mercury

package
v0.0.0-...-2536ce9 Latest Latest
Warning

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

Go to latest
Published: Nov 6, 2024 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Album

type Album struct {
	Artists []Artist `json:"artists"`
	Image   string   `json:"image"`
	Name    string   `json:"name"`
	Uri     string   `json:"uri"`
}

type Artist

type Artist struct {
	Image string `json:"image"`
	Name  string `json:"name"`
	Uri   string `json:"uri"`
}

type Callback

type Callback func(Response)

type Client

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

func CreateMercury

func CreateMercury(stream connection.PacketStream) *Client

CreateMercury initializes a Connection for the specified session.

func (*Client) GetAlbum

func (m *Client) GetAlbum(uri string) (albumID string, album *Spotify.Album, err error)

func (*Client) GetArtist

func (m *Client) GetArtist(uri string) (artistID string, artist *Spotify.Artist, err error)

func (*Client) GetPlaylist

func (m *Client) GetPlaylist(id string) (*Spotify.SelectedListContent, error)

func (*Client) GetRootPlaylist

func (m *Client) GetRootPlaylist(username string) (*Spotify.SelectedListContent, error)

func (*Client) GetToken

func (m *Client) GetToken(clientId string, scopes string) (*Token, error)

func (*Client) GetTrack

func (m *Client) GetTrack(uri string) (trackID string, track *Spotify.Track, err error)

func (*Client) Handle

func (m *Client) Handle(cmd uint8, reader io.Reader) error

func (*Client) NextSeq

func (m *Client) NextSeq() []byte

func (*Client) NextSeqWithInt

func (m *Client) NextSeqWithInt() (uint32, []byte)

func (*Client) Request

func (m *Client) Request(req Request, cb Callback) error

func (*Client) Search

func (m *Client) Search(search string, limit int, country string, username string) (*SearchResponse, error)

func (*Client) Subscribe

func (m *Client) Subscribe(uri string, recv chan Response, cb Callback) error

Subscribe subscribes the specified receiving channel to the specified URI, and calls the callback function whenever there's an event happening.

func (*Client) Suggest

func (m *Client) Suggest(search string) (*SuggestResult, error)

type Connection

type Connection interface {
	Subscribe(uri string, recv chan Response, cb Callback) error
	Request(req Request, cb Callback) (err error)
	Handle(cmd uint8, reader io.Reader) (err error)
}

type Genre

type Genre struct {
	Name  string `json:"name"`
	Uri   string `json:"uri"`
	Image string `json:"image"`
}

type Internal

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

func (*Internal) NextSeq

func (m *Internal) NextSeq() (uint32, []byte)

type Pending

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

type Playlist

type Playlist struct {
	Name           string `json:"name"`
	Uri            string `json:"uri"`
	Image          string `json:"image"`
	FollowersCount int    `json:"followersCount"`
	Author         string `json:"author"`
}

type Profile

type Profile struct {
	Name           string `json:"name"`
	Uri            string `json:"uri"`
	Image          string `json:"image"`
	FollowersCount int    `json:"followersCount"`
}

type Request

type Request struct {
	Method      string
	Uri         string
	ContentType string
	Payload     [][]byte
}

type Response

type Response struct {
	HeaderData []byte
	Uri        string
	Payload    [][]byte
	StatusCode int32
	SeqKey     string
}

func (*Response) CombinePayload

func (res *Response) CombinePayload() []byte

type SearchResponse

type SearchResponse struct {
	Results         SearchResult `json:"results"`
	RequestId       string       `json:"requestId"`
	CategoriesOrder []string     `json:"categoriesOrder"`
}

type SearchResult

type SearchResult struct {
	Tracks struct {
		Hits  []Track `json:"hits"`
		Total int     `json:"total"`
	} `json:"tracks"`

	Albums struct {
		Hits  []Album `json:"hits"`
		Total int     `json:"total"`
	} `json:"albums"`

	Artists struct {
		Hits  []Artist `json:"hits"`
		Total int      `json:"total"`
	} `json:"artists"`

	Playlists struct {
		Hits  []Playlist `json:"hits"`
		Total int        `json:"total"`
	} `json:"playlists"`

	Profiles struct {
		Hits  []Profile `json:"hits"`
		Total int       `json:"total"`
	} `json:"profiles"`

	Genres struct {
		Hits  []Genre `json:"hits"`
		Total int     `json:"total"`
	} `json:"genres"`

	TopHit struct {
		Hits  []TopHit `json:"hits"`
		Total int      `json:"total"`
	} `json:"topHit"`

	Shows struct {
		Hits  []Show `json:"hits"`
		Total int    `json:"total"`
	} `json:"shows"`

	VideoEpisodes struct {
		Hits  []VideoEpisode `json:"hits"`
		Total int            `json:"total"`
	} `json:"videoEpisodes"`

	TopRecommendations struct {
		Hits  []TopRecommendation `json:"hits"`
		Total int                 `json:"total"`
	} `json:"topRecommendations"`

	Error error
}

type Show

type Show struct {
	Name     string `json:"name"`
	Uri      string `json:"uri"`
	Image    string `json:"image"`
	ShowType string `json:"showType"`
}

type SuggestResult

type SuggestResult struct {
	Sections []struct {
		RawItems json.RawMessage `json:"items"`
		Typ      string          `json:"type"`
	} `json:"sections"`
	Albums  []Artist
	Artists []Album
	Tracks  []Track
	TopHits []TopHit
	Error   error
}

func ParseSuggest

func ParseSuggest(body []byte) (*SuggestResult, error)

type Token

type Token struct {
	AccessToken string   `json:"accessToken"`
	ExpiresIn   int      `json:"expiresIn"`
	TokenType   string   `json:"tokenType"`
	Scope       []string `json:"scope"`
}

type TopHit

type TopHit struct {
	Uri            string `json:"uri"`
	Name           string `json:"name"`
	Image          string `json:"image"`
	Verified       bool   `json:"verified"`
	Following      bool   `json:"following"`
	FollowersCount int    `json:"followersCount"`
	Author         string `json:"author"`
	Log            struct {
		Origin string `json:"origin"`
		TopHit string `json:"top_hit"`
	} `json:"log"`
	Artists []Artist `json:"artists"`
	Album   Album    `json:"album"`
}

type TopRecommendation

type TopRecommendation struct {
}

type Track

type Track struct {
	Album      Album    `json:"album"`
	Artists    []Artist `json:"artists"`
	Image      string   `json:"image"`
	Name       string   `json:"name"`
	Uri        string   `json:"uri"`
	Duration   int      `json:"duration"`
	Popularity float32  `json:"popularity"`
}

type VideoEpisode

type VideoEpisode struct {
	Name  string `json:"name"`
	Uri   string `json:"uri"`
	Image string `json:"image"`
}

Jump to

Keyboard shortcuts

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