Documentation
¶
Overview ¶
Package scheduled provides scheduled status management services for the Lesser ActivityPub server.
This service handles all operations related to scheduled statuses including: - Creating and scheduling posts for future publication - Managing scheduled status updates and deletions - Processing scheduled statuses at their scheduled time - Handling media attachments for scheduled posts
Index ¶
- type CreateScheduledStatusCommand
- type DeleteScheduledStatusCommand
- type GetScheduledStatusQuery
- type ListScheduledStatusesQuery
- type PublishScheduledStatusCommand
- type Service
- func (s *Service) CreateScheduledStatus(ctx context.Context, cmd *CreateScheduledStatusCommand) (*StatusResult, error)
- func (s *Service) DeleteScheduledStatus(ctx context.Context, cmd *DeleteScheduledStatusCommand) error
- func (s *Service) GetScheduledMediaAttachments(ctx context.Context, scheduledStatusID string) ([]*models.Media, error)
- func (s *Service) GetScheduledStatus(ctx context.Context, query *GetScheduledStatusQuery) (*StatusResult, error)
- func (s *Service) ListScheduledStatuses(ctx context.Context, query *ListScheduledStatusesQuery) (*StatusListResult, error)
- func (s *Service) PublishScheduledStatus(ctx context.Context, cmd *PublishScheduledStatusCommand) error
- func (s *Service) UpdateScheduledStatus(ctx context.Context, cmd *UpdateScheduledStatusCommand) (*StatusResult, error)
- type StatusListResult
- type StatusResult
- type UpdateScheduledStatusCommand
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CreateScheduledStatusCommand ¶
type CreateScheduledStatusCommand struct {
Username string `json:"username" validate:"required"`
Status string `json:"status" validate:"required,min=1,max=500"`
MediaIDs []string `json:"media_ids"`
Sensitive bool `json:"sensitive"`
SpoilerText string `json:"spoiler_text"`
Visibility string `json:"visibility"`
Language string `json:"language"`
InReplyToID string `json:"in_reply_to_id"`
Poll map[string]any `json:"poll"`
ScheduledAt time.Time `json:"scheduled_at" validate:"required"`
ApplicationID string `json:"application_id"`
}
CreateScheduledStatusCommand contains data needed to create a scheduled status
type DeleteScheduledStatusCommand ¶
type DeleteScheduledStatusCommand struct {
ID string `json:"id" validate:"required"`
Username string `json:"username" validate:"required"` // For ownership verification
}
DeleteScheduledStatusCommand contains data needed to delete a scheduled status
type GetScheduledStatusQuery ¶
type GetScheduledStatusQuery struct {
ID string `json:"id" validate:"required"`
Username string `json:"username"` // For ownership verification
}
GetScheduledStatusQuery contains parameters for retrieving a single scheduled status
type ListScheduledStatusesQuery ¶
type ListScheduledStatusesQuery struct {
Username string `json:"username" validate:"required"`
Pagination interfaces.PaginationOptions `json:"pagination"`
}
ListScheduledStatusesQuery contains parameters for listing scheduled statuses
type PublishScheduledStatusCommand ¶
type PublishScheduledStatusCommand struct {
ID string `json:"id" validate:"required"`
}
PublishScheduledStatusCommand contains data needed to publish a scheduled status
type Service ¶
type Service struct {
// contains filtered or unexported fields
}
Service provides business logic for scheduled status operations
func NewService ¶
func NewService( scheduledRepo scheduledStatusRepository, statusRepo interfaces.StatusRepository, mediaRepo mediaRepository, publisher streaming.Publisher, logger *zap.Logger, domain string, ) *Service
NewService creates a new scheduled status service
func (*Service) CreateScheduledStatus ¶
func (s *Service) CreateScheduledStatus(ctx context.Context, cmd *CreateScheduledStatusCommand) (*StatusResult, error)
CreateScheduledStatus creates a new scheduled status
func (*Service) DeleteScheduledStatus ¶
func (s *Service) DeleteScheduledStatus(ctx context.Context, cmd *DeleteScheduledStatusCommand) error
DeleteScheduledStatus deletes a scheduled status
func (*Service) GetScheduledMediaAttachments ¶
func (s *Service) GetScheduledMediaAttachments(ctx context.Context, scheduledStatusID string) ([]*models.Media, error)
GetScheduledMediaAttachments retrieves media attachments for a scheduled status
func (*Service) GetScheduledStatus ¶
func (s *Service) GetScheduledStatus(ctx context.Context, query *GetScheduledStatusQuery) (*StatusResult, error)
GetScheduledStatus retrieves a single scheduled status by ID
func (*Service) ListScheduledStatuses ¶
func (s *Service) ListScheduledStatuses(ctx context.Context, query *ListScheduledStatusesQuery) (*StatusListResult, error)
ListScheduledStatuses retrieves all scheduled statuses for a user
func (*Service) PublishScheduledStatus ¶
func (s *Service) PublishScheduledStatus(ctx context.Context, cmd *PublishScheduledStatusCommand) error
PublishScheduledStatus publishes a scheduled status immediately or at its scheduled time
func (*Service) UpdateScheduledStatus ¶
func (s *Service) UpdateScheduledStatus(ctx context.Context, cmd *UpdateScheduledStatusCommand) (*StatusResult, error)
UpdateScheduledStatus updates a scheduled status (currently only scheduled time)
type StatusListResult ¶
type StatusListResult struct {
ScheduledStatuses []*storage.ScheduledStatus `json:"scheduled_statuses"`
Pagination *interfaces.PaginatedResult[string] `json:"pagination"`
Events []*streaming.Event `json:"events"`
}
StatusListResult contains multiple scheduled statuses
type StatusResult ¶
type StatusResult struct {
ScheduledStatus *storage.ScheduledStatus `json:"scheduled_status"`
MediaAttachments []*models.Media `json:"media_attachments,omitempty"`
Events []*streaming.Event `json:"events"`
}
StatusResult contains a single scheduled status
type UpdateScheduledStatusCommand ¶
type UpdateScheduledStatusCommand struct {
ID string `json:"id" validate:"required"`
Username string `json:"username" validate:"required"` // For ownership verification
ScheduledAt *time.Time `json:"scheduled_at"`
}
UpdateScheduledStatusCommand contains data needed to update a scheduled status