Documentation ¶
Index ¶
- Variables
- func ArgumentToKeyPart(keyBuilder *strings.Builder, argument any)
- func SliceArgumentToKeyPart(keyBuilder *strings.Builder, value *reflect.Value)
- type AppTokenResponse
- type AvatarQueryPayload
- type Client
- func (client *Client) CreateAppToken() error
- func (client *Client) DoGQL(queries ...PersistedQuery) ([]PersistedQueryResponse, error)
- func (client *Client) EnableCache(redisAddress string, redisDatabase int)
- func (client *Client) EnsureAppToken() error
- func (client *Client) FetchCached(key string, target any) bool
- func (client *Client) GetAllClipsForBroadcaster(broadcasterID string) ([]Clip, error)
- func (client *Client) GetChannelAvatar(login string) (*AvatarQueryPayload, error)
- func (client *Client) GetClipPlaybackUrl(clipSlug string) (string, error)
- func (client *Client) GetClipsForBroadcaster(broadcasterID string) (*ClipsResponse, error)
- func (client *Client) GetClipsForBroadcasterWithinTimeframe(broadcasterID string, startTime time.Time, endTime time.Time) (*ClipsResponse, error)
- func (client *Client) GetUsersByIDs(userIDs ...string) (*UsersResponse, error)
- func (client *Client) GetUsersByLogins(logins ...string) (*UsersResponse, error)
- func (client *Client) GetVideoHomeShelfForLogin(login string) (*HomeShelfVideoPayload, error)
- func (client *Client) IsAppTokenValid() (bool, error)
- func (client *Client) MakeGetRequest(endpoint string, parameters url.Values, headers url.Values, returnObject any) (int, error)
- func (client *Client) MakeHttpRequest(method string, endpoint string, parameters url.Values, headers url.Values, ...) (int, error)
- func (client *Client) MakePostRequest(endpoint string, parameters url.Values, headers url.Values, payload io.Reader, ...) (int, error)
- func (client *Client) MakeRedisKey(arguments ...any) string
- func (client *Client) SetCached(key string, data any, ttl time.Duration)
- type Clip
- type ClipsQueryPayload
- type ClipsResponse
- type ErrorMeta
- type HomeShelfVideoPayload
- type Pagination
- type PaginationMeta
- type PersistedQuery
- type PersistedQueryExtension
- type PersistedQueryExtensions
- type PersistedQueryResponse
- type PersistedQuerySpec
- type PlaybackAccessToken
- type User
- type UsersResponse
- type V
- type ValidationResponse
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ChannelAvatarQuery = PersistedQuerySpec{OperationName: "ChannelAvatar", Sha256Hash: "84ed918aaa9aaf930e58ac81733f552abeef8ac26c0117746865428a7e5c8ab0"} PlaybackAccessTokenQuery = PersistedQuerySpec{OperationName: "VideoAccessToken_Clip", Sha256Hash: "36b89d2507fce29e5ca551df756d27c1cfe079e2609642b4390aa4c35796eb11"} HomeShelfVideos = PersistedQuerySpec{OperationName: "HomeShelfVideos", Sha256Hash: "d61bcfa277e9c3839fc468031eaf5a73c94726ff8d3155d28fb68c1505b5ab88"} )
Functions ¶
func ArgumentToKeyPart ¶
Types ¶
type AppTokenResponse ¶
type AvatarQueryPayload ¶
type Client ¶
type Client struct { Client http.Client ClientID string ClientSecret string AppToken string TokenExpires time.Time LastTokenCheck time.Time Redis *redis.Client }
func (*Client) CreateAppToken ¶
func (*Client) DoGQL ¶
func (client *Client) DoGQL(queries ...PersistedQuery) ([]PersistedQueryResponse, error)
func (*Client) EnableCache ¶
func (*Client) EnsureAppToken ¶
func (*Client) GetAllClipsForBroadcaster ¶
func (*Client) GetChannelAvatar ¶
func (client *Client) GetChannelAvatar(login string) (*AvatarQueryPayload, error)
func (*Client) GetClipPlaybackUrl ¶
func (*Client) GetClipsForBroadcaster ¶
func (client *Client) GetClipsForBroadcaster(broadcasterID string) (*ClipsResponse, error)
func (*Client) GetClipsForBroadcasterWithinTimeframe ¶
func (*Client) GetUsersByIDs ¶
func (client *Client) GetUsersByIDs(userIDs ...string) (*UsersResponse, error)
func (*Client) GetUsersByLogins ¶
func (client *Client) GetUsersByLogins(logins ...string) (*UsersResponse, error)
func (*Client) GetVideoHomeShelfForLogin ¶
func (client *Client) GetVideoHomeShelfForLogin(login string) (*HomeShelfVideoPayload, error)
func (*Client) IsAppTokenValid ¶
func (*Client) MakeGetRequest ¶
func (*Client) MakeHttpRequest ¶
func (*Client) MakePostRequest ¶
func (*Client) MakeRedisKey ¶
type Clip ¶
type Clip struct { ID string `json:"id,omitempty"` Url string `json:"url,omitempty"` EmbedUrl string `json:"embed_url,omitempty"` BroadcasterId string `json:"broadcaster_id,omitempty"` BroadcasterName string `json:"broadcaster_name,omitempty"` CreatorId string `json:"creator_id,omitempty"` CreatorName string `json:"creator_name,omitempty"` VideoID string `json:"video_id,omitempty"` GameID string `json:"game_id,omitempty"` Language string `json:"language,omitempty"` Title string `json:"title,omitempty"` ViewCount int `json:"view_count,omitempty"` CreatedAt string `json:"created_at,omitempty"` ThumbnailUrl string `json:"thumbnail_url,omitempty"` Duration float64 `json:"duration,omitempty"` VodOffset int `json:"vod_offset,omitempty"` }
type ClipsQueryPayload ¶
type ClipsResponse ¶
type ClipsResponse struct { Data []Clip `json:"data"` PaginationMeta ErrorMeta }
type ErrorMeta ¶
type HomeShelfVideoPayload ¶
type HomeShelfVideoPayload struct { User struct { ID string `json:"ID,omitempty"` VideoShelves struct { Edges []struct { Node struct { ID string `json:"ID,omitempty"` Title string `json:"title,omitempty"` Type string `json:"type,omitempty"` Description string `json:"description,omitempty"` Items []struct { Broadcaster struct { ID string `json:"ID,omitempty"` Login string `json:"login,omitempty"` DisplayName string `json:"displayName,omitempty"` PrimaryColorHex string `json:"primaryColorHex,omitempty"` ProfileImageURL string `json:"profileImageURL,omitempty"` } `json:"broadcaster"` ClipGame struct { ID string `json:"ID,omitempty"` Name string `json:"name,omitempty"` DisplayName string `json:"displayName,omitempty"` BoxArtURL string `json:"boxArtURL,omitempty"` } `json:"clipGame"` ClipTitle string `json:"clipTitle,omitempty"` ClipViewCount int `json:"clipViewCount,omitempty"` CreatedAt string `json:"createdAt,omitempty"` Curator struct { ID string `json:"ID,omitempty"` Login string `json:"login,omitempty"` DisplayName string `json:"displayName,omitempty"` } `json:"curator"` DurationSeconds int `json:"durationSeconds,omitempty"` ID string `json:"ID,omitempty"` IsFeatured bool `json:"isFeatured,omitempty"` Slug string `json:"slug,omitempty"` ThumbnailURL string `json:"thumbnailURL,omitempty"` } `json:"items,omitempty"` } `json:"node"` } `json:"edges"` } `json:"videoShelves"` } `json:"user"` }
type Pagination ¶
type Pagination struct {
Cursor string `json:"cursor"`
}
type PaginationMeta ¶
type PaginationMeta struct {
Pagination Pagination `json:"pagination"`
}
type PersistedQuery ¶
type PersistedQuery struct { OperationName string `json:"operationName"` Extensions PersistedQueryExtensions `json:"extensions"` Variables map[string]any `json:"variables"` }
type PersistedQueryExtension ¶
type PersistedQueryExtensions ¶
type PersistedQueryExtensions struct {
PersistedQuery PersistedQueryExtension `json:"persistedQuery"`
}
type PersistedQueryResponse ¶
type PersistedQueryResponse struct { Data any `json:"data,omitempty"` Extensions struct { DurationMilliseconds int OperationName string `json:"operationName,omitempty"` RequestID string `json:"requestID,omitempty"` } `json:"extensions,omitempty"` }
func (*PersistedQueryResponse) Bind ¶
func (response *PersistedQueryResponse) Bind(target any) error
type PersistedQuerySpec ¶
func (*PersistedQuerySpec) Prepare ¶
func (query *PersistedQuerySpec) Prepare(variables map[string]any) PersistedQuery
type PlaybackAccessToken ¶
type PlaybackAccessToken struct { Authorization struct { Forbidden bool `json:"forbidden,omitempty"` Reason string `json:"reason,omitempty"` } `json:"authorization"` ClipUri string `json:"clip_uri,omitempty"` DeviceID string `json:"device_id,omitempty"` Expires int `json:"expires,omitempty"` UserID string `json:"user_id,omitempty"` Version int `json:"version,omitempty"` }
type User ¶
type User struct { ID string `json:"id,omitempty"` Login string `json:"login,omitempty"` DisplayName string `json:"display_name,omitempty"` Type string `json:"type,omitempty"` BroadcasterType string `json:"broadcaster_type,omitempty"` Description string `json:"description,omitempty"` ProfileImageUrl string `json:"profile_image_url,omitempty"` OfflineImageUrl string `json:"offline_image_url,omitempty"` ViewCould int `json:"view_could,omitempty"` Email string `json:"email,omitempty"` CreatedAt string `json:"created_at,omitempty"` }
type UsersResponse ¶
Source Files ¶
Click to show internal directories.
Click to hide internal directories.