Documentation
¶
Overview ¶
Package accounts provides the core Accounts Service for the Lesser project's API alignment. This service handles all account/user profile operations including profile updates, preferences management, and account discovery. It emits appropriate events for real-time streaming and queues federation delivery for remote followers.
Index ¶
- Variables
- type AccountPinsResult
- type AccountResult
- type AccountSearchResult
- type ActivityPubCollectionResult
- type AuthService
- type CreateAuthorizationCodeCommand
- type CreateAuthorizationCodeResult
- type CryptoService
- type FamiliarFollowersForAccount
- type FamiliarFollowersResult
- type FederationService
- type FollowersResult
- type FollowingResult
- type GetAccountMetadataQuery
- type GetAccountMetadataResult
- type GetAccountNoteQuery
- type GetAccountNoteResult
- type GetAccountPinsQuery
- type GetAccountQuery
- type GetActivityPubCollectionQuery
- type GetFamiliarFollowersQuery
- type GetFieldVerificationQuery
- type GetFieldVerificationResult
- type GetFollowRequestStateQuery
- type GetFollowRequestStateResult
- type GetFollowersQuery
- type GetFollowingQuery
- type GetInstanceStatsQuery
- type GetInstanceStatsResult
- type GetMarkersQuery
- type GetMarkersResult
- type GetOAuthAppQuery
- type GetOAuthAppResult
- type GetPreferenceQuery
- type GetPreferenceResult
- type GetPreferencesQuery
- type GetUserAppConsentQuery
- type GetUserAppConsentResult
- type GetUserQuery
- type GetUserResult
- type IsAccountPinnedQuery
- type IsBlockedDomainQuery
- type IsBlockedDomainResult
- type LookupAccountQuery
- type PinAccountCommand
- type PreferencesResult
- type ProfileField
- type RegisterAccountCommand
- type RegisterAccountResult
- type RelationshipResult
- type RemoveFollowerCommand
- type SaveMarkerCommand
- type SaveMarkerResult
- type SearchAccountsQuery
- type Service
- func (s *Service) CreateAuthorizationCode(ctx context.Context, cmd *CreateAuthorizationCodeCommand) (*CreateAuthorizationCodeResult, error)
- func (s *Service) GetAccount(ctx context.Context, username string) (*storage.Account, error)
- func (s *Service) GetAccountMetadata(ctx context.Context, query *GetAccountMetadataQuery) (*GetAccountMetadataResult, error)
- func (s *Service) GetAccountNote(ctx context.Context, currentUsername, targetActorID string) (string, error)
- func (s *Service) GetAccountPins(ctx context.Context, query *GetAccountPinsQuery) (*AccountPinsResult, error)
- func (s *Service) GetActivityPubCollection(ctx context.Context, query *GetActivityPubCollectionQuery) (*ActivityPubCollectionResult, error)
- func (s *Service) GetFamiliarFollowers(ctx context.Context, query *GetFamiliarFollowersQuery) (*FamiliarFollowersResult, error)
- func (s *Service) GetFieldVerification(ctx context.Context, username, fieldName string) (*storage.ActorField, error)
- func (s *Service) GetFollowRequestState(ctx context.Context, requesterID, targetID string) (string, error)
- func (s *Service) GetFollowers(ctx context.Context, query *GetFollowersQuery) (*FollowersResult, error)
- func (s *Service) GetFollowing(ctx context.Context, query *GetFollowingQuery) (*FollowingResult, error)
- func (s *Service) GetInstanceStats(ctx context.Context, _ *GetInstanceStatsQuery) (*GetInstanceStatsResult, error)
- func (s *Service) GetMarkers(ctx context.Context, query *GetMarkersQuery) (*GetMarkersResult, error)
- func (s *Service) GetOAuthApp(ctx context.Context, query *GetOAuthAppQuery) (*GetOAuthAppResult, error)
- func (s *Service) GetPreference(ctx context.Context, userID, key string) (string, error)
- func (s *Service) GetPreferences(ctx context.Context, query *GetPreferencesQuery) (*PreferencesResult, error)
- func (s *Service) GetUser(ctx context.Context, username string) (*storage.User, error)
- func (s *Service) GetUserAppConsent(ctx context.Context, query *GetUserAppConsentQuery) (*GetUserAppConsentResult, error)
- func (s *Service) IsAccountPinned(ctx context.Context, userID, pinnedActorID string) (bool, error)
- func (s *Service) IsBlockedDomain(ctx context.Context, userID, targetDomain string) (bool, error)
- func (s *Service) LookupAccount(ctx context.Context, query *LookupAccountQuery) (*storage.Account, error)
- func (s *Service) PinAccount(ctx context.Context, cmd *PinAccountCommand) (*RelationshipResult, error)
- func (s *Service) RegisterAccount(ctx context.Context, cmd *RegisterAccountCommand) (*RegisterAccountResult, error)
- func (s *Service) RemoveFollower(ctx context.Context, cmd *RemoveFollowerCommand) (*RelationshipResult, error)
- func (s *Service) SaveMarker(ctx context.Context, cmd *SaveMarkerCommand) (*SaveMarkerResult, error)
- func (s *Service) SearchAccounts(ctx context.Context, query *SearchAccountsQuery) (*AccountSearchResult, error)
- func (s *Service) SetAccountNote(ctx context.Context, cmd *SetAccountNoteCommand) (*RelationshipResult, error)
- func (s *Service) StoreOAuthState(ctx context.Context, cmd *StoreOAuthStateCommand) (*StoreOAuthStateResult, error)
- func (s *Service) UnpinAccount(ctx context.Context, cmd *UnpinAccountCommand) (*RelationshipResult, error)
- func (s *Service) UpdatePreferences(ctx context.Context, cmd *UpdatePreferencesCommand) (*PreferencesResult, error)
- func (s *Service) UpdateProfile(ctx context.Context, cmd *UpdateProfileCommand) (*AccountResult, error)
- type SetAccountNoteCommand
- type StoreOAuthStateCommand
- type StoreOAuthStateResult
- type UnpinAccountCommand
- type UpdatePreferencesCommand
- type UpdateProfileCommand
- type ValidationError
Constants ¶
This section is empty.
Variables ¶
var ( // Input validation errors ErrValidationFailed = errors.New("validation failed") ErrEmptySearchQuery = errors.New("search query cannot be empty") ErrUsernameRequired = errors.New("username is required") ErrUpdaterIDRequired = errors.New("updater_id is required") // Account operations ErrGetAccount = errors.New("failed to get account") ErrUpdateProfile = errors.New("failed to update profile") ErrStoreAccount = errors.New("failed to store account") ErrGetPreferences = errors.New("failed to get preferences") ErrUpdatePreferences = errors.New("failed to update preferences") ErrAccountNotFound = errors.New("account not found") ErrSearchAccounts = errors.New("failed to search accounts") ErrProfileFieldNameEmpty = errors.New("profile field name cannot be empty") ErrProfileFieldNameTooLong = errors.New("profile field name too long (max 255 characters)") ErrProfileFieldValueTooLong = errors.New("profile field value too long (max 255 characters)") ErrInvalidExpandMediaSetting = errors.New("invalid expand media setting") ErrInvalidTimelineOrder = errors.New("invalid timeline order") ErrAccountNoActivityPubActor = errors.New("account has no ActivityPub actor") // Actor operations ErrGetActor = errors.New("failed to get actor") ErrGetFollowersAccounts = errors.New("failed to get followers") ErrGetFollowingList = errors.New("failed to get following list") ErrGetViewerActor = errors.New("failed to get viewer actor") ErrGetViewerFollowing = errors.New("failed to get viewer following") // Repository availability errors ErrRelationshipRepositoryNotAvailable = errors.New("relationship repository not available") ErrActorRepositoryNotAvailable = errors.New("actor repository not available") // Account relationships ErrTargetAccountNotFound = errors.New("target account not found") ErrAccountAlreadyPinned = errors.New("account already pinned") ErrPinAccount = errors.New("failed to pin account") ErrUnpinAccount = errors.New("failed to unpin account") ErrGetAccountPins = errors.New("failed to get account pins") ErrSetAccountNote = errors.New("failed to set account note") ErrRemoveFollower = errors.New("failed to remove follower") // Account creation ErrEmailRequired = errors.New("email is required") ErrMustAgreeToTerms = errors.New("must agree to terms of service") ErrUsernameAlreadyTaken = errors.New("username already taken") ErrGenerateKeypair = errors.New("failed to generate keypair") ErrEncodePublicKey = errors.New("failed to encode public key") ErrHashPassword = errors.New("failed to hash password") ErrCreateAccount = errors.New("failed to create account") ErrCryptoServiceNotConfigured = errors.New("crypto service not configured") ErrAuthServiceNotConfigured = errors.New("auth service not configured") ErrStorageNotAvailable = errors.New("storage not available") // User operations ErrCheckAccountPinned = errors.New("failed to check if account is pinned") ErrGetUser = errors.New("failed to get user") ErrGetUserPreferences = errors.New("failed to get user preferences") ErrCheckDomainBlockedByUser = errors.New("failed to check if domain is blocked by user") ErrGetFieldVerification = errors.New("failed to get field verification") ErrGetAccountNote = errors.New("failed to get account note") ErrUserRepositoryNotAvailable = errors.New("user repository not available") ErrDomainBlockRepositoryNotAvailable = errors.New("domain block repository not available") ErrAccountRepositoryNotAvailable = errors.New("account repository not available") // Permission errors ErrCannotUpdateProfileForOtherUser = errors.New("cannot update profile for another user") ErrCannotUpdatePreferencesForOtherUser = errors.New("cannot update preferences for another user") ErrCannotPinAccountForOtherUser = errors.New("cannot pin account for another user") ErrCannotUnpinAccountForOtherUser = errors.New("cannot unpin account for another user") ErrCannotSetNoteForOtherUser = errors.New("cannot set note for another user") ErrCannotRemoveFollowerForOtherUser = errors.New("cannot remove follower for another user") // Quote permissions errors ErrQuoteRepositoryNotAvailable = errors.New("quote repository not available") )
Standardized error constants for account operations These align with the constants in pkg/services/errors.go
Functions ¶
This section is empty.
Types ¶
type AccountPinsResult ¶
type AccountPinsResult struct {
PinnedAccounts []*storage.Account `json:"pinned_accounts"`
Events []*streaming.Event `json:"events"`
}
AccountPinsResult contains pinned accounts (endorsements) and events
type AccountResult ¶
type AccountResult struct {
Account *storage.Account `json:"account"`
Events []*streaming.Event `json:"events"`
}
AccountResult contains an account and associated events that were emitted
type AccountSearchResult ¶
type AccountSearchResult struct {
Accounts []*storage.Account `json:"accounts"`
Pagination *interfaces.PaginatedResult[*storage.Account] `json:"pagination"`
Events []*streaming.Event `json:"events"`
}
AccountSearchResult contains search results and pagination information
type ActivityPubCollectionResult ¶
type ActivityPubCollectionResult struct {
Collection map[string]any `json:"collection"`
Events []*streaming.Event `json:"events"`
}
ActivityPubCollectionResult contains ActivityPub collection data
type AuthService ¶
type AuthService interface {
HashPassword(password string) (string, error)
ValidatePassword(password, username string) error
PasswordStrength(password string) int
}
AuthService defines the interface for authentication operations
type CreateAuthorizationCodeCommand ¶
type CreateAuthorizationCodeCommand struct {
AuthCode *storage.AuthorizationCode
}
CreateAuthorizationCodeCommand contains parameters for creating an authorization code
type CreateAuthorizationCodeResult ¶
CreateAuthorizationCodeResult contains the result of creating an authorization code
type CryptoService ¶
type CryptoService interface {
GenerateRSAKeyPair(bits int) (interface{}, error)
EncodePublicKeyPEM(publicKey interface{}) ([]byte, error)
EncodePrivateKeyPEM(privateKey interface{}) ([]byte, error)
}
CryptoService defines the interface for cryptographic operations
type FamiliarFollowersForAccount ¶
type FamiliarFollowersForAccount struct {
ID string `json:"id"`
Accounts []*storage.Account `json:"accounts"`
}
FamiliarFollowersForAccount represents mutual connections for a specific account
type FamiliarFollowersResult ¶
type FamiliarFollowersResult struct {
Results []FamiliarFollowersForAccount `json:"results"`
Events []*streaming.Event `json:"events"`
}
FamiliarFollowersResult contains mutual connections grouped by account
type FederationService ¶
type FederationService interface {
QueueActivity(ctx context.Context, activity *activitypub.Activity) error
}
FederationService defines the interface for federation operations
type FollowersResult ¶
type FollowersResult struct {
Followers []*storage.Account `json:"followers"`
Pagination *interfaces.PaginatedResult[*storage.Account] `json:"pagination"`
Events []*streaming.Event `json:"events"`
}
FollowersResult contains followers list and pagination
type FollowingResult ¶
type FollowingResult struct {
Following []*storage.Account `json:"following"`
Pagination *interfaces.PaginatedResult[*storage.Account] `json:"pagination"`
Events []*streaming.Event `json:"events"`
}
FollowingResult contains following list and pagination
type GetAccountMetadataQuery ¶
type GetAccountMetadataQuery struct {
Username string `json:"username" validate:"required"`
}
GetAccountMetadataQuery represents a request to get account metadata
type GetAccountMetadataResult ¶
type GetAccountMetadataResult struct {
Actor *activitypub.Actor `json:"actor"`
Metadata *storage.ActorMetadata `json:"metadata"`
}
GetAccountMetadataResult represents account metadata
type GetAccountNoteQuery ¶
type GetAccountNoteQuery struct {
CurrentUsername string `json:"current_username" validate:"required"`
TargetActorID string `json:"target_actor_id" validate:"required"`
}
GetAccountNoteQuery represents a request to get an account note
type GetAccountNoteResult ¶
type GetAccountNoteResult struct {
Note string `json:"note"`
Events []*streaming.Event `json:"events"`
}
GetAccountNoteResult contains the note and events
type GetAccountPinsQuery ¶
type GetAccountPinsQuery struct {
Username string `json:"username" validate:"required"`
}
GetAccountPinsQuery contains data needed to get account pins (endorsed accounts)
type GetAccountQuery ¶
type GetAccountQuery struct {
Username string `json:"username" validate:"required"`
ViewerID string `json:"viewer_id"` // User requesting the account (for privacy checks)
}
GetAccountQuery contains parameters for retrieving a single account
type GetActivityPubCollectionQuery ¶
type GetActivityPubCollectionQuery struct {
Username string `json:"username" validate:"required"`
CollectionType string `json:"collection_type" validate:"required,oneof=followers following"`
ViewerID string `json:"viewer_id"`
Page bool `json:"page"`
Cursor string `json:"cursor"`
Limit int `json:"limit"`
}
GetActivityPubCollectionQuery contains parameters for ActivityPub collection requests
type GetFamiliarFollowersQuery ¶
type GetFamiliarFollowersQuery struct {
AccountIDs []string `json:"account_ids" validate:"required,min=1"`
ViewerID string `json:"viewer_id" validate:"required"`
}
GetFamiliarFollowersQuery contains parameters for finding mutual connections
type GetFieldVerificationQuery ¶
type GetFieldVerificationQuery struct {
Username string `json:"username" validate:"required"`
FieldName string `json:"field_name" validate:"required"`
}
GetFieldVerificationQuery represents a request to get field verification
type GetFieldVerificationResult ¶
type GetFieldVerificationResult struct {
Field *storage.ActorField `json:"field"`
Events []*streaming.Event `json:"events"`
}
GetFieldVerificationResult contains the verification status and events
type GetFollowRequestStateQuery ¶
type GetFollowRequestStateQuery struct {
RequesterID string `json:"requester_id" validate:"required"`
TargetID string `json:"target_id" validate:"required"`
}
GetFollowRequestStateQuery represents a request to get follow request state
type GetFollowRequestStateResult ¶
type GetFollowRequestStateResult struct {
State string `json:"state"`
Events []*streaming.Event `json:"events"`
}
GetFollowRequestStateResult contains the state and events
type GetFollowersQuery ¶
type GetFollowersQuery struct {
Username string `json:"username" validate:"required"`
ViewerID string `json:"viewer_id"` // User viewing the followers
Pagination interfaces.PaginationOptions `json:"pagination"`
}
GetFollowersQuery contains parameters for retrieving account followers
type GetFollowingQuery ¶
type GetFollowingQuery struct {
Username string `json:"username" validate:"required"`
ViewerID string `json:"viewer_id"` // User viewing the following
Pagination interfaces.PaginationOptions `json:"pagination"`
}
GetFollowingQuery contains parameters for retrieving accounts being followed
type GetInstanceStatsQuery ¶
type GetInstanceStatsQuery struct{}
GetInstanceStatsQuery contains parameters for getting instance statistics
type GetInstanceStatsResult ¶
type GetInstanceStatsResult struct {
TotalUsers int
ActiveMonth int
ActiveHalfyear int
LocalPosts int
LocalComments int
Events []*streaming.Event
}
GetInstanceStatsResult contains instance statistics
type GetMarkersQuery ¶
type GetMarkersQuery struct {
Username string
Timelines []string // Optional filter for specific timelines
}
GetMarkersQuery contains parameters for getting markers
type GetMarkersResult ¶
GetMarkersResult contains the result of getting markers
type GetOAuthAppQuery ¶
type GetOAuthAppQuery struct {
ClientID string
}
GetOAuthAppQuery contains parameters for getting an OAuth app
type GetOAuthAppResult ¶
GetOAuthAppResult contains the result of getting an OAuth app
type GetPreferenceQuery ¶
type GetPreferenceQuery struct {
UserID string `json:"user_id" validate:"required"`
Key string `json:"key" validate:"required"`
}
GetPreferenceQuery represents a request to get a user preference
type GetPreferenceResult ¶
type GetPreferenceResult struct {
Value string `json:"value"`
Events []*streaming.Event `json:"events"`
}
GetPreferenceResult contains the preference value and events
type GetPreferencesQuery ¶
type GetPreferencesQuery struct {
Username string `json:"username" validate:"required"`
}
GetPreferencesQuery contains parameters for retrieving user preferences
type GetUserAppConsentQuery ¶
GetUserAppConsentQuery contains parameters for checking user consent
type GetUserAppConsentResult ¶
type GetUserAppConsentResult struct {
Consent *storage.UserAppConsent
Events []*streaming.Event
}
GetUserAppConsentResult contains the result of checking user consent
type GetUserQuery ¶
type GetUserQuery struct {
Username string `json:"username" validate:"required"`
}
GetUserQuery represents a request to get a user by username
type GetUserResult ¶
type GetUserResult struct {
User *storage.User `json:"user"`
Events []*streaming.Event `json:"events"`
}
GetUserResult contains the user and events
type IsAccountPinnedQuery ¶
type IsAccountPinnedQuery struct {
UserID string `json:"user_id" validate:"required"`
PinnedActorID string `json:"pinned_actor_id" validate:"required"`
}
IsAccountPinnedQuery represents a request to check if an account is pinned
type IsBlockedDomainQuery ¶
type IsBlockedDomainQuery struct {
UserID string `json:"user_id" validate:"required"`
TargetDomain string `json:"target_domain" validate:"required"`
}
IsBlockedDomainQuery represents a request to check if a domain is blocked
type IsBlockedDomainResult ¶
type IsBlockedDomainResult struct {
IsBlocked bool `json:"is_blocked"`
Events []*streaming.Event `json:"events"`
}
IsBlockedDomainResult contains the blocked status and events
type LookupAccountQuery ¶
type LookupAccountQuery struct {
Acct string `json:"acct" validate:"required"` // username@domain format
ViewerID string `json:"viewer_id"` // User performing the lookup
}
LookupAccountQuery contains parameters for looking up an account by username@domain
type PinAccountCommand ¶
type PinAccountCommand struct {
Username string `json:"username" validate:"required"`
TargetAccount string `json:"target_account" validate:"required"`
PinnerID string `json:"pinner_id" validate:"required"`
}
PinAccountCommand contains data needed to pin an account to user's profile
type PreferencesResult ¶
type PreferencesResult struct {
Preferences map[string]interface{} `json:"preferences"`
Events []*streaming.Event `json:"events"`
}
PreferencesResult contains user preferences and any events
type ProfileField ¶
type ProfileField struct {
Name string `json:"name" validate:"required,max=255"`
Value string `json:"value" validate:"required,max=255"`
VerifiedAt *time.Time `json:"verified_at,omitempty"`
}
ProfileField represents a custom profile field
type RegisterAccountCommand ¶
type RegisterAccountCommand struct {
Username string `json:"username" validate:"required,min=3,max=30"`
Email string `json:"email" validate:"required,email"`
Password string `json:"password"` // Optional for WebAuthn registration
Locale string `json:"locale"`
Agreement bool `json:"agreement" validate:"required"`
Reason string `json:"reason"` // Registration reason (for approval)
InviteCode string `json:"invite_code"`
DefaultPostingVisibility string `json:"default_posting_visibility"`
}
RegisterAccountCommand contains all data needed to register a new account
type RegisterAccountResult ¶
type RegisterAccountResult struct {
Account *storage.Account `json:"account"`
Actor *activitypub.Actor `json:"actor"`
Events []*streaming.Event `json:"events"`
}
RegisterAccountResult contains the result of account registration
type RelationshipResult ¶
type RelationshipResult struct {
Relationship map[string]any `json:"relationship"`
Events []*streaming.Event `json:"events"`
}
RelationshipResult contains relationship status between accounts
type RemoveFollowerCommand ¶
type RemoveFollowerCommand struct {
Username string `json:"username" validate:"required"`
FollowerID string `json:"follower_id" validate:"required"`
RemoverID string `json:"remover_id" validate:"required"`
}
RemoveFollowerCommand contains data needed to remove a follower
type SaveMarkerCommand ¶
SaveMarkerCommand contains parameters for saving a marker
type SaveMarkerResult ¶
SaveMarkerResult contains the result of saving a marker
type SearchAccountsQuery ¶
type SearchAccountsQuery struct {
Query string `json:"query" validate:"required"`
ViewerID string `json:"viewer_id"` // User performing the search
Pagination interfaces.PaginationOptions `json:"pagination"`
Resolve bool `json:"resolve"` // Resolve remote accounts
Following bool `json:"following"` // Only search following
Followers bool `json:"followers"` // Only search followers
}
SearchAccountsQuery contains parameters for searching accounts
type Service ¶
type Service struct {
// contains filtered or unexported fields
}
Service provides account operations
func NewService ¶
func NewService( storage core.RepositoryStorage, publisher streaming.Publisher, federation FederationService, crypto CryptoService, auth AuthService, logger *zap.Logger, domainName string, ) *Service
NewService creates a new Accounts Service with the required dependencies
func (*Service) CreateAuthorizationCode ¶
func (s *Service) CreateAuthorizationCode(ctx context.Context, cmd *CreateAuthorizationCodeCommand) (*CreateAuthorizationCodeResult, error)
CreateAuthorizationCode creates a new authorization code
func (*Service) GetAccount ¶
GetAccount retrieves a single account with privacy-aware data
func (*Service) GetAccountMetadata ¶
func (s *Service) GetAccountMetadata(ctx context.Context, query *GetAccountMetadataQuery) (*GetAccountMetadataResult, error)
GetAccountMetadata retrieves an account with its metadata
func (*Service) GetAccountNote ¶
func (s *Service) GetAccountNote(ctx context.Context, currentUsername, targetActorID string) (string, error)
GetAccountNote retrieves a private note set on an account
func (*Service) GetAccountPins ¶
func (s *Service) GetAccountPins(ctx context.Context, query *GetAccountPinsQuery) (*AccountPinsResult, error)
GetAccountPins retrieves all accounts pinned by a user (endorsements)
func (*Service) GetActivityPubCollection ¶
func (s *Service) GetActivityPubCollection(ctx context.Context, query *GetActivityPubCollectionQuery) (*ActivityPubCollectionResult, error)
GetActivityPubCollection handles ActivityPub collection requests with proper format
func (*Service) GetFamiliarFollowers ¶
func (s *Service) GetFamiliarFollowers(ctx context.Context, query *GetFamiliarFollowersQuery) (*FamiliarFollowersResult, error)
GetFamiliarFollowers returns accounts that the requesting user follows and who also follow the given accounts
func (*Service) GetFieldVerification ¶
func (s *Service) GetFieldVerification(ctx context.Context, username, fieldName string) (*storage.ActorField, error)
GetFieldVerification retrieves field verification information
func (*Service) GetFollowRequestState ¶
func (s *Service) GetFollowRequestState(ctx context.Context, requesterID, targetID string) (string, error)
GetFollowRequestState retrieves the state of a follow request
func (*Service) GetFollowers ¶
func (s *Service) GetFollowers(ctx context.Context, query *GetFollowersQuery) (*FollowersResult, error)
GetFollowers retrieves the list of accounts following the given account
func (*Service) GetFollowing ¶
func (s *Service) GetFollowing(ctx context.Context, query *GetFollowingQuery) (*FollowingResult, error)
GetFollowing retrieves the list of accounts the given account is following
func (*Service) GetInstanceStats ¶
func (s *Service) GetInstanceStats(ctx context.Context, _ *GetInstanceStatsQuery) (*GetInstanceStatsResult, error)
GetInstanceStats retrieves instance-level statistics
func (*Service) GetMarkers ¶
func (s *Service) GetMarkers(ctx context.Context, query *GetMarkersQuery) (*GetMarkersResult, error)
GetMarkers retrieves timeline markers for a user
func (*Service) GetOAuthApp ¶
func (s *Service) GetOAuthApp(ctx context.Context, query *GetOAuthAppQuery) (*GetOAuthAppResult, error)
GetOAuthApp retrieves an OAuth application by client ID
func (*Service) GetPreference ¶
GetPreference retrieves a user preference value
func (*Service) GetPreferences ¶
func (s *Service) GetPreferences(ctx context.Context, query *GetPreferencesQuery) (*PreferencesResult, error)
GetPreferences retrieves user preferences
func (*Service) GetUserAppConsent ¶
func (s *Service) GetUserAppConsent(ctx context.Context, query *GetUserAppConsentQuery) (*GetUserAppConsentResult, error)
GetUserAppConsent retrieves user's consent for an OAuth app
func (*Service) IsAccountPinned ¶
IsAccountPinned checks if a user has pinned an account
func (*Service) IsBlockedDomain ¶
IsBlockedDomain checks if a domain is blocked for a user
func (*Service) LookupAccount ¶
func (s *Service) LookupAccount(ctx context.Context, query *LookupAccountQuery) (*storage.Account, error)
LookupAccount looks up an account by username@domain format
func (*Service) PinAccount ¶
func (s *Service) PinAccount(ctx context.Context, cmd *PinAccountCommand) (*RelationshipResult, error)
PinAccount pins an account to the user's profile
func (*Service) RegisterAccount ¶
func (s *Service) RegisterAccount(ctx context.Context, cmd *RegisterAccountCommand) (*RegisterAccountResult, error)
RegisterAccount creates a new user account with actor
func (*Service) RemoveFollower ¶
func (s *Service) RemoveFollower(ctx context.Context, cmd *RemoveFollowerCommand) (*RelationshipResult, error)
RemoveFollower removes a follower from the current user's followers list
func (*Service) SaveMarker ¶
func (s *Service) SaveMarker(ctx context.Context, cmd *SaveMarkerCommand) (*SaveMarkerResult, error)
SaveMarker saves a timeline marker for a user
func (*Service) SearchAccounts ¶
func (s *Service) SearchAccounts(ctx context.Context, query *SearchAccountsQuery) (*AccountSearchResult, error)
SearchAccounts searches for accounts with filters and privacy checks
func (*Service) SetAccountNote ¶
func (s *Service) SetAccountNote(ctx context.Context, cmd *SetAccountNoteCommand) (*RelationshipResult, error)
SetAccountNote sets a private note on an account
func (*Service) StoreOAuthState ¶
func (s *Service) StoreOAuthState(ctx context.Context, cmd *StoreOAuthStateCommand) (*StoreOAuthStateResult, error)
StoreOAuthState stores OAuth authorization state
func (*Service) UnpinAccount ¶
func (s *Service) UnpinAccount(ctx context.Context, cmd *UnpinAccountCommand) (*RelationshipResult, error)
UnpinAccount unpins an account from the user's profile
func (*Service) UpdatePreferences ¶
func (s *Service) UpdatePreferences(ctx context.Context, cmd *UpdatePreferencesCommand) (*PreferencesResult, error)
UpdatePreferences updates user preferences and emits events (but not federation)
func (*Service) UpdateProfile ¶
func (s *Service) UpdateProfile(ctx context.Context, cmd *UpdateProfileCommand) (*AccountResult, error)
UpdateProfile updates a user's profile, validates input, stores changes, emits events, and queues federation
type SetAccountNoteCommand ¶
type SetAccountNoteCommand struct {
Username string `json:"username" validate:"required"`
TargetAccount string `json:"target_account" validate:"required"`
Note string `json:"note" validate:"max=500"`
SetterID string `json:"setter_id" validate:"required"`
}
SetAccountNoteCommand contains data needed to set a private note on an account
type StoreOAuthStateCommand ¶
type StoreOAuthStateCommand struct {
State string
OAuthState *storage.OAuthState
}
StoreOAuthStateCommand contains parameters for storing OAuth state
type StoreOAuthStateResult ¶
StoreOAuthStateResult contains the result of storing OAuth state
type UnpinAccountCommand ¶
type UnpinAccountCommand struct {
Username string `json:"username" validate:"required"`
TargetAccount string `json:"target_account" validate:"required"`
PinnerID string `json:"pinner_id" validate:"required"`
}
UnpinAccountCommand contains data needed to unpin an account from user's profile
type UpdatePreferencesCommand ¶
type UpdatePreferencesCommand struct {
Username string `json:"username" validate:"required"`
Language string `json:"language"`
DefaultPostingVisibility string `json:"default_posting_visibility" validate:"oneof=public unlisted private direct"`
DefaultMediaSensitive bool `json:"default_media_sensitive"`
ExpandSpoilers bool `json:"expand_spoilers"`
ExpandMedia string `json:"expand_media" validate:"oneof=default show_all hide_all"`
AutoplayGifs bool `json:"autoplay_gifs"`
ShowFollowCounts bool `json:"show_follow_counts"`
PreferredTimelineOrder string `json:"preferred_timeline_order" validate:"oneof=newest oldest"`
SearchSuggestionsEnabled bool `json:"search_suggestions_enabled"`
PersonalizedSearchEnabled bool `json:"personalized_search_enabled"`
ReblogFilters map[string]bool `json:"reblog_filters"`
UpdaterID string `json:"updater_id" validate:"required"` // Must be the account owner
}
UpdatePreferencesCommand contains all data needed to update user preferences
type UpdateProfileCommand ¶
type UpdateProfileCommand struct {
Username string `json:"username" validate:"required"`
DisplayName string `json:"display_name" validate:"max=100"`
Bio string `json:"bio" validate:"max=5000"`
Avatar string `json:"avatar"` // URL to avatar image
Header string `json:"header"` // URL to header image
Locked bool `json:"locked"` // Account locked (requires approval for follows)
Bot bool `json:"bot"` // Bot account flag
Fields []ProfileField `json:"fields"` // Custom profile fields
Discoverable bool `json:"discoverable"` // Show in directory
NoIndex bool `json:"no_index"` // Don't index for search
Sensitive bool `json:"sensitive"` // Mark media as sensitive by default
Language string `json:"language"` // Default language
UpdaterID string `json:"updater_id" validate:"required"` // Must be the account owner
}
UpdateProfileCommand contains all data needed to update a user's profile
type ValidationError ¶
ValidationError represents a validation error
func (*ValidationError) Error ¶
func (e *ValidationError) Error() string
Error implements the error interface