api

package
v0.2.3 Latest Latest
Warning

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

Go to latest
Published: Oct 19, 2023 License: BSD-3-Clause Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const BaseURL = "https://api.twitch.tv/helix"

Variables

This section is empty.

Functions

func CodeOf added in v0.2.0

func CodeOf(err error) int

CodeOf returns the HTTP status code of the given error. If the error is not an API error, it returns http.StatusInternalServerError.

Types

type APIError added in v0.2.0

type APIError struct {
	Status  int    `json:"status"`
	Code    string `json:"error"`
	Message string `json:"message"`
}

func (APIError) Error added in v0.2.0

func (err APIError) Error() string

type AdsInsertRequest added in v0.2.0

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

func (*AdsInsertRequest) Do added in v0.2.0

Do executes the request.

req := client.Ads.Insert("41245072").Duration(60)
data, err := req.Do(ctx, api.WithBearerToken("2gbdx6oar67tqtcmt49t3wpcgycthx")

func (*AdsInsertRequest) Duration added in v0.2.0

func (c *AdsInsertRequest) Duration(seconds int) *AdsInsertRequest

Duration sets the duration of the commercial in seconds.

Twitch tries to serve a commercial that’s the requested length, but it may be shorter or longer. The maximum length you should request is 180 seconds.

type AdsInsertResponse added in v0.2.0

type AdsInsertResponse struct {
	Header http.Header
	Data   []Commercial
}

type AdsResource added in v0.2.0

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

func NewAdsResource added in v0.2.0

func NewAdsResource(client *Client) *AdsResource

func (*AdsResource) Insert added in v0.2.0

func (r *AdsResource) Insert(broadcasterId string) *AdsInsertRequest

Insert creates a request to start a commercial for the specified broadcaster.

Required Scope: channel:edit:commercial

type AnalyticsResource added in v0.2.0

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

func NewAnalyticsResource added in v0.2.0

func NewAnalyticsResource(client *Client) *AnalyticsResource

type BitsLeaderboardEntry added in v0.2.1

type BitsLeaderboardEntry struct {
	ID          string `json:"user_id"`
	Login       string `json:"user_login"`
	DisplayName string `json:"user_name"`
	Rank        int    `json:"rank"`
	Score       int    `json:"score"`
}

type BitsLeaderboardListCall added in v0.2.1

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

func (*BitsLeaderboardListCall) Count added in v0.2.1

Count limits the number of results to return.

Maximum: 100 (default: 10)

func (*BitsLeaderboardListCall) Do added in v0.2.1

Do executes the request.

func (*BitsLeaderboardListCall) Period added in v0.2.1

Period sets the time period over which data is aggregated.

Possible values: "day", "week", "month", "year", "all" (default: "all")

func (*BitsLeaderboardListCall) StartedAt added in v0.2.1

StartedAt the start date used for determining the aggregation period.

func (*BitsLeaderboardListCall) UserID added in v0.2.1

UserID limits the aggregated results to the specified user ID. If count is greater than 1, the response may include users ranked above and below the specified user.

To get the leaderboard's top leaders, don't specify this.

type BitsLeaderboardListResponse added in v0.2.1

type BitsLeaderboardListResponse struct {
	Header http.Header
	Total  int
	Data   []BitsLeaderboardEntry
}

type BitsLeaderboardResource added in v0.2.1

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

func NewBitsLeaderboardResource added in v0.2.1

func NewBitsLeaderboardResource(client *Client) *BitsLeaderboardResource

func (*BitsLeaderboardResource) List added in v0.2.1

List creates a request to list users from the authenticated users Bits leaderboard.

type BitsResource added in v0.2.0

type BitsResource struct {
	Cheermotes  *CheermotesResource
	Leaderboard *BitsLeaderboardResource
	// contains filtered or unexported fields
}

func NewBitsResource added in v0.2.0

func NewBitsResource(client *Client) *BitsResource

type Channel added in v0.2.0

type Channel struct {
	ID                          string   `json:"broadcaster_id"`
	Login                       string   `json:"broadcaster_login"`
	DisplayName                 string   `json:"broadcaster_name"`
	GameID                      string   `json:"game_id"`
	GameName                    string   `json:"game_name"`
	Title                       string   `json:"title"`
	Delay                       int      `json:"delay"`
	Tags                        []string `json:"tags"`
	ContentClassificationLabels []string `json:"content_classification_labels"`
	IsBrandedContent            bool     `json:"is_branded_content"`
}

type ChannelPointsResource added in v0.2.0

type ChannelPointsResource struct {
	CustomRewards *CustomRewardsResource
	// contains filtered or unexported fields
}

func NewChannelPointsResource added in v0.2.0

func NewChannelPointsResource(client *Client) *ChannelPointsResource

type ChannelsListCall added in v0.2.0

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

func (*ChannelsListCall) BroadcasterID added in v0.2.0

func (c *ChannelsListCall) BroadcasterID(ids []string) *ChannelsListCall

BroadcasterID filters the results to the specified broadcaster ID.

func (*ChannelsListCall) Do added in v0.2.0

Do executes the request.

type ChannelsListResponse added in v0.2.0

type ChannelsListResponse struct {
	Header http.Header
	Data   []Channel
}

type ChannelsResource added in v0.2.0

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

func NewChannelsResource added in v0.2.0

func NewChannelsResource(client *Client) *ChannelsResource

func (*ChannelsResource) List added in v0.2.0

List creates a request to list channels based on the specified criteria.

type CharityResource added in v0.2.0

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

func NewCharityResource added in v0.2.0

func NewCharityResource(client *Client) *CharityResource

type ChatResource added in v0.2.0

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

func NewChatResource added in v0.2.0

func NewChatResource(client *Client) *ChatResource

type ChatterBan added in v0.2.0

type ChatterBan struct {
	BroadcasterID string     `json:"broadcaster_id"`
	ModeratorID   string     `json:"moderator_id"`
	UserID        string     `json:"user_id"`
	CreatedAt     time.Time  `json:"created_at"`
	EndsAt        *time.Time `json:"ends_at,omitempty"`
}

type Cheermote added in v0.2.0

type Cheermote struct {
	Prefix       string          `json:"prefix"`
	Tiers        []CheermoteTier `json:"tiers"`
	Type         string          `json:"type"`
	Order        int             `json:"order"`
	IsCharitable bool            `json:"is_charitable"`
	LastUpdated  time.Time       `json:"last_updated"`
}

type CheermoteTier added in v0.2.0

type CheermoteTier struct {
	ID             string            `json:"id"`
	MinBits        int               `json:"min_bits"`
	Color          string            `json:"color"`
	Images         map[string]string `json:"images"`
	CanCheer       bool              `json:"can_cheer"`
	ShowInBitsCard bool              `json:"show_in_bits_card"`
}

type CheermotesListCall added in v0.2.0

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

func (*CheermotesListCall) BroadcasterID added in v0.2.0

func (c *CheermotesListCall) BroadcasterID(id string) *CheermotesListCall

BroadcasterID filters the results to the specified broadcaster ID.

func (*CheermotesListCall) Do added in v0.2.0

BroadcasterName filters the results to the specified broadcaster name.

type CheermotesListResponse added in v0.2.0

type CheermotesListResponse struct {
	Header http.Header
	Data   []Cheermote
}

type CheermotesResource added in v0.2.0

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

func NewCheermotesResource added in v0.2.0

func NewCheermotesResource(client *Client) *CheermotesResource

func (*CheermotesResource) List added in v0.2.0

List creates a request to list cheermotes based on the specified criteria.

Requires an app or user access token. No scope is required.

type ClearChatRequest added in v0.2.0

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

func (*ClearChatRequest) Do added in v0.2.0

func (c *ClearChatRequest) Do(ctx context.Context, opts ...RequestOption) error

Do executes the request.

func (*ClearChatRequest) MessageID added in v0.2.0

func (c *ClearChatRequest) MessageID(messageId string) *ClearChatRequest

MessageID the ID of the message to delete.

type Client

type Client struct {
	Ads           *AdsResource
	Analytics     *AnalyticsResource
	Bits          *BitsResource
	Channels      *ChannelsResource
	ChannelPoints *ChannelPointsResource
	Charity       *CharityResource
	Chat          *ChatResource
	Clips         *ClipsResource
	Entitlements  *EntitlementsResource
	Extensions    *ExtensionsResource
	EventSub      *EventSubResource
	Games         *GamesResource
	Goals         *GoalsResource
	GuestStar     *GuestStarResource
	HypeTrain     *HypeTrainResource
	Moderation    *ModerationResource
	Polls         *PollsResource
	Predictions   *PredictionsResource
	Raids         *RaidsResource
	Schedule      *ScheduleResource
	Search        *SearchResource
	Streams       *StreamsResource
	Subscriptions *SubscriptionsResource
	Tags          *TagsResource
	Teams         *TeamsResource
	Users         *UsersResource
	Videos        *VideosResource
	Whispers      *WhispersResource
	// contains filtered or unexported fields
}

func New

func New(clientID string, opts ...ClientOption) *Client

New creates a new API client for Twitch.

type ClientOption added in v0.2.0

type ClientOption func(*Client)

func WithClientSecret added in v0.2.0

func WithClientSecret(secret string) ClientOption

WithClientSecret sets the client secret to use for API requests.

func WithHTTPClient added in v0.2.0

func WithHTTPClient(client HTTPClient) ClientOption

WithHTTPClient sets the HTTP client to use for API requests.

type Clip added in v0.2.3

type Clip 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"`
	ThumbnailURL    string       `json:"thumbnail_url"`
	Duration        ClipDuration `json:"duration"`
	VODOffset       int          `json:"vod_offset"`
	Featured        bool         `json:"is_featured"`
	CreatedAt       time.Time    `json:"created_at"`
}

