model

package
v0.0.0-...-6d36bb5 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 22, 2024 License: Apache-2.0 Imports: 10 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ActiveEmoteFlagModel

type ActiveEmoteFlagModel int32
const (
	ActiveEmoteFlagModelZeroWidth                ActiveEmoteFlagModel = 1 << 0  // 1 - Emote is zero-width
	ActiveEmoteFlagModelOverrideTwitchGlobal     ActiveEmoteFlagModel = 1 << 16 // 65536 - Overrides Twitch Global emotes with the same name
	ActiveEmoteFlagModelOverrideTwitchSubscriber ActiveEmoteFlagModel = 1 << 17 // 131072 - Overrides Twitch Subscriber emotes with the same name
	ActiveEmoteFlagModelOverrideBetterTTV        ActiveEmoteFlagModel = 1 << 18 // 262144 - Overrides BetterTTV emotes with the same name
)

type ActiveEmoteModel

type ActiveEmoteModel struct {
	ID        primitive.ObjectID   `json:"id"`
	Name      string               `json:"name"`
	Flags     ActiveEmoteFlagModel `json:"flags"`
	Timestamp int64                `json:"timestamp"`
	ActorID   *primitive.ObjectID  `json:"actor_id" extensions:"x-nullable"`
	Data      *EmotePartialModel   `json:"data,omitempty" extensions:"x-nullable"`
	OriginID  *primitive.ObjectID  `json:"origin_id,omitempty" extensions:"x-omitempty"`
}

type CosmeticAvatarModel

type CosmeticAvatarModel struct {
	ID   string           `json:"id"`
	User UserPartialModel `json:"user"`
	As   string           `json:"as,omitempty"`
	Host ImageHost        `json:"host"`
}

type CosmeticBadgeModel

type CosmeticBadgeModel struct {
	ID      primitive.ObjectID `json:"id"`
	Name    string             `json:"name"`
	Tag     string             `json:"tag"`
	Tooltip string             `json:"tooltip"`
	Host    ImageHost          `json:"host"`
}

type CosmeticKind

type CosmeticKind string
const (
	CosmeticKindPaint  CosmeticKind = "PAINT"
	CosmeticKindBadge  CosmeticKind = "BADGE"
	CosmeticKindAvatar CosmeticKind = "AVATAR"
)

type CosmeticModel

type CosmeticModel[T CosmeticPaintModel | CosmeticBadgeModel | CosmeticAvatarModel | json.RawMessage] struct {
	ID   primitive.ObjectID `json:"id"`
	Kind CosmeticKind       `json:"kind"`
	Data T                  `json:"data"`
}

type CosmeticPaintCanvasRepeat

type CosmeticPaintCanvasRepeat string
const (
	CosmeticPaintCanvasRepeatNone   CosmeticPaintCanvasRepeat = "no-repeat"
	CosmeticPaintCanvasRepeatX      CosmeticPaintCanvasRepeat = "repeat-x"
	CosmeticPaintCanvasRepeatY      CosmeticPaintCanvasRepeat = "repeat-y"
	CosmeticPaintCanvasRepeatRevert CosmeticPaintCanvasRepeat = "revert"
	CosmeticPaintCanvasRepeatRound  CosmeticPaintCanvasRepeat = "round"
	CosmeticPaintCanvasRepeatSpace  CosmeticPaintCanvasRepeat = "space"
)

type CosmeticPaintFlair

type CosmeticPaintFlair struct {
	// The kind of sprite
	Kind CosmeticPaintFlairKind `json:"kind" bson:"kind"`
	// The X offset of the flair (%)
	OffsetX float64 `json:"x_offset" bson:"x_offset"`
	// The Y offset of the flair (%)
	OffsetY float64 `json:"y_offset" bson:"y_offset"`
	// The width of the flair
	Width float64 `json:"width" bson:"width"`
	// The height of the flair
	Height float64 `json:"height" bson:"height"`
	// Base64-encoded image or vector data
	Data string `json:"data" bson:"data"`
}

type CosmeticPaintFlairKind

type CosmeticPaintFlairKind string
const (
	CosmeticPaintSpriteKindImage  CosmeticPaintFlairKind = "IMAGE"
	CosmeticPaintSpriteKindVector CosmeticPaintFlairKind = "VECTOR"
	CosmeticPaintSpriteKindText   CosmeticPaintFlairKind = "TEXT"
)

