deezer

package module
v0.0.0-...-1356c00 Latest Latest
Warning

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

Go to latest
Published: Dec 25, 2017 License: MIT Imports: 6 Imported by: 1

README

Deezer

Deezer API for GO

Documentation

Index

Constants

View Source
const (
	ERR_QUOTA             = 4
	ERR_PERMISSION        = 200
	ERR_TOKEN_INVALID     = 300
	ERR_PARAMETER         = 500
	ERR_PARAMETER_MISSING = 501
	ERR_QUERY_INVALID     = 600
	ERR_SERVICE_BUSY      = 700
	ERR_DATA_NOT_FOUND    = 800
)
View Source
const (
	RANKING       = "RANKING"
	TRACK_ASC     = "TRACK_ASC"
	TRACK_DESC    = "TRACK_DESC"
	ARTIST_ASC    = "ARTIST_ASC"
	ARTIST_DESC   = "ARTIST_DESC"
	ALBUM_ASC     = "ALBUM_ASC"
	ALBUM_DESC    = "ALBUM_DESC"
	RATING_ASC    = "RATING_ASC"
	RATING_DESC   = "RATING_DESC"
	DURATION_ASC  = "DURATION_ASC"
	DURATION_DESC = "DURATION_DESC"
)

Variables

View Source
var BaseUrl = "http://api.deezer.com"

Functions

func Get

func Get(url string, result interface{}) error

Types

type AdvancedSearch

type AdvancedSearch struct {
	Artist string
	Album  string
	Track  string
	Label  string
	DurMin int
	DurMax int
	BPMMin int
	BPMMax int
}

func (AdvancedSearch) String

func (a AdvancedSearch) String() (s string)

type Album

type Album struct {
	ID          int       `json:"id,omitempty"`           // The Deezer album id
	Title       string    `json:"title,omitempty"`        // The album title
	UPC         string    `json:"upc,omitempty"`          // The album UPC
	Link        string    `json:"link,omitempty"`         // The url of the album on Deezer url
	Share       string    `json:"share,omitempty"`        // The share link of the album on Deezer
	Cover       string    `json:"cover,omitempty"`        // The url of the album's cover.
	GenreID     int       `json:"genre_id,omitempty"`     // The album's first genre id. NB : -1 for not found
	Genres      GenreList `json:"genres,omitempty"`       // List of genre object
	Label       string    `json:"label,omitempty"`        // The album's label name
	NbTracks    int       `json:"nb_tracks,omitempty"`    // Number of tracks
	Duration    int       `json:"duration,omitempty"`     // The album's duration (seconds)
	Fans        int       `json:"fans,omitempty"`         // The number of album's Fans
	Rating      int       `json:"rating,omitempty"`       // The playlist's rate
	ReleaseDate string    `json:"release_date,omitempty"` // The album's release date
	RecordType  string    `json:"record_type,omitempty"`  // The record type of the album (EP / ALBUM / etc..)
	Available   bool      `json:"available,omitempty"`    // If the album is avaiable
	// Alternative    Album    `json:"alternative,omitempty"`     // Return an alternative album object if the current album is not available
	Tracklist      string    `json:"tracklist,omitempty"`       // API Link to the tracklist of this album
	ExplicitLyrics bool      `json:"explicit_lyrics,omitempty"` // Whether the album contains explicit lyrics
	Contributors   []Artist  `json:"contributors,omitempty"`    // Return a list of contributors on the album
	Artist         *Artist   `json:"artist,omitempty"`          // artist object containing : id, name, picture
	Tracks         TrackList `json:"tracks,omitempty"`          // list of track
}

func GetAlbum

func GetAlbum(id int) (Album, error)

type AlbumList

type AlbumList []Album

func GetArtistAlbums

func GetArtistAlbums(id, index, limit int) (AlbumList, error)

func GetChartAlbums

func GetChartAlbums(id, index, limit int) (AlbumList, error)

func GetEditorialReleases

func GetEditorialReleases(id, index, limit int) (AlbumList, error)

func GetEditorialSelection

func GetEditorialSelection(id int, date string, index, limit int) (AlbumList, error)

func GetUserAlbums

func GetUserAlbums(id, index, limit int) (AlbumList, error)

func SearchAlbum

func SearchAlbum(query string, strict bool, order string, index, limit int) (AlbumList, error)

func (*AlbumList) UnmarshalJSON

func (a *AlbumList) UnmarshalJSON(data []byte) error

