api

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: May 4, 2025 License: BSD-3-Clause Imports: 9 Imported by: 0

Documentation

Index

Constants

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

BaseURL is the base URL for the Twitch API.

Variables

This section is empty.

Functions

func CodeOf

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

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

func (APIError) Error

func (err APIError) Error() string

type AdSchedule

type AdSchedule struct {
	Duration        int       `json:"duration"`
	NextAdAt        time.Time `json:"next_ad_at"`
	LastAdAt        time.Time `json:"last_ad_at"`
	PrerollFreeTime int       `json:"preroll_free_time"`
	SnoozeCount     int       `json:"snooze_count"`
	SnoozeRefreshAt time.Time `json:"snooze_refresh_at"`
}

type AdSnooze

type AdSnooze struct {
	SnoozeCount     int       `json:"snooze_count"`
	SnoozeRefreshAt time.Time `json:"snooze_refresh_at"`
	NextAdAt        time.Time `json:"next_ad_at"`
}

type AdsInsertRequest

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

func (*AdsInsertRequest) Do

Do executes the request.

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

func (*AdsInsertRequest) Duration

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

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

type AdsResource

type AdsResource struct {
	Schedule *AdsScheduleResource
	Snooze   *AdsSnoozeResource
	// contains filtered or unexported fields
}

func NewAdsResource

func NewAdsResource(client *Client) *AdsResource

func (*AdsResource) Insert

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 AdsScheduleListRequest

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

func (*AdsScheduleListRequest) Do

Do executes the request.

type AdsScheduleListResponse

type AdsScheduleListResponse struct {
	Header http.Header
	Data   []AdSchedule
}

type AdsScheduleResource

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

func NewAdsScheduleResource

func NewAdsScheduleResource(client *Client) *AdsScheduleResource

func (*AdsScheduleResource) List

func (r *AdsScheduleResource) List(broadcasterId string) *AdsScheduleListRequest

List returns ad schedule related information, including snooze, when the last ad was run, when the next ad is scheduled, and if the channel is currently in pre-roll free time.

NOTE: A new advertisement can NOT be run until 8 minutes running the previous.

Required Scope: channel:read:ads

type AdsSnoozeRequest

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

func (*AdsSnoozeRequest) Do

Do executes the request.

type AdsSnoozeResource

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

func NewAdsSnoozeResource

func NewAdsSnoozeResource(client *Client) *AdsSnoozeResource

func (*AdsSnoozeResource) Insert

func (r *AdsSnoozeResource) Insert(broadcasterId string) *AdsSnoozeRequest

Insert if available, pushes back the timestamp of the upcoming automatic advertisement mid-roll by 5 minutes. This endpoint duplicates the snooze functionality in the creator dashboard's Ad Manager.

Required Scope: channel:manage:ads

type AdsSnoozeResponse

type AdsSnoozeResponse struct {
	Header http.Header
	Data   []AdSnooze
}

type AnalyticsDateRange

type AnalyticsDateRange struct {
	StartedAt time.Time `json:"started_at"`
	EndedAt   time.Time `json:"ended_at"`
}

type AnalyticsExtensionListCall

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

func (*AnalyticsExtensionListCall) After

After A cursor for forward pagination: the first set of results to return. Provide this value in the after query parameter.

func (*AnalyticsExtensionListCall) Do

Do executes the request.

func (*AnalyticsExtensionListCall) EndedAt

EndedAt The end of the date range for the report.

func (*AnalyticsExtensionListCall) ExtensionID

ExtensionID If specified, the response contains a report for the specified extension. If not specified, the response includes a report for each extension that the authenticated user owns.

func (*AnalyticsExtensionListCall) First

First The number of records to return. Maximum: 100. Default: 20.

func (*AnalyticsExtensionListCall) StartedAt

StartedAt The start of the date range for the report.

func (*AnalyticsExtensionListCall) Type

Type The type of analytics report to get. Possible values are:

  • overview_v2

type AnalyticsExtensionListResponse

type AnalyticsExtensionListResponse struct {
	Header     http.Header
	Data       []ExtensionAnalytics
	Pagination Pagination
}

type AnalyticsExtensionResource

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

func NewAnalyticsExtensionResource

