Documentation
¶
Index ¶
- Variables
- type API
- func (a *API) BanUser(ctx context.Context, broadcasterID string, moderatorID string, ...) error
- func (a *API) CreateClip(ctx context.Context, broadcastID string, hasDelay bool) (CreatedClip, error)
- func (a *API) CreateEventSubSubscription(ctx context.Context, reqData CreateEventSubSubscriptionRequest) (CreateEventSubSubscriptionResponse, error)
- func (a *API) CreateStreamMarker(ctx context.Context, req CreateStreamMarkerRequest) (StreamMarker, error)
- func (a *API) DeleteMessage(ctx context.Context, broadcasterID string, moderatorID string, ...) error
- func (a *API) DeleteSubSubscriptions(ctx context.Context, id string) error
- func (a *API) FetchAllUserEmotes(ctx context.Context, userID string, broadcasterID string) ([]UserEmoteImage, string, error)
- func (a *API) FetchEventSubSubscriptions(ctx context.Context, status, subType, userID string) ([]EventSubData, error)
- func (a *API) FetchUnbanRequests(ctx context.Context, broadcasterID, moderatorID string) ([]UnbanRequest, error)
- func (a *API) FetchUserFollowedChannels(ctx context.Context, userID string, broadcasterID string) ([]FollowedChannel, error)
- func (a *API) GetChannelChatBadges(ctx context.Context, broadcasterID string) ([]BadgeSet, error)
- func (a *API) GetChannelEmotes(ctx context.Context, broadcaster string) (EmoteResponse, error)
- func (a *API) GetChatSettings(ctx context.Context, broadcasterID string, moderatorID string) (GetChatSettingsResponse, error)
- func (a *API) GetGlobalChatBadges(ctx context.Context) ([]BadgeSet, error)
- func (a *API) GetGlobalEmotes(ctx context.Context) (EmoteResponse, error)
- func (a *API) GetStreamInfo(ctx context.Context, broadcastID []string) (GetStreamsResponse, error)
- func (a *API) GetUserChatColor(ctx context.Context, userIDs []string) ([]UserChatColor, error)
- func (a *API) GetUsers(ctx context.Context, logins []string, ids []string) (UserResponse, error)
- func (a *API) ResolveBanRequest(ctx context.Context, broadcasterID, moderatorID, requestID, status string) (UnbanRequest, error)
- func (a *API) SendChatAnnouncement(ctx context.Context, broadcasterID string, moderatorID string, ...) error
- func (a *API) SendChatMessage(ctx context.Context, data SendChatMessageRequest) (SendChatMessageResponse, error)
- func (a *API) UnbanUser(ctx context.Context, broadcasterID string, moderatorID string, userID string) error
- type APIError
- type APIOptionFunc
- type AccountProvider
- type BadgeSet
- type BadgeVersion
- type BanUserData
- type BanUserRequest
- type ChatAnnouncementColor
- type ChatSettingData
- type CreateChatAnnouncementRequest
- type CreateClipResponse
- type CreateEventSubSubscriptionRequest
- type CreateEventSubSubscriptionResponse
- type CreateStreamMarkerRequest
- type CreateStreamMarkerResponse
- type CreatedClip
- type DropReason
- type EmoteData
- type EmoteImage
- type EmoteResponse
- type EventSubData
- type EventSubTransport
- type EventSubTransportRequest
- type FollowedChannel
- type GetChannelChatBadgesResp
- type GetChatSettingsResponse
- type GetEventSubSubscriptionsResponse
- type GetFollowedChannelsResponse
- type GetGlobalBadgesResp
- type GetStreamsResponse
- type GetUnbanRequestsResponse
- type GetUserChatColorResponse
- type GetUserEmotesResponse
- type Pagination
- type SendChatMessageData
- type SendChatMessageRequest
- type SendChatMessageResponse
- type StreamData
- type StreamMarker
- type TokenRefresher
- type UnbanRequest
- type UserChatColor
- type UserData
- type UserEmoteImage
- type UserResponse
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ErrNoAuthProvided = errors.New("one of app secret or user access token needs to be provided") ErrNoUserAccess = errors.New("user endpoint called when no token was provided") ErrUserRefreshToken = errors.New("the provided user refresh token is empty") ErrNoRefresher = errors.New("refresher was not provided") ErrNoClientSecret = errors.New("no app access token was provided") ErrAppTokenStatusCode = errors.New("invalid status code response while creating app access token") )
Functions ¶
This section is empty.
Types ¶
type API ¶
type API struct {
// contains filtered or unexported fields
}
func (*API) CreateClip ¶
func (*API) CreateEventSubSubscription ¶
func (a *API) CreateEventSubSubscription(ctx context.Context, reqData CreateEventSubSubscriptionRequest) (CreateEventSubSubscriptionResponse, error)
func (*API) CreateStreamMarker ¶
func (a *API) CreateStreamMarker(ctx context.Context, req CreateStreamMarkerRequest) (StreamMarker, error)
func (*API) DeleteMessage ¶
func (*API) DeleteSubSubscriptions ¶
func (*API) FetchAllUserEmotes ¶
func (*API) FetchEventSubSubscriptions ¶
func (a *API) FetchEventSubSubscriptions(ctx context.Context, status, subType, userID string) ([]EventSubData, error)
https://dev.twitch.tv/docs/api/reference/#get-eventsub-subscriptions
func (*API) FetchUnbanRequests ¶
func (*API) FetchUserFollowedChannels ¶
func (*API) GetChannelChatBadges ¶
func (*API) GetChannelEmotes ¶
func (*API) GetChatSettings ¶
func (a *API) GetChatSettings(ctx context.Context, broadcasterID string, moderatorID string) (GetChatSettingsResponse, error)
moderatorID needs to match ID of the user the token was generated for
func (*API) GetGlobalChatBadges ¶
func (*API) GetGlobalEmotes ¶
func (a *API) GetGlobalEmotes(ctx context.Context) (EmoteResponse, error)
func (*API) GetStreamInfo ¶
func (*API) GetUserChatColor ¶
func (*API) ResolveBanRequest ¶
func (*API) SendChatAnnouncement ¶
func (*API) SendChatMessage ¶
func (a *API) SendChatMessage(ctx context.Context, data SendChatMessageRequest) (SendChatMessageResponse, error)
type APIError ¶
type APIError struct {
ErrorText string `json:"error"`
Status int `json:"status"`
Message string `json:"message"`
}
error response
type APIOptionFunc ¶
func WithClientSecret ¶
func WithClientSecret(secret string) APIOptionFunc
func WithHTTPClient ¶
func WithHTTPClient(client *http.Client) APIOptionFunc
func WithUserAuthentication ¶
func WithUserAuthentication(provider AccountProvider, refresher TokenRefresher, accountID string) APIOptionFunc
type AccountProvider ¶
type BadgeSet ¶
type BadgeSet struct {
ID string `json:"set_id"`
Versions []BadgeVersion `json:"versions"`
}
type BadgeVersion ¶
type BadgeVersion struct {
ID string `json:"id"`
Image_URL_1x string `json:"image_url_1x"`
Image_URL_2x string `json:"image_url_2x"`
Image_URL_4x string `json:"image_url_4x"`
Title string `json:"title"`
Description string `json:"description"`
ClickAction string `json:"click_action"`
ClickURL string `json:"click_url"`
}
type BanUserData ¶
type BanUserRequest ¶
type BanUserRequest struct {
Data BanUserData `json:"data"`
}
type ChatAnnouncementColor ¶
type ChatAnnouncementColor string
const ( ChatAnnouncementColorBlue ChatAnnouncementColor = "blue" ChatAnnouncementColorGreen ChatAnnouncementColor = "green" ChatAnnouncementColorOrange ChatAnnouncementColor = "orange" ChatAnnouncementColorPurple ChatAnnouncementColor = "purple" ChatAnnouncementColorPrimary ChatAnnouncementColor = "primary" )
type ChatSettingData ¶
type ChatSettingData struct {
BroadcasterID string `json:"broadcaster_id"`
SlowMode bool `json:"slow_mode"`
SlowModeWaitTime int `json:"slow_mode_wait_time"` // in seconds
FollowerMode bool `json:"follower_mode"`
FollowerModeDuration int `json:"follower_mode_duration"` // in minutes
SubscriberMode bool `json:"subscriber_mode"`
EmoteMode bool `json:"emote_mode"`
UniqueChatMode bool `json:"unique_chat_mode"`
NonModeratorChatDelay bool `json:"non_moderator_chat_delay"`
NonModeratorChatDelayDuration int `json:"non_moderator_chat_delay_duration"` // in seconds
}
type CreateChatAnnouncementRequest ¶
type CreateChatAnnouncementRequest struct {
Message string `json:"message"`
Color ChatAnnouncementColor `json:"color"`
}
https://dev.twitch.tv/docs/api/reference/#send-chat-announcement
type CreateClipResponse ¶
type CreateClipResponse struct {
Data []CreatedClip `json:"data"`
}
type CreateEventSubSubscriptionRequest ¶
type CreateEventSubSubscriptionRequest struct {
Type string `json:"type"`
Version string `json:"version"`
Condition map[string]string `json:"condition"`
Transport EventSubTransportRequest `json:"transport"`
}
type CreateEventSubSubscriptionResponse ¶
type CreateEventSubSubscriptionResponse struct {
Data []EventSubData `json:"data"`
Total int `json:"total"`
TotalCost int `json:"total_cost"`
MaxTotalCost int `json:"max_total_cost"`
}
type CreateStreamMarkerResponse ¶
type CreateStreamMarkerResponse struct {
Data []StreamMarker `json:"data"`
}
type CreatedClip ¶
type DropReason ¶
type EmoteImage ¶
type EmoteResponse ¶
type EventSubData ¶
type EventSubTransport ¶
type FollowedChannel ¶
type GetChannelChatBadgesResp ¶
type GetChannelChatBadgesResp struct {
Data []BadgeSet `json:"data"`
}
type GetChatSettingsResponse ¶
type GetChatSettingsResponse struct {
Data []ChatSettingData `json:"data"`
}
type GetEventSubSubscriptionsResponse ¶
type GetEventSubSubscriptionsResponse struct {
Total int `json:"total"`
TotalCost int `json:"total_cost"`
MaxTotalCost int `json:"max_total_cost"`
Pagination Pagination `json:"pagination"`
Data []EventSubData `json:"data"`
}
type GetFollowedChannelsResponse ¶
type GetFollowedChannelsResponse struct {
Total int `json:"total"`
Data []FollowedChannel `json:"data"`
Pagination Pagination `json:"pagination"`
}
type GetGlobalBadgesResp ¶
type GetGlobalBadgesResp struct {
Data []BadgeSet `json:"data"`
}
type GetStreamsResponse ¶
type GetStreamsResponse struct {
Data []StreamData `json:"data"`
Pagination Pagination `json:"pagination"`
}
type GetUnbanRequestsResponse ¶
type GetUnbanRequestsResponse struct {
Data []UnbanRequest `json:"data"`
Pagination Pagination `json:"pagination"`
}
type GetUserChatColorResponse ¶
type GetUserChatColorResponse struct {
Data []UserChatColor `json:"data"`
}
type GetUserEmotesResponse ¶
type GetUserEmotesResponse struct {
Data []UserEmoteImage `json:"data"`
Template string `json:"template"`
Pagination Pagination `json:"pagination"`
}
type Pagination ¶
type Pagination struct {
Cursor string `json:"cursor"`
}
type SendChatMessageData ¶
type SendChatMessageData struct {
MessageID string `json:"message_id"`
IsSent bool `json:"is_sent"`
DropReason DropReason `json:"drop_reason"`
}
type SendChatMessageRequest ¶
type SendChatMessageResponse ¶
type SendChatMessageResponse struct {
Data []SendChatMessageData `json:"data"`
}
type StreamData ¶
type StreamData struct {
ID string `json:"id"`
UserID string `json:"user_id"`
UserLogin string `json:"user_login"`
UserName string `json:"user_name"`
GameID string `json:"game_id"`
GameName string `json:"game_name"`
Type string `json:"type"`
Title string `json:"title"`
Tags []string `json:"tags"`
ViewerCount int `json:"viewer_count"`
StartedAt time.Time `json:"started_at"`
Language string `json:"language"`
ThumbnailURL string `json:"thumbnail_url"`
TagIds []any `json:"tag_ids"`
IsMature bool `json:"is_mature"`
}
type StreamMarker ¶
type TokenRefresher ¶
type UnbanRequest ¶
type UnbanRequest struct {
ID string `json:"id"`
BroadcasterName string `json:"broadcaster_name"`
BroadcasterLogin string `json:"broadcaster_login"`
BroadcasterID string `json:"broadcaster_id"`
ModeratorID string `json:"moderator_id"`
ModeratorLogin string `json:"moderator_login"`
ModeratorName string `json:"moderator_name"`
UserID string `json:"user_id"`
UserLogin string `json:"user_login"`
UserName string `json:"user_name"`
Text string `json:"text"`
Status string `json:"status"`
CreatedAt time.Time `json:"created_at"`
ResolvedAt time.Time `json:"resolved_at"`
ResolutionText string `json:"resolution_text"`
}
type UserChatColor ¶
type UserData ¶
type UserData struct {
ID string `json:"id"`
Login string `json:"login"`
DisplayName string `json:"display_name"`
Type string `json:"type"`
BroadcasterType string `json:"broadcaster_type"`
Description string `json:"description"`
ProfileImageURL string `json:"profile_image_url"`
OfflineImageURL string `json:"offline_image_url"`
ViewCount int `json:"view_count"`
Email string `json:"email"`
CreatedAt time.Time `json:"created_at"`
}
type UserEmoteImage ¶
type UserResponse ¶
type UserResponse struct {
Data []UserData `json:"data"`
}
Click to show internal directories.
Click to hide internal directories.