helix

package
v0.0.7 Latest Latest
Warning

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

Go to latest
Published: Jun 18, 2021 License: MIT Imports: 8 Imported by: 0

Documentation

Overview

Package helix handles interactions with twitch via the TAU pass through.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AuthorizationError

type AuthorizationError struct {
	// contains filtered or unexported fields
}

AuthorizationError represents an Unauthorized response from Twitch

func (AuthorizationError) Error

func (a AuthorizationError) Error() string

type BadRequestError

type BadRequestError struct {
	// contains filtered or unexported fields
}

BadRequestError represents bad inputs from an application trying to make an API request to twitch based on their documented limitations

func (BadRequestError) Error

func (b BadRequestError) Error() string

type BannedEvents

type BannedEvents struct {
	Data []struct {
		ID             string    `json:"id"`
		EventType      string    `json:"event_type"`
		EventTimestamp time.Time `json:"event_timestamp"`
		Version        string    `json:"version"`
		EventData      struct {
			BroadcasterID    string `json:"broadcaster_id"`
			BroadcasterLogin string `json:"broadcaster_login"`
			BroadcasterName  string `json:"broadcaster_name"`
			UserID           string `json:"user_id"`
			UserLogin        string `json:"user_login"`
			UserName         string `json:"user_name"`
			ExpiresAt        string `json:"expires_at"`
		} `json:"event_data"`
	} `json:"data"`
	Pagination *TwitchPagination `json:"pagination"`
}

BannedEvents represents the response from Get Banned Events, see https://dev.twitch.tv/docs/api/reference#get-banned-events

type BannedUsers

type BannedUsers struct {
	Data []struct {
		UserID    string    `json:"user_id"`
		UserLogin string    `json:"user_login"`
		UserName  string    `json:"user_name"`
		ExpiresAt time.Time `json:"expires_at"`
	} `json:"data"`
	Pagination *TwitchPagination `json:"pagination"`
}

BannedUsers represents the response from Get Banned Users, see https://dev.twitch.tv/docs/api/reference#get-banned-users

type BitsLeaderboard

type BitsLeaderboard struct {
	Data []struct {
		UserID    string `json:"user_id"`
		UserLogin string `json:"user_login"`
		UserName  string `json:"user_name"`
		Rank      int    `json:"rank"`
		Score     int    `json:"score"`
	} `json:"data"`
	DateRange struct {
		StartedAt time.Time `json:"started_at"`
		EndedAt   time.Time `json:"ended_at"`
	} `json:"date_range"`
	Total int `json:"total"`
}

BitsLeaderboard represents the response from Get Bits Leaderboard, see https://dev.twitch.tv/docs/api/reference#get-bits-leaderboard

type ChannelChatBadges

type ChannelChatBadges struct {
	Data []struct {
		SetID    string `json:"set_id"`
		Versions []struct {
			ID         string `json:"id"`
			ImageUrl1X string `json:"image_url_1x"`
			ImageUrl2X string `json:"image_url_2x"`
			ImageUrl4X string `json:"image_url_4x"`
		} `json:"versions"`
	} `json:"data"`
}

ChannelChatBadges represents the respons from Get Channel Chat Badges or Get Global Chat Badges, see https://dev.twitch.tv/docs/api/reference#get-channel-chat-badges

type ChannelEditors

type ChannelEditors struct {
	Data []struct {
		UserID    string    `json:"user_id"`
		UserName  string    `json:"user_name"`
		CreatedAt time.Time `json:"created_at"`
	} `json:"data"`
}

ChannelEditors represents the response from Get Channel Editors, see https://dev.twitch.tv/docs/api/reference#get-channel-editors

type ChannelInformation

type ChannelInformation struct {
	Data []struct {
		BroadcasterID       string `json:"broadcaster_id"`
		BroadcasterLogin    string `json:"broadcaster_login"`
		BroadcasterName     string `json:"broadcaster_name"`
		BroadcasterLanguage string `json:"broadcaster_language"`
		GameID              string `json:"game_id"`
		GameName            string `json:"game_name"`
		Title               string `json:"title"`
		Delay               int    `json:"delay"`
	} `json:"data"`
}

ChannelInformation represents the response from Get Channel Information, see https://dev.twitch.tv/docs/api/reference#get-channel-information

type ChannelSearchResults

type ChannelSearchResults struct {
	Data []struct {
		BroadcasterLanguage string   `json:"broadcaster_language"`
		BroadcasterLogin    string   `json:"broadcaster_login"`
		DisplayName         string   `json:"display_name"`
		GameID              string   `json:"game_id"`
		GameName            string   `json:"game_name"`
		ID                  string   `json:"id"`
		IsLive              bool     `json:"is_live"`
		TagIDs              []string `json:"tag_ids"`
		ThumbnailUrl        string   `json:"thumbnail_url"`
		Title               string   `json:"title"`
		StartedAt           string   `json:"started_at"`
	} `json:"data"`
	Pagination *TwitchPagination `json:"pagination"`
}

ChannelSearchResults represents the response from Search Channels, see https://dev.twitch.tv/docs/api/reference#search-channels

type ChannelStreamSchedule added in v0.0.7

type ChannelStreamSchedule struct {
	Data struct {
		Segments []struct {
			ID            string     `json:"id"`
			StartTime     time.Time  `json:"start_time"`
			EndTime       time.Time  `json:"end_time"`
			Title         string     `json:"title"`
			CanceledUntil *time.Time `json:"canceled_until"`
			Category      struct {
				Id   string `json:"id"`
				Name string `json:"name"`
			} `json:"category"`
			IsRecurring bool `json:"is_recurring"`
		} `json:"segments"`
		BroadcasterId    string    `json:"broadcaster_id"`
		BroadcasterName  string    `json:"broadcaster_name"`
		BroadcasterLogin string    `json:"broadcaster_login"`
		Vacation         *Vacation `json:"vacation"`
	} `json:"data"`
	Pagination *TwitchPagination `json:"pagination"`
}

ChannelStreamSchedule represents the stream schedule data

type ChannelTeams

type ChannelTeams struct {
	Data []struct {
		BroadcasterID      string    `json:"broadcaster_id"`
		BroadcasterName    string    `json:"broadcaster_name"`
		BroadcasterLogin   string    `json:"broadcaster_login"`
		BackgroundImageUrl string    `json:"background_image_url"`
		Banner             string    `json:"banner"`
		CreatedAt          time.Time `json:"created_at"`
		UpdatedAt          time.Time `json:"updated_at"`
		Info               string    `json:"info"`
		ThumbnailUrl       string    `json:"thumbnail_url"`
		TeamName           string    `json:"team_name"`
		TeamDisplayName    string    `json:"team_display_name"`
		ID                 string    `json:"id"`
	} `json:"data"`
}

ChannelTeams represents the response from Get Channel Teams, see https://dev.twitch.tv/docs/api/reference#get-channel-teams

type CheermotesList

