package server // Contains types used by the Linstrom API. Types comply with the jsonapi spec import "time" var ( _ = linstromRole{} _ = linstromRelation{} ) type linstromNote struct { Id string `jsonapi:"primary,notes"` RawContent string `jsonapi:"attr,content"` OriginServer *linstromOriginServer `jsonapi:"relation,origin-server"` OriginServerId int `jsonapi:"attr,origin-server-id"` ReactionCount string `jsonapi:"attr,reaction-count"` CreatedAt time.Time `jsonapi:"attr,created-at"` UpdatedAt *time.Time `jsonapi:"attr,updated-at,omitempty"` Author *linstromAccount `jsonapi:"relation,author"` AuthorId string `jsonapi:"attr,author-id"` ContentWarning *string `jsonapi:"attr,content-warning,omitempty"` InReplyToId *string `jsonapi:"attr,in-reply-to-id,omitempty"` QuotesId *string `jsonapi:"attr,quotes-id,omitempty"` EmoteIds []string `jsonapi:"attr,emotes,omitempty"` Attachments []*linstromMediaMetadata `jsonapi:"relation,attachments,omitempty"` AttachmentIds []string `jsonapi:"attr,attachment-ids"` AccessLevel uint8 `jsonapi:"attr,access-level"` Pings []*linstromAccount `jsonapi:"relation,pings,omitempty"` PingIds []string `jsonapi:"attr,ping-ids,omitempty"` ReactionIds []uint `jsonapi:"attr,reaction-ids"` } type linstromOriginServer struct { Id uint `jsonapi:"primary,origins"` CreatedAt time.Time `jsonapi:"attr,created-at"` UpdatedAt *time.Time `jsonapi:"attr,updated-at,omitempty"` ServerType string `jsonapi:"attr,server-type"` // one of "Linstrom", "Mastodon", "Plemora", "Misskey" or "Wafrn" Domain string `jsonapi:"attr,domain"` DisplayName string `jsonapi:"attr,display-name"` Icon *linstromMediaMetadata `jsonapi:"relation,icon"` IsSelf bool `jsonapi:"attr,is-self"` } type linstromMediaMetadata struct { Id string `jsonapi:"primary,media"` CreatedAt time.Time `jsonapi:"attr,created-at"` UpdatedAt *time.Time `jsonapi:"attr,updated-at,omitempty"` IsRemote bool `jsonapi:"attr,is-remote"` Url string `jsonapi:"attr,url"` MimeType string `jsonapi:"attr,mime-type"` Name string `jsonapi:"attr,name"` AltText string `jsonapi:"attr,alt-text"` Blurred bool `jsonapi:"attr,blurred"` } type linstromAccount struct { Id string `jsonapi:"primary,accounts"` CreatedAt time.Time `jsonapi:"attr,created-at"` UpdatedAt *time.Time `jsonapi:"attr,updated-at,omitempty"` Username string `jsonapi:"attr,username"` OriginServer *linstromOriginServer `jsonapi:"relation,origin-server"` OriginServerId int `jsonapi:"attr,origin-server-id"` DisplayName string `jsonapi:"attr,display-name"` CustomFields []*linstromCustomAccountField `jsonapi:"relation,custom-fields"` CustomFieldIds []uint `jsonapi:"attr,custom-field-ids"` IsBot bool `jsonapi:"attr,is-bot"` Description string `jsonapi:"attr,description"` Icon *linstromMediaMetadata `jsonapi:"relation,icon"` IconId string `jsonapi:"attr,icon-id"` Banner *linstromMediaMetadata `jsonapi:"relation,banner"` BannerId *string `jsonapi:"attr,banner-id"` Background *linstromMediaMetadata `jsonapi:"relation,background"` BackgroundId *string `jsonapi:"attr,background-id"` RelationIds []uint `jsonapi:"attr,follows-ids"` Indexable bool `jsonapi:"attr,indexable"` RestrictedFollow bool `jsonapi:"attr,restricted-follow"` IdentifiesAs []string `jsonapi:"attr,identifies-as"` Pronouns []string `jsonapi:"attr,pronouns"` Roles []string `jsonapi:"attr,roles"` } type linstromCustomAccountField struct { Id uint `jsonapi:"primary,custom-account-fields"` CreatedAt time.Time `jsonapi:"attr,created-at"` UpdatedAt *time.Time `jsonapi:"attr,updated-at,omitempty"` Key string `jsonapi:"attr,key"` Value string `jsonapi:"attr,value"` Verified *bool `jsonapi:"attr,verified,omitempty"` BelongsToId string `jsonapi:"attr,belongs-to-id"` } type linstromRelation struct { Id uint `jsonapi:"primary,relations"` CreatedAt time.Time `jsonapi:"attr,created-at"` UpdatedAt time.Time `jsonapi:"attr,updated-at"` FromId string `jsonapi:"attr,from-id"` ToId string `jsonapi:"attr,to-id"` Requested bool `jsonapi:"attr,requested"` Accepted bool `jsonapi:"attr,accepted"` } type linstromReaction struct { Id uint `jsonapi:"primary,reactions"` NoteId string `jsonapi:"attr,note-id"` ReactorId string `jsonapi:"attr,reactor-id"` EmoteId uint `jsonapi:"attr,emote-id"` Emote *linstromEmote `jsonapi:"relation,emote"` } type linstromEmote struct { Id uint `jsonapi:"primary,emotes"` MetadataId string `jsonapi:"attr,metadata-id"` Metadata *linstromMediaMetadata `jsonapi:"relation,metadata"` Name string `jsonapi:"attr,name"` ServerId uint `jsonapi:"attr,server-id"` Server *linstromOriginServer `jsonapi:"relation,server"` } // Role is essentially just a carbon copy of storage/roles.go type linstromRole struct { Id uint `jsonapi:"primary,roles"` CreatedAt time.Time `jsonapi:"attr,created-at"` UpdatedAt *time.Time `jsonapi:"attr,updated-at,omitempty"` // Name of the role Name string `jsonapi:"attr,name"` // Priority of the role // Lower priority gets applied first and thus overwritten by higher priority ones // If two roles have the same priority, the order is undetermined and may be random // Default priority for new roles is 1 to always overwrite default user // And full admin has max priority possible Priority uint32 `jsonapi:"attr,priority"` // Whether this role is for a for a single user only (like custom, per user permissions in Discord) // If yes, Name will be the id of the user in question IsUserRole bool `jsonapi:"attr,is-user-role"` // Whether this role is one built into Linstrom from the start or not // Note: Built-in roles can't be modified IsBuiltIn bool `jsonapi:"attr,is-builtin"` // --- User permissions --- CanSendMedia *bool `jsonapi:"attr,can-send-media"` CanSendCustomEmotes *bool `jsonapi:"attr,can-send-custom-emotes"` CanSendCustomReactions *bool `jsonapi:"attr,can-send-custom-reactions"` CanSendPublicNotes *bool `jsonapi:"attr,can-send-public-notes"` CanSendLocalNotes *bool `jsonapi:"attr,can-send-local-notes"` CanSendFollowerOnlyNotes *bool `jsonapi:"attr,can-send-follower-only-notes"` CanSendPrivateNotes *bool `jsonapi:"attr,can-send-private-notes"` CanSendReplies *bool `jsonapi:"attr,can-send-replies"` CanQuote *bool `jsonapi:"attr,can-quote"` CanBoost *bool `jsonapi:"attr,can-boost"` CanIncludeLinks *bool `jsonapi:"attr,can-include-links"` CanIncludeSurvey *bool `jsonapi:"attr,can-include-survey"` CanChangeDisplayName *bool `jsonapi:"attr,can-change-display-name"` BlockedUsers []string `jsonapi:"attr,blocked-users"` CanSubmitReports *bool `jsonapi:"attr,can-submit-reports"` CanLogin *bool `jsonapi:"attr,can-login"` CanMentionOthers *bool `jsonapi:"attr,can-mention-others"` HasMentionCountLimit *bool `jsonapi:"attr,has-mention-count-limit"` MentionLimit *uint32 `jsonapi:"attr,mention-count-limit"` // CanViewBoosts *bool // CanViewQuotes *bool // CanViewMedia *bool // CanViewCustomEmotes *bool // --- Automod --- AutoNsfwMedia *bool `jsonapi:"attr,auto-nsfw-media"` AutoCwPosts *bool `jsonapi:"attr,auto-cw-posts"` AutoCwPostsText *string `jsonapi:"attr,auto-cw-posts-text"` ScanCreatedPublicNotes *bool `jsonapi:"attr,scan-created-public-notes"` ScanCreatedLocalNotes *bool `jsonapi:"attr,scan-created-local-notes"` ScanCreatedFollowerOnlyNotes *bool `jsonapi:"attr,scan-created-follower-only-notes"` ScanCreatedPrivateNotes *bool `jsonapi:"attr,scan-created-private-notes"` DisallowInteractionsWith []string `jsonapi:"attr,disallow-interactions-with"` WithholdNotesForManualApproval *bool `jsonapi:"attr,withhold-notes-for-manual-approval"` WithholdNotesBasedOnRegex *bool `jsonapi:"attr,withhold-notes-based-on-regex"` WithholdNotesRegexes []string `jsonapi:"attr,withhold-notes-regexes"` // --- Admin perms --- // If set, counts as all permissions being set as given and all restrictions being disabled FullAdmin *bool `jsonapi:"attr,full-admin"` CanAffectOtherAdmins *bool `jsonapi:"attr,can-affect-other-admins"` CanDeleteNotes *bool `jsonapi:"attr,can-delete-notes"` CanConfirmWithheldNotes *bool `jsonapi:"attr,can-confirm-withheld-notes"` CanAssignRoles *bool `jsonapi:"attr,can-assign-roles"` CanSupressInteractionsBetweenUsers *bool `jsonapi:"attr,can-supress-interactions-between-users"` CanOverwriteDisplayNames *bool `jsonapi:"attr,can-overwrite-display-names"` CanManageCustomEmotes *bool `jsonapi:"attr,can-manage-custom-emotes"` CanViewDeletedNotes *bool `jsonapi:"attr,can-view-deleted-notes"` CanRecoverDeletedNotes *bool `jsonapi:"attr,can-recover-deleted-notes"` CanManageAvatarDecorations *bool `jsonapi:"attr,can-manage-avatar-decorations"` CanManageAds *bool `jsonapi:"attr,can-manage-ads"` CanSendAnnouncements *bool `jsonapi:"attr,can-send-announcements"` }