rumblelivestreamlib

package module
v0.9.1 Latest Latest
Warning

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

Go to latest
Published: May 31, 2024 License: MIT Imports: 18 Imported by: 1

README

rumble-livestream-lib-go

Go library for accessing Rumble's Live Stream API

Documentation

Index

Constants

View Source
const (
	ChatBadgeRecurringSubscription = "recurring_subscription"
	ChatBadgeLocalsSupporter       = "locals_supporter"

	ChatTypeInit           = "init"
	ChatTypeMessages       = "messages"
	ChatTypeMuteUsers      = "mute_users"
	ChatTypeDeleteMessages = "delete_messages"
	ChatTypeSubscriber     = "locals_supporter"
	ChatTypeRaiding        = "raid_confirmed"
	ChatTypePinMessage     = "pin_message"
	ChatTypeUnpinMessage   = "unpin_message"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Badge

type Badge string

type Categories

type Categories struct {
	Primary   Category `json:"primary"`
	Secondary Category `json:"secondary"`
}

type Category

type Category struct {
	Slug  string `json:"slug"`
	Title string `json:"title"`
}

type Chat

type Chat struct {
	LatestMessage  Message   `json:"latest_message"`
	RecentMessages []Message `json:"recent_messages"`
	LatestRant     Rant      `json:"latest_rant"`
	RecentRants    []Rant    `json:"recent_rants"`
}

type ChatData

type ChatData struct {
	RequestID string      `json:"request_id"`
	Message   ChatMessage `json:"message"`
	Rant      *string     `json:"rant"`
	ChannelID *int        `json:"channel_id"`
}

type ChatEvent added in v0.2.0

type ChatEvent struct {
	Data      ChatEventData `json:"data"`
	RequestID string        `json:"request_id"`
	Type      string        `json:"type"`
}

type ChatEventBlock added in v0.2.0

type ChatEventBlock struct {
	Data ChatEventBlockData `json:"data"`
	Type string             `json:"type"`
}

type ChatEventBlockData added in v0.2.0

type ChatEventBlockData struct {
	Text string `json:"text"`
}

type ChatEventChannel added in v0.2.0

type ChatEventChannel struct {
	ID       string `json:"id"`
	Image1   string `json:"image.1"`
	Link     string `json:"link"`
	Username string `json:"username"`
}

type ChatEventData added in v0.2.0

type ChatEventData struct {
	Channels []ChatEventChannel `json:"channels"`
	Messages []ChatEventMessage `json:"messages"`
	Users    []ChatEventUser    `json:"users"`
}

type ChatEventDataNoChannels added in v0.2.0

type ChatEventDataNoChannels struct {
	// TODO: change [][]string to [][]any and test
	Channels [][]string         `json:"channels"`
	Messages []ChatEventMessage `json:"messages"`
	Users    []ChatEventUser    `json:"users"`
}

type ChatEventMessage added in v0.2.0

type ChatEventMessage struct {
	Blocks           []ChatEventBlock           `json:"blocks"`
	ChannelID        *int64                     `json:"channel_id"`
	ID               string                     `json:"id"`
	Notification     *ChatEventNotification     `json:"notification"`
	RaidNotification *ChatEventRaidNotification `json:"raid_notification"`
	Rant             *ChatEventRant             `json:"rant"`
	Text             string                     `json:"text"`
	Time             string                     `json:"time"`
	UserID           string                     `json:"user_id"`
}

type ChatEventNoChannels added in v0.2.0

type ChatEventNoChannels struct {
	Data      ChatEventDataNoChannels `json:"data"`
	RequestID string                  `json:"request_id"`
	Type      string                  `json:"type"`
}

type ChatEventNotification added in v0.9.0

type ChatEventNotification struct {
	Badge string `json:"badge"`
	Text  string `json:"text"`
}

type ChatEventRaidNotification added in v0.9.0

type ChatEventRaidNotification struct {
	StartTs int64 `json:"start_ts"`
}

type ChatEventRant added in v0.2.0

type ChatEventRant struct {
	Duration   int    `json:"duration"`
	ExpiresOn  string `json:"expires_on"`
	PriceCents int    `json:"price_cents"`
}

type ChatEventUser added in v0.2.0

type ChatEventUser struct {
	Badges     []string `json:"badges"`
	Color      string   `json:"color"`
	ID         string   `json:"id"`
	Image1     string   `json:"image.1"`
	IsFollower bool     `json:"is_follower"`
	Link       string   `json:"link"`
	Username   string   `json:"username"`
}

type ChatInfo

type ChatInfo struct {
	ChannelID int
	ChatID    string
	Page      string
	UrlPrefix string
}

func (*ChatInfo) MessageUrl added in v0.2.0

func (ci *ChatInfo) MessageUrl() string

func (*ChatInfo) StreamUrl added in v0.2.0

func (ci *ChatInfo) StreamUrl() string

type ChatMessage

type ChatMessage struct {
	Text string `json:"text"`
}

type ChatRequest

type ChatRequest struct {
	Data ChatData `json:"data"`
}

type ChatResponse

type ChatResponse struct {
	Errors []Error `json:"errors"`
}

type ChatStream added in v0.2.0

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

type ChatView added in v0.2.0

type ChatView struct {
	Badges      []string
	ChannelName string
	Color       string
	ImageUrl    string
	Init        bool
	IsFollower  bool
	Raid        bool
	Rant        int
	Sub         bool
	Text        string
	Time        time.Time
	Type        string
	Username    string
}

type Client

type Client struct {
	ApiKey        string
	LiveStreamUrl string
	// contains filtered or unexported fields
}

func NewClient

func NewClient(opts NewClientOptions) (*Client, error)

func (*Client) Chat

func (c *Client) Chat(message string, channelID *int) error

func (*Client) ChatInfo added in v0.2.0

func (c *Client) ChatInfo(reload bool) (*ChatInfo, error)

func (*Client) LoggedIn added in v0.3.0

func (c *Client) LoggedIn() (*LoggedInResponse, error)

func (*Client) Login

func (c *Client) Login(username string, password string) ([]*http.Cookie, error)

func (*Client) Logout

func (c *Client) Logout() error

func (*Client) PrintCookies

func (c *Client) PrintCookies() error

func (*Client) Request

func (c *Client) Request() (*LivestreamResponse, error)

func (*Client) StartChatStream added in v0.2.0

func (c *Client) StartChatStream(handle func(cv ChatView), handleError func(err error)) error

func (*Client) StopChatStream added in v0.2.0

func (c *Client) StopChatStream()

type DataBool

type DataBool struct {
	Session bool `json:"session"`
}

type DataString

type DataString struct {
	Session string `json:"session"`
}

type Error

type Error struct {
	Code    string `json:"code"`
	Message string `json:"message"`
	Type    string `json:"type"`
}

type Follower

type Follower struct {
	Username   string `json:"username"`
	FollowedOn string `json:"followed_on"`
}

type Followers

type Followers struct {
	NumFollowers      int64      `json:"num_followers"`
	NumFollowersTotal int64      `json:"num_followers_total"`
	LatestFollower    Follower   `json:"latest_follower"`
	RecentFollowers   []Follower `json:"recent_followers"`
}

type GetSaltsData

type GetSaltsData struct {
	Salts []string `json:"salts"`
}

type GetSaltsResponse

type GetSaltsResponse struct {
	Data GetSaltsData `json:"data"`
}

type Livestream

type Livestream struct {
	ID          string     `json:"id"`
	Title       string     `json:"title"`
	CreatedOn   string     `json:"created_on"`
	IsLive      bool       `json:"is_live"`
	Categories  Categories `json:"categories"`
	StreamKey   string     `json:"stream_key"`
	Likes       int64      `json:"likes"`
	Dislikes    int64      `json:"dislikes"`
	WatchingNow int64      `json:"watching_now"`
	Chat        Chat       `json:"chat"`
}

type LivestreamResponse

type LivestreamResponse struct {
	Now           int64        `json:"now"`
	Type          string       `json:"type"`
	UserID        string       `json:"user_id"`
	Username      string       `json:"username"`
	ChannelID     int64        `json:"channel_id"`
	ChannelName   string       `json:"channel_name"`
	MaxNumResults int64        `json:"max_num_results"`
	Followers     Followers    `json:"followers"`
	Subscribers   Subscribers  `json:"subscribers"`
	Livestreams   []Livestream `json:"livestreams"`
}

type LoggedInResponse added in v0.3.1

type LoggedInResponse struct {
	Data LoggedInResponseData `json:"data"`
	User LoggedInResponseUser `json:"user"`
}

type LoggedInResponseData added in v0.8.0

type LoggedInResponseData struct {
	Username string `json:"username"`
}

type LoggedInResponseUser added in v0.3.1

type LoggedInResponseUser struct {
	ID       string `json:"id"`
	LoggedIn bool   `json:"logged_in"`
}

type LoginResponseBool

type LoginResponseBool struct {
	Data DataBool `json:"data"`
}

type LoginResponseString

type LoginResponseString struct {
	Data DataString `json:"data"`
}

type Message

type Message struct {
	Username  string  `json:"username"`
	Badges    []Badge `json:"badges"`
	Text      string  `json:"text"`
	CreatedOn string  `json:"created_on"`
}

type NewClientOptions added in v0.3.0

type NewClientOptions struct {
	Cookies       []*http.Cookie `json:"cookies"`
	ApiKey        string         `json:"stream_key"`
	LiveStreamUrl string         `json:"stream_url"`
}

type Rant

type Rant struct {
	Message
	ExpiresOn     string `json:"expires_on"`
	AmountCents   int64  `json:"amount_cents"`
	AmountDollars int64  `json:"amount_dollars"`
}

type Subscriber

type Subscriber struct {
	User          string `json:"user"`
	Username      string `json:"username"`
	AmountCents   int64  `json:"amount_cents"`
	AmountDollars int64  `json:"amount_dollars"`
	SubscribedOn  string `json:"subscribed_on"`
}

type Subscribers

type Subscribers struct {
	NumSubscribers    int64        `json:"num_subscribers"`
	LatestSubscriber  Subscriber   `json:"latest_subscriber"`
	RecentSubscribers []Subscriber `json:"recent_subscribers"`
}

Jump to

Keyboard shortcuts

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