type CheermotesList struct {
	Data []struct {
		Prefix string `json:"prefix"`
		Tiers  []struct {
			MinBits int    `json:"min_bits"`
			ID      string `json:"id"`
			Color   string `json:"color"`
			Images  struct {
				Dark struct {
					Animated struct {
						One          string `json:"1"`
						OnePointFive string `json:"1.5"`
						Two          string `json:"2"`
						Three        string `json:"3"`
						Four         string `json:"4"`
					} `json:"animated"`
					Static struct {
						One          string `json:"1"`
						OnePointFive string `json:"1.5"`
						Two          string `json:"2"`
						Three        string `json:"3"`
						Four         string `json:"4"`
					} `json:"static"`
				} `json:"dark"`
				Light struct {
					Animated struct {
						One          string `json:"1"`
						OnePointFive string `json:"1.5"`
						Two          string `json:"2"`
						Three        string `json:"3"`
						Four         string `json:"4"`
					} `json:"animated"`
					Static struct {
						One          string `json:"1"`
						OnePointFive string `json:"1.5"`
						Two          string `json:"2"`
						Three        string `json:"3"`
						Four         string `json:"4"`
					} `json:"static"`
				} `json:"light"`
			} `json:"images"`
			CanCheer       bool `json:"can_cheer"`
			ShowInBitsCard bool `json:"show_in_bits_card"`
		} `json:"tiers"`
		Type         string    `json:"type"`
		Order        int       `json:"order"`
		LastUpdated  time.Time `json:"last_updated"`
		IsCharitable bool      `json:"is_charitable"`
	} `json:"data"`
}

CheermotesList represents the response from Get Cheermotes, see https://dev.twitch.tv/docs/api/reference#get-cheermotes

type Client

type Client struct {
	// contains filtered or unexported fields
}

Client for interacting with the TAU Helix pass thru, storing the important credential information.

func NewClient

func NewClient(hostname string, port int, token string, hasSSL bool) (*Client, error)

NewClient will generate a new client for interacting with the twitch helix api using the TAU pass thru. Currently never returns an error but could in the future so including for changes to be less likely to be breaking.

func (*Client) CheckUserSubscription

func (c *Client) CheckUserSubscription(broadcasterID, userID string) (*UserSubscriptions, error)

CheckUserSubscription makes an api call to https://dev.twitch.tv/docs/api/reference#check-user-subscription, and formats the data.

func (*Client) CreateChannelStreamScheduleSegment added in v0.0.7

func (c *Client) CreateChannelStreamScheduleSegment(broadcasterID string, segment *StreamScheduleSegmentUpdate) (*ChannelStreamSchedule, error)

CreateChannelStreamScheduleSegment can be used to create a new scheduled stream, see https://dev.twitch.tv/docs/api/reference#create-channel-stream-schedule-segment

func (*Client) CreateClip added in v0.0.7

func (c *Client) CreateClip(broadcasterID string, hasDelay bool) (string, string, error)

CreateClip allows you to create clips, see https://dev.twitch.tv/docs/api/reference#create-clip

func (*Client) CreateCustomReward added in v0.0.7

func (c *Client) CreateCustomReward(broadcasterID string, customReward *CustomRewardsUpdate) (*CustomRewards, error)

CreateCustomReward is used to create custom channel point rewards, see https://dev.twitch.tv/docs/api/reference#create-custom-rewards.

func (*Client) CreatePoll added in v0.0.7

func (c *Client) CreatePoll(poll *CreatePoll) (*Polls, error)

CreatePoll can be used to create a poll on your channel, see https://dev.twitch.tv/docs/api/reference#create-poll

func (*Client) CreatePrediction added in v0.0.7

func (c *Client) CreatePrediction(prediction *CreatePrediction) (*Predictions, error)

CreatePrediction allows you to create predictions for your viewers to bet on with channel points. See https://dev.twitch.tv/docs/api/reference#create-prediction

func (*Client) CreateUserFollows added in v0.0.7

func (c *Client) CreateUserFollows(fromID, toID string, allowNotifications bool) (bool, error)

CreateUserFollows allows you to follow a user, see https://dev.twitch.tv/docs/api/reference#create-user-follows

func (*Client) DeleteChannelStreamScheduleSegment added in v0.0.7

func (c *Client) DeleteChannelStreamScheduleSegment(broadcasterID, ID string) (bool, error)

DeleteChannelStreamScheduleSegment makes an api call to https://dev.twitch.tv/docs/api/reference#delete-channel-stream-schedule-segment, and formats the data.

func (*Client) DeleteCustomReward added in v0.0.7

func (c *Client) DeleteCustomReward(broadcasterID, ID string) (bool, error)

DeleteCustomReward makes an api call to https://dev.twitch.tv/docs/api/reference#delete-custom-reward, and formats the data.

func (*Client) DeleteEventSubSubscription added in v0.0.7

func (c *Client) DeleteEventSubSubscription(ID string) (bool, error)

DeleteEventSubSubscription makes an api call to https://dev.twitch.tv/docs/api/reference#delete-eventsub-subscription, and formats the data.

func (*Client) DeleteRequest added in v0.0.7

func (c *Client) DeleteRequest(endpoint string, params map[string][]string) (bool, error)

DeleteRequest runs a raw GET request against the twitch helix pass thru, and returns true if the delete worked.

func (*Client) DeleteUserFollows added in v0.0.7

func (c *Client) DeleteUserFollows(fromID, toID string) (bool, error)

DeleteUserFollows makes an api call to https://dev.twitch.tv/docs/api/reference#delete-user-follows, and formats the data.

func (*Client) DeleteVideos added in v0.0.7

func (c *Client) DeleteVideos(IDs []string) (bool, error)

DeleteVideos makes an api call to https://dev.twitch.tv/docs/api/reference#delete-videos, and formats the data.

func (*Client) EndPoll added in v0.0.7

func (c *Client) EndPoll(broadcasterID, pollID, status string) (*Polls, error)

EndPoll allows you to end/archive a poll, see https://dev.twitch.tv/docs/api/reference#end-poll

func (*Client) EndPrediction added in v0.0.7

func (c *Client) EndPrediction(broadcasterID, predictionID, status string, winningOutcome *string) (*Predictions, error)

EndPrediction allows you to lock/payout/cancel a prediction, see https://dev.twitch.tv/docs/api/reference#end-prediction

func (*Client) GetAllStreamTags

func (c *Client) GetAllStreamTags(after string, count int, tagIDs []string) (*StreamTags, error)

GetAllStreamTags makes an api call to https://dev.twitch.tv/docs/api/reference#get-all-stream-tags, and formats the data.

func (*Client) GetBannedEvents

func (c *Client) GetBannedEvents(broadcasterID, userID, after string, count int) (*BannedEvents, error)

GetBannedEvents makes an api call to https://dev.twitch.tv/docs/api/reference#get-banned-events, and formats the data.

func (*Client) GetBitsLeaderboard

func (c *Client) GetBitsLeaderboard(count int, period string, startedAt *time.Time, userID string) (*BitsLeaderboard, error)

GetBitsLeaderboard makes an api call to https://dev.twitch.tv/docs/api/reference#get-bits-leaderboard and formats the data.

func (*Client) GetBroadcasterSubscriptions

func (c *Client) GetBroadcasterSubscriptions(broadcasterID string, userIDs []string, after string, count int) (*Subscriptions, error)

GetBroadcasterSubscriptions makes an api call to https://dev.twitch.tv/docs/api/reference#get-stream-markers, and formats the data.