type CosmeticPaintFunction

type CosmeticPaintFunction string
const (
	CosmeticPaintFunctionLinearGradient CosmeticPaintFunction = "LINEAR_GRADIENT"
	CosmeticPaintFunctionRadialGradient CosmeticPaintFunction = "RADIAL_GRADIENT"
	CosmeticPaintFunctionImageURL       CosmeticPaintFunction = "URL"
)

type CosmeticPaintGradient

type CosmeticPaintGradient struct {
	// The function used to generate the paint (i.e gradients or an image)
	Function CosmeticPaintFunction `json:"function" bson:"function"`
	// The repeat mode of the canvas
	CanvasRepeat CosmeticPaintCanvasRepeat `json:"canvas_repeat" bson:"canvas_repeat"`
	// The canvas size for the paint
	Size [2]float64 `json:"canvas_size" bson:"canvas_size"`
	// Gradient position (X/Y % values)
	At [2]float64 `json:"at,omitempty" bson:"at,omitempty"`
	// A list of gradients. There may be any amount, which can be stacked onto each other
	// Gradient stops, a list of positions and colors
	Stops []CosmeticPaintGradientStop `json:"stops" bson:"stops"`
	// For a URL-based paint, the URL to an image
	ImageURL string `json:"image_url,omitempty" bson:"image_url,omitempty"`
	// For a radial gradient, the shape of the gradient
	Shape string `json:"shape,omitempty" bson:"shape,omitempty"`
	// The degree angle of the gradient (does not apply if function is URL)
	Angle int32 `json:"angle,omitempty" bson:"angle,omitempty"`
	// Whether or not the gradient repeats outside its original area
	Repeat bool `json:"repeat" bson:"repeat"`
}

type CosmeticPaintGradientStop

type CosmeticPaintGradientStop struct {
	At    float64 `json:"at"`
	Color int32   `json:"color"`
	// the center position for the gradient. X/Y % values (for radial gradients only)
	CenterAt [2]float64 `json:"center_at,omitempty" bson:"center_at,omitempty"`
}

type CosmeticPaintModel

type CosmeticPaintModel struct {
	ID        primitive.ObjectID      `json:"id"`
	Name      string                  `json:"name"`
	Color     *int32                  `json:"color"`
	Gradients []CosmeticPaintGradient `json:"gradients"`
	// A list of shadows. There may be any amount, which can be stacked onto each other
	Shadows []CosmeticPaintShadow `json:"shadows"`
	Flairs  []CosmeticPaintFlair  `json:"flairs"`
	Text    *CosmeticPaintText    `json:"text"`
	// use `gradients`
	Function CosmeticPaintFunction `json:"function" enums:"LINEAR_GRADIENT,RADIAL_GRADIENT,URL"`
	// use `gradients`
	Repeat bool `json:"repeat"`
	// use `gradients`
	Angle int32 `json:"angle"`
	// use `gradients`
	Shape string `json:"shape"`
	// use `gradients`
	ImageURL string `json:"image_url"`
	// use `gradients`
	Stops []CosmeticPaintGradientStop `json:"stops"`
}

type CosmeticPaintShadow

type CosmeticPaintShadow struct {
	OffsetX float64 `json:"x_offset"`
	OffsetY float64 `json:"y_offset"`
	Radius  float64 `json:"radius"`
	Color   int32   `json:"color"`
}

type CosmeticPaintStroke

type CosmeticPaintStroke struct {
	// Stroke color
	Color int32 `json:"color" bson:"color"`
	// Stroke width
	Width float64 `json:"width" bson:"width"`
}

type CosmeticPaintText

type CosmeticPaintText struct {
	// Weight multiplier for the text. Defaults to 9x is not specified
	Weight uint8 `json:"weight,omitempty" bson:"weight,omitempty"`
	// Shadows applied to the text
	Shadows []CosmeticPaintShadow `json:"shadows,omitempty" bson:"shadows,omitempty"`
	// Text tranformation
	Transform CosmeticPaintTextTransform `json:"transform,omitempty" bson:"transform,omitempty"`
	// Text stroke
	Stroke *CosmeticPaintStroke `json:"stroke,omitempty" bson:"stroke,omitempty"`
	// (css) font variant property. non-standard
	Variant string `json:"variant" bson:"variant"`
}