func NewAnalyticsExtensionResource(client *Client) *AnalyticsExtensionResource

func (*AnalyticsExtensionResource) List

type AnalyticsGameListCall

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

func (*AnalyticsGameListCall) After

After A cursor for forward pagination: the first set of results to return. Provide this value in the after query parameter.

func (*AnalyticsGameListCall) Do

Do executes the request.

func (*AnalyticsGameListCall) EndedAt

EndedAt The end of the date range for the report.

func (*AnalyticsGameListCall) First

First The number of records to return. Maximum: 100. Default: 20.

func (*AnalyticsGameListCall) GameID

GameID If specified, the response contains a report for the specified game. If not specified, the response includes a report for each game that the authenticated user has played.

func (*AnalyticsGameListCall) StartedAt

StartedAt The start of the date range for the report.

type AnalyticsGameListResponse

type AnalyticsGameListResponse struct {
	Header     http.Header
	Data       []GameAnalytics
	Pagination Pagination
}

type AnalyticsGameResource

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

func NewAnalyticsGameResource

func NewAnalyticsGameResource(client *Client) *AnalyticsGameResource

func (*AnalyticsGameResource) List

type AnalyticsResource

type AnalyticsResource struct {
	Extensions *AnalyticsExtensionResource
	Games      *AnalyticsGameResource
	// contains filtered or unexported fields
}

func NewAnalyticsResource

func NewAnalyticsResource(client *Client) *AnalyticsResource

type BitsExtensionTransactionsResource

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

func NewBitsExtensionTransactionsResource

func NewBitsExtensionTransactionsResource(client *Client) *BitsExtensionTransactionsResource

func (*BitsExtensionTransactionsResource) List

type BitsLeaderboardEntry

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

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

func (*BitsLeaderboardListCall) Count

Count limits the number of results to return.

Maximum: 100 (default: 10)

func (*BitsLeaderboardListCall) Do

Do executes the request.

func (*BitsLeaderboardListCall) Period

Period sets the time period over which data is aggregated.

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

func (*BitsLeaderboardListCall) StartedAt

StartedAt the start date used for determining the aggregation period.

func (*BitsLeaderboardListCall) UserID

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

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

type BitsLeaderboardResource

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

func NewBitsLeaderboardResource

func NewBitsLeaderboardResource(client *Client) *BitsLeaderboardResource

func (*BitsLeaderboardResource) List

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

type BitsResource

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

func NewBitsResource

func NewBitsResource(client *Client) *BitsResource

type BitsTransactionsListCall

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

func (*BitsTransactionsListCall) After

func (*BitsTransactionsListCall) Do

func (*BitsTransactionsListCall) First

func (*BitsTransactionsListCall) TransactionID

func (c *BitsTransactionsListCall) TransactionID(ids ...string) *BitsTransactionsListCall

type BitsTransactionsListResponse

type BitsTransactionsListResponse struct {
	Header     http.Header
	Data       []ExtensionTransaction
	Pagination Pagination
}

type Channel

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

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

func NewChannelPointsResource

func NewChannelPointsResource(client *Client) *ChannelPointsResource

type ChannelsListCall

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

func (*ChannelsListCall) BroadcasterID

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

BroadcasterID filters the results to the specified broadcaster ID.

func (*ChannelsListCall) Do

Do executes the request.

type ChannelsListResponse

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

type ChannelsResource

type ChannelsResource struct {
	Followed  *FollowedResource
	Followers *FollowersResource
	// contains filtered or unexported fields
}

func NewChannelsResource

func NewChannelsResource(client *Client) *ChannelsResource

func (*ChannelsResource) List

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

type CharityResource

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

func NewCharityResource

func NewCharityResource(client *Client) *CharityResource

type ChatResource

type ChatResource struct {
	Chatters *ChattersResource
	// contains filtered or unexported fields
}

func NewChatResource

func NewChatResource(client *Client) *ChatResource

func (*ChatResource) List

func (r *ChatResource) List(broadcasterId, moderatorId string) *ChattersListCall

List creates a new call to list chatters.

type Chatter

type Chatter struct {
	ID          string `json:"user_id"`
	Username    string `json:"user_login"`
	DisplayName string `json:"user_name"`
}