func (*Client) GetChannelChatBadges

func (c *Client) GetChannelChatBadges(broadcasterID string) (*ChannelChatBadges, error)

GetChannelChatBadges makes an api call to https://dev.twitch.tv/docs/api/reference#get-channel-chat-badges and formats the data.

func (*Client) GetChannelEditors

func (c *Client) GetChannelEditors(broadcasterID string) (*ChannelEditors, error)

GetChannelEditors makes an api call to https://dev.twitch.tv/docs/api/reference#get-channel-editors and formats the data.

func (*Client) GetChannelInformation

func (c *Client) GetChannelInformation(broadcasterID string) (*ChannelInformation, error)

GetChannelInformation makes an api call to https://dev.twitch.tv/docs/api/reference#get-channel-information and formats the data.

func (*Client) GetChannelStreamSchedule added in v0.0.7

func (c *Client) GetChannelStreamSchedule(broadcasterID string, IDs []string, startTime *time.Time,
	utcOffset, count int, after string) (*ChannelStreamSchedule, error)

GetChannelStreamSchedule makes an api call to https://dev.twitch.tv/docs/api/reference#get-channel-stream-schedule, and formats the data.

func (*Client) GetChannelStreamScheduleAsICal added in v0.0.7

func (c *Client) GetChannelStreamScheduleAsICal(broadcasterID string) ([]byte, error)

GetChannelStreamScheduleAsICal gets the iCal format schedule for a stream. This is returned as a []byte to allow for use with your iCal library of choice. See https://dev.twitch.tv/docs/api/reference#get-channel-icalendar.

func (*Client) GetChannelTeams

func (c *Client) GetChannelTeams(broadcasterID string) (*ChannelTeams, error)

GetChannelTeams makes an api call to https://dev.twitch.tv/docs/api/reference#get-channel-teams, and formats the data.

func (*Client) GetCheermotes

func (c *Client) GetCheermotes(broadcasterID string) (*CheermotesList, error)

GetCheermotes makes an api call to https://dev.twitch.tv/docs/api/reference#get-cheermotes and formats the data.

func (*Client) GetClipsByBroadcaster

func (c *Client) GetClipsByBroadcaster(broadcasterID, after, before string, startedAt,
	endedAt *time.Time, count int) (*Clips, error)

GetClipsByBroadcaster makes an api call to https://dev.twitch.tv/docs/api/reference#get-clips based on broadcaster, and formats the data.

func (*Client) GetClipsByGame

func (c *Client) GetClipsByGame(gameID, after, before string, startedAt,
	endedAt *time.Time, count int) (*Clips, error)

GetClipsByGame makes an api call to https://dev.twitch.tv/docs/api/reference#get-clips based on game, and formats the data.

func (*Client) GetClipsByID

func (c *Client) GetClipsByID(clipID []string, after, before string, startedAt,
	endedAt *time.Time, count int) (*Clips, error)

GetClipsByID makes an api call to https://dev.twitch.tv/docs/api/reference#get-clips based on clip id, and formats the data.

func (*Client) GetCustomRewardRedemption

func (c *Client) GetCustomRewardRedemption(broadcasterID string, rewardID string, redemptionID []string,
	status string, sort string, cursor string, resultCount int) (*CustomRewardRedemptions, error)

GetCustomRewardRedemption makes an api call to https://dev.twitch.tv/docs/api/reference#get-custom-reward-redemption and formats the data.

func (*Client) GetCustomRewards

func (c *Client) GetCustomRewards(broadcasterID string, rewardID []string, onlyManageableRewards bool) (*CustomRewards, error)

GetCustomRewards makes an api call to https://dev.twitch.tv/docs/api/reference#get-custom-reward and formats the data.

func (*Client) GetEventSubSubscriptions

func (c *Client) GetEventSubSubscriptions(status, eventType string) (*EventSubSubscriptions, error)

GetEventSubSubscriptions makes an api call to https://dev.twitch.tv/docs/api/reference#get-eventsub-subscriptions, and formats the data.

func (*Client) GetFollowedStreams

func (c *Client) GetFollowedStreams(userID, after string, count int) (*Streams, error)

GetFollowedStreams makes an api call to https://dev.twitch.tv/docs/api/reference#get-followed-streams, and formats the data.

func (*Client) GetGames

func (c *Client) GetGames(ids, names []string) (*Games, error)

GetGames makes an api call to https://dev.twitch.tv/docs/api/reference#get-games, and formats the data.

func (*Client) GetGlobalChatBadges

func (c *Client) GetGlobalChatBadges() (*ChannelChatBadges, error)

GetGlobalChatBadges makes an api call to https://dev.twitch.tv/docs/api/reference#get-global-chat-badges and formats the data.

func (*Client) GetHypeTrainEvents

func (c *Client) GetHypeTrainEvents(broadcasterID string, count int, id, cursor string) (*HypeTrainEvents, error)

GetHypeTrainEvents makes an api call to https://dev.twitch.tv/docs/api/reference#get-hype-train-events, and formats the data.

func (*Client) GetModeratorEvents

func (c *Client) GetModeratorEvents(broadcasterID string, userIDs []string, after string, count int) (*ModeratorEvents, error)

GetModeratorEvents makes an api call to https://dev.twitch.tv/docs/api/reference#get-moderator-events, and formats the data.

func (*Client) GetModerators

func (c *Client) GetModerators(broadcasterID string, userIDs []string, after string, count int) (*Moderators, error)

GetModerators makes an api call to https://dev.twitch.tv/docs/api/reference#get-moderators, and formats the data.

func (*Client) GetPolls

func (c *Client) GetPolls(broadcasterID string, IDs []string, after string, count int) (*Polls, error)

GetPolls makes an api call to https://dev.twitch.tv/docs/api/reference#get-polls, and formats the data.

func (*Client) GetPredictions

func (c *Client) GetPredictions(broadcasterID string, IDs []string, after string, count int) (*Predictions, error)

GetPredictions makes an api call to https://dev.twitch.tv/docs/api/reference#get-predictions, and formats the data.

func (*Client) GetRequest

func (c *Client) GetRequest(endpoint string, queryParams map[string][]string) ([]byte, error)

GetRequest runs a raw GET request against the twitch helix pass thru, and returns the []byte of the data.

func (*Client) GetStreamKey

func (c *Client) GetStreamKey(broadcasterID string) (*StreamKey, error)

GetStreamKey makes an api call to https://dev.twitch.tv/docs/api/reference#get-stream-key, and formats the data.

func (*Client) GetStreamMarkers

func (c *Client) GetStreamMarkers(userID, videoID, before, after string, count int) (*StreamMarkers, error)

GetStreamMarkers makes an api call to https://dev.twitch.tv/docs/api/reference#get-stream-markers, and formats the data.

func (*Client) GetStreamTags

func (c *Client) GetStreamTags(broadcasterID string) (*StreamTags, error)

GetStreamTags makes an api call to https://dev.twitch.tv/docs/api/reference#get-stream-tags, and formats the data.

func (*Client) GetStreams

func (c *Client) GetStreams(before, after string, count int, gameIDs []string, languages []string,
	userIDs []string, userLogins []string) (*Streams, error)

