Documentation
¶
Overview ¶
Package lastfm implements the LastFM API 2.0
This package is a wrapper for the LastFM API: https://www.last.fm/api
The wrapper is built to be modular, and each LastFM API endpoint method is a separate package. Following API methods are covered by the package:
album: https://godoc.org/git.maych.in/thunderbottom/lastfm-go/api/album
artist: https://godoc.org/git.maych.in/thunderbottom/lastfm-go/api/artist
chart: https://godoc.org/git.maych.in/thunderbottom/lastfm-go/api/chart
geo: https://godoc.org/git.maych.in/thunderbottom/lastfm-go/api/geo
library: https://godoc.org/git.maych.in/thunderbottom/lastfm-go/api/library
tag: https://godoc.org/git.maych.in/thunderbottom/lastfm-go/api/tag
track: https://godoc.org/git.maych.in/thunderbottom/lastfm-go/api/track
user: https://godoc.org/git.maych.in/thunderbottom/lastfm-go/api/user
Index ¶
- type Auth
- type Client
- func (client *Client) Bool2strint(b bool) string
- func (client *Client) GetLimit() (limit string)
- func (client *Client) GetUserAgent() string
- func (client *Client) Login(username string, password string) (err error)
- func (client *Client) Logout()
- func (client *Client) Request(provider *Provider) (err error)
- func (client *Client) SetLimit(limit int)
- func (client *Client) SetUserAgent(useragent string)
- type Error
- type Provider
- type Scrobble
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Auth ¶
type Auth struct { Name string `xml:"name"` Key string `xml:"key"` Subscriber bool `xml:"subscriber"` }
Auth contains the response for the LastFM Login endpoint.
type Client ¶
Client is the LastFM client.
func New ¶
New returns an instance of the LastFM Client. The instance also includes an HTTP client for querying the LastFM API, with timeout set to 10 seconds. The page limit for requests is set to 50 by default, which can be changed using SetLimit
func (*Client) Bool2strint ¶
Bool2strint returns a string representation of the integer value for the provided boolean input.
func (*Client) GetLimit ¶
GetLimit returns a string representation of the current page limit set on the Client. This function is usually called from functions abstracting the LastFM API where page limits are required.
func (*Client) GetUserAgent ¶
GetUserAgent returns the currently set User-Agent header
func (*Client) Login ¶
Login creates a web service session for the LastFM user by authenticating using LastFM login credentials, and sets the session key within the LastFM Client.
username and password must be a valid LastFM user credentials.
This function must be called once before executing any function performing POST request on the LastFM API.
func (*Client) Logout ¶
func (client *Client) Logout()
Logout clears the current web service session and logs the user out of LastFM
func (*Client) Request ¶
Request uses an instance of Client to perform GET and POST requests on the LastFM API endpoints. provider must be an instance of Provider containing the API Method, parameters for the API call, and the request Type. Optionally, the provider should also include an interface to Unmarshal the request response.
This function is usually called from functions abstracting the LastFM API.
func (*Client) SetLimit ¶
SetLimit sets the page limit on the Client for LastFM API requests. The limit defaults to 50 for new Client instances or when set to <= 0.
type Error ¶
Error contains the error response generated by the LastFM API.
type Provider ¶
Provider contains details about a LastFM API request.
This structure is usually used by functions abstracting the LastFM API.