From b8e2c017d77f0d26723bf3f575ea998f7dbdf030 Mon Sep 17 00:00:00 2001 From: Artem Piskun Date: Fri, 11 Mar 2016 17:41:48 +0300 Subject: [PATCH 1/2] Update README.md --- README.md | 64 ++++++++++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 63 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index f5e35cd..c6a8cf2 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,65 @@ # REST API 2.0 Discogs.com client -..work in progress.. +go-discogs is a Go client library for the [Discogs API](https://www.discogs.com/developers/). Check the usage section or try the examples to see how to access the Discogs API. + +### Feauteres + * Database + * Releases + * Master Releases + * Release Versions + * Artists + * Artist Releases + * Label + * All Label Releases + +#### ToDo +- Search + + +Install +-------- + go get github.com/irlndts/go-discogs + +Usage +--------- +The discogs package provides a client for accessing the Discogs API. +First of all import library and init client variable. According to discogs api documentation you [must provide your user-agent](https://www.discogs.com/developers/#page:home,header:home-general-information). +```go + package main + + import ( + "github.com/irlndts/go-discogs" + "net/http" + ) + + func main(){ + client := discogs.NewClient(&http.Client{}).UserAgent("TestDiscogsClient/0.0.1 +example.com") + //.... +``` + +#### Releases +```go + params := &discogs.ReleaseParams{Release_id: "8138518"} + release, _, err := d.Release.Release(params) + + fmt.Println(fmt.Println(release.Artists[0].Name, " - ", release.Title)) // St. Petersburg Ska-Jazz Review - Elephant Riddim +``` + +#### Artists +```go + params := &discogs.LabelParams{Label_id: "890477", Page: 2, Per_page: 3} + label, _, err := d.Label.Releases(params) + + for _, release := range label.Releases { + fmt.Println(release.Title) + } + + /* + Someday / I Hate Everything About You + Spy Potion + Surf Attack From Russia + */ +``` + +etc. +More examples - soon From fd09f103fc62113874ef3560febf0fdd3f6b81fb Mon Sep 17 00:00:00 2001 From: Artem Piskun Date: Fri, 11 Mar 2016 17:46:37 +0300 Subject: [PATCH 2/2] Update README.md --- README.md | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index c6a8cf2..097eeb0 100644 --- a/README.md +++ b/README.md @@ -29,12 +29,10 @@ First of all import library and init client variable. According to discogs api d import ( "github.com/irlndts/go-discogs" - "net/http" ) - - func main(){ - client := discogs.NewClient(&http.Client{}).UserAgent("TestDiscogsClient/0.0.1 +example.com") - //.... + ``` + ```go + client := discogs.NewClient().UserAgent("TestDiscogsClient/0.0.1 +example.com") ``` #### Releases