GetStreams makes an api call to https://dev.twitch.tv/docs/api/reference#get-streams, and formats the data.

func (*Client) GetTeam

func (c *Client) GetTeam(name, id string) (*Teams, error)

GetTeam makes an api call to https://dev.twitch.tv/docs/api/reference#get-teams, and formats the data.

func (*Client) GetTopGames

func (c *Client) GetTopGames(before, after string, count int) (*Games, error)

GetTopGames makes an api call to https://dev.twitch.tv/docs/api/reference#get-top-games, and formats the data.

func (*Client) GetTwitchUsers

func (c *Client) GetTwitchUsers(logins []string, ids []string) (*Users, error)

GetTwitchUsers makes an api call to https://dev.twitch.tv/docs/api/reference#get-users, and formats the data. This does some limited validation based on the API definition.

func (*Client) GetUserActiveExtensions

func (c *Client) GetUserActiveExtensions(userID string) (*UserActiveExtensions, error)

GetUserActiveExtensions makes an api call to https://dev.twitch.tv/docs/api/reference#get-user-active-extensions, and formats the data.

func (*Client) GetUserExtensions

func (c *Client) GetUserExtensions() (*UserExtensions, error)

GetUserExtensions makes an api call to https://dev.twitch.tv/docs/api/reference#get-user-extensions, and formats the data.

func (*Client) GetUsers

func (c *Client) GetUsers(IDs, logins []string) (*Users, error)

GetUsers makes an api call to https://dev.twitch.tv/docs/api/reference#get-users, and formats the data.

func (*Client) GetUsersBlockList

func (c *Client) GetUsersBlockList(broadcasterID, after string, count int) (*UserBlockList, error)

GetUsersBlockList makes an api call to https://dev.twitch.tv/docs/api/reference#get-user-block-list, and formats the data.

func (*Client) GetUsersFollows

func (c *Client) GetUsersFollows(fromID, toID, after string, count int) (*UserFollows, error)

GetUsersFollows makes an api call to https://dev.twitch.tv/docs/api/reference#get-users-follows, and formats the data.

func (*Client) GetVideosByGame

func (c *Client) GetVideosByGame(gameID, before, after, language string, count int,
	period, sort, _type string) (*Video, error)

GetVideosByGame makes an api call to https://dev.twitch.tv/docs/api/reference#get-videos, and formats the data.

func (*Client) GetVideosByID

func (c *Client) GetVideosByID(ids []string) (*Video, error)

GetVideosByID makes an api call to https://dev.twitch.tv/docs/api/reference#get-videos, and formats the data.

func (*Client) GetVideosByUser

func (c *Client) GetVideosByUser(userID, before, after, language string, count int,
	period, sort, _type string) (*Video, error)

GetVideosByUser makes an api call to https://dev.twitch.tv/docs/api/reference#get-videos, and formats the data.

func (*Client) GetWebhookSubscriptions

func (c *Client) GetWebhookSubscriptions(after string, count int) (*WebhookSubscriptions, error)

GetWebhookSubscriptions makes an api call to https://dev.twitch.tv/docs/api/reference#get-webhook-subscriptions, and formats the data.

func (*Client) ModifyChannelInformation added in v0.0.7

func (c *Client) ModifyChannelInformation(broadcasterID string, gameID, language, title *string, delay *int) (bool, error)

ModifyChannelInformation updates the channel information based on https://dev.twitch.tv/docs/api/reference#modify-channel-information.

func (*Client) PatchRequest added in v0.0.7

func (c *Client) PatchRequest(endpoint string, params map[string][]string, body []byte) (bool, []byte, error)

PatchRequest handles generic PATCH requests to twitch's API, leveraged internally as well as allows you to make raw requests in case an update to the API comes out and the library hasn't been updated yet.

func (*Client) PostRequest added in v0.0.7

func (c *Client) PostRequest(endpoint string, params map[string][]string, body []byte) ([]byte, error)

PostRequest handles generic POST requests to twitch's API, leveraged internally as well as allows you to make raw requests in case an update to the API comes out and the library hasn't been updated yet.

func (*Client) PutRequest added in v0.0.7

func (c *Client) PutRequest(endpoint string, params map[string][]string, body []byte) ([]byte, error)

PutRequest wraps PUT requests to helix thru TAU

func (*Client) ReplaceStreamTags added in v0.0.7

func (c *Client) ReplaceStreamTags(broadcasterID string, tags []string) (bool, error)

ReplaceStreamTags can be used to set/reset a streams tags, see https://dev.twitch.tv/docs/api/reference#replace-stream-tags

func (*Client) SearchCategories

func (c *Client) SearchCategories(query, after string, count int) (*Games, error)

SearchCategories makes an api call to https://dev.twitch.tv/docs/api/reference#search-categories, and formats the data.

func (*Client) SearchChannels

func (c *Client) SearchChannels(query, after string, count int, liveOnly bool) (*ChannelSearchResults, error)

SearchChannels makes an api call to https://dev.twitch.tv/docs/api/reference#search-channels, and formats the data.

func (*Client) StartCommercial added in v0.0.7

func (c *Client) StartCommercial(broadcasterID string, length int) (*Commercial, error)

StartCommercial allows you to start a commercial on a stream, see https://dev.twitch.tv/docs/api/reference#start-commercial

func (*Client) UnblockUser added in v0.0.7

func (c *Client) UnblockUser(userID string) (bool, error)

UnblockUser makes an api call to https://dev.twitch.tv/docs/api/reference#unblock-user, and formats the data.

func (*Client) UpdateChannelStreamSchedule added in v0.0.7

func (c *Client) UpdateChannelStreamSchedule(broadcasterID string, vacationEnabled *bool,
	vacationStartTime, vacationEndTime *time.Time, timezone *string) (bool, error)

UpdateChannelStreamSchedule updates the channel stream schedule per https://dev.twitch.tv/docs/api/reference#update-channel-stream-schedule.

func (*Client) UpdateChannelStreamScheduleSegment added in v0.0.7

func (c *Client) UpdateChannelStreamScheduleSegment(broadcasterID, segmentID string, update *StreamScheduleSegmentUpdate) (*ChannelStreamSchedule, error)

UpdateChannelStreamScheduleSegment updates a segment of your schedule per https://dev.twitch.tv/docs/api/reference#update-channel-stream-schedule-segment returning the resulting schedule segment.

func (*Client) UpdateCustomReward added in v0.0.7

func (c *Client) UpdateCustomReward(broadcasterID string, ID string, change *CustomRewardsUpdate) (*CustomRewards, error)

UpdateCustomReward updates a custom reward that is owned by your client id. For more information see https://dev.twitch.tv/docs/api/reference#update-custom-reward.

func (*Client) UpdateRedemptionStatus added in v0.0.7

func (c *Client) UpdateRedemptionStatus(broadcasterID, rewardID string, redemptionIDs []string, status string) (*CustomRewardRedemptions, error)

UpdateRedemptionStatus updates the status of one or more redemptions for a reward owned by your client id. For more information see https://dev.twitch.tv/docs/api/reference#update-redemption-status.

func (*Client) UpdateUser added in v0.0.7

func (c *Client) UpdateUser(description *string) (*Users, error)

