application

package
v1.25.0 Latest Latest
Warning

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

Go to latest
Published: Jun 17, 2026 License: MIT Imports: 22 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 Approved = State{
	Name:      "APPROVED",
	EnterFunc: ApproveBundle,
}
View Source
var Draft = State{
	Name:      "DRAFT",
	EnterFunc: DraftBundle,
}
View Source
var InReview = State{
	Name:      "IN_REVIEW",
	EnterFunc: ReviewBundle,
}
View Source
var Published = State{
	Name:      "PUBLISHED",
	EnterFunc: PublishBundle,
}

list of states for the state machine

Functions

func ApproveBundle added in v1.22.0

func ApproveBundle(ctx context.Context, smBundle StateMachineBundleAPI, bundle *models.Bundle, authEntityData *models.AuthEntityData) (*models.Bundle, error)

func DraftBundle added in v1.22.0

func DraftBundle(ctx context.Context, smBundle StateMachineBundleAPI, bundle *models.Bundle, authEntityData *models.AuthEntityData) (*models.Bundle, error)

func PublishBundle added in v1.22.0

func PublishBundle(ctx context.Context, smBundle StateMachineBundleAPI, bundle *models.Bundle, authEntityData *models.AuthEntityData) (*models.Bundle, error)

func PublishContentItems added in v1.22.0

func PublishContentItems(ctx context.Context, smBundle StateMachineBundleAPI, authEntityData *models.AuthEntityData, contentItem *models.ContentItem, ch chan string, wg *sync.WaitGroup, state, bundleTitle string, errCh chan error)

func ReviewBundle added in v1.22.0

func ReviewBundle(ctx context.Context, smBundle StateMachineBundleAPI, bundle *models.Bundle, authEntityData *models.AuthEntityData) (*models.Bundle, error)

func UpdateContentItemCreateEvent added in v1.22.0

func UpdateContentItemCreateEvent(ctx context.Context, smBundle StateMachineBundleAPI, authEntityData *models.AuthEntityData, contentItem *models.ContentItem, state string) error

Types

type State

type State struct {
	Name      string
	EnterFunc func(ctx context.Context, smBundle StateMachineBundleAPI, bundle *models.Bundle, authEntityData *models.AuthEntityData) (*models.Bundle, error)
}

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, datasetAPIClient datasetAPISDK.Clienter) *StateMachine

func (*StateMachine) Transition

func (sm *StateMachine) Transition(ctx context.Context, stateMachineBundleAPI *StateMachineBundleAPI, currentBundle *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
	PreviewServiceURL     string
}

func Setup

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

func (*StateMachineBundleAPI) AddPolicyConditionsForAddedPreviewTeams added in v1.19.0

func (s *StateMachineBundleAPI) AddPolicyConditionsForAddedPreviewTeams(ctx context.Context, authToken, bundleID string, currentTeams, updatedTeams *[]models.PreviewTeam) error

AddPolicyConditionsForAddedPreviewTeams adds policy conditions for teams that have been added to the bundle during a PUT bundle update

func (*StateMachineBundleAPI) AddPolicyConditionsForContentItem added in v1.14.0

func (s *StateMachineBundleAPI) AddPolicyConditionsForContentItem(ctx context.Context, authToken string, bundle *models.Bundle, contentItem *models.ContentItem) error

AddPolicyConditionsForContentItem adds policy conditions for all preview teams in a bundle when a content item is added

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 *models.Bundle, authEntityData *models.AuthEntityData, eTag string) (*models.Bundle, error)

func (*StateMachineBundleAPI) RemovePolicyConditionsForContentItem added in v1.14.0

func (s *StateMachineBundleAPI) RemovePolicyConditionsForContentItem(ctx context.Context, authToken string, bundle *models.Bundle, contentItem *models.ContentItem) error

RemovePolicyConditionsForContentItem removes policy conditions for all preview teams in a bundle when a content item is removed

func (*StateMachineBundleAPI) RemovePolicyConditionsForRemovedPreviewTeams added in v1.19.0

func (s *StateMachineBundleAPI) RemovePolicyConditionsForRemovedPreviewTeams(ctx context.Context, authToken, bundleID string, currentTeams, updatedTeams *[]models.PreviewTeam) error

RemovePolicyConditionsForRemovedPreviewTeams removes policy conditions for teams that have been removed from the bundle during a PUT bundle update.

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

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