status

package
v0.8.1 Latest Latest
Warning

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

Go to latest
Published: Apr 19, 2023 License: AGPL-3.0 Imports: 19 Imported by: 0

Documentation

Index

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, tc typeutils.TypeConverter, filter *visibility.Filter, parseMention gtsmodel.ParseMentionFunc) Processor

New returns a new status processor.

func (*Processor) BookmarkCreate added in v0.8.0

func (p *Processor) BookmarkCreate(ctx context.Context, requestingAccount *gtsmodel.Account, targetStatusID string) (*apimodel.Status, gtserror.WithCode)

BookmarkCreate adds a bookmark for the requestingAccount, targeting the given status (no-op if bookmark already exists).

func (*Processor) BookmarkRemove added in v0.8.0

func (p *Processor) BookmarkRemove(ctx context.Context, requestingAccount *gtsmodel.Account, targetStatusID string) (*apimodel.Status, gtserror.WithCode)

BookmarkRemove removes a bookmark for the requesting account, targeting the given status (no-op if bookmark doesn't exist).

func (*Processor) BoostCreate added in v0.8.0

func (p *Processor) BoostCreate(ctx context.Context, requestingAccount *gtsmodel.Account, application *gtsmodel.Application, targetStatusID string) (*apimodel.Status, gtserror.WithCode)

BoostCreate processes the boost/reblog of a given status, returning the newly-created boost if all is well.

func (*Processor) BoostRemove added in v0.8.0

func (p *Processor) BoostRemove(ctx context.Context, requestingAccount *gtsmodel.Account, application *gtsmodel.Application, targetStatusID string) (*apimodel.Status, gtserror.WithCode)

BoostRemove processes the unboost/unreblog of a given status, returning the status if all is well.

func (*Processor) ContextGet added in v0.8.0

func (p *Processor) ContextGet(ctx context.Context, requestingAccount *gtsmodel.Account, targetStatusID string) (*apimodel.Context, gtserror.WithCode)

ContextGet returns the context (previous and following posts) from the given status ID.

func (*Processor) Create

Create processes the given form to create a new status, returning the api model representation of that status if it's OK.

func (*Processor) Delete

func (p *Processor) Delete(ctx context.Context, requestingAccount *gtsmodel.Account, targetStatusID string) (*apimodel.Status, gtserror.WithCode)

Delete processes the delete of a given status, returning the deleted status if the delete goes through.

func (*Processor) FaveCreate added in v0.8.0

func (p *Processor) FaveCreate(ctx context.Context, requestingAccount *gtsmodel.Account, targetStatusID string) (*apimodel.Status, gtserror.WithCode)

FaveCreate adds a fave for the requestingAccount, targeting the given status (no-op if fave already exists).

func (*Processor) FaveRemove added in v0.8.0

func (p *Processor) FaveRemove(ctx context.Context, requestingAccount *gtsmodel.Account, targetStatusID string) (*apimodel.Status, gtserror.WithCode)

FaveRemove removes a fave for the requesting account, targeting the given status (no-op if fave doesn't exist).

func (*Processor) FavedBy

func (p *Processor) FavedBy(ctx context.Context, requestingAccount *gtsmodel.Account, targetStatusID string) ([]*apimodel.Account, gtserror.WithCode)

FavedBy returns a slice of accounts that have liked the given status, filtered according to privacy settings.

func (*Processor) Get

func (p *Processor) Get(ctx context.Context, requestingAccount *gtsmodel.Account, targetStatusID string) (*apimodel.Status, gtserror.WithCode)

Get gets the given status, taking account of privacy settings and blocks etc.

func (*Processor) PinCreate added in v0.8.0

func (p *Processor) PinCreate(ctx context.Context, requestingAccount *gtsmodel.Account, targetStatusID string) (*apimodel.Status, gtserror.WithCode)

PinCreate pins the target status to the top of requestingAccount's profile, if possible.

Conditions for a pin to work:

  • Status belongs to requesting account.
  • Status is public, unlisted, or followers-only.
  • Status is not a boost.
  • Status is not already pinnd.
  • Limit of pinned statuses not yet met or exceeded.

If the conditions can't be met, then code 422 Unprocessable Entity will be returned.

func (*Processor) PinRemove added in v0.8.0

func (p *Processor) PinRemove(ctx context.Context, requestingAccount *gtsmodel.Account, targetStatusID string) (*apimodel.Status, gtserror.WithCode)

PinRemove unpins the target status from the top of requestingAccount's profile, if possible.

Conditions for an unpin to work:

  • Status belongs to requesting account.
  • Status is public, unlisted, or followers-only.
  • Status is not a boost.

If the conditions can't be met, then code 422 Unprocessable Entity will be returned.

Unlike with PinCreate, statuses that are already unpinned will not return 422, but just do nothing and return the api model representation of the status, to conform to the masto API.

func (*Processor) StatusBoostedBy added in v0.8.0

func (p *Processor) StatusBoostedBy(ctx context.Context, requestingAccount *gtsmodel.Account, targetStatusID string) ([]*apimodel.Account, gtserror.WithCode)

StatusBoostedBy returns a slice of accounts that have boosted the given status, filtered according to privacy settings.

Jump to

Keyboard shortcuts

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