Documentation
¶
Index ¶
- Constants
- Variables
- type Channel
- type Client
- func New() (client *Client)deprecated
- func (client Client) CustomMutation(ctx context.Context, mutation interface{}, vars map[string]interface{}) error
- func (client Client) CustomQuery(ctx context.Context, query interface{}, vars map[string]interface{}) error
- func (client Client) GetChannelsByID(ctx context.Context, ids ...string) ([]Channel, error)
- func (client Client) GetChannelsByName(ctx context.Context, names ...string) ([]Channel, error)
- func (client Client) GetClipBySlug(ctx context.Context, slug string) (*Clip, error)
- func (client Client) GetCurrentUser(ctx context.Context) (*User, error)
- func (client Client) GetFollowersForChannel(ctx context.Context, channel Channel, opts FollowQueryOpts) (*FollowersQuery, error)
- func (client Client) GetFollowersForUser(ctx context.Context, user User, opts FollowQueryOpts) (*FollowersQuery, error)
- func (client Client) GetGames(ctx context.Context, opts GameQueryOpts) (*GamesQuery, error)
- func (client Client) GetModsForChannel(ctx context.Context, channel Channel, opts ModsQueryOpts) (*ModsQuery, error)
- func (client Client) GetModsForUser(ctx context.Context, user User, opts ModsQueryOpts) (*ModsQuery, error)
- func (client Client) GetStreams(ctx context.Context, opts StreamQueryOpts) (*StreamsQuery, error)
- func (client Client) GetUsersByID(ctx context.Context, ids ...string) ([]User, error)
- func (client Client) GetUsersByLogin(ctx context.Context, logins ...string) ([]User, error)
- func (client Client) GetVIPsForChannel(ctx context.Context, channel Channel, opts VIPsQueryOpts) (*VIPsQuery, error)
- func (client Client) GetVIPsForUser(ctx context.Context, user User, opts VIPsQueryOpts) (*VIPsQuery, error)
- func (client Client) GetVideos(ctx context.Context, opts VideoQueryOpts) (*VideosQuery, error)
- func (client Client) GetVideosByChannel(ctx context.Context, channel Channel, opts VideoQueryOpts) (*VideosQuery, error)
- func (client Client) GetVideosByUser(ctx context.Context, user User, opts VideoQueryOpts) (*VideosQuery, error)
- func (client *Client) IsUsernameAvailable(ctx context.Context, username string) (bool, error)
- func (client *Client) SetBearer(token string)
- type Clip
- type Cursor
- type FollowQueryOpts
- type FollowersQuery
- type GQLChannelIDsQuery
- type GQLChannelNamesQuery
- type GQLClipQuery
- type GQLCurrentUserQuery
- type GQLFollowersQuery
- type GQLGamesQuery
- type GQLModsQuery
- type GQLStreamsQuery
- type GQLUserIDsQuery
- type GQLUserLoginsQuery
- type GQLUserVideosQuery
- type GQLUsernameAvailabilityQuery
- type GQLVIPsQuery
- type GQLVideosQuery
- type Game
- type GameOptions
- type GameQueryOpts
- type GamesQuery
- type ModsQuery
- type ModsQueryOpts
- type PageInfo
- type Stream
- type StreamOptions
- type StreamQueryOpts
- type StreamsQuery
- type User
- type VIPsQuery
- type VIPsQueryOpts
- type Video
- type VideoQueryOpts
- type VideosQuery
Constants ¶
const URL = "https://gql.twitch.tv/gql"
URL is the address for the GraphQL server
Variables ¶
var ( // ErrInvalidArgument returned when an argument is invalid ErrInvalidArgument = errors.New("one or more arguments are invalid") // ErrTokenNotSet returned when a method requires an authorization token but no token is set ErrTokenNotSet = errors.New("missing authorization token") // ErrTooManyArguments returned when a method receives more arguments than allowed by the GraphQL server ErrTooManyArguments = errors.New("too many arguments provided") )
Functions ¶
This section is empty.
Types ¶
type Channel ¶
type Channel struct { ID graphql.ID Name string `graphql:"login"` DisplayName string URL string `graphql:"profileURL"` BannerImageURL string `graphql:"bannerImageURL"` OfflineImageURL string `graphql:"offlineImageURL"` ChatColor string Description string ProfileViewCount int32 BroadcastSettings struct { Title string Game *Game Language string IsMature bool LiveNotification *struct { IsDefault bool Text string `graphql:"liveUpNotification"` } `graphql:"liveUpNotificationInfo"` } ChatSettings struct { Rules []string IsFastSubsModeEnabled bool IsLinksBlocked bool `graphql:"blockLinks"` IsVerifiedAccountRequired bool `graphql:"requireVerifiedAccount"` IsSubOnly bool `graphql:"isSubscribersOnlyModeEnabled"` IsEmoteOnly bool `graphql:"isEmoteOnlyModeEnabled"` IsUniqueModeEnabled bool `graphql:"isUniqueChatModeEnabled"` SlowModeDurationInSeconds int32 `graphql:"slowModeDurationSeconds"` FollowersOnlyDurationInMinutes int32 `graphql:"followersOnlyDurationMinutes"` ChatDelayInMilliseconds int32 `graphql:"chatDelayMs"` } Roles struct { IsAffiliate bool IsPartner bool IsExtensionsDeveloper bool IsGlobalMod bool IsStaff bool IsSiteAdmin bool } CreatedAt time.Time UpdatedAt time.Time }
Channel stores data about a users channel on Twitch
type Client ¶
type Client struct { ID string // contains filtered or unexported fields }
Client stores data about a GraphQL client
func (Client) CustomMutation ¶
func (client Client) CustomMutation(ctx context.Context, mutation interface{}, vars map[string]interface{}) error
CustomMutation executes a mutation on the GraphQL server
func (Client) CustomQuery ¶
func (client Client) CustomQuery(ctx context.Context, query interface{}, vars map[string]interface{}) error
CustomQuery executes a query on the GraphQL server
func (Client) GetChannelsByID ¶
GetChannelsByID retrieves an array of channels from Twitch based on their IDs
func (Client) GetChannelsByName ¶
GetChannelsByName retrieves an array of channels from Twitch based on their names
func (Client) GetClipBySlug ¶
GetClipBySlug retrieves data about a clip available on Twitch by its slug
func (Client) GetCurrentUser ¶
GetCurrentUser retrieves the current user based on the clients authentication token
func (Client) GetFollowersForChannel ¶
func (client Client) GetFollowersForChannel(ctx context.Context, channel Channel, opts FollowQueryOpts) (*FollowersQuery, error)
GetFollowersForChannel retrieves data about who follows the provided channel on Twitch
func (Client) GetFollowersForUser ¶
func (client Client) GetFollowersForUser(ctx context.Context, user User, opts FollowQueryOpts) (*FollowersQuery, error)
GetFollowersForUser retrieves data about who follows the provided user on Twitch
func (Client) GetGames ¶
func (client Client) GetGames(ctx context.Context, opts GameQueryOpts) (*GamesQuery, error)
GetGames retrieves data about games available on Twitch
func (Client) GetModsForChannel ¶
func (client Client) GetModsForChannel(ctx context.Context, channel Channel, opts ModsQueryOpts) (*ModsQuery, error)
GetModsForChannel retrieves data about who is a moderator for the provided channel on Twitch
func (Client) GetModsForUser ¶
func (client Client) GetModsForUser(ctx context.Context, user User, opts ModsQueryOpts) (*ModsQuery, error)
GetModsForUser retrieves data about who is a moderator for the provided user on Twitch
func (Client) GetStreams ¶
func (client Client) GetStreams(ctx context.Context, opts StreamQueryOpts) (*StreamsQuery, error)
GetStreams retrieves data about streams available on Twitch
func (Client) GetUsersByID ¶
GetUsersByID retrieves an array of users from Twitch based on their User IDs
func (Client) GetUsersByLogin ¶
GetUsersByLogin retrieves an array of users from Twitch based on their usernames
func (Client) GetVIPsForChannel ¶
func (client Client) GetVIPsForChannel(ctx context.Context, channel Channel, opts VIPsQueryOpts) (*VIPsQuery, error)
GetVIPsForChannel retrieves data about who is a VIP for the provided channel on Twitch
func (Client) GetVIPsForUser ¶
func (client Client) GetVIPsForUser(ctx context.Context, user User, opts VIPsQueryOpts) (*VIPsQuery, error)
GetVIPsForUser retrieves data about who is a VIP for the provided user on Twitch
func (Client) GetVideos ¶
func (client Client) GetVideos(ctx context.Context, opts VideoQueryOpts) (*VideosQuery, error)
GetVideos retrieves videos on Twitch
func (Client) GetVideosByChannel ¶
func (client Client) GetVideosByChannel(ctx context.Context, channel Channel, opts VideoQueryOpts) (*VideosQuery, error)
GetVideosByChannel retrieves videos on Twitch based on the provided channel
func (Client) GetVideosByUser ¶
func (client Client) GetVideosByUser(ctx context.Context, user User, opts VideoQueryOpts) (*VideosQuery, error)
GetVideosByUser retrieves videos on Twitch based on the provided user
func (*Client) IsUsernameAvailable ¶
IsUsernameAvailable returns true if the provided username is not taken on Twitch
type Clip ¶
type Clip struct { ID string Slug string Title string ViewCount int32 Broadcaster User Author User `graphql:"curator"` Game Game Video *Video URL string DurationSeconds int32 VideoOffsetSeconds int32 CreatedAt time.Time }
Clip stores data about a section of a Twitch stream.
type FollowQueryOpts ¶
FollowQueryOpts stores various options for querying followers on Twitch
type FollowersQuery ¶
type FollowersQuery struct { TotalCount int32 Followers []struct { User User `graphql:"node"` FollowedAt time.Time Cursor Cursor } `graphql:"edges"` PageInfo PageInfo }
FollowersQuery stores data returned from GQLFollowersQuery
type GQLChannelIDsQuery ¶
type GQLChannelIDsQuery struct {
Data []Channel `graphql:"users(ids: $ids)"`
}
GQLChannelIDsQuery GraphQL query for 1-100 Channels by their IDs
type GQLChannelNamesQuery ¶
type GQLChannelNamesQuery struct {
Data []Channel `graphql:"users(logins: $names)"`
}
GQLChannelNamesQuery GraphQL query for 1-100 Channels by name
type GQLClipQuery ¶
type GQLClipQuery struct {
Data *Clip `graphql:"clip(slug: $slug)"`
}
GQLClipQuery GraphQL query for a clip on Twitch
type GQLCurrentUserQuery ¶
type GQLCurrentUserQuery struct {
Data *User `graphql:"currentUser"`
}
GQLCurrentUserQuery GraphQL query for current authenticated user
type GQLFollowersQuery ¶
type GQLFollowersQuery struct { Data *struct { Followers *FollowersQuery `graphql:"followers(first: $first, after: $after)"` } `graphql:"user(id: $id)"` }
GQLFollowersQuery GraphQL query for a users followers on Twitch
type GQLGamesQuery ¶
type GQLGamesQuery struct {
Data *GamesQuery `graphql:"games(first: $first, after: $after, options: $options)"`
}
GQLGamesQuery GraphQL query for games on Twitch
type GQLModsQuery ¶
type GQLModsQuery struct { Data *struct { Mods *ModsQuery `graphql:"mods(first: $first, after: $after)"` } `graphql:"user(id: $id)"` }
GQLModsQuery GraphQL query for getting mods for a user on Twitch
type GQLStreamsQuery ¶
type GQLStreamsQuery struct {
Data *StreamsQuery `graphql:"streams(first: $first, after: $after, options: $options)"`
}
GQLStreamsQuery GraphQL query for streams on Twitch
type GQLUserIDsQuery ¶
type GQLUserIDsQuery struct {
Data []User `graphql:"users(ids: $ids)"`
}
GQLUserIDsQuery GraphQL query for 1-100 Users by their IDs
type GQLUserLoginsQuery ¶
type GQLUserLoginsQuery struct {
Data []User `graphql:"users(logins: $logins)"`
}
GQLUserLoginsQuery GraphQL query for 1-100 Users by their usernames
type GQLUserVideosQuery ¶
type GQLUserVideosQuery struct { Data *struct { Videos *VideosQuery `graphql:"videos(first: $first, after: $after, sort: TIME)"` } `graphql:"user(id: $id)"` }
GQLUserVideosQuery GraphQL query for a users videos on Twitch
type GQLUsernameAvailabilityQuery ¶
type GQLUsernameAvailabilityQuery struct {
IsAvailable bool `graphql:"isUsernameAvailable(username: $username)"`
}
GQLUsernameAvailabilityQuery GraphQL query to check if a username is available on Twitch
type GQLVIPsQuery ¶
type GQLVIPsQuery struct { Data *struct { VIPs *VIPsQuery `graphql:"vips(first: $first, after: $after)"` } `graphql:"user(id: $id)"` }
GQLVIPsQuery GraphQL query for getting VIPs for a user on Twitch
type GQLVideosQuery ¶
type GQLVideosQuery struct {
Data *VideosQuery `graphql:"videos(first: $first, after: $after)"`
}
GQLVideosQuery GraphQL query for videos on Twitch
type Game ¶
type Game struct { ID graphql.ID Name string DisplayName string BroadcastersCount int32 ViewersCount int32 FollowersCount int32 PopularityScore int32 GiantBombID graphql.ID `graphql:"giantBombID"` PrestoID graphql.ID `graphql:"prestoID"` }
Game stores data about a category on Twitch
type GameOptions ¶
GameOptions stores various options for querying games on Twitch
type GameQueryOpts ¶
type GameQueryOpts struct { First int32 After Cursor Options GameOptions }
GameQueryOpts stores various options for querying games on Twitch
type GamesQuery ¶
type GamesQuery struct { Games []struct { TrackingID graphql.ID `graphql:"trackingID"` Game Game `graphql:"node"` Cursor Cursor } `graphql:"edges"` PageInfo PageInfo }
GamesQuery stores data returned from GQLGamesQuery
type ModsQuery ¶
type ModsQuery struct { Mods []struct { User User `graphql:"node"` IsActive bool GrantedAt time.Time Cursor Cursor } `graphql:"edges"` PageInfo PageInfo }
ModsQuery stores data returned from GQLUserModsQuery and GQLChannelModsQuery
type ModsQueryOpts ¶
ModsQueryOpts stores various options for querying mods on Twitch
type Stream ¶
type Stream struct { ID graphql.ID ViewersCount int32 Channel *Channel `graphql:"broadcaster"` Game *Game BroadcasterSoftware string AverageFPS float64 `graphql:"averageFPS"` Bitrate float64 Codec string Type string CreatedAt time.Time UpdatedAt time.Time `graphql:"lastUpdatedAt"` }
Stream stores data about a livestream on Twitch
type StreamOptions ¶
StreamOptions stores various options for querying streams on Twitch
type StreamQueryOpts ¶
type StreamQueryOpts struct { First int32 After Cursor Options StreamOptions }
StreamQueryOpts stores various options for querying streams on Twitch
type StreamsQuery ¶
type StreamsQuery struct { ResponseID graphql.ID `graphql:"responseID"` GenerationID graphql.ID `graphql:"generationID"` Streams []struct { TrackingID graphql.ID `graphql:"trackingID"` Stream Stream `graphql:"node"` Cursor Cursor } `graphql:"edges"` PageInfo PageInfo }
StreamsQuery stores data returned from GQLStreamsQuery
type User ¶
type User struct { ID graphql.ID Login string DisplayName string ChannelURL string `graphql:"profileURL"` BannerImageURL string `graphql:"bannerImageURL"` OfflineImageURL string `graphql:"offlineImageURL"` ChatColor string Description string ProfileViewCount int32 Stream *Stream Hosting *struct { Channel Stream Stream } Roles struct { IsAffiliate bool IsPartner bool IsExtensionsDeveloper bool IsGlobalMod bool IsStaff bool IsSiteAdmin bool } HasPrime bool HasTurbo bool CreatedAt time.Time UpdatedAt time.Time DeletedAt time.Time }
User stores data about a user on Twitch
type VIPsQuery ¶
type VIPsQuery struct { VIPs []struct { User User `graphql:"node"` GrantedAt time.Time Cursor Cursor } `graphql:"edges"` PageInfo PageInfo }
VIPsQuery stores data returned from GQLUserVIPsQuery and GQLChannelVIPsQuery
type VIPsQueryOpts ¶
VIPsQueryOpts stores various options for querying vips on Twitch
type Video ¶
type Video struct { ID string Title string Description string ViewCount int32 AnimatedPreviewURL string `graphql:"animatedPreviewURL"` SeekPreviewsURL string `graphql:"seekPreviewsURL"` Owner User Game Game Tags []string OffsetSeconds int32 LengthInSeconds int32 `graphql:"lengthSeconds"` PublishedAt time.Time CreatedAt time.Time UpdatedAt time.Time }
Video stores data about a streams VOD on Twitch.
type VideoQueryOpts ¶
VideoQueryOpts stores various options for querying videos on Twitch