Documentation ¶
Overview ¶
Package services provides mechanisms for working with statusthingv1.StatusThing and related operations
nolint: revive TODO: remove nolint after finishing implementations
nolint: revive
Index ¶
- type ServiceOption
- type StatusThingService
- func (sts *StatusThingService) AddItem(ctx context.Context, name string, opts ...filters.FilterOption) (*statusthingv1.Item, error)
- func (sts *StatusThingService) AddNote(ctx context.Context, itemID, noteText string) (*statusthingv1.Note, error)
- func (sts *StatusThingService) AddStatus(ctx context.Context, statusName string, statusKind statusthingv1.StatusKind, ...) (*statusthingv1.Status, error)
- func (sts *StatusThingService) AddUser(ctx context.Context, username string, password string, emailAddress string, ...) (*v1.User, error)
- func (sts *StatusThingService) ChangePassword(ctx context.Context, username string, currPass string, newPass string) error
- func (sts *StatusThingService) CheckPassword(ctx context.Context, username string, password string) (*v1.User, error)
- func (sts *StatusThingService) CreateDefaultStatuses() error
- func (sts *StatusThingService) EditItem(ctx context.Context, itemID string, opts ...filters.FilterOption) error
- func (sts *StatusThingService) EditNote(ctx context.Context, noteID, noteText string, opts ...filters.FilterOption) error
- func (sts *StatusThingService) EditStatus(ctx context.Context, statusID string, opts ...filters.FilterOption) error
- func (sts *StatusThingService) EditUser(ctx context.Context, username string, opts ...filters.FilterOption) error
- func (sts *StatusThingService) FindItems(ctx context.Context, opts ...filters.FilterOption) ([]*statusthingv1.Item, error)
- func (sts *StatusThingService) FindNotes(ctx context.Context, itemID string) ([]*statusthingv1.Note, error)
- func (sts *StatusThingService) FindStatus(ctx context.Context, opts ...filters.FilterOption) ([]*statusthingv1.Status, error)
- func (sts *StatusThingService) GetCreatedDefaults() []*statusthingv1.Status
- func (sts *StatusThingService) GetItem(ctx context.Context, itemID string) (*statusthingv1.Item, error)
- func (sts *StatusThingService) GetNote(ctx context.Context, noteID string) (*statusthingv1.Note, error)
- func (sts *StatusThingService) GetStatus(ctx context.Context, statusID string) (*statusthingv1.Status, error)
- func (sts *StatusThingService) GetUser(ctx context.Context, username string) (*v1.User, error)
- func (sts *StatusThingService) RemoveItem(ctx context.Context, itemID string) error
- func (sts *StatusThingService) RemoveNote(ctx context.Context, noteID string) error
- func (sts *StatusThingService) RemoveStatus(ctx context.Context, statusID string) error
- func (sts *StatusThingService) RemoveUser(ctx context.Context, username string) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ServiceOption ¶
type ServiceOption func(s *StatusThingService) error
ServiceOption is a functional option for configuring a StatusThingService
func WithDefaults ¶
func WithDefaults() ServiceOption
WithDefaults triggers adding default data at creation time
type StatusThingService ¶
type StatusThingService struct {
// contains filtered or unexported fields
}
StatusThingService is a domain service for statusthingv1.StatusThing and related items
func NewStatusThingService ¶
func NewStatusThingService(store storers.StatusThingStorer, opts ...ServiceOption) (*StatusThingService, error)
NewStatusThingService returns a new StatusThingService
func (*StatusThingService) AddItem ¶
func (sts *StatusThingService) AddItem(ctx context.Context, name string, opts ...filters.FilterOption) (*statusthingv1.Item, error)
AddItem creates a new item with the provided name Supported options: - filters.WithStatusID set the initial status to the statusthingv1.Status with provided status id - filters.WithDescription sets the optional description of the statusthingv1.Item - filters.WithItemID sets a custom unique id. default is generated via [ksuid.New().String()] - filters.WithNoteText sets the note text for an initial note to create along with the item - filters.WithStatus creates a new statusthingv1.Status before creating the item and sets the items status to that new status
func (*StatusThingService) AddNote ¶
func (sts *StatusThingService) AddNote(ctx context.Context, itemID, noteText string) (*statusthingv1.Note, error)
AddNote adds the provided text as a statusthingv1.Note to the statusthingv1.Item with the provided id
func (*StatusThingService) AddStatus ¶
func (sts *StatusThingService) AddStatus(ctx context.Context, statusName string, statusKind statusthingv1.StatusKind, opts ...filters.FilterOption) (*statusthingv1.Status, error)
AddStatus adds a new statusthingv1.CustomStatus with the provided name and statusthingv1.StatusKind supported filters: - filters.WithColor - filters.WithDescription
func (*StatusThingService) AddUser ¶
func (sts *StatusThingService) AddUser(ctx context.Context, username string, password string, emailAddress string, opts ...filters.FilterOption) (*v1.User, error)
AddUser creates a new user
func (*StatusThingService) ChangePassword ¶
func (sts *StatusThingService) ChangePassword(ctx context.Context, username string, currPass string, newPass string) error
ChangePassword changes the password
func (*StatusThingService) CheckPassword ¶
func (sts *StatusThingService) CheckPassword(ctx context.Context, username string, password string) (*v1.User, error)
CheckPassword validates the password for the supplied userid
func (*StatusThingService) CreateDefaultStatuses ¶
func (sts *StatusThingService) CreateDefaultStatuses() error
func (*StatusThingService) EditItem ¶
func (sts *StatusThingService) EditItem(ctx context.Context, itemID string, opts ...filters.FilterOption) error
EditItem updates the statusthingv1.Item with the provided id
func (*StatusThingService) EditNote ¶
func (sts *StatusThingService) EditNote(ctx context.Context, noteID, noteText string, opts ...filters.FilterOption) error
EditNote edits the statusthingv1.Note with provided id to set the text to provided text supported opts: filters.WithTimestamps to override the timestamps (generally for testing)
func (*StatusThingService) EditStatus ¶
func (sts *StatusThingService) EditStatus(ctx context.Context, statusID string, opts ...filters.FilterOption) error
EditStatus updates a [statusthingv1.tatus] by its id
func (*StatusThingService) EditUser ¶
func (sts *StatusThingService) EditUser(ctx context.Context, username string, opts ...filters.FilterOption) error
EditUser edits the user
func (*StatusThingService) FindItems ¶
func (sts *StatusThingService) FindItems(ctx context.Context, opts ...filters.FilterOption) ([]*statusthingv1.Item, error)
FindItems returns all known statusthingv1.Item supported filters: - filters.WithStatusIDs: only return results having the provided status ids - filters.WithStatusKinds: only return restuls having the provided status kinds StatusIDs and StatusKinds are mutually exclusive
func (*StatusThingService) FindNotes ¶
func (sts *StatusThingService) FindNotes(ctx context.Context, itemID string) ([]*statusthingv1.Note, error)
FindNotes returns all statusthingv1.Note belonging to statusthingv1.Item with provided id
func (*StatusThingService) FindStatus ¶
func (sts *StatusThingService) FindStatus(ctx context.Context, opts ...filters.FilterOption) ([]*statusthingv1.Status, error)
FindStatus gets all statusthingv1.Status
func (*StatusThingService) GetCreatedDefaults ¶
func (sts *StatusThingService) GetCreatedDefaults() []*statusthingv1.Status
GetCreatedDefaults gets the default status that were created if requested
func (*StatusThingService) GetItem ¶
func (sts *StatusThingService) GetItem(ctx context.Context, itemID string) (*statusthingv1.Item, error)
GetItem gets a statusthingv1.Item by id
func (*StatusThingService) GetNote ¶
func (sts *StatusThingService) GetNote(ctx context.Context, noteID string) (*statusthingv1.Note, error)
GetNote gets a statusthingv1.Note by id
func (*StatusThingService) GetStatus ¶
func (sts *StatusThingService) GetStatus(ctx context.Context, statusID string) (*statusthingv1.Status, error)
GetStatus gets a statusthingv1.Status by id
func (*StatusThingService) RemoveItem ¶
func (sts *StatusThingService) RemoveItem(ctx context.Context, itemID string) error
RemoveItem removes a statusthingv1.Item by its unique id
func (*StatusThingService) RemoveNote ¶
func (sts *StatusThingService) RemoveNote(ctx context.Context, noteID string) error
RemoveNote removes the statusthingv1.Note with the provided id from the statusthingv1.Item with the provided id
func (*StatusThingService) RemoveStatus ¶
func (sts *StatusThingService) RemoveStatus(ctx context.Context, statusID string) error
RemoveStatus removes a statusthingv1.Status by its unique id
func (*StatusThingService) RemoveUser ¶
func (sts *StatusThingService) RemoveUser(ctx context.Context, username string) error
RemoveUser removes the user