spotify

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Mar 28, 2026 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 {
	ID          string
	URI         string
	Name        string
	Artist      string
	ReleaseDate string
	TrackCount  int
}

type Artist

type Artist struct {
	ID     string
	URI    string
	Name   string
	Genres []string
}

type Client

type Client struct {
	PreferredDevice string // if set, FindDevice prefers this device name
	// contains filtered or unexported fields
}

func New

func New(spClient *sp.Client, httpClient *http.Client) *Client

func (*Client) FetchUserID

func (c *Client) FetchUserID(ctx context.Context) error

func (*Client) FindDevice

func (c *Client) FindDevice(ctx context.Context) (id string, active bool, err error)

FindDevice returns the best device ID and whether it is currently active.

func (*Client) GetAlbumTracks

func (c *Client) GetAlbumTracks(ctx context.Context, albumID string, offset, limit int) ([]Track, bool, error)

func (*Client) GetArtistAlbums

func (c *Client) GetArtistAlbums(ctx context.Context, artistID string, offset, limit int) ([]Album, bool, error)

func (*Client) GetPlayerState

func (c *Client) GetPlayerState(ctx context.Context) (*PlayerState, error)

func (*Client) GetPlaylistTracks

func (c *Client) GetPlaylistTracks(ctx context.Context, id string, offset, limit int) ([]Track, bool, error)

func (*Client) GetPlaylists

func (c *Client) GetPlaylists(ctx context.Context, offset, limit int) (playlists []Playlist, rawCount int, more bool, err error)

GetPlaylists returns the user's own playlists. The second return value (rawCount) is the unfiltered API page size, which callers must use to advance the offset (since it includes items filtered out by owner matching).

func (*Client) GetSavedShows

func (c *Client) GetSavedShows(ctx context.Context, offset, limit int) ([]Show, bool, error)

func (*Client) GetShowEpisodes

func (c *Client) GetShowEpisodes(ctx context.Context, showID string, offset, limit int) ([]Episode, bool, error)

func (*Client) Next

func (c *Client) Next(ctx context.Context, deviceID string) error

func (*Client) Pause

func (c *Client) Pause(ctx context.Context, deviceID string) error

func (*Client) Play

func (c *Client) Play(ctx context.Context, itemURI, contextURI, deviceID string) error

func (*Client) PlayQueue

func (c *Client) PlayQueue(ctx context.Context, uris []string, deviceID string) error

func (*Client) Previous

func (c *Client) Previous(ctx context.Context, deviceID string) error

func (*Client) Resume

func (c *Client) Resume(ctx context.Context, deviceID string) error

func (*Client) SearchAlbums

func (c *Client) SearchAlbums(ctx context.Context, query string, offset, limit int) ([]Album, bool, error)

func (*Client) SearchArtists

func (c *Client) SearchArtists(ctx context.Context, query string, offset, limit int) ([]Artist, bool, error)

func (*Client) SearchEpisodes

func (c *Client) SearchEpisodes(ctx context.Context, query string, offset, limit int) ([]Episode, bool, error)

func (*Client) SearchShows

func (c *Client) SearchShows(ctx context.Context, query string, offset, limit int) ([]Show, bool, error)

func (*Client) SearchTracks

func (c *Client) SearchTracks(ctx context.Context, query string, offset, limit int) ([]Track, bool, error)

func (*Client) Seek

func (c *Client) Seek(ctx context.Context, positionMs int, deviceID string) error

func (*Client) Shuffle

func (c *Client) Shuffle(ctx context.Context, state bool, deviceID string) error

func (*Client) Stop

func (c *Client) Stop(ctx context.Context, deviceID string) error

func (*Client) TransferPlayback

func (c *Client) TransferPlayback(ctx context.Context, deviceID string, play bool) error

type Episode

type Episode struct {
	ID          string
	URI         string
	Name        string
	ReleaseDate string
	Duration    time.Duration
}

type PlayerState

type PlayerState struct {
	Playing    bool
	Shuffling  bool
	TrackName  string
	ArtistName string
	TrackURI   string
	ContextURI string
	ImageURL   string
	ProgressMs int
	DurationMs int
	DeviceName string
}

type Playlist

type Playlist struct {
	ID         string
	Name       string
	OwnerName  string
	TrackCount int
}

type Show

type Show struct {
	ID            string
	URI           string
	Name          string
	TotalEpisodes int
}

type Track

type Track struct {
	ID       string
	URI      string
	Name     string
	Artist   string
	Album    string
	Duration time.Duration
}

Jump to

Keyboard shortcuts

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