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