UpdateUser allows you to update the description of a user. If the description is nil it just gets the user. See https://dev.twitch.tv/docs/api/reference#update-user.

type Clips

type Clips struct {
	Data []struct {
		ID              string    `json:"id"`
		Url             string    `json:"url"`
		EmbedUrl        string    `json:"embed_url"`
		BroadcasterID   string    `json:"broadcaster_id"`
		BroadcasterName string    `json:"broadcaster_name"`
		CreatorID       string    `json:"creator_id"`
		CreatorName     string    `json:"creator_name"`
		VideoID         string    `json:"video_id"`
		GameID          string    `json:"game_id"`
		Language        string    `json:"language"`
		Title           string    `json:"title"`
		ViewCount       int       `json:"view_count"`
		CreatedAt       time.Time `json:"created_at"`
		ThumbnailUrl    string    `json:"thumbnail_url"`
		Duration        float64   `json:"duration"`
	} `json:"data"`
	Pagination *TwitchPagination `json:"pagination"`
}

Clips represents the response from Get Clips, see https://dev.twitch.tv/docs/api/reference#get-clips

type CodeStatus

type CodeStatus struct {
	Data []struct {
		Code   string `json:"code"`
		Status string `json:"status"`
	} `json:"data"`
}

CodeStatus represents the response from Get Code Status, see https://dev.twitch.tv/docs/api/reference#get-code-status

type Commercial added in v0.0.7

type Commercial struct {
	Data []struct {
		Length     int    `json:"length"`
		Message    string `json:"message"`
		RetryAfter int    `json:"retry_after"`
	} `json:"data"`
}

Commercial represents the response when you start a commercial, see https://dev.twitch.tv/docs/api/reference#start-commercial

type CreatePoll added in v0.0.7

type CreatePoll struct {
	BroadcasterID              string    `json:"broadcaster_id"`
	Title                      string    `json:"title"`
	Choices                    []Outcome `json:"choices"`
	Duration                   int       `json:"duration"`
	BitsVotingEnabled          *bool     `json:"bits_voting_enabled,omitempty"`
	BitsPerVote                *int      `json:"bits_per_vote,omitempty"`
	ChannelPointsVotingEnabled *bool     `json:"channel_points_voting_enabled,omitempty"`
	ChannelPointsPerVote       *int      `json:"channel_points_per_vote,omitempty"`
}

CreatePoll is used to create a poll in a stream

type CreatePrediction added in v0.0.7

type CreatePrediction struct {
	BroadcasterId    string    `json:"broadcaster_id"`
	Title            string    `json:"title"`
	Choices          []Outcome `json:"outcomes"`
	PredictionWindow int       `json:"prediction_window"`
}

CreatePrediction is used to create a prediction in a stream

type CustomRewardImage

type CustomRewardImage struct {
	Url1X string `json:"url_1x"`
	Url2X string `json:"url_2x"`
	Url4X string `json:"url_4x"`
}

CustomRewardImage represents the various images associated with a custom reward.

type CustomRewardRedemptions

type CustomRewardRedemptions struct {
	Data []struct {
		BroadcasterName  string    `json:"broadcaster_name"`
		BroadcasterLogin string    `json:"broadcaster_login"`
		BroadcasterID    string    `json:"broadcaster_id"`
		ID               string    `json:"id"`
		UserLogin        string    `json:"user_login"`
		UserID           string    `json:"user_id"`
		UserName         string    `json:"user_name"`
		UserInput        string    `json:"user_input"`
		Status           string    `json:"status"`
		RedeemedAt       time.Time `json:"redeemed_at"`
		Reward           struct {
			ID     string `json:"id"`
			Title  string `json:"title"`
			Prompt string `json:"prompt"`
			Cost   int    `json:"cost"`
		} `json:"reward"`
	} `json:"data"`
	Pagination *TwitchPagination `json:"pagination"`
}

CustomRewardRedemptions represents the response from Get Custom Reward Redemption, see https://dev.twitch.tv/docs/api/reference#get-custom-reward-redemption

type CustomRewards

type CustomRewards struct {
	Data []struct {
		BroadcasterName     string             `json:"broadcaster_name"`
		BroadcasterLogin    string             `json:"broadcaster_login"`
		BroadcasterId       string             `json:"broadcaster_id"`
		ID                  string             `json:"id"`
		Image               *CustomRewardImage `json:"image"`
		BackgroundColor     string             `json:"background_color"`
		IsEnabled           bool               `json:"is_enabled"`
		Cost                int                `json:"cost"`
		Title               string             `json:"title"`
		Prompt              string             `json:"prompt"`
		IsUserInputRequired bool               `json:"is_user_input_required"`
		MaxPerStreamSetting struct {
			IsEnabled    bool `json:"is_enabled"`
			MaxPerStream int  `json:"max_per_stream"`
		} `json:"max_per_stream_setting"`
		MaxPerUserPerStreamSetting struct {
			IsEnabled           bool `json:"is_enabled"`
			MaxPerUserPerStream int  `json:"max_per_user_per_stream"`
		} `json:"max_per_user_per_stream_setting"`
		GlobalCooldownSetting struct {
			IsEnabled             bool `json:"is_enabled"`
			GlobalCooldownSeconds int  `json:"global_cooldown_seconds"`
		} `json:"global_cooldown_setting"`
		IsPaused                          bool               `json:"is_paused"`
		IsInStock                         bool               `json:"is_in_stock"`
		DefaultImage                      *CustomRewardImage `json:"default_image"`
		ShouldRedemptionsSkipRequestQueue bool               `json:"should_redemptions_skip_request_queue"`
		RedemptionsRedeemedCurrentStream  int                `json:"redemptions_redeemed_current_stream"`
		CooldownExpiresAt                 *time.Time         `json:"cooldown_expires_at"`
	} `json:"data"`
}

CustomRewards represents the response from Get Custom Rewards, see https://dev.twitch.tv/docs/api/reference#get-custom-reward

type CustomRewardsUpdate added in v0.0.7

type CustomRewardsUpdate struct {
	Title                             *string `json:"title,omitempty"`
	Prompt                            *string `json:"prompt,omitempty"`
	Cost                              *int    `json:"cost,omitempty"`
	BackgroundColor                   *string `json:"background_color,omitempty"`
	IsEnabled                         *bool   `json:"is_enabled,omitempty"`
	IsUserInputRequired               *bool   `json:"is_user_input_required,omitempty"`
	IsMaxPerStreamEnabled             *bool   `json:"is_max_per_stream_enabled,omitempty"`
	MaxPerStream                      *int    `json:"max_per_stream,omitempty"`
	IsMaxPerUserPerStreamEnabled      *bool   `json:"is_max_per_user_per_stream_enabled,omitempty"`
	MaxPerUserPerStream               *int    `json:"max_per_user_per_stream,omitempty"`
	IsGlobalCooldownEnabled           *bool   `json:"is_global_cooldown_enabled,omitempty"`
	GlobalCooldownSeconds             *int    `json:"global_cooldown_seconds,omitempty"`
	IsPaused                          *bool   `json:"is_paused,omitempty"`
	ShouldRedemptionsSkipRequestQueue *bool   `json:"should_redemptions_skip_request_queue,omitempty"`
}

