restclient

package
v0.0.0-...-d3be85b Latest Latest
Warning

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

Go to latest
Published: May 29, 2021 License: GPL-3.0 Imports: 13 Imported by: 1

Documentation

Index

Constants

View Source
const (
	ScopeReadAnalyticsExtensions  = "analytics:read:extensions"
	ScopeReadAnalyticsGames       = "analytics:read:games"
	ScopeReadBits                 = "bits:read"
	ScopeEditChannelCommercials   = "channel:edit:commercial"
	ScopeManageChannelBroadcast   = "channel:manage:broadcast"
	ScopeManageChannelExtensions  = "channel:manage:extensions"
	ScopeManageChannelRedemptions = "channel:manage:redemptions"
	ScopeManageChannelVideos      = "channel:manage:videos"
	ScopeReadChannelEditors       = "channel:read:editors"
	ScopeReadChannelHypeTrain     = "channel:read:hype_train"
	ScopeReadChannelRedemptions   = "channel:read:redemptions"
	ScopeReadChannelStreamKey     = "channel:read:stream_key"
	ScopeReadChannelSubscriptios  = "channel:read:subscriptions"
	ScopeEditClips                = "clips:edit"
	ScopeModerationRead           = "moderation:read"
	ScopeUserEdit                 = "user:edit"
	ScopeUserEditFollows          = "user:edit:follows"
	ScopeUserReadBlocked          = "user:read:blocked_users"
	ScopeUserManageBlocked        = "user:manage:blocked_users"
	ScopeUserReadBroadcast        = "user:read:broadcast"
	ScopeUserReadEmail            = "user:read:email"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

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

func InitClient

func InitClient(clientID, clientSecret string, scopes []string) *Client

func (*Client) CreateSubscription

func (c *Client) CreateSubscription(condition interface{}, transport messages.TransportOpts) (*messages.SubscriptionRequestStatus, error)

func (*Client) DeleteSubscription

func (c *Client) DeleteSubscription(subscriptionID string) error

DeleteSubscription attempts to delete a previously-created EventSub subscription from the twitch API

func (*Client) GetStreamsIter

func (c *Client) GetStreamsIter(opts GetStreamsOpts) chan StreamResult

GetStreamsIter returns a channel which will be populated with data on streams which match the provided options

func (*Client) GetStreamsPage

func (c *Client) GetStreamsPage(opts GetStreamsOpts, pagination *pagination) (*streamsPage, error)

func (*Client) GetUsers

func (c *Client) GetUsers(ids []string, logins []string) ([]TwitchUser, error)

GetUsers returns user data for up to 100 user IDs or names (https://dev.twitch.tv/docs/api/reference#get-users)

func (*Client) Subscriptions

func (c *Client) Subscriptions(filters *SubscriptionsParams) chan SubscriptionResult

Subscriptions returns a channel which will be populated with all Eventsub subscriptions owned by the current app

type GetStreamsOpts

type GetStreamsOpts struct {
	After     string   `url:"after,omitempty"`
	Before    string   `url:"before,omitempty"`
	First     int      `url:"first,omitempty"`
	GameID    []string `url:"game_id,omitempty"`
	Language  []string `url:"language,omitempty"`
	UserID    []string `url:"user_id,omitempty"`
	UserLogin []string `url:"user_login,omitempty"`
}

type StreamResult

type StreamResult struct {
	Stream *TwitchStream
	Err    error
}

type SubscriptionResult

type SubscriptionResult struct {
	Subscription *messages.Subscription
	Err          error
}

type SubscriptionsParams

type SubscriptionsParams struct {
	Status string `json:"status,omitempty"`
	Type   string `json:"type,omitempty"`
}

type TwitchStream

type TwitchStream struct {
	StreamID     string    `json:"id"`
	UserID       string    `json:"user_id"`
	UserLogin    string    `json:"user_login"`
	UserName     string    `json:"user_name"`
	GameID       string    `json:"game_id"`
	GameName     string    `json:"game_name"`
	Type         string    `json:"type"`
	Title        string    `json:"title"`
	ViewerCount  int       `json:"viewer_count"`
	StartedAt    time.Time `json:"start_at"`
	Language     string    `json:"language"`
	ThumbnailURL string    `json:"thumbnail_url"`
	TagIDs       []string  `json:"tag_ids"`
}

type TwitchUser

type TwitchUser 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"`
}

Jump to

Keyboard shortcuts

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