Documentation ¶
Index ¶
- func APIMarkerNameToMarkerName(m apimodel.MarkerName) gtsmodel.MarkerName
- func APIVisToVis(m apimodel.Visibility) gtsmodel.Visibility
- 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) FollowRequestToFollow(ctx context.Context, f *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) (*apimodel.Notification, error)
- func (c *Converter) OutboxToASCollection(ctx context.Context, outboxID string) (vocab.ActivityStreamsOrderedCollection, 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) 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, s *gtsmodel.Status, boostingAccount *gtsmodel.Account) (*gtsmodel.Status, error)
- func (c *Converter) StatusToRSSItem(ctx context.Context, s *gtsmodel.Status) (*feeds.Item, 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) VisToAPIVis(ctx context.Context, m gtsmodel.Visibility) apimodel.Visibility
- func (c *Converter) WrapPersonInUpdate(person vocab.ActivityStreamsPerson, originAccount *gtsmodel.Account) (vocab.ActivityStreamsUpdate, error)
- func (c *Converter) WrapStatusableInCreate(status ap.Statusable, objectIRIOnly bool) (vocab.ActivityStreamsCreate, error)
- func (c *Converter) WrapStatusableInUpdate(status ap.Statusable, objectIRIOnly bool) (vocab.ActivityStreamsUpdate, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
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
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 status.
The returned bool indicates whether this status is new (true) or not new (false).
In other words, if the status is already in the database with the ID set on the announceable, then that will be returned, the returned bool will be false, and no further processing is necessary. If the returned bool is true, indicating that this is a new announce, then further processing will be necessary, because the returned status will be bareboned and require further dereferencing.
This is useful when multiple users on an instance might receive the same boost, and we only want to process the boost once.
NOTE -- this is different from one status being boosted multiple times! In this case, new boosts should indeed be created.
Implementation note: this function creates and returns a boost WRAPPER status which references the boosted status in its BoostOf field. No dereferencing is done on the boosted status by this function. Callers should look at `status.BoostOf` to see the status being boosted, and do dereferencing on it as appropriate.
The returned boolean indicates whether or not the boost has already been seen before by this instance. If it was, then status.BoostOf should be a fully filled-out status. If not, then only status.BoostOf.URI will be set.
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) FollowRequestToFollow ¶ added in v0.12.0
func (c *Converter) FollowRequestToFollow(ctx context.Context, f *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) (*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) 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) (*apimodel.Status, error)
StatusToAPIStatus converts a gts model status into its api (frontend) representation for serialization on the API.
Requesting account can be nil.
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, s *gtsmodel.Status, boostingAccount *gtsmodel.Account) (*gtsmodel.Status, error)
StatusToBoost wraps the given status into a boosting status.
func (*Converter) StatusToRSSItem ¶ added in v0.12.0
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) 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 ...
func (*Converter) WrapStatusableInCreate ¶ added in v0.12.0
func (c *Converter) WrapStatusableInCreate(status ap.Statusable, objectIRIOnly bool) (vocab.ActivityStreamsCreate, error)
WrapNoteInCreate wraps a Statusable with a Create activity.
If objectIRIOnly is set to true, then the function won't put the *entire* note in the Object field of the Create, but just the AP URI of the note. This is useful in cases where you want to give a remote server something to dereference, and still have control over whether or not they're allowed to actually see the contents.
func (*Converter) WrapStatusableInUpdate ¶ added in v0.12.0
func (c *Converter) WrapStatusableInUpdate(status ap.Statusable, objectIRIOnly bool) (vocab.ActivityStreamsUpdate, error)
WrapStatusableInUpdate wraps a Statusable with an Update activity.
If objectIRIOnly is set to true, then the function won't put the *entire* note in the Object field of the Create, but just the AP URI of the note. This is useful in cases where you want to give a remote server something to dereference, and still have control over whether or not they're allowed to actually see the contents.