type ChatterBan

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 ChattersListCall

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

func (*ChattersListCall) After

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

After filters the results to those after the specified cursor.

func (*ChattersListCall) Do

func (*ChattersListCall) First

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

First filters the results to the first n chatters.

type ChattersResource

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

func NewChattersResource

func NewChattersResource(client *Client) *ChattersResource

type ChattersResponse

type ChattersResponse struct {
	Total    int
	Header   http.Header
	Chatters []Chatter
	Cursor   string
}

type Cheermote

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

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

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

func (*CheermotesListCall) BroadcasterID

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

BroadcasterID filters the results to the specified broadcaster ID.

func (*CheermotesListCall) Do

BroadcasterName filters the results to the specified broadcaster name.

type CheermotesListResponse

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

type CheermotesResource

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

func NewCheermotesResource

func NewCheermotesResource(client *Client) *CheermotesResource

func (*CheermotesResource) List

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

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

func (*ClearChatRequest) Do

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

Do executes the request.

func (*ClearChatRequest) MessageID

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
	Conduits      *ConduitsResource
	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

type ClientOption func(*Client)

func WithClientSecret

func WithClientSecret(secret string) ClientOption

WithClientSecret sets the client secret to use for API requests.

func WithDefaultBearerToken

func WithDefaultBearerToken(token string) ClientOption

WithDefaultBearerToken sets the bearer token to use for API requests.

This can be considered dangerous as if a token is not provided per request, this will become the default token. Some developers may prefer to default to the App Access Token using this method. However, it is recommended to still use the WithBearerToken option for requests that require a token as this method always will fail if the App Access Token has expired.

func WithHTTPClient

func WithHTTPClient(client HTTPClient) ClientOption

WithHTTPClient sets the HTTP client to use for API requests.

type Clip

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

type ClipDuration time.Duration

func (ClipDuration) AsDuration

func (d ClipDuration) AsDuration() time.Duration

func (*ClipDuration) UnmarshalJSON

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

type ClipsListCall

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

func (*ClipsListCall) After

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

After filters the results to those after the specified cursor.

func (*ClipsListCall) Before

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

Before filters the results to those before the specified cursor.

func (*ClipsListCall) BroadcasterID

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

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

func (*ClipsListCall) Do

Do executes the call.

func (*ClipsListCall) EndedAt

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

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

func (*ClipsListCall) Featured

func (c *ClipsListCall) Featured() *ClipsListCall

Featured filters the results to only those that are featured.

func (*ClipsListCall) First

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

First filters the results to the first n clips.

func (*ClipsListCall) GameID

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

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

func (*ClipsListCall) ID

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

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

func (*ClipsListCall) StartedAt

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

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

type ClipsListResponse

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

type ClipsResource

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

func NewClipsResource

func NewClipsResource(client *Client) *ClipsResource

func (*ClipsResource) List

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

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

type Conduit

type Conduit struct {
	ID         string `json:"id"`
	ShardCount int    `json:"shard_count"`
}

Conduit represents a Twitch Eventsub Conduit.

type ConduitDeleteCall

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

ConduitDeleteCall is the API call for deleting a Twitch Eventsub Conduit.

func (*ConduitDeleteCall) Do

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

Do executes the request.

type ConduitInsertCall

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

ConduitInsertCall is the API call for creating a new Twitch Eventsub Conduit.

func (*ConduitInsertCall) Do

Do executes the request.

func (*ConduitInsertCall) ShardCount

func (c *ConduitInsertCall) ShardCount(n int) *ConduitInsertCall

ShardCount sets the shard count for the new conduit.

type ConduitShard

type ConduitShard struct {
	ID        string    `json:"id"`
	Status    string    `json:"status"`
	Transport Transport `json:"transport"`
}

ConduitShard is a shard for a Twitch Eventsub Conduit.

type ConduitShardListCall

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

ConduitShardListCall is the API call for listing Twitch Eventsub Conduit Shards.

func (*ConduitShardListCall) After

After sets the cursor for pagination.

func (*ConduitShardListCall) Do

Do executes the request.

func (*ConduitShardListCall) Status

Status filters the list of shards by status.

type ConduitShardUpdateCall

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

