first steps

This commit is contained in:
Пискун Артем 2016-02-12 18:22:50 +03:00
parent 7ae9aacb9f
commit 5c75cd32bb
2 changed files with 38 additions and 0 deletions

23
discogs/discogs.go Normal file
View File

@ -0,0 +1,23 @@
package discogs
import (
"github.com/irlndts/go-apirequest"
"net/http"
)
const discogsAPI = "https://api.discogs.com/"
// Client is a Discogs client for making Discogs API requests.
type Client struct {
api *apirequest.API
Releases *ReleaseService
}
// NewClient returns a new Client.
func NewClient(httpClient *http.Client) *Client {
base := apirequest.New().Client(httpClient).Base(discogsAPI)
return &Client{
api: base,
Releases: newReleaseService(base.New()),
}
}

15
discogs/releases.go Normal file
View File

@ -0,0 +1,15 @@
package discogs
import (
"github.com/irlndts/go-apirequest"
)
type ReleaseService struct {
api *apirequest.API
}
func newReleaseService(api *apirequest.API) *ReleaseService {
return &ReleaseService{
api: api.Path("releases/"),
}
}