Documentation ¶
Index ¶
- Constants
- Variables
- type ActiveEmote
- type ActiveEmoteFlag
- type AuditLog
- type AuditLogBuilder
- func (alb *AuditLogBuilder) AddChanges(changes ...*AuditLogChange) *AuditLogBuilder
- func (alb *AuditLogBuilder) SetActor(id primitive.ObjectID) *AuditLogBuilder
- func (alb *AuditLogBuilder) SetExtra(key string, value interface{}) *AuditLogBuilder
- func (alb *AuditLogBuilder) SetKind(kind AuditLogKind) *AuditLogBuilder
- func (alb *AuditLogBuilder) SetTargetID(id primitive.ObjectID) *AuditLogBuilder
- func (alb *AuditLogBuilder) SetTargetKind(kind ObjectKind) *AuditLogBuilder
- type AuditLogChange
- func (alc *AuditLogChange) WriteArrayAdded(values ...any) *AuditLogChange
- func (alc *AuditLogChange) WriteArrayRemoved(values ...any) *AuditLogChange
- func (alc *AuditLogChange) WriteArrayUpdated(values ...AuditLogChangeSingleValue) *AuditLogChange
- func (alc *AuditLogChange) WriteSingleValues(old any, new any) *AuditLogChange
- type AuditLogChangeArrayChange
- type AuditLogChangeFormat
- type AuditLogChangeSingleValue
- type AuditLogKind
- type Ban
- type BanBuilder
- func (bb BanBuilder) Initial() Ban
- func (bb BanBuilder) IsTainted() bool
- func (ub *BanBuilder) MarkAsTainted()
- func (bb *BanBuilder) SetActorID(id primitive.ObjectID) *BanBuilder
- func (bb *BanBuilder) SetEffects(a BanEffect) *BanBuilder
- func (bb *BanBuilder) SetExpireAt(t time.Time) *BanBuilder
- func (bb *BanBuilder) SetReason(s string) *BanBuilder
- func (bb *BanBuilder) SetVictimID(id primitive.ObjectID) *BanBuilder
- type BanEffect
- type Cosmetic
- type CosmeticData
- type CosmeticDataBadge
- type CosmeticDataPaint
- type CosmeticKind
- type CosmeticPaintAnimation
- type CosmeticPaintAnimationKeyframe
- type CosmeticPaintDropShadow
- type CosmeticPaintFunction
- type CosmeticPaintGradientStop
- type Emote
- type EmoteBuilder
- func (eb *EmoteBuilder) AddVersion(v EmoteVersion) *EmoteBuilder
- func (eb *EmoteBuilder) Initial() Emote
- func (eb *EmoteBuilder) InitialVersions() []*EmoteVersion
- func (eb *EmoteBuilder) IsTainted() bool
- func (eb *EmoteBuilder) MarkAsTainted()
- func (eb *EmoteBuilder) RemoveVersion(id ObjectID) *EmoteBuilder
- func (eb *EmoteBuilder) SetFlags(sum EmoteFlag) *EmoteBuilder
- func (eb *EmoteBuilder) SetName(name string) *EmoteBuilder
- func (eb *EmoteBuilder) SetOwnerID(id primitive.ObjectID) *EmoteBuilder
- func (eb *EmoteBuilder) SetTags(tags []string, validate bool) *EmoteBuilder
- func (eb *EmoteBuilder) UpdateVersion(id ObjectID, v EmoteVersion) *EmoteBuilder
- type EmoteFile
- type EmoteFlag
- type EmoteFormat
- type EmoteFormatName
- type EmoteLifecycle
- type EmoteSet
- type EmoteSetBuilder
- func (esb *EmoteSetBuilder) AddActiveEmote(id ObjectID, alias string, at time.Time, actorID *primitive.ObjectID) *EmoteSetBuilder
- func (esb *EmoteSetBuilder) Initial() *EmoteSet
- func (esb *EmoteSetBuilder) IsTainted() bool
- func (esb *EmoteSetBuilder) MarkAsTainted()
- func (esb *EmoteSetBuilder) RemoveActiveEmote(id ObjectID) *EmoteSetBuilder
- func (esb *EmoteSetBuilder) SetEmoteSlots(slots int32) *EmoteSetBuilder
- func (esb *EmoteSetBuilder) SetImmutable(b bool) *EmoteSetBuilder
- func (esb *EmoteSetBuilder) SetName(name string) *EmoteSetBuilder
- func (esb *EmoteSetBuilder) SetOwnerID(id ObjectID) *EmoteSetBuilder
- func (esb *EmoteSetBuilder) SetParentID(id *ObjectID) *EmoteSetBuilder
- func (esb *EmoteSetBuilder) SetPrivileged(b bool) *EmoteSetBuilder
- func (esb *EmoteSetBuilder) SetTags(tags []string) *EmoteSetBuilder
- func (esb *EmoteSetBuilder) UpdateActiveEmote(id ObjectID, alias string) *EmoteSetBuilder
- type EmoteState
- type EmoteValidator
- type EmoteVersion
- func (ev EmoteVersion) CountFiles(format EmoteFormatName, omitStatic bool) int32
- func (ev EmoteVersion) GetFiles(format EmoteFormatName, omitStatic bool) []EmoteFile
- func (ev EmoteVersion) IsProcessing() bool
- func (ev EmoteVersion) IsUnavailable() bool
- func (e *EmoteVersion) Validator() EmoteVersionValidator
- type EmoteVersionState
- type EmoteVersionValidator
- type Entitlement
- type EntitlementApp
- type EntitlementBuilder
- func (b *EntitlementBuilder[D]) SetApp(app EntitlementApp) *EntitlementBuilder[D]
- func (b *EntitlementBuilder[D]) SetCondition(cond EntitlementCondition) *EntitlementBuilder[D]
- func (b *EntitlementBuilder[D]) SetData(data D) *EntitlementBuilder[D]
- func (b *EntitlementBuilder[D]) SetKind(kind EntitlementKind) *EntitlementBuilder[D]
- func (b *EntitlementBuilder[D]) SetUserID(id primitive.ObjectID) *EntitlementBuilder[D]
- type EntitlementCondition
- type EntitlementData
- type EntitlementDataBadge
- type EntitlementDataBase
- type EntitlementDataEmoteSet
- type EntitlementDataPaint
- type EntitlementDataRole
- type EntitlementDataSubscription
- type EntitlementKind
- type ListItemAction
- type Message
- type MessageBuilder
- func (eb *MessageBuilder[D]) IsTainted() bool
- func (eb *MessageBuilder[D]) MarkAsTainted()
- func (mb *MessageBuilder[D]) SetAnonymous(b bool) *MessageBuilder[D]
- func (mb *MessageBuilder[D]) SetAuthorID(id primitive.ObjectID) *MessageBuilder[D]
- func (mb *MessageBuilder[D]) SetData(data D) *MessageBuilder[D]
- func (mb *MessageBuilder[D]) SetKind(kind MessageKind) *MessageBuilder[D]
- func (mb *MessageBuilder[D]) SetTimestamp(t time.Time) *MessageBuilder[D]
- type MessageData
- type MessageDataEmoteComment
- type MessageDataInbox
- type MessageDataModRequest
- type MessageDataPlaceholder
- type MessageKind
- type MessageRead
- type Object
- type ObjectID
- type ObjectKind
- type Report
- type ReportBuilder
- func (rb *ReportBuilder) AddAssignee(id primitive.ObjectID) *ReportBuilder
- func (rb *ReportBuilder) AddNote(note ReportNote) *ReportBuilder
- func (rb *ReportBuilder) RemoveAssignee(id primitive.ObjectID) *ReportBuilder
- func (rb *ReportBuilder) SetBody(body string) *ReportBuilder
- func (rb *ReportBuilder) SetCreatedAt(t time.Time) *ReportBuilder
- func (rb *ReportBuilder) SetPriority(p int32) *ReportBuilder
- func (rb *ReportBuilder) SetReporterID(id primitive.ObjectID) *ReportBuilder
- func (rb *ReportBuilder) SetStatus(s ReportStatus) *ReportBuilder
- func (rb *ReportBuilder) SetSubject(subject string) *ReportBuilder
- func (rb *ReportBuilder) SetTargetID(id primitive.ObjectID) *ReportBuilder
- func (rb *ReportBuilder) SetTargetKind(kind ObjectKind) *ReportBuilder
- type ReportNote
- type ReportStatus
- type Role
- type RoleBuilder
- func (rb *RoleBuilder) SetAllowed(allowed RolePermission) *RoleBuilder
- func (rb *RoleBuilder) SetColor(color int32) *RoleBuilder
- func (rb *RoleBuilder) SetDenied(denied RolePermission) *RoleBuilder
- func (rb *RoleBuilder) SetName(name string) *RoleBuilder
- func (rb *RoleBuilder) SetPosition(pos int32) *RoleBuilder
- type RolePermission
- type System
- type SystemDefaultObject
- type UpdateMap
- func (u UpdateMap) AddToSet(key string, value UpdateValue) UpdateMap
- func (u UpdateMap) Clear()
- func (u UpdateMap) Pull(key string, value UpdateValue) UpdateMap
- func (u UpdateMap) Push(key string, value UpdateValue) UpdateMap
- func (u UpdateMap) Set(key string, value UpdateValue) UpdateMap
- func (u UpdateMap) UndoSet(key string) UpdateMap
- type UpdateValue
- type User
- type UserBuilder
- func (ub *UserBuilder) AddConnection(conn UserConnection[bson.Raw]) *UserBuilder
- func (ub *UserBuilder) AddEditor(id ObjectID, permissions UserEditorPermission, visible bool) *UserBuilder
- func (ub *UserBuilder) GetConnection(p UserConnectionPlatform, id ...string) *UserConnectionBuilder[bson.Raw]
- func (ub *UserBuilder) Initial() *User
- func (ub *UserBuilder) IsTainted() bool
- func (ub *UserBuilder) MarkAsTainted()
- func (ub *UserBuilder) RemoveEditor(id ObjectID) *UserBuilder
- func (ub *UserBuilder) SetAvatarID(url string) *UserBuilder
- func (ub *UserBuilder) SetDiscriminator(discrim string) *UserBuilder
- func (ub *UserBuilder) SetDisplayName(s string) *UserBuilder
- func (ub *UserBuilder) SetEmail(email string) *UserBuilder
- func (ub *UserBuilder) SetUsername(username string) *UserBuilder
- func (ub *UserBuilder) UpdateEditor(id ObjectID, permissions UserEditorPermission, visible bool) *UserBuilder
- type UserConnection
- type UserConnectionBuilder
- func (ucb *UserConnectionBuilder[D]) SetActiveEmoteSet(id ObjectID) *UserConnectionBuilder[D]
- func (ucb *UserConnectionBuilder[D]) SetData(data D) *UserConnectionBuilder[D]
- func (ucb *UserConnectionBuilder[D]) SetGrant(at string, rt string, ex int, sc []string) *UserConnectionBuilder[D]
- func (ucb *UserConnectionBuilder[D]) SetID(id string) *UserConnectionBuilder[D]
- func (ucb *UserConnectionBuilder[D]) SetLinkedAt(date time.Time) *UserConnectionBuilder[D]
- func (ucb *UserConnectionBuilder[D]) SetPlatform(platform UserConnectionPlatform) *UserConnectionBuilder[D]
- type UserConnectionData
- type UserConnectionDataTwitch
- type UserConnectionDataYoutube
- type UserConnectionGrant
- type UserConnectionList
- type UserConnectionPlatform
- type UserDiscriminator
- type UserEditor
- type UserEditorPermission
- type UserState
- type UserType
Constants ¶
const ( EmoteSetNameLengthLeast int = 48 EmoteSetNameLengthMost int = 3 )
const ( EntitlementKindSubscription = EntitlementKind("SUBSCRIPTION") // Subscription Entitlement EntitlementKindBadge = EntitlementKind("BADGE") // Badge Entitlement EntitlementKindPaint = EntitlementKind("PAINT") // Badge Entitlement EntitlementKindRole = EntitlementKind("ROLE") // Role Entitlement EntitlementKindEmoteSet = EntitlementKind("EMOTE_SET") // Emote Set Entitlement )
const ( RolePermissionAll = RolePermissionCreateEmote | RolePermissionEditEmote | RolePermissionEditEmoteSet | RolePermissionReportCreate | RolePermissionFeatureZeroWidthEmoteType | RolePermissionFeatureProfilePictureAnimation | RolePermissionManageBans | RolePermissionManageRoles | RolePermissionManageReports | RolePermissionEditAnyEmote | RolePermissionEditAnyEmoteSet | RolePermissionSuperAdministrator | RolePermissionManageNews | RolePermissionManageStack | RolePermissionManageCosmetics )
All permissions
Variables ¶
var ( RegExpEmoteName = regexp.MustCompile(`^[-_A-Za-z(!?&)$+:0-9]{2,100}$`) RegExpEmoteVersionName = regexp.MustCompile(`^[A-Za-z0-9\s]{2,40}$`) RegExpEmoteVersionDescription = regexp.MustCompile(`^[-_*=/\\"'\]\[}{@&~!?;:A-Za-z0-9\s]{3,240}$`) )
var ( ErrUnknownEmote error = fmt.Errorf("unknown emote") ErrUnknownUser error = fmt.Errorf("unknown user") ErrInsufficientPrivilege error = fmt.Errorf("insufficient privilege") ErrInternalError error = fmt.Errorf("internal error occured") ErrIncompleteMutation error = fmt.Errorf("the mutation struct was not set up properly") )
var BanEffectMap = map[string]BanEffect{ "NO_PERMISSIONS": BanEffectNoPermissions, "NO_AUTH": BanEffectNoAuth, "NO_OWNERSHIP": BanEffectNoOwnership, "MEMORY_HOLE": BanEffectMemoryHole, "IP_BLOCKED": BanEffectBlockedIP, }
var DeletedEmote = Emote{ ID: primitive.NilObjectID, OwnerID: DeletedUser.ID, Name: "*UnknownEmote", Flags: 0, Tags: []string{}, State: EmoteState{}, Versions: []EmoteVersion{}, ChildrenIDs: []primitive.ObjectID{}, Owner: &DeletedUser, }
var DeletedUser = User{ ID: primitive.NilObjectID, UserType: UserTypeSystem, Username: "*deleted_user", DisplayName: "*DeletedUser", Discriminator: "0000", RoleIDs: []primitive.ObjectID{}, Editors: []UserEditor{}, TokenVersion: 0, Connections: UserConnectionList{}, }
var NilRole = Role{ ID: primitive.NilObjectID, Name: "NULL", Position: 0, }
var RevocationRole = Role{ ID: [12]byte{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 32}, Name: "NORIGHTS", Denied: RolePermissionAll, Position: 0, }
Functions ¶
This section is empty.
Types ¶
type ActiveEmote ¶
type ActiveEmote struct { ID primitive.ObjectID `json:"id" bson:"id"` Name string `json:"name,omitempty" bson:"name,omitempty"` Flags ActiveEmoteFlag `json:"flags" bson:"flags"` Timestamp time.Time `json:"timestamp" bson:"timestamp"` ActorID primitive.ObjectID `json:"actor_id,omitempty" bson:"actor_id,omitempty"` Emote *Emote `json:"emote" bson:"emote,omitempty,skip"` }
type ActiveEmoteFlag ¶
type ActiveEmoteFlag int32
const ( ActiveEmoteFlagZeroWidth ActiveEmoteFlag = 1 << 0 // 1 - Emote is zero-width ActiveEmoteFlagOverrideTwitchGlobal ActiveEmoteFlag = 1 << 16 // 65536 - Overrides Twitch Global emotes with the same name ActiveEmoteFlagOverrideTwitchSubscriber ActiveEmoteFlag = 1 << 17 // 131072 - Overrides Twitch Subscriber emotes with the same name ActiveEmoteFlagOverrideBetterTTV ActiveEmoteFlag = 1 << 18 // 262144 - Overrides BetterTTV emotes with the same name ActiveEmoteFlagOverrideFrankerFaceZ ActiveEmoteFlag = 1 << 19 // 524288 - Overrides FrankerFaceZ emotes with the same name )
type AuditLog ¶
type AuditLog struct { ID primitive.ObjectID `json:"id" bson:"_id,omitempty"` Kind AuditLogKind `json:"kind" bson:"kind"` ActorID primitive.ObjectID `json:"actor_id" bson:"actor_id"` TargetID primitive.ObjectID `json:"target_id" bson:"target_id"` TargetKind ObjectKind `json:"target_kind" bson:"target_kind"` Changes []*AuditLogChange `json:"changes" bson:"changes"` Extra map[string]any `json:"extra,omitempty" bson:"extra,omitempty"` Reason string `json:"reason,omitempty" bson:"reason,omitempty"` }
type AuditLogBuilder ¶
func NewAuditLogBuilder ¶
func NewAuditLogBuilder(log AuditLog) *AuditLogBuilder
NewAuditLogBuilder creates a new Builder utility for an Audit Log
func (*AuditLogBuilder) AddChanges ¶
func (alb *AuditLogBuilder) AddChanges(changes ...*AuditLogChange) *AuditLogBuilder
AddChanges adds one or more changes in the audit log
func (*AuditLogBuilder) SetActor ¶
func (alb *AuditLogBuilder) SetActor(id primitive.ObjectID) *AuditLogBuilder
SetActor defines the ID of the responsible ('actor') user in the audit log
func (*AuditLogBuilder) SetExtra ¶
func (alb *AuditLogBuilder) SetExtra(key string, value interface{}) *AuditLogBuilder
SetExtra defines arbitrary extraneous data that may be helpful in some cases where changes cannot be explained with just old and new values
func (*AuditLogBuilder) SetKind ¶
func (alb *AuditLogBuilder) SetKind(kind AuditLogKind) *AuditLogBuilder
SetKind sets the kind of the audit log
func (*AuditLogBuilder) SetTargetID ¶
func (alb *AuditLogBuilder) SetTargetID(id primitive.ObjectID) *AuditLogBuilder
SetTargetID sets the id of the resource targeted in the audit log
func (*AuditLogBuilder) SetTargetKind ¶
func (alb *AuditLogBuilder) SetTargetKind(kind ObjectKind) *AuditLogBuilder
SetTargetKind sets the object kind of the resource targeted in the audit log
type AuditLogChange ¶
type AuditLogChange struct { Format AuditLogChangeFormat `json:"format" bson:"format"` Key string `json:"key" bson:"key"` Value bson.Raw `json:"value" bson:"value"` }
func NewAuditChange ¶
func NewAuditChange(key string) *AuditLogChange
func (*AuditLogChange) WriteArrayAdded ¶
func (alc *AuditLogChange) WriteArrayAdded(values ...any) *AuditLogChange
func (*AuditLogChange) WriteArrayRemoved ¶
func (alc *AuditLogChange) WriteArrayRemoved(values ...any) *AuditLogChange
func (*AuditLogChange) WriteArrayUpdated ¶
func (alc *AuditLogChange) WriteArrayUpdated(values ...AuditLogChangeSingleValue) *AuditLogChange
func (*AuditLogChange) WriteSingleValues ¶
func (alc *AuditLogChange) WriteSingleValues(old any, new any) *AuditLogChange
type AuditLogChangeArrayChange ¶
type AuditLogChangeArrayChange struct { Added []any `json:"added,omitempty" bson:"added,omitempty"` Removed []any `json:"removed,omitempty" bson:"removed,omitempty"` Updated []AuditLogChangeSingleValue `json:"updated,omitempty" bson:"updated,omitempty"` }
type AuditLogChangeFormat ¶
type AuditLogChangeFormat int8
const ( AuditLogChangeFormatSingleValue AuditLogChangeFormat = 1 AuditLogChangeFormatArrayChange AuditLogChangeFormat = 2 )
type AuditLogKind ¶
type AuditLogKind int8
const ( AuditLogKindCreateEmote AuditLogKind = 1 // emote was created AuditLogKindDeleteEmote AuditLogKind = 2 // emote was deleted AuditLogKindDisableEmote AuditLogKind = 3 // emote was disabled AuditLogKindUpdateEmote AuditLogKind = 4 // emote was updated AuditLogKindMergeEmote AuditLogKind = 5 // emote was merged AuditLogKindUndoDeleteEmote AuditLogKind = 6 // deleted emote was restored AuditLogKindEnableEmote AuditLogKind = 7 // emote was enabled AuditLogKindSignUserToken AuditLogKind = 20 // a user token was signed AuditLogKindSignCSRFToken AuditLogKind = 21 // a CSRF token was signed AuditLogKindRejectedAccess AuditLogKind = 26 // an attempt to access a privileged area was rejected AuditLogKindCreateUser AuditLogKind = 30 // user was created AuditLogKindDeleteUser AuditLogKind = 31 // user was deleted AuditLogKindBanUser AuditLogKind = 32 // user was banned AuditLogKindEditUser AuditLogKind = 33 // user was edited AuditLogKindUnban AuditLogKind = 36 // user was unbanned AuditLogKindAddUserEditor AuditLogKind = 37 // editor added to user AuditLogKindRemoveUserEditor AuditLogKind = 38 // editor removed from user AuditLogKindCreateEmoteSet AuditLogKind = 70 // emote set was created AuditLogKindUpdateEmoteSet AuditLogKind = 71 // emote set was updated AuditLogKindDeleteEmoteSet AuditLogKind = 72 // emote set was deleted )
type Ban ¶
type Ban struct { ID primitive.ObjectID `json:"id" bson:"_id,omitempty"` // The user who is affected by this ban VictimID primitive.ObjectID `json:"victim_id" bson:"victim_id"` // The user who created this ban ActorID primitive.ObjectID `json:"actor_id" bson:"actor_id"` // The reason for the ban Reason string `json:"reason" bson:"reason"` // The time at which the ban will expire ExpireAt time.Time `json:"expire_at" bson:"expire_at"` // The effects that this ban will have Effects BanEffect `json:"effects" bson:"effects"` Victim *User `json:"victim" bson:"victim,skip,omitempty"` Actor *User `json:"actor" bson:"actor,skip,omitempty"` }
type BanBuilder ¶
func NewBanBuilder ¶
func NewBanBuilder(ban Ban) *BanBuilder
NewRoleBuilder: create a new role builder
func (BanBuilder) Initial ¶
func (bb BanBuilder) Initial() Ban
Initial returns a pointer to the value first passed to this Builder
func (BanBuilder) IsTainted ¶
func (bb BanBuilder) IsTainted() bool
IsTainted returns whether or not this Builder has been mutated before
func (*BanBuilder) MarkAsTainted ¶
func (ub *BanBuilder) MarkAsTainted()
MarkAsTainted taints the builder, preventing it from being mutated again
func (*BanBuilder) SetActorID ¶
func (bb *BanBuilder) SetActorID(id primitive.ObjectID) *BanBuilder
func (*BanBuilder) SetEffects ¶
func (bb *BanBuilder) SetEffects(a BanEffect) *BanBuilder
func (*BanBuilder) SetExpireAt ¶
func (bb *BanBuilder) SetExpireAt(t time.Time) *BanBuilder
func (*BanBuilder) SetReason ¶
func (bb *BanBuilder) SetReason(s string) *BanBuilder
func (*BanBuilder) SetVictimID ¶
func (bb *BanBuilder) SetVictimID(id primitive.ObjectID) *BanBuilder
type BanEffect ¶
type BanEffect uint32
const ( // Strip the banned user of all permissions BanEffectNoPermissions BanEffect = 1 << 0 // Prevents the banned user from authenticating BanEffectNoAuth BanEffect = 1 << 1 // Any object owned by the banned user will no longer be returned by the API BanEffectNoOwnership BanEffect = 1 << 2 // The banned user is never returned by the API to non-privileged users BanEffectMemoryHole BanEffect = 1 << 3 // The banned user's IP will be blocked from accessing all services BanEffectBlockedIP BanEffect = 1 << 4 )
type Cosmetic ¶
type Cosmetic[D CosmeticData] struct { ID primitive.ObjectID `json:"id" bson:"_id"` Kind CosmeticKind `json:"kind" bson:"kind"` Priority int `json:"priority" bson:"priority"` Name string `json:"name" bson:"name"` UserIDs []primitive.ObjectID `json:"users" bson:"user_ids"` Users []User `json:"user_objects" bson:"user_objects,skip,omitempty"` Data D `json:"data" bson:"data"` // User Relationals Selected bool `json:"selected" bson:"selected,skip,omitempty"` }
func ConvertCosmetic ¶
type CosmeticData ¶
type CosmeticData interface { bson.Raw | CosmeticDataBadge | CosmeticDataPaint }
type CosmeticDataBadge ¶
type CosmeticDataPaint ¶
type CosmeticDataPaint struct { ID primitive.ObjectID `json:"id" bson:"-"` // The function used to generate the paint (i.e gradients or an image) Function CosmeticPaintFunction `json:"function" bson:"function"` // The default color of the paint Color *int32 `json:"color" bson:"color"` // Gradient stops, a list of positions and colors Stops []CosmeticPaintGradientStop `json:"stops" bson:"stops"` // Whether or not the gradient repeats outside its original area Repeat bool `json:"repeat" bson:"repeat"` // Gradient angle in degrees Angle int32 `json:"angle" bson:"angle"` // Shape of a radial gradient, when the paint is of RADIAL_GRADIENT type Shape string `json:"shape,omitempty" bson:"shape,omitempty"` // URL of an image, when the paint is of BACKGROUND_IMAGE type ImageURL string `json:"image_url,omitempty" bson:"image_url,omitempty"` // A list of drop shadows. There may be any amount, which can be stacked onto each other DropShadows []CosmeticPaintDropShadow `json:"drop_shadows,omitempty" bson:"drop_shadows,omitempty"` }
type CosmeticKind ¶
type CosmeticKind string
const ( CosmeticKindBadge CosmeticKind = "BADGE" CosmeticKindNametagPaint CosmeticKind = "PAINT" )
type CosmeticPaintAnimation ¶
type CosmeticPaintAnimation struct { Speed int32 `json:"speed" bson:"speed"` Keyframes []CosmeticPaintAnimationKeyframe `json:"keyframes" bson:"keyframes"` }
type CosmeticPaintDropShadow ¶
type CosmeticPaintFunction ¶
type CosmeticPaintFunction string
const ( CosmeticPaintFunctionLinearGradient CosmeticPaintFunction = "LINEAR_GRADIENT" CosmeticPaintFunctionRadialGradient CosmeticPaintFunction = "RADIAL_GRADIENT" CosmeticPaintFunctionImageURL CosmeticPaintFunction = "URL" )
type Emote ¶
type Emote struct { ID ObjectID `json:"id" bson:"_id"` OwnerID ObjectID `json:"owner_id" bson:"owner_id"` Name string `json:"name" bson:"name"` Flags EmoteFlag `json:"flags" bson:"flags"` Tags []string `json:"tags" bson:"tags"` State EmoteState `json:"state" bson:"state"` Versions []EmoteVersion `json:"versions,omitempty" bson:"versions,omitempty"` ChildrenIDs []primitive.ObjectID `json:"children_ids,omitempty" bson:"children_ids,omitempty"` ParentID *primitive.ObjectID `json:"parent_id,omitempty" bson:"parent_id,omitempty"` Owner *User `json:"owner" bson:"owner_user,skip,omitempty"` Channels []User `json:"channels" bson:"channels,skip,omitempty"` }
func (Emote) GetLatestVersion ¶
func (e Emote) GetLatestVersion(onlyListed bool) EmoteVersion
func (Emote) GetVersion ¶
func (e Emote) GetVersion(id ObjectID) (EmoteVersion, int)
func (*Emote) Validator ¶
func (e *Emote) Validator() EmoteValidator
type EmoteBuilder ¶
EmoteBuilder Wraps an Emote and offers methods to fetch and mutate emote data
func NewEmoteBuilder ¶
func NewEmoteBuilder(emote Emote) *EmoteBuilder
NewEmoteBuilder: create a new emote builder
func (*EmoteBuilder) AddVersion ¶
func (eb *EmoteBuilder) AddVersion(v EmoteVersion) *EmoteBuilder
func (*EmoteBuilder) Initial ¶
func (eb *EmoteBuilder) Initial() Emote
Initial returns a pointer to the value first passed to this Builder
func (*EmoteBuilder) InitialVersions ¶
func (eb *EmoteBuilder) InitialVersions() []*EmoteVersion
func (*EmoteBuilder) IsTainted ¶
func (eb *EmoteBuilder) IsTainted() bool
IsTainted returns whether or not this Builder has been mutated before
func (*EmoteBuilder) MarkAsTainted ¶
func (eb *EmoteBuilder) MarkAsTainted()
MarkAsTainted taints the builder, preventing it from being mutated again
func (*EmoteBuilder) RemoveVersion ¶
func (eb *EmoteBuilder) RemoveVersion(id ObjectID) *EmoteBuilder
func (*EmoteBuilder) SetFlags ¶
func (eb *EmoteBuilder) SetFlags(sum EmoteFlag) *EmoteBuilder
func (*EmoteBuilder) SetName ¶
func (eb *EmoteBuilder) SetName(name string) *EmoteBuilder
SetName: change the name of the emote
func (*EmoteBuilder) SetOwnerID ¶
func (eb *EmoteBuilder) SetOwnerID(id primitive.ObjectID) *EmoteBuilder
func (*EmoteBuilder) SetTags ¶
func (eb *EmoteBuilder) SetTags(tags []string, validate bool) *EmoteBuilder
func (*EmoteBuilder) UpdateVersion ¶
func (eb *EmoteBuilder) UpdateVersion(id ObjectID, v EmoteVersion) *EmoteBuilder
type EmoteFile ¶
type EmoteFile struct { Name string `json:"n" bson:"name"` // The name of the file Width int32 `json:"w" bson:"width"` // The pixel width of the emote Height int32 `json:"h" bson:"height"` // The pixel height of the emote Animated bool `json:"a" bson:"animated"` // Whether or not this file is animated ProcessingTime int64 `json:"-" bson:"time"` // The amount of time in nanoseconds it took for this file to be processed Length int64 `json:"b" bson:"length"` // The file size in bytes // contains filtered or unexported fields }
func (EmoteFile) Format ¶
func (ef EmoteFile) Format() EmoteFormatName
type EmoteFlag ¶
type EmoteFlag int32
const ( EmoteFlagsPrivate EmoteFlag = 1 << 0 // The emote is private and can only be accessed by its owner, editors and moderators EmoteFlagsAuthentic EmoteFlag = 1 << 1 // The emote was verified to be an original creation by the uploader EmoteFlagsZeroWidth EmoteFlag = 1 << 8 // The emote is recommended to be enabled as Zero-Width EmoteFlagsContentSexual EmoteFlag = 1 << 16 // Sexually Suggesive EmoteFlagsContentEpilepsy EmoteFlag = 1 << 17 // Rapid flashing EmoteFlagsContentEdgy EmoteFlag = 1 << 18 // Edgy or distasteful, may be offensive to some users EmoteFlagsContentTwitchDisallowed EmoteFlag = 1 << 24 // Not allowed specifically on the Twitch platform )
type EmoteFormat ¶
type EmoteFormat struct { Name EmoteFormatName `json:"name" bson:"name"` Files []EmoteFile `json:"files" bson:"files"` }
type EmoteFormatName ¶
type EmoteFormatName string
const ( EmoteFormatNameWEBP EmoteFormatName = "image/webp" EmoteFormatNameAVIF EmoteFormatName = "image/avif" EmoteFormatNameGIF EmoteFormatName = "image/gif" EmoteFormatNamePNG EmoteFormatName = "image/png" )
type EmoteLifecycle ¶
type EmoteLifecycle int32
const ( EmoteLifecycleDeleted EmoteLifecycle = iota - 1 EmoteLifecyclePending EmoteLifecycleProcessing EmoteLifecycleDisabled EmoteLifecycleLive EmoteLifecycleFailed EmoteLifecycle = -2 )
type EmoteSet ¶
type EmoteSet struct { ID primitive.ObjectID `json:"-" bson:"_id,omitempty"` // The emote set's name Name string `json:"name" bson:"name"` // Search tags for the emote set Tags []string `json:"tags,omitempty" bson:"tags,omitempty"` // Whether or not the emote set can be edited Immutable bool `json:"immutable" bson:"immutable"` // If true, the set is "privileged" and can only be modified by its owner or a super administrator, regardless of the "Edit Any Emote Set" permission Privileged bool `json:"privilleged" bson:"privileged"` // The emotes assigned to this set Emotes []ActiveEmote `json:"emotes" bson:"emotes"` // The maximum amount of emotes this set is allowed to contain EmoteSlots int32 `json:"emote_slots" bson:"emote_slots"` // The ID of the parent set. If defined, this set is treated as a child set // and its emotes are derived from the parent ParentID *ObjectID `json:"parent_id,omitempty" bson:"parent_id,omitempty"` // The ID of the user who owns this emote set OwnerID ObjectID `json:"owner_id" bson:"owner_id"` Owner *User `json:"owner,omitempty" bson:"owner_user,skip,omitempty"` }
type EmoteSetBuilder ¶
type EmoteSetBuilder struct { Update UpdateMap EmoteSet EmoteSet // contains filtered or unexported fields }
func NewEmoteSetBuilder ¶
func NewEmoteSetBuilder(emoteSet EmoteSet) *EmoteSetBuilder
func (*EmoteSetBuilder) AddActiveEmote ¶
func (esb *EmoteSetBuilder) AddActiveEmote(id ObjectID, alias string, at time.Time, actorID *primitive.ObjectID) *EmoteSetBuilder
func (*EmoteSetBuilder) Initial ¶
func (esb *EmoteSetBuilder) Initial() *EmoteSet
Initial returns a pointer to the value first passed to this Builder
func (*EmoteSetBuilder) IsTainted ¶
func (esb *EmoteSetBuilder) IsTainted() bool
IsTainted returns whether or not this Builder has been mutated before
func (*EmoteSetBuilder) MarkAsTainted ¶
func (esb *EmoteSetBuilder) MarkAsTainted()
MarkAsTainted taints the builder, preventing it from being mutated again
func (*EmoteSetBuilder) RemoveActiveEmote ¶
func (esb *EmoteSetBuilder) RemoveActiveEmote(id ObjectID) *EmoteSetBuilder
func (*EmoteSetBuilder) SetEmoteSlots ¶
func (esb *EmoteSetBuilder) SetEmoteSlots(slots int32) *EmoteSetBuilder
func (*EmoteSetBuilder) SetImmutable ¶
func (esb *EmoteSetBuilder) SetImmutable(b bool) *EmoteSetBuilder
func (*EmoteSetBuilder) SetName ¶
func (esb *EmoteSetBuilder) SetName(name string) *EmoteSetBuilder
func (*EmoteSetBuilder) SetOwnerID ¶
func (esb *EmoteSetBuilder) SetOwnerID(id ObjectID) *EmoteSetBuilder
func (*EmoteSetBuilder) SetParentID ¶
func (esb *EmoteSetBuilder) SetParentID(id *ObjectID) *EmoteSetBuilder
func (*EmoteSetBuilder) SetPrivileged ¶
func (esb *EmoteSetBuilder) SetPrivileged(b bool) *EmoteSetBuilder
func (*EmoteSetBuilder) SetTags ¶
func (esb *EmoteSetBuilder) SetTags(tags []string) *EmoteSetBuilder
func (*EmoteSetBuilder) UpdateActiveEmote ¶
func (esb *EmoteSetBuilder) UpdateActiveEmote(id ObjectID, alias string) *EmoteSetBuilder
type EmoteState ¶
type EmoteValidator ¶
type EmoteValidator struct {
// contains filtered or unexported fields
}
func (EmoteValidator) Name ¶
func (x EmoteValidator) Name() error
type EmoteVersion ¶
type EmoteVersion struct { ID primitive.ObjectID `json:"id" bson:"id"` Name string `json:"name,omitempty" bson:"name,omitempty"` Description string `json:"description,omitempty" bson:"description,omitempty"` Timestamp time.Time `json:"timestamp" bson:"timestamp"` State EmoteVersionState `json:"state" bson:"state"` FrameCount int32 `json:"frame_count" bson:"frame_count"` Formats []EmoteFormat `json:"formats,omitempty" bson:"formats,omitempty"` }
func (EmoteVersion) CountFiles ¶
func (ev EmoteVersion) CountFiles(format EmoteFormatName, omitStatic bool) int32
func (EmoteVersion) GetFiles ¶
func (ev EmoteVersion) GetFiles(format EmoteFormatName, omitStatic bool) []EmoteFile
func (EmoteVersion) IsProcessing ¶
func (ev EmoteVersion) IsProcessing() bool
func (EmoteVersion) IsUnavailable ¶
func (ev EmoteVersion) IsUnavailable() bool
func (*EmoteVersion) Validator ¶
func (e *EmoteVersion) Validator() EmoteVersionValidator
type EmoteVersionState ¶
type EmoteVersionState struct { // The current life cycle of the emote // indicating whether it's processing, live, deleted, etc. Lifecycle EmoteLifecycle `json:"lifecycle" bson:"lifecycle"` // Whether or not the emote is listed Listed bool `json:"listed" bson:"listed"` // The ranked position for the amount of channels this emote is added on to. // This value is to be determined with an external cron job ChannelCountRank int32 `json:"-" bson:"channel_count_rank,omitempty"` // The amount of channels this emote is added on to. // This value is to be determined with an external cron job ChannelCount int32 `json:"-" bson:"channel_count,omitempty"` // The time at which the ChannelCount value was last checked ChannelCountCheckAt time.Time `json:"-" bson:"channel_count_check_at,omitempty"` }
type EmoteVersionValidator ¶
type EmoteVersionValidator struct {
// contains filtered or unexported fields
}
func (EmoteVersionValidator) Description ¶
func (x EmoteVersionValidator) Description() error
func (EmoteVersionValidator) Name ¶
func (x EmoteVersionValidator) Name() error
type Entitlement ¶
type Entitlement[D EntitlementData] struct { ID primitive.ObjectID `json:"id" bson:"_id,omitempty"` // Kind represents what item this entitlement grants Kind EntitlementKind `json:"kind" bson:"kind"` // Data referencing the entitled item Data D `json:"data" bson:"data"` // The user who is entitled to the item UserID primitive.ObjectID `json:"user_id" bson:"user_id"` // Eligibility conditions for this entitlement Condition EntitlementCondition `json:"condition,omitempty" bson:"condition,omitempty"` // Whether this entitlement is currently inactive Disabled bool `json:"disabled,omitempty" bson:"disabled,omitempty"` // Information about the app that created this entitlement App *EntitlementApp `json:"app,omitempty" bson:"app,omitempty"` }
Entitlement is a binding between a resource and a user It grants the user access to the bound resource and may define some additional properties on top.
func ConvertEntitlement ¶
func ConvertEntitlement[D EntitlementData](c Entitlement[bson.Raw]) (Entitlement[D], error)
func (Entitlement[D]) ToRaw ¶
func (e Entitlement[D]) ToRaw() Entitlement[bson.Raw]
type EntitlementApp ¶
type EntitlementBuilder ¶
type EntitlementBuilder[D EntitlementData] struct { Entitlement Entitlement[D] User *User // contains filtered or unexported fields }
func NewEntitlementBuilder ¶
func NewEntitlementBuilder[D EntitlementData](ent Entitlement[D]) *EntitlementBuilder[D]
func (*EntitlementBuilder[D]) SetApp ¶
func (b *EntitlementBuilder[D]) SetApp(app EntitlementApp) *EntitlementBuilder[D]
func (*EntitlementBuilder[D]) SetCondition ¶
func (b *EntitlementBuilder[D]) SetCondition(cond EntitlementCondition) *EntitlementBuilder[D]
func (*EntitlementBuilder[D]) SetData ¶
func (b *EntitlementBuilder[D]) SetData(data D) *EntitlementBuilder[D]
SetSubscriptionData: Add a subscription reference to the entitlement
func (*EntitlementBuilder[D]) SetKind ¶
func (b *EntitlementBuilder[D]) SetKind(kind EntitlementKind) *EntitlementBuilder[D]
SetKind: Change the entitlement's kind
func (*EntitlementBuilder[D]) SetUserID ¶
func (b *EntitlementBuilder[D]) SetUserID(id primitive.ObjectID) *EntitlementBuilder[D]
SetUserID: Change the entitlement's assigned user
type EntitlementCondition ¶
type EntitlementCondition struct { AnyRoles []primitive.ObjectID `json:"any_roles,omitempty" bson:"any_roles,omitempty"` AllRoles []primitive.ObjectID `json:"all_roles,omitempty" bson:"all_roles,omitempty"` MinDate time.Time `json:"min_date,omitempty" bson:"min_date,omitempty"` MaxDate time.Time `json:"max_date,omitempty" bson:"max_date,omitempty"` }
type EntitlementData ¶
type EntitlementData interface { bson.Raw | EntitlementDataBase | EntitlementDataSubscription | EntitlementDataBadge | EntitlementDataPaint | EntitlementDataRole | EntitlementDataEmoteSet }
type EntitlementDataBadge ¶
type EntitlementDataBadge struct { ObjectReference primitive.ObjectID `json:"-" bson:"ref"` // DEPRECATED: use Entitlement.Condition RoleBinding *primitive.ObjectID `json:"role_binding,omitempty" bson:"role_binding,omitempty"` Selected bool `json:"selected,omitempty" bson:"selected,omitempty"` }
EntitledBadge Badge binding in an Entitlement
type EntitlementDataBase ¶
type EntitlementDataEmoteSet ¶
EntitledEmoteSet Emote Set binding in an Entitlement
type EntitlementDataPaint ¶
type EntitlementDataRole ¶
EntitledRole Role binding in an Entitlement
type EntitlementDataSubscription ¶
type EntitlementDataSubscription struct { // The ID of the subscription ObjectReference primitive.ObjectID `json:"-" bson:"ref"` }
EntitledSubscription Subscription binding in an Entitlement
type EntitlementKind ¶
type EntitlementKind string
EntitlementKind A string representing a kind of entitlement
type ListItemAction ¶
type ListItemAction string
const ( ListItemActionAdd ListItemAction = "ADD" ListItemActionUpdate ListItemAction = "UPDATE" ListItemActionRemove ListItemAction = "REMOVE" )
type Message ¶
type Message[D MessageData] struct { ID primitive.ObjectID `json:"id" bson:"_id,omitempty"` // The kind of message this is (i.e a comment, or inbox message) Kind MessageKind `json:"kind" bson:"kind"` // The ID of the user who created this message AuthorID primitive.ObjectID `json:"author_id" bson:"author_id,omitempty"` // Whether or not the message's author will not be displayed to unprivileged end users Anonymous bool `json:"anonymous,omitempty" bson:"anonymous,omitempty"` // The date on which this message was cretaed CreatedAt time.Time `json:"created_at" bson:"created_at"` // Message data Data D `json:"data" bson:"data"` Author *User `json:"author,omitempty" bson:"author,skip,omitempty"` Read bool `json:"read,omitempty" bson:"read,omitempty"` }
func ConvertMessage ¶
type MessageBuilder ¶
type MessageBuilder[D MessageData] struct { Message Message[D] Update UpdateMap // contains filtered or unexported fields }
func NewMessageBuilder ¶
func NewMessageBuilder[D MessageData](msg Message[D]) *MessageBuilder[D]
func (*MessageBuilder[D]) IsTainted ¶
func (eb *MessageBuilder[D]) IsTainted() bool
IsTainted returns whether or not this Builder has been mutated before
func (*MessageBuilder[D]) MarkAsTainted ¶
func (eb *MessageBuilder[D]) MarkAsTainted()
MarkAsTainted taints the builder, preventing it from being mutated again
func (*MessageBuilder[D]) SetAnonymous ¶
func (mb *MessageBuilder[D]) SetAnonymous(b bool) *MessageBuilder[D]
func (*MessageBuilder[D]) SetAuthorID ¶
func (mb *MessageBuilder[D]) SetAuthorID(id primitive.ObjectID) *MessageBuilder[D]
func (*MessageBuilder[D]) SetData ¶
func (mb *MessageBuilder[D]) SetData(data D) *MessageBuilder[D]
func (*MessageBuilder[D]) SetKind ¶
func (mb *MessageBuilder[D]) SetKind(kind MessageKind) *MessageBuilder[D]
func (*MessageBuilder[D]) SetTimestamp ¶
func (mb *MessageBuilder[D]) SetTimestamp(t time.Time) *MessageBuilder[D]
type MessageData ¶
type MessageData interface { bson.Raw | MessageDataEmoteComment | MessageDataInbox | MessageDataPlaceholder | MessageDataModRequest }
type MessageDataEmoteComment ¶
type MessageDataEmoteComment struct { EmoteID primitive.ObjectID `json:"emote_id" bson:"emote_id"` // Whether or not the comment is an official statement // i.e, a warning by a moderator Authoritative bool `json:"authoritative,omitempty" bson:"authoritative,omitempty"` // Whether or not the comment is pinned. // Pinned comments will always appear at the top Pinned bool `json:"pinned,omitempty" bson:"pinned,omitempty"` // The comment's text contents Content string `json:"content" bson:"content"` }
type MessageDataInbox ¶
type MessageDataInbox struct { Subject string `json:"subject" bson:"subject"` // the message's subject Content string `json:"content" bson:"content"` // the content of the message Important bool `json:"important,omitempty" bson:"important,omitempty"` // whether or not the message is important Starred bool `json:"starred,omitempty" bson:"starred,omitempty"` // whether or not the message is started Pinned bool `json:"pinned,omitempty" bson:"pinned,omitempty"` // whether or not the message is pinned Locked bool `json:"locked,omitempty" bson:"locked,omitempty"` // whether or not replies can be added to this message Locale bool `json:"locale,omitempty" bson:"locale,omitempty"` // whether or not this message can use locale strings System bool `json:"system,omitempty" bson:"system,omitempty"` // whether or not the message is a system message Placeholders map[string]string `json:"placeholders,omitempty" bson:"placeholders,omitempty"` // placeholders for localization }
type MessageDataModRequest ¶
type MessageDataModRequest struct { TargetKind ObjectKind `json:"target_kind" bson:"target_kind"` TargetID primitive.ObjectID `json:"target_id" bson:"target_id"` }
type MessageDataPlaceholder ¶
type MessageKind ¶
type MessageKind int8
const ( MessageKindEmoteComment MessageKind = 1 // a comment MessageKindModRequest MessageKind = 2 // a moderator action request MessageKindInbox MessageKind = 3 // an inbox message MessageKindNews MessageKind = 4 // a news post )
func (MessageKind) String ¶
func (k MessageKind) String() string
type MessageRead ¶
type MessageRead struct { ID primitive.ObjectID `json:"id" bson:"_id,omitempty"` Kind MessageKind `json:"kind" bson:"kind"` Timestamp time.Time `json:"timestamp" bson:"timestamp"` MessageID primitive.ObjectID `json:"message_id" bson:"message_id"` RecipientID primitive.ObjectID `json:"recipient_id,omitempty" bson:"recipient_id,omitempty"` Read bool `json:"read" bson:"read"` ReadAt time.Time `json:"read_at,omitempty" bson:"read_at,omitempty"` }
MessageRead read/unread state for a message
type ObjectKind ¶
type ObjectKind int8
const ( ObjectKindUser ObjectKind = 1 ObjectKindEmote ObjectKind = 2 ObjectKindEmoteSet ObjectKind = 3 ObjectKindRole ObjectKind = 4 ObjectKindEntitlement ObjectKind = 5 ObjectKindBan ObjectKind = 6 ObjectKindMessage ObjectKind = 7 ObjectKindReport ObjectKind = 8 )
func (ObjectKind) CollectionName ¶
func (k ObjectKind) CollectionName() string
type Report ¶
type Report struct { ID primitive.ObjectID `json:"id" bson:"_id"` // The type of the target TargetKind ObjectKind `json:"target_kind" bson:"target_kind"` // The ID of the target TargetID primitive.ObjectID `json:"target_id" bson:"target_id"` // The ID of the user who created the report ReporterID primitive.ObjectID `json:"reporter_id" bson:"reporter_id"` // The report subject (i.e "Stolen Emote") Subject string `json:"subject" bson:"subject"` // The report body (a user-generated text field with details) Body string `json:"body" bson:"body"` // Priority of the report Priority int32 `json:"priority" bson:"priority"` // Whether or not the report is open Status ReportStatus `json:"status" bson:"status"` // The date on which the report was created CreatedAt time.Time `json:"created_at" bson:"created_at"` // The IDs of users assigned to this report AssigneeIDs []primitive.ObjectID `json:"assignee_ids" bson:"assignee_ids"` // Notes (moderator comments) Notes []ReportNote `json:"notes" bson:"notes"` Target *User `json:"target" bson:"target,skip,omitempty"` Reporter *User `json:"reporter" bson:"reporter,skip,omitempty"` Assignees []User `json:"assignees" bson:"assignees,skip,omitempty"` }
type ReportBuilder ¶
func NewReportBuilder ¶
func NewReportBuilder(report Report) *ReportBuilder
NewReportBuilder: create a new report builder
func (*ReportBuilder) AddAssignee ¶
func (rb *ReportBuilder) AddAssignee(id primitive.ObjectID) *ReportBuilder
func (*ReportBuilder) AddNote ¶
func (rb *ReportBuilder) AddNote(note ReportNote) *ReportBuilder
func (*ReportBuilder) RemoveAssignee ¶
func (rb *ReportBuilder) RemoveAssignee(id primitive.ObjectID) *ReportBuilder
func (*ReportBuilder) SetBody ¶
func (rb *ReportBuilder) SetBody(body string) *ReportBuilder
func (*ReportBuilder) SetCreatedAt ¶
func (rb *ReportBuilder) SetCreatedAt(t time.Time) *ReportBuilder
func (*ReportBuilder) SetPriority ¶
func (rb *ReportBuilder) SetPriority(p int32) *ReportBuilder
func (*ReportBuilder) SetReporterID ¶
func (rb *ReportBuilder) SetReporterID(id primitive.ObjectID) *ReportBuilder
func (*ReportBuilder) SetStatus ¶
func (rb *ReportBuilder) SetStatus(s ReportStatus) *ReportBuilder
func (*ReportBuilder) SetSubject ¶
func (rb *ReportBuilder) SetSubject(subject string) *ReportBuilder
func (*ReportBuilder) SetTargetID ¶
func (rb *ReportBuilder) SetTargetID(id primitive.ObjectID) *ReportBuilder
func (*ReportBuilder) SetTargetKind ¶
func (rb *ReportBuilder) SetTargetKind(kind ObjectKind) *ReportBuilder
type ReportNote ¶
type ReportNote struct { // The time at which the note was created Timestamp time.Time `json:"timestamp" bson:"timestamp"` // The ID of the user who wrote this note AuthorID primitive.ObjectID `json:"author_id" bson:"author_id"` // The text content of the note Content string `json:"content" bson:"content"` // If true, the note is only visible to other privileged users // it will not be visible to the reporter Internal bool `json:"internal" bson:"internal"` // Whether or not the note was read by the reporter Read bool `json:"read" bson:"read"` // A reply to the note by the reporter Reply string `json:"reply" bson:"reply"` }
type ReportStatus ¶
type ReportStatus string
const ( ReportStatusOpen ReportStatus = "OPEN" ReportStatusAssigned ReportStatus = "ASSIGNED" ReportStatusClosed ReportStatus = "CLOSED" )
type Role ¶
type Role struct { ID primitive.ObjectID `json:"id" bson:"_id"` // the role's name Name string `json:"name" bson:"name"` // the role's privilege position Position int32 `json:"position" bson:"position"` // the role's display color Color int32 `json:"color" bson:"color"` // the role's allowed permission bits Allowed RolePermission `json:"allowed" bson:"allowed"` // the role's denied permission bits Denied RolePermission `json:"denied" bson:"denied"` // whether or not this role is the default role Default bool `json:"default" bson:"default,omitempty"` // whether or not the role Invisible bool `json:"invisible" bson:"invisible,omitempty"` }
func (Role) HasPermissionBit ¶
func (r Role) HasPermissionBit(bit RolePermission) bool
HasPermissionBit: Check for specific bit in the role's allowed permissions
type RoleBuilder ¶
func NewRoleBuilder ¶
func NewRoleBuilder(role Role) *RoleBuilder
NewRoleBuilder: create a new role builder
func (*RoleBuilder) SetAllowed ¶
func (rb *RoleBuilder) SetAllowed(allowed RolePermission) *RoleBuilder
func (*RoleBuilder) SetColor ¶
func (rb *RoleBuilder) SetColor(color int32) *RoleBuilder
func (*RoleBuilder) SetDenied ¶
func (rb *RoleBuilder) SetDenied(denied RolePermission) *RoleBuilder
func (*RoleBuilder) SetName ¶
func (rb *RoleBuilder) SetName(name string) *RoleBuilder
func (*RoleBuilder) SetPosition ¶
func (rb *RoleBuilder) SetPosition(pos int32) *RoleBuilder
type RolePermission ¶
type RolePermission int64
RolePermission Role permission bits
const ( RolePermissionCreateEmote RolePermission = 1 << 0 // 1 - Allows creating emotes RolePermissionEditEmote RolePermission = 1 << 1 // 2 - Allows editing emotes RolePermissionCreateEmoteSet RolePermission = 1 << 2 // 4 - Allows creating emote sets RolePermissionEditEmoteSet RolePermission = 1 << 3 // 8 - Allows creating and modifying emote sets )
Emotes Range: 1 << 0 - 1 << 5
const ( RolePermissionReportCreate RolePermission = 1 << 13 // 8192 - Allows creating reports RolePermissionSendMessages RolePermission = 1 << 14 // 16384 - Allows sending messages (i.e comments or user inboxs) RolePermissionFeatureZeroWidthEmoteType RolePermission = 1 << 23 // 8388608 - Allows using the Zero-Width emote type RolePermissionFeatureProfilePictureAnimation RolePermission = 1 << 24 // 16777216 - Allows the user's profile picture to be animated )
User / Misc / Special Range: 1 << 13 - 1 << 1 << 29
const ( RolePermissionManageBans RolePermission = 1 << 30 // 1073741824 - (Mod) Allows creating or deleting bans RolePermissionManageRoles RolePermission = 1 << 31 // 2147483648 - (Mod) Allows creating, deleting and assigning roles to users RolePermissionManageReports RolePermission = 1 << 32 // 4294967296 - (Mod) Allows managing reports RolePermissionManageUsers RolePermission = 1 << 33 // 8589934592 - (Mod) Allows managing users RolePermissionEditAnyEmote RolePermission = 1 << 41 // 2199023255552 - (Mod) Allows editing any emote RolePermissionEditAnyEmoteSet RolePermission = 1 << 42 // 4398046511104 - (Mod) Allows editing any emote set, unless it is a privileged set RolePermissionBypassPrivacy RolePermission = 1 << 48 // 281474976710656 - (Mod) Lets the user see all non-public content )
Moderation Range: 1 << 30 - 1 << 53
const ( RolePermissionSuperAdministrator RolePermission = 1 << 62 // 4611686018427387904 - (Admin) GRANTS EVERY PERMISSION /!\ RolePermissionManageNews RolePermission = 1 << 54 // 18014398509481984 - (Admin) Allows creating and editing news RolePermissionManageStack RolePermission = 1 << 55 // 36028797018963968 - (Admin) Allows managing the application stack RolePermissionManageCosmetics RolePermission = 1 << 56 // 72057594037927936 - (Admin) Allows managing user cosmetics )
Administration Range: 1 << 54 - 1 << 63
type SystemDefaultObject ¶
type UpdateValue ¶
type UpdateValue interface{}
type User ¶
type User struct { ID ObjectID `json:"id,omitempty" bson:"_id,omitempty"` // the type of this user. empty when a regular user, but could also be "BOT" or "SYSTEM" UserType UserType `json:"type,omitempty" bson:"type,omitempty"` // the user's username Username string `json:"username" bson:"username"` // the user's display name DisplayName string `json:"display_name" bson:"display_name"` // the user's discriminatory space Discriminator string `json:"discriminator" bson:"discriminator"` // the user's email Email string `json:"email" bson:"email"` // list of role IDs directly bound to the user (not via an entitlement) RoleIDs []ObjectID `json:"role_ids" bson:"role_ids"` // the user's editors Editors []UserEditor `json:"editors" bson:"editors"` // the user's avatar URL AvatarID string `json:"avatar_id" bson:"avatar_id"` // the user's biography Biography string `json:"biography" bson:"biography"` // token version. When this value changes all existing auth tokens are invalidated TokenVersion float64 `json:"token_version" bson:"token_version"` // third party connections. Who's the third party now? Connections UserConnectionList `json:"connections" bson:"connections"` // the ID of users who have been blocked by the user BlockedUserIDs []ObjectID `json:"blocked_user_ids,omitempty" bson:"blocked_user_ids,omitempty"` // persisted non-structural data that can be used internally for querying State UserState `json:"-" bson:"state"` Emotes []Emote `json:"emotes" bson:"emotes,skip,omitempty"` OwnedEmotes []Emote `json:"owned_emotes" bson:"owned_emotes,skip,omitempty"` Bans []Ban `json:"bans" bson:"bans,skip,omitempty"` Entitlements []Entitlement[bson.Raw] `json:"entitlements" bson:"entitlements,skip,omitempty"` Roles []Role `json:"roles" bson:"roles,skip,omitempty"` EditorOf []UserEditor `json:"editor_of" bson:"editor_of,skip,omitempty"` AvatarURL string `json:"avatar_url" bson:"-"` }
User A standard app user object
func (*User) FinalPermission ¶
func (u *User) FinalPermission() (total RolePermission)
func (*User) GetHighestRole ¶
func (*User) HasPermission ¶
func (u *User) HasPermission(bit RolePermission) bool
HasPermission checks relational roles against a permission bit
type UserBuilder ¶
func NewUserBuilder ¶
func NewUserBuilder(user User) *UserBuilder
NewUserBuilder: create a new user builder
func (*UserBuilder) AddConnection ¶
func (ub *UserBuilder) AddConnection(conn UserConnection[bson.Raw]) *UserBuilder
func (*UserBuilder) AddEditor ¶
func (ub *UserBuilder) AddEditor(id ObjectID, permissions UserEditorPermission, visible bool) *UserBuilder
func (*UserBuilder) GetConnection ¶
func (ub *UserBuilder) GetConnection(p UserConnectionPlatform, id ...string) *UserConnectionBuilder[bson.Raw]
func (*UserBuilder) Initial ¶
func (ub *UserBuilder) Initial() *User
Initial returns a pointer to the value first passed to this Builder
func (*UserBuilder) IsTainted ¶
func (ub *UserBuilder) IsTainted() bool
IsTainted returns whether or not this Builder has been mutated before
func (*UserBuilder) MarkAsTainted ¶
func (ub *UserBuilder) MarkAsTainted()
MarkAsTainted taints the builder, preventing it from being mutated again
func (*UserBuilder) RemoveEditor ¶
func (ub *UserBuilder) RemoveEditor(id ObjectID) *UserBuilder
func (*UserBuilder) SetAvatarID ¶
func (ub *UserBuilder) SetAvatarID(url string) *UserBuilder
func (*UserBuilder) SetDiscriminator ¶
func (ub *UserBuilder) SetDiscriminator(discrim string) *UserBuilder
func (*UserBuilder) SetDisplayName ¶
func (ub *UserBuilder) SetDisplayName(s string) *UserBuilder
func (*UserBuilder) SetEmail ¶
func (ub *UserBuilder) SetEmail(email string) *UserBuilder
SetEmail: set the email for the user
func (*UserBuilder) SetUsername ¶
func (ub *UserBuilder) SetUsername(username string) *UserBuilder
SetUsername: set the username for the user
func (*UserBuilder) UpdateEditor ¶
func (ub *UserBuilder) UpdateEditor(id ObjectID, permissions UserEditorPermission, visible bool) *UserBuilder
type UserConnection ¶
type UserConnection[D UserConnectionData] struct { ID string `json:"id,omitempty" bson:"id,omitempty"` // the platform of this connection Platform UserConnectionPlatform `json:"platform" bson:"platform"` // the time at which this connection was linked LinkedAt time.Time `json:"linked_at" bson:"linked_at"` // the maximum amount of emotes this connection may have have enabled, counting the total from active sets EmoteSlots int32 `json:"emote_slots,omitempty" bson:"emote_slots,omitempty"` // emote sets bound to this connection / channel EmoteSetID ObjectID `json:"emote_set_id,omitempty" bson:"emote_set_id,omitempty"` // third-party connection data Data D `json:"data" bson:"data"` // a full oauth2 token grant Grant *UserConnectionGrant `json:"-" bson:"grant,omitempty"` EmoteSet *EmoteSet `json:"emote_set" bson:"emote_set,skip,omitempty"` }
UserConnection: Represents an external connection to a platform for a user
func ConvertUserConnection ¶
func ConvertUserConnection[D UserConnectionData](c UserConnection[bson.Raw]) (UserConnection[D], error)
func (UserConnection[D]) ToRaw ¶
func (u UserConnection[D]) ToRaw() UserConnection[bson.Raw]
type UserConnectionBuilder ¶
type UserConnectionBuilder[D UserConnectionData] struct { Update UpdateMap UserConnection UserConnection[D] }
UserConnectionBuilder: utility for creating a new UserConnection
func NewUserConnectionBuilder ¶
func NewUserConnectionBuilder[D UserConnectionData](v UserConnection[D]) *UserConnectionBuilder[D]
NewUserConnectionBuilder: create a new user connection builder
func (*UserConnectionBuilder[D]) SetActiveEmoteSet ¶
func (ucb *UserConnectionBuilder[D]) SetActiveEmoteSet(id ObjectID) *UserConnectionBuilder[D]
func (*UserConnectionBuilder[D]) SetData ¶
func (ucb *UserConnectionBuilder[D]) SetData(data D) *UserConnectionBuilder[D]
func (*UserConnectionBuilder[D]) SetGrant ¶
func (ucb *UserConnectionBuilder[D]) SetGrant(at string, rt string, ex int, sc []string) *UserConnectionBuilder[D]
func (*UserConnectionBuilder[D]) SetID ¶
func (ucb *UserConnectionBuilder[D]) SetID(id string) *UserConnectionBuilder[D]
func (*UserConnectionBuilder[D]) SetLinkedAt ¶
func (ucb *UserConnectionBuilder[D]) SetLinkedAt(date time.Time) *UserConnectionBuilder[D]
SetLinkedAt: set the time at which the connection was linked
func (*UserConnectionBuilder[D]) SetPlatform ¶
func (ucb *UserConnectionBuilder[D]) SetPlatform(platform UserConnectionPlatform) *UserConnectionBuilder[D]
SetPlatform: defines the platform a connection is for (i.e twitch/youtube)
type UserConnectionData ¶
type UserConnectionData interface { bson.Raw | UserConnectionDataTwitch | UserConnectionDataYoutube }
type UserConnectionDataTwitch ¶
type UserConnectionDataTwitch struct { ID string `json:"id" bson:"id"` Login string `json:"login" bson:"login"` DisplayName string `json:"display_name" bson:"display_name"` BroadcasterType string `json:"broadcaster_type" bson:"broadcaster_type"` Description string `json:"description" bson:"description"` ProfileImageURL string `json:"profile_image_url" bson:"profile_image_url"` OfflineImageURL string `json:"offline_image_url" bson:"offline_image_url"` ViewCount int `json:"view_count" bson:"view_count"` Email string `json:"email" bson:"email"` CreatedAt time.Time `json:"created_at" bson:"twitch_created_at"` }
type UserConnectionGrant ¶
type UserConnectionList ¶
type UserConnectionList []UserConnection[bson.Raw]
func (UserConnectionList) Twitch ¶
func (ucl UserConnectionList) Twitch() (UserConnection[UserConnectionDataTwitch], int, error)
Twitch returns the first Twitch user connection
func (UserConnectionList) YouTube ¶
func (ucl UserConnectionList) YouTube() (UserConnection[UserConnectionDataYoutube], int, error)
YouTube returns the first YouTube user connection
type UserConnectionPlatform ¶
type UserConnectionPlatform string
UserConnectionPlatform Represents a platform that the app supports
var ( UserConnectionPlatformTwitch UserConnectionPlatform = "TWITCH" UserConnectionPlatformYouTube UserConnectionPlatform = "YOUTUBE" )
type UserDiscriminator ¶
type UserDiscriminator uint8
type UserEditor ¶
type UserEditor struct { ID ObjectID `json:"id" bson:"id"` // The permissions this editor has Permissions UserEditorPermission `json:"permissions" bson:"permissions"` // Whether or not that editor will be visible on the user's profile page Visible bool `json:"visible" bson:"visible"` AddedAt time.Time `json:"added_at,omitempty" bson:"added_at,omitempty"` // Relational User *User `json:"user" bson:"user,skip,omitempty"` }
func (*UserEditor) HasPermission ¶
func (ed *UserEditor) HasPermission(bit UserEditorPermission) bool
HasPermission: check whether or not the editor has a permission
type UserEditorPermission ¶
type UserEditorPermission int32
const ( UserEditorPermissionModifyEmotes UserEditorPermission = 1 << 0 // 1 - Allows modifying emotes in the user's active emote sets UserEditorPermissionUsePrivateEmotes UserEditorPermission = 1 << 1 // 2 - Allows using the user's private emotes UserEditorPermissionManageProfile UserEditorPermission = 1 << 2 // 4 - Allows managing the user's public profile UserEditorPermissionManageOwnedEmotes UserEditorPermission = 1 << 3 // 8 - Allows managing the user's owned emotes UserEditorPermissionManageEmoteSets UserEditorPermission = 1 << 4 // 16 - Allows managing the user's owned emote sets UserEditorPermissionManageBilling UserEditorPermission = 1 << 5 // 32 - Allows managing billing and payments, such as subscriptions UserEditorPermissionManageEditors UserEditorPermission = 1 << 6 // 64 - Allows adding or removing editors for the user UserEditorPermissionViewMessages UserEditorPermission = 1 << 7 // 128 - Allows viewing the user's private messages, such as inbox )
Source Files ¶
- builder.audit.go
- builder.emote.go
- builder.emoteset.go
- builder.entitlement.go
- builder.message.go
- builder.report.go
- builder.user.go
- const.go
- defaults.go
- structures.go
- type.audit.go
- type.ban.go
- type.cosmetic.go
- type.emote.go
- type.emoteset.go
- type.entitlement.go
- type.message.go
- type.report.go
- type.role.go
- type.system.go
- type.user.go
- validator.emote.go