Documentation
¶
Index ¶
- Constants
- Variables
- func NewHasher(hasher string) func() hash.Hash
- func VerifySignature(body, expected, secret string) error
- type Category
- type Channel
- type Client
- type Event
- type ListStream
- type ListStreamResponse
- type Pagination
- type ProfileCanvas
- type ProfileFeatured
- type ProfileFeaturedStream
- type ProfileLink
- type ProfileTheme
- type StreamData
- type StreamEvent
- type User
- type UserStream
Constants ¶
View Source
const ( StreamOnline = "stream.online" StreamOffline = "stream.offline" StreamUpdate = "stream.update" )
Variables ¶
View Source
var ( ErrInvalidHeader = errors.New("invalid expected header, should match sha256=SIGNATURE") ErrInvalidHasher = errors.New("unsupported hashing algorithm") ErrInvalidSignature = errors.New("invalid signature") )
View Source
var (
ErrNotFound = errors.New("resource not found")
)
Functions ¶
func VerifySignature ¶
VerifySignature is a standard hmac w/ sha1/256/384/512 implementation, parsed off the prefix This is used in standard websub and other implementations
Types ¶
type Category ¶
type Category struct {
ID string `json:"id"`
Slug string `json:"slug"`
Name string `json:"name"`
Description string `json:"description"`
ImageURL string `json:"imageUrl"`
ExternalImageURL string `json:"externalImageUrl"`
AssetPath string `json:"assetPath"`
Source string `json:"source"`
CategoryType string `json:"categoryType"`
Viewers int `json:"viewers"`
Streamers int `json:"streamers"`
}
type Client ¶
type Client interface {
Stream(username string) (*UserStream, error)
LiveStreams() ([]ListStream, error)
FeaturedStreams() ([]ListStream, error)
TopStreams() ([]ListStream, error)
GrowingStreams() ([]ListStream, error)
Categories() ([]Category, error)
User(username string) (*User, error)
}
type ListStream ¶
type ListStream struct {
ID string `json:"id"`
UserID string `json:"userId"`
Username string `json:"username"`
DisplayName string `json:"displayName"`
Title string `json:"title"`
Category string `json:"category"`
CategorySlug string `json:"categorySlug"`
ViewerCount int `json:"viewerCount"`
Thumbnail string `json:"thumbnail"`
// Avatar has an alternate avatarUrl which is populated with the same data
Avatar string `json:"avatar"`
// Banner has an alternate bannerUrl which is populated the same
Banner string `json:"banner"`
Tags []string `json:"tags"`
SessionTags []string `json:"sessionTags"`
IdentityTags []string `json:"identityTags"`
Language string `json:"language"`
Languages []string `json:"languages"`
StartedAt time.Time `json:"startedAt"`
FollowerCount int `json:"followerCount"`
AccentColor *string `json:"accentColor"`
PlaylistURL string `json:"playlistUrl"`
IsFirstStream bool `json:"isFirstStream"`
ProfileTheme *ProfileTheme `json:"profileTheme"`
IngestSource string `json:"ingestSource"`
}
ListStream is a response type for the listing endpoints, which return different structures than the UserStream endpoint.
type ListStreamResponse ¶
type ListStreamResponse struct {
Streams []ListStream `json:"streams"`
Pagination *Pagination `json:"pagination"`
}
type Pagination ¶
type Pagination struct {
Cursor string `json:"cursor"`
}
type ProfileCanvas ¶
type ProfileFeatured ¶
type ProfileFeatured struct {
ChannelID string `json:"channelId"`
Headline string `json:"headline"`
Tagline string `json:"tagline"`
AccentColor *string `json:"accentColor"`
Stream *ProfileFeaturedStream `json:"stream"`
}
type ProfileFeaturedStream ¶
type ProfileFeaturedStream struct {
ID string `json:"id"`
Username string `json:"username"`
DisplayName string `json:"displayName"`
Title string `json:"title"`
Category string `json:"category"`
ViewerCount int `json:"viewerCount"`
Avatar string `json:"avatar"`
FollowerCount int `json:"followerCount"`
CommunityLabelPlural string `json:"communityLabelPlural"`
IsLive bool `json:"isLive"`
}
type ProfileLink ¶
type ProfileTheme ¶
type ProfileTheme struct {
AccentColor *string `json:"accentColor"`
DerivedAccentColor *string `json:"derivedAccentColor"`
TextureKey *string `json:"textureKey"`
TextureIntensity int `json:"textureIntensity"`
BackgroundEnabled bool `json:"backgroundEnabled"`
CommunityLabelSingular string `json:"communityLabelSingular"`
CommunityLabelPlural string `json:"communityLabelPlural"`
CommunityLabelSingularCustom *string `json:"communityLabelSingularCustom"`
CommunityLabelPluralCustom *string `json:"communityLabelPluralCustom"`
SubscriberLabelSingular string `json:"subscriberLabelSingular"`
SubscriberLabelPlural string `json:"subscriberLabelPlural"`
SubscriberLabelSingularCustom *string `json:"subscriberLabelSingularCustom"`
SubscriberLabelPluralCustom *string `json:"subscriberLabelPluralCustom"`
DisplayFontFamily *string `json:"displayFontFamily"`
DisplayFontVariant *string `json:"displayFontVariant"`
DisplayFontHref *string `json:"displayFontHref"`
DisplayFontSizeDelta float32 `json:"displayFontSizeDelta"`
ChannelPointsNameSingular string `json:"channelPointsNameSingular"`
ChannelPointsNamePlural string `json:"channelPointsNamePlural"`
ChannelPointsNameSingularCustom *string `json:"channelPointsNameSingularCustom"`
ChannelPointsNamePluralCustom *string `json:"channelPointsNamePluralCustom"`
ChannelPointsIcon *string `json:"channelPointsIcon"`
ChannelPointsIconCategory *string `json:"channelPointsIconCategory"`
}
type StreamData ¶
type StreamEvent ¶
type StreamEvent struct {
Channel Channel `json:"channel"`
Stream UserStream `json:"stream"`
}
type User ¶
type User struct {
ID string `json:"id"`
Username string `json:"username"`
DisplayName string `json:"displayName"`
Bio string `json:"bio"`
AvatarURL string `json:"avatarUrl"`
Role string `json:"role"`
Status string `json:"status"`
FollowerCount int `json:"followerCount"`
TotalViews int `json:"totalViews"`
TotalStreamCount int `json:"totalStreamCount"`
TotalStreamHours float64 `json:"totalStreamHours"`
CreatedAt time.Time `json:"createdAt"`
YoutubeConnected bool `json:"youtubeConnected"`
YoutubeChannelID *string `json:"youtubeChannelId"`
StaffBadgeType *string `json:"staffBadgeType"`
StaffBadgeVisible bool `json:"staffBadgeVisible"`
ActiveTeamBadgeID *string `json:"activeTeamBadgeId"`
CanMonetize bool `json:"canMonetize"`
Pronouns string `json:"pronouns"`
PronounsShort string `json:"pronounsShort"`
PronounsInChat bool `json:"pronounsInChat"`
StreamTags []string `json:"streamTags"`
StreamInfo *UserStream `json:"streamInfo"`
IsLive bool `json:"isLive"`
AccentColor string `json:"accentColor"`
AllowEmbed bool `json:"allowEmbed"`
LastLiveAt time.Time `json:"lastLiveAt"`
ProfileTheme *ProfileTheme `json:"profileTheme"`
ProfileLinks []ProfileLink `json:"profileLinks"`
ProfileFeatured []ProfileFeatured `json:"profileFeatured"`
ProfileCanvas *ProfileCanvas `json:"profileCanvas"`
CanvasStudioData interface{} `json:"canvasStudioData"`
Badges []interface{} `json:"badges"`
TeamMemberships []interface{} `json:"teamMemberships"`
}
type UserStream ¶
type UserStream struct {
ID string `json:"id"`
UserID string `json:"userId"`
Username string `json:"username"`
Title string `json:"title"`
Description string `json:"description"` // HTML content
Category string `json:"category"`
CategorySlug string `json:"categorySlug"`
ThumbnailURL string `json:"thumbnailUrl"`
IsLive bool `json:"isLive"`
ViewerCount int `json:"viewerCount"`
StartedAt time.Time `json:"startedAt"`
HLSURL string `json:"hlsUrl"`
WSSignalingURL string `json:"wsSignalingUrl"`
Language string `json:"language"`
IngestOrigin string `json:"ingestOrigin"`
IngestSource string `json:"ingestSource"`
}
UserStream is a stream retrieved by the user stream endpoint /api/streams/user/<username>
Click to show internal directories.
Click to hide internal directories.