Documentation
¶
Overview ¶
Package deezer is the library behind the deezer command line: the HTTP client, request shaping, and the typed data models for the Deezer public music API (https://api.deezer.com/).
The Client here is the spine every command shares. It sets a real User-Agent, paces requests so a busy session stays polite, and retries the transient failures (429 and 5xx) that any public API throws under load.
Index ¶
- Constants
- type Album
- type Artist
- type Client
- func (c *Client) GetAlbum(ctx context.Context, id int) (*Album, error)
- func (c *Client) GetArtist(ctx context.Context, id int) (*Artist, error)
- func (c *Client) GetTrack(ctx context.Context, id int) (*Track, error)
- func (c *Client) Search(ctx context.Context, query string, limit int) ([]Track, error)
- func (c *Client) SearchArtists(ctx context.Context, query string, limit int) ([]Artist, error)
- type Domain
- type Track
Constants ¶
const DefaultUserAgent = "deezer-cli/0.1 (tamnd87@gmail.com)"
DefaultUserAgent identifies the client to Deezer. A real, honest User-Agent is both polite and the thing most likely to keep you unblocked.
const Host = "api.deezer.com"
Host is the site this client talks to.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Album ¶
type Album struct {
ID int `kit:"id" json:"id"`
Title string `json:"title"`
Artist string `json:"artist"`
Tracks int `json:"tracks"`
Duration int `json:"duration_sec"`
Released string `json:"released"`
Label string `json:"label"`
Fans int `json:"fans"`
Genres string `json:"genres"`
}
Album is a Deezer album.
type Artist ¶
type Artist struct {
ID int `kit:"id" json:"id"`
Name string `json:"name"`
Albums int `json:"albums"`
Fans int `json:"fans"`
URL string `json:"url"`
}
Artist is a Deezer artist.
type Client ¶
type Client struct {
HTTP *http.Client
UserAgent string
// Rate is the minimum gap between requests. Zero means no pacing.
Rate time.Duration
Retries int
// contains filtered or unexported fields
}
Client talks to the Deezer API over HTTP.
type Domain ¶
type Domain struct{}
Domain is the deezer driver. It carries no state; the per-run client is built by the factory Register hands kit.
func (Domain) Info ¶
func (Domain) Info() kit.DomainInfo
Info describes the scheme, the hostnames a pasted link is matched against, and the identity reused for the binary's help and version.