type CosmeticPaintTextTransform

type CosmeticPaintTextTransform string
const (
	CosmeticPaintTextTransformUppercase CosmeticPaintTextTransform = "uppercase"
	CosmeticPaintTextTransformLowercase CosmeticPaintTextTransform = "lowercase"
)

type EmoteFlagsModel

type EmoteFlagsModel int32
const (
	EmoteFlagsPrivate   EmoteFlagsModel = 1 << 0 // The emote is private and can only be accessed by its owner, editors and moderators
	EmoteFlagsAuthentic EmoteFlagsModel = 1 << 1 // The emote was verified to be an original creation by the uploader
	EmoteFlagsZeroWidth EmoteFlagsModel = 1 << 8 // The emote is recommended to be enabled as Zero-Width

	EmoteFlagsContentSexual           EmoteFlagsModel = 1 << 16 // Sexually Suggesive
	EmoteFlagsContentEpilepsy         EmoteFlagsModel = 1 << 17 // Rapid flashing
	EmoteFlagsContentEdgy             EmoteFlagsModel = 1 << 18 // Edgy or distasteful, may be offensive to some users
	EmoteFlagsContentTwitchDisallowed EmoteFlagsModel = 1 << 24 // Not allowed specifically on the Twitch platform
)

type EmoteLifecycleModel

type EmoteLifecycleModel int32
const (
	EmoteLifecycleDeleted EmoteLifecycleModel = iota - 1
	EmoteLifecyclePending
	EmoteLifecycleProcessing
	EmoteLifecycleDisabled
	EmoteLifecycleLive
	EmoteLifecycleFailed EmoteLifecycleModel = -2
)

type EmoteModel

type EmoteModel struct {
	ID        primitive.ObjectID  `json:"id"`
	Name      string              `json:"name"`
	Flags     EmoteFlagsModel     `json:"flags"`
	Tags      []string            `json:"tags"`
	Lifecycle EmoteLifecycleModel `json:"lifecycle"`
	State     []EmoteVersionState `json:"state"`
	Listed    bool                `json:"listed"`
	Animated  bool                `json:"animated"`
	Owner     *UserPartialModel   `json:"owner,omitempty" extensions:"x-omitempty"`
	OwnerID   primitive.ObjectID  `json:"-"`
	Host      ImageHost           `json:"host"`
	Versions  []EmoteVersionModel `json:"versions"`
}

func (EmoteModel) ToPartial

func (em EmoteModel) ToPartial() EmotePartialModel

type EmotePartialModel

type EmotePartialModel struct {
	ID        primitive.ObjectID  `json:"id"`
	Name      string              `json:"name"`
	Flags     EmoteFlagsModel     `json:"flags"`
	Tags      []string            `json:"tags,omitempty"`
	Lifecycle EmoteLifecycleModel `json:"lifecycle"`
	State     []EmoteVersionState `json:"state"`
	Listed    bool                `json:"listed"`
	Animated  bool                `json:"animated"`
	Owner     *UserPartialModel   `json:"owner,omitempty" extensions:"x-omitempty"`
	Host      ImageHost           `json:"host"`
}

type EmoteSetFlagModel

type EmoteSetFlagModel int32
const (
	// Set is immutable, meaning it cannot be modified
	EmoteSetFlagImmutable EmoteSetFlagModel = 1 << 0
	// Set is privileged, meaning it can only be modified by its owner
	EmoteSetFlagPrivileged EmoteSetFlagModel = 1 << 1
	// Set is personal, meaning its content can be used globally and it is subject to stricter content moderation rules
	EmoteSetFlagPersonal EmoteSetFlagModel = 1 << 2
	// Set is commercial, meaning it is sold and subject to extra rules on content ownership
	EmoteSetFlagCommercial EmoteSetFlagModel = 1 << 3
)

type EmoteSetModel

