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/discogs.go
2017-04-17 00:09:01 +03:00

34 lines
814 B
Go

package discogs
import (
"net/http"
"github.com/irlndts/go-apirequest"
)
const (
discogsAPI = "https://api.discogs.com/"
)
// Client is a Discogs client for making Discogs API requests.
type Client struct {
api *apirequest.API
Release *ReleaseService
Master *MasterService
Artist *ArtistService
Label *LabelService
Search *SearchService
}
// NewClient returns a new Client.
func NewClient(useragent, token string) *Client {
base := apirequest.New().Client(&http.Client{}).Base(discogsAPI).Add("User-Agent", useragent).Add("Authorization", "Discogs token="+token)
return &Client{
Artist: newArtistService(base.New()),
Label: newLabelService(base.New()),
Master: newMasterService(base.New()),
Release: newReleaseService(base.New()),
Search: newSearchService(base.New()),
}
}