type ClipDuration added in v0.2.3

type ClipDuration time.Duration

func (ClipDuration) AsDuration added in v0.2.3

func (d ClipDuration) AsDuration() time.Duration

func (*ClipDuration) UnmarshalJSON added in v0.2.3

func (d *ClipDuration) UnmarshalJSON(data []byte) error

type ClipsListCall added in v0.2.3

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

func (*ClipsListCall) After added in v0.2.3

func (c *ClipsListCall) After(cursor string) *ClipsListCall

After filters the results to those after the specified cursor.

func (*ClipsListCall) Before added in v0.2.3

func (c *ClipsListCall) Before(cursor string) *ClipsListCall

Before filters the results to those before the specified cursor.

func (*ClipsListCall) BroadcasterID added in v0.2.3

func (c *ClipsListCall) BroadcasterID(id string) *ClipsListCall

BroadcasterID filters the results to those with the specified broadcaster ID.

func (*ClipsListCall) Do added in v0.2.3

Do executes the call.

func (*ClipsListCall) EndedAt added in v0.2.3

func (c *ClipsListCall) EndedAt(t time.Time) *ClipsListCall

EndedAt filters the results to those created before the specified time.

func (*ClipsListCall) Featured added in v0.2.3

func (c *ClipsListCall) Featured() *ClipsListCall