type EmoteSetModel struct {
	ID         primitive.ObjectID `json:"id"`
	Name       string             `json:"name"`
	Flags      EmoteSetFlagModel  `json:"flags"`
	Tags       []string           `json:"tags"`
	Immutable  bool               `json:"immutable"`
	Privileged bool               `json:"privileged"`
	Emotes     []ActiveEmoteModel `json:"emotes,omitempty" extensions:"x-omitempty"`
	EmoteCount int                `json:"emote_count,omitempty" extensions:"x-omitempty"`
	Capacity   int32              `json:"capacity"`
	Origins    []EmoteSetOrigin   `json:"origins,omitempty" extensions:"x-omitempty"`
	Owner      *UserPartialModel  `json:"owner" extensions:"x-nullable"`
}

func (EmoteSetModel) ToPartial

func (esm EmoteSetModel) ToPartial() EmoteSetPartialModel

type EmoteSetOrigin

type EmoteSetOrigin struct {
	ID     primitive.ObjectID `json:"id"`
	Weight int32              `json:"weight"`
	Slices []uint32           `json:"slices"`
}

type EmoteSetPartialModel

type EmoteSetPartialModel struct {
	ID       primitive.ObjectID `json:"id"`
	Name     string             `json:"name"`
	Flags    EmoteSetFlagModel  `json:"flags"`
	Tags     []string           `json:"tags"`
	Capacity int32              `json:"capacity"`
	Owner    *UserPartialModel  `json:"owner,omitempty" extensions:"x-nullable, x-omitempty"`
}

type EmoteVersionModel

type EmoteVersionModel struct {
	ID          primitive.ObjectID  `json:"id"`
	Name        string              `json:"name"`
	Description string              `json:"description"`
	Lifecycle   EmoteLifecycleModel `json:"lifecycle"`
	State       []EmoteVersionState `json:"state"`
	Listed      bool                `json:"listed"`
	Animated    bool                `json:"animated"`
	Host        *ImageHost          `json:"host,omitempty" extensions:"x-omitempty"`
	CreatedAt   int64               `json:"createdAt"`
}

type EmoteVersionState

type EmoteVersionState string
const (
	EmoteVersionStateListed        EmoteVersionState = "LISTED"
	EmoteVersionStateAllowPersonal EmoteVersionState = "PERSONAL"
	EmoteVersionStateNoPersonal    EmoteVersionState = "NO_PERSONAL"
)

type EntitlementKind

type EntitlementKind string
const (
	EntitlementKindBadge    EntitlementKind = "BADGE"
	EntitlementKindPaint    EntitlementKind = "PAINT"
	EntitlementKindEmoteSet EntitlementKind = "EMOTE_SET"
)

type EntitlementModel

type EntitlementModel struct {
	ID    primitive.ObjectID `json:"id"`
	Kind  EntitlementKind    `json:"kind"`
	User  UserPartialModel   `json:"user"`
	RefID primitive.ObjectID `json:"ref_id"`
}

type ImageFile

type ImageFile struct {
	Name string `json:"name"`
	// deprecated
	StaticName string      `json:"static_name"`
	Width      int32       `json:"width"`
	Height     int32       `json:"height"`
	FrameCount int32       `json:"frame_count,omitempty"`
	Size       int64       `json:"size,omitempty"`
	Format     ImageFormat `json:"format"`
}

type ImageFormat

type ImageFormat string
const (
	ImageFormatAVIF ImageFormat = "AVIF"
	ImageFormatWEBP ImageFormat = "WEBP"
)

type ImageHost

type ImageHost struct {
	URL   string      `json:"url"`
	Files []ImageFile `json:"files"`
}

type InboxMessageModel

type InboxMessageModel struct {
	ID           primitive.ObjectID  `json:"id"`
	Kind         MessageKind         `json:"kind"`
	CreatedAt    int64               `json:"createdAt"`
	AuthorID     *primitive.ObjectID `json:"author_id"`
	Read         bool                `json:"read"`
	ReadAt       *int64              `json:"readAt"`
	Subject      string              `json:"subject"`
	Content      string              `json:"content"`
	Important    bool                `json:"important"`
	Starred      bool                `json:"starred"`
	Pinned       bool                `json:"pinned"`
	Placeholders map[string]string   `json:"placeholders"`
}

type MessageKind

