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 AttachmentSchema() 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 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 SignupFormSchema() schema.Element
- func SortThemes(a, b Theme) bool
- func StreamSchema() schema.Element
- func StreamSummaryFields() []string
- func StreamWidgetSchema() schema.Element
- func TagAsJSONLD(tag Tag) mapof.Any
- func TagSchema() schema.Element
- func UserSchema() schema.Element
- func UserSummaryFields() []string
- 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) GetIntOK(name string) (int, 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) SetInt(name string, value int) bool
- func (attachment *Attachment) SetString(name string, value string) bool
- func (attachment *Attachment) SetURL(host string)
- type Authorization
- type Bundle
- type Client
- type Content
- type DocumentLink
- type Domain
- func (domain *Domain) GetClient(providerID string) (Client, bool)
- func (domain *Domain) GetPointer(name string) (any, bool)
- func (domain Domain) GetStringOK(name string) (string, bool)
- func (domain *Domain) HasSignupForm() bool
- func (domain *Domain) ID() string
- func (domain *Domain) InitClients()
- func (domain Domain) IsEmpty() bool
- func (domain Domain) NotEmpty() bool
- func (domain *Domain) SetClient(client Client)
- func (domain *Domain) SetString(name string, value string) bool
- 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) Roles(authorization *Authorization) []string
- func (follower *Follower) SetString(name string, value string) bool
- func (follower Follower) State() 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
- 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
- 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) HasImageURL() bool
- func (person PersonLink) IsEmpty() bool
- func (person PersonLink) NotEmpty() bool
- func (link *PersonLink) SetString(name string, value string) bool
- func (person PersonLink) Toot() object.Account
- 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 SignupForm
- type State
- type StateSetter
- type Stream
- func (stream *Stream) ActivityPubAnnouncedURL() 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) AssignPermission(role string, groupID primitive.ObjectID)
- func (stream *Stream) DefaultAllowAnonymous() bool
- func (stream *Stream) DocumentLink() DocumentLink
- 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) HasParent() bool
- func (stream *Stream) ID() string
- func (stream *Stream) IsPublished() bool
- 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) 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) ParentID() string
- func (summary StreamSummary) StreamID() string
- type StreamWidget
- type Tag
- 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) ID() string
- func (template *Template) Inherit(parent *Template)
- func (template *Template) IsValidWidgetLocation(location string) bool
- func (template *Template) State(stateID string) (State, bool)
- type Theme
- type User
- func (user *User) ActivityPubAvatarURL() string
- func (user *User) ActivityPubBlockedURL() string
- func (user *User) ActivityPubFollowersURL() string
- func (user *User) ActivityPubFollowingURL() 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) Claims() jwt.Claims
- func (user User) Copy() User
- func (user User) GetJSONLD() mapof.Any
- func (user *User) GetPassword() string
- func (user *User) GetPointer(name string) (any, bool)
- func (user *User) GetProfileURL() string
- func (user User) GetRank() int64
- func (user *User) GetStringOK(name string) (string, bool)
- func (user *User) GetUsername() string
- func (user *User) ID() string
- func (user *User) JSONFeedURL() string
- func (user User) PersonLink() PersonLink
- func (user *User) Roles(authorization *Authorization) []string
- func (user *User) SetPassword(password 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 Widget
Constants ¶
const AttachmentTypeStream = "Stream"
AttachmentTypeStream represents an attachment that is owned by a Stream
const AttachmentTypeUser = "User"
AttachmentTypeUser represents an attachment that is owned by a User
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 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 FollowMethodActivityPub = "ACTIVITYPUB"
FollowMethodActivityPub represents the ActivityPub subscription https://www.w3.org/TR/activitypub/
const FollowMethodPoll = "POLL"
FollowMethodPoll represents a subscription that must be polled for updates
const FollowMethodRssCloud = "RSSCLOUD"
const FollowMethodWebSub = "WEBSUB"
FollowMethodWebSub represents a WebSub subscription https://websub.rocks
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 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 MimeTypeJSONResourceDescriptor = "application/jrd+json"
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 TagRelationRule = "--emissary-rule"
TagRelationRule identifies a tag that was created by an internal Emissary rule.
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 AttachmentSchema ¶
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 OutboxMessageSummaryFields ¶ added in v0.6.0
func OutboxMessageSummaryFields() []string
func PasswordResetSchema ¶
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 SignupFormSchema ¶
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 TagAsJSONLD ¶ added in v0.6.0
func UserSchema ¶
func UserSummaryFields ¶
func UserSummaryFields() []string
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
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 URL string `bson:"url"` // URL where the file is stored Rank int `bson:"rank"` // The sort order to display the attachments in. Height int `bson:"height"` // Image height (if applicable) Width int `bson:"width"` // Image width (if applicable) 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) GetStringOK ¶
func (attachment *Attachment) GetStringOK(name string) (string, bool)
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) SetString ¶
func (attachment *Attachment) SetString(name string, value string) bool
func (*Attachment) SetURL ¶ added in v0.6.0
func (attachment *Attachment) SetURL(host string)
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 Client ¶
type Client struct { ProviderID string `bson:"provider"` // ID of the provider that this credential accesses Data mapof.Any `bson:"data"` // Unique data for this credential Token *oauth2.Token `bson:"token"` // OAuth2 Token (if necessary) Active bool `bson:"active"` // Is this credential active? }
Client 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.
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 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 ImageURL string `json:"imageUrl,omitempty" bson:"imageUrl,omitempty"` // URL of the cover image for this document's image 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. 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 Forward string `bson:"forward"` // If present, then all requests for this domain should be forwarded to the designated new domain. Clients set.Map[Client] `bson:"clients"` // External connections (e.g. Facebook, Twitter, etc.) ThemeData mapof.Any `bson:"themeData"` // Custom data stored in this domain SignupForm SignupForm `bson:"signupForm"` // Valid signup forms to make new accounts. DatabaseVersion uint `bson:"databaseVersion"` // Version of the database schema journal.Journal `json:"-" bson:",inline"` }
Domain represents an account or node on this server.
func (*Domain) GetClient ¶
GetClient returns a client matching the given providerID. The OK return is TRUE if the client has already been configured.
func (*Domain) GetPointer ¶ added in v0.6.0
func (*Domain) HasSignupForm ¶
HasSignupForm returns TRUE if this domain includes a valid signup form.
func (*Domain) InitClients ¶
func (domain *Domain) InitClients()
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 ParentID primitive.ObjectID `json:"parentId" bson:"parentId"` // Unique identifier for the Stream that is being followed (including user's outboxes) Type string `json:"type" bson:"type"` // Type of record being followed (e.g. "User", "Stream") Method string `json:"method" bson:"method"` // Method of follower (e.g. "POLL", "WEBSUB", "RSS-CLOUD", "ACTIVITYPUB") Format string `json:"format" bson:"format"` // Format of the data being followed (e.g. "JSON", "XML", "ATOM", "RSS") 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) 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. Others (like Anonymous and Authenticated) should never be allowed on an Follower record, so they are not returned.
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. ProfileURL string `json:"profileUrl" bson:"profileUrl"` // Updated, computer-facing URL that is being followed. ImageURL string `json:"imageUrl" bson:"imageUrl"` // URL of an 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
type FollowingSummary ¶
type FollowingSummary struct { FollowingID primitive.ObjectID `bson:"_id"` URL string `bson:"url"` Label string `bson:"label"` Folder string `bson:"folder"` FolderID primitive.ObjectID `bson:"folderId"` ImageURL string `bson:"imageUrl"` 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
type Group ¶
type Group struct { GroupID primitive.ObjectID `json:"groupId" bson:"_id"` Label string `json:"label" bson:"label"` 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"` KeyName string `bson:"keyName"` Algorithm string `bson:"algorithm"` Plaintext []byte `bson:"-"` EncryptedValue []byte `bson:"encryptedValue"` 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) ReadDate int64 `json:"readDate" bson:"readDate"` // Unix timestamp of the date/time when this Message was read. If unread, this is MaxInt64. PublishDate int64 `json:"publishDate" bson:"publishDate,omitempty"` // Unix timestamp of the date/time when this Message was published 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 or outbox. It is loosely modelled on the MessageStreams standard, and can be converted into a strict go-fed streams.Type object.
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 ImageURL string `json:"imageUrl" bson:"imageUrl,omitempty"` // URL of the cover image for this document's image }
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) Fields ¶ added in v0.6.0
func (summary OutboxMessage) Fields() []string
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(duration time.Duration) PasswordReset
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.
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 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 ImageURL string `json:"imageUrl,omitempty" bson:"imageUrl,omitempty"` // URL of the person's avatar image }
func NewPersonLink ¶
func NewPersonLink() PersonLink
func (PersonLink) GetJSONLD ¶ added in v0.6.0
func (person PersonLink) GetJSONLD() mapof.Any
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 "imageUrl" should be passed to this function. all others will return nil values
func (PersonLink) HasImageURL ¶ added in v0.6.0
func (person PersonLink) HasImageURL() bool
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) NotEmpty ¶ added in v0.6.0
func (person PersonLink) NotEmpty() bool
func (PersonLink) Toot ¶ added in v0.6.0
func (person PersonLink) Toot() object.Account
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 SignupForm ¶
type SignupForm struct { Title string `json:"title" bson:"title"` // Title displayed on the signup page Message string `json:"message" bson:"message"` // Message displayed on the signup page GroupID primitive.ObjectID `json:"groupId" bson:"groupId"` // Group to add new users to when completed Active bool `json:"active" bson:"active"` // If true, then allow this signup page }
func NewSignupForm ¶
func NewSignupForm() SignupForm
func (SignupForm) GetStringOK ¶
func (form SignupForm) GetStringOK(name string) (string, bool)
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. 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 users 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 ImageURL string `json:"imageUrl,omitempty" bson:"imageUrl,omitempty"` // URL of the cover image for this document's image 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. Tags sliceof.Object[Tag] `json:"tags,omitempty" bson:"tags,omitempty"` // List of tags that are associated with this document 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. AttributedTo PersonLink `json:"attributedTo,omitempty" bson:"attributedTo,omitempty"` // List of people who are attributed to this document Context string `json:"context,omitempty" bson:"context,omitempty"` // Context of this document (usually a URL) InReplyTo string `json:"inReplyTo,omitempty" bson:"inReplyTo"` // 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"` // 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. journal.Journal `bson:",inline"` }
Stream corresponds to a top-level path on any Domain.
func (*Stream) ActivityPubAnnouncedURL ¶ added in v0.6.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) AssignPermission ¶
AssignPermissions assigns a role to a group
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) IsPublished ¶
IsPublished rturns 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 }
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 ImageURL string `json:"imageUrl,omitempty" bson:"imageUrl,omitempty"` // URL of the cover image for this document's image 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 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. }
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) 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 Tag ¶ added in v0.6.0
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) 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 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 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) 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. 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. GroupIDs id.Slice `json:"groupIds" bson:"groupIds"` // Slice of IDs for the groups that this user belongs to. ImageID primitive.ObjectID `json:"imageId" bson:"imageId"` // AttachmentID of this user's avatar 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. Links sliceof.Object[PersonLink] `json:"links" bson:"links"` // Slice of links to profiles on other web services. 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. FollowerCount int `json:"followerCount" bson:"followerCount"` // Number of followers for this user FollowingCount int `json:"followingCount" bson:"followingCount"` // Number of users that this user is following RuleCount int `json:"ruleCount" bson:"ruleCount"` // Number of users that this user is following 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 available PasswordReset PasswordReset ` bson:"passwordReset"` // Most recent password reset information. journal.Journal `json:"-" bson:",inline"` }
User represents a person or machine account that can own pages and sections.
func (*User) ActivityPubAvatarURL ¶
func (*User) ActivityPubBlockedURL ¶
func (*User) ActivityPubFollowersURL ¶
func (*User) ActivityPubFollowingURL ¶
func (*User) ActivityPubInboxURL ¶
func (*User) ActivityPubLikedURL ¶
func (*User) ActivityPubOutboxURL ¶
func (*User) ActivityPubPublicKeyURL ¶
func (*User) ActivityPubURL ¶
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) Copy ¶
Copy returns a duplicate copy of this User NOTE: This must NOT be a pointer receiver, so that a true COPY of this record is returned.
func (*User) GetPassword ¶
GetPassword returns the (encrypted) passsword for this User. A part of the "steranko.User" interface.
func (*User) GetProfileURL ¶
func (*User) GetUsername ¶
GetUsername returns the username for this User. A part of the "steranko.User" interface.
func (*User) JSONFeedURL ¶
func (User) PersonLink ¶
func (user User) PersonLink() PersonLink
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"` DisplayName string `bson:"displayName"` EmailAddress string `bson:"emailAddress"` Username string `bson:"username"` ImageURL string `bson:"imageUrl"` ProfileURL string `bson:"profileUrl"` }
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
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
- attachment_accessors.go
- attachment_constants.go
- authorization.go
- bundle.go
- client.go
- client_accessors.go
- content.go
- content_accessors.go
- content_constants.go
- domain.go
- domain_accessors.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
- passwordReset.go
- response.go
- response_accessors.go
- role.go
- rule.go
- ruleSummary.go
- rule_accessors.go
- rule_constants.go
- rule_filters.go
- signupForm.go
- signupForm_accessors.go
- state.go
- stream.go
- streamActor.go
- streamSummary.go
- streamWidget.go
- streamWidget_accessors.go
- stream_accessors.go
- tag.go
- tag_accessors.go
- template.go
- theme.go
- user.go
- userResponseSummary.go
- userSummary.go
- user_accessors.go
- widget.go