Featured filters the results to only those that are featured.

func (*ClipsListCall) First added in v0.2.3

func (c *ClipsListCall) First(n int) *ClipsListCall

First filters the results to the first n clips.

func (*ClipsListCall) GameID added in v0.2.3

func (c *ClipsListCall) GameID(id string) *ClipsListCall

GameID filters the results to those with the specified game ID.

func (*ClipsListCall) ID added in v0.2.3

func (c *ClipsListCall) ID(ids []string) *ClipsListCall

ID filters the results to those with the specified clip IDs.

func (*ClipsListCall) StartedAt added in v0.2.3

func (c *ClipsListCall) StartedAt(t time.Time) *ClipsListCall

StartedAt filters the results to those created after the specified time.

type ClipsListResponse added in v0.2.3

type ClipsListResponse struct {
	Header http.Header
	Data   []Clip
	Cursor string
}

type ClipsResource added in v0.2.0

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

func NewClipsResource added in v0.2.0

func NewClipsResource(client *Client) *ClipsResource

func (*ClipsResource) List added in v0.2.3

func (r *ClipsResource) List() *ClipsListCall

List creates a new call to list clips.

One or more of ID, BroadcasterID, or GameID must be specified.

type Commercial added in v0.2.0

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

type CreateBanRequest added in v0.2.0

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

func (*CreateBanRequest) Do added in v0.2.0

func (c *CreateBanRequest) Do(ctx context.Context, opts ...RequestOption) ([]ChatterBan, error)

Do executes the request.

func (*CreateBanRequest) Duration added in v0.2.0

func (c *CreateBanRequest) Duration(duration time.Duration) *CreateBanRequest

Duration the duration of the timeout, in seconds. If omitted, the ban is permanent.

The minimum timeout is 1 second and the maximum is 1,209,600 seconds (2 weeks).

To end a user's timeout early, set this field to 1, or use the Unban user endpoint.

func (*CreateBanRequest) Reason added in v0.2.0

func (c *CreateBanRequest) Reason(reason string) *CreateBanRequest

Reason the reason the you're banning the user or putting them in a timeout. This is optional and may be an empty string.

Reason is limited to a maximum of 500 characters.

func (*CreateBanRequest) TargetID added in v0.2.0

func (c *CreateBanRequest) TargetID(userId string) *CreateBanRequest

UserID the ID of the user to ban or put in a timeout.

type CustomReward added in v0.2.1

type CustomReward struct {
	ID                          string    `json:"id"`
	BroadcasterID               string    `json:"broadcaster_id"`
	BroadcasterLogin            string    `json:"broadcaster_login"`
	BroadcasterDisplayName      string    `json:"broadcaster_name"`
	BackgroundColor             string    `json:"background_color"`
	Title                       string    `json:"title"`
	Prompt                      string    `json:"prompt"`
	Cost                        int64     `json:"cost"`
	Enabled                     bool      `json:"is_enabled"`
	Paused                      bool      `json:"is_paused"`
	InStock                     bool      `json:"is_in_stock"`
	IsUserInputRequired         bool      `json:"is_user_input_required"`
	RedemptionsSkipRequestQueue bool      `json:"should_redemptions_skip_request_queue"`
	CooldownExpiresAt           time.Time `json:"cooldown_expires_at"`
}

type CustomRewardRedemption added in v0.2.1