ConduitShardUpdateCall is the API call for updating Twitch Eventsub Conduit Shards.

func (*ConduitShardUpdateCall) Do

Do executes the request.

func (*ConduitShardUpdateCall) Shard

func (c *ConduitShardUpdateCall) Shard(shardID string, transport Transport) *ConduitShardUpdateCall

Shard adds a shard to the update call.

type ConduitShardsResource

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

ConduitShardsResource is the API resource for managing Twitch Eventsub Conduit Shards.

func NewConduitShardsResource

func NewConduitShardsResource(client *Client) *ConduitShardsResource

NewConduitShardsResource creates a new ConduitShardsResource.

func (*ConduitShardsResource) List

List creates a new ConduitShardListCall.

func (*ConduitShardsResource) Update

func (r *ConduitShardsResource) Update(conduitID string) *ConduitShardUpdateCall

Update creates a new ConduitShardUpdateCall.

type ConduitShardsResponse

type ConduitShardsResponse struct {
	Header http.Header
	Shards []ConduitShard
	Cursor string
}

ConduitShardsResponse represents the response from the Twitch Eventsub Conduit Shards API.

type ConduitUpdateCall

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

ConduitUpdateCall is the API call for updating a Twitch Eventsub Conduit.

func (*ConduitUpdateCall) Do

Do executes the request.

func (*ConduitUpdateCall) ShardCount

func (c *ConduitUpdateCall) ShardCount(n int) *ConduitUpdateCall

ShardCount sets the shard count for the conduit.

type ConduitsListCall

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

ConduitsListCall is the API call for listing an apps Twitch Eventsub Conduits.

func (*ConduitsListCall) Do

Do executes the request.

type ConduitsResource

type ConduitsResource struct {
	Shards *ConduitShardsResource
	// contains filtered or unexported fields
}

ConduitsResource is the API resource for managing Twitch Eventsub Conduits.

func NewConduitsResource

func NewConduitsResource(client *Client) *ConduitsResource

NewConduitsResource creates a new ConduitsResource.

func (*ConduitsResource) Delete

func (r *ConduitsResource) Delete(id string) *ConduitDeleteCall

Delete creates a new ConduitDeleteCall.

func (*ConduitsResource) Insert

func (r *ConduitsResource) Insert() *ConduitInsertCall

Insert creates a new ConduitInsertCall.

func (*ConduitsResource) List

List creates a new ConduitsListCall.

func (*ConduitsResource) Update

func (r *ConduitsResource) Update(id string) *ConduitUpdateCall

Update creates a new ConduitUpdateCall.

type ConduitsResponse

type ConduitsResponse struct {
	Header   http.Header
	Conduits []Conduit
}

ConduitsResponse represents the response from the Twitch Eventsub Conduits API.

type CreateBanRequest

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

func (*CreateBanRequest) Do

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

Do executes the request.

func (*CreateBanRequest) Duration

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

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

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

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

type CustomReward

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

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

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

func (*CustomRewardsDeleteCall) Do

Do executes the request.

type CustomRewardsInsertCall

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

func (*CustomRewardsInsertCall) BackgroundColor

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

func (*CustomRewardsInsertCall) Cost

func (*CustomRewardsInsertCall) Do

Do executes the request.

func (*CustomRewardsInsertCall) GlobalCooldown

func (*CustomRewardsInsertCall) IsEnabled

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

func (*CustomRewardsInsertCall) IsGlobalCooldownEnabled

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

func (*CustomRewardsInsertCall) IsMaxPerStreamEnabled

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

func (*CustomRewardsInsertCall) IsMaxPerUserPerStreamEnabled

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

func (*CustomRewardsInsertCall) IsPaused

func (*CustomRewardsInsertCall) IsUserInputRequired

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

func (*CustomRewardsInsertCall) MaxPerStream

func (*CustomRewardsInsertCall) MaxPerUserPerStream

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

func (*CustomRewardsInsertCall) Prompt

func (*CustomRewardsInsertCall) ShouldRedemptionsSkipRequestQueue

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

func (*CustomRewardsInsertCall) Title

type CustomRewardsInsertResponse

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

type CustomRewardsListCall

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

func (*CustomRewardsListCall) Do

