2016-03-04 16:08:02 +00:00
|
|
|
package discogs
|
|
|
|
|
|
|
|
import (
|
|
|
|
"github.com/irlndts/go-apirequest"
|
2016-03-04 16:48:26 +00:00
|
|
|
"net/http"
|
2016-03-04 16:08:02 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
type ReleaseService struct {
|
|
|
|
api *apirequest.API
|
|
|
|
}
|
|
|
|
|
2016-03-04 16:48:26 +00:00
|
|
|
type ReleaseParams struct {
|
2016-03-09 14:54:25 +00:00
|
|
|
Release_id string
|
2016-03-04 16:48:26 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
type Release struct {
|
2016-03-10 14:48:15 +00:00
|
|
|
Title string `json:"title"`
|
|
|
|
Id int `json:"id"`
|
|
|
|
Artists []ArtistSource `json:"artists"`
|
|
|
|
Data_quality string `json:"data_quality"`
|
|
|
|
Thumb string `json:"thumb"`
|
|
|
|
Community Community `json:"community"`
|
|
|
|
Companies []Company `json:"companies"`
|
|
|
|
Country string `json:"country"`
|
|
|
|
Date_added string `json:"date_added"`
|
|
|
|
Date_changed string `json:"date_changed"`
|
|
|
|
Estimated_weight int `json:"estimated_weight"`
|
|
|
|
Extraartists []ArtistSource `json:"extraartists"`
|
|
|
|
Format_quantity int `json:"format_quantity"`
|
|
|
|
Formats []Format `json:"formats"`
|
|
|
|
Genres []string `json:"genres"`
|
|
|
|
Identifiers []Identifier `json:"identifiers"`
|
|
|
|
Images []Image `json:"images"`
|
|
|
|
Labels []Label `json:"labels"`
|
|
|
|
Master_id int `json:"master_id"`
|
|
|
|
Master_url string `json:"master_url"`
|
|
|
|
Notes string `josn:"notes"`
|
|
|
|
Released string `json:"released"`
|
|
|
|
Released_formatted string `json:"released_formatted"`
|
|
|
|
Resource_url string `json:"resource_url"`
|
|
|
|
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
|
|
|
}
|
|
|
|
|
2016-03-04 16:08:02 +00:00
|
|
|
func newReleaseService(api *apirequest.API) *ReleaseService {
|
|
|
|
return &ReleaseService{
|
|
|
|
api: api.Path("releases/"),
|
|
|
|
}
|
|
|
|
}
|
2016-03-04 16:48:26 +00:00
|
|
|
|
|
|
|
func (self *ReleaseService) Release(params *ReleaseParams) (*Release, *http.Response, error) {
|
|
|
|
release := new(Release)
|
2016-03-09 15:14:42 +00:00
|
|
|
apiError := new(APIError)
|
2016-03-10 14:25:55 +00:00
|
|
|
|
|
|
|
resp, err := self.api.New().Get(params.Release_id).Receive(release, apiError)
|
2016-03-09 15:14:42 +00:00
|
|
|
return release, resp, relevantError(err, *apiError)
|
2016-03-04 16:48:26 +00:00
|
|
|
}
|