Documentation ¶
Index ¶
- type Processor
- func (p *Processor) Accounts(ctx context.Context, requestingAccount *gtsmodel.Account, query string, ...) ([]*apimodel.Account, gtserror.WithCode)
- func (p *Processor) Get(ctx context.Context, account *gtsmodel.Account, req *apimodel.SearchRequest) (*apimodel.SearchResult, gtserror.WithCode)
- func (p *Processor) Lookup(ctx context.Context, requestingAccount *gtsmodel.Account, query string) (*apimodel.Account, gtserror.WithCode)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Processor ¶
type Processor struct {
// contains filtered or unexported fields
}
func New ¶
func New(state *state.State, federator federation.Federator, converter *typeutils.Converter, filter *visibility.Filter) Processor
New returns a new status processor.
func (*Processor) Accounts ¶
func (p *Processor) Accounts( ctx context.Context, requestingAccount *gtsmodel.Account, query string, limit int, offset int, resolve bool, following bool, ) ([]*apimodel.Account, gtserror.WithCode)
Accounts does a partial search for accounts that match the given query. It expects input that looks like a namestring, and will normalize plaintext to look more like a namestring. For queries that include domain, it will only return one match at most. For namestrings that exclude domain, multiple matches may be returned.
This behavior aligns more or less with Mastodon's API. See https://docs.joinmastodon.org/methods/accounts/#search.
func (*Processor) Get ¶
func (p *Processor) Get( ctx context.Context, account *gtsmodel.Account, req *apimodel.SearchRequest, ) (*apimodel.SearchResult, gtserror.WithCode)
Get performs a search for accounts and/or statuses using the provided request parameters.
Implementation note: in this function, we try to only return an error to the caller they've submitted a bad request, or when a serious error has occurred. This is because the search has a sort of fallthrough logic: if we can't get a result with one type of search, we should proceed with y search rather than returning an early error.
If we get to the end and still haven't found anything, even then we shouldn't return an error, just return an empty result.
func (*Processor) Lookup ¶
func (p *Processor) Lookup( ctx context.Context, requestingAccount *gtsmodel.Account, query string, ) (*apimodel.Account, gtserror.WithCode)
Lookup does a quick, non-resolving search for accounts that match the given query. It expects input that looks like a namestring, and will normalize plaintext to look more like a namestring. Will only ever return one account, and only on an exact match.
This behavior aligns more or less with Mastodon's API. See https://docs.joinmastodon.org/methods/accounts/#lookup