application

package
v1.13.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 8, 2026 License: MIT Imports: 19 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	Draft     = State{Name: "DRAFT"}
	InReview  = State{Name: "IN_REVIEW"}
	Approved  = State{Name: "APPROVED"}
	Published = State{Name: "PUBLISHED"}
)

list of states for the state machine

Functions

This section is empty.

Types

type State

type State struct {
	Name string
}

func (State) String

func (s State) String() string

type StateMachine

type StateMachine struct {
	// contains filtered or unexported fields
}

func NewStateMachine

func NewStateMachine(ctx context.Context, states []State, transitions []Transition, datastore store.Datastore) *StateMachine

func (*StateMachine) IsValidTransition added in v1.4.0

func (sm *StateMachine) IsValidTransition(ctx context.Context, sourceState, targetState *models.BundleState) error

IsValidTransition validates whether the sourceState can transition to the targetState. If not, an error is returned

func (*StateMachine) Transition

func (sm *StateMachine) Transition(ctx context.Context, stateMachineBundleAPI *StateMachineBundleAPI, currentBundle, bundleUpdate *models.Bundle) error

func (*StateMachine) TransitionBundle added in v1.4.0

func (sm *StateMachine) TransitionBundle(ctx context.Context, stateMachineBundleAPI *StateMachineBundleAPI, bundle *models.Bundle, targetState *models.BundleState, authEntityData *models.AuthEntityData) (*models.Bundle, error)

type StateMachineBundleAPI

type StateMachineBundleAPI struct {
	Datastore             store.Datastore
	StateMachine          *StateMachine
	DatasetAPIClient      datasetAPISDK.Clienter
	PermissionsAPIClient  permissionsAPISDK.Clienter
	DataBundleSlackClient slack.Clienter
}

func Setup

func Setup(datastore store.Datastore, stateMachine *StateMachine, datasetAPIClient datasetAPISDK.Clienter, permissionsAPIClient permissionsAPISDK.Clienter, dataBundleSlackClient slack.Clienter) *StateMachineBundleAPI

func (*StateMachineBundleAPI) CheckAllBundleContentsAreApproved

func (s *StateMachineBundleAPI) CheckAllBundleContentsAreApproved(ctx context.Context, bundleID string) (bool, error)

func (*StateMachineBundleAPI) CheckBundleExists added in v1.3.0

func (s *StateMachineBundleAPI) CheckBundleExists(ctx context.Context, bundleID string) (bool, error)

func (*StateMachineBundleAPI) CheckBundleExistsByTitle added in v1.4.0

func (s *StateMachineBundleAPI) CheckBundleExistsByTitle(ctx context.Context, title string) (bool, error)

func (*StateMachineBundleAPI) CheckBundleExistsByTitleUpdate added in v1.4.0

func (s *StateMachineBundleAPI) CheckBundleExistsByTitleUpdate(ctx context.Context, title, excludeID string) (bool, error)

func (*StateMachineBundleAPI) CheckContentItemExistsByDatasetEditionVersion added in v1.3.0

func (s *StateMachineBundleAPI) CheckContentItemExistsByDatasetEditionVersion(ctx context.Context, datasetID, editionID string, versionID int) (bool, error)

func (*StateMachineBundleAPI) CheckPolicyExists added in v1.13.0

func (s *StateMachineBundleAPI) CheckPolicyExists(ctx context.Context, authToken, policyID string) (bool, error)

CheckPolicyExists checks if a policy with the given ID exists

func (*StateMachineBundleAPI) CreateBundle added in v1.4.0

func (s *StateMachineBundleAPI) CreateBundle(ctx context.Context, bundle *models.Bundle, authEntityData *models.AuthEntityData) (int, *models.Bundle, *models.Error, error)

func (*StateMachineBundleAPI) CreateBundlePolicies added in v1.12.0

func (s *StateMachineBundleAPI) CreateBundlePolicies(ctx context.Context, authToken string, previewTeams *[]models.PreviewTeam, role models.Role) error

CreateBundlePolicies creates a new policy for each preview team with the provided role

func (*StateMachineBundleAPI) CreateContentItem added in v1.3.0

func (s *StateMachineBundleAPI) CreateContentItem(ctx context.Context, contentItem *models.ContentItem) error

func (*StateMachineBundleAPI) CreateEvent added in v1.10.0

func (s *StateMachineBundleAPI) CreateEvent(ctx context.Context, authEntityData *models.AuthEntityData, action models.Action, bundle *models.Bundle, contentItem *models.ContentItem) error

func (*StateMachineBundleAPI) DeleteBundle added in v1.4.0