type Artist

type Artist struct {
	ID        int       `json:"id,omitempty"`        //	The artist's Deezer id
	Name      string    `json:"name,omitempty"`      //	name	The artist's name
	Link      string    `json:"link,omitempty"`      //	The url of the artist on Deezer
	Share     string    `json:"share,omitempty"`     //	The share link of the artist on Deezer
	Picture   string    `json:"picture,omitempty"`   //	The url of the artist picture.
	NbAlbum   int       `json:"nb_album,omitempty"`  //	The number of artist's albums
	NbFan     int       `json:"nb_fan,omitempty"`    //	The number of artist's fans
	Radio     bool      `json:"radio,omitempty"`     //	true if the artist has a smartradio
	Tracklist string    `json:"tracklist,omitempty"` //	API Link to the top of this artist
	Role      string    `json:"role,omitempty"`      //	The artist's role in a track or album
	Albums    AlbumList `json:"albums,omitempty"`
	Tracks    TrackList `json:"tracks,omitempty"`
}

func GetArtist

func GetArtist(id int) (Artist, error)

type ArtistList

type ArtistList []Artist

func GetArtistRelated

func GetArtistRelated(id, index, limit int) (ArtistList, error)

func GetChartArtists

func GetChartArtists(id, index, limit int) (ArtistList, error)

func GetGenreArtists

func GetGenreArtists(id int) (ArtistList, error)

func GetUserArtists

func GetUserArtists(id, index, limit int) (ArtistList, error)

func SearchArtist

func SearchArtist(query string, strict bool, order string, index, limit int) (ArtistList, error)

func (*ArtistList) UnmarshalJSON

func (a *ArtistList) UnmarshalJSON(data []byte) error

type Chart

type Chart struct {
	Tracks    TrackList    `json:"tracks,omitempty"`
	Albums    AlbumList    `json:"albums,omitempty"`
	Artists   ArtistList   `json:"artists,omitempty"`
	Playlists PlaylistList `json:"playlists,omitempty"`
}

func GetCharts

func GetCharts(index, limit int) (Chart, error)

func GetEditorialCharts

func GetEditorialCharts(id, index, limit int) (Chart, error)

type Comment

type Comment struct {
	ID     int      `json:"id,omitempty"`
	Text   string   `json:"text,omitempty"`
	Date   int      `json:"date,omitempty"`
	Object Playlist `json:"object,omitempty"`
	Author User     `json:"author,omitempty"`
}

func GetComment

func GetComment(id int) (Comment, error)

type CommentList

type CommentList struct {
	Data  []Comment `json:"data,omitempty"`
	Total int       `json:"total,omitempty"`
	Next  string    `json:"next,omitempty"`
}

func GetAlbumComments

func GetAlbumComments(id, index, limit int) (CommentList, error)

func GetArtistComments

func GetArtistComments(id, index, limit int) (CommentList, error)

func GetPlaylistComments

func GetPlaylistComments(id, index, limit int) (CommentList, error)

type Editorial

type Editorial struct {
	ID   int    `json:"id,omitempty"`   // The editorial's Deezer id
	Name string `json:"name,omitempty"` // The editorial's name
}

func GetEditorial

func GetEditorial(id int) (Editorial, error)

type EditorialList

type EditorialList struct {
	Data  []Editorial `json:"data,omitempty"`
	Total int         `json:"total,omitempty"`
	Next  string      `json:"next,omitempty"`
}

func GetEditorials

func GetEditorials() (EditorialList, error)

type Error

type Error struct {
	Type    string `json:"type,omitempty"`
	Message string `json:"message,omitempty"`
	Code    int    `json:"code,omitempty"`
}

func (Error) String

func (e Error) String() string

type ErrorResponse

type ErrorResponse struct {
	Error Error `json:"error,omitempty"`
}

type ExtendedAlbumList

type ExtendedAlbumList struct {
	Data  []Album `json:"data,omitempty"`
	Total int     `json:"total,omitempty"`
	Next  string  `json:"next,omitempty"`
}

type ExtendedArtistList

type ExtendedArtistList struct {
	Data  []Artist `json:"data,omitempty"`
	Total int      `json:"total,omitempty"`
	Next  string   `json:"next,omitempty"`
}

type ExtendedGenreList

type ExtendedGenreList struct {
	Data []Genre `json:"data,omitempty"`
}

type ExtendedPlaylistList