type MessageKind string
const (
	MessageKindEmoteComment MessageKind = "EMOTE_COMMENT"
	MessageKindModRequest   MessageKind = "MOD_REQUEST"
	MessageKindInbox        MessageKind = "INBOX"
	MessageKindNews         MessageKind = "NEWS"
)

type ModRequestMessageModel

type ModRequestMessageModel struct {
	ID               primitive.ObjectID  `json:"id"`
	Kind             MessageKind         `json:"kind"`
	CreatedAt        int64               `json:"createdAt"`
	AuthorID         *primitive.ObjectID `json:"author_id"`
	TargetKind       int                 `json:"targetKind"`
	TargetID         primitive.ObjectID  `json:"targetID"`
	Read             bool                `json:"read"`
	Wish             string              `json:"wish"`
	ActorCountryName string              `json:"actor_country_name"`
	ActorCountryCode string              `json:"actor_country_code"`
}

type ModelInstanceOptions

type ModelInstanceOptions struct {
	CDN     string
	Website string
}

type Modelizer

type Modelizer interface {
	Emote(v structures.Emote) EmoteModel
	User(v structures.User) UserModel
	UserEditor(v structures.UserEditor) UserEditorModel
	UserConnection(v structures.UserConnection[bson.Raw]) UserConnectionModel
	Presence(v structures.UserPresence[bson.Raw]) PresenceModel
	Entitlement(v structures.Entitlement[bson.Raw], user structures.User) EntitlementModel
	Cosmetic(v structures.Cosmetic[bson.Raw]) CosmeticModel[json.RawMessage]
	Paint(v structures.Cosmetic[structures.CosmeticDataPaint]) CosmeticPaintModel
	Badge(v structures.Cosmetic[structures.CosmeticDataBadge]) CosmeticBadgeModel
	Avatar(v structures.User) CosmeticModel[CosmeticAvatarModel]
	EmoteSet(v structures.EmoteSet) EmoteSetModel
	ActiveEmote(v structures.ActiveEmote) ActiveEmoteModel
	Role(v structures.Role) RoleModel
	InboxMessage(v structures.Message[structures.MessageDataInbox]) InboxMessageModel
	ModRequestMessage(v structures.Message[structures.MessageDataModRequest]) ModRequestMessageModel
}

func NewInstance

func NewInstance(opt ModelInstanceOptions) Modelizer

type MutationResponse

type MutationResponse struct {
	OK bool `json:"ok"`
}

type PresenceKind

type PresenceKind uint8
const (
	UserPresenceKindUnknown PresenceKind = iota
	UserPresenceKindChannel
	UserPresenceKindWebPage
)

type PresenceModel

type PresenceModel struct {
	ID        primitive.ObjectID `json:"id"`
	UserID    primitive.ObjectID `json:"user_id"`
	Timestamp int64              `json:"timestamp"`
	TTL       int64              `json:"ttl"`
	Kind      PresenceKind       `json:"kind"`
}

type RoleModel

type RoleModel struct {
	ID        primitive.ObjectID `json:"id"`
	Name      string             `json:"name"`
	Position  int32              `json:"position"`
	Color     int32              `json:"color"`
	Allowed   string             `json:"allowed"`
	Denied    string             `json:"denied"`
	Invisible bool               `json:"invisible,omitempty" extensions:"x-omitempty"`
}

type UserConnectionModel

type UserConnectionModel struct {
	ID string `json:"id"`
	// The service of the connection.
	Platform UserConnectionPlatformModel `json:"platform" enums:"TWITCH,YOUTUBE,DISCORD"`
	// The username of the user on the platform.
	Username string `json:"username"`
	// The display name of the user on the platform.
	DisplayName string `json:"display_name"`
	// The time when the user linked this connection
	LinkedAt int64 `json:"linked_at"`
	// The maximum size of emote sets that may be bound to this connection.
	EmoteCapacity int32 `json:"emote_capacity"`
	// The ID of the emote set bound to this connection.
	EmoteSetID *primitive.ObjectID `json:"emote_set_id" extensions:"x-nullable"`
	// The emote set that is linked to this connection
	EmoteSet *EmoteSetModel `json:"emote_set" extensions:"x-nullable"`
	// A list of users active in the channel
	Presences []UserPartialModel `json:"presences,omitempty" extensions:"x-omitempty"`

	// App data for the user
	User *UserModel `json:"user,omitempty" extensions:"x-omitempty"`
}

