Documentation ¶
Index ¶
- func DecodeJwt(claims jwt.Claims, key string, token string) error
- func EncodeJwt(claims jwt.Claims, key string) (string, error)
- type Channel
- type ChannelRole
- type Color
- type CountDocument
- type CountDocumentType
- type Emote
- type EventsSubscribeChat
- type EventsSubscribeUser
- type GlobalRole
- type JwtInternalRead
- type JwtLogin
- type JwtMuxerPayload
- type JwtMuxerPayloadVariant
- type JwtTranscodePayload
- type JwtWatchStream
- type KeyValue
- type Member
- type Message
- type MessageEmote
- type RedisRtmpEvent
- type RedisRtmpEventType
- type Stream
- type TwitchAccount
- type TwitchRole
- type TwitchRoleType
- type User
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Channel ¶
type Channel struct { Title string `bson:"title" json:"title,omitempty"` // string Public bool `bson:"public" json:"public,omitempty"` // boolean StreamKey string `bson:"stream_key" json:"stream_key,omitempty"` // string LastLive time.Time `bson:"last_live" json:"last_live,omitempty"` // time TwitchRoleMirror bool `bson:"twitch_role_mirror" json:"twitch_role_mirror,omitempty"` // boolean Emotes []Emote `bson:"emotes" json:"emotes,omitempty"` // Emote }
Channel structure is a MongoDB object in the object `User` which is in the schema "users"
type ChannelRole ¶
type ChannelRole int32
ChannelRole is a int32 value which denotes your permissions
const ( // The default role ChannelRoleUser ChannelRole = iota // Can watch the channel if set to private ChannelRoleViewer // Extra permissions ChannelRoleVIP // Manage Emotes, title, category ChannelRoleEditor // Moderation permissions can manage chat, other users, and the channel ChannelRoleModerator // Admin permissions can manage channel, and other moderators ChannelRoleAdmin )
type Color ¶
type Color int32
Color is an int32 which provides helper methods to get RGBA values.
type CountDocument ¶
type CountDocument struct { ID primitive.ObjectID `bson:"_id"` // ObjectID primary-key Key interface{} `bson:"key"` // string index(key) Group interface{} `bson:"group"` // ObjectID index(group) Type CountDocumentType `bson:"type"` // string index(type) Expiry time.Time `bson:"expiry"` // Time index(expiry) *ttl }
type CountDocumentType ¶
type CountDocumentType string
const ( CountDocumentTypeChatter CountDocumentType = "CHATTER" CountDocumentTypeViewer CountDocumentType = "VIEWER" )
type Emote ¶
type Emote struct { ID primitive.ObjectID `bson:"id" json:"id"` // ObjectID index-unique(id) Tag string `bson:"tag" json:"tag"` // string UploaderID primitive.ObjectID `bson:"uploader_id" json:"uploader_id"` // ObjectID index(uploader_id) }
Emote structure is a MongoDB object in the object `Channel` which is in the schema "users"
type EventsSubscribeChat ¶
type EventsSubscribeUser ¶
type GlobalRole ¶
type GlobalRole int32
const ( // Normal role has no extra permissions GlobalRoleUser GlobalRole = iota // Streamer role can go live and stream GlobalRoleStreamer GlobalRole = 100 // Staff role has the permissions of admin in every channel and can also modify users and grant users the streamer role GlobalRoleStaff GlobalRole = 900 // Owner role same as staff but can modify staff GlobalRoleOwner GlobalRole = 1000 )
type JwtInternalRead ¶
type JwtInternalRead struct { StreamID primitive.ObjectID `json:"stream_id"` jwt.StandardClaims }
type JwtLogin ¶
type JwtLogin struct { UserID primitive.ObjectID `json:"user_id"` jwt.StandardClaims }
type JwtMuxerPayload ¶
type JwtMuxerPayload struct { StreamID primitive.ObjectID `json:"stream_id"` UserID primitive.ObjectID `json:"user_id"` Variant JwtMuxerPayloadVariant `json:"variant"` IngestPodIP string `json:"ingest_pod_ip"` TranscoderPodIP string `json:"transcoder_pod_ip"` jwt.StandardClaims }
type JwtMuxerPayloadVariant ¶
type JwtTranscodePayload ¶
type JwtWatchStream ¶
type Member ¶
type Member struct { ChannelID primitive.ObjectID `bson:"channel_id" json:"channel_id,omitempty"` // ObjectID index(channel_id, user_id), index(channel_id, role) Role ChannelRole `bson:"role" json:"role,omitempty"` // int32 index(channel_id, role) AddedByID primitive.ObjectID `bson:"added_by_id" json:"added_by_id,omitempty"` // ObjectID index(channel_id, added_by_id) }
Member structure is a MongoDB object in the object `User` which is in the schema "users"
type Message ¶
type Message struct { ID primitive.ObjectID `bson:"_id" json:"id"` // ObjectID primary-key UserID primitive.ObjectID `bson:"user_id" json:"user_id"` // ObjectID index(user_id), index(user_id, channel_id) ChannelID primitive.ObjectID `bson:"channel_id" json:"channel_id"` // ObjectID index(channel_id), index(user_id, channel_id) Content string `bson:"content" json:"content"` // string index-text(content) Emotes []MessageEmote `bson:"emotes" json:"emotes"` // ChatEmote }
Message structure is a MongoDB object in the schema "messages"
type MessageEmote ¶
type MessageEmote struct { ID primitive.ObjectID `bson:"id" json:"id"` // ObjectID Tag string `bson:"tag" json:"tag"` // string }
MessageEmote structure is a MongoDB object in the object `Message` in the schema "messages"
type RedisRtmpEvent ¶
type RedisRtmpEvent struct { Type RedisRtmpEventType `json:"type"` Key string `json:"key"` }
type RedisRtmpEventType ¶
type RedisRtmpEventType int32
const (
RedisRtmpEventTypeKill RedisRtmpEventType = iota
)
type Stream ¶
type Stream struct { ID primitive.ObjectID `bson:"_id,omitempty"` // ObjectID primary-key UserID primitive.ObjectID `bson:"user_id"` // ObjectID index(user_id) Title string `bson:"title"` // stirng StartedAt time.Time `bson:"started_at"` // time EndedAt time.Time `bson:"ended_at"` // time Revision int32 `bson:"revision"` // int32 }
Stream structure is a MongoDB object in the schema "streams"
type TwitchAccount ¶
type TwitchAccount struct { ID string `bson:"id" json:"id,omitempty"` // string index-unique(id) Login string `bson:"login" json:"login,omitempty"` // string index(login) DisplayName string `bson:"display_name" json:"display_name,omitempty"` // string ProfilePicture string `bson:"profile_picture" json:"profile_picture,omitempty"` // string }
TwitchAccount structure is a MongoDB object in the object `User` which is in the schema "users"
type TwitchRole ¶
type TwitchRole struct { ID primitive.ObjectID `bson:"_id"` ChannelID primitive.ObjectID `bson:"channel_id"` Type TwitchRoleType `bson:"type"` }
TwitchRole structure is a MongoDB object in the schema "twitch_roles"
type TwitchRoleType ¶
type TwitchRoleType int32
TwitchRoleType is an int32 which contains infomation about the user's twitch role
const ( // If the user is a twitch Subscriber TwitchRoleTypeSub TwitchRoleType = iota // If the user is a twitch VIP TwitchRoleTypeVIP // If the user is a twitch mod TwitchRoleTypeMod )
type User ¶
type User struct { ID primitive.ObjectID `bson:"_id,omitempty" json:"_id,omitempty"` // ObjectID primary-key Login string `bson:"login" json:"login,omitempty"` // string index(login) ProfilePicture primitive.ObjectID `bson:"profile_picture" json:"profile_picture,omitempty"` // ObjectID DisplayName string `bson:"display_name" json:"display_name,omitempty"` // string Color Color `bson:"color" json:"color,omitempty"` // int32 Role GlobalRole `bson:"role" json:"role,omitempty"` // int32 index(role) Channel Channel `bson:"channel" json:"channel,omitempty"` // Channel TwitchAccount TwitchAccount `bson:"twitch_account" json:"twitch_account,omitempty"` // TwitchAccount Memberships []Member `bson:"memberships" json:"memberships,omitempty"` // []Member }
User structure is a MongoDB object in the schema "users"
func (User) MemberRole ¶
func (u User) MemberRole(channelID primitive.ObjectID) ChannelRole