type ExtendedPlaylistList struct {
	Data  []Playlist `json:"data,omitempty"`
	Total int        `json:"total,omitempty"`
	Next  string     `json:"next,omitempty"`
}

type ExtendedTrackList

type ExtendedTrackList struct {
	Data  []Track `json:"data"`
	Total int     `json:"total"`
	Next  string  `json:"next"`
}

type Genre

type Genre struct {
	ID   int    `json:"id,omitempty"`
	Name string `json:"name,omitempty"`
}

func GetGenre

func GetGenre(id int) (Genre, error)

type GenreList

type GenreList []Genre

func GetGenres

func GetGenres() (GenreList, error)

func (*GenreList) UnmarshalJSON

func (g *GenreList) UnmarshalJSON(data []byte) error

type GenreRadio

type GenreRadio struct {
	ID     int     `json:"id,omitempty"`
	Title  string  `json:"title,omitempty"`
	Radios []Radio `json:"radios,omitempty"`
}

type GenreRadioList

type GenreRadioList struct {
	Data []GenreRadio `json:"data,omitempty"`
}

func GetRadioGenres

func GetRadioGenres() (GenreRadioList, error)

type Playlist

type Playlist struct {
	ID            int       `json:"id,omitempty"`             // The playlist's Deezer id
	Title         string    `json:"title,omitempty"`          // The playlist's title
	Description   string    `json:"description,omitempty"`    // The playlist description
	Duration      int       `json:"duration,omitempty"`       // The playlist's duration (seconds)
	Public        bool      `json:"public,omitempty"`         // If the playlist is public or not
	IsLovedTrack  bool      `json:"is_loved_track,omitempty"` // If the playlist is the love tracks playlist
	Collaborative bool      `json:"collaborative,omitempty"`  // If the playlist is collaborative or not
	Rating        int       `json:"rating,omitempty"`         // The playlist's rate
	Fans          int       `json:"fans,omitempty"`           // The number of playlist's fans
	Link          string    `json:"link,omitempty"`           // The url of the playlist on Deezer
	Share         string    `json:"share,omitempty"`          // The share link of the playlist on Deezer
	Picture       string    `json:"picture,omitempty"`        // The url of the playlist's cover.
	Checksum      string    `json:"hecksum,omitempty"`        // The checksum for the track list
	Creator       *User     `json:"creator,omitempty"`        // User object containing : id, name
	Tracks        TrackList `json:"tracks,omitempty"`         // List of tracks
}

func GetPlaylist

func GetPlaylist(id int) (Playlist, error)

type PlaylistList

type PlaylistList []Playlist

func GetChartPlaylists

func GetChartPlaylists(id, index, limit int) (PlaylistList, error)

func GetUserPlaylists

func GetUserPlaylists(id, index, limit int) (PlaylistList, error)

func SearchPlaylist

func SearchPlaylist(query string, strict bool, order string, index, limit int) (PlaylistList, error)

func (*PlaylistList) UnmarshalJSON

func (p *PlaylistList) UnmarshalJSON(data []byte) error

type Radio

type Radio struct {
	ID          int    `json:"id,omitempty"`          //	The radio deezeid
	Title       string `json:"title,omitempty"`       //	The radio title
	Description string `json:"description,omitempty"` //	The radio title
	Share       string `json:"share,omitempty"`       //	The share link of the radio on Deezer
	Picture     string `json:"picture,omitempty"`     //	The url of the radio picture.
	Tracklist   string `json:"tracklist,omitempty"`   //	API Link to the tracklist of this radio
}

func GetRadio

func GetRadio(id int) (Radio, error)

type RadioList

type RadioList struct {
	Data []Radio `json:"data,omitempty"`
}

func GetGenreRadios

func GetGenreRadios(id int) (RadioList, error)

func GetRadioTop

func GetRadioTop() (RadioList, error)

func GetRadios

func GetRadios() (RadioList, error)

func GetUserRadios

func GetUserRadios(id, index, limit int) (RadioList, error)

type Track

