Documentation
¶
Index ¶
- func CheckResponse(r *http.Response) error
- func DoRequestWithClient(client *http.Client, req *http.Request) (*http.Response, error)
- type APIError
- type Album
- type AlbumService
- type Artist
- type Client
- type Contributors
- type ErrorResponse
- type Genres
- type GenresData
- type Response
- type Tracks
- type TracksData
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CheckResponse ¶ added in v0.0.2
checkResponse inspect the repsonse status code for HTTP errors and returns them as errors if present,
given an http.Client's Do() does not returns an error on non-2xx status codes.
Types ¶
type Album ¶
type Album struct { ID int `json:"id"` Title string `json:"title"` Upc string `json:"upc"` Link string `json:"link"` Cover string `json:"cover"` CoverSmall string `json:"cover_small"` CoverMedium string `json:"cover_medium"` CoverBig string `json:"cover_big"` CoverXl string `json:"cover_xl"` Md5Image string `json:"md5_image"` GenreID int `json:"genre_id"` Genres Genres `json:"genres"` Label string `json:"label"` NbTracks int `json:"nb_tracks"` Duration int `json:"duration"` Fans int `json:"fans"` Rating int `json:"rating"` ReleaseDate string `json:"release_date"` RecordType string `json:"record_type"` Available bool `json:"available"` Tracklist string `json:"tracklist"` ExplicitLyrics bool `json:"explicit_lyrics"` ExplicitContentLyrics int `json:"explicit_content_lyrics"` ExplicitContentCover int `json:"explicit_content_cover"` Contributors []Contributors `json:"contributors"` Artist Artist `json:"artist"` Type string `json:"type"` Tracks Tracks `json:"tracks"` }
Album represents an artist's album.
type AlbumService ¶
type AlbumService struct {
// contains filtered or unexported fields
}
AlbumService defines a client to interface with the Deezer Album service
type Artist ¶
type Artist struct { ID int `json:"id"` Name string `json:"name"` Picture string `json:"picture"` PictureSmall string `json:"picture_small"` PictureMedium string `json:"picture_medium"` PictureBig string `json:"picture_big"` PictureXl string `json:"picture_xl"` Tracklist string `json:"tracklist"` Type string `json:"type"` }
Artist is for Album
type Client ¶
type Client struct { URL *url.URL Albums *AlbumService // contains filtered or unexported fields }
Client manages communication with the Deezer API.
func (*Client) Do ¶
Do makes an API request and returns a custom Response. The API response is JSON and will be decoded in the value specified by v. If v implements the io.Writer interface, the raw response will be written to v, without attempting to decode it.
func (*Client) NewRequest ¶
NewRequest creates a request. It takes care of using the BaseURL and setup common headers. Setting up the BaseURL allows to seamlessly use the loopback interface when using the test server.
type Contributors ¶
type Contributors struct { ID int `json:"id"` Name string `json:"name"` Link string `json:"link"` Picture string `json:"picture"` PictureSmall string `json:"picture_small"` PictureMedium string `json:"picture_medium"` PictureBig string `json:"picture_big"` PictureXl string `json:"picture_xl"` Radio bool `json:"radio"` Tracklist string `json:"tracklist"` Type string `json:"type"` Role string `json:"role"` }
Controbutors is for Album
type ErrorResponse ¶ added in v0.0.2
type ErrorResponse struct { // HTTP response that cause this error Response *http.Response // Error message Message string `json:"message"` // Error returned by the API on successful HTTP request APIError *APIError `json:"error"` // Carries any other error up the chain Carrier error }
func (*ErrorResponse) Error ¶ added in v0.0.2
func (e *ErrorResponse) Error() string
type GenresData ¶
type GenresData struct { ID int `json:"id"` Name string `json:"name"` Picture string `json:"picture"` Type string `json:"type"` }
GenresData is for Album
type Response ¶
Response is a wrapper for the standard http.Response. Typical use cases are: add pagination data, rate limits, etc.
type TracksData ¶
type TracksData struct { ID int `json:"id"` Readable bool `json:"readable"` Title string `json:"title"` TitleShort string `json:"title_short"` TitleVersion string `json:"title_version"` Link string `json:"link"` Duration int `json:"duration"` Rank int `json:"rank"` ExplicitLyrics bool `json:"explicit_lyrics"` ExplicitContentLyrics int `json:"explicit_content_lyrics"` ExplicitContentCover int `json:"explicit_content_cover"` Preview string `json:"preview"` Md5Image string `json:"md5_image"` Artist Artist `json:"artist"` Type string `json:"type"` }
TracksData is for Album