CustomRewardsUpdate is used when creating and updating custom rewards

type DropEntitlements

type DropEntitlements struct {
	Data []struct {
		ID        string    `json:"id"`
		BenefitID string    `json:"benefit_id"`
		Timestamp time.Time `json:"timestamp"`
		UserID    string    `json:"user_id"`
		GameID    string    `json:"game_id"`
	} `json:"data"`
	Pagination *TwitchPagination `json:"pagination"`
}

DropEntitlements represents the response from Get Drop Entitlements, see https://dev.twitch.tv/docs/api/reference#get-drops-entitlements

type EventSubSubscriptions

type EventSubSubscriptions struct {
	Total int `json:"total"`
	Data  []struct {
		ID        string `json:"id"`
		Status    string `json:"status"`
		Type      string `json:"type"`
		Version   string `json:"version"`
		Condition struct {
			BroadcasterUserID string `json:"broadcaster_user_id,omitempty"`
			UserID            string `json:"user_id,omitempty"`
		} `json:"condition"`
		CreatedAt time.Time `json:"created_at"`
		Transport struct {
			Method   string `json:"method"`
			Callback string `json:"callback"`
		} `json:"transport"`
		Cost int `json:"cost"`
	} `json:"data"`
	TotalCost    int               `json:"total_cost"`
	MaxTotalCost int               `json:"max_total_cost"`
	Pagination   *TwitchPagination `json:"pagination"`
}

EventSubSubscriptions represents the response from Get EventSub Subscriptions, see https://dev.twitch.tv/docs/api/reference#get-eventsub-subscriptions

type ExtensionAnalytics

type ExtensionAnalytics struct {
	Data []struct {
		ExtensionID string `json:"extension_id"`
		URL         string `json:"URL"`
		Type        string `json:"type"`
		DateRange   struct {
			StartedAt time.Time `json:"started_at"`
			EndedAt   time.Time `json:"ended_at"`
		} `json:"date_range"`
	} `json:"data"`
	Pagination *TwitchPagination `json:"pagination"`
}

ExtensionAnalytics represents the response from Get Extension Analytics, see https://dev.twitch.tv/docs/api/reference#get-extension-analytics

type ExtensionTransactions

type ExtensionTransactions struct {
	Data []struct {
		ID               string    `json:"id"`
		Timestamp        time.Time `json:"timestamp"`
		BroadcasterID    string    `json:"broadcaster_id"`
		BroadcasterLogin string    `json:"broadcaster_login"`
		BroadcasterName  string    `json:"broadcaster_name"`
		UserID           string    `json:"user_id"`
		UserLogin        string    `json:"user_login"`
		UserName         string    `json:"user_name"`
		ProductType      string    `json:"product_type"`
		ProductData      struct {
			Sku  string `json:"sku"`
			Cost struct {
				Amount int    `json:"amount"`
				Type   string `json:"type"`
			} `json:"cost"`
			DisplayName   string `json:"displayName"`
			InDevelopment bool   `json:"inDevelopment"`
		} `json:"product_data"`
	} `json:"data"`
	Pagination *TwitchPagination `json:"pagination"`
}

ExtensionTransactions represents the response from Get Extension Transactions, see https://dev.twitch.tv/docs/api/reference#get-extension-transactions

type GameAnalytics

type GameAnalytics struct {
	Data []struct {
		GameID    string `json:"game_id"`
		URL       string `json:"URL"`
		Type      string `json:"type"`
		DateRange struct {
			StartedAt time.Time `json:"started_at"`
			EndedAt   time.Time `json:"ended_at"`
		} `json:"date_range"`
	} `json:"data"`
	Pagination *TwitchPagination `json:"pagination"`
}

GameAnalytics represents the response from Get Game Analytics, see https://dev.twitch.tv/docs/api/reference#get-game-analytics

type Games

type Games struct {
	Data []struct {
		ID        string `json:"id"`
		Name      string `json:"name"`
		BoxArtUrl string `json:"box_art_url"`
	} `json:"data"`
	Pagination *TwitchPagination `json:"pagination"`
}

Games represents the response from Get Top Games, Get Games, and Search Categories see https://dev.twitch.tv/docs/api/reference#get-top-games

type GenericError added in v0.0.7

type GenericError struct {
	// contains filtered or unexported fields
}

GenericError represents a non-specific error, sorta a catch all.

func (GenericError) Body added in v0.0.7

func (g GenericError) Body() string

Body returns the body of a failed request

func (GenericError) Error added in v0.0.7

func (g GenericError) Error() string

func (GenericError) StatusCode added in v0.0.7

func (g GenericError) StatusCode() int

StatusCode returns the status code returned by twitch

type HypeTrainEvents

type HypeTrainEvents struct {
	Data []struct {
		ID             string    `json:"id"`
		EventType      string    `json:"event_type"`
		EventTimestamp time.Time `json:"event_timestamp"`
		Version        string    `json:"version"`
		EventData      struct {
			BroadcasterId    string    `json:"broadcaster_id"`
			CooldownEndTime  time.Time `json:"cooldown_end_time"`
			ExpiresAt        time.Time `json:"expires_at"`
			Goal             int       `json:"goal"`
			ID               string    `json:"id"`
			LastContribution struct {
				Total int    `json:"total"`
				Type  string `json:"type"`
				User  string `json:"user"`
			} `json:"last_contribution"`
			Level            int       `json:"level"`
			StartedAt        time.Time `json:"started_at"`
			TopContributions []struct {
				Total int    `json:"total"`
				Type  string `json:"type"`
				User  string `json:"user"`
			} `json:"top_contributions"`
			Total int `json:"total"`
		} `json:"event_data"`
	} `json:"data"`
	Pagination *TwitchPagination `json:"pagination"`
}

HypeTrainEvents represents the response from Get Hype Train Events, see https://dev.twitch.tv/docs/api/reference#get-hype-train-events

type ModeratorEvents

type ModeratorEvents struct {
	Data []struct {
		ID             string    `json:"id"`
		EventType      string    `json:"event_type"`
		EventTimestamp time.Time `json:"event_timestamp"`
		Version        string    `json:"version"`
		EventData      struct {
			BroadcasterID    string `json:"broadcaster_id"`
			BroadcasterLogin string `json:"broadcaster_login"`
			BroadcasterName  string `json:"broadcaster_name"`
			UserID           string `json:"user_id"`
			UserLogin        string `json:"user_login"`
			UserName         string `json:"user_name"`
		} `json:"event_data"`
	} `json:"data"`
	Pagination *TwitchPagination `json:"pagination"`
}

ModeratorEvents represents the response from Get Moderator Events, see https://dev.twitch.tv/docs/api/reference#get-moderator-events

type Moderators

type Moderators struct {
	Data []struct {
		UserID    string `json:"user_id"`
		UserLogin string `json:"user_login"`
		UserName  string `json:"user_name"`
	} `json:"data"`
	Pagination *TwitchPagination `json:"pagination"`
}

Moderators represents the response from Get Moderators, see https://dev.twitch.tv/docs/api/reference#get-moderators

type Outcome added in v0.0.7

type Outcome struct {
	Title string `json:"title"`
}