type Track struct {
	ID                 int      `json:"id,omitempty"`                  // The track's Deezer id
	Readable           bool     `json:"readable,omitempty"`            // true if the track is readable in the player for the current user
	Title              string   `json:"title,omitempty"`               // The track's title
	Isrc               string   `json:"isrc,omitempty"`                // The track isrc
	Link               string   `json:"link,omitempty"`                // The url of the track on Deezer
	Share              string   `json:"share,omitempty"`               // The share link of the track on Deezer
	Duration           int      `json:"duration,omitempty"`            // The track's duration in seconds
	TrackPosition      int      `json:"track_position,omitempty"`      // The position of the track in its album
	DiskNumber         int      `json:"disk_number,omitempty"`         // The track's album's disk number
	Rank               int      `json:"rank,omitempty"`                // The track's Deezer rank
	ReleaseDate        string   `json:"release_date,omitempty"`        // The track's release date
	ExplicitLyrics     bool     `json:"explicit_lyrics,omitempty"`     // Whether the track contains explicit lyrics
	Preview            string   `json:"preview,omitempty"`             // The url of track's preview file. This file contains the first 30 seconds of the track
	Bpm                float64  `json:"bpm,omitempty"`                 // Beats per minute
	Gain               float64  `json:"gain,omitempty"`                // Signal strength
	AvailableCountries []string `json:"available_countries,omitempty"` // List of countries where the track is available
	// Alternative         Track    `json:"alternative,omitempty"`         // Return an alternative readable track if the current track is not readable
	Contributors []Artist `json:"contributors,omitempty"` // Return a list of contributors on the track
	Artist       *Artist  `json:"artist,omitempty"`       // artist object containing : id, name, link, share, picture, nb_album, nb_fan, radio, tracklist, role
	Album        *Album   `json:"album,omitempty"`        // album object containing : id, title, link, cover, release_date
}

func GetTrack

func GetTrack(id int) (Track, error)

type TrackList

type TrackList []Track

func GetAlbumTracks

func GetAlbumTracks(id, index, limit int) (TrackList, error)

func GetArtistRadio

func GetArtistRadio(id, index, limit int) (TrackList, error)

func GetArtistTop

func GetArtistTop(id, index, limit int) (TrackList, error)

func GetChartTracks

func GetChartTracks(id, index, limit int) (TrackList, error)

func GetPlaylistTracks

func GetPlaylistTracks(id, index, limit int) (TrackList, error)

func GetRadioTracks

func GetRadioTracks(id, index, limit int) (TrackList, error)

func GetUserCharts

func GetUserCharts(id, index, limit int) (TrackList, error)

func GetUserFlow

func GetUserFlow(id, index, limit int) (TrackList, error)

func GetUserTracks

func GetUserTracks(id, index, limit int) (TrackList, error)

func SearchTrack

func SearchTrack(query string, strict bool, order string, index, limit int) (TrackList, error)

func (*TrackList) UnmarshalJSON

func (t *TrackList) UnmarshalJSON(data []byte) error

type User

type User struct {
	ID              int    `json:"id,omitempty"`               //	The user's Deezer ID
	Name            string `json:"name,omitempty"`             //	The user's Deezer nickname
	Lastname        string `json:"lastname,omitempty"`         //	The user's last name
	Firstname       string `json:"firstname,omitempty"`        //	The user's first name
	Email           string `json:"email,omitempty"`            //	The user's email
	Status          int    `json:"status,omitempty"`           //	The user's status
	Birthday        int    `json:"birthday,omitempty"`         //	The user's birthday
	InscriptionDate int    `json:"inscription_date,omitempty"` //	The user's inscription date
	Gender          string `json:"gender,omitempty"`           //	The user's gender : F or M
	Link            string `json:"link,omitempty"`             //	The url of the profil for the user on Deezer
	Picture         string `json:"picture,omitempty"`          //	The url of the user's profil picture.
	Country         string `json:"country,omitempty"`          //	The user's country
	Lang            string `json:"lang,omitempty"`             //	The user's language
	Tracklist       string `json:"tracklist,omitempty"`        //	API Link to the flow of this user
}

func GetUser

func GetUser(id int) (User, error)

type UserList

type UserList struct {
	Data  []User `json:"data,omitempty"`
	Total int    `json:"total,omitempty"`
	Next  string `json:"next,omitempty"`
}

func GetAlbumFans

func GetAlbumFans(id, index, limit int) (UserList, error)

func GetArtistFans

func GetArtistFans(id, index, limit int) (UserList, error)

func GetPlaylistFans

func GetPlaylistFans(id, index, limit int) (UserList, error)

func GetUserFollowings

func GetUserFollowings(id, index, limit int) (UserList, error)

func SearchUser

func SearchUser(query string, strict bool, order string, index, limit int) (UserList, error)

Jump to

Keyboard shortcuts

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