spotify

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Jul 16, 2024 License: BlueOak-1.0.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

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

func New

func New(clientID, clientSecret string) *Client

New creates a new Spotify client, with the given clientID and clientSecret.

func (*Client) FetchGenre

func (spo *Client) FetchGenre(ctx context.Context, name string) ([]data.Artist, error)

FetchGenre does a search for artists with the given genre, fetches the first 20 pages of search results, and returns up to 1000 artists.

The request is basically,

https://api.spotify.com/v1/search?query=genre:GENRE&type=artist

FetchGenre respects Spotify's documented semantics around its rate limiter: checking for a Retry-After header when it receives a 429 response. If FetchGenre is rate limited, it won't error, but it might take a long time.

Jump to

Keyboard shortcuts

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