Outcome is used by CreatePoll and CreatePrediction for the possible choices

type Polls

type Polls struct {
	Data []struct {
		ID               string `json:"id"`
		BroadcasterID    string `json:"broadcaster_id"`
		BroadcasterName  string `json:"broadcaster_name"`
		BroadcasterLogin string `json:"broadcaster_login"`
		Title            string `json:"title"`
		Choices          []struct {
			ID                 string `json:"id"`
			Title              string `json:"title"`
			Votes              int    `json:"votes"`
			ChannelPointsVotes int    `json:"channel_points_votes"`
			BitsVotes          int    `json:"bits_votes"`
		} `json:"choices"`
		BitsVotingEnabled          bool       `json:"bits_voting_enabled"`
		BitsPerVote                int        `json:"bits_per_vote"`
		ChannelPointsVotingEnabled bool       `json:"channel_points_voting_enabled"`
		ChannelPointsPerVote       int        `json:"channel_points_per_vote"`
		Status                     string     `json:"status"`
		Duration                   int        `json:"duration"`
		StartedAt                  time.Time  `json:"started_at"`
		EndedAt                    *time.Time `json:"ended_at"`
	} `json:"data"`
	Pagination *TwitchPagination `json:"pagination"`
}

Polls represents the response from Get Polls, see https://dev.twitch.tv/docs/api/reference#get-polls

type Predictions

type Predictions struct {
	Data []struct {
		ID               string `json:"id"`
		BroadcasterID    string `json:"broadcaster_id"`
		BroadcasterName  string `json:"broadcaster_name"`
		BroadcasterLogin string `json:"broadcaster_login"`
		Title            string `json:"title"`
		WinningOutcomeId string `json:"winning_outcome_id"`
		Outcomes         []struct {
			ID            string           `json:"id"`
			Title         string           `json:"title"`
			Users         int              `json:"users"`
			ChannelPoints int              `json:"channel_points"`
			TopPredictors []*TopPredictors `json:"top_predictors"`
			Color         string           `json:"color"`
		} `json:"outcomes"`
		PredictionWindow int        `json:"prediction_window"`
		Status           string     `json:"status"`
		CreatedAt        time.Time  `json:"created_at"`
		EndedAt          *time.Time `json:"ended_at"`
		LockedAt         *time.Time `json:"locked_at"`
	} `json:"data"`
	Pagination *TwitchPagination `json:"pagination"`
}

Predictions represents the response from Get Predictions, see https://dev.twitch.tv/docs/api/reference#get-predictions

type RateLimitError added in v0.0.7

type RateLimitError struct {
	// contains filtered or unexported fields
}

RateLimitError occurs when a twitch rate limits the request.

func (RateLimitError) Error added in v0.0.7

func (r RateLimitError) Error() string

func (RateLimitError) ResetTime added in v0.0.7

func (r RateLimitError) ResetTime() *time.Time

ResetTime can be used to check when the point bucket used by twitch will refill. See https://dev.twitch.tv/docs/api/guide#rate-limits

type StreamKey

type StreamKey struct {
	Data []struct {
		StreamKey string `json:"stream_key"`
	} `json:"data"`
}

StreamKey represents the response from Get Stream Key, see https://dev.twitch.tv/docs/api/reference#get-stream-key

type StreamMarkers

type StreamMarkers struct {
	Data []struct {
		UserID    string `json:"user_id"`
		UserName  string `json:"user_name"`
		UserLogin string `json:"user_login"`
		Videos    []struct {
			VideoId string `json:"video_id"`
			Markers []struct {
				ID              string    `json:"id"`
				CreatedAt       time.Time `json:"created_at"`
				Description     string    `json:"description"`
				PositionSeconds int       `json:"position_seconds"`
				URL             string    `json:"URL"`
			} `json:"markers"`
		} `json:"videos"`
	} `json:"data"`
	Pagination *TwitchPagination `json:"pagination"`
}

StreamMarkers represents the response from Get Stream Markers, see https://dev.twitch.tv/docs/api/reference#get-stream-markers

type StreamScheduleSegmentUpdate added in v0.0.7

type StreamScheduleSegmentUpdate struct {
	StartTime   *time.Time `json:"start_time,omitempty"`
	Timezone    *string    `json:"timezone,omitempty"`
	IsRecurring *bool      `json:"is_recurring,omitempty"`
	Duration    *string    `json:"duration,omitempty"`
	CategoryID  *string    `json:"category_id,omitempty"`
	Title       *string    `json:"title,omitempty"`
}

StreamScheduleSegmentUpdate is used when creating or updating stream segments

type StreamTags

type StreamTags struct {
	Data []struct {
		TagID                    string            `json:"tag_id"`
		IsAuto                   bool              `json:"is_auto"`
		LocalizationNames        map[string]string `json:"localization_names"`
		LocalizationDescriptions map[string]string `json:"localization_descriptions"`
	} `json:"data"`
	Pagination *TwitchPagination `json:"pagination"`
}

StreamTags represents the response from Get All Stream Tags and Get Stream Tags, see https://dev.twitch.tv/docs/api/reference#get-all-stream-tags

type Streams

type Streams struct {
	Data []struct {
		ID           string    `json:"id"`
		UserID       string    `json:"user_id"`
		UserLogin    string    `json:"user_login"`
		UserName     string    `json:"user_name"`
		GameID       string    `json:"game_id"`
		GameName     string    `json:"game_name"`
		Type         string    `json:"type"`
		Title        string    `json:"title"`
		ViewerCount  int       `json:"viewer_count"`
		StartedAt    time.Time `json:"started_at"`
		Language     string    `json:"language"`
		ThumbnailUrl string    `json:"thumbnail_url"`
		TagIDs       []string  `json:"tag_ids"`
		IsMature     bool      `json:"is_mature"`
	} `json:"data"`
	Pagination *TwitchPagination `json:"pagination"`
}

Streams represents the response from Get Streams and Get Followed Streams, see https://dev.twitch.tv/docs/api/reference#get-streams

type Subscriptions

type Subscriptions struct {
	Data []struct {
		BroadcasterID    string `json:"broadcaster_id"`
		BroadcasterLogin string `json:"broadcaster_login"`
		BroadcasterName  string `json:"broadcaster_name"`
		GifterID         string `json:"gifter_id"`
		GifterLogin      string `json:"gifter_login"`
		GifterName       string `json:"gifter_name"`
		IsGift           bool   `json:"is_gift"`
		Tier             string `json:"tier"`
		PlanName         string `json:"plan_name"`
		UserID           string `json:"user_id"`
		UserName         string `json:"user_name"`
		UserLogin        string `json:"user_login"`
	} `json:"data"`
	Pagination *TwitchPagination `json:"pagination"`
	Total      int               `json:"total"`
}

Subscriptions represents the response from Get Broadcaster Subscriptions, see https://dev.twitch.tv/docs/api/reference#get-broadcaster-subscriptions

type Teams