func (UserConnectionModel) ToPartial

type UserConnectionPartialModel

type UserConnectionPartialModel struct {
	ID string `json:"id"`
	// The service of the connection.
	Platform UserConnectionPlatformModel `json:"platform" enums:"TWITCH,YOUTUBE,DISCORD"`
	// The username of the user on the platform.
	Username string `json:"username"`
	// The display name of the user on the platform.
	DisplayName string `json:"display_name"`
	// The time when the user linked this connection
	LinkedAt int64 `json:"linked_at"`
	// The maximum size of emote sets that may be bound to this connection.
	EmoteCapacity int32 `json:"emote_capacity"`
	// The emote set that is linked to this connection
	EmoteSetID *primitive.ObjectID `json:"emote_set_id" extensions:"x-nullable"`
}

type UserConnectionPlatformModel

type UserConnectionPlatformModel string
var (
	UserConnectionPlatformTwitch  UserConnectionPlatformModel = "TWITCH"
	UserConnectionPlatformYouTube UserConnectionPlatformModel = "YOUTUBE"
	UserConnectionPlatformDiscord UserConnectionPlatformModel = "DISCORD"
)

type UserEditorModel

type UserEditorModel struct {
	ID          primitive.ObjectID `json:"id"`
	Permissions int32              `json:"permissions"`
	Visible     bool               `json:"visible"`
	AddedAt     int64              `json:"added_at"`
}

type UserModel

type UserModel struct {
	ID          primitive.ObjectID     `json:"id"`
	UserType    UserTypeModel          `json:"type,omitempty" enums:",BOT,SYSTEM"`
	Username    string                 `json:"username"`
	DisplayName string                 `json:"display_name"`
	CreatedAt   int64                  `json:"created_at,omitempty"`
	AvatarURL   string                 `json:"avatar_url,omitempty"`
	Biography   string                 `json:"biography,omitempty" extensions:"x-omitempty"`
	Style       UserStyle              `json:"style"`
	EmoteSets   []EmoteSetPartialModel `json:"emote_sets,omitempty" extensions:"x-omitempty"`
	Editors     []UserEditorModel      `json:"editors,omitempty"`
	RoleIDs     []primitive.ObjectID   `json:"roles,omitempty"`
	Connections []UserConnectionModel  `json:"connections,omitempty" extensions:"x-omitempty"`
}

func (UserModel) ToPartial

func (um UserModel) ToPartial() UserPartialModel

type UserPartialModel

type UserPartialModel struct {
	ID          primitive.ObjectID           `json:"id"`
	UserType    UserTypeModel                `json:"type,omitempty" enums:",BOT,SYSTEM"`
	Username    string                       `json:"username"`
	DisplayName string                       `json:"display_name"`
	AvatarURL   string                       `json:"avatar_url,omitempty" extensions:"x-omitempty"`
	Style       UserStyle                    `json:"style"`
	RoleIDs     []primitive.ObjectID         `json:"roles,omitempty" extensions:"x-omitempty"`
	Connections []UserConnectionPartialModel `json:"connections,omitempty" extensions:"x-omitempty"`
}

type UserPresenceWriteResponse

type UserPresenceWriteResponse struct {
	OK       bool          `json:"ok"`
	Presence PresenceModel `json:"presence"`
}

type UserStyle

type UserStyle struct {
	Color   int32               `json:"color,omitempty" extensions:"x-omitempty"`
	PaintID *primitive.ObjectID `json:"paint_id,omitempty" extensions:"x-omitempty"`
	Paint   *CosmeticPaintModel `json:"paint,omitempty" extensions:"x-omitempty"`
	BadgeID *primitive.ObjectID `json:"badge_id,omitempty" extensions:"x-omitempty"`
	Badge   *CosmeticBadgeModel `json:"badge,omitempty" extensions:"x-omitempty"`
}

type UserTypeModel

type UserTypeModel string
var (
	UserTypeRegular UserTypeModel = ""
	UserTypeBot     UserTypeModel = "BOT"
	UserTypeSystem  UserTypeModel = "SYSTEM"
)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL