Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ErrorClientOption = errors.New("lastfm: client misconfigured")
ErrorClientOption is returned when a Client is misconfigured.
Functions ¶
This section is empty.
Types ¶
type APIError ¶
type APIError struct {
Message string `json:"message"`
Code int `json:"error"`
HTTPStatus int `json:"-"`
}
APIError is an error sent by the JSON API.
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client is an HTTP client for the Last.fm JSON API.
func (*Client) UserRecentTracks ¶
UserRecentTracks fetches the tracks a user has most recently listened to.
func (*Client) UserTopAlbums ¶
UserTopAlbums fetches a user's top albums for a period.
type Time ¶
Time is a timestamp sent by the API.
func (Time) MarshalJSON ¶
func (*Time) UnmarshalJSON ¶
type UserInfo ¶
type UserInfo struct {
Name string `json:"name"`
Age int `json:"age,string"`
Subscriber int `json:"subscriber,string"`
RealName string `json:"realname"`
Bootstrap string `json:"bootstrap"`
PlayCount int `json:"playcount,string"`
ArtistCount int `json:"artist_count,string"`
Playlists int `json:"playlists,string"`
TrackCount int `json:"track_count,string"`
AlbumCount int `json:"album_count,string"`
Image []*Image `json:"image"`
Registered struct {
UnixTime Time `json:"unixtime"`
Text string `json:"text"`
} `json:"registered"`
Country string `json:"country"`
Gender string `json:"gender"`
URL string `json:"url"`
Type string `json:"type"`
}
UserInfo is a user's info sent by the API.
type UserMeta ¶
type UserMeta struct {
User string `json:"user"`
TotalPages int `json:"totalPages,string"`
Page int `json:"page,string"`
PerPage int `json:"perPage,string"`
Total int `json:"total,string"`
}
UserMeta is a meta information about a request sent with some user endpoints.
type UserQuery ¶
type UserQuery struct {
// Every user request
User string `url:"user"`
// getRecentTracks / getTopAlbums
Limit int `url:"limit,omitempty"`
Page int `url:"page,omitempty"`
Period string `url:"period,omitempty"`
// getRecentTracks
From time.Time `url:"from,unix,omitempty"`
To time.Time `url:"to,unix,omitempty"`
Extended bool `url:"extended,int,omitempty"`
}
UserQuery is used to configure a request to the users endpoint.
type UserRecentTrack ¶
type UserRecentTrack struct {
Artist struct {
MBID string `json:"mbid"`
Name string `json:"#text"`
} `json:"artist"`
Album struct {
MBID string `json:"mbid"`
Name string `json:"#text"`
} `json:"album"`
Streamable Bool `json:"streamable"`
Image []*Image `json:"image"`
MBID string `json:"mbid"`
Name string `json:"name"`
URL string `json:"url"`
Date struct {
Time Time `json:"uts"`
}
Meta struct {
NowPlaying Bool `json:"nowplaying"`
} `json:"@attr,omitempty"`
}
UserRecentTrack represents a track recently listened to by a user.
type UserRecentTracks ¶
type UserRecentTracks struct {
Tracks []*UserRecentTrack `json:"track"`
Meta *UserMeta `json:"@attr"`
}
type UserTopAlbum ¶
type UserTopAlbum struct {
Artist struct {
URL string `json:"url"`
Name string `json:"name"`
MBID string `json:"mbid"`
} `json:"artist"`
Image []*Image `json:"image"`
MBID string `json:"mbid"`
URL string `json:"url"`
PlayCount int `json:"playcount,string"`
Name string `json:"name"`
Meta struct {
Rank int `json:"rank,string"`
} `json:"@attr"`
}
UserTopAlbum represents a top album for a user.
type UserTopAlbums ¶
type UserTopAlbums struct {
Albums []*UserTopAlbum `json:"album"`
Meta *UserMeta `json:"@attr"`
}
UserTopAlbums is a user's top albums.