type Teams struct {
	Data []struct {
		Users []struct {
			UserID    string `json:"user_id"`
			UserName  string `json:"user_name"`
			UserLogin string `json:"user_login"`
		} `json:"users"`
		BackgroundImageUrl interface{} `json:"background_image_url"`
		Banner             interface{} `json:"banner"`
		CreatedAt          time.Time   `json:"created_at"`
		UpdatedAt          time.Time   `json:"updated_at"`
		Info               string      `json:"info"`
		ThumbnailUrl       string      `json:"thumbnail_url"`
		TeamName           string      `json:"team_name"`
		TeamDisplayName    string      `json:"team_display_name"`
		ID                 string      `json:"id"`
	} `json:"data"`
}

Teams represents the response from Get Teams, see https://dev.twitch.tv/docs/api/reference#get-teams

type TopPredictors added in v0.0.7

type TopPredictors struct {
	UserID            string `json:"id"`
	UserName          string `json:"name"`
	UserLogin         string `json:"login"`
	ChannelPointsUsed int    `json:"channel_points_used"`
	ChannelPointsWon  int    `json:"channel_points_won"`
}

TopPredictors represents users who bet the most on their Predictions and won

type TwitchPagination

type TwitchPagination struct {
	Cursor string `json:"cursor"`
}

TwitchPagination represents pagination data from twitch on endpoints that support multi-paged responses.

type UserActiveExtensions

type UserActiveExtensions struct {
	Data struct {
		Panel struct {
			Field1 struct {
				Active  bool   `json:"active"`
				ID      string `json:"id"`
				Version string `json:"version"`
				Name    string `json:"name"`
			} `json:"1"`
			Field2 struct {
				Active  bool   `json:"active"`
				ID      string `json:"id"`
				Version string `json:"version"`
				Name    string `json:"name"`
			} `json:"2"`
			Field3 struct {
				Active  bool   `json:"active"`
				ID      string `json:"id"`
				Version string `json:"version"`
				Name    string `json:"name"`
			} `json:"3"`
		} `json:"panel"`
		Overlay struct {
			Field1 struct {
				Active  bool   `json:"active"`
				ID      string `json:"id"`
				Version string `json:"version"`
				Name    string `json:"name"`
			} `json:"1"`
		} `json:"overlay"`
		Component struct {
			Field1 struct {
				Active  bool   `json:"active"`
				ID      string `json:"id"`
				Version string `json:"version"`
				Name    string `json:"name"`
				X       int    `json:"x"`
				Y       int    `json:"y"`
			} `json:"1"`
			Field2 struct {
				Active  bool   `json:"active"`
				ID      string `json:"id"`
				Version string `json:"version"`
				Name    string `json:"name"`
				X       int    `json:"x"`
				Y       int    `json:"y"`
			} `json:"2"`
		} `json:"component"`
	} `json:"data"`
}

UserActiveExtensions represents the response to Get User Active Extensions, see https://dev.twitch.tv/docs/api/reference#get-user-active-extensions

type UserBlockList

type UserBlockList struct {
	Data []struct {
		UserID      string `json:"user_id"`
		UserLogin   string `json:"user_login"`
		DisplayName string `json:"display_name"`
	} `json:"data"`
	Pagination *TwitchPagination `json:"pagination"`
}

UserBlockList represents the response from Get User Block List, see https://dev.twitch.tv/docs/api/reference#get-user-block-list

type UserExtensions

type UserExtensions struct {
	Data []struct {
		ID          string   `json:"id"`
		Version     string   `json:"version"`
		Name        string   `json:"name"`
		CanActivate bool     `json:"can_activate"`
		Type        []string `json:"type"`
	} `json:"data"`
}

UserExtensions represents the response from Get User Extensions, see https://dev.twitch.tv/docs/api/reference#get-user-extensions

type UserFollows

type UserFollows struct {
	Total int `json:"total"`
	Data  []struct {
		FromId     string    `json:"from_id"`
		FromLogin  string    `json:"from_login"`
		FromName   string    `json:"from_name"`
		ToId       string    `json:"to_id"`
		ToName     string    `json:"to_name"`
		FollowedAt time.Time `json:"followed_at"`
	} `json:"data"`
	Pagination *TwitchPagination `json:"pagination"`
}

UserFollows represents the response from Get User Follows, see https://dev.twitch.tv/docs/api/reference#get-users-follows

type UserSubscriptions

type UserSubscriptions struct {
	Data []struct {
		BroadcasterId    string `json:"broadcaster_id"`
		BroadcasterName  string `json:"broadcaster_name"`
		BroadcasterLogin string `json:"broadcaster_login"`
		GifterID         string `json:"gifter_id"`
		GifterName       string `json:"gifter_name"`
		GifterLogin      string `json:"gifter_login"`
		IsGift           bool   `json:"is_gift"`
		Tier             string `json:"tier"`
	} `json:"data"`
}

UserSubscriptions represents the response from Check User Subscription, see https://dev.twitch.tv/docs/api/reference#check-user-subscription

type Users

type Users struct {
	Data []struct {
		ID              string    `json:"id"`
		Login           string    `json:"login"`
		DisplayName     string    `json:"display_name"`
		Type            string    `json:"type"`
		BroadcasterType string    `json:"broadcaster_type"`
		Description     string    `json:"description"`
		ProfileImageUrl string    `json:"profile_image_url"`
		OfflineImageUrl string    `json:"offline_image_url"`
		ViewCount       int       `json:"view_count"`
		Email           string    `json:"email"`
		CreatedAt       time.Time `json:"created_at"`
	} `json:"data"`
}

Users represents the response from Get Users, see https://dev.twitch.tv/docs/api/reference#get-users

type Vacation added in v0.0.7

type Vacation struct {
	StartTime time.Time `json:"start_time"`
	EndTime   time.Time `json:"end_time"`
}

Vacation Represents a vacation object as part of a ChannelStreamSchedule

type Video

type Video struct {
	Data []struct {
		ID            string    `json:"id"`
		StreamID      string    `json:"stream_id"`
		UserID        string    `json:"user_id"`
		UserLogin     string    `json:"user_login"`
		UserName      string    `json:"user_name"`
		Title         string    `json:"title"`
		Description   string    `json:"description"`
		CreatedAt     time.Time `json:"created_at"`
		PublishedAt   time.Time `json:"published_at"`
		Url           string    `json:"url"`
		ThumbnailUrl  string    `json:"thumbnail_url"`
		Viewable      string    `json:"viewable"`
		ViewCount     int       `json:"view_count"`
		Language      string    `json:"language"`
		Type          string    `json:"type"`
		Duration      string    `json:"duration"`
		MutedSegments []struct {
			Duration int `json:"duration"`
			Offset   int `json:"offset"`
		} `json:"muted_segments"`
	} `json:"data"`
	Pagination *TwitchPagination `json:"pagination"`
}

Video represents the response from Get Videos, see https://dev.twitch.tv/docs/api/reference#get-videos

type WebhookSubscriptions

type WebhookSubscriptions struct {
	Total int `json:"total"`
	Data  []struct {
		Topic     string    `json:"topic"`
		Callback  string    `json:"callback"`
		ExpiresAt time.Time `json:"expires_at"`
	} `json:"data"`
	Pagination *TwitchPagination `json:"pagination"`
}

WebhookSubscriptions represents the response from Get Webhook Subscriptions, see https://dev.twitch.tv/docs/api/reference#get-webhook-subscriptions

Jump to

Keyboard shortcuts

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