Documentation
¶
Overview ¶
Package emoji provides custom emoji management services for the Lesser ActivityPub server.
This service handles all operations related to custom emojis including: - Creating, updating, and deleting custom emojis - Retrieving emojis for display in the UI - Managing emoji categories and visibility - Handling federation of custom emojis from remote instances
Index ¶
- type CopyEmojiCommand
- type CreateEmojiCommand
- type DeleteEmojiCommand
- type GetEmojiQuery
- type GetPopularEmojisQuery
- type IncrementUsageCommand
- type ListEmojisQuery
- type ListResult
- type Result
- type SearchEmojisQuery
- type Service
- func (s *Service) CopyRemoteEmoji(ctx context.Context, cmd *CopyEmojiCommand) (*Result, error)
- func (s *Service) CreateEmoji(ctx context.Context, cmd *CreateEmojiCommand) (*Result, error)
- func (s *Service) DeleteEmoji(ctx context.Context, cmd *DeleteEmojiCommand) error
- func (s *Service) GetEmoji(ctx context.Context, query *GetEmojiQuery) (*storage.CustomEmoji, error)
- func (s *Service) GetPopularEmojis(ctx context.Context, query *GetPopularEmojisQuery) (*ListResult, error)
- func (s *Service) IncrementUsage(ctx context.Context, cmd *IncrementUsageCommand) error
- func (s *Service) ListEmojis(ctx context.Context, query *ListEmojisQuery) (*ListResult, error)
- func (s *Service) SearchEmojis(ctx context.Context, query *SearchEmojisQuery) (*ListResult, error)
- func (s *Service) UpdateEmoji(ctx context.Context, cmd *UpdateEmojiCommand) (*Result, error)
- type UpdateEmojiCommand
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CopyEmojiCommand ¶
type CopyEmojiCommand struct {
Shortcode string `json:"shortcode" validate:"required"`
Domain string `json:"domain" validate:"required"`
NewShortcode string `json:"new_shortcode"` // Optional, use original if not provided
}
CopyEmojiCommand contains data needed to copy a remote emoji
type CreateEmojiCommand ¶
type CreateEmojiCommand struct {
Shortcode string `json:"shortcode" validate:"required,min=2,max=30"`
ImageURL string `json:"image_url" validate:"required,url"`
Category string `json:"category"`
VisibleInPicker bool `json:"visible_in_picker"`
}
CreateEmojiCommand contains data needed to create a new emoji
type DeleteEmojiCommand ¶
type DeleteEmojiCommand struct {
Shortcode string `json:"shortcode" validate:"required"`
}
DeleteEmojiCommand contains data needed to delete an emoji
type GetEmojiQuery ¶
type GetEmojiQuery struct {
Shortcode string `json:"shortcode" validate:"required"`
}
GetEmojiQuery contains parameters for retrieving a single emoji
type GetPopularEmojisQuery ¶
type GetPopularEmojisQuery struct {
Domain string `json:"domain"` // Optional, empty for local emojis
Limit int `json:"limit"`
}
GetPopularEmojisQuery contains parameters for getting popular emojis
type IncrementUsageCommand ¶
type IncrementUsageCommand struct {
Shortcode string `json:"shortcode" validate:"required"`
}
IncrementUsageCommand contains data needed to increment emoji usage
type ListEmojisQuery ¶
type ListEmojisQuery struct {
OnlyLocal bool `json:"only_local"` // Only show local emojis
OnlyVisible bool `json:"only_visible"` // Only show visible emojis
Category string `json:"category"` // Filter by category
IncludeDisabled bool `json:"include_disabled"` // Include disabled emojis
}
ListEmojisQuery contains parameters for listing emojis
type ListResult ¶
type ListResult struct {
Emojis []*storage.CustomEmoji `json:"emojis"`
Total int `json:"total"`
Events []*streaming.Event `json:"events"`
}
ListResult contains multiple emojis
type Result ¶
type Result struct {
Emoji *storage.CustomEmoji `json:"emoji"`
Events []*streaming.Event `json:"events"`
}
Result contains a single emoji
type SearchEmojisQuery ¶
type SearchEmojisQuery struct {
Query string `json:"query" validate:"required,min=1"`
Limit int `json:"limit"`
}
SearchEmojisQuery contains parameters for searching emojis
type Service ¶
type Service struct {
// contains filtered or unexported fields
}
Service provides business logic for custom emoji operations
func NewService ¶
func NewService( emojiRepo emojiRepository, publisher streaming.Publisher, logger *zap.Logger, domain string, ) *Service
NewService creates a new emoji service
func (*Service) CopyRemoteEmoji ¶
CopyRemoteEmoji copies a remote emoji to the local instance
func (*Service) CreateEmoji ¶
CreateEmoji creates a new custom emoji
func (*Service) DeleteEmoji ¶
func (s *Service) DeleteEmoji(ctx context.Context, cmd *DeleteEmojiCommand) error
DeleteEmoji deletes a custom emoji
func (*Service) GetEmoji ¶
func (s *Service) GetEmoji(ctx context.Context, query *GetEmojiQuery) (*storage.CustomEmoji, error)
GetEmoji retrieves a single custom emoji by shortcode
func (*Service) GetPopularEmojis ¶
func (s *Service) GetPopularEmojis(ctx context.Context, query *GetPopularEmojisQuery) (*ListResult, error)
GetPopularEmojis retrieves emojis by popularity score
func (*Service) IncrementUsage ¶
func (s *Service) IncrementUsage(ctx context.Context, cmd *IncrementUsageCommand) error
IncrementUsage increments the usage count for an emoji
func (*Service) ListEmojis ¶
func (s *Service) ListEmojis(ctx context.Context, query *ListEmojisQuery) (*ListResult, error)
ListEmojis retrieves all custom emojis with optional filters
func (*Service) SearchEmojis ¶
func (s *Service) SearchEmojis(ctx context.Context, query *SearchEmojisQuery) (*ListResult, error)
SearchEmojis performs sophisticated emoji searches with relevance scoring
func (*Service) UpdateEmoji ¶
UpdateEmoji updates an existing custom emoji