From 5c75cd32bbc8549125318193ab65a4f3eb73e6fe Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=9F=D0=B8=D1=81=D0=BA=D1=83=D0=BD=20=D0=90=D1=80=D1=82?= =?UTF-8?q?=D0=B5=D0=BC?= Date: Fri, 12 Feb 2016 18:22:50 +0300 Subject: [PATCH] first steps --- discogs/discogs.go | 23 +++++++++++++++++++++++ discogs/releases.go | 15 +++++++++++++++ 2 files changed, 38 insertions(+) create mode 100644 discogs/discogs.go create mode 100644 discogs/releases.go diff --git a/discogs/discogs.go b/discogs/discogs.go new file mode 100644 index 0000000..b394872 --- /dev/null +++ b/discogs/discogs.go @@ -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()), + } +} diff --git a/discogs/releases.go b/discogs/releases.go new file mode 100644 index 0000000..0e1ab70 --- /dev/null +++ b/discogs/releases.go @@ -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/"), + } +}