type CustomRewardRedemption struct {
	ID                     string `json:"id"`
	BroadcasterID          string `json:"broadcaster_id"`
	BroadcasterLogin       string `json:"broadcaster_login"`
	BroadcasterDisplayName string `json:"broadcaster_name"`
	UserID                 string `json:"user_id"`
	UserLogin              string `json:"user_login"`
	UserDisplayName        string `json:"user_name"`
	UserInput              string `json:"user_input"`
	Status                 string `json:"status"`
	Reward                 struct {
		ID     string `json:"id"`
		Title  string `json:"title"`
		Prompt string `json:"prompt"`
		Cost   int64  `json:"cost"`
	} `json:"reward"`
	RedeemedAt time.Time `json:"redeemed_at"`
}

type CustomRewardsDeleteCall added in v0.2.1

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

func (*CustomRewardsDeleteCall) Do added in v0.2.1

Do executes the request.

type CustomRewardsInsertCall added in v0.2.1

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

func (*CustomRewardsInsertCall) BackgroundColor added in v0.2.1

func (c *CustomRewardsInsertCall) BackgroundColor(hexCode string) *CustomRewardsInsertCall

func (*CustomRewardsInsertCall) Cost added in v0.2.1

func (*CustomRewardsInsertCall) Do added in v0.2.1

Do executes the request.

func (*CustomRewardsInsertCall) GlobalCooldown added in v0.2.1

func (*CustomRewardsInsertCall) IsEnabled added in v0.2.1

func (c *CustomRewardsInsertCall) IsEnabled(enabled bool) *CustomRewardsInsertCall

func (*CustomRewardsInsertCall) IsGlobalCooldownEnabled added in v0.2.1

func (c *CustomRewardsInsertCall) IsGlobalCooldownEnabled(enabled bool) *CustomRewardsInsertCall

func (*CustomRewardsInsertCall) IsMaxPerStreamEnabled added in v0.2.1

func (c *CustomRewardsInsertCall) IsMaxPerStreamEnabled(enabled bool) *CustomRewardsInsertCall

func (*CustomRewardsInsertCall) IsMaxPerUserPerStreamEnabled added in v0.2.1

func (c *CustomRewardsInsertCall) IsMaxPerUserPerStreamEnabled(enabled bool) *CustomRewardsInsertCall

func (*CustomRewardsInsertCall) IsPaused added in v0.2.1

func (*CustomRewardsInsertCall) IsUserInputRequired added in v0.2.1

func (c *CustomRewardsInsertCall) IsUserInputRequired(required bool) *CustomRewardsInsertCall

func (*CustomRewardsInsertCall) MaxPerStream added in v0.2.1

func (*CustomRewardsInsertCall) MaxPerUserPerStream added in v0.2.1

func (c *CustomRewardsInsertCall) MaxPerUserPerStream(max int64) *CustomRewardsInsertCall

func (*CustomRewardsInsertCall) Prompt added in v0.2.1

func (*CustomRewardsInsertCall) ShouldRedemptionsSkipRequestQueue added in v0.2.1

func (c *CustomRewardsInsertCall) ShouldRedemptionsSkipRequestQueue(b bool) *CustomRewardsInsertCall

func (*CustomRewardsInsertCall) Title added in v0.2.1

type CustomRewardsInsertResponse added in v0.2.1

type CustomRewardsInsertResponse struct {
	Header http.Header
	Data   []CustomReward
}

type CustomRewardsListCall added in v0.2.1

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

func (*CustomRewardsListCall) Do added in v0.2.1

Do executes the request.

func (*CustomRewardsListCall) ID added in v0.2.1

ID filters the results to the specified reward IDs.

func (*CustomRewardsListCall) OnlyManageable added in v0.2.1

func (c *CustomRewardsListCall) OnlyManageable() *CustomRewardsListCall

OnlyManageable filters the results to only rewards that the app may manage.

type CustomRewardsListResponse added in v0.2.1

type CustomRewardsListResponse struct {
	Header http.Header
	Data   []CustomReward
}

type CustomRewardsRedemptionListCall added in v0.2.1

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

func (*CustomRewardsRedemptionListCall) After added in v0.2.1

After filters the results to those with a cursor value after the specified cursor.

func (*CustomRewardsRedemptionListCall) Before added in v0.2.1

Before filters the results to those with a cursor value before the specified cursor.

func (*CustomRewardsRedemptionListCall) Do added in v0.2.1

Do executes the request.

func (*CustomRewardsRedemptionListCall) ID added in v0.2.1

ID filters the results to the specified reward redemption IDs.

func (*CustomRewardsRedemptionListCall) Sort added in v0.2.1

Sort specifies the order in which to sort the results.

Possible values: "OLDEST", "NEWEST" (default: OLDEST)

func (*CustomRewardsRedemptionListCall) Status added in v0.2.1

Status filters the results to the specified statuses.

Possible values: "UNFULFILLED", "FULFILLED", "CANCELED" (default: UNFULFILLED)

type CustomRewardsRedemptionListResponse added in v0.2.1

