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
Пискун Артем 4c36248c00 specified release json
2016-03-09 17:54:25 +03:00

34 lines
699 B
Go

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
}
// NewClient returns a new Client.
func NewClient(httpClient *http.Client) *Client {
base := apirequest.New().Client(httpClient).Base(discogsAPI).Add("User-Agent", useragent)
return &Client{
api: base,
Release: newReleaseService(base.New()),
}
}
// discogs require specified user agent
func (c *Client) UserAgent(useragent string) *Client {
c.api.Set("User-Agent", useragent)
return c
}