2016-03-04 16:08:02 +00:00
|
|
|
package discogs
|
|
|
|
|
|
|
|
import (
|
2017-04-25 16:39:32 +00:00
|
|
|
"strconv"
|
2016-03-04 16:08:02 +00:00
|
|
|
)
|
|
|
|
|
2017-04-25 16:39:32 +00:00
|
|
|
// Release serves relesase response from discogs
|
2016-03-04 16:48:26 +00:00
|
|
|
type Release struct {
|
2017-04-25 16:39:32 +00:00
|
|
|
Title string `json:"title"`
|
|
|
|
ID int `json:"id"`
|
|
|
|
Artists []ArtistSource `json:"artists"`
|
|
|
|
DataQuality string `json:"data_quality"`
|
|
|
|
Thumb string `json:"thumb"`
|
|
|
|
Community Community `json:"community"`
|
|
|
|
Companies []Company `json:"companies"`
|
|
|
|
Country string `json:"country"`
|
|
|
|
DateAdded string `json:"date_added"`
|
|
|
|
DateChanged string `json:"date_changed"`
|
|
|
|
EstimatedWeight int `json:"estimated_weight"`
|
|
|
|
ExtraArtists []ArtistSource `json:"extraartists"`
|
|
|
|
FormatQuantity int `json:"format_quantity"`
|
|
|
|
Formats []Format `json:"formats"`
|
|
|
|
Genres []string `json:"genres"`
|
|
|
|
Identifiers []Identifier `json:"identifiers"`
|
|
|
|
Images []Image `json:"images"`
|
|
|
|
Labels []LabelSource `json:"labels"`
|
|
|
|
LowestPrice float64 `json:"lowest_price"`
|
|
|
|
MasterID int `json:"master_id"`
|
|
|
|
MasterURL string `json:"master_url"`
|
|
|
|
Notes string `json:"notes,omitempty"`
|
|
|
|
NumForSale int `json:"numfor_sale,omitempty"`
|
|
|
|
Released string `json:"released"`
|
|
|
|
ReleasedFormatted string `json:"released_formatted"`
|
|
|
|
ResourceURL string `json:"resource_url"`
|
|
|
|
// Series
|
|
|
|
Status string `json:"status"`
|
|
|
|
Styles []string `json:"styles"`
|
|
|
|
Tracklist []Track `json:"tracklist"`
|
|
|
|
URI string `json:"uri"`
|
|
|
|
Videos []Video `json:"videos"`
|
|
|
|
Year int `json:"year"`
|
2016-03-09 14:54:25 +00:00
|
|
|
}
|
|
|
|
|
2017-04-25 16:39:32 +00:00
|
|
|
type RequestRelease struct {
|
|
|
|
Curr_abbr string
|
2016-03-04 16:08:02 +00:00
|
|
|
}
|
2016-03-04 16:48:26 +00:00
|
|
|
|
2017-04-25 16:39:32 +00:00
|
|
|
// Release returns release by release's ID
|
|
|
|
func (c *Client) Release(releaseID int) (*Release, error) {
|
2016-03-04 16:48:26 +00:00
|
|
|
release := new(Release)
|
2016-03-09 15:14:42 +00:00
|
|
|
apiError := new(APIError)
|
2016-03-10 14:25:55 +00:00
|
|
|
|
2017-04-25 16:39:32 +00:00
|
|
|
req := &RequestRelease{Curr_abbr: c.currency}
|
|
|
|
_, err := c.api.New().Get("releases/"+strconv.Itoa(releaseID)).QueryStruct(req).Receive(release, apiError)
|
|
|
|
return release, relevantError(err, *apiError)
|
2016-03-04 16:48:26 +00:00
|
|
|
}
|