type CustomRewardsRedemptionListResponse struct {
	Header http.Header
	Data   []CustomRewardRedemption
	Cursor string
}

type CustomRewardsRedemptionResource added in v0.2.1

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

func NewCustomRewardsRedemptionResource added in v0.2.1

func NewCustomRewardsRedemptionResource(client *Client) *CustomRewardsRedemptionResource

func (*CustomRewardsRedemptionResource) List added in v0.2.1

List creates a request to list custom channel point reward redemptions for a given broadcaster.

func (*CustomRewardsRedemptionResource) Update added in v0.2.1

func (r *CustomRewardsRedemptionResource) Update(broadcasterId, rewardId string, id []string) *CustomRewardsRedemptionUpdateCall

type CustomRewardsRedemptionUpdateCall added in v0.2.1

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

func (*CustomRewardsRedemptionUpdateCall) Cancel added in v0.2.1

func (*CustomRewardsRedemptionUpdateCall) Do added in v0.2.1

Do executes the request.

func (*CustomRewardsRedemptionUpdateCall) Fulfill added in v0.2.1

type CustomRewardsRedemptionUpdateResponse added in v0.2.1

type CustomRewardsRedemptionUpdateResponse struct {
	Header http.Header
	Data   []CustomRewardRedemption
}

type CustomRewardsResource added in v0.2.1

type CustomRewardsResource struct {
	Redemption *CustomRewardsRedemptionResource
	// contains filtered or unexported fields
}

func NewCustomRewardsResource added in v0.2.1

func NewCustomRewardsResource(client *Client) *CustomRewardsResource

func (*CustomRewardsResource) Delete added in v0.2.1

func (r *CustomRewardsResource) Delete(broadcasterId, id string) *CustomRewardsDeleteCall

func (*CustomRewardsResource) Insert added in v0.2.1

func (r *CustomRewardsResource) Insert(broadcasterId string) *CustomRewardsInsertCall

func (*CustomRewardsResource) List added in v0.2.1

func (r *CustomRewardsResource) List(broadcasterId string) *CustomRewardsListCall

List creates a reqyest to list custom channel point rewards for a given broadcaster.

func (*CustomRewardsResource) Update added in v0.2.1

func (r *CustomRewardsResource) Update(broadcasterId, id string) *CustomRewardsUpdateCall

type CustomRewardsUpdateCall added in v0.2.1

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

func (*CustomRewardsUpdateCall) BackgroundColor added in v0.2.1

func (c *CustomRewardsUpdateCall) BackgroundColor(hexCode string) *CustomRewardsUpdateCall

func (*CustomRewardsUpdateCall) Cost added in v0.2.1

func (*CustomRewardsUpdateCall) Do added in v0.2.1

Do executes the request.

func (*CustomRewardsUpdateCall) GlobalCooldown added in v0.2.1

func (*CustomRewardsUpdateCall) IsEnabled added in v0.2.1

func (c *CustomRewardsUpdateCall) IsEnabled(enabled bool) *CustomRewardsUpdateCall

func (*CustomRewardsUpdateCall) IsGlobalCooldownEnabled added in v0.2.1

func (c *CustomRewardsUpdateCall) IsGlobalCooldownEnabled(enabled bool) *CustomRewardsUpdateCall

func (*CustomRewardsUpdateCall) IsMaxPerStreamEnabled added in v0.2.1

func (c *CustomRewardsUpdateCall) IsMaxPerStreamEnabled(enabled bool) *CustomRewardsUpdateCall

func (*CustomRewardsUpdateCall) IsMaxPerUserPerStreamEnabled added in v0.2.1

func (c *CustomRewardsUpdateCall) IsMaxPerUserPerStreamEnabled(enabled bool) *CustomRewardsUpdateCall

func (*CustomRewardsUpdateCall) IsPaused added in v0.2.1

func (*CustomRewardsUpdateCall) IsUserInputRequired added in v0.2.1

func (c *CustomRewardsUpdateCall) IsUserInputRequired(required bool) *CustomRewardsUpdateCall

func (*CustomRewardsUpdateCall) MaxPerStream added in v0.2.1

func (*CustomRewardsUpdateCall) MaxPerUserPerStream added in v0.2.1

func (c *CustomRewardsUpdateCall) MaxPerUserPerStream(max int64) *CustomRewardsUpdateCall

func (*CustomRewardsUpdateCall) Prompt added in v0.2.1

func (*CustomRewardsUpdateCall) ShouldRedemptionsSkipRequestQueue added in v0.2.1

func (c *CustomRewardsUpdateCall) ShouldRedemptionsSkipRequestQueue(b bool) *CustomRewardsUpdateCall

func (*CustomRewardsUpdateCall) Title added in v0.2.1

type CustomRewardsUpdateResponse added in v0.2.1

type CustomRewardsUpdateResponse struct {
	Header http.Header
	Data   []CustomReward
}

type EntitlementsResource added in v0.2.0

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