Do executes the request.

func (*CustomRewardsListCall) ID

ID filters the results to the specified reward IDs.

func (*CustomRewardsListCall) OnlyManageable

func (c *CustomRewardsListCall) OnlyManageable() *CustomRewardsListCall

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

type CustomRewardsListResponse

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

type CustomRewardsRedemptionListCall

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

func (*CustomRewardsRedemptionListCall) After

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

func (*CustomRewardsRedemptionListCall) Before

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

func (*CustomRewardsRedemptionListCall) Do

Do executes the request.

func (*CustomRewardsRedemptionListCall) ID

ID filters the results to the specified reward redemption IDs.

func (*CustomRewardsRedemptionListCall) Sort

Sort specifies the order in which to sort the results.

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

func (*CustomRewardsRedemptionListCall) Status

Status filters the results to the specified statuses.

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

type CustomRewardsRedemptionListResponse

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

type CustomRewardsRedemptionResource

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

func NewCustomRewardsRedemptionResource

func NewCustomRewardsRedemptionResource(client *Client) *CustomRewardsRedemptionResource

func (*CustomRewardsRedemptionResource) List

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

func (*CustomRewardsRedemptionResource) Update

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

type CustomRewardsRedemptionUpdateCall

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

func (*CustomRewardsRedemptionUpdateCall) Cancel

func (*CustomRewardsRedemptionUpdateCall) Do

Do executes the request.

func (*CustomRewardsRedemptionUpdateCall) Fulfill

type CustomRewardsRedemptionUpdateResponse

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

type CustomRewardsResource

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

func NewCustomRewardsResource

func NewCustomRewardsResource(client *Client) *CustomRewardsResource

func (*CustomRewardsResource) Delete

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

func (*CustomRewardsResource) Insert

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

func (*CustomRewardsResource) List

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

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

func (*CustomRewardsResource) Update

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

type CustomRewardsUpdateCall

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

func (*CustomRewardsUpdateCall) BackgroundColor

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

func (*CustomRewardsUpdateCall) Cost

func (*CustomRewardsUpdateCall) Do

Do executes the request.

func (*CustomRewardsUpdateCall) GlobalCooldown

func (*CustomRewardsUpdateCall) IsEnabled

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

func (*CustomRewardsUpdateCall) IsGlobalCooldownEnabled

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

func (*CustomRewardsUpdateCall) IsMaxPerStreamEnabled

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

func (*CustomRewardsUpdateCall) IsMaxPerUserPerStreamEnabled

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

func (*CustomRewardsUpdateCall) IsPaused

func (*CustomRewardsUpdateCall) IsUserInputRequired

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

func (*CustomRewardsUpdateCall) MaxPerStream

func (*CustomRewardsUpdateCall) MaxPerUserPerStream

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

func (*CustomRewardsUpdateCall) Prompt

func (*CustomRewardsUpdateCall) ShouldRedemptionsSkipRequestQueue

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

func (*CustomRewardsUpdateCall) Title

type CustomRewardsUpdateResponse

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

type EntitlementsResource

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

func NewEntitlementsResource

func NewEntitlementsResource(client *Client) *EntitlementsResource

type EventSubResource

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

func NewEventSubResource

func NewEventSubResource(client *Client) *EventSubResource

type ExtensionAnalytics

type ExtensionAnalytics struct {
	ExtensionID string             `json:"extension_id"`
	URL         string             `json:"URL"`
	Type        string             `json:"type"`
	DateRate    AnalyticsDateRange `json:"date_range"`
}

type ExtensionProduct

type ExtensionProduct struct {
	Sku           string               `json:"sku"`
	Domain        string               `json:"domain"`
	Cost          ExtensionProductCost `json:"cost"`
	InDevelopment bool                 `json:"inDevelopment"`
	DisplayName   string               `json:"displayName"`
	Broadcast     bool                 `json:"broadcast"`
}

type ExtensionProductCost

type ExtensionProductCost struct {
	Amount int    `json:"amount"`
	Type   string `json:"type"`
}

type ExtensionTransaction

type ExtensionTransaction struct {
	ID               string           `json:"id"`
	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"`
	Product          ExtensionProduct `json:"product_data"`
	Timestamp        time.Time        `json:"timestamp"`
}

