Documentation ¶
Index ¶
- Constants
- Variables
- type AuditLog
- type AuditLogChange
- type AuditTarget
- type AuditType
- type Ban
- type Broadcast
- type Cosmetic
- type CosmeticDataBadge
- type CosmeticDataPaint
- type CosmeticKind
- type CosmeticPaintAnimationKeyframe
- type CosmeticPaintDropShadow
- type CosmeticPaintFunction
- type CosmeticPaintGradientStop
- type CosmeticType
- type Emote
- type Meta
- type Notification
- type NotificationContentMessagePartType
- type NotificationMessagePart
- type NotificationReadState
- type Report
- type ReportTarget
- type Role
- type User
Constants ¶
View Source
const ( EmoteVisibilityPrivate int32 = 1 << iota EmoteVisibilityGlobal EmoteVisibilityUnlisted EmoteVisibilityOverrideBTTV EmoteVisibilityOverrideFFZ EmoteVisibilityOverrideTwitchGlobal EmoteVisibilityOverrideTwitchSubscriber EmoteVisibilityZeroWidth EmoteVisibilityPermanentlyUnlisted EmoteVisibilityAll int32 = (1 << iota) - 1 )
View Source
const ( EmoteStatusDeleted int32 = iota - 1 EmoteStatusProcessing EmoteStatusPending EmoteStatusDisabled EmoteStatusLive )
View Source
const ( RolePermissionEmoteCreate int64 = 1 << iota // 1 - Allows creating emotes RolePermissionEmoteEditOwned // 2 - Allows editing own emotes RolePermissionEmoteEditAll // 4 - (Elevated) Allows editing all emotes RolePermissionCreateReports // 8 - Allows creating reports RolePermissionManageReports // 16 - (Elevated) Allows managing reports RolePermissionBanUsers // 32 - (Elevated) Allows banning other users RolePermissionAdministrator // 64 - (Dangerous, Elevated) GRANTS ALL PERMISSIONS RolePermissionManageRoles // 128 - (Elevated) Allows managing roles RolePermissionManageUsers // 256 - (Elevated) Allows managing users RolePermissionManageEditors // 512 - Allows adding and removing editors from own channel RolePermissionEditEmoteGlobalState // 1024 - (Elevated) Allows editing the global state of an emote RolePermissionEditApplicationMeta // 2048 - (Elevated) Allows editing global app metadata, such as the active featured broadcast RolePermissionManageEntitlements // 4096 - (Elevated) Allows granting and revoking entitlements to and from users RolePermissionUseZeroWidthEmote // 8192 - Allows zero-width emotes to be enabled RolePermissionUseCustomAvatars // 16384 - Allows setting a custom avatar RolePermissionAll int64 = (1 << iota) - 1 )
Variables ¶
View Source
var ( CollectionNameEmotes = mongo.CollectionName("emotes") CollectionNameUsers = mongo.CollectionName("users") CollectionNameBans = mongo.CollectionName("bans") CollectionNameReports = mongo.CollectionName("reports") CollectionNameCosmetics = mongo.CollectionName("cosmetics") CollectionNameRoles = mongo.CollectionName("roles") CollectionNameAudit = mongo.CollectionName("audit") CollectionNameEntitlements = mongo.CollectionName("entitlements") CollectionNameNotifications = mongo.CollectionName("notifications") CollectionNameNotificationsRead = mongo.CollectionName("notifications_read") )
View Source
var DeletedUser = &User{ ID: primitive.NilObjectID, Login: "*deleted_user", DisplayName: "*DeletedUser", Email: "", Editors: nil, TokenVersion: "", }
View Source
var EmoteVisibilitySimpleMap = map[int32]string{ EmoteVisibilityPrivate: "PRIVATE", EmoteVisibilityGlobal: "GLOBAL", EmoteVisibilityUnlisted: "UNLISTED", EmoteVisibilityOverrideFFZ: "OVERRIDE_FFZ", EmoteVisibilityOverrideBTTV: "OVERRIDE_BTTV", EmoteVisibilityOverrideTwitchSubscriber: "OVERRIDE_TWITCH_SUBSCRIBER", EmoteVisibilityOverrideTwitchGlobal: "OVERRIDE_TWITCH_GLOBAL", EmoteVisibilityZeroWidth: "ZERO_WIDTH", }
View Source
var NilRole = &Role{ ID: primitive.NilObjectID, Name: "NULL", Position: 0, }
View Source
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 AuditLog ¶
type AuditLog struct { ID primitive.ObjectID `json:"id" bson:"_id,omitempty"` Type AuditType `json:"type" bson:"type"` Target *AuditTarget `json:"target" bson:"target"` Changes []AuditLogChange `json:"changes" bson:"changes"` Reason *string `json:"reason" bson:"reason"` CreatedBy primitive.ObjectID `json:"action_user_id" bson:"action_user"` }
type AuditLogChange ¶
type AuditLogChange struct { Key string `json:"key" bson:"key"` OldValue interface{} `json:"old_value" bson:"old_value"` NewValue interface{} `json:"new_value" bson:"new_value"` }
type AuditTarget ¶
type AuditType ¶
type AuditType int32
const ( // Emotes (1-19) AuditLogTypeEmoteCreate AuditType = 1 AuditLogTypeEmoteDelete AuditType = 2 AuditLogTypeEmoteDisable AuditType = 3 AuditLogTypeEmoteEdit AuditType = 4 AuditLogTypeEmoteUndoDeleteAuditType = 4 AuditLogTypeEmoteMerge AuditType = 5 // Auth (20-29) AuditLogTypeAuthIn AuditType = 20 AuditLogTypeAuthOut AuditType = 21 // Users (30-69) AuditLogTypeUserCreate AuditType = 30 AuditLogTypeUserDelete AuditType = 31 AuditLogTypeUserBan AuditType = 32 AuditLogTypeUserEdit AuditType = 33 AuditLogTypeUserChannelEmoteAdd AuditType = 34 AuditLogTypeUserChannelEmoteRemove AuditType = 35 AuditLogTypeUserUnban AuditType = 36 AuditLogTypeUserChannelEditorAdd AuditType = 37 AuditLogTypeUserChannelEditorRemove AuditType = 38 AuditLogTypeUserChannelEmoteEdit AuditType = 39 // Admin (70-89) AuditLogTypeAppMaintenanceMode AuditType = 70 AuditLogTypeAppRouteLock AuditType = 71 AuditLogTypeAppLogsView AuditType = 72 AuditLogTypeAppScale AuditType = 73 AuditLogTypeAppNodeCreate AuditType = 74 AuditLogTypeAppNodeDelete AuditType = 75 AuditLogTypeAppNodeJoin AuditType = 75 AuditLogTypeAppNodeUnref AuditType = 76 // Reports (90-99) AuditLogTypeReport AuditType = 90 AuditLogTypeReportClear AuditType = 91 )
type Ban ¶
type Ban struct { ID primitive.ObjectID `json:"id" bson:"_id,omitempty"` UserID *primitive.ObjectID `json:"user_id" bson:"user_id"` Reason string `json:"reason" bson:"reason"` IssuedByID *primitive.ObjectID `json:"issued_by_id" bson:"issued_by_id"` ExpireAt time.Time `json:"expire_at" bson:"expire_at"` }
type Broadcast ¶
type Broadcast struct { ID string `json:"id"` Title string `json:"title"` ThumbnailURL string `json:"thumbnail_url"` ViewerCount int32 `json:"viewer_count"` Type string `json:"type"` GameName string `json:"game_name"` GameID string `json:"game_id"` Language string `json:"language"` Tags []string `json:"tags"` Mature bool `json:"mature"` StartedAt string `json:"started_at"` UserID string `json:"user_id"` }
type Cosmetic ¶
type Cosmetic[K CosmeticType] 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 K `json:"data" bson:"data"` // User Relationals Selected bool `json:"selected" bson:"selected,skip,omitempty"` }
func ConvertCosmetic ¶
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 utils.Color `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"` // Deprecated: Properties for a drop shadow DropShadow CosmeticPaintDropShadow `json:"drop_shadow,omitempty" bson:"drop_shadow,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 CosmeticPaintDropShadow ¶
type CosmeticPaintFunction ¶
type CosmeticPaintFunction string
const ( CosmeticPaintFunctionLinearGradient CosmeticPaintFunction = "linear-gradient" CosmeticPaintFunctionRadialGradient CosmeticPaintFunction = "radial-gradient" CosmeticPaintFunctionImageURL CosmeticPaintFunction = "url" )
type CosmeticType ¶
type CosmeticType interface { CosmeticDataBadge | CosmeticDataPaint | bson.Raw }
type Emote ¶
type Emote struct { ID primitive.ObjectID `json:"id" bson:"_id,omitempty"` Name string `json:"name" bson:"name"` OwnerID primitive.ObjectID `json:"owner_id" bson:"owner"` Visibility int32 `json:"visibility" bson:"visibility"` Mime string `json:"mime" bson:"mime"` Status int32 `json:"status" bson:"status"` Tags []string `json:"tags" bson:"tags"` LastModifiedDate time.Time `json:"edited_at" bson:"edited_at"` Width [4]int16 `json:"width" bson:"width"` // The emote's width in pixels Height [4]int16 `json:"height" bson:"height"` // The emote's height in pixels Animated bool `json:"animated" bson:"animated"` // ChannelCount is used during the popularity sort check, generated by a pipeline. // It is not used anywhere else ChannelCount int32 `json:"channel_count,omitempty" bson:"channel_count"` LastChannelCountCheck time.Time `json:"channel_count_checked_at,omitempty" bson:"channel_count_checked_at"` Owner User `json:"owner,omitempty" bson:"-"` AuditEntries []AuditLog `json:"audit_entries,omitempty" bson:"-"` Channels []User `json:"channels,omitempty" bson:"-"` Reports []Report `json:"reports,omitempty" bson:"-"` Provider string `json:"provider,omitempty" bson:"-"` // The service provider for the emote ProviderID string `json:"provider_id,omitempty" bson:"-"` // The emote ID as defined by the foreign provider. Nil if 7TV URLs [][]string `json:"urls,omitempty" bson:"-"` // Synthesized URLs to CDN for the emote }
func (*Emote) GetSimpleVisibility ¶
type Notification ¶
type Notification struct { ID primitive.ObjectID `json:"id" bson:"_id,omitempty"` Announcement bool `json:"announcement" bson:"announcement"` // If true, the notification is global and visible to all users regardless of targets Title string `json:"title" bson:"title"` // The notification's heading / title MessageParts []NotificationMessagePart `json:"message_parts" bson:"message_parts"` // The parts making up the notification's formatted message Read bool `json:"read" bson:"read,omitempty"` ReadAt time.Time `json:"read_at" bson:"read_at,omitempty"` Users []*User `json:"users" bson:"-"` // The users mentioned in this notification Emotes []*Emote `json:"emotes" bson:"-"` // The emotesm entioned in this notification }
type NotificationContentMessagePartType ¶
type NotificationContentMessagePartType int8
const ( NotificationMessagePartTypeText NotificationContentMessagePartType = 1 + iota NotificationMessagePartTypeUserMention NotificationMessagePartTypeEmoteMention NotificationMessagePartTypeRoleMention )
type NotificationMessagePart ¶
type NotificationMessagePart struct { Type NotificationContentMessagePartType `json:"part_type" bson:"part_type"` // The type of this part Text *string `json:"text" bson:"text"` Mention *primitive.ObjectID `json:"mention" bson:"mention"` }
type NotificationReadState ¶
type NotificationReadState struct { TargetUser primitive.ObjectID `json:"target" bson:"target"` // The user targeted to see the notification Notification primitive.ObjectID `json:"notification_id" bson:"notification"` // The notification that can be read Read bool `json:"read" bson:"read"` // Whether the user read the notification ReadAt *time.Time `json:"read_at" bson:"read_at"` // When the notification was read }
type Report ¶
type Report struct { ID primitive.ObjectID `json:"id" bson:"_id"` ReporterID *primitive.ObjectID `json:"reporter_id" bson:"reporter_id"` Reason string `json:"reason" bson:"target"` Target *ReportTarget `json:"target" bson:"target"` Cleared bool `json:"cleared" bson:"cleared"` // Relational Data ETarget Emote `json:"e_target" bson:"-"` UTarget User `json:"u_target" bson:"-"` Reporter User `json:"reporter" bson:"-"` AuditEntries []AuditLog `json:"audit_entries" bson:"-"` }
type ReportTarget ¶
type Role ¶
type Role struct { ID primitive.ObjectID `json:"id" bson:"_id"` Name string `json:"name" bson:"name"` Position int32 `json:"position" bson:"position"` Color int32 `json:"color" bson:"color"` Allowed int64 `json:"allowed" bson:"allowed"` Denied int64 `json:"denied" bson:"denied"` Default bool `json:"default,omitempty" bson:"default"` }
type User ¶
type User struct { ID primitive.ObjectID `json:"_id" bson:"_id,omitempty"` Email string `json:"email" bson:"email"` Rank int32 `json:"rank" bson:"rank"` EmoteIDs []primitive.ObjectID `json:"emote_ids" bson:"emotes"` EditorIDs []primitive.ObjectID `json:"editor_ids" bson:"editors"` RoleID *primitive.ObjectID `json:"role_id" bson:"role"` TokenVersion string `json:"token_version" bson:"token_version"` // Twitch Data TwitchID string `json:"twitch_id" bson:"id"` YouTubeID string `json:"yt_id,omitempty" bson:"yt_id,omitempty"` DisplayName string `json:"display_name" bson:"display_name"` Login string `json:"login" bson:"login"` BroadcasterType string `json:"broadcaster_type" bson:"broadcaster_type"` ProfileImageURL string `json:"profile_image_url" bson:"profile_image_url"` OfflineImageURL string `json:"offline_image_url" bson:"offline_image_url"` Description string `json:"description" bson:"description"` CreatedAt time.Time `json:"twitch_created_at" bson:"twitch_created_at"` ViewCount int32 `json:"view_count" bson:"view_count"` ProfilePictureID string `json:"profile_picture_id,omitempty" bson:"profile_picture_id,omitempty"` EmoteAlias map[string]string `json:"-" bson:"emote_alias"` // Emote Alias - backend only Badge *primitive.ObjectID `json:"badge" bson:"badge"` // User's badge, if any EmoteSlots int32 `json:"emote_slots" bson:"emote_slots"` // User's maximum channel emote slots // Relational Data Emotes []Emote `json:"emotes" bson:"-"` OwnedEmotes []Emote `json:"owned_emotes" bson:"-"` Editors []User `json:"editors" bson:"-"` Role Role `json:"role" bson:"-"` EditorIn []User `json:"editor_in" bson:"-"` AuditEntries []AuditLog `json:"audit_entries" bson:"-"` Reports []Report `json:"reports" bson:"-"` Bans []Ban `json:"bans" bson:"-"` Cosmetics []Cosmetic[bson.Raw] `json:"cosmetics" bson:"-"` Notifications []Notification `json:"-" bson:"-"` NotificationCount int64 `json:"-" bson:"-"` }
func (User) HasPermission ¶
Test whether a User has a permission flag
Click to show internal directories.
Click to hide internal directories.