func (s *StateMachineBundleAPI) DeleteBundle(ctx context.Context, bundleID string, authEntityData *models.AuthEntityData) (int, *models.Error, error)

func (*StateMachineBundleAPI) DeleteContentItem added in v1.4.0

func (s *StateMachineBundleAPI) DeleteContentItem(ctx context.Context, contentItemID string) error

func (*StateMachineBundleAPI) GetBundle added in v1.3.0

func (s *StateMachineBundleAPI) GetBundle(ctx context.Context, bundleID string) (*models.Bundle, error)

func (*StateMachineBundleAPI) GetBundleAndValidateETag added in v1.4.0

func (s *StateMachineBundleAPI) GetBundleAndValidateETag(ctx context.Context, bundleID, suppliedETag string) (*models.Bundle, error)

func (*StateMachineBundleAPI) GetBundleContents added in v1.4.0

func (s *StateMachineBundleAPI) GetBundleContents(ctx context.Context, bundleID string, offset, limit int, authHeaders datasetAPISDK.Headers) ([]*models.ContentItem, int, error)

func (*StateMachineBundleAPI) GetContentItemByBundleIDAndContentItemID added in v1.4.0

func (s *StateMachineBundleAPI) GetContentItemByBundleIDAndContentItemID(ctx context.Context, bundleID, contentItemID string) (*models.ContentItem, error)

func (*StateMachineBundleAPI) GetContentItemsByBundleID added in v1.4.0

func (s *StateMachineBundleAPI) GetContentItemsByBundleID(ctx context.Context, bundleID string) ([]*models.ContentItem, error)

func (*StateMachineBundleAPI) ListBundleEvents added in v1.3.0

func (s *StateMachineBundleAPI) ListBundleEvents(ctx context.Context, offset, limit int, bundleID string, after, before *time.Time) ([]*models.Event, int, error)

func (*StateMachineBundleAPI) ListBundles

func (s *StateMachineBundleAPI) ListBundles(ctx context.Context, offset, limit int, bundleFilters *filters.BundleFilters) ([]*models.Bundle, int, error)

func (*StateMachineBundleAPI) PutBundle added in v1.4.0

func (s *StateMachineBundleAPI) PutBundle(ctx context.Context, bundleID string, bundleUpdate, currentBundle *models.Bundle, authEntityData *models.AuthEntityData) (*models.Bundle, error)

func (*StateMachineBundleAPI) UpdateBundle added in v1.4.0

func (s *StateMachineBundleAPI) UpdateBundle(ctx context.Context, bundleID string, bundle *models.Bundle) (*models.Bundle, error)

func (*StateMachineBundleAPI) UpdateBundleETag added in v1.3.0

func (s *StateMachineBundleAPI) UpdateBundleETag(ctx context.Context, bundleID, email string) (*models.Bundle, error)

func (*StateMachineBundleAPI) UpdateBundleState added in v1.4.0

func (s *StateMachineBundleAPI) UpdateBundleState(ctx context.Context, bundleID, suppliedETag string, targetState models.BundleState, authEntityData *models.AuthEntityData) (*models.Bundle, error)

func (*StateMachineBundleAPI) UpdateContentItemDatasetInfo added in v1.4.0

func (s *StateMachineBundleAPI) UpdateContentItemDatasetInfo(ctx context.Context, contentItemID, title, state string) error

func (*StateMachineBundleAPI) UpdateContentItemsWithDatasetInfo added in v1.4.0

func (s *StateMachineBundleAPI) UpdateContentItemsWithDatasetInfo(ctx context.Context, bundleID string, authHeaders datasetAPISDK.Headers) error

func (*StateMachineBundleAPI) UpdateDatasetVersionReleaseDate added in v1.10.0

func (s *StateMachineBundleAPI) UpdateDatasetVersionReleaseDate(ctx context.Context, releaseDate *time.Time, datasetID, editionID string, versionID int, authHeaders datasetAPISDK.Headers) error

func (*StateMachineBundleAPI) ValidateBundleRules added in v1.4.0

func (s *StateMachineBundleAPI) ValidateBundleRules(ctx context.Context, bundleUpdate, currentBundle *models.Bundle) []*models.Error

ValidateBundleRules validates the rules for bundle updates

func (*StateMachineBundleAPI) ValidateScheduledAt added in v1.4.0

func (s *StateMachineBundleAPI) ValidateScheduledAt(bundle *models.Bundle) error

type Transition

type Transition struct {
	Label               string
	TargetState         State
	AllowedSourceStates []string
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL