handlers

package
v1.1.15 Latest Latest
Warning

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

Go to latest
Published: Feb 21, 2026 License: AGPL-3.0 Imports: 22 Imported by: 0

Documentation

Overview

Package handlers provides WebSocket command handlers for different domains

Package handlers provides WebSocket command handlers for async operations

Package handlers provides WebSocket command handlers for different domains

Package handlers provides WebSocket command handlers for different domains

Package handlers provides WebSocket command handlers for different domains

Package handlers provides WebSocket command handlers for system/utility commands

Index

Constants

View Source
const (
	StatusProcessing = "processing"
	StatusCompleted  = "completed"
)

Constants for operation statuses

Variables

This section is empty.

Functions

func ExecuteGenericCommand

func ExecuteGenericCommand(
	ctx context.Context,
	handler *streaming.BaseCommandHandler,
	conn *streaming.ConnectionInfo,
	cmd *streaming.Command,
	executor CommandExecutor,
	errorCode string,
) (*streaming.CommandResponse, error)

ExecuteGenericCommand provides a generic execution flow for commands

Types

type AccountCommandHandler

type AccountCommandHandler struct {
	*streaming.BaseCommandHandler
	// contains filtered or unexported fields
}

AccountCommandHandler handles WebSocket commands related to accounts/users

func NewAccountCommandHandler

func NewAccountCommandHandler(accountsService *accounts.Service, logger *zap.Logger) *AccountCommandHandler

NewAccountCommandHandler creates a new account command handler

func (*AccountCommandHandler) GetSupportedCommands

func (ach *AccountCommandHandler) GetSupportedCommands() []string

GetSupportedCommands returns the list of commands this handler supports

func (*AccountCommandHandler) HandleCommand

HandleCommand processes account-related WebSocket commands

type AsyncCommandHandler

type AsyncCommandHandler struct {
	*streaming.BaseCommandHandler
	// contains filtered or unexported fields
}

AsyncCommandHandler handles WebSocket commands for async operations (bulk ops, import/export)

func NewAsyncCommandHandler

func NewAsyncCommandHandler(
	bulkService BulkService,
	importExportService ImportExportService,
	relationshipsService RelationshipsService,
	publisher streaming.Publisher,
	logger *zap.Logger,
) *AsyncCommandHandler

NewAsyncCommandHandler creates a new async command handler

func (*AsyncCommandHandler) GetSupportedCommands

func (ach *AsyncCommandHandler) GetSupportedCommands() []string

GetSupportedCommands returns the list of commands this handler supports

func (*AsyncCommandHandler) HandleCommand

HandleCommand processes async-related WebSocket commands

type BulkService

type BulkService interface {
	BulkFollow(ctx context.Context, cmd *bulk.FollowCommand) (*bulk.OperationResult, error)
	BulkDeleteStatuses(ctx context.Context, cmd *bulk.DeleteStatusesCommand) (*bulk.OperationResult, error)
	GetOperation(ctx context.Context, query *bulk.GetOperationQuery) (*bulk.OperationResult, error)

	// Bulk Content Management Operations
	BulkDelete(ctx context.Context, cmd *bulk.DeleteCommand) (*bulk.OperationResult, error)
	BulkArchive(ctx context.Context, cmd *bulk.ArchiveCommand) (*bulk.OperationResult, error)
	BulkRestore(ctx context.Context, cmd *bulk.RestoreCommand) (*bulk.OperationResult, error)
	BulkExport(ctx context.Context, cmd *bulk.ExportCommand) (*bulk.OperationResult, error)
	BulkListMembers(ctx context.Context, cmd *bulk.ListMembersCommand) (*bulk.OperationResult, error)

	// Bulk Moderation Operations
	BulkUnblock(ctx context.Context, cmd *bulk.UnblockCommand) (*bulk.OperationResult, error)
	BulkMute(ctx context.Context, cmd *bulk.MuteCommand) (*bulk.OperationResult, error)
	BulkBlock(ctx context.Context, cmd *bulk.BlockCommand) (*bulk.OperationResult, error)
}

BulkService defines the interface for bulk operations

type CommandExecutor

type CommandExecutor interface {
	// RequiresAuth returns true if the command requires authentication
	RequiresAuth() bool

	// RequiredFields returns the list of required fields for validation
	RequiredFields() []string

	// BuildCommand builds the service command from the WebSocket command payload
	BuildCommand(conn *streaming.ConnectionInfo, payload map[string]interface{}) interface{}

	// Execute executes the service command and returns the result
	Execute(ctx context.Context, serviceCmd interface{}) (interface{}, error)

	// FormatResponse formats the service result for WebSocket response
	FormatResponse(result interface{}) (map[string]interface{}, error)
}

CommandExecutor defines the interface for executing service commands

type ImportExportService

ImportExportService defines the interface for import/export operations

type RelationshipCommandHandler

type RelationshipCommandHandler struct {
	*streaming.BaseCommandHandler
	// contains filtered or unexported fields
}

RelationshipCommandHandler handles WebSocket commands related to relationships

func NewRelationshipCommandHandler

func NewRelationshipCommandHandler(relationshipsService *relationships.Service, accountsService *accounts.Service, logger *zap.Logger) *RelationshipCommandHandler

NewRelationshipCommandHandler creates a new relationship command handler

func (*RelationshipCommandHandler) GetSupportedCommands

func (rch *RelationshipCommandHandler) GetSupportedCommands() []string

GetSupportedCommands returns the list of commands this handler supports

func (*RelationshipCommandHandler) HandleCommand

HandleCommand processes relationship-related WebSocket commands

type RelationshipsService

RelationshipsService defines the interface for relationship operations needed by async handlers.

type SimpleStatusExecutor

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

SimpleStatusExecutor handles simple status operations that follow a common pattern

func NewSimpleStatusExecutor

func NewSimpleStatusExecutor(
	requiresAuth bool,
	requiredFields []string,
	commandBuilder func(*streaming.ConnectionInfo, map[string]interface{}) interface{},
	executor func(context.Context, interface{}) (interface{}, error),
	responseKey string,
) *SimpleStatusExecutor

NewSimpleStatusExecutor creates a new simple status executor

func (*SimpleStatusExecutor) BuildCommand

func (e *SimpleStatusExecutor) BuildCommand(conn *streaming.ConnectionInfo, payload map[string]interface{}) interface{}

BuildCommand builds the service command from the WebSocket command payload

func (*SimpleStatusExecutor) Execute

func (e *SimpleStatusExecutor) Execute(ctx context.Context, serviceCmd interface{}) (interface{}, error)

Execute executes the service command and returns the result

func (*SimpleStatusExecutor) FormatResponse

func (e *SimpleStatusExecutor) FormatResponse(result interface{}) (map[string]interface{}, error)

FormatResponse formats the service result for WebSocket response

func (*SimpleStatusExecutor) RequiredFields

func (e *SimpleStatusExecutor) RequiredFields() []string

RequiredFields returns the list of required fields for validation

func (*SimpleStatusExecutor) RequiresAuth

func (e *SimpleStatusExecutor) RequiresAuth() bool

RequiresAuth returns whether this command requires authentication

type StatusCommandHandlerV2

type StatusCommandHandlerV2 struct {
	*streaming.BaseCommandHandler
	// contains filtered or unexported fields
}

StatusCommandHandlerV2 handles WebSocket commands related to statuses/notes with reduced duplication

func NewStatusCommandHandlerV2

func NewStatusCommandHandlerV2(notesService *notes.Service, logger *zap.Logger) *StatusCommandHandlerV2

NewStatusCommandHandlerV2 creates a new status command handler with reduced duplication

func (*StatusCommandHandlerV2) GetSupportedCommands

func (sch *StatusCommandHandlerV2) GetSupportedCommands() []string

GetSupportedCommands returns the list of commands this handler supports

func (*StatusCommandHandlerV2) HandleCommand

HandleCommand processes status-related WebSocket commands with reduced duplication

type SystemCommandHandler

type SystemCommandHandler struct {
	*streaming.BaseCommandHandler
	// contains filtered or unexported fields
}

SystemCommandHandler handles WebSocket commands for system-level operations

func NewSystemCommandHandler

func NewSystemCommandHandler(
	notesService *notes.Service,
	listsService *lists.Service,
	mediaService mediaUploader,
	notificationsService *notifications.Service,
	logger *zap.Logger,
) *SystemCommandHandler

NewSystemCommandHandler creates a new system command handler

func (*SystemCommandHandler) GetSupportedCommands

func (sch *SystemCommandHandler) GetSupportedCommands() []string

GetSupportedCommands returns the list of commands this handler supports

func (*SystemCommandHandler) HandleCommand

HandleCommand processes system-related WebSocket commands

Jump to

Keyboard shortcuts

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