func NewEntitlementsResource added in v0.2.0

func NewEntitlementsResource(client *Client) *EntitlementsResource

type EventSubResource added in v0.2.0

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

func NewEventSubResource added in v0.2.0

func NewEventSubResource(client *Client) *EventSubResource

type ExtensionsResource added in v0.2.0

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

func NewExtensionsResource added in v0.2.0

func NewExtensionsResource(client *Client) *ExtensionsResource

type Game added in v0.2.0

type Game struct {
	ID        string `json:"id"`
	Name      string `json:"name"`
	BoxArtURL string `json:"box_art_url"`
	IGDB      string `json:"igdb_id"`
}

type GamesResource added in v0.2.0

type GamesResource struct {
	Top *TopGamesResource
	// contains filtered or unexported fields
}

func NewGamesResource added in v0.2.0

func NewGamesResource(client *Client) *GamesResource

type GoalsResource added in v0.2.0

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

func NewGoalsResource added in v0.2.0

func NewGoalsResource(client *Client) *GoalsResource

type GuestStarResource added in v0.2.0

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

func NewGuestStarResource added in v0.2.0

func NewGuestStarResource(client *Client) *GuestStarResource

type HTTPClient added in v0.2.0

type HTTPClient interface {
	Do(req *http.Request) (*http.Response, error)
}

type HypeTrainResource added in v0.2.0

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

func NewHypeTrainResource added in v0.2.0

func NewHypeTrainResource(client *Client) *HypeTrainResource

type ModerationResource added in v0.2.0

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

func NewModerationResource added in v0.2.0

func NewModerationResource(client *Client) *ModerationResource

func (*ModerationResource) ClearChat added in v0.2.0

func (r *ModerationResource) ClearChat(broadcasterId, moderatorId string) *ClearChatRequest

ClearChat creates a request to clear all messages from a channel.

Required Scope: moderator:manage:chat_messages

func (*ModerationResource) CreateBan added in v0.2.0

func (r *ModerationResource) CreateBan(broadcasterId, moderatorId, userId string) *CreateBanRequest

CreateBan creates a request to ban a user from a channel.

Required Scope: moderator:manage:banned_users

func (*ModerationResource) RemoveBan added in v0.2.0

func (r *ModerationResource) RemoveBan(broadcasterId, moderatorId, userId string) *RemoveBanRequest

RemoveBan creates a request to remove a ban on a user from a channel.

Required Scope: moderator:manage:banned_users

type Pagination added in v0.2.0

type Pagination struct {
	Cursor string `json:"cursor,omitempty"`
}

type PollsResource added in v0.2.0

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

func NewPollsResource added in v0.2.0

func NewPollsResource(client *Client) *PollsResource

type PredictionsResource added in v0.2.0

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

func NewPredictionsResource added in v0.2.0

func NewPredictionsResource(client *Client) *PredictionsResource

type RaidsResource added in v0.2.0

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

func NewRaidsResource added in v0.2.0

func NewRaidsResource(client *Client) *RaidsResource

type RemoveBanRequest added in v0.2.0

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

func (*RemoveBanRequest) Do added in v0.2.0

func (c *RemoveBanRequest) Do(ctx context.Context, opts ...RequestOption) error

Do executes the request.

func (*RemoveBanRequest) TargetID added in v0.2.0

func (c *RemoveBanRequest) TargetID(userId string) *RemoveBanRequest

UserID the ID of the user to unban.

type RequestOption added in v0.2.0

type RequestOption func(*http.Request)

func AddQueryParameter added in v0.2.0

func AddQueryParameter(key, value string) RequestOption

AddQueryParameter adds a query parameter to the request without replacing any existing values.

func SetQueryParameter added in v0.2.0

func SetQueryParameter(key, value string) RequestOption

SetQueryParameter sets a query parameter on the request, replacing any existing values.

func WithBearerToken added in v0.2.0

func WithBearerToken(token string) RequestOption

WithBearerToken sets the bearer token to use for API requests.

type ResponseData added in v0.2.0

type ResponseData[T any] struct {
	Total  int `json:"total,omitempty"`  // Only present in some endpoints.
	Points int `json:"points,omitempty"` // Only present in some endpoints.

	Data       []T        `json:"data"`
	Pagination Pagination `json:"pagination,omitempty"`

	Status  int    `json:"status"`            // If not provided by Twitch, defaults to HTTP status code.
	Code    string `json:"error"`             // If not provided by Twitch, defaults to HTTP status text.
	Message string `json:"message,omitempty"` // Only present if status is non-200
}

type ScheduleResource added in v0.2.0

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

func NewScheduleResource added in v0.2.0

func NewScheduleResource(client *Client) *ScheduleResource

type SearchResource added in v0.2.0

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

func NewSearchResource added in v0.2.0

func NewSearchResource(client *Client) *SearchResource

type Stream added in v0.2.0

type Stream struct {
	ID              string    `json:"id"`
	UserID          string    `json:"user_id"`
	UserLogin       string    `json:"user_login"`
	UserDisplayName string    `json:"user_name"`
	GameID          string    `json:"game_id"`
	GameName        string    `json:"game_name"`
	Type            string    `json:"type"`
	Title           string    `json:"title"`
	Tags            []string  `json:"tags"`
	ViewerCount     int       `json:"viewer_count"`
	Language        string    `json:"language"`
	ThumbnailURL    string    `json:"thumbnail_url"`
	IsMature        bool      `json:"is_mature"`
	StartedAt       time.Time `json:"started_at"`
}

type StreamsListCall added in v0.2.0

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

func (*StreamsListCall) After added in v0.2.0

func (c *StreamsListCall) After(cursor string) *StreamsListCall

After filters the results to streams that started after the specified cursor.

func (*StreamsListCall) Before added in v0.2.0

func (c *StreamsListCall) Before(cursor string) *StreamsListCall

Before filters the results to streams that started before the specified cursor.

func (*StreamsListCall) Do added in v0.2.0

Do executes the request.

func (*StreamsListCall) First added in v0.2.0

func (c *StreamsListCall) First(n int) *StreamsListCall

First limits the number of results to the specified amount.

Maximum: 100 (default: 20)

func (*StreamsListCall) GameID added in v0.2.0

func (c *StreamsListCall) GameID(ids []string) *StreamsListCall

GameID filters the results to the specified game IDs.

func (*StreamsListCall) Languages added in v0.2.0

func (c *StreamsListCall) Languages(languages []string) *StreamsListCall

Language filters the results to the specified languages.

func (*StreamsListCall) Type added in v0.2.0

Type filters the results to the specified stream types.

Possible values: "all", "live" (Default: "all")

func (*StreamsListCall) UserID added in v0.2.0

func (c *StreamsListCall) UserID(ids []string) *StreamsListCall

UserID filters the results to the specified user IDs.

func (*StreamsListCall) Username added in v0.2.0

func (c *StreamsListCall) Username(usernames []string) *StreamsListCall

Username filters the results to the specified usernames.

type StreamsListResponse added in v0.2.0

type StreamsListResponse struct {
	Header http.Header
	Data   []Stream
	Cursor string
}

type StreamsResource added in v0.2.0

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

func NewStreamsResource added in v0.2.0

func NewStreamsResource(client *Client) *StreamsResource

func (*StreamsResource) List added in v0.2.0

func (r *StreamsResource) List() *StreamsListCall

List creates a request to list streams based on the specified criteria.

Requires an app or user access token. No scope is required.

type SubscriptionsResource added in v0.2.0

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

func NewSubscriptionsResource added in v0.2.0

func NewSubscriptionsResource(client *Client) *SubscriptionsResource

type TagsResource added in v0.2.0

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

func NewTagsResource added in v0.2.0

func NewTagsResource(client *Client) *TagsResource

type TeamsResource added in v0.2.0

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

func NewTeamsResource added in v0.2.0

func NewTeamsResource(client *Client) *TeamsResource

type TopGamesListCall added in v0.2.0

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

func (*TopGamesListCall) After added in v0.2.0

func (c *TopGamesListCall) After(cursor string) *TopGamesListCall

After filters the results to those with a cursor value after the specified cursor.

func (*TopGamesListCall) Before added in v0.2.0

func (c *TopGamesListCall) Before(cursor string) *TopGamesListCall

Before filters the results to those with a cursor value before the specified cursor.

func (*TopGamesListCall) Do added in v0.2.0

Do executes the request.

func (*TopGamesListCall) First added in v0.2.0

func (c *TopGamesListCall) First(n int) *TopGamesListCall

First limits the number of results to the specified amount.

Maximum: 100 (default: 20)

type TopGamesListResponse added in v0.2.0

type TopGamesListResponse struct {
	Header http.Header
	Data   []Game
	Cursor string
}

type TopGamesResource added in v0.2.0

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

func NewTopGamesResource added in v0.2.0

func NewTopGamesResource(client *Client) *TopGamesResource

func (*TopGamesResource) List added in v0.2.0

List creates a request to list top games based on the specified criteria.

type User added in v0.2.0

type User 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"`
	Email           string    `json:"email,omitempty"`
	CreatedAt       time.Time `json:"created_at"`
}

type UsersListCall added in v0.2.0

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

func (*UsersListCall) Do added in v0.2.0

Do executes the request.

func (*UsersListCall) ID added in v0.2.0

func (c *UsersListCall) ID(ids []string) *UsersListCall

ID filters the results to the specified user IDs.

func (*UsersListCall) Login added in v0.2.0

func (c *UsersListCall) Login(logins []string) *UsersListCall

Login filters the results to the specified usernames.

type UsersListResponse added in v0.2.0

type UsersListResponse struct {
	Header http.Header
	Data   []User
}

type UsersResource added in v0.2.0

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

func NewUsersResource added in v0.2.0

func NewUsersResource(client *Client) *UsersResource

func (*UsersResource) List added in v0.2.0

func (r *UsersResource) List() *UsersListCall

List creates a request to list users based on the specified criteria.

The email field will be empty unless the access token has the user:read:email scope.

type Video added in v0.2.1

type Video struct {
	ID              string        `json:"id"`
	StreamID        string        `json:"stream_id"`
	UserID          string        `json:"user_id"`
	UserLogin       string        `json:"user_login"`
	UserDisplayName string        `json:"user_name"`
	Title           string        `json:"title"`
	Description     string        `json:"description"`
	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        VideoDuration `json:"duration"`
	PublishedAt     time.Time     `json:"published_at"`
	CreatedAt       time.Time     `json:"created_at"`
}

type VideoDuration added in v0.2.2

type VideoDuration time.Duration

func (VideoDuration) AsDuration added in v0.2.2

func (d VideoDuration) AsDuration() time.Duration

func (*VideoDuration) UnmarshalJSON added in v0.2.2

func (d *VideoDuration) UnmarshalJSON(data []byte) error

type VideosDeleteCall added in v0.2.1

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

func (*VideosDeleteCall) Do added in v0.2.1

type VideosDeleteResponse added in v0.2.1

type VideosDeleteResponse struct {
	Header http.Header
	Data   []string
}

type VideosListCall added in v0.2.1

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

func (*VideosListCall) After added in v0.2.1

func (c *VideosListCall) After(cursor string) *VideosListCall

After filters the results to those with a cursor value after the specified cursor.

func (*VideosListCall) Before added in v0.2.1

func (c *VideosListCall) Before(cursor string) *VideosListCall

Before filters the results to those with a cursor value before the specified cursor.

func (*VideosListCall) Do added in v0.2.1

func (*VideosListCall) First added in v0.2.1

func (c *VideosListCall) First(n int) *VideosListCall

func (*VideosListCall) GameID added in v0.2.1

func (c *VideosListCall) GameID(id string) *VideosListCall

GameID filters the results to those with the specified game ID.

func (*VideosListCall) ID added in v0.2.1

func (c *VideosListCall) ID(ids []string) *VideosListCall

ID filters the results to those with the specified ID.

func (*VideosListCall) Language added in v0.2.1

func (c *VideosListCall) Language(language string) *VideosListCall

Language filters the results to those with the specified language.

func (*VideosListCall) Period added in v0.2.1

func (c *VideosListCall) Period(p string) *VideosListCall

Period filters the results to those with a specified period.

Possible values: "all", "day", "week", "month" (default: all)

func (*VideosListCall) Sort added in v0.2.1

func (c *VideosListCall) Sort(s string) *VideosListCall

Sort sets the order in which to list videos.

Possible values: "time", "trending", "views" (default: time)

func (*VideosListCall) Type added in v0.2.1

func (c *VideosListCall) Type(t string) *VideosListCall

Type filters the results to those with the specified type.

Possible values: "all", "upload", "archive", "highlight" (default: all)

func (*VideosListCall) UserID added in v0.2.1

func (c *VideosListCall) UserID(id string) *VideosListCall

UserID filters the results to those with the specified user ID.

type VideosListResponse added in v0.2.1

type VideosListResponse struct {
	Header http.Header
	Data   []Video
	Cursor string
}

type VideosResource added in v0.2.0

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

func NewVideosResource added in v0.2.0

func NewVideosResource(client *Client) *VideosResource

func (*VideosResource) Delete added in v0.2.1

func (r *VideosResource) Delete(ids []string) *VideosDeleteCall

Delete creates a new call to delete videos.

func (*VideosResource) List added in v0.2.1

func (r *VideosResource) List() *VideosListCall

List creates a new call to list videos.

One of ID, UserID, or GameID must be specified.

type WhispersInsertCall added in v0.2.0

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

func (*WhispersInsertCall) Do added in v0.2.0

Do executes the request.

req := client.Whispers.SendWhisper("123", "456").Message("Hello")
data, err := req.Do(ctx, api.WithBearerToken("kpvy3cjboyptmdkiacwr0c19hotn5s")

func (*WhispersInsertCall) Message added in v0.2.0

func (c *WhispersInsertCall) Message(message string) *WhispersInsertCall

Message the whisper message to send. The message must not be empty.

The maximum message lengths are:

  • 500 characters if the user you're sending the message to hasn't whispered you before.
  • 10,000 characters if the user you're sending the message to has whispered you before.

Messages that exceed the maximum length are truncated.

type WhispersResource added in v0.2.0

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

func NewWhispersResource added in v0.2.0

func NewWhispersResource(client *Client) *WhispersResource

func (*WhispersResource) Insert added in v0.2.0

func (r *WhispersResource) Insert(senderId, recipientId string) *WhispersInsertCall

Jump to

Keyboard shortcuts

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