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