type ExtensionsResource

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

func NewExtensionsResource

func NewExtensionsResource(client *Client) *ExtensionsResource

type Followed

type Followed struct {
	BroadcasterID    string    `json:"broadcaster_id"`
	BroadcasterLogin string    `json:"broadcaster_login"`
	BroadcasterName  string    `json:"broadcaster_name"`
	FollowedAt       time.Time `json:"followed_at"`
}

type FollowedListCall

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

func (*FollowedListCall) After

func (c *FollowedListCall) After(n int) *FollowedListCall

The cursor used to get the next page of results.

func (*FollowedListCall) BroadcasterID

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

Use this parameter to see whether the user follows this broadcaster. If specified, the response contains this broadcaster if the user follows them. If not specified, the response contains all broadcasters that the user follows.

func (*FollowedListCall) Do

func (*FollowedListCall) First

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

The minimum page size is 1 item per page and the maximum is 100. The default is 20.

func (*FollowedListCall) UserID

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

UserID returns the list of broadcasters that this user follows

type FollowedListResponse

type FollowedListResponse struct {
	Header http.Header
	Data   []Followed
	Cursor string
}

type FollowedResource

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

func NewFollowedResource

func NewFollowedResource(client *Client) *FollowedResource

func (*FollowedResource) List

type Follower

type Follower struct {
	UserID     string    `json:"user_id"`
	UserLogin  string    `json:"user_login"`
	UserName   string    `json:"user_name"`
	FollowedAt time.Time `json:"followed_at"`
}

type FollowersListCall

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

func (*FollowersListCall) After

The cursor used to get the next page of results.

func (*FollowersListCall) BroadcasterID

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

BroadcasterID filters the results to the specified broadcaster ID.

func (*FollowersListCall) Do

func (*FollowersListCall) First

The minimum page size is 1 item per page and the maximum is 100. The default is 20.

func (*FollowersListCall) UserID

UserID filters the results to the specified user ID.

type FollowersListResponse

type FollowersListResponse struct {
	Header http.Header
	Data   []Follower
	Cursor string
}

type FollowersResource

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

func NewFollowersResource

func NewFollowersResource(client *Client) *FollowersResource

func (*FollowersResource) List

type Game

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

type GameAnalytics

type GameAnalytics struct {
	GameID   string             `json:"game_id"`
	URL      string             `json:"URL"`
	DateRate AnalyticsDateRange `json:"date_range"`
}

type GamesResource

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

func NewGamesResource

func NewGamesResource(client *Client) *GamesResource

type GoalsResource

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

func NewGoalsResource

func NewGoalsResource(client *Client) *GoalsResource

type GuestStarResource

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

func NewGuestStarResource

func NewGuestStarResource(client *Client) *GuestStarResource

type HTTPClient

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

type HypeTrainResource

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

func NewHypeTrainResource

func NewHypeTrainResource(client *Client) *HypeTrainResource

type ModerationResource

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

func NewModerationResource

func NewModerationResource(client *Client) *ModerationResource

func (*ModerationResource) ClearChat

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

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

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

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

type PollsResource

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

func NewPollsResource

func NewPollsResource(client *Client) *PollsResource

type PredictionsResource

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

func NewPredictionsResource

func NewPredictionsResource(client *Client) *PredictionsResource

type RaidsResource

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

func NewRaidsResource

func NewRaidsResource(client *Client) *RaidsResource

type RemoveBanRequest

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

func (*RemoveBanRequest) Do

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

Do executes the request.

func (*RemoveBanRequest) TargetID

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

UserID the ID of the user to unban.

type RequestOption

type RequestOption func(*http.Request)

func AddQueryParameter

func AddQueryParameter(key, value string) RequestOption

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

func SetQueryParameter

func SetQueryParameter(key, value string) RequestOption

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

func WithBearerToken

func WithBearerToken(token string) RequestOption

WithBearerToken sets the bearer token to use for API requests.

type ResponseData

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

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

func NewScheduleResource

func NewScheduleResource(client *Client) *ScheduleResource

type SearchResource

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

func NewSearchResource

func NewSearchResource(client *Client) *SearchResource

