This repository has been archived on 2023-04-13. You can view files and clone it, but cannot push or open issues or pull requests.
go-discogs/releases.go

62 lines
2.1 KiB
Go
Raw Normal View History

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-09 14:54:25 +00:00
Title string `json:"title"`
Id int `json:"id"`
2016-03-10 14:25:55 +00:00
Artists []Artist `json:"artists"`
2016-03-09 14:54:25 +00:00
Data_quality string `json:"data_quality"`
Thumb string `json:"thumb"`
2016-03-10 14:25:55 +00:00
Community Community `json:"community"`
Companies []Company `json:"companies"`
2016-03-09 14:54:25 +00:00
Country string `json:"country"`
Date_added string `json:"date_added"`
Date_changed string `json:"date_changed"`
Estimated_weight int `json:"estimated_weight"`
2016-03-10 14:25:55 +00:00
Extraartists []Extraartist `json:"extraartists"`
2016-03-09 14:54:25 +00:00
Format_quantity int `json:"format_quantity"`
2016-03-10 14:25:55 +00:00
Formats []Format `json:"formats"`
2016-03-09 14:54:25 +00:00
Genres []string `json:"genres"`
2016-03-10 14:25:55 +00:00
Identifiers []Identifier `json:"identifiers"`
Images []Image `json:"images"`
Labels []Label `json:"labels"`
2016-03-09 14:54:25 +00:00
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"`
2016-03-10 14:25:55 +00:00
Tracklist []Track `json:"tracklist"`
2016-03-09 14:54:25 +00:00
Uri string `json:"uri"`
2016-03-10 14:25:55 +00:00
Videos []Video `json:"videos"`
2016-03-09 14:54:25 +00:00
Year int `json:"year"`
}
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
}