Documentation ¶
Index ¶
- func APIFilterActionToFilterAction(m apimodel.FilterAction) gtsmodel.FilterAction
- func APIMarkerNameToMarkerName(m apimodel.MarkerName) gtsmodel.MarkerName
- func APIVisToVis(m apimodel.Visibility) gtsmodel.Visibility
- func ContentToContentLanguage(ctx context.Context, content gtsmodel.Content) (string, string)
- func WrapStatusableInCreate(status ap.Statusable, iriOnly bool) vocab.ActivityStreamsCreate
- func WrapStatusableInUpdate(status ap.Statusable, iriOnly bool) vocab.ActivityStreamsUpdate
- type Converter
- func (c *Converter) ASAnnounceToStatus(ctx context.Context, announceable ap.Announceable) (*gtsmodel.Status, bool, error)
- func (c *Converter) ASBlockToBlock(ctx context.Context, blockable ap.Blockable) (*gtsmodel.Block, error)
- func (c *Converter) ASFlagToReport(ctx context.Context, flaggable ap.Flaggable) (*gtsmodel.Report, error)
- func (c *Converter) ASFollowToFollow(ctx context.Context, followable ap.Followable) (*gtsmodel.Follow, error)
- func (c *Converter) ASFollowToFollowRequest(ctx context.Context, followable ap.Followable) (*gtsmodel.FollowRequest, error)
- func (c *Converter) ASLikeToFave(ctx context.Context, likeable ap.Likeable) (*gtsmodel.StatusFave, error)
- func (c *Converter) ASRepresentationToAccount(ctx context.Context, accountable ap.Accountable, accountDomain string) (*gtsmodel.Account, error)
- func (c *Converter) ASStatusToStatus(ctx context.Context, statusable ap.Statusable) (*gtsmodel.Status, error)
- func (c *Converter) AccountToAPIAccountBlocked(ctx context.Context, a *gtsmodel.Account) (*apimodel.Account, error)
- func (c *Converter) AccountToAPIAccountPublic(ctx context.Context, a *gtsmodel.Account) (*apimodel.Account, error)
- func (c *Converter) AccountToAPIAccountSensitive(ctx context.Context, a *gtsmodel.Account) (*apimodel.Account, error)
- func (c *Converter) AccountToAS(ctx context.Context, a *gtsmodel.Account) (vocab.ActivityStreamsPerson, error)
- func (c *Converter) AccountToASMinimal(ctx context.Context, a *gtsmodel.Account) (vocab.ActivityStreamsPerson, error)
- func (c *Converter) AccountToAdminAPIAccount(ctx context.Context, a *gtsmodel.Account) (*apimodel.AdminAccountInfo, error)
- func (c *Converter) AppToAPIAppPublic(ctx context.Context, a *gtsmodel.Application) (*apimodel.Application, error)
- func (c *Converter) AppToAPIAppSensitive(ctx context.Context, a *gtsmodel.Application) (*apimodel.Application, error)
- func (c *Converter) AttachmentToAPIAttachment(ctx context.Context, a *gtsmodel.MediaAttachment) (apimodel.Attachment, error)
- func (c *Converter) AttachmentToAS(ctx context.Context, a *gtsmodel.MediaAttachment) (vocab.ActivityStreamsDocument, error)
- func (c *Converter) BlockToAS(ctx context.Context, b *gtsmodel.Block) (vocab.ActivityStreamsBlock, error)
- func (c *Converter) BoostToAS(ctx context.Context, boostWrapperStatus *gtsmodel.Status, ...) (vocab.ActivityStreamsAnnounce, error)
- func (c *Converter) DomainPermToAPIDomainPerm(ctx context.Context, d gtsmodel.DomainPermission, export bool) (*apimodel.DomainPermission, error)
- func (c *Converter) EmojiCategoryToAPIEmojiCategory(ctx context.Context, category *gtsmodel.EmojiCategory) (*apimodel.EmojiCategory, error)
- func (c *Converter) EmojiToAPIEmoji(ctx context.Context, e *gtsmodel.Emoji) (apimodel.Emoji, error)
- func (c *Converter) EmojiToAS(ctx context.Context, e *gtsmodel.Emoji) (vocab.TootEmoji, error)
- func (c *Converter) EmojiToAdminAPIEmoji(ctx context.Context, e *gtsmodel.Emoji) (*apimodel.AdminEmoji, error)
- func (c *Converter) FaveToAS(ctx context.Context, f *gtsmodel.StatusFave) (vocab.ActivityStreamsLike, error)
- func (c *Converter) FilterKeywordToAPIFilterKeyword(ctx context.Context, filterKeyword *gtsmodel.FilterKeyword) *apimodel.FilterKeyword
- func (c *Converter) FilterKeywordToAPIFilterV1(ctx context.Context, filterKeyword *gtsmodel.FilterKeyword) (*apimodel.FilterV1, error)
- func (c *Converter) FilterStatusToAPIFilterStatus(ctx context.Context, filterStatus *gtsmodel.FilterStatus) *apimodel.FilterStatus
- func (c *Converter) FilterToAPIFilterV2(ctx context.Context, filter *gtsmodel.Filter) (*apimodel.FilterV2, error)
- func (c *Converter) FilterToAPIFiltersV1(ctx context.Context, filter *gtsmodel.Filter) ([]*apimodel.FilterV1, error)
- func (c *Converter) FollowRequestToFollow(ctx context.Context, fr *gtsmodel.FollowRequest) *gtsmodel.Follow
- func (c *Converter) FollowToAS(ctx context.Context, f *gtsmodel.Follow) (vocab.ActivityStreamsFollow, error)
- func (c *Converter) InstanceRuleToAPIRule(r gtsmodel.Rule) apimodel.InstanceRule
- func (c *Converter) InstanceRuleToAdminAPIRule(r *gtsmodel.Rule) *apimodel.AdminInstanceRule
- func (c *Converter) InstanceRulesToAPIRules(r []gtsmodel.Rule) []apimodel.InstanceRule
- func (c *Converter) InstanceToAPIV1Instance(ctx context.Context, i *gtsmodel.Instance) (*apimodel.InstanceV1, error)
- func (c *Converter) InstanceToAPIV2Instance(ctx context.Context, i *gtsmodel.Instance) (*apimodel.InstanceV2, error)
- func (c *Converter) ListToAPIList(ctx context.Context, l *gtsmodel.List) (*apimodel.List, error)
- func (c *Converter) MarkersToAPIMarker(ctx context.Context, markers []*gtsmodel.Marker) (*apimodel.Marker, error)
- func (c *Converter) MentionToAPIMention(ctx context.Context, m *gtsmodel.Mention) (apimodel.Mention, error)
- func (c *Converter) MentionToAS(ctx context.Context, m *gtsmodel.Mention) (vocab.ActivityStreamsMention, error)
- func (c *Converter) NotificationToAPINotification(ctx context.Context, n *gtsmodel.Notification, filters []*gtsmodel.Filter, ...) (*apimodel.Notification, error)
- func (c *Converter) OutboxToASCollection(ctx context.Context, outboxID string) (vocab.ActivityStreamsOrderedCollection, error)
- func (c *Converter) PollToAPIPoll(ctx context.Context, requester *gtsmodel.Account, poll *gtsmodel.Poll) (*apimodel.Poll, error)
- func (c *Converter) PollVoteToASCreate(ctx context.Context, vote *gtsmodel.PollVote) (vocab.ActivityStreamsCreate, error)
- func (c *Converter) RelationshipToAPIRelationship(ctx context.Context, r *gtsmodel.Relationship) (*apimodel.Relationship, error)
- func (c *Converter) ReportToAPIReport(ctx context.Context, r *gtsmodel.Report) (*apimodel.Report, error)
- func (c *Converter) ReportToASFlag(ctx context.Context, r *gtsmodel.Report) (vocab.ActivityStreamsFlag, error)
- func (c *Converter) ReportToAdminAPIReport(ctx context.Context, r *gtsmodel.Report, requestingAccount *gtsmodel.Account) (*apimodel.AdminReport, error)
- func (c *Converter) StatusToAPIStatus(ctx context.Context, s *gtsmodel.Status, requestingAccount *gtsmodel.Account, ...) (*apimodel.Status, error)
- func (c *Converter) StatusToAPIStatusSource(ctx context.Context, s *gtsmodel.Status) (*apimodel.StatusSource, error)
- func (c *Converter) StatusToAS(ctx context.Context, s *gtsmodel.Status) (ap.Statusable, error)
- func (c *Converter) StatusToASDelete(ctx context.Context, s *gtsmodel.Status) (vocab.ActivityStreamsDelete, error)
- func (c *Converter) StatusToASRepliesCollection(ctx context.Context, status *gtsmodel.Status, onlyOtherAccounts bool) (vocab.ActivityStreamsCollection, error)
- func (c *Converter) StatusToBoost(ctx context.Context, target *gtsmodel.Status, booster *gtsmodel.Account, ...) (*gtsmodel.Status, error)
- func (c *Converter) StatusToRSSItem(ctx context.Context, s *gtsmodel.Status) (*feeds.Item, error)
- func (c *Converter) StatusToWebStatus(ctx context.Context, s *gtsmodel.Status, requestingAccount *gtsmodel.Account) (*apimodel.Status, error)
- func (c *Converter) StatusURIsToASRepliesPage(ctx context.Context, status *gtsmodel.Status, onlyOtherAccounts bool, ...) (vocab.ActivityStreamsCollectionPage, error)
- func (c *Converter) StatusesToASFeaturedCollection(ctx context.Context, featuredCollectionID string, statuses []*gtsmodel.Status) (vocab.ActivityStreamsOrderedCollection, error)
- func (c *Converter) StatusesToASOutboxPage(ctx context.Context, outboxID string, maxID string, minID string, ...) (vocab.ActivityStreamsOrderedCollectionPage, error)
- func (c *Converter) TagToAPITag(ctx context.Context, t *gtsmodel.Tag, stubHistory bool) (apimodel.Tag, error)
- func (c *Converter) TagToAS(ctx context.Context, t *gtsmodel.Tag) (vocab.TootHashtag, error)
- func (c *Converter) ThemesToAPIThemes(themes []*gtsmodel.Theme) []apimodel.Theme
- func (c *Converter) UserToAPIUser(ctx context.Context, u *gtsmodel.User) *apimodel.User
- func (c *Converter) VisToAPIVis(ctx context.Context, m gtsmodel.Visibility) apimodel.Visibility
- func (c *Converter) WrapPersonInUpdate(person vocab.ActivityStreamsPerson, originAccount *gtsmodel.Account) (vocab.ActivityStreamsUpdate, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func APIFilterActionToFilterAction ¶ added in v0.16.0
func APIFilterActionToFilterAction(m apimodel.FilterAction) gtsmodel.FilterAction
func APIMarkerNameToMarkerName ¶ added in v0.11.0
func APIMarkerNameToMarkerName(m apimodel.MarkerName) gtsmodel.MarkerName
func APIVisToVis ¶ added in v0.8.0
func APIVisToVis(m apimodel.Visibility) gtsmodel.Visibility
func ContentToContentLanguage ¶ added in v0.13.0
ContentToContentLanguage tries to extract a content string and language tag string from the given intermediary content.
Either/both of the returned strings may be empty, depending on how things go.
func WrapStatusableInCreate ¶ added in v0.13.0
func WrapStatusableInCreate(status ap.Statusable, iriOnly bool) vocab.ActivityStreamsCreate
func WrapStatusableInUpdate ¶ added in v0.13.0
func WrapStatusableInUpdate(status ap.Statusable, iriOnly bool) vocab.ActivityStreamsUpdate
Types ¶
type Converter ¶ added in v0.12.0
type Converter struct {
// contains filtered or unexported fields
}
func NewConverter ¶
func (*Converter) ASAnnounceToStatus ¶ added in v0.12.0
func (c *Converter) ASAnnounceToStatus( ctx context.Context, announceable ap.Announceable, ) (*gtsmodel.Status, bool, error)
ASAnnounceToStatus converts an activitystreams 'announce' into a boost wrapper status. The returned bool indicates whether this boost is new (true) or not. If new, callers should use `status.BoostOfURI` to see the status being boosted, and do dereferencing on it as appropriate. If not new, then the boost has already been fully processed and can be ignored.
func (*Converter) ASBlockToBlock ¶ added in v0.12.0
func (c *Converter) ASBlockToBlock(ctx context.Context, blockable ap.Blockable) (*gtsmodel.Block, error)
ASBlockToBlock converts a remote activity streams 'block' representation into a gts model block.
func (*Converter) ASFlagToReport ¶ added in v0.12.0
func (c *Converter) ASFlagToReport(ctx context.Context, flaggable ap.Flaggable) (*gtsmodel.Report, error)
ASFlagToReport converts a remote activitystreams 'flag' representation into a gts model report.
func (*Converter) ASFollowToFollow ¶ added in v0.12.0
func (c *Converter) ASFollowToFollow(ctx context.Context, followable ap.Followable) (*gtsmodel.Follow, error)
ASFollowToFollowRequest converts a remote activitystreams `follow` representation into gts model follow.
func (*Converter) ASFollowToFollowRequest ¶ added in v0.12.0
func (c *Converter) ASFollowToFollowRequest(ctx context.Context, followable ap.Followable) (*gtsmodel.FollowRequest, error)
ASFollowToFollowRequest converts a remote activitystreams `follow` representation into gts model follow request.
func (*Converter) ASLikeToFave ¶ added in v0.12.0
func (c *Converter) ASLikeToFave(ctx context.Context, likeable ap.Likeable) (*gtsmodel.StatusFave, error)
ASLikeToFave converts a remote activitystreams 'like' representation into a gts model status fave.
func (*Converter) ASRepresentationToAccount ¶ added in v0.12.0
func (c *Converter) ASRepresentationToAccount(ctx context.Context, accountable ap.Accountable, accountDomain string) (*gtsmodel.Account, error)
ASRepresentationToAccount converts a remote account/person/application representation into a gts model account.
If accountDomain is provided then this value will be used as the account's Domain, else the AP ID host.
func (*Converter) ASStatusToStatus ¶ added in v0.12.0
func (c *Converter) ASStatusToStatus(ctx context.Context, statusable ap.Statusable) (*gtsmodel.Status, error)
ASStatus converts a remote activitystreams 'status' representation into a gts model status.
func (*Converter) AccountToAPIAccountBlocked ¶ added in v0.12.0
func (c *Converter) AccountToAPIAccountBlocked(ctx context.Context, a *gtsmodel.Account) (*apimodel.Account, error)
AccountToAPIAccountBlocked takes a db model account as a param, and returns a apitype account, or an error if something goes wrong. The returned account will be a bare minimum representation of the account. This function should be used when someone wants to view an account they've blocked.
func (*Converter) AccountToAPIAccountPublic ¶ added in v0.12.0
func (c *Converter) AccountToAPIAccountPublic(ctx context.Context, a *gtsmodel.Account) (*apimodel.Account, error)
AccountToAPIAccountPublic takes a db model account as a param, and returns a populated apitype account, or an error if something goes wrong. The returned account should be ready to serialize on an API level, and may NOT have sensitive fields. In other words, this is the public record that the server has of an account.
func (*Converter) AccountToAPIAccountSensitive ¶ added in v0.12.0
func (c *Converter) AccountToAPIAccountSensitive(ctx context.Context, a *gtsmodel.Account) (*apimodel.Account, error)
AppToAPIAppSensitive takes a db model application as a param, and returns a populated apitype application, or an error if something goes wrong. The returned application should be ready to serialize on an API level, and may have sensitive fields (such as client id and client secret), so serve it only to an authorized user who should have permission to see it.
func (*Converter) AccountToAS ¶ added in v0.12.0
func (c *Converter) AccountToAS(ctx context.Context, a *gtsmodel.Account) (vocab.ActivityStreamsPerson, error)
AccountToAS converts a gts model account into an activity streams person, suitable for federation
func (*Converter) AccountToASMinimal ¶ added in v0.12.0
func (c *Converter) AccountToASMinimal(ctx context.Context, a *gtsmodel.Account) (vocab.ActivityStreamsPerson, error)
AccountToASMinimal converts a gts model account into an activity streams person, suitable for federation.
The returned account will just have the Type, Username, PublicKey, and ID properties set. This is suitable for serving to requesters to whom we want to give as little information as possible because we don't trust them (yet).
func (*Converter) AccountToAdminAPIAccount ¶ added in v0.12.0
func (*Converter) AppToAPIAppPublic ¶ added in v0.12.0
func (c *Converter) AppToAPIAppPublic(ctx context.Context, a *gtsmodel.Application) (*apimodel.Application, error)
AppToAPIAppPublic takes a db model application as a param, and returns a populated apitype application, or an error if something goes wrong. The returned application should be ready to serialize on an API level, and has sensitive fields sanitized so that it can be served to non-authorized accounts without revealing any private information.
func (*Converter) AppToAPIAppSensitive ¶ added in v0.12.0
func (c *Converter) AppToAPIAppSensitive(ctx context.Context, a *gtsmodel.Application) (*apimodel.Application, error)
func (*Converter) AttachmentToAPIAttachment ¶ added in v0.12.0
func (c *Converter) AttachmentToAPIAttachment(ctx context.Context, a *gtsmodel.MediaAttachment) (apimodel.Attachment, error)
AttachmentToAPIAttachment converts a gts model media attacahment into its api representation for serialization on the API.
func (*Converter) AttachmentToAS ¶ added in v0.12.0
func (c *Converter) AttachmentToAS(ctx context.Context, a *gtsmodel.MediaAttachment) (vocab.ActivityStreamsDocument, error)
AttachmentToAS converts a gts model media attachment into an activity streams Attachment, suitable for federation
func (*Converter) BlockToAS ¶ added in v0.12.0
func (c *Converter) BlockToAS(ctx context.Context, b *gtsmodel.Block) (vocab.ActivityStreamsBlock, error)
BlockToAS converts a gts model block into an activityStreams BLOCK, suitable for federation. we want to end up with something like this:
{ "@context": "https://www.w3.org/ns/activitystreams", "actor": "https://example.org/users/some_user", "id":"https://example.org/users/some_user/blocks/SOME_ULID_OF_A_BLOCK", "object":"https://some_other.instance/users/some_other_user", "type":"Block" }
func (*Converter) BoostToAS ¶ added in v0.12.0
func (c *Converter) BoostToAS(ctx context.Context, boostWrapperStatus *gtsmodel.Status, boostingAccount *gtsmodel.Account, boostedAccount *gtsmodel.Account) (vocab.ActivityStreamsAnnounce, error)
BoostToAS converts a gts model boost into an activityStreams ANNOUNCE, suitable for federation
func (*Converter) DomainPermToAPIDomainPerm ¶ added in v0.12.0
func (c *Converter) DomainPermToAPIDomainPerm( ctx context.Context, d gtsmodel.DomainPermission, export bool, ) (*apimodel.DomainPermission, error)
DomainPermToAPIDomainPerm converts a gts model domin block or allow into an api domain permission.
func (*Converter) EmojiCategoryToAPIEmojiCategory ¶ added in v0.12.0
func (c *Converter) EmojiCategoryToAPIEmojiCategory(ctx context.Context, category *gtsmodel.EmojiCategory) (*apimodel.EmojiCategory, error)
EmojiCategoryToAPIEmojiCategory converts a gts model emoji category into its api (frontend) representation.
func (*Converter) EmojiToAPIEmoji ¶ added in v0.12.0
EmojiToAPIEmoji converts a gts model emoji into its api (frontend) representation for serialization on the API.
func (*Converter) EmojiToAS ¶ added in v0.12.0
EmojiToAS converts a gts emoji into a mastodon ns Emoji, suitable for federation. we're making something like this:
{ "id": "https://example.com/emoji/123", "type": "Emoji", "name": ":kappa:", "icon": { "type": "Image", "mediaType": "image/png", "url": "https://example.com/files/kappa.png" } }
func (*Converter) EmojiToAdminAPIEmoji ¶ added in v0.12.0
func (c *Converter) EmojiToAdminAPIEmoji(ctx context.Context, e *gtsmodel.Emoji) (*apimodel.AdminEmoji, error)
EmojiToAdminAPIEmoji converts a gts model emoji into an API representation with extra admin information.
func (*Converter) FaveToAS ¶ added in v0.12.0
func (c *Converter) FaveToAS(ctx context.Context, f *gtsmodel.StatusFave) (vocab.ActivityStreamsLike, error)
FaveToAS converts a gts model status fave into an activityStreams LIKE, suitable for federation. We want to end up with something like this:
{ "@context": "https://www.w3.org/ns/activitystreams", "actor": "https://ondergrond.org/users/dumpsterqueer", "id": "https://ondergrond.org/users/dumpsterqueer#likes/44584", "object": "https://testingtesting123.xyz/users/gotosocial_test_account/statuses/771aea80-a33d-4d6d-8dfd-57d4d2bfcbd4", "type": "Like" }
func (*Converter) FilterKeywordToAPIFilterKeyword ¶ added in v0.16.0
func (c *Converter) FilterKeywordToAPIFilterKeyword(ctx context.Context, filterKeyword *gtsmodel.FilterKeyword) *apimodel.FilterKeyword
FilterKeywordToAPIFilterKeyword converts a GTS model filter status into an API filter status.
func (*Converter) FilterKeywordToAPIFilterV1 ¶ added in v0.15.0
func (c *Converter) FilterKeywordToAPIFilterV1(ctx context.Context, filterKeyword *gtsmodel.FilterKeyword) (*apimodel.FilterV1, error)
FilterKeywordToAPIFilterV1 converts one GTS model filter and filter keyword into an API v1 filter
func (*Converter) FilterStatusToAPIFilterStatus ¶ added in v0.16.0
func (c *Converter) FilterStatusToAPIFilterStatus(ctx context.Context, filterStatus *gtsmodel.FilterStatus) *apimodel.FilterStatus
FilterStatusToAPIFilterStatus converts a GTS model filter status into an API filter status.
func (*Converter) FilterToAPIFilterV2 ¶ added in v0.16.0
func (c *Converter) FilterToAPIFilterV2(ctx context.Context, filter *gtsmodel.Filter) (*apimodel.FilterV2, error)
FilterToAPIFilterV2 converts one GTS model filter into an API v2 filter.
func (*Converter) FilterToAPIFiltersV1 ¶ added in v0.15.0
func (c *Converter) FilterToAPIFiltersV1(ctx context.Context, filter *gtsmodel.Filter) ([]*apimodel.FilterV1, error)
FilterToAPIFiltersV1 converts one GTS model filter into an API v1 filter list
func (*Converter) FollowRequestToFollow ¶ added in v0.12.0
func (c *Converter) FollowRequestToFollow( ctx context.Context, fr *gtsmodel.FollowRequest, ) *gtsmodel.Follow
FollowRequestToFollow just converts a follow request into a follow, that's it! No bells and whistles.
func (*Converter) FollowToAS ¶ added in v0.12.0
func (c *Converter) FollowToAS(ctx context.Context, f *gtsmodel.Follow) (vocab.ActivityStreamsFollow, error)
FollowToASFollow converts a gts model Follow into an activity streams Follow, suitable for federation
func (*Converter) InstanceRuleToAPIRule ¶ added in v0.12.0
func (c *Converter) InstanceRuleToAPIRule(r gtsmodel.Rule) apimodel.InstanceRule
InstanceRuleToAdminAPIRule converts a local instance rule into its api equivalent for serving at /api/v1/admin/instance/rules/:id
func (*Converter) InstanceRuleToAdminAPIRule ¶ added in v0.12.0
func (c *Converter) InstanceRuleToAdminAPIRule(r *gtsmodel.Rule) *apimodel.AdminInstanceRule
InstanceRuleToAdminAPIRule converts a local instance rule into its api equivalent for serving at /api/v1/admin/instance/rules/:id
func (*Converter) InstanceRulesToAPIRules ¶ added in v0.12.0
func (c *Converter) InstanceRulesToAPIRules(r []gtsmodel.Rule) []apimodel.InstanceRule
InstanceRulesToAPIRules converts all local instance rules into their api equivalent for serving at /api/v1/instance/rules
func (*Converter) InstanceToAPIV1Instance ¶ added in v0.12.0
func (c *Converter) InstanceToAPIV1Instance(ctx context.Context, i *gtsmodel.Instance) (*apimodel.InstanceV1, error)
InstanceToAPIV1Instance converts a gts instance into its api equivalent for serving at /api/v1/instance
func (*Converter) InstanceToAPIV2Instance ¶ added in v0.12.0
func (c *Converter) InstanceToAPIV2Instance(ctx context.Context, i *gtsmodel.Instance) (*apimodel.InstanceV2, error)
InstanceToAPIV2Instance converts a gts instance into its api equivalent for serving at /api/v2/instance
func (*Converter) ListToAPIList ¶ added in v0.12.0
ListToAPIList converts one gts model list into an api model list, for serving at /api/v1/lists/{id}
func (*Converter) MarkersToAPIMarker ¶ added in v0.12.0
func (c *Converter) MarkersToAPIMarker(ctx context.Context, markers []*gtsmodel.Marker) (*apimodel.Marker, error)
MarkersToAPIMarker converts several gts model markers into an api marker, for serving at /api/v1/markers
func (*Converter) MentionToAPIMention ¶ added in v0.12.0
func (c *Converter) MentionToAPIMention(ctx context.Context, m *gtsmodel.Mention) (apimodel.Mention, error)
MentionToAPIMention converts a gts model mention into its api (frontend) representation for serialization on the API.
func (*Converter) MentionToAS ¶ added in v0.12.0
func (c *Converter) MentionToAS(ctx context.Context, m *gtsmodel.Mention) (vocab.ActivityStreamsMention, error)
MentionToAS converts a gts model mention into an activity streams Mention, suitable for federation
func (*Converter) NotificationToAPINotification ¶ added in v0.12.0
func (c *Converter) NotificationToAPINotification( ctx context.Context, n *gtsmodel.Notification, filters []*gtsmodel.Filter, mutes *usermute.CompiledUserMuteList, ) (*apimodel.Notification, error)
NotificationToAPINotification converts a gts notification into a api notification
func (*Converter) OutboxToASCollection ¶ added in v0.12.0
func (c *Converter) OutboxToASCollection(ctx context.Context, outboxID string) (vocab.ActivityStreamsOrderedCollection, error)
OutboxToASCollection returns an ordered collection with appropriate id, next, and last fields. The returned collection won't have any actual entries; just links to where entries can be obtained. we want something that looks like this:
{ "@context": "https://www.w3.org/ns/activitystreams", "id": "https://example.org/users/whatever/outbox", "type": "OrderedCollection", "first": "https://example.org/users/whatever/outbox?page=true" }
func (*Converter) PollToAPIPoll ¶ added in v0.13.0
func (c *Converter) PollToAPIPoll(ctx context.Context, requester *gtsmodel.Account, poll *gtsmodel.Poll) (*apimodel.Poll, error)
PollToAPIPoll converts a database (gtsmodel) Poll into an API model representation appropriate for the given requesting account.
func (*Converter) PollVoteToASCreate ¶ added in v0.13.0
func (c *Converter) PollVoteToASCreate( ctx context.Context, vote *gtsmodel.PollVote, ) (vocab.ActivityStreamsCreate, error)
PollVoteToASCreate converts a vote on a poll into a Create activity, suitable for federation, with each choice in the vote appended as a Note to the Create's Object field.
func (*Converter) RelationshipToAPIRelationship ¶ added in v0.12.0
func (c *Converter) RelationshipToAPIRelationship(ctx context.Context, r *gtsmodel.Relationship) (*apimodel.Relationship, error)
RelationshipToAPIRelationship converts a gts relationship into its api equivalent for serving in various places
func (*Converter) ReportToAPIReport ¶ added in v0.12.0
func (c *Converter) ReportToAPIReport(ctx context.Context, r *gtsmodel.Report) (*apimodel.Report, error)
ReportToAPIReport converts a gts model report into an api model report, for serving at /api/v1/reports
func (*Converter) ReportToASFlag ¶ added in v0.12.0
func (c *Converter) ReportToASFlag(ctx context.Context, r *gtsmodel.Report) (vocab.ActivityStreamsFlag, error)
ReportToASFlag converts a gts model report into an activitystreams FLAG, suitable for federation.
func (*Converter) ReportToAdminAPIReport ¶ added in v0.12.0
func (c *Converter) ReportToAdminAPIReport(ctx context.Context, r *gtsmodel.Report, requestingAccount *gtsmodel.Account) (*apimodel.AdminReport, error)
ReportToAdminAPIReport converts a gts model report into an admin view report, for serving at /api/v1/admin/reports
func (*Converter) StatusToAPIStatus ¶ added in v0.12.0
func (c *Converter) StatusToAPIStatus( ctx context.Context, s *gtsmodel.Status, requestingAccount *gtsmodel.Account, filterContext statusfilter.FilterContext, filters []*gtsmodel.Filter, mutes *usermute.CompiledUserMuteList, ) (*apimodel.Status, error)
StatusToAPIStatus converts a gts model status into its api (frontend) representation for serialization on the API.
Requesting account can be nil.
Filter context can be the empty string if these statuses are not being filtered.
If there is a matching "hide" filter, the returned status will be nil with a ErrHideStatus error; callers need to handle that case by excluding it from results.
func (*Converter) StatusToAPIStatusSource ¶ added in v0.16.0
func (c *Converter) StatusToAPIStatusSource(ctx context.Context, s *gtsmodel.Status) (*apimodel.StatusSource, error)
StatusToAPIStatusSource returns the *apimodel.StatusSource of the given status. Callers should check beforehand whether a requester has permission to view the source of the status, and ensure they're passing only a local status into this function.
func (*Converter) StatusToAS ¶ added in v0.12.0
StatusToAS converts a gts model status into an ActivityStreams Statusable implementation, suitable for federation
func (*Converter) StatusToASDelete ¶ added in v0.12.0
func (c *Converter) StatusToASDelete(ctx context.Context, s *gtsmodel.Status) (vocab.ActivityStreamsDelete, error)
StatusToASDelete converts a gts model status into a Delete of that status, using just the URI of the status as object, and addressing the Delete appropriately.
func (*Converter) StatusToASRepliesCollection ¶ added in v0.12.0
func (c *Converter) StatusToASRepliesCollection(ctx context.Context, status *gtsmodel.Status, onlyOtherAccounts bool) (vocab.ActivityStreamsCollection, error)
StatusToASRepliesCollection converts a gts model status into an activityStreams REPLIES collection. the goal is to end up with something like this:
{ "@context": "https://www.w3.org/ns/activitystreams", "id": "https://example.org/users/whatever/statuses/01FCNEXAGAKPEX1J7VJRPJP490/replies", "type": "Collection", "first": { "id": "https://example.org/users/whatever/statuses/01FCNEXAGAKPEX1J7VJRPJP490/replies?page=true", "type": "CollectionPage", "next": "https://example.org/users/whatever/statuses/01FCNEXAGAKPEX1J7VJRPJP490/replies?only_other_accounts=true&page=true", "partOf": "https://example.org/users/whatever/statuses/01FCNEXAGAKPEX1J7VJRPJP490/replies", "items": [] } }
func (*Converter) StatusToBoost ¶ added in v0.12.0
func (c *Converter) StatusToBoost( ctx context.Context, target *gtsmodel.Status, booster *gtsmodel.Account, applicationID string, ) (*gtsmodel.Status, error)
StatusToBoost wraps the target status into a boost wrapper status owned by the requester.
func (*Converter) StatusToRSSItem ¶ added in v0.12.0
func (*Converter) StatusToWebStatus ¶ added in v0.13.0
func (c *Converter) StatusToWebStatus( ctx context.Context, s *gtsmodel.Status, requestingAccount *gtsmodel.Account, ) (*apimodel.Status, error)
StatusToWebStatus converts a gts model status into an api representation suitable for serving into a web template.
Requesting account can be nil.
func (*Converter) StatusURIsToASRepliesPage ¶ added in v0.12.0
func (c *Converter) StatusURIsToASRepliesPage(ctx context.Context, status *gtsmodel.Status, onlyOtherAccounts bool, minID string, replies map[string]*url.URL) (vocab.ActivityStreamsCollectionPage, error)
StatusURIsToASRepliesPage returns a collection page with appropriate next/part of pagination. the goal is to end up with something like this:
{ "@context": "https://www.w3.org/ns/activitystreams", "id": "https://example.org/users/whatever/statuses/01FCNEXAGAKPEX1J7VJRPJP490/replies?only_other_accounts=true&page=true", "type": "CollectionPage", "next": "https://example.org/users/whatever/statuses/01FCNEXAGAKPEX1J7VJRPJP490/replies?min_id=106720870266901180&only_other_accounts=true&page=true", "partOf": "https://example.org/users/whatever/statuses/01FCNEXAGAKPEX1J7VJRPJP490/replies", "items": [ "https://example.com/users/someone/statuses/106720752853216226", "https://somewhere.online/users/eeeeeeeeeep/statuses/106720870163727231" ] }
func (*Converter) StatusesToASFeaturedCollection ¶ added in v0.12.0
func (c *Converter) StatusesToASFeaturedCollection(ctx context.Context, featuredCollectionID string, statuses []*gtsmodel.Status) (vocab.ActivityStreamsOrderedCollection, error)
StatusesToASFeaturedCollection converts a slice of statuses into an ordered collection of URIs, suitable for serializing and serving via the activitypub API.
func (*Converter) StatusesToASOutboxPage ¶ added in v0.12.0
func (c *Converter) StatusesToASOutboxPage(ctx context.Context, outboxID string, maxID string, minID string, statuses []*gtsmodel.Status) (vocab.ActivityStreamsOrderedCollectionPage, error)
StatusesToASOutboxPage returns an ordered collection page using the given statuses and parameters as contents.
The maxID and minID should be the parameters that were passed to the database to obtain the given statuses. These will be used to create the 'id' field of the collection.
OutboxID is used to create the 'partOf' field in the collection.
Appropriate 'next' and 'prev' fields will be created based on the highest and lowest IDs present in the statuses slice. the goal is to end up with something like this:
{ "id": "https://example.org/users/whatever/outbox?page=true", "type": "OrderedCollectionPage", "next": "https://example.org/users/whatever/outbox?max_id=01FJC1Q0E3SSQR59TD2M1KP4V8&page=true", "prev": "https://example.org/users/whatever/outbox?min_id=01FJC1Q0E3SSQR59TD2M1KP4V8&page=true", "partOf": "https://example.org/users/whatever/outbox", "orderedItems": [ "id": "https://example.org/users/whatever/statuses/01FJC1MKPVX2VMWP2ST93Q90K7/activity", "type": "Create", "actor": "https://example.org/users/whatever", "published": "2021-10-18T20:06:18Z", "to": [ "https://www.w3.org/ns/activitystreams#Public" ], "cc": [ "https://example.org/users/whatever/followers" ], "object": "https://example.org/users/whatever/statuses/01FJC1MKPVX2VMWP2ST93Q90K7" ] }
func (*Converter) TagToAPITag ¶ added in v0.12.0
func (c *Converter) TagToAPITag(ctx context.Context, t *gtsmodel.Tag, stubHistory bool) (apimodel.Tag, error)
TagToAPITag converts a gts model tag into its api (frontend) representation for serialization on the API. If stubHistory is set to 'true', then the 'history' field of the tag will be populated with a pointer to an empty slice, for API compatibility reasons.
func (*Converter) TagToAS ¶ added in v0.12.0
TagToAS converts a gts model tag into a toot Hashtag, suitable for federation.
func (*Converter) ThemesToAPIThemes ¶ added in v0.15.0
ThemesToAPIThemes converts a slice of gtsmodel Themes into apimodel Themes.
func (*Converter) UserToAPIUser ¶ added in v0.16.0
UserToAPIUser converts a *gtsmodel.User to an API representation suitable for serving to that user.
Contains sensitive info so should only ever be served to the user themself.
func (*Converter) VisToAPIVis ¶ added in v0.12.0
func (c *Converter) VisToAPIVis(ctx context.Context, m gtsmodel.Visibility) apimodel.Visibility
VisToAPIVis converts a gts visibility into its api equivalent
func (*Converter) WrapPersonInUpdate ¶ added in v0.12.0
func (c *Converter) WrapPersonInUpdate(person vocab.ActivityStreamsPerson, originAccount *gtsmodel.Account) (vocab.ActivityStreamsUpdate, error)
WrapPersonInUpdate ...