Documentation ¶
Index ¶
- Constants
- Variables
- func CheckStatusCode(code int) error
- func Int(v int) *int
- func Int64(v int64) *int64
- func SetArtistGetParams(agp *ArtistGetParams) string
- func SetArtistSearchParams(asp *ArtistSearchParams) string
- func SetTrackGetParams(tgp *TrackGetParams) string
- func SetTrackListParams(tlp *TrackListParams) string
- func SetTrackLyricsParams(tlp *TrackLyricsParams) string
- func String(v string) *string
- type Artist
- type ArtistGetParams
- type ArtistSearchParams
- type Artists
- type ArtistsList
- type Backend
- type BackendService
- type FlexBool
- type FlexTime
- type GenreFields
- type Genres
- type Header
- type Lyric
- type LyricInfo
- type Message
- type MusicGenre
- type Return
- type Track
- type TrackGetParams
- type TrackList
- type TrackListParams
- type TrackLyricsParams
- type Tracks
Constants ¶
const (
//BaseURL is the API URL
BaseURL = "http://api.musixmatch.com/ws/1.1"
)
Variables ¶
var Key string
Key is the MusixMatch API key
Functions ¶
func CheckStatusCode ¶
CheckStatusCode checks for response errors
func SetArtistGetParams ¶
func SetArtistGetParams(agp *ArtistGetParams) string
func SetArtistSearchParams ¶
func SetArtistSearchParams(asp *ArtistSearchParams) string
func SetTrackListParams ¶
func SetTrackListParams(tlp *TrackListParams) string
SetTrackListParams ...
func SetTrackLyricsParams ¶
func SetTrackLyricsParams(tlp *TrackLyricsParams) string
SetTrackLyricsParams ...
Types ¶
type Artist ¶
type Artist struct { ID int64 `json:"artist_id"` MBID string `json:"artist_mbid"` Name string `json:"artist_name"` Comment string `json:"artist_comment"` Country string `json:"artist_country"` Rating int `json:"artist_rating"` PrimaryGenres Genres `json:"primary_genres"` Credits ArtistsList `json:"artist_credits"` Restricted FlexBool `json:"restricted"` Managed FlexBool `json:"managed"` }
type ArtistGetParams ¶
type ArtistSearchParams ¶
type ArtistsList ¶
type ArtistsList struct {
Artists []*Artists `json:"artist_list"`
}
type Backend ¶
Backend holds the user API key and the HTTP client
func GetBackend ¶
func GetBackend() Backend
GetBackend returns a Backend with the default HTTPClient
func SetBackend ¶
SetBackend sets a Backend type with a custom HTTPClient
type BackendService ¶
BackendService is an interface to be implemented by MusixMatch clients
type FlexBool ¶
type FlexBool bool
FlexBool is a custom bool type that can convert 1 and 0 to true and false
func (FlexBool) MarshalJSON ¶
MarshalJSON implements the Marshaler interface for FlexBool
func (*FlexBool) UnmarshalJSON ¶
UnmarshalJSON implements the Unmarshaler interface for FlexBool
type FlexTime ¶
FlexTime is a custom type that holds musixmatch time representation, which can be either time or empty string
func (*FlexTime) UnmarshalJSON ¶
UnmarshalJSON implements the Unmarshaler interface for FlexTime
type GenreFields ¶
type GenreFields struct { ID int64 `json:"music_genre_id"` ParentID int64 `json:"music_genre_parent_id"` Name string `json:"music_genre_name"` NameExtended string `json:"music_genre_name_extended"` Vanity string `json:"music_genre_vanity"` }
GenreFields represents the fields of the music genre type
type Genres ¶
type Genres struct {
GenreList []*MusicGenre `json:"music_genre_list"`
}
Genres represents the list of primary music genres
type Header ¶
type Header struct {
StatusCode int `json:"status_code"`
}
Header contains the Status Code returned from the API request
type Lyric ¶
type Lyric struct { ID int64 `json:"lyrics_id"` Restricted FlexBool `json:"restricted"` Instrumental FlexBool `json:"instrumental"` Body string `json:"lyrics_body"` Language string `json:"lyrics_language"` ScriptTrackingURL string `json:"script_tracking_url"` PixelTrackingURL string `json:"pixel_tracking_url"` HTMLTrackinURL string `json:"html_tracking_url"` Copyright string `json:"lyrics_copyright"` UpdatedAt FlexTime `json:"updated_time"` }
Lyric represents info returned from get.lyrics.track
type Message ¶
type Message struct { Header Header `json:"header"` Body *json.RawMessage `json:"body"` }
Message represents the JSON object returned from the API request
type MusicGenre ¶
type MusicGenre struct {
Genre GenreFields `json:"music_genre"`
}
MusicGenre represents the music genre type
type Return ¶
type Return struct {
Message `json:"message"`
}
Return is the type that will hold the response from the API request
type Track ¶
type Track struct { ID int64 `json:"track_id"` MBID string `json:"track_mbid"` Name string `json:"track_name"` Rating int `json:"track_rating"` Instrumental FlexBool `json:"instrumental"` Explicit FlexBool `json:"explicit"` Favourites int `json:"num_favourite"` Genres Genres `json:"primary_genres"` HasLyrics FlexBool `json:"has_lyrics"` HasSubtitles FlexBool `json:"has_subtitles"` LyricsID int64 `json:"lyrics_id"` SubtitleID int64 `json:"subtitle_id"` AlbumID int64 `json:"album_id"` AlbumName string `json:"album_name"` ArtistID int64 `json:"artist_id"` ArtistName string `json:"artist_name"` Restricted FlexBool `json:"restricted"` FirstReleaseDate FlexTime `json:"first_release_date"` UpdatedTime FlexTime `json:"updated_time"` }
Track represents the fields of the track type
type TrackGetParams ¶
TrackGetParams are the acceptable params for the get.track request
type TrackList ¶
type TrackList struct {
Tracks []*Tracks `json:"track_list"`
}
TrackList represents a list of Track instances
type TrackListParams ¶
type TrackListParams struct { TrackTitle *string Artist *string Lyrics *string FilterArtistID *int64 FilterMusicGenreID *int64 FilterLyricsLang *string FilterLyricsOnly *bool FilterByArtistRating *string FilterByTrackRating *string Page *int PageSize *int }
TrackListParams are the param options acceptable for requests returning a track list
type TrackLyricsParams ¶
TrackLyricsParams are the acceptable params for the track.lyrics.get and matcher.track.get requests