Documentation
¶
Overview ¶
Package spotify implements search using Spotify's desktop search service. Requests use the embedded player's access and client tokens.
Index ¶
- Constants
- func Cover(images []Image, px int) string
- type Album
- type AlbumDetails
- type Artist
- type ArtistOverview
- type Client
- func (c *Client) Album(ctx context.Context, uri string) (AlbumDetails, error)
- func (c *Client) Artist(ctx context.Context, uri string) (ArtistOverview, error)
- func (c *Client) Home(ctx context.Context) (HomeFeed, error)
- func (c *Client) LikedTracks(ctx context.Context, offset, limit int) (SavedTracksPage, error)
- func (c *Client) Reset()
- func (c *Client) Search(ctx context.Context, q string, limit int) (Results, error)
- type Error
- type HomeFeed
- type HomeItem
- type HomeSection
- type Image
- type Playlist
- type Results
- type SavedTrack
- type SavedTracksPage
- type Track
Constants ¶
const BaseURL = "https://api-partner.spotify.com/pathfinder/v2/query"
BaseURL is the desktop query service.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type AlbumDetails ¶
type AlbumDetails = catalog.AlbumDetails
type ArtistOverview ¶
type ArtistOverview = catalog.ArtistOverview
type Client ¶
type Client struct {
Token func(context.Context) (string, error)
ClientToken func(context.Context) (string, error)
HTTP *http.Client
Base string // complete endpoint; "": BaseURL
Now func() time.Time
// contains filtered or unexported fields
}
Client calls the desktop search service. Token supplies an access token (the player's); it is asked once per tokenLife and again when Spotify rejects one.
func (*Client) Artist ¶
Artist loads the Spotify artist overview and its popular tracks from the same query Spotify uses for artist pages.
func (*Client) Home ¶
Home reads Spotify's own personalized Home shelves. sectionItemsLimit is deliberately bounded to keep the response small.
func (*Client) LikedTracks ¶
LikedTracks returns one bounded page of the user's Liked Songs.
type Error ¶
Error is a Spotify service failure.
func (Error) HTTPStatus ¶
func (Error) RetryAfterValue ¶
type HomeSection ¶
type HomeSection = catalog.HomeSection
type SavedTrack ¶
type SavedTrack = catalog.SavedTrack
SavedTrack is a track in the user's Liked Songs collection. AddedAt is zero when the service does not include a saved timestamp for that item.
type SavedTracksPage ¶
type SavedTracksPage = catalog.SavedTracksPage
SavedTracksPage is one bounded page of Liked Songs. Total is Spotify's reported collection size; Items preserves one slot per returned raw item, including entries whose metadata is unavailable.