type Stream

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

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

func (*StreamsListCall) After

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

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

func (*StreamsListCall) Before

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

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

func (*StreamsListCall) Do

Do executes the request.

func (*StreamsListCall) First

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

First limits the number of results to the specified amount.

Maximum: 100 (default: 20)

func (*StreamsListCall) GameID

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

GameID filters the results to the specified game IDs.

func (*StreamsListCall) Languages

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

Language filters the results to the specified languages.

func (*StreamsListCall) Type

Type filters the results to the specified stream types.

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

func (*StreamsListCall) UserID

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

UserID filters the results to the specified user IDs.

func (*StreamsListCall) Username

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

Username filters the results to the specified usernames.

type StreamsListResponse

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

type StreamsResource

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

func NewStreamsResource

func NewStreamsResource(client *Client) *StreamsResource

func (*StreamsResource) List

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

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

func NewSubscriptionsResource

func NewSubscriptionsResource(client *Client) *SubscriptionsResource

type TagsResource

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

func NewTagsResource

func NewTagsResource(client *Client) *TagsResource

type TeamsResource

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

func NewTeamsResource

func NewTeamsResource(client *Client) *TeamsResource

type TopGamesListCall

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

func (*TopGamesListCall) After

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

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

func (*TopGamesListCall) Before

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

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

func (*TopGamesListCall) Do

Do executes the request.

func (*TopGamesListCall) First

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

First limits the number of results to the specified amount.

Maximum: 100 (default: 20)

type TopGamesListResponse

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

type TopGamesResource

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

func NewTopGamesResource

func NewTopGamesResource(client *Client) *TopGamesResource

func (*TopGamesResource) List

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

type Transport

type Transport struct {
	Method         string     `json:"method"`
	Callback       *string    `json:"callback,omitempty"`
	Secret         *string    `json:"secret,omitempty"`
	SessionID      *string    `json:"session_id,omitempty"`
	ConnectedAt    *time.Time `json:"connected_at,omitempty"`
	DisconnectedAt *time.Time `json:"disconnected_at,omitempty"`
}

Transport is the transport method for a Twitch Eventsub Conduit Shard.

func NewWebSocketTransport

func NewWebSocketTransport(sessionID string) Transport

NewWebSocketTransport creates a new websocket transport for a Twitch Eventsub Conduit Shard.

func NewWebhookTransport

func NewWebhookTransport(callback, secret string) Transport

NewWebhookTransport creates a new webhook transport for a Twitch Eventsub Conduit Shard.

type User

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

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

func (*UsersListCall) Do

Do executes the request.

func (*UsersListCall) ID

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

ID filters the results to the specified user IDs.

func (*UsersListCall) Login

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

Login filters the results to the specified usernames.

type UsersListResponse

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

type UsersResource

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

func NewUsersResource

func NewUsersResource(client *Client) *UsersResource

func (*UsersResource) List

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

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

type VideoDuration time.Duration

func (VideoDuration) AsDuration

func (d VideoDuration) AsDuration() time.Duration

func (*VideoDuration) UnmarshalJSON

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

type VideosDeleteCall

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

func (*VideosDeleteCall) Do

type VideosDeleteResponse

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

type VideosListCall

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

func (*VideosListCall) After

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

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

func (*VideosListCall) Before

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

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

func (*VideosListCall) Do

func (*VideosListCall) First

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

func (*VideosListCall) GameID

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

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

func (*VideosListCall) ID

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

ID filters the results to those with the specified ID.

func (*VideosListCall) Language

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

Language filters the results to those with the specified language.

func (*VideosListCall) Period

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

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

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

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

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

type VideosListResponse

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

type VideosResource

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

func NewVideosResource

func NewVideosResource(client *Client) *VideosResource

func (*VideosResource) Delete

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

Delete creates a new call to delete videos.

func (*VideosResource) List

func (r *VideosResource) List() *VideosListCall

List creates a new call to list videos.

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

type WhispersInsertCall

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

func (*WhispersInsertCall) Do

Do executes the request.

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

func (*WhispersInsertCall) Message

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

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

func NewWhispersResource

func NewWhispersResource(client *Client) *WhispersResource

func (*WhispersResource) Insert

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