Documentation ¶
Overview ¶
Package model contains all of the domain model objects that are used in the system. Model objects map loosely to the concept of "Entities" outlined in the "Clean Architecture" design pattern (https://blog.cleancoder.com/uncle-bob/2012/08/13/the-clean-architecture.html),so model objects do not contain business logic -- only pure data and limited functionality (such as validation). Database access, business logic, and other more advanced features are handled by the service package.
Index ¶
- Constants
- Variables
- func AttachmentRulesSchema() schema.Element
- func AttachmentSchema() schema.Element
- func ConnectionSchema() schema.Element
- func ContentSchema() schema.Element
- func DocumentLinkSchema() schema.Element
- func DomainSchema() schema.Element
- func EncryptionKeySchema() schema.Element
- func FolderSchema() schema.Element
- func FollowerSchema() schema.Element
- func FollowerSummaryFields() []string
- func FollowingSchema() schema.Element
- func FollowingSummaryFields() []string
- func GroupFields() []string
- func GroupSchema() schema.Element
- func MentionSchema() schema.Element
- func MessageFields() []string
- func MessageSchema() schema.Element
- func NewStreamPermissions() mapof.Object[sliceof.String]
- func NewStreamWidgets() set.Slice[StreamWidget]
- func OAuthClientSchema() schema.Element
- func OAuthUserTokenSchema() schema.Element
- func OriginLinkSchema() schema.Element
- func OutboxMessageFields() []string
- func OutboxMessageSchema() schema.Element
- func OutboxMessageSummaryFields() []string
- func PasswordResetSchema() schema.Element
- func PermissionSchema() schema.Element
- func PersonLinkProfileURL(person PersonLink) string
- func PersonLinkSchema() schema.Element
- func ResponseSchema() schema.Element
- func RuleSchema() schema.Element
- func RuleSummaryFields() []string
- func SearchTagSchema() schema.Element
- func SortThemes(a, b Theme) bool
- func StreamSchema() schema.Element
- func StreamSummaryFields() []string
- func StreamWidgetSchema() schema.Element
- func ToToken(value string) string
- func UserSchema() schema.Element
- func UserSummaryFields() []string
- func WebhookFields() []string
- func WebhookSchema() schema.Element
- func WidgetSchema() schema.Element
- type Action
- type ActorSummary
- type Attachment
- func (attachment *Attachment) AspectRatio() string
- func (attachment *Attachment) CalcURL(host string) string
- func (attachment *Attachment) DownloadExtension() string
- func (attachment *Attachment) DownloadMimeType() string
- func (attachment Attachment) FileSpec(address *url.URL) mediaserver.FileSpec
- func (attachment *Attachment) GetPointer(name string) (any, bool)
- func (attachment *Attachment) GetStringOK(name string) (string, bool)
- func (attachment Attachment) HasDimensions() bool
- func (attachment *Attachment) ID() string
- func (attachment Attachment) JSONLD() map[string]any
- func (attachment *Attachment) MimeCategory() string
- func (attachment *Attachment) MimeType() string
- func (attachment *Attachment) OriginalExtension() string
- func (attachment *Attachment) SetRules(width int, height int, extensions []string)
- func (attachment *Attachment) SetString(name string, value string) bool
- func (attachment *Attachment) SetURL(host string)
- type AttachmentRules
- type Authorization
- type Bundle
- type Connection
- type Content
- type DatasetMap
- type DocumentLink
- type Domain
- func (domain *Domain) GetPointer(name string) (any, bool)
- func (domain Domain) GetStringOK(name string) (string, bool)
- func (domain *Domain) HasRegistrationForm() bool
- func (domain *Domain) Host() string
- func (domain *Domain) ID() string
- func (domain *Domain) IconURL() string
- func (domain Domain) IsEmpty() bool
- func (domain Domain) NotEmpty() bool
- func (domain *Domain) SetString(name string, value string) bool
- type Email
- type EncryptionKey
- type FieldLister
- type Folder
- func (folder *Folder) GetIntOK(name string) (int, bool)
- func (folder Folder) GetRank() int64
- func (folder *Folder) GetStringOK(name string) (string, bool)
- func (folder Folder) ID() string
- func (folder Folder) LookupCode() form.LookupCode
- func (folder Folder) Roles(authorization *Authorization) []string
- func (folder *Folder) SetInt(name string, value int) bool
- func (folder *Folder) SetString(name string, value string) bool
- func (folder Folder) State() string
- func (folder Folder) Toot() object.List
- type FolderList
- type Follower
- func (follower Follower) GetJSONLD() mapof.Any
- func (follower *Follower) GetPointer(name string) (any, bool)
- func (follower *Follower) GetStringOK(name string) (string, bool)
- func (follower *Follower) ID() string
- func (follower Follower) MarshalMap() mapof.Any
- func (follower Follower) ParentURL(host string) string
- func (follower Follower) Roles(authorization *Authorization) []string
- func (follower *Follower) SetString(name string, value string) bool
- func (follower Follower) State() string
- func (follower *Follower) UnmarshalMap(data mapof.Any)
- func (follower Follower) UnsubscribeLink(host string) string
- type FollowerSummary
- type Following
- func (following *Following) GetLink(property string, value string) digit.Link
- func (following *Following) GetPointer(name string) (any, bool)
- func (following Following) GetStringOK(name string) (string, bool)
- func (following Following) ID() string
- func (following Following) IsZero() bool
- func (following Following) NotZero() bool
- func (following *Following) Origin(originType string) OriginLink
- func (following Following) Roles(authorization *Authorization) []string
- func (following *Following) SetLinks(newLinks ...digit.Link)
- func (following *Following) SetString(name string, value string) bool
- func (following Following) State() string
- func (following Following) Toot() object.Relationship
- func (following Following) UsernameOrID() string
- type FollowingSummary
- type Group
- type JSONLDGetter
- type JWTKey
- type Mention
- type Message
- func (message *Message) AddReference(reference OriginLink) bool
- func (summary Message) Fields() []string
- func (message *Message) GetPointer(name string) (any, bool)
- func (message Message) GetRank() int64
- func (message *Message) GetStringOK(name string) (string, bool)
- func (message Message) ID() string
- func (message Message) IsRead() bool
- func (message *Message) MarkMuted() bool
- func (message *Message) MarkNewReplies() bool
- func (message *Message) MarkRead() bool
- func (message *Message) MarkUnmuted() bool
- func (message *Message) MarkUnread() bool
- func (message Message) NotRead() bool
- func (message Message) RankSeconds() int64
- func (message Message) Roles(authorization *Authorization) []string
- func (message *Message) SetMyResponse(responseType string)
- func (message *Message) SetState(stateID string)
- func (message *Message) SetString(name string, value string) bool
- func (message Message) State() string
- func (message Message) Toot() object.Status
- type OAuthAuthorizationRequest
- type OAuthClient
- type OAuthUserToken
- func (token OAuthUserToken) Code() string
- func (userToken *OAuthUserToken) GetPointer(name string) (any, bool)
- func (userToken *OAuthUserToken) GetStringOK(name string) (string, bool)
- func (token OAuthUserToken) ID() string
- func (token OAuthUserToken) JSONResponse() map[string]any
- func (userToken *OAuthUserToken) SetString(name string, value string) bool
- func (token OAuthUserToken) Toot() object.Token
- type OAuthUserTokenRequest
- type OAuthUserTokenRevokeRequest
- type OriginLink
- func (origin OriginLink) Equals(other OriginLink) bool
- func (origin *OriginLink) GetPointer(name string) (any, bool)
- func (origin *OriginLink) GetStringOK(name string) (string, bool)
- func (origin OriginLink) Icon() string
- func (origin OriginLink) IsEmpty() bool
- func (origin OriginLink) NotEmpty() bool
- func (origin *OriginLink) SetString(name string, value string) bool
- type OutboxMessage
- func (message OutboxMessage) Created() int64
- func (summary OutboxMessage) Fields() []string
- func (message OutboxMessage) GetJSONLD() mapof.Any
- func (message *OutboxMessage) GetPointer(name string) (any, bool)
- func (message *OutboxMessage) GetStringOK(name string) (string, bool)
- func (message OutboxMessage) ID() string
- func (message *OutboxMessage) SetString(name string, value string) bool
- type OutboxMessageSummary
- type PasswordReset
- type PersonLink
- func (person PersonLink) GetJSONLD() mapof.Any
- func (link *PersonLink) GetPointer(name string) (any, bool)
- func (link *PersonLink) GetStringOK(name string) (string, bool)
- func (person PersonLink) GetURL(name string) *url.URL
- func (person PersonLink) HasIconURL() bool
- func (person PersonLink) IsEmpty() bool
- func (person PersonLink) MarshalMap() mapof.Any
- func (person PersonLink) NotEmpty() bool
- func (link *PersonLink) SetString(name string, value string) bool
- func (person PersonLink) Toot() object.Account
- func (person *PersonLink) UnmarshalMap(data mapof.Any)
- func (person PersonLink) UsernameOrID() string
- type Registration
- type RegistrationTxn
- type Response
- func (response Response) ActivityPubCreateDate() string
- func (response Response) ActivityPubURL() string
- func (response Response) CreateDateSeconds() int64
- func (response Response) Fields() []string
- func (response Response) GetJSONLD() mapof.Any
- func (response *Response) GetPointer(name string) (any, bool)
- func (response Response) GetStringOK(name string) (string, bool)
- func (response Response) ID() string
- func (response Response) IsEmpty() bool
- func (response Response) IsEqual(other Response) bool
- func (response Response) NotEmpty() bool
- func (response Response) Roles(authorization *Authorization) []string
- func (response *Response) SetString(name string, value string) bool
- func (response Response) State() string
- func (response Response) Toot() object.Status
- type Role
- type RoleStateEnumerator
- type Rule
- func (rule Rule) Fields() []string
- func (rule Rule) FilterByActor(actor string) bool
- func (rule Rule) FilterByActorAndContent(actor string, content ...string) bool
- func (rule Rule) FilterByActors(actors ...string) bool
- func (rule Rule) FilterByContent(content string) bool
- func (rule *Rule) GetPointer(name string) (any, bool)
- func (rule Rule) GetRank() int64
- func (rule *Rule) GetStringOK(name string) (string, bool)
- func (rule Rule) ID() string
- func (rule Rule) Origin() string
- func (rule Rule) OriginAdmin() bool
- func (rule Rule) OriginRemote() bool
- func (rule Rule) OriginUser() bool
- func (rule Rule) Roles(authorization *Authorization) []string
- func (rule *Rule) SetString(name string, value string) bool
- func (rule Rule) State() string
- func (rule Rule) Toot() object.Relationship
- type RuleSummary
- type SearchResult
- type SearchTag
- func (searchTag SearchTag) Fields() []string
- func (searchTag *SearchTag) GetPointer(name string) (any, bool)
- func (searchTag SearchTag) GetStringOK(name string) (string, bool)
- func (searchTag SearchTag) ID() string
- func (searchTag SearchTag) ImageURL() string
- func (searchTag SearchTag) RelatedTags() sliceof.String
- func (searchTag *SearchTag) SetString(name string, value string) bool
- func (searchTag SearchTag) StatusText() string
- type State
- type StateSetter
- type Stream
- func (stream *Stream) ActivityPubAnnouncedURL() string
- func (stream Stream) ActivityPubChildrenURL() string
- func (stream Stream) ActivityPubDislikesURL() string
- func (stream *Stream) ActivityPubFollowersURL() string
- func (stream *Stream) ActivityPubInboxURL() string
- func (stream Stream) ActivityPubLikesURL() string
- func (stream *Stream) ActivityPubOutboxURL() string
- func (stream Stream) ActivityPubRepliesURL() string
- func (stream Stream) ActivityPubResponses(responseType string) string
- func (stream Stream) ActivityPubSharesURL() string
- func (stream Stream) ActivityPubType() string
- func (stream Stream) ActivityPubURL() string
- func (stream *Stream) ActorLink() PersonLink
- func (stream *Stream) AssignPermission(role string, groupID primitive.ObjectID)
- func (stream *Stream) CopyFrom(other Stream)
- func (stream *Stream) DefaultAllowAnonymous() bool
- func (stream *Stream) DocumentLink() DocumentLink
- func (stream *Stream) GetBoolOK(name string) (bool, bool)
- func (stream *Stream) GetPointer(name string) (any, bool)
- func (stream Stream) GetRank() int64
- func (stream *Stream) GetSort(fieldName string) any
- func (stream *Stream) GetStringOK(name string) (string, bool)
- func (stream Stream) GetWebhookData() mapof.Any
- func (stream *Stream) GrandparentID() primitive.ObjectID
- func (stream *Stream) GrandparentURL() string
- func (stream *Stream) HasGrandparent() bool
- func (stream *Stream) HasParent() bool
- func (stream *Stream) ID() string
- func (stream *Stream) IsPublished() bool
- func (stream *Stream) ParentURL() string
- func (stream *Stream) Permalink() string
- func (stream *Stream) PermissionGroups(roles ...string) []primitive.ObjectID
- func (stream *Stream) PermissionRoles(groupIDs ...primitive.ObjectID) []string
- func (stream *Stream) PublishActivity() string
- func (stream *Stream) Roles(authorization *Authorization) []string
- func (stream *Stream) SetAttributedTo(person PersonLink)
- func (stream *Stream) SetBool(name string, value bool) bool
- func (stream *Stream) SetState(stateID string)
- func (stream *Stream) SetString(name string, value string) bool
- func (stream *Stream) SimplePermissionModel() mapof.Any
- func (stream *Stream) State() string
- func (stream Stream) Toot() object.Status
- func (stream *Stream) WidgetByID(streamWidgetID primitive.ObjectID) StreamWidget
- func (stream *Stream) WidgetsByLocation(location string) []StreamWidget
- type StreamActor
- type StreamSummary
- func (summary StreamSummary) Author() PersonLink
- func (summary StreamSummary) ContentHTML() string
- func (summary StreamSummary) ContentRaw() string
- func (summary StreamSummary) Fields() []string
- func (summary StreamSummary) ID() string
- func (summary StreamSummary) IsPublished() bool
- func (summary StreamSummary) ParentID() string
- func (summary StreamSummary) StreamID() string
- type StreamWidget
- type Template
- func (template *Template) Action(actionID string) (Action, bool)
- func (template *Template) CanBeContainedBy(templateRoles ...string) bool
- func (template *Template) Default() Action
- func (template *Template) GetOEmbed() *template.Template
- func (template *Template) HasOEmbed() bool
- func (template Template) ID() string
- func (template *Template) Inherit(parent *Template)
- func (template *Template) IsValidWidgetLocation(location string) bool
- func (template Template) IsZero() bool
- func (template *Template) State(stateID string) (State, bool)
- type Theme
- type User
- func (user *User) ActivityPubBlockedURL() string
- func (user *User) ActivityPubFollowersURL() string
- func (user *User) ActivityPubFollowingURL() string
- func (user *User) ActivityPubIconURL() string
- func (user *User) ActivityPubImageURL() string
- func (user *User) ActivityPubInboxURL() string
- func (user *User) ActivityPubLikedURL() string
- func (user *User) ActivityPubOutboxURL() string
- func (user *User) ActivityPubPublicKeyURL() string
- func (user *User) ActivityPubURL() string
- func (user *User) AddGroup(groupID primitive.ObjectID)
- func (user *User) Claims() jwt.Claims
- func (user User) GetJSONLD() mapof.Any
- func (user *User) GetPassword() string
- func (user *User) GetPointer(name string) (any, bool)
- func (user User) GetRank() int64
- func (user *User) GetStringOK(name string) (string, bool)
- func (user *User) GetUsername() string
- func (user User) GetWebhookData() mapof.Any
- func (user *User) ID() string
- func (user *User) JSONFeedURL() string
- func (user User) PersonLink() PersonLink
- func (user *User) RemoveGroup(groupID primitive.ObjectID)
- func (user *User) Roles(authorization *Authorization) []string
- func (user *User) SetPassword(password string)
- func (user *User) SetState(stateID string)
- func (user *User) SetString(name string, value string) bool
- func (user *User) SetUsername(username string)
- func (user *User) State() string
- func (user User) Summary() UserSummary
- func (user User) Toot() object.Account
- type UserResponseSummary
- type UserSummary
- type Webhook
- type WebhookDataGetter
- type Widget
Constants ¶
const AttachmentMediaTypeAny = "any"
AttachmentMediaTypeOther represents an attachment that is any type
const AttachmentMediaTypeAudio = "audio"
AttachmentMediaTypeAudio represents an attachment that is audio
const AttachmentMediaTypeDocument = "document"
AttachmentMediaTypeDocument represents an attachment that is a document
const AttachmentMediaTypeImage = "image"
AttachmentMediaTypeImage represents an attachment that is an image
const AttachmentMediaTypeVideo = "video"
AttachmentMediaTypeVideo represents an attachment that is a video
const AttachmentObjectTypeDomain = "Domain"
AttachmentObjectTypeDomain represents an attachment that is owned by a Domain
const AttachmentObjectTypeSearchTag = "SearchTag"
AttachmentObjectTypeSearchTag represents an attachment that is owned by a SearchTag
const AttachmentObjectTypeStream = "Stream"
AttachmentObjectTypeStream represents an attachment that is owned by a Stream
const AttachmentObjectTypeUser = "User"
AttachmentObjectTypeUser represents an attachment that is owned by a User
const AttachmentStatusReady = "READY"
AttachmentStatusReady represents an attachment that has been transcoded (if necessary) and is ready to download or stream
const AttachmentStatusWorking = "WORKING"
AttachmentStatusWorking represents an attachment that is currently being processed and cannot be downloaded yet.
const ConnectionProviderGiphy = "GIPHY"
ConnectionProviderGiphy represents an API connection to the https://giphy.com service for generating animated GIFs.
const ConnectionProviderStripe = "STRIPE"
ConnectionProviderStripe represents an API connection to the https://stripe.com service for processing payments.
const ConnectionProviderUnsplash = "UNSPLASH"
ConnectionProviderUnsplash represents an API connection to the https://unsplash.com service for generating photographs.
const ConnectionTypeImage = "IMAGE"
ConnectionTypeIMage represents a provider/connection that can be used to generate images.
const ConnectionTypePayment = "PAYMENT"
ConnectionTypePayment represents a provider/connection that can be used to process payments.
const ContentFormatEditorJS = "EDITORJS"
ContentFormatEditorJS represents a content object whose Raw value is defined in EditorJS This content must be converted into HTML before being used in a browser See: https://editorjs.io
const ContentFormatHTML = "HTML"
ContentFormatHTML represents a content object whose Raw value is defined in HTML This content can be used in a browser (after passing through a safety filter like BlueMonday)
const ContentFormatMarkdown = "MARKDOWN"
ContentFormatContentJS represents a content object whose Raw value is defined in Markdown This content must be converted into HTML before being used in a browser See: https://commonmark.org
const ContentFormatText = "TEXT"
ContentFormatText represents a content object whose Raw value is defined in plain text. This content must be converted into HTML before being used in a browser
const DomainColorModeAuto = "AUTO"
DomainColorModeAuto represents color mode that is determined automatically by the client's settings
const DomainColorModeDark = "DARK"
DomainColorModeDark represents dark color mode
const DomainColorModeLight = "LIGHT"
DomainColorModeLight represents light color mode
const EncryptionKeyEncodingPlaintext = "plaintext"
const EncryptionKeyTypeStream = "Stream"
EncryptionKeyTypeStream identifies an EncryptionKey that is owned by a Stream/Actor
const EncryptionKeyTypeUser = "User"
EncryptionKeyTypeUser identifies an EncryptionKey that is owned by a User/Actor
const FolderFilterAll = "ALL"
const FolderFilterUnread = "UNREAD"
const FolderLayoutChat = "CHAT"
const FolderLayoutMagazine = "MAGAZINE"
const FolderLayoutNewspaper = "NEWSPAPER"
const FolderLayoutSocial = "SOCIAL"
const FollowerMethodActivityPub = "ACTIVITYPUB"
FollowerMethodActivityPub represents a Follower subscription that receives real-time updates via ActivityPub https://www.w3.org/TR/activitypub/
const FollowerMethodEmail = "EMAIL"
FollowerMethodEmail represents a Follower subscription that received real-time updates via email
const FollowerMethodWebSub = "WEBSUB"
FollowerMethodWebSub represents a Follower subscription that receives real-time updates via WebSub https://websub.rocks
const FollowerStateActive = "ACTIVE"
FollowerStateActive represents an active Follower who is currently receiving updates from the Stream
const FollowerStatePending = "PENDING"
FollowerStatePending represents an inactive Follower who has yet to confirm their subscription status (e.g. via email confirmation)
const FollowerTypeSearch = "Search"
FollowerTypeSearch represents a Follower that is following a Search Query
const FollowerTypeStream = "Stream"
FollowerTypeStream represents a Follower that is following a Stream
const FollowerTypeUser = "User"
FollowerTypeUser represents a Follower that is following a User
const FollowingBehaviorPosts = "POSTS"
FollowingBehaviorPosts declares that only Posts (not Replies) should be imported from a followed account
const FollowingBehaviorPostsAndReplies = "POSTS+REPLIES"
FollowingBehaviorPostsAndReplies declares that all messages (both Posts and Replies) should be imported from a followed account
const FollowingMethodActivityPub = "ACTIVITYPUB"
FollowingMethodActivityPub represents the ActivityPub subscription https://www.w3.org/TR/activitypub/
const FollowingMethodPoll = "POLL"
FollowingMethodPoll represents a subscription that must be polled for updates
const FollowingMethodWebSub = "WEBSUB"
FollowingMethodWebSub represents a WebSub subscription https://websub.rocks
const FollowingRuleActionBlock = "BLOCK"
FollowingRuleActionBlock declares that Rules published by a followed account should be blocked
const FollowingRuleActionIgnore = "IGNORE"
FollowingRuleActionIgnore declares that Rules published by a followed account should be ignored
const FollowingRuleActionLabel = "LABEL"
FollowingRuleActionLabel declares that Rules published by a followed account should be labeled with content provided by the followed account.
const FollowingRuleActionMute = "MUTE"
FollowingRuleActionMute declares that Rules published by a followed account should be muted
const FollowingStatusFailure = "FAILURE"
FollowingStatusFailure represents a following that has failed to load
const FollowingStatusLoading = "LOADING"
FollowingStatusLoading represents a following that is being loaded for the first time
const FollowingStatusNew = "NEW"
FollowingStatusNew represents a new following that has not yet been polled
const FollowingStatusSuccess = "SUCCESS"
FollowingStatusSuccess represents a following that has successfully loaded
const LinkRelationAlternate = "alternate"
LinkRelationAlternate refers to an alternate format of the current document https://html.spec.whatwg.org/multipage/links.html#link-type-alternate
const LinkRelationAuthor = "author"
LinkRelationAuthor refers to the context's author. https://html.spec.whatwg.org/multipage/links.html#link-type-author
const LinkRelationBookmark = "bookmark"
LinkRelationBookmark gives a permanent link to use for bookmarking purposes https://html.spec.whatwg.org/multipage/links.html#link-type-bookmark
const LinkRelationHub = "hub"
LinkRelationHub is a link to a WebSub hub https://www.w3.org/TR/websub/#discovery
const LinkRelationIcon = "icon"
LinkRelationIcon indicates an icon for the current document https://html.spec.whatwg.org/multipage/links.html#rel-icon
const LinkRelationInReplyTo = "in-reply-to"
LinkRelationInReplyTo indicates that this document is a reply to another document https://www.rfc-editor.org/rfc/rfc4685.html
const LinkRelationOriginal = "original"
LinkRelationOriginal points to an Original Resource. https://www.rfc-editor.org/rfc/rfc7089.html#section-2.2.1
const LinkRelationProfile = "profile"
LinkRelationProfile refers to the context's author. https://www.rfc-editor.org/rfc/rfc6906.html
const LinkRelationSelf = "self"
LinkRelationSelf refers to the context's author. https://html.spec.whatwg.org/multipage/links.html#link-type-self
const LinkSourceActivityPub = "ACTIVITYPUB"
LinkSourceActivityPub indicates that this linked document was generated by an ActivityPub source
const LinkSourceInternal = "INTERNAL"
LinkSourceInternal indicates that this linked document was generated by Emissary
const LinkSourceRSS = "RSS"
LinkSourceRSS indicates that that this linked document was generated by an RSS Feed
const LinkSourceTwitter = "TWITTER"
LinkSourceTwitter indicates that this linked document was generated by Twitter
const MagicMimeTypeWebSub = "MAGIC-MIME-TYPE-WEBSUB"
const MagicRoleAnonymous = "anonymous"
MagicRoleAnonymous grants permissions to a user who has not been signed in.
const MagicRoleAuthenticated = "authenticated"
MagicRoleAuthenticated grants permissions to a user who has been signed in, regardless of any other group roles.
const MagicRoleAuthor = "author"
MagicRoleAuthor grants permissions to the user who originally created a stream
const MagicRoleMyself = "self"
MagicRoleMyself grants permissions to a user who is trying to access their own profile.
const MagicRoleOwner = "owner"
MagicRoleOwner grants full access to a user with database owner privileges
const MentionStatusInvalid = "INVALID"
MentionStatusInvalid represents a Mention that is not valid
const MentionStatusPending = "PENDING"
MentionStatusPending represents a Mention that has not yet been validated
const MentionStatusValidated = "VALIDATED"
MentionStatusValidated represents a Mention that has been validated
const MentionTypeStream = "Stream"
MentionTypeStream represents a Mention that references a Stream record
const MentionTypeUser = "User"
MentionTypeUser represents a Mention that references a User record
const MessageStateMuted = "MUTED"
MessageStateMuted labels a message that has been read by its owner and marked as "Muted". If additional replies are received for this messages, it will NOT be re-displayed in their inbox.
const MessageStateNewReplies = "NEW-REPLIES"
MessageStateNewReplies labels a message that has been read by its owner, and is now being re-displayed in their inbox because new replies have been received.
const MessageStateRead = "READ"
MessageStateRead labels a message that has been read by its owner. If additional replies are recieved for this message, it will be re-displayed in their inbox.
const MessageStateUnmuted = "UNMUTED"
MessageStateUnmuted is a magic state that is used to reset a message's MUTE status.
const MessageStateUnread = "UNREAD"
MessageStateNew labels a message that has been received but not yet read by its owner
const MimeTypeActivityPub = "application/activity+json"
const MimeTypeAtom = "application/atom+xml"
const MimeTypeEventStream = "text/event-stream"
const MimeTypeHTML = "text/html"
const MimeTypeImage = "image/*"
const MimeTypeJSON = "application/json"
const MimeTypeJSONFeed = "application/feed+json"
const MimeTypeJSONLD = "application/ld+json"
const MimeTypeJSONLDWithProfile = `application/ld+json; profile="https://www.w3.org/ns/activitystreams"`
const MimeTypeJSONResourceDescriptor = "application/jrd+json"
https://datatracker.ietf.org/doc/html/rfc7033#section-10.2
const MimeTypeJSONResourceDescriptorWithCharset = "application/jrd+json; charset=utf-8"
https://datatracker.ietf.org/doc/html/rfc7033#section-10.2 With charset extension to match Mastodon
const MimeTypeRSS = "application/rss+xml"
const MimeTypeXML = "application/xml"
const MimeTypeXMLText = "text/xml"
const OriginTypeAnnounce = "ANNOUNCE"
OriginTypeAnnounce identifies a link that was retrieved because of a "Announce" of an existing post
const OriginTypeDislike = "DISLIKE"
OriginTypeBoost identifies a link that was retrieved because of a "Dislike" of an existing post
const OriginTypeLike = "LIKE"
OriginTypeBoost identifies a link that was retrieved because of a "Like" of an existing post
const OriginTypePrimary = "PRIMARY"
OriginTypePrimary identifies an original post by an author (not a reply, announce, like, or dislike)
const OriginTypeReply = "REPLY"
OriginTypeReply identifies a link that was retrieved because of a "Reply" to an existing post
const RuleActionBlock = "BLOCK"
RuleActionBlock rules all contact with a particular user or domain
const RuleActionLabel = "LABEL"
RuleActionLabel allows inbound messages but labels them with a custom message
const RuleActionMute = "MUTE"
RuleActionMute prevents inbound messages from a particular user or domain
const RuleOriginAdmin = "ADMIN"
RuleOriginAdmin signifies a Rule that was created by a domain administrator
const RuleOriginRemote = "REMOTE"
RuleOriginRemote signifies a Rule that was imported from a remote actor
const RuleOriginUser = "USER"
RuleOriginUser signifies a Rule that was created by the user
const RuleTypeActor = "ACTOR"
RuleTypeUser rules all messages from a specific user
const RuleTypeContent = "CONTENT"
RuleTypeUser rules all messages that contain a particular phrase (hashtag)
const RuleTypeDomain = "DOMAIN"
RuleTypeDomain rules all messages that link to a specific domain or URL prefix
const SearchTagStateAllowed = 1
SearchTagStateAllowed represents a SearchTag that is allowed on the search index
const SearchTagStateBlocked = -1
SearchTagStateBlocked represents a SearchTag that is blocked from the search index
const SearchTagStateFeatured = 2
SearchTagStateFeatured represents a SearchTag that is featured on the search index
const SearchTagStateWaiting = 0
SearchTagStateWaiting represents a SearchTag that is waiting to be allowed on the search index
const TagRelationRule = "--emissary-rule"
TagRelationRule identifies a tag that was created by an internal Emissary rule.
const UserMapIDStripe = "STRIPE"
UserMapIDStripe identifies the Stripe CustomerID for a User https://docs.stripe.com/api/customers/object#customer_object-id
const WebhookEventStreamCreate = "stream:create"
WebhookEventStreamCreate is triggered when a new Stream record is created
const WebhookEventStreamDelete = "stream:delete"
WebhookEventStreamDelete is triggered when an existing Stream record is deleted
const WebhookEventStreamPublish = "stream:publish"
WebhookEventStreamPublish is triggered when a Stream is published
const WebhookEventStreamPublishUndo = "stream:publish:undo"
WebhookEventStreamUnpublish is triggered when a Stream is unpublished
const WebhookEventStreamSyndicate = "stream:syndicate"
WebhookEventStreamSyndicate is triggered when a Stream is syndicated
const WebhookEventStreamSyndicateUndo = "stream:syndicate:undo"
WebhookEventStreamSyndicateUndo is triggered when a Stream's syndication is undone
const WebhookEventStreamUpdate = "stream:update"
WebhookEventStreamUpdate is triggered when an existing Stream record is updated
const WebhookEventUserCreate = "user:create"
WebhookEventUserCreate is triggered when a new User record is created
const WebhookEventUserDelete = "user:delete"
WebhookEventUserDelete is triggered when an existing User record is deleted
const WebhookEventUserUpdate = "user:update"
WebhookEventUserUpdate is triggered when an existing User record is updated
Variables ¶
var MagicGroupIDAnonymous primitive.ObjectID
MagicGroupIDAnonymous refers to a user who has not been signed in. Every user on the Internet is given this group, whether signed in or not. Go won't let us make constant arrays, but consider this variable to be immutable.
var MagicGroupIDAuthenticated primitive.ObjectID
MaicGroupIDAuthenticated refers to every user who has been signed in, regardless of other permissions, but does not include Anonymous users who are not signed in. Go won't let us make constant arrays, but consider this variable to be immutable.
Functions ¶
func AttachmentRulesSchema ¶ added in v0.7.0
func AttachmentSchema ¶
AttachmentSchema returns a validating schema for Attachment objects.
func ConnectionSchema ¶ added in v0.7.0
func ContentSchema ¶
ContentSchema returns the JSON Schema for a Content object
func DocumentLinkSchema ¶
func DomainSchema ¶
func EncryptionKeySchema ¶
func FolderSchema ¶
FolderSchema returns a Rosetta Schema for the Folder object
func FollowerSchema ¶
func FollowerSummaryFields ¶
func FollowerSummaryFields() []string
FollowerSummaryFields returns a slice of all BSON field names for a FollowerSummary
func FollowingSchema ¶
FollowingSchema returns a validating schema for Following objects
func FollowingSummaryFields ¶
func FollowingSummaryFields() []string
FollowingSummaryFields returns a slice of all BSON field names for a FollowingSummary
func GroupFields ¶
func GroupFields() []string
func GroupSchema ¶
func MentionSchema ¶
func MessageFields ¶ added in v0.6.0
func MessageFields() []string
func MessageSchema ¶
MessageSchema returns a JSON Schema that describes this object
func NewStreamPermissions ¶
NewStreamPermissions returns a fully initialized Permissions object
func NewStreamWidgets ¶
func NewStreamWidgets() set.Slice[StreamWidget]
NewStreamWidgets returns a fully initialized StreamWidget slice
func OAuthClientSchema ¶ added in v0.6.0
func OAuthUserTokenSchema ¶ added in v0.6.0
func OriginLinkSchema ¶
OriginLinkSchema returns a JSON Schema for OriginLink structures
func OutboxMessageFields ¶ added in v0.6.0
func OutboxMessageFields() []string
func OutboxMessageSchema ¶ added in v0.7.0
func OutboxMessageSummaryFields ¶ added in v0.6.0
func OutboxMessageSummaryFields() []string
func PasswordResetSchema ¶
PasswordResetSchema returns the data schema for PasswordReset objects
func PermissionSchema ¶
func PersonLinkProfileURL ¶ added in v0.6.0
func PersonLinkProfileURL(person PersonLink) string
PersonLinkProfileURL is a convenience function that returns the profile URL for a PersonLink
func PersonLinkSchema ¶
func ResponseSchema ¶ added in v0.6.0
func RuleSchema ¶ added in v0.6.0
func RuleSummaryFields ¶ added in v0.6.0
func RuleSummaryFields() []string
RuleSummaryFields returns a list of fields that should be queried from the database when populating a RuleSummary object or collection.
func SearchTagSchema ¶ added in v0.7.0
SearchTagSchema returns a validating schema for SearchTag objects
func SortThemes ¶ added in v0.6.0
SortThemes is a sort.Slice function that sorts themes by their label
func StreamSchema ¶
func StreamSummaryFields ¶
func StreamSummaryFields() []string
func StreamWidgetSchema ¶
func ToToken ¶ added in v0.7.0
ToToken returns a normalized version of the input string, stripping out all non-alphanumeric characters, and converting all characters to lowercase.
func UserSchema ¶
func UserSummaryFields ¶
func UserSummaryFields() []string
func WebhookFields ¶ added in v0.7.0
func WebhookFields() []string
func WebhookSchema ¶ added in v0.7.0
func WidgetSchema ¶
WidgetSchema defines the structure for the "widgets" container.
Types ¶
type Action ¶
type Action struct { Roles []string `json:"roles" bson:"roles"` // List of roles required to execute this Action. If empty, then none are required. States []string `json:"states" bson:"states"` // List of states required to execute this Action. If empty, then one are required. StateRoles map[string][]string `json:"stateRoles" bson:"stateRoles"` // Map of states -> list of roles that can perform this Action (when a stream is in the given state) Steps []step.Step `json:"steps" bson:"steps"` // List of steps to execute when GET-ing or POST-ing this Action. }
Action holds the data for actions that can be performed on any Stream from a particular Template.
func (*Action) AllowedRoles ¶
AllowedRoles returns a string of all page request roles that are allowed to perform this action. This includes system roles like "anonymous", "authenticated", "self", "author", and "owner".
func (*Action) UnmarshalJSON ¶
func (*Action) UserCan ¶
func (action *Action) UserCan(enumerator RoleStateEnumerator, authorization *Authorization) bool
UserCan returns TRUE if this action is permitted on a stream (using the provided authorization)
type ActorSummary ¶ added in v0.6.0
type ActorSummary struct { ID string `bson:"id"` Type string `bson:"type"` Name string `bson:"name"` Icon string `bson:"icon"` Username string `bson:"preferredUsername"` }
ActorSummary is a record returned by the ActivityStream directory
func (ActorSummary) UsernameOrID ¶ added in v0.6.0
func (actor ActorSummary) UsernameOrID() string
UsernameOrID returns the best identifier we can find for an Actor: either the Actor' username, if it exists, or the Actor's ID
type Attachment ¶
type Attachment struct { AttachmentID primitive.ObjectID `bson:"_id"` // ID of this Attachment ObjectID primitive.ObjectID `bson:"objectId"` // ID of the Stream that owns this Attachment ObjectType string `bson:"objectType"` // Type of object that owns this Attachment Original string `bson:"original"` // Original filename uploaded by user Category string `bson:"category"` // Category of the file (defined by the Template) Label string `bson:"label"` // User-defined label for the attachment Description string `bson:"description"` // User-defined description for the attachment URL string `bson:"url"` // URL where the file is stored Status string `bson:"status"` // Status of the attachment (READY, WORKING) Rules AttachmentRules `bson:"rules"` // Rules for downloading this attachment Height int `bson:"height"` // Height of the media file (if applicable) Width int `bson:"width"` // Width of the media file (if applicable) Duration int `bbson:"duration"` // Duration of the media file (if applicable) Rank int `bson:"rank"` // The sort order to display the attachments in. journal.Journal `json:"-" bson:",inline"` // Journal entry for fetch compatability }
Attachment represents a file that has been uploaded to the software
func NewAttachment ¶
func NewAttachment(objectType string, objectID primitive.ObjectID) Attachment
NewAttachment returns a fully initialized Attachment object.
func (*Attachment) AspectRatio ¶
func (attachment *Attachment) AspectRatio() string
func (*Attachment) CalcURL ¶ added in v0.6.0
func (attachment *Attachment) CalcURL(host string) string
func (*Attachment) DownloadExtension ¶
func (attachment *Attachment) DownloadExtension() string
func (*Attachment) DownloadMimeType ¶
func (attachment *Attachment) DownloadMimeType() string
func (Attachment) FileSpec ¶ added in v0.7.0
func (attachment Attachment) FileSpec(address *url.URL) mediaserver.FileSpec
func (*Attachment) GetPointer ¶ added in v0.7.0
func (attachment *Attachment) GetPointer(name string) (any, bool)
GetPointer implements the schema.PointerGetter interface, and allows read/write access to (most) fields of the Attachment object.
func (*Attachment) GetStringOK ¶
func (attachment *Attachment) GetStringOK(name string) (string, bool)
GetStringOK implements the schema.StringGetter interface, and returns string values for several fields of the Attachment object.
func (Attachment) HasDimensions ¶ added in v0.6.0
func (attachment Attachment) HasDimensions() bool
func (*Attachment) ID ¶
func (attachment *Attachment) ID() string
ID returns the primary key of this object
func (Attachment) JSONLD ¶ added in v0.6.0
func (attachment Attachment) JSONLD() map[string]any
func (*Attachment) MimeCategory ¶
func (attachment *Attachment) MimeCategory() string
func (*Attachment) MimeType ¶
func (attachment *Attachment) MimeType() string
MimeType returns the mime-type of the attached file
func (*Attachment) OriginalExtension ¶
func (attachment *Attachment) OriginalExtension() string
OriginalExtension returns the file extension of the original filename
func (*Attachment) SetRules ¶ added in v0.7.0
func (attachment *Attachment) SetRules(width int, height int, extensions []string)
func (*Attachment) SetString ¶
func (attachment *Attachment) SetString(name string, value string) bool
SetString implemments the schema.StringSetter interface, and allows setting string values for several fields of the Attachment object.
func (*Attachment) SetURL ¶ added in v0.6.0
func (attachment *Attachment) SetURL(host string)
type AttachmentRules ¶ added in v0.7.0
type AttachmentRules struct { Extensions sliceof.String // Allowed extensions. The first value is used as the default. Width int // Fixed width for all downloads Height int // Fixed height for all downloads Bitrate int }
AttachmentRules defines the rules for downloading an attachment
func NewAttachmentRules ¶ added in v0.7.0
func NewAttachmentRules() AttachmentRules
NewAttachmentRules returns a fully initialized AttachmentRules object
func (AttachmentRules) FileSpec ¶ added in v0.7.0
func (rules AttachmentRules) FileSpec(address *url.URL, originalExtension string) mediaserver.FileSpec
FileSpec applies the attachment rules to a request, and returns the best-matching FileSpec definition for mediaserver
func (*AttachmentRules) GetPointer ¶ added in v0.7.0
func (rules *AttachmentRules) GetPointer(name string) (any, bool)
type Authorization ¶
type Authorization struct { UserID primitive.ObjectID `json:"U"` // Unique identifier of the User GroupIDs []primitive.ObjectID `json:"G"` // IDs for all server-level groups that the User belongs to ClientID primitive.ObjectID `json:"C,omitempty"` // Unique identifier of the OAuth Application/Client DomainOwner bool `json:"O,omitempty"` // If TRUE, then this user is an owner of this domain APIUser bool `json:"A,omitempty"` // If TRUE, then this user is an API user Scope string `json:"S,omitempty"` // OAuth Scopes that this user has access to jwt.RegisteredClaims // By embedding the "RegisteredClaims" object, this record can support standard behaviors, like token expiration, etc. }
Authorization represents the JWT Claims that the server gives to a user when they sign in.
func NewAuthorization ¶
func NewAuthorization() Authorization
NewAuthorization generates a fully initialized Authorization object.
func (*Authorization) AllGroupIDs ¶
func (authorization *Authorization) AllGroupIDs() []primitive.ObjectID
AllGroupIDs returns a slice of groups that this authorization belongs to, including the magic "Anonymous", and (if valid) "Authenticated" groups.
func (Authorization) IsAuthenticated ¶
func (authorization Authorization) IsAuthenticated() bool
IsAuthenticated returns TRUE if this authorization is valid and has a non-zero UserID
func (Authorization) Scopes ¶ added in v0.6.0
func (authorization Authorization) Scopes() []string
Scopes returns a slice of scopes that this Authorization token is allowed to use. This implements the toot.ScopesGetter interface.
type Bundle ¶
type Bundle struct { ContentType string `json:"content-type"` CacheControl string `json:"cache-control"` Content []byte `json:"-"` }
Bundle represents a collection of files that are packaged into a Theme, Template, or Widget and are served as a single unit. Recognized content types are automatically minified via github.com/tdewolff/minify/v2.
func (Bundle) GetCacheControl ¶
GetCacheControl returns the Cache-Control header for this bundle. If no Cache-Control header is defined, this method returns "public, max-age=3600"
type Connection ¶ added in v0.7.0
type Connection struct { ConnectionID primitive.ObjectID `bson:"_id"` // Unique ID for this connection ProviderID string `bson:"providerId"` // ID of the provider that this credential accesses Type string `bson:"type"` // Type of connection (e.g. "payment") Data mapof.String `bson:"data"` // Unique data for this credential Token *oauth2.Token `bson:"token"` // OAuth2 Token (if necessary) Active bool `bson:"active"` // Is this credential active? journal.Journal `bson:",inline"` }
Connection represents a single connection to an individual Provider. It usually contains an OAuth2 token, but may also contain other connection information like a username or password. It may also represent a connection that is still being formed, for instance, storing the intermediate state of an OAuth2 connection that has not yet completed the three-legged handshake.
func NewConnection ¶ added in v0.7.0
func NewConnection() Connection
NewConnection returns a fully initialized Connection object.
func (*Connection) GetPointer ¶ added in v0.7.0
func (connection *Connection) GetPointer(name string) (any, bool)
func (Connection) GetStringOK ¶ added in v0.7.0
func (connection Connection) GetStringOK(name string) (string, bool)
func (Connection) ID ¶ added in v0.7.0
func (connection Connection) ID() string
ID implements the set.Value interface
type Content ¶
type Content struct { Format string `json:"format" bson:"format"` Raw string `json:"raw" bson:"raw"` HTML string `json:"html" bson:"html"` }
Content represents the WYSIWYG body content in a Stream or Activity
func NewContent ¶ added in v0.6.0
func NewContent() Content
func NewHTMLContent ¶
NewHTMLContent creates a new HTML Content object with the specified HTML value
func NewTextContent ¶
NewTextContent creates a new Text Content object with the specified Plaintext value
type DatasetMap ¶ added in v0.7.0
type DatasetMap map[string]form.ReadOnlyLookupGroup
type DocumentLink ¶
type DocumentLink struct { ID primitive.ObjectID `json:"id,omitempty" bson:"id,omitempty"` // Internal ID of the record that is being linked URL string `json:"url,omitempty" bson:"url,omitempty"` // URL of the original document Label string `json:"label,omitempty" bson:"label,omitempty"` // Label/Title of the document Summary string `json:"summary,omitempty" bson:"summary,omitempty"` // Brief summary of the document IconURL string `json:"iconUrl,omitempty" bson:"iconUrl,omitempty"` // URL of the icon image for this document AttributedTo PersonLink `json:"attributedTo,omitempty" bson:"attributedTo,omitempty"` // Person that this document is attributed to }
func NewDocumentLink ¶
func NewDocumentLink() DocumentLink
func (*DocumentLink) GetPointer ¶ added in v0.6.0
func (doc *DocumentLink) GetPointer(name string) (any, bool)
func (*DocumentLink) GetStringOK ¶
func (doc *DocumentLink) GetStringOK(name string) (string, bool)
func (*DocumentLink) IsComplete ¶
func (doc *DocumentLink) IsComplete() bool
func (DocumentLink) IsEmpty ¶
func (doc DocumentLink) IsEmpty() bool
IsEmpty returns TRUE if this record does not link to an internal or external document (if both the InternalID and the URL are empty)
type Domain ¶
type Domain struct { DomainID primitive.ObjectID `bson:"_id"` // This is the internal ID for the domain. It should not be available via the web service. IconID primitive.ObjectID `bson:"iconId"` // ID of the logo to use for this domain Hostname string `bson:"hostname"` // Hostname of this domain (e.g. "example.com") Label string `bson:"label"` // Human-friendly name displayed at the top of this domain Description string `bson:"description"` // Human-friendly description of this domain ThemeID string `bson:"themeId"` // ID of the theme to use for this domain RegistrationID string `bson:"registrationId"` // ID of the signup template to use for this domain InboxID string `bson:"inboxId"` // ID of the default inbox template to use for this domain OutboxID string `bson:"outboxId"` // ID of the default outbox template to use for this domain Forward string `bson:"forward"` // If present, then all requests for this domain should be forwarded to the designated new domain. ThemeData mapof.Any `bson:"themeData"` // Custom data stored in this domain RegistrationData mapof.String `bson:"registrationData"` // Custom data for signup template stored in this domain ColorMode string `bson:"colorMode"` // Color mode for this domain (e.g. "LIGHT", "DARK", or "AUTO") Data mapof.String `bson:"data"` // Custom data stored in this domain DatabaseVersion uint `bson:"databaseVersion"` // Version of the database schema Syndication sliceof.Object[form.LookupCode] `bson:"syndication"` // List of external services that this domain can syndicate to PrivateKey string `bson:"privateKey"` // Private key for this domain journal.Journal `json:"-" bson:",inline"` }
Domain represents an account or node on this server.
func (*Domain) GetPointer ¶ added in v0.6.0
func (*Domain) HasRegistrationForm ¶ added in v0.7.0
HasRegistrationForm returns TRUE if this domain includes a valid signup form.
type Email ¶ added in v0.7.0
type Email struct { EmailID string // Unique identifier for this email. EmailRole string // Role of the email - for system emails that may have multiple options Model string // Object type that this email is associated with Headers *template.Template // Additional email header values To *template.Template // Template for the email address to send this email to Subject *template.Template // Template for the email subject Body *template.Template // Template for the email body Resources fs.FS // File system containing additional files (like images) required by this email }
type EncryptionKey ¶
type EncryptionKey struct { EncryptionKeyID primitive.ObjectID `json:"encryptionKeyId" bson:"_id"` ParentType string `json:"parentType" bson:"parentType"` ParentID primitive.ObjectID `json:"parentId" bson:"parentId"` Encoding string `json:"encoding" bson:"encoding"` PublicPEM string `json:"publicPEM" bson:"publicPEM"` PrivatePEM string `json:"privatePEM" bson:"privatePEM"` journal.Journal `json:"-" bson:",inline"` }
func NewEncryptionKey ¶
func NewEncryptionKey() EncryptionKey
func (*EncryptionKey) ID ¶
func (encryptionKey *EncryptionKey) ID() string
type FieldLister ¶
type FieldLister interface { // FieldList returns the subset of fields that should be queried from the database to // populate this object type Fields() []string }
FieldLister wraps the Files() method, which provides the list of fields to query from a database
type Folder ¶
type Folder struct { FolderID primitive.ObjectID `json:"folderId" bson:"_id"` // Unique ID for this folder UserID primitive.ObjectID `json:"userId" bson:"userId"` // ID of the User who owns this folder Label string `json:"label" bson:"label"` // Label of the folder Icon string `json:"icon" bson:"icon"` // Icon of the folder Layout string `json:"layout" bson:"layout"` // Layout type of the folder Group int `json:"group" bson:"group"` // Group number of the folder (starting with 1) Rank int `json:"rank" bson:"rank"` // Sort order of the folder UnreadCount int `json:"unreadCount" bson:"unreadCount"` // Number of unread messages in this folder journal.Journal `json:"-" bson:",inline"` }
Folder represents a custom folder that organizes incoming messages
func (Folder) LookupCode ¶
func (folder Folder) LookupCode() form.LookupCode
func (Folder) Roles ¶
func (folder Folder) Roles(authorization *Authorization) []string
Roles returns a list of all roles that match the provided authorization. Since Folders should only be accessible by the folder owner, this function only returns MagicRoleMyself if applicable. Others (like Anonymous and Authenticated) should never be allowed on an inbox folder, so they are not returned.
type FolderList ¶
FolderList contains a group of folders and the currently selected folder
func NewFolderList ¶
func NewFolderList() FolderList
NewFolderList returns a fully initialized FolderList object
func (FolderList) ByID ¶
func (list FolderList) ByID(folderID primitive.ObjectID) Folder
ByID scans the list for the folder with the specified ID
func (FolderList) HasSelection ¶
func (list FolderList) HasSelection() bool
HasSelection returns TRUE if a folder is currently selected
func (FolderList) Selected ¶
func (list FolderList) Selected() Folder
Selected returns the currently selected folder
type Follower ¶
type Follower struct { FollowerID primitive.ObjectID `json:"followerId" bson:"_id"` // Unique identifier for this Follower ParentType string `json:"type" bson:"type"` // Type of record being followed (e.g. "User", "Stream", or "Search") ParentID primitive.ObjectID `json:"parentId" bson:"parentId"` // Unique identifier for the Stream that is being followed (including user's outboxes) StateID string `json:"stateId" bson:"stateId"` // Unique identifier for the State of this Follower ("ACTIVE", "PENDING") Method string `json:"method" bson:"method"` // Method of follower (e.g. "POLL", "WEBSUB", "RSS-CLOUD", "ACTIVITYPUB", "EMAIL") Format string `json:"format" bson:"format"` // Format of the data being followed (e.g. "ATOM", "HTML", "JSON", "RSS", "XML") Actor PersonLink `json:"actor" bson:"actor"` // Person who is follower the User Data mapof.Any `json:"data" bson:"data"` // Additional data about this Follower that depends on the follow method ExpireDate int64 `json:"expireDate" bson:"expireDate"` // Unix timestamp (in seconds) when this follower will be automatically purged. journal.Journal `json:"-" bson:",inline"` }
func NewFollower ¶
func NewFollower() Follower
func (*Follower) GetPointer ¶ added in v0.6.0
func (Follower) MarshalMap ¶ added in v0.7.0
MarshalMap returns a mapof.Any representation of this Follower
func (Follower) ParentURL ¶ added in v0.7.0
ParentURL returns the URL of the parent object that this Follower is following.
func (Follower) Roles ¶
func (follower Follower) Roles(authorization *Authorization) []string
Roles returns a list of all roles that match the provided authorization. Since Follower records should only be accessible by the follower owner, this function only returns MagicRoleMyself if applicable.
func (Follower) State ¶
State returns the current state of this object. For users, there is no state, so it returns ""
func (*Follower) UnmarshalMap ¶ added in v0.7.0
UnmarshalMap populates this Follower from a mapof.Any object
func (Follower) UnsubscribeLink ¶ added in v0.7.0
UnsubscribeLink returns a URL where an Email Follower can unsubscribe. It returns an empty string for all other follower types (ActivityPub, WebSub, etc.)
type FollowerSummary ¶
type FollowerSummary struct { FollowerID primitive.ObjectID `json:"summaryId" bson:"_id"` // Unique identifier for this Follower ParentID primitive.ObjectID `json:"parentId" bson:"parentId"` // Unique identifier for the User that is being followed Actor PersonLink `json:"actor" bson:"actor"` // Person who is follower the User Method string `json:"method" bson:"method"` // Method of follower (e.g. "RSS", "RSSCloud", "ActivityPub".) }
func (FollowerSummary) Fields ¶
func (summary FollowerSummary) Fields() []string
func (FollowerSummary) MethodIcon ¶
func (summary FollowerSummary) MethodIcon() string
type Following ¶
type Following struct { FollowingID primitive.ObjectID `json:"followingId" bson:"_id"` // Unique Identifier of this record UserID primitive.ObjectID `json:"userId" bson:"userId"` // ID of the stream that owns this "following" FolderID primitive.ObjectID `json:"folderId" bson:"folderId"` // ID of the folder to put new messages into Folder string `json:"folder" bson:"folder"` // Name of the folder to put new messages into Label string `json:"label" bson:"label"` // Label of this "following" record Notes string `json:"notes" bson:"notes"` // Notes about this "following" record, entered by the user. URL string `json:"url" bson:"url"` // Human-Facing URL that is being followed. Username string `json:"username" bson:"username"` // Username of the actor that is being followed (@username@server.social). ProfileURL string `json:"profileUrl" bson:"profileUrl"` // Updated, computer-facing URL that is being followed. IconURL string `json:"iconUrl" bson:"iconUrl"` // URL of an the avatar/icon image that represents this "following" Behavior string `json:"behavior" bson:"behavior"` // Behavior determines the types of records to import from this Actor [POSTS+REPLIES] RuleAction string `json:"ruleAction" bson:"ruleAction"` // RuleAction determines the types of records to rule from this Actor [IGNORE, LABEL, MUTE, BLOCK ] CollapseThreads bool `json:"collapseThreads" bson:"collapseThreads"` // If TRUE, traverse responses and import the initial post that initiated a thread IsPublic bool `json:"isPublic" bson:"isPublic"` // If TRUE, this following is visible to the public Links digit.LinkSet `json:"links" bson:"links"` // List of links can be used to update this following. Method string `json:"method" bson:"method"` // Method used to update this feed (POLL, WEBSUB, RSS-CLOUD, ACTIVITYPUB) Secret string `json:"secret" bson:"secret"` // Secret used to authenticate this feed (if required) Status string `json:"status" bson:"status"` // Status of the last poll of Following (NEW, CONNECTING, POLLING, SUCCESS, FAILURE) StatusMessage string `json:"statusMessage" bson:"statusMessage"` // Optional message describing the status of the last poll LastPolled int64 `json:"lastPolled" bson:"lastPolled"` // Unix Timestamp of the last date that this resource was retrieved. PollDuration int `json:"pollDuration" bson:"pollDuration"` // Time (in hours) to wait between polling this resource. NextPoll int64 `json:"nextPoll" bson:"nextPoll"` // Unix Timestamp of the next time that this resource should be polled. PurgeDuration int `json:"purgeDuration" bson:"purgeDuration"` // Time (in days) to wait before purging old messages ErrorCount int `json:"errorCount" bson:"errorCount"` // Number of times that this "following" has failed to load (for exponential backoff) journal.Journal `json:"-" bson:",inline"` }
Following is a model object that represents a user's following to an external data feed. Currently, the only supported feed types are: RSS, Atom, and JSON Feed. Others may be added in the future.
func NewFollowing ¶
func NewFollowing() Following
NewFollowing returns a fully initialized Following object
func (*Following) GetLink ¶
GetLink returns a link from the Following that matches the given property and value
func (*Following) GetPointer ¶ added in v0.6.0
func (*Following) Origin ¶
func (following *Following) Origin(originType string) OriginLink
func (Following) Roles ¶
func (following Following) Roles(authorization *Authorization) []string
Roles returns a list of all roles that match the provided authorization. Since Following records should only be accessible by the following owner, this function only returns MagicRoleMyself if applicable. Others (like Anonymous and Authenticated) should never be allowed on an Following record, so they are not returned.
func (*Following) SetLinks ¶
SetLinks adds or replaces a link in the Following that matches the given property
func (Following) State ¶
State returns the current state of this object. For users, there is no state, so it returns ""
func (Following) Toot ¶ added in v0.6.0
func (following Following) Toot() object.Relationship
func (Following) UsernameOrID ¶ added in v0.7.0
type FollowingSummary ¶
type FollowingSummary struct { FollowingID primitive.ObjectID `bson:"_id"` Username string `bson:"username"` URL string `bson:"url"` Label string `bson:"label"` Folder string `bson:"folder"` FolderID primitive.ObjectID `bson:"folderId"` IconURL string `bson:"iconUrl"` Method string `bson:"method"` Status string `bson:"status"` LastPolled int64 `bson:"lastPolled"` NextPoll int64 `bson:"nextPoll"` CreateDate int64 `bson:"createDate"` }
func (FollowingSummary) Fields ¶
func (summary FollowingSummary) Fields() []string
func (FollowingSummary) GetRank ¶ added in v0.6.0
func (summary FollowingSummary) GetRank() int64
func (FollowingSummary) Icon ¶
func (summary FollowingSummary) Icon() string
func (FollowingSummary) StatusClass ¶
func (summary FollowingSummary) StatusClass() string
func (FollowingSummary) UsernameOrID ¶ added in v0.7.0
func (summary FollowingSummary) UsernameOrID() string
type Group ¶
type Group struct { GroupID primitive.ObjectID `json:"groupId" bson:"_id"` // Unique identifier assigned by the database Token string `json:"token" bson:"token"` // Uniqe token chosen by the administrator Label string `json:"label" bson:"label"` // Human-readable label for this group. journal.Journal `json:"-" bson:",inline"` }
func (*Group) LookupCode ¶
func (group *Group) LookupCode() form.LookupCode
type JSONLDGetter ¶
ActivityPubProfileGetter wraps the ActivityPubProfile() method, which lets a model object return its data formatted in JSON-LD
type JWTKey ¶ added in v0.6.0
type JWTKey struct { JWTKeyID primitive.ObjectID `bson:"_id"` // Unique identifier for this key (used by MongoDB) KeyName string `bson:"keyName"` // Name of this key (used by the application) Algorithm string `bson:"algorithm"` // Algorithm used to generate this key (AES) Encrypted string `bson:"encrypted"` // Encrypted value journal.Journal `json:"-" bson:",inline"` }
JWTKey represents
type Mention ¶
type Mention struct { MentionID primitive.ObjectID `json:"mentionId" bson:"_id"` // Unique ID for this record ObjectID primitive.ObjectID `json:"objectId" bson:"objectId"` // Unique ID of the internal object that was mentioned Type string `json:"type" bson:"type"` // Type of object that was mentioned (Stream, User) StateID string `json:"stateId" bson:"stateId"` // State of this mention (Validated, Pending, Invalid) Origin OriginLink `json:"origin" bson:"origin"` // Origin information of the site that mentions this object Author PersonLink `json:"author" bson:"author"` // Author information of the person who mentioned this object journal.Journal `json:"-" bson:",inline"` }
Mention represents a single hyperlink from an external source to an internal object. Mentions are created by WebMentions or by ActivityPub "Mention" records
func (*Mention) GetPointer ¶ added in v0.6.0
type Message ¶
type Message struct { MessageID primitive.ObjectID `json:"messageId" bson:"_id"` // Unique ID of the Message UserID primitive.ObjectID `json:"userId" bson:"userId"` // Unique ID of the User who owns this Message FollowingID primitive.ObjectID `json:"followingId" bson:"followingId,omitempty"` // Unique ID of the Following record that generated this Message FolderID primitive.ObjectID `json:"folderId" bson:"folderId,omitempty"` // Unique ID of the Folder where this Message is stored SocialRole string `json:"socialRole" bson:"socialRole,omitempty"` // Role this message plays in social integrations ("Article", "Note", etc) Origin OriginLink `json:"origin" bson:"origin,omitempty"` // Link to the original source of this Message (the following and website that originally published it) References sliceof.Object[OriginLink] `json:"references" bson:"references,omitempty"` // Links to other references to this Message - likes, reposts, or comments that informed us of its existence URL string `json:"url" bson:"url"` // URL of this Message InReplyTo string `json:"inReplyTo" bson:"inReplyTo,omitempty"` // URL this message is in reply to MyResponse string `json:"myResponse" bson:"myResponse,omitempty"` // If the owner of this message has responded, then this field contains the responseType (Like, Dislike, Repost) StateID string `json:"stateId" bson:"stateId"` // StateID of this message (UNREAD,READ,MUTED,NEW-REPLIES) PublishDate int64 `json:"publishDate" bson:"publishDate,omitempty"` // Unix timestamp of the date/time when this Message was published ReadDate int64 `json:"readDate" bson:"readDate"` // Unix timestamp of the date/time when this Message was read. If unread, this is MaxInt64. Rank int64 `json:"rank" bson:"rank"` // Sort rank for this message (publishDate * 1000 + sequence number) journal.Journal `json:"-" bson:",inline"` }
Message represents a single item in a User's inbox.
func (*Message) AddReference ¶ added in v0.6.0
func (message *Message) AddReference(reference OriginLink) bool
AddReference adds a new reference to this message, while attempting to prevent duplicates. It returns TRUE if the message has been updated.
func (*Message) GetPointer ¶ added in v0.6.0
func (*Message) MarkMuted ¶ added in v0.6.0
MarkMuted sets the stateID of this Message to "MUTED" This function returns TRUE if the value was changed
func (*Message) MarkNewReplies ¶ added in v0.6.0
MarkNewReplies sets the stateID of this Message to "NEW-REPLIES" ReadDate is cleared to MaxInt64 This function returns TRUE if the value was changed
func (*Message) MarkRead ¶ added in v0.6.0
MarkRead sets the stateID of this Message to "READ". If the ReadDate is not already set, then it is set to the current time. This function returns TRUE if the value was changed
func (*Message) MarkUnmuted ¶ added in v0.6.0
MarkRead sets the stateID of this Message to "READ". If the ReadDate is not already set, then it is set to the current time. This function returns TRUE if the value was changed
func (*Message) MarkUnread ¶ added in v0.6.0
MarkUnread sets the stateID of this Message to "UNREAD" ReadDate is cleared to MaxInt64 This function returns TRUE if the value was changed
func (Message) NotRead ¶ added in v0.6.0
NotRead returns TRUE if this message does not have a valid ReadDate
func (Message) RankSeconds ¶ added in v0.6.0
RankSeconds returns the rank of this Message in seconds (ignoring milliseconds)
func (Message) Roles ¶
func (message Message) Roles(authorization *Authorization) []string
Roles returns a list of all roles that match the provided authorization
func (*Message) SetMyResponse ¶ added in v0.6.0
SetMyResponse
func (*Message) SetState ¶ added in v0.6.0
SetState implements the model.StateSetter interface, and updates the message.StateID by wrapping the MarkXXX() methods. This method is primarily used by HTML templates in the build pipeline. Services and handlers written in Go should probably use MarkRead(), MarkUnread(), etc. directly.
type OAuthAuthorizationRequest ¶ added in v0.6.0
type OAuthAuthorizationRequest struct { ResponseType string `query:"response_type" form:"response_type"` ClientID string `query:"client_id" form:"client_id"` RedirectURI string `query:"redirect_uri" form:"redirect_uri"` Scope string `query:"scope" form:"scope"` ForceLogin bool `query:"force_login" form:"force_login"` Language string `query:"language" form:"language"` }
https://docs.joinmastodon.org/methods/oauth/#authorize GET /oauth/authorize Returns: Authorization code
func NewOAuthAuthorizationRequest ¶ added in v0.6.0
func NewOAuthAuthorizationRequest() OAuthAuthorizationRequest
func (OAuthAuthorizationRequest) Scopes ¶ added in v0.6.0
func (req OAuthAuthorizationRequest) Scopes() []string
func (*OAuthAuthorizationRequest) Validate ¶ added in v0.6.0
func (req *OAuthAuthorizationRequest) Validate(app OAuthClient) error
Validate confirms that a request is valid based on the settings in the OAuthClient. This method MAY update the request if certain values are missing.
type OAuthClient ¶ added in v0.6.0
type OAuthClient struct { ClientID primitive.ObjectID `json:"clientId" bson:"_id"` ClientSecret string `json:"clientSecret" bson:"clientSecret"` Name string `json:"name" bson:"name"` Website string `json:"website" bson:"website"` RedirectURIs []string `json:"redirectUris" bson:"redirectUris"` Scopes sliceof.String `json:"scopes" bson:"scopes"` journal.Journal `json:"-" bson:",inline"` }
func NewOAuthClient ¶ added in v0.6.0
func NewOAuthClient() OAuthClient
func (*OAuthClient) GetPointer ¶ added in v0.6.0
func (app *OAuthClient) GetPointer(name string) (any, bool)
func (*OAuthClient) GetStringOK ¶ added in v0.6.0
func (app *OAuthClient) GetStringOK(name string) (string, bool)
func (OAuthClient) ID ¶ added in v0.6.0
func (app OAuthClient) ID() string
func (*OAuthClient) SetString ¶ added in v0.6.0
func (app *OAuthClient) SetString(name string, value string) bool
func (OAuthClient) Toot ¶ added in v0.6.0
func (app OAuthClient) Toot() object.Application
ToToot converts this object into a Mastodon-compatible Application object
type OAuthUserToken ¶ added in v0.6.0
type OAuthUserToken struct { OAuthUserTokenID primitive.ObjectID `json:"-" bson:"_id"` ClientID primitive.ObjectID `json:"C" bson:"clientId"` UserID primitive.ObjectID `json:"U" bson:"userId"` Token string `json:"T" bson:"token"` APIUser bool `json:"A" bson:"apiUser"` Scopes sliceof.String `json:"S" bson:"scopes"` journal.Journal `json:"-" bson:",inline"` }
UserOAuthToken represents an application-specific token that a remote API can use to access a user's account on their behalf
func NewOAuthUserToken ¶ added in v0.6.0
func NewOAuthUserToken() OAuthUserToken
func (OAuthUserToken) Code ¶ added in v0.6.0
func (token OAuthUserToken) Code() string
Code returns the OAuth2 code that is used to request an access token. This is just the string version of the ID.
func (*OAuthUserToken) GetPointer ¶ added in v0.6.0
func (userToken *OAuthUserToken) GetPointer(name string) (any, bool)
func (*OAuthUserToken) GetStringOK ¶ added in v0.6.0
func (userToken *OAuthUserToken) GetStringOK(name string) (string, bool)
func (OAuthUserToken) ID ¶ added in v0.6.0
func (token OAuthUserToken) ID() string
func (OAuthUserToken) JSONResponse ¶ added in v0.6.0
func (token OAuthUserToken) JSONResponse() map[string]any
func (*OAuthUserToken) SetString ¶ added in v0.6.0
func (userToken *OAuthUserToken) SetString(name string, value string) bool
func (OAuthUserToken) Toot ¶ added in v0.6.0
func (token OAuthUserToken) Toot() object.Token
type OAuthUserTokenRequest ¶ added in v0.6.0
type OAuthUserTokenRequest struct { GrantType string `form:"grant_type"` Code string `form:"code"` ClientID string `form:"client_id"` ClientSecret string `form:"client_secret"` RedirectURI string `form:"redirect_uri"` Scope string `form:"scope"` }
https://docs.joinmastodon.org/methods/oauth/#token POST /oauth/token Returns: Token Obtain an access token, to be used during API calls that are not public
func NewOAuthUserTokenRequest ¶ added in v0.6.0
func NewOAuthUserTokenRequest() OAuthUserTokenRequest
func (OAuthUserTokenRequest) Scopes ¶ added in v0.6.0
func (o OAuthUserTokenRequest) Scopes() []string
func (*OAuthUserTokenRequest) Validate ¶ added in v0.6.0
func (req *OAuthUserTokenRequest) Validate(app OAuthClient) error
Validate confirms that a request is valid based on the settings in the OAuthClient. This method MAY update the request if certain values are missing.
type OAuthUserTokenRevokeRequest ¶ added in v0.6.0
type OAuthUserTokenRevokeRequest struct { ClientID string `form:"client_id"` ClientSecret string `form:"client_secret"` Token string `form:"token"` }
https://docs.joinmastodon.org/methods/oauth/#revoke POST /oauth/revoke Returns: Empty struct Revoke an access token to make it no longer valid for use
func NewOAuthUserTokenRevokeRequest ¶ added in v0.6.0
func NewOAuthUserTokenRevokeRequest() OAuthUserTokenRevokeRequest
func (*OAuthUserTokenRevokeRequest) Validate ¶ added in v0.6.0
func (req *OAuthUserTokenRevokeRequest) Validate(app OAuthClient) error
type OriginLink ¶
type OriginLink struct { Type string `json:"type" bson:"type,omitempty"` // The type of message that this document (DIRECT, LIKE, DISLIKE, REPLY, ANNOUNCE) FollowingID primitive.ObjectID `json:"followingId" bson:"followingId,omitempty"` // Unique ID of a document in this database Label string `json:"label" bson:"label,omitempty"` // Human-friendly label of the origin URL string `json:"url" bson:"url,omitempty"` // Public URL of the origin IconURL string `json:"iconUrl" bson:"iconUrl,omitempty"` // URL of the a avatar/icon image for this origin }
OriginLink represents the original source of a stream that has been imported into Emissary. This could be an external ActivityPub server, RSS Feed, or Tweet.
func NewOriginLink ¶
func NewOriginLink() OriginLink
NewOriginLink returns a fully initialized OriginLink
func (OriginLink) Equals ¶ added in v0.6.0
func (origin OriginLink) Equals(other OriginLink) bool
Equals returns TRUE if the URL for this OriginLink is the same as the URL for another OriginLink
func (*OriginLink) GetPointer ¶ added in v0.6.0
func (origin *OriginLink) GetPointer(name string) (any, bool)
func (*OriginLink) GetStringOK ¶
func (origin *OriginLink) GetStringOK(name string) (string, bool)
func (OriginLink) Icon ¶
func (origin OriginLink) Icon() string
Icon returns the standard icon label for this origin
func (OriginLink) IsEmpty ¶
func (origin OriginLink) IsEmpty() bool
IsEmpty returns TRUE if this OriginLink is empty
func (OriginLink) NotEmpty ¶ added in v0.6.0
func (origin OriginLink) NotEmpty() bool
type OutboxMessage ¶ added in v0.6.0
type OutboxMessage struct { OutboxMessageID primitive.ObjectID `json:"messageId" bson:"_id"` // Unique ID of the OutboxMessage ParentType string `json:"parentType" bson:"parentType"` // Type of the parent object (User or Stream) ParentID primitive.ObjectID `json:"parentId" bson:"parentId"` // Unique ID of the User who owns this OutboxMessage (in their inbox or outbox) ActivityType string `json:"type" bson:"type"` // Type of the activity (Create, Follow, Like, Block, etc.) URL string `json:"url" bson:"url"` // URL of the object (if applicable) journal.Journal `json:"-" bson:",inline"` }
OutboxMessage represents a single item in a User's inbox or outbox. It is loosely modelled on the OutboxMessageStreams standard, and can be converted into a strict go-fed streams.Type object.
func NewOutboxMessage ¶ added in v0.6.0
func NewOutboxMessage() OutboxMessage
NewOutboxMessage returns a fully initialized OutboxMessage record
func (OutboxMessage) Created ¶ added in v0.7.0
func (message OutboxMessage) Created() int64
func (OutboxMessage) Fields ¶ added in v0.6.0
func (summary OutboxMessage) Fields() []string
func (OutboxMessage) GetJSONLD ¶ added in v0.7.0
func (message OutboxMessage) GetJSONLD() mapof.Any
func (*OutboxMessage) GetPointer ¶ added in v0.7.0
func (message *OutboxMessage) GetPointer(name string) (any, bool)
func (*OutboxMessage) GetStringOK ¶ added in v0.7.0
func (message *OutboxMessage) GetStringOK(name string) (string, bool)
func (OutboxMessage) ID ¶ added in v0.6.0
func (message OutboxMessage) ID() string
type OutboxMessageSummary ¶ added in v0.6.0
func NewOutboxMessageSummary ¶ added in v0.6.0
func NewOutboxMessageSummary() OutboxMessageSummary
func (OutboxMessageSummary) Created ¶ added in v0.6.0
func (message OutboxMessageSummary) Created() int64
func (OutboxMessageSummary) GetJSONLD ¶ added in v0.6.0
func (message OutboxMessageSummary) GetJSONLD() mapof.Any
type PasswordReset ¶
type PasswordReset struct { AuthCode string CreateDate int64 `json:"createDate"` ExpireDate int64 `json:"expireDate"` }
PasswordReset represents a single password reset request. Only one password reset request is allowed per user.
func NewPasswordReset ¶
func NewPasswordReset() PasswordReset
NewPasswordReset returns a fully initialized PasswordReset object.
func (PasswordReset) IsActive ¶ added in v0.7.0
func (reset PasswordReset) IsActive() bool
IsActive returns TRUE if this code exists and has not expired (i.e. people can still use it to reset their password)
func (PasswordReset) IsExpired ¶
func (reset PasswordReset) IsExpired() bool
IsExpired returns TRUE if the password reset has expired
func (PasswordReset) IsValid ¶
func (reset PasswordReset) IsValid(code string) bool
IsValid returns TRUE if the password reset code is valid and has not expired.
func (PasswordReset) NotActive ¶ added in v0.7.0
func (reset PasswordReset) NotActive() bool
NotActive returns TRUE if this code does not exist, or has expired (i.e. people cannot use it to reset their password)
func (*PasswordReset) RefreshExpireDate ¶ added in v0.7.0
func (reset *PasswordReset) RefreshExpireDate()
RefreshExpireDate extends the expiration date of the password reset code by 24 hours.
type PersonLink ¶
type PersonLink struct { UserID primitive.ObjectID `json:"userId,omitempty" bson:"userId,omitempty"` // Internal ID of the person (if they exist in this database) Name string `json:"name,omitempty" bson:"name,omitempty"` // Name of the person Username string `json:"username,omitempty" bson:"username,omitempty"` // Username of the person (e.g. @user@domain.social) ProfileURL string `json:"profileUrl,omitempty" bson:"profileUrl,omitempty"` // URL of the person's profile InboxURL string `json:"inboxUrl,omitempty" bson:"inboxUrl,omitempty"` // URL of the person's inbox EmailAddress string `json:"emailAddress,omitempty" bson:"emailAddress,omitempty"` // Email address of the person IconURL string `json:"iconUrl,omitempty" bson:"iconUrl,omitempty"` // URL of the person's avatar/icon image }
func NewPersonLink ¶
func NewPersonLink() PersonLink
func (PersonLink) GetJSONLD ¶ added in v0.6.0
func (person PersonLink) GetJSONLD() mapof.Any
GetJSONLD returns a JSON-LD representation of this Person.
func (*PersonLink) GetPointer ¶ added in v0.6.0
func (link *PersonLink) GetPointer(name string) (any, bool)
func (*PersonLink) GetStringOK ¶
func (link *PersonLink) GetStringOK(name string) (string, bool)
func (PersonLink) GetURL ¶
func (person PersonLink) GetURL(name string) *url.URL
GetURL gets a named property value of this person, then retuns it as a parsed URL. Only "profileUrl" "inboxUrl" and "iconUrl" should be passed to this function. all others will return nil values
func (PersonLink) HasIconURL ¶ added in v0.7.0
func (person PersonLink) HasIconURL() bool
HasIconURL returns TRUE if this person has a non-empty icon
func (PersonLink) IsEmpty ¶
func (person PersonLink) IsEmpty() bool
IsEmpty returns TRUE if this record does not link to an internal or external person (if the UserID, ProfileURL, and Name are all empty)
func (PersonLink) MarshalMap ¶ added in v0.7.0
func (person PersonLink) MarshalMap() mapof.Any
MarshalMap returns a mapof.Any representation of this PersonLink
func (PersonLink) NotEmpty ¶ added in v0.6.0
func (person PersonLink) NotEmpty() bool
NotEmpty returns TRUE if this record is not empty.
func (PersonLink) Toot ¶ added in v0.6.0
func (person PersonLink) Toot() object.Account
func (*PersonLink) UnmarshalMap ¶ added in v0.7.0
func (person *PersonLink) UnmarshalMap(data mapof.Any)
UnmarshalMap populates this PersonLink from a mapof.Any object
func (PersonLink) UsernameOrID ¶ added in v0.7.0
func (person PersonLink) UsernameOrID() string
UsernameOrID returns the best-available username for this Person
type Registration ¶ added in v0.7.0
type Registration struct { RegistrationID string `json:"registrationId" bson:"registrationId"` // Internal name/token other objects (like streams) will use to reference this Registration. Extends sliceof.String `json:"extends" bson:"extends"` // List of registrations that this registration extends. The first registration in the list is the most important, and the last registration in the list is the least important. Label string `json:"label" bson:"label"` // Human-readable label used in management UI. Description string `json:"description" bson:"description"` // Human-readable long-description text used in management UI. Icon string `json:"icon" bson:"icon"` // Icon image used in management UI. Sort int `json:"sort" bson:"sort"` // Sort order used in management UI. Form form.Element `json:"form" bson:"form"` // Form used to edit custom data Schema schema.Schema `json:"schema" bson:"schema"` // JSON Schema that describes the data required to populate this Registration. Actions mapof.Object[Action] `json:"actions" bson:"actions"` // Map of actions that can be performed on streams of this Registration HTMLTemplate *template.Template `json:"-" bson:"-"` // Compiled HTML template Bundles mapof.Object[Bundle] `json:"bundles" bson:"bundles"` // Additional resources (JS, HS, CSS) reqired tp remder this Registration. Resources fs.FS `json:"-" bson:"-"` // File system containing the registration resources AllowedFields []string `json:"allowedFields" bson:"allowedFields"` // List of fields that are allowed to be set by the user }
Registration represents an HTML registration used for building Streams
func NewRegistration ¶ added in v0.7.0
func NewRegistration(registrationID string, funcMap template.FuncMap) Registration
NewRegistration creates a new, fully initialized Registration object
func (*Registration) Action ¶ added in v0.7.0
func (registration *Registration) Action(actionID string) (Action, bool)
Action returns the action object for a specified name
func (Registration) ID ¶ added in v0.7.0
func (registration Registration) ID() string
ID implements the set.Value interface
func (*Registration) Inherit ¶ added in v0.7.0
func (registration *Registration) Inherit(parent *Registration)
func (Registration) IsZero ¶ added in v0.7.0
func (registration Registration) IsZero() bool
type RegistrationTxn ¶ added in v0.7.0
type RegistrationTxn struct { DisplayName string `form:"displayName"` // required: User's DisplayName EmailAddress string `form:"emailAddress"` // required: User's EmailAddress Username string `form:"username"` // optional: User's Username Password string `form:"password"` // optional: User's Password StateID string `form:"stateId"` // optional: User's StateID InboxTemplate string `form:"inboxTemplate"` // optional: User's InboxTemplate OutboxTemplate string `form:"outboxTemplate"` // optional: User's OutboxTemplate AddGroups string `form:"addGroups"` // optional: Comma-separated list of GroupIDs to add the User to RemoveGroups string `form:"removeGroups"` // optional: Comma-separated list of GroupIDs to remove the User from Secret string `form:"secret"` // optional: Secret key used to validate the registration // Internal values assigned by the server UserID string `form:"-"` // optional: Unique identifier for the User to be created. Prevents replay/reuse attacks }
RegistrationTsn represents the data that is submitted when a User registers for a new account
func NewRegistrationTxn ¶ added in v0.7.0
func NewRegistrationTxn() RegistrationTxn
NewRegistrationTxn returns a fully initialized RegistrationTxn object
func ParseRegistrationFromClaims ¶ added in v0.7.0
func ParseRegistrationFromClaims(claims jwt.MapClaims) RegistrationTxn
func (RegistrationTxn) Claims ¶ added in v0.7.0
func (txn RegistrationTxn) Claims() jwt.MapClaims
func (RegistrationTxn) IsInvalid ¶ added in v0.7.0
func (txn RegistrationTxn) IsInvalid(secret string) bool
IsInvalid is the inverse of `IsValid`. It returns TRUE if the transaction is NOT VALID
func (RegistrationTxn) IsValid ¶ added in v0.7.0
func (txn RegistrationTxn) IsValid(secret string) bool
IsValid returns TRUE if all of the required fields are present and valid. The "secret" field is required, and if not empty, MUST match the `secret` value in the Transaction.
type Response ¶ added in v0.6.0
type Response struct { ResponseID primitive.ObjectID `json:"responseId" bson:"_id"` // Unique identifier for this Response UserID primitive.ObjectID `json:"userId" bson:"userId"` // ID of the User who made this response Actor string `json:"actor" bson:"actor"` // ActivityPubURL of the User who made the response Object string `json:"object" bson:"object"` // ActivityPubURL of the Object that the actor responded to Type string `json:"type" bson:"type"` // Type of Response (e.g. "Announce", "Bookmark", "Like", "Dislike", etc...) Summary string `json:"summary" bson:"summary,omitempty"` // Summary of the response (e.g. "I liked this post because...") Content string `json:"content" bson:"content,omitempty"` // Custom value assigned to the response (emoji, vote, etc.) journal.Journal `json:"-" bson:",inline"` }
Reponse defines a single Actor's response to an Object. The actor may be a local or remote user, and the Object may be a local stream or an inbox message.
func NewResponse ¶ added in v0.6.0
func NewResponse() Response
NewReponse returns a fully initialized Response object
func (Response) ActivityPubCreateDate ¶ added in v0.6.0
func (Response) ActivityPubURL ¶ added in v0.6.0
func (Response) CreateDateSeconds ¶ added in v0.6.0
CreateDateSeconds returns the CreateDate in Unix Epoch seconds (instead of milliseconds)
func (Response) GetJSONLD ¶ added in v0.6.0
GetJSONLD returns the JSON-LD representation of this Response
func (*Response) GetPointer ¶ added in v0.6.0
func (Response) GetStringOK ¶ added in v0.6.0
func (Response) ID ¶ added in v0.6.0
ID returns the unique identifier for this Response (in string format)
func (Response) IsEqual ¶ added in v0.6.0
IsEqual returns TRUE if two responses match urls, actors, objects, types, and values
func (Response) Roles ¶ added in v0.6.0
func (response Response) Roles(authorization *Authorization) []string
Roles returns a list of all roles that match the provided authorization
type Role ¶
type Role struct { RoleID string `json:"roleId" bson:"roleId"` // Unique ID for this role Label string `json:"label" bson:"label"` // Short, human-friendly label used to select this role in UX Description string `json:"description" bson:"description"` // Medium-length, human-friendly description that gives more details about this role }
Role is used in a map[sring]Role within each Template. Role IDs are used to identify what actions a User can take on a Stream (given the user's Groups and the Stream's Template)
type RoleStateEnumerator ¶
type RoleStateEnumerator interface { // State returns the current state of the object. State() string // Roles Returns the list of roles granted by the provided authorization Roles(*Authorization) []string }
RoleStateEnumerator wraps the methods required for an object to declare what authorized roles/state combinations are required for access.
type Rule ¶ added in v0.6.0
type Rule struct { RuleID primitive.ObjectID `json:"ruleId" bson:"_id"` // Unique identifier of this Rule UserID primitive.ObjectID `json:"userId" bson:"userId"` // Unique identifier of the User who owns this Rule FollowingID primitive.ObjectID `json:"followingId" bson:"followingId"` // Unique identifier of the Following record that created this Rule. If Zero, then this rule was created by the user. FollowingLabel string `json:"followingLabel" bson:"followingLabel"` // Label of the Following record that created this Rule. Type string `json:"type" bson:"type"` // Type of Rule (e.g. "ACTOR", "DOMAIN", "CONTENT") Action string `json:"action" bson:"action"` // Action to take when this rule is triggered (e.g. "BLOCK", "MUTE", "LABEL") Label string `json:"label" bson:"label"` // Human-friendly label to add to messages Trigger string `json:"trigger" bson:"trigger"` // Parameter for this rule type) Summary string `json:"summary" bson:"summary"` // Optional comment describing why this rule exists IsPublic bool `json:"isPublic" bson:"isPublic"` // If TRUE, this record is visible publicly PublishDate int64 `json:"publishDate" bson:"publishDate"` // Unix timestamp when this rule was published to followers journal.Journal `json:"-" bson:",inline"` }
Rule represents many kinds of filters that are applied to messages before they are added into a User's inbox
func (Rule) FilterByActor ¶ added in v0.6.0
FilterByActor returns TRUE if the provided actor should be ruleed
func (Rule) FilterByActorAndContent ¶ added in v0.6.0
func (Rule) FilterByActors ¶ added in v0.6.0
func (Rule) FilterByContent ¶ added in v0.6.0
func (Rule) GetRank ¶ added in v0.6.0
GetRank returns the "Rank" of this object, which is its CreateDate
func (*Rule) GetStringOK ¶ added in v0.6.0
func (Rule) Origin ¶ added in v0.6.0
Origin returns a string that identifies the origin of this Rule. (DOMAIN, REMOTE, or USER)
func (Rule) OriginAdmin ¶ added in v0.6.0
OriginAdmin returns TRUE if this Rule was created by a Domain administrator.
func (Rule) OriginRemote ¶ added in v0.6.0
OriginRemote returns TRUE if this Rule was created by a Following record.
func (Rule) OriginUser ¶ added in v0.6.0
OriginUser returns TRUE if this Rule was created by the User.
func (Rule) Roles ¶ added in v0.6.0
func (rule Rule) Roles(authorization *Authorization) []string
Roles returns a list of all roles that match the provided authorization. Since Rule records should only be accessible by the rule owner, this function only returns MagicRoleMyself if applicable. Others (like Anonymous and Authenticated) should never be allowed on an Rule record, so they are not returned.
func (Rule) State ¶ added in v0.6.0
State returns the current state of this object. For users, there is no state, so it returns ""
func (Rule) Toot ¶ added in v0.6.0
func (rule Rule) Toot() object.Relationship
type RuleSummary ¶ added in v0.6.0
type RuleSummary struct { RuleID primitive.ObjectID `bson:"_id"` Type string `bson:"type"` Action string `bson:"action"` Behavior string `bson:"behavior"` Trigger string `bson:"trigger"` Label string `bson:"label"` FollowingLabel string `bson:"followingLabel"` }
RuleSummary is a trimmed down subset of the Rule object, which is used when executing rules on a piece of content
func (RuleSummary) Fields ¶ added in v0.6.0
func (rule RuleSummary) Fields() []string
func (RuleSummary) IsAllowed ¶ added in v0.6.0
func (rule RuleSummary) IsAllowed(document *streams.Document) bool
IsAllowed returns TRUE if the document should be allowed based on this rule. (i.e. the document DOES NOT match the rule)
func (RuleSummary) IsDisallowSend ¶ added in v0.6.0
func (rule RuleSummary) IsDisallowSend(recipient string) bool
func (RuleSummary) IsDisallowed ¶ added in v0.6.0
func (rule RuleSummary) IsDisallowed(document *streams.Document) bool
IsDisallowed returns TRUE if the document SHOULD NOT BE allowed based on this rule. (i.e. the document MATCHES the rule)
type SearchResult ¶ added in v0.7.0
type SearchResult struct { SearchResultID primitive.ObjectID `bson:"_id"` // SearchResultID is the unique identifier for a SearchResult. Type string `bson:"type"` // Type is the ActivityPub object type (Person, Article, etc) URL string `bson:"url"` // URL is the URL of the SearchResult. Name string `bson:"name"` // Name is the name of the SearchResult. AttributedTo string `bson:"attributedTo"` // AttributedTo is the name (or username) of the creator of this SearchResult. Summary string `bson:"summary"` // Summary is a short description of the SearchResult. IconURL string `bson:"icon"` // IconURL is the URL of the icon for the SearchResult. TagNames sliceof.String `bson:"tagNames"` // TagNames is a human-readable list of tags that are associated with this SearchResult. TagValues sliceof.String `bson:"tagValues"` // TagValues is a machine-readable list of tag values that are associated with this SearchResult. FullText string `bson:"fullText"` // FullText is the full text of the SearchResult. Rank int64 `bson:"rank"` // Rank is the rank of this SearchResult in the search index. Shuffle int64 `bson:"shuffle"` // Shuffle is a random number used to shuffle the search results. ReIndexDate int64 `bson:"reindexDate"` // ReIndexDate is the date that this SearchResult should be reindexed. journal.Journal `bson:",inline"` }
SearchResult represents a value in the search index
func NewSearchResult ¶ added in v0.7.0
func NewSearchResult() SearchResult
func (SearchResult) Fields ¶ added in v0.7.0
func (searchResult SearchResult) Fields() []string
func (SearchResult) ID ¶ added in v0.7.0
func (searchResult SearchResult) ID() string
ID returns the unique identifier for this SearchResult and implements the data.Object interface
func (SearchResult) IsZero ¶ added in v0.7.0
func (searchResult SearchResult) IsZero() bool
func (*SearchResult) Update ¶ added in v0.7.0
func (searchResult *SearchResult) Update(other SearchResult)
Update copies the values from another SearchResult into this SearchResult
type SearchTag ¶ added in v0.7.0
type SearchTag struct { SearchTagID primitive.ObjectID `bson:"_id"` // SearchTagID is the unique identifier for a SearchTag. Group string `bson:"group"` // Group is the type of tag (GENRE, MOOD, ACTIVITY, etc.) Name string `bson:"name"` // Name used for this tag Value string `bson:"value"` // Value is the normalized version of the tag name. Colors sliceof.String `bson:"colors"` // Colors is a slice of one or more RGB Hex color to use for tags featured on search panels. Related string `bson:"related"` // Related is a list of other tags that are related to this tag. Notes string `bson:"notes"` // Notes is a place for administrators to make notes about the tag. Rank int `bson:"rank"` // Rank is the sort order of the SearchTag. StateID int `bson:"stateId"` // StateID represents the state that the tag is in. (FEATURED, ALLOWED, WAITING, BLOCKED) ImageID primitive.ObjectID `bson:"imageId"` // AttachmentID is the unique identifier for the attachment that is associated with this tag. journal.Journal `bson:",inline"` }
SearchTag represents a tag that vistors can use to search for Users and Streams in the database.
func NewSearchTag ¶ added in v0.7.0
func NewSearchTag() SearchTag
NewSearchTag returns a fully initialized SearchTag object
func (SearchTag) Fields ¶ added in v0.7.0
Fields returns a slice of field names to include in a batch search query.
func (*SearchTag) GetPointer ¶ added in v0.7.0
GetPointer implements the schema.PointerGetter interface, and allows read/write access to many fields of a SearchTag object
func (SearchTag) GetStringOK ¶ added in v0.7.0
GetStringOK implements the schema.StringGetter interface, and allows read access to many fields of a SearchTag object
func (SearchTag) ID ¶ added in v0.7.0
ID returns the unique identifier for this SearchTag, implementing the data.Object interface.
func (SearchTag) ImageURL ¶ added in v0.7.0
ImageURL returns the URL for the attached image (if present) or an empty string.
func (SearchTag) RelatedTags ¶ added in v0.7.0
RelatedTags returns a parsed slice of tags from the "Related" tag field.
func (*SearchTag) SetString ¶ added in v0.7.0
SetString implements the schema.StringSetter interface, and allows write access to many fields of a SearchTag object
func (SearchTag) StatusText ¶ added in v0.7.0
type State ¶
type State struct { StateID string `json:"stateId" bson:"stateId"` // Unique ID for this state (within this Template) Label string `json:"label" bson:"label"` // Human-friendly label for this State Description string `json:"description" bson:"description"` // Description of this State }
State defines an individual state that a Template/Stream can be in. States are the basis for transitions, forms, and actions.
type StateSetter ¶ added in v0.6.0
type StateSetter interface { // SetState updates the state of the object. The meaning of // this behavior is defined by the object. SetState(string) }
StateSetter wraps the SetState() method, which updates the state of an object.
type Stream ¶
type Stream struct { StreamID primitive.ObjectID `json:"streamId" bson:"_id"` // Unique identifier of this Stream. ParentID primitive.ObjectID `json:"parentId" bson:"parentId"` // Unique identifier of the "parent" stream. ParentIDs id.Slice `json:"parentIds" bson:"parentIds"` // List of all parent IDs, including the current parent. This is used to generate "breadcrumbs" for the Stream. Rank int `json:"rank" bson:"rank"` // If Template uses a custom sort order, then this is the value used to determine the position of this Stream. RankAlt int `json:"rankAlt" bson:"rankAlt"` // Alternate sort criteria StartTime int64 `json:"startTime" bson:"startTime"` // Unix timestamp of the date/time when an event is expected to start EndTime int64 `json:"endTime" bson:"endTime"` // Unix timestamp of the date/time when an event is expected to end TemplateID string `json:"templateId" bson:"templateId"` // Unique identifier (name) of the Template to use when building this Stream in HTML. ParentTemplateID string `json:"parentTemplateId" bson:"parentTemplateId"` // Unique identifier (name) of the parent's Template. StateID string `json:"stateId" bson:"stateId"` // Unique identifier of the State this Stream is in. This is used to populate the State information from the Template service at load time. SocialRole string `json:"socialRole,omitempty" bson:"socialRole,omitempty"` // Role to use for this Stream in social integrations (Article, Note, Image, etc) Permissions mapof.Object[sliceof.String] `json:"permissions,omitempty" bson:"permissions,omitempty"` // Permissions for which streams can access this stream. DefaultAllow id.Slice `json:"defaultAllow,omitempty" bson:"defaultAllow,omitempty"` // List of Groups that are allowed to perform the 'default' (view) action. This is used to query general access to the Stream from the database, before performing server-based authentication. URL string `json:"url,omitempty" bson:"url,omitempty"` // URL of the original document Token string `json:"token,omitempty" bson:"token,omitempty"` // Unique value that identifies this element in the URL Label string `json:"label,omitempty" bson:"label,omitempty"` // Label/Title of the document Summary string `json:"summary,omitempty" bson:"summary,omitempty"` // Brief summary of the document IconURL string `json:"iconUrl,omitempty" bson:"iconUrl,omitempty"` // URL of this document's icon/thumbnail image Context string `json:"context,omitempty" bson:"context,omitempty"` // Context of this document (usually a URL) InReplyTo string `json:"inReplyTo" bson:"inReplyTo"` // If this stream is a reply to another stream or web page, then this links to the original document. AttributedTo PersonLink `json:"attributedTo,omitempty" bson:"attributedTo,omitempty"` // List of people who are attributed to this document Content Content `json:"content,omitempty" bson:"content,omitempty"` // Body content object for this Stream. Widgets set.Slice[StreamWidget] `json:"widgets,omitempty" bson:"widgets,omitempty"` // Additional widgets to include when building this Stream. Data mapof.Any `json:"data,omitempty" bson:"data,omitempty"` // Set of data to populate into the Template. This is validated by the JSON-Schema of the Template. Syndication delta.Slice[string] `json:"syndication,omitempty" bson:"syndication,omitempty"` // List of external services that this Stream has been syndicated to. PublishDate int64 `json:"publishDate" bson:"publishDate"` // Unix timestamp of the date/time when this document is/was/will be first available on the domain. UnPublishDate int64 `json:"unpublishDate" bson:"unpublishDate"` // Unix timestemp of the date/time when this document will no longer be available on the domain. IsFeatured bool `json:"isFeatured" bson:"isFeatured"` // TRUE if this Stream is featured by its parent container. journal.Journal `bson:",inline"` }
Stream corresponds to a top-level path on any Domain.
func (*Stream) ActivityPubAnnouncedURL ¶ added in v0.6.0
func (Stream) ActivityPubChildrenURL ¶ added in v0.7.0
func (Stream) ActivityPubDislikesURL ¶ added in v0.6.0
func (*Stream) ActivityPubFollowersURL ¶ added in v0.6.0
func (*Stream) ActivityPubInboxURL ¶ added in v0.6.0
func (Stream) ActivityPubLikesURL ¶ added in v0.6.0
func (*Stream) ActivityPubOutboxURL ¶ added in v0.6.0
func (Stream) ActivityPubRepliesURL ¶ added in v0.6.0
func (Stream) ActivityPubResponses ¶ added in v0.6.0
func (Stream) ActivityPubSharesURL ¶ added in v0.6.0
func (Stream) ActivityPubType ¶ added in v0.6.0
func (Stream) ActivityPubURL ¶ added in v0.6.0
func (*Stream) ActorLink ¶ added in v0.7.0
func (stream *Stream) ActorLink() PersonLink
ActorLink returns a PersonLink object that represents this Stream as an ActivityPub "actor"
func (*Stream) AssignPermission ¶
AssignPermissions assigns a role to a group
func (*Stream) CopyFrom ¶ added in v0.7.0
CopyFrom sets all values in this Stream to match the values in the provided Stream
func (*Stream) DefaultAllowAnonymous ¶
DefaultAllowAnonymous returns TRUE if a Stream's default action (VIEW) is visible to anonymous visitors
func (*Stream) DocumentLink ¶ added in v0.6.0
func (stream *Stream) DocumentLink() DocumentLink
func (*Stream) GetPointer ¶ added in v0.6.0
func (*Stream) GetSort ¶
GetSort returns the sortable value for this stream, based onthe provided fieldName
func (Stream) GetWebhookData ¶ added in v0.7.0
GetWebhookData returns the data for this Stream that will be sent to a webhook
func (*Stream) GrandparentID ¶ added in v0.7.0
GrandParentID returns the ID of the parent of the parent of this Stream (if it exists)
func (*Stream) GrandparentURL ¶ added in v0.7.0
GrandparentURL returns the URL of the parent of the parent of this Stream (if it exists)
func (*Stream) HasGrandparent ¶ added in v0.7.0
HasGrandparent returns TRUE if this Stream has a GrandparentID
func (*Stream) IsPublished ¶
IsPublished returns TRUE if this Stream is currently published
func (*Stream) PermissionGroups ¶
PermissionGroups returns all groups that match the provided roles
func (*Stream) PermissionRoles ¶
PermissionRoles returns a unique list of all roles that the provided groups can access.
func (*Stream) PublishActivity ¶ added in v0.6.0
PublishActivity returns the ActivityType that should be used when publishing this Stream (either Create or Update)
func (*Stream) Roles ¶
func (stream *Stream) Roles(authorization *Authorization) []string
Roles returns a list of all roles that match the provided authorization
func (*Stream) SetAttributedTo ¶ added in v0.6.0
func (stream *Stream) SetAttributedTo(person PersonLink)
SetAttributedTo sets the list of people that this Stream is attributed to
func (*Stream) SimplePermissionModel ¶
SimplePermissionModel returns a model object for displaying Simple Sharing.
func (*Stream) State ¶
State returns the current state of this Stream. It is part of the implementation of the RoleStateEmulator interface
func (*Stream) WidgetByID ¶
func (stream *Stream) WidgetByID(streamWidgetID primitive.ObjectID) StreamWidget
func (*Stream) WidgetsByLocation ¶
func (stream *Stream) WidgetsByLocation(location string) []StreamWidget
type StreamActor ¶ added in v0.6.0
type StreamActor struct { SocialRole string `json:"social-role" bson:"socialRole"` // StreamActor Role to use for this Template in social integrations (Person, Organization, Application, etc.) RSS bool `json:"rss" bson:"rss"` // If TRUE, Generate RSS/Atom/JSONFeed/WebSub endpoints for this actor and its children BoostInbox bool `json:"boost-inbox" bson:"boostInbox"` // If TRUE, Broadcast all events sent to this Stream to all Followers BoostFollowersOnly bool `json:"boost-followers-only" bson:"boostFollowersOnly"` // If TRUE, Broadcast messages from Followers only (not from other sources) BoostChildren bool `json:"boost-children" bson:"boostChildren"` // If TRUE, Broadcast add/update/delete events on child Streams to Followers PublishFollowers bool `json:"publish-followers" bson:"publishFollowers"` // If TRUE, Follower list is published via ActivityPub }
StreamActor defines the settings for a Stream to be used as an Actor in social integrations
func (StreamActor) IsNil ¶ added in v0.6.0
func (actor StreamActor) IsNil() bool
IsNull returns TRUE if this actor is nil (or undefined)
func (StreamActor) JSONLD ¶ added in v0.6.0
func (actor StreamActor) JSONLD(stream *Stream) mapof.Any
func (StreamActor) NotNil ¶ added in v0.6.0
func (actor StreamActor) NotNil() bool
NotNil returns TRUE if this actor has been defined (and should be executed).
type StreamSummary ¶
type StreamSummary struct { ObjectID primitive.ObjectID `json:"streamId" bson:"_id"` // Unique identifier of this Stream. (NOT USED PUBLICLY) ParentObjectID primitive.ObjectID `json:"parentId" bson:"parentId"` // Unique identifier of the "parent" stream. (NOT USED PUBLICLY) Token string `json:"token" bson:"token"` // Unique value that identifies this element in the URL TemplateID string `json:"templateId" bson:"templateId"` // Unique identifier (name) of the Template to use when building this Stream in HTML. URL string `json:"url,omitempty" bson:"url,omitempty"` // URL of the original document Label string `json:"label,omitempty" bson:"label,omitempty"` // Label/Title of the document Summary string `json:"summary,omitempty" bson:"summary,omitempty"` // Brief summary of the document Content Content `json:"content,omitempty" bson:"content,omitempty"` // Content of the document Data mapof.Any `json:"data,omitempty" bson:"data,omitempty"` // Additional data that is specific to the Template used to build this Stream IconURL string `json:"iconUrl,omitempty" bson:"iconUrl,omitempty"` // URL of the icon image for this document AttributedTo PersonLink `json:"attributedTo,omitempty" bson:"attributedTo,omitempty"` // List of people who are attributed to this document InReplyTo string `json:"inReplyTo,omitempty" bson:"inReplyTo,omitempty"` // If this stream is a reply to another stream or web page, then this links to the original document. PublishDate int64 `json:"publishDate" bson:"publishDate"` // Date when this stream was published UnPublishDate int64 `json:"unpublishDate" bson:"unpublishDate"` // Date when this stream should be removed from public view Rank int `json:"rank" bson:"rank"` // If Template uses a custom sort order, then this is the value used to determine the position of this Stream. IsFeatured bool `json:"isFeatured" bson:"isFeatured"` // If this Stream is "featured" then it will be displayed in a special location on the page. CreateDate int64 `json:"createDate" bson:"createDate"` // Date when this stream was created }
StreamSummary represents a partial stream record (used for lists)
func NewStreamSummary ¶
func NewStreamSummary() StreamSummary
NewStream returns a fully initialized Stream object.
func (StreamSummary) Author ¶ added in v0.6.0
func (summary StreamSummary) Author() PersonLink
func (StreamSummary) ContentHTML ¶ added in v0.6.0
func (summary StreamSummary) ContentHTML() string
func (StreamSummary) ContentRaw ¶ added in v0.6.0
func (summary StreamSummary) ContentRaw() string
func (StreamSummary) Fields ¶
func (summary StreamSummary) Fields() []string
func (StreamSummary) ID ¶ added in v0.6.0
func (summary StreamSummary) ID() string
func (StreamSummary) IsPublished ¶ added in v0.7.0
func (summary StreamSummary) IsPublished() bool
func (StreamSummary) ParentID ¶
func (summary StreamSummary) ParentID() string
func (StreamSummary) StreamID ¶
func (summary StreamSummary) StreamID() string
type StreamWidget ¶
type StreamWidget struct { StreamWidgetID primitive.ObjectID `json:"streamWidgetId" bson:"streamWidgetId"` Type string `json:"type" bson:"type"` Location string `json:"location" bson:"location"` Label string `json:"label" bson:"label"` Data mapof.Any `json:"data" bson:"data"` // These values are not stored in the database, but injected during building Stream *Stream `json:"-" bson:"-"` Widget Widget `json:"-" bson:"-"` }
func NewStreamWidget ¶
func NewStreamWidget(widgetType string, label string, location string) StreamWidget
func (*StreamWidget) GetPointer ¶ added in v0.6.0
func (x *StreamWidget) GetPointer(key string) (any, bool)
func (StreamWidget) GetStringOK ¶
func (x StreamWidget) GetStringOK(key string) (string, bool)
func (StreamWidget) ID ¶ added in v0.6.0
func (widget StreamWidget) ID() string
ID returns the string representation of the StreamWidgetID This method satisfies the set.Value interface
func (StreamWidget) IsNew ¶
func (widget StreamWidget) IsNew() bool
type Template ¶
type Template struct { TemplateID string `json:"templateId" bson:"templateId"` // Internal name/token other objects (like streams) will use to reference this Template. URL string `json:"url" bson:"url"` // URL where this template is published TemplateRole string `json:"templateRole" bson:"templateRole"` // Role that this Template performs in the system. Used to match which streams can be contained by which other streams. SocialRole string `json:"socialRole" bson:"socialRole"` // Role to use for this Template in social integrations (Article, Note, etc) SocialRules translate.Pipeline `json:"socialRules" bson:"socialRules"` // List of rules to convert this Template into a social object Model string `json:"model" bson:"model"` // Type of model object that this template works with. (Stream, User, Group, Domain, etc.) Extends sliceof.String `json:"extends" bson:"extends"` // List of templates that this template extends. The first template in the list is the most important, and the last template in the list is the least important. ContainedBy sliceof.String `json:"containedBy" bson:"containedBy"` // Slice of Templates that can contain Streams that use this Template. Label string `json:"label" bson:"label"` // Human-readable label used in management UI. Description string `json:"description" bson:"description"` // Human-readable long-description text used in management UI. Category string `json:"category" bson:"category"` // Human-readable category (grouping) used in management UI. Icon string `json:"icon" bson:"icon"` // Icon image used in management UI. Sort int `json:"sort" bson:"sort"` // Sort order used in management UI. ChildSortType string `json:"childSortType" bson:"childSortType"` // SortType used to display children ChildSortDirection string `json:"childSortDirection" bson:"childSortDirection"` // Sort direction "asc" or "desc" (Default is ascending) WidgetLocations sliceof.String `json:"widget-locations" bson:"widgetLocations"` // List of locations where widgets can be placed. Common values are: "TOP", "BOTTOM", "LEFT", "RIGHT" Schema schema.Schema `json:"schema" bson:"schema"` // JSON Schema that describes the data required to populate this Template. States mapof.Object[State] `json:"states" bson:"states"` // Map of States (by state.ID) that Streams of this Template can be in. AccessRoles mapof.Object[Role] `json:"accessRoles" bson:"accessRoles"` // Map of custom roles defined by this Template. Actions mapof.Object[Action] `json:"actions" bson:"actions"` // Map of actions that can be performed on streams of this Template HTMLTemplate *template.Template `json:"-" bson:"-"` // Compiled HTML template TagPaths []string `json:"tagPaths" bson:"tagPaths"` // List of paths to tags that are used in this template SearchOptions templatemap.Map `json:"search" bson:"search"` // Compiled templates that override default search result values Bundles mapof.Object[Bundle] `json:"bundles" bson:"bundles"` // Additional resources (JS, HS, CSS) reqired tp remder this Template. Resources fs.FS `json:"-" bson:"-"` // File system containing the template resources Datasets DatasetMap `json:"datasets" bson:"-"` // Lookup codes defined by this template DefaultAction string `json:"defaultAction" bson:"defaultAction"` // Name of the action to be used when none is provided. Also serves as the permissions for viewing a Stream. If this is empty, it is assumed to be "view" Actor StreamActor `json:"actor" bson:"actor"` // ActivityPub Actor operated on behalf of this Template/Stream }
Template represents an HTML template used for building Streams
func NewTemplate ¶
NewTemplate creates a new, fully initialized Template object
func (*Template) CanBeContainedBy ¶
CanBeContainedBy returns TRUE if this Streams using this Template can be nested inside of Streams using the Template named in the parameters
func (*Template) GetOEmbed ¶ added in v0.7.0
GetOEmbed returns the OEmbed template for this Template If no OEmbed template is found, then nil is returned
func (*Template) HasOEmbed ¶ added in v0.7.0
HasOEmbed returns TRUE if this Template has an OEmbed template
func (*Template) IsValidWidgetLocation ¶
type Theme ¶
type Theme struct { ThemeID string `json:"themeID" bson:"themeID"` // Internal name/token other objects (like streams) will use to reference this Theme. Extends []string `json:"extends" bson:"extends"` // List of other themes that this theme extends Category string `json:"category" bson:"category"` // Category of this theme (for grouping) Label string `json:"label" bson:"label"` // Human-readable label for this theme Description string `json:"description" bson:"description"` // Human-readable description for this theme Rank int `json:"rank" bson:"rank"` // Sort order for this theme HTMLTemplate *template.Template `json:"-" bson:"-"` // HTML template for this theme Bundles mapof.Object[Bundle] `json:"bundles" bson:"bundles"` // // Additional resources (JS, HS, CSS) reqired tp remder this Theme. Resources fs.FS `json:"-" bson:"-"` // File system containing the template resources Datasets mapof.Object[mapof.Any] `json:"datasets" bson:"datasets"` // Datasets used by this theme StartupStreams []mapof.Any `json:"startupStreams" bson:"startupStreams"` // Dataset of Streams to initialize when this theme is first chosen. StartupGroups []mapof.Any `json:"startupGroups" bson:"startupGroups"` // Dataset of Groups to initialize when this theme is first chosen. DefaultFolders []mapof.Any `json:"defaultFolders" bson:"defaultFolders"` // Dataset of Folders to initialize when a User is added using this Theme. DefaultInbox string `json:"defaultInbox" bson:"defaultInbox"` // Default Inbox Template for Users created underneath this theme DefaultOutbox string `json:"defaultOutbox" bson:"defaultOutbox"` // Default Outbox Template for Users created underneath this theme Form form.Element `json:"form" bson:"form"` // Form used to edit custom data Schema schema.Schema `json:"schema" bson:"schema"` // Schema used to validate custom data Data mapof.String `json:"data" bson:"data"` // Custom data for this theme IsVisible bool `json:"isVisible" bson:"isVisible"` // Is this theme visible to the site owners? }
Theme represents an HTML template used for building all hard-coded application elements (but not dynamic streams)
func (Theme) IsPlaceholder ¶ added in v0.6.0
IsPlaceholder is a temporary function the SHOULD be removed once we have a sufficient number of well-defined themes. Until then, it's used to mark themes that are in the system but don't work yet.
func (Theme) LookupCode ¶
func (theme Theme) LookupCode() form.LookupCode
type User ¶
type User struct { UserID primitive.ObjectID `json:"userId" bson:"_id"` // Unique identifier for this user. MapIDs mapof.String `json:"mapIds" bson:"mapIds"` // Map of IDs for this user on other web services. GroupIDs id.Slice `json:"groupIds" bson:"groupIds"` // Slice of IDs for the groups that this user belongs to. IconID primitive.ObjectID `json:"iconId" bson:"iconId"` // AttachmentID of this user's avatar/icon image. ImageID primitive.ObjectID `json:"imageId" bson:"imageId"` // AttachmentID of this user's banner image. DisplayName string `json:"displayName" bson:"displayName"` // Name to be displayed for this user StatusMessage string `json:"statusMessage" bson:"statusMessage"` // Status summary for this user Location string `json:"location" bson:"location"` // Human-friendly description of this user's physical location. ProfileURL string `json:"profileUrl" bson:"profileUrl"` // Fully Qualified profile URL for this user (including domain name) EmailAddress string `json:"emailAddress" bson:"emailAddress"` // Email address for this user Username string `json:"username" bson:"username"` // This is the primary public identifier for the user. Password string `json:"-" bson:"password"` // This password should be encrypted with BCrypt. Locale string `json:"locale" bson:"locale"` // Language code for this user's preferred language. SignupNote string `json:"signupNote" bson:"signupNote,omitempty"` // Note that was included when this user signed up. StateID string `json:"stateId" bson:"stateId"` // State ID for this user InboxTemplate string `json:"inboxTemplate" bson:"inboxTemplate"` // Template for the user's inbox OutboxTemplate string `json:"outboxTemplate" bson:"outboxTemplate"` // Template for the user's outbox NoteTemplate string `json:"noteTemplate" bson:"noteTemplate"` // Template for generically created notes Links sliceof.Object[PersonLink] `json:"links" bson:"links"` // Slice of links to profiles on other web services. PasswordReset PasswordReset `json:"-" bson:"passwordReset"` // Most recent password reset information. Data mapof.String `json:"data" bson:"data"` // Custom profile data that can be stored with this User. journal.Journal `json:"-" bson:",inline"` FollowerCount int `json:"followerCount" bson:"followerCount"` // Number of followers for this user FollowingCount int `json:"followingCount" bson:"followingCount"` // Number of actors that this user is following RuleCount int `json:"ruleCount" bson:"ruleCount"` // Number of rules (blocks) that this user has implemented IsOwner bool `json:"isOwner" bson:"isOwner"` // If TRUE, then this user is a website owner with FULL privileges. IsPublic bool `json:"isPublic" bson:"isPublic"` // If TRUE, then this user's profile is publicly visible IsIndexable bool `json:"isIndexable" bson:"isIndexable"` // If TRUE, then this user's profile can be indexed by search engines. }
User represents a person or machine account that can own pages and sections.
func (*User) ActivityPubBlockedURL ¶
func (*User) ActivityPubFollowersURL ¶
func (*User) ActivityPubFollowingURL ¶
func (*User) ActivityPubIconURL ¶ added in v0.7.0
func (*User) ActivityPubImageURL ¶ added in v0.7.0
func (*User) ActivityPubInboxURL ¶
func (*User) ActivityPubLikedURL ¶
func (*User) ActivityPubOutboxURL ¶
func (*User) ActivityPubPublicKeyURL ¶
func (*User) ActivityPubURL ¶
func (*User) AddGroup ¶ added in v0.7.0
AddGroup adds a new group to this user's list of groups, avoiding duplicates
func (*User) Claims ¶
func (user *User) Claims() jwt.Claims
Claims returns all access privileges given to this user. A part of the "steranko.User" interface.
func (*User) GetPassword ¶
GetPassword returns the (encrypted) passsword for this User. A part of the "steranko.User" interface.
func (*User) GetUsername ¶
GetUsername returns the username for this User. A part of the "steranko.User" interface.
func (User) GetWebhookData ¶ added in v0.7.0
GetWebhookData returns the data for this User that will be sent to a webhook
func (*User) JSONFeedURL ¶
func (User) PersonLink ¶
func (user User) PersonLink() PersonLink
func (*User) RemoveGroup ¶ added in v0.7.0
RemoveGroup removes a group from this user's list of groups
func (*User) Roles ¶
func (user *User) Roles(authorization *Authorization) []string
Roles returns a list of all roles that match the provided authorization
func (*User) SetPassword ¶
SetPassword updates the password for this User. A part of the "steranko.User" interface.
func (*User) SetUsername ¶
SetUsername updates the username for this User. A part of the "steranko.User" interface.
func (*User) State ¶
State returns the current state of this object. For users, there is no state, so it returns ""
func (User) Summary ¶
func (user User) Summary() UserSummary
Summary generates a lightweight summary of this user record.
type UserResponseSummary ¶ added in v0.6.0
UserResponseSummary is a summary object of the User's response(s) to a particular ActivityStream
func NewUserResponseSummary ¶ added in v0.6.0
func NewUserResponseSummary() UserResponseSummary
NewUserResponseSummary returns a fully initialized UserResponseSummary
func (*UserResponseSummary) SetResponse ¶ added in v0.6.0
func (summary *UserResponseSummary) SetResponse(responseType string, value bool)
type UserSummary ¶
type UserSummary struct { UserID primitive.ObjectID `bson:"_id"` IconID primitive.ObjectID `bson:"iconId"` DisplayName string `bson:"displayName"` EmailAddress string `bson:"emailAddress"` Username string `bson:"username"` ProfileURL string `bson:"profileUrl"` StatusMessage string `bson:"statusMessage"` }
UserSummary is used as a lightweight, read-only summary of a user record.
func NewUserSummary ¶
func NewUserSummary() UserSummary
func (UserSummary) Fields ¶
func (userSummary UserSummary) Fields() []string
func (UserSummary) IconURL ¶ added in v0.7.0
func (userSummary UserSummary) IconURL() string
type Webhook ¶ added in v0.7.0
type Webhook struct { WebhookID primitive.ObjectID `json:"webhookId" bson:"_id"` Events sliceof.String `json:"events" bson:"events"` Label string `json:"label" bson:"label"` TargetURL string `json:"targetUrl" bson:"targetUrl"` journal.Journal `json:"-" bson:",inline"` }
Webhook defines an outbound webhook that can be triggered by events in the system
func NewWebhook ¶ added in v0.7.0
func NewWebhook() Webhook
NewWebhook returns a fully initialized Webhook object
func (*Webhook) GetPointer ¶ added in v0.7.0
func (Webhook) GetStringOK ¶ added in v0.7.0
type WebhookDataGetter ¶ added in v0.7.0
WebhookDataGetter wraps the GetWebhook() method, which lets an object return an arbitrary data structure to be sent as a webhook
type Widget ¶
type Widget struct { WidgetID string `json:"widgetId" bson:"widgetId"` // Unique identifier for this widget Label string `json:"label" bson:"label"` // Human-readable label for this widget Description string `json:"description" bson:"description"` // Human-readable description for this widget Schema schema.Schema `json:"schema" bson:"schema"` // Custom data schema to use for this widget Form form.Element `json:"form" bson:"form"` // Property/Settings form for this widget HTMLTemplate *template.Template `json:"htmlTemplate" bson:"htmlTemplate"` // HTML template for this widget Bundles mapof.Object[Bundle] `json:"bundles" bson:"bundles"` // List of bundles that this widget uses Resources fs.FS `json:"-" bson:"-"` // File system containing the template resources }
func (Widget) IsEditable ¶ added in v0.6.0
Source Files ¶
- action.go
- activityStreams.go
- attachment.go
- attachmentRules.go
- attachmentRules_accessors.go
- attachment_accessors.go
- attachment_constants.go
- authorization.go
- bundle.go
- connection.go
- connection_accessors.go
- connection_constants.go
- content.go
- content_accessors.go
- content_constants.go
- domain.go
- domain_accessors.go
- domain_constants.go
- email.go
- encryptionKey.go
- encryptionKey_constants.go
- folder.go
- folderList.go
- folder_accessors.go
- folder_constants.go
- follower.go
- followerSummary.go
- follower_accessors.go
- follower_constants.go
- following.go
- followingSummary.go
- following_accessors.go
- following_constants.go
- group.go
- group_accessors.go
- interfaces.go
- jwt.go
- linkDocument.go
- linkDocument_accessors.go
- linkOrigin.go
- linkOrigin_accessors.go
- linkOrigin_constants.go
- linkPerson.go
- linkPerson_accessors.go
- link_constants.go
- magic.go
- mention.go
- mention_accessors.go
- mention_constants.go
- message.go
- message_accessors.go
- message_constants.go
- mimeType.go
- model.go
- oauthAuthorizationRequest.go
- oauthClient.go
- oauthClient_accessors.go
- oauthUserToken.go
- oauthUserTokenRequest.go
- oauthUserTokenRevokeRequest.go
- oauthUserToken_accessors.go
- outboxMessage.go
- outboxMessageSummary.go
- outboxMessage_accessors.go
- passwordReset.go
- registration.go
- registrationTxn.go
- response.go
- response_accessors.go
- role.go
- rule.go
- ruleSummary.go
- rule_accessors.go
- rule_constants.go
- rule_filters.go
- searchResult.go
- searchTag.go
- searchTag_accessors.go
- searchTag_constants.go
- state.go
- stream.go
- streamActor.go
- streamSummary.go
- streamWidget.go
- streamWidget_accessors.go
- stream_accessors.go
- template.go
- theme.go
- user.go
- userResponseSummary.go
- userSummary.go
- user_accessors.go
- user_constants.go
- utils.go
- webhook.go
- webhook_accessors.go
- webhook_constants.go
- widget.go