commit
872ff94673
12
artists.go
12
artists.go
@ -17,12 +17,12 @@ func newArtistService(url string) *ArtistService {
|
||||
type Artist struct {
|
||||
Namevariations []string `json:"namevariations"`
|
||||
Profile string `json:"profile"`
|
||||
Releases_url string `json:"releases_url"`
|
||||
Resource_url string `json:"resource_url"`
|
||||
Uri string `json:"uri"`
|
||||
Urls []string `json:"urls"`
|
||||
Data_quality string `json:"data_quality"`
|
||||
Id int `json:"id"`
|
||||
ReleasesURL string `json:"releases_url"`
|
||||
ResourceURL string `json:"resource_url"`
|
||||
URI string `json:"uri"`
|
||||
URLs []string `json:"urls"`
|
||||
DataQuality string `json:"data_quality"`
|
||||
ID int `json:"id"`
|
||||
Images []Image `json:"images"`
|
||||
Members []Member `json:"members"`
|
||||
}
|
||||
|
@ -12,6 +12,7 @@ const (
|
||||
discogsAPI = "https://api.discogs.com/"
|
||||
)
|
||||
|
||||
// Options is a set of options to use discogs API client
|
||||
type Options struct {
|
||||
URL string
|
||||
Currency string
|
||||
@ -73,7 +74,7 @@ func currency(c string) (string, error) {
|
||||
case "":
|
||||
return "USD", nil
|
||||
default:
|
||||
return "", fmt.Errorf("%v\n", "Invalid currency abbreviation.")
|
||||
return "", fmt.Errorf("invalid currency abbreviation")
|
||||
}
|
||||
}
|
||||
|
||||
|
31
masters.go
31
masters.go
@ -4,6 +4,7 @@ import (
|
||||
"strconv"
|
||||
)
|
||||
|
||||
// MasterService ...
|
||||
type MasterService struct {
|
||||
url string
|
||||
}
|
||||
@ -17,21 +18,21 @@ func newMasterService(url string) *MasterService {
|
||||
// Master resource represents a set of similar releases.
|
||||
// Masters (also known as `master releases`) have a `main release` which is often the chronologically earliest.
|
||||
type Master struct {
|
||||
Styles []string `json:"styles"`
|
||||
Genres []string `json:"genres"`
|
||||
Videos []Video `json:"videos"`
|
||||
Title string `json:"title"`
|
||||
Main_release int `json:"main_release"`
|
||||
Main_release_url string `json:"main_release_url"`
|
||||
Uri string `json:"uri"`
|
||||
Artists []Artist `json:"artists"`
|
||||
Version_url string `json:"version_url"`
|
||||
Year int `json:"year"`
|
||||
Images []Image `json:"images"`
|
||||
Resource_url string `json:"resource_url"`
|
||||
Tracklist []Track `json:"tracklist"`
|
||||
Id int `json:"id"`
|
||||
Data_quality string `json:"data_quality"`
|
||||
Styles []string `json:"styles"`
|
||||
Genres []string `json:"genres"`
|
||||
Videos []Video `json:"videos"`
|
||||
Title string `json:"title"`
|
||||
MainRelease int `json:"main_release"`
|
||||
MainReleaseURL string `json:"main_release_url"`
|
||||
URI string `json:"uri"`
|
||||
Artists []Artist `json:"artists"`
|
||||
VersionURL string `json:"version_url"`
|
||||
Year int `json:"year"`
|
||||
Images []Image `json:"images"`
|
||||
ResourceURL string `json:"resource_url"`
|
||||
Tracklist []Track `json:"tracklist"`
|
||||
ID int `json:"id"`
|
||||
DataQuality string `json:"data_quality"`
|
||||
}
|
||||
|
||||
// Master returns a master release
|
||||
|
@ -53,7 +53,7 @@ type LabelSource struct {
|
||||
ResourceURL string `json:"resource_url"`
|
||||
}
|
||||
|
||||
// Itentifier ...
|
||||
// Identifier ...
|
||||
type Identifier struct {
|
||||
Type string `json:"type"`
|
||||
Value string `json:"value"`
|
||||
|
@ -79,7 +79,7 @@ type ReleaseRating struct {
|
||||
Rating Rating `json:"rating"`
|
||||
}
|
||||
|
||||
// Ratings retruns community release rating
|
||||
// Rating retruns community release rating
|
||||
func (s *ReleaseService) Rating(releaseID int) (*ReleaseRating, error) {
|
||||
var rating *ReleaseRating
|
||||
if err := request(s.url+strconv.Itoa(releaseID)+"/rating", nil, &rating); err != nil {
|
||||
|
@ -15,7 +15,7 @@ func newSearchService(url string) *SearchService {
|
||||
}
|
||||
}
|
||||
|
||||
// SerachRequest describes search request
|
||||
// SearchRequest describes search request
|
||||
type SearchRequest struct {
|
||||
Q string `url:"q,omitempty"` // search query
|
||||
Type string `url:"type,omitempty"` // one of release, master, artist, label
|
||||
|
Reference in New Issue
Block a user