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/README.md

60 lines
1.4 KiB
Markdown
Raw Normal View History

2016-02-03 15:31:59 +00:00
# REST API 2.0 Discogs.com client
2016-02-04 12:30:49 +00:00
2016-03-11 14:41:48 +00:00
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
2016-03-11 14:54:33 +00:00
import "github.com/irlndts/go-discogs"
```
```go
client := discogs.NewClient().UserAgent("TestDiscogsClient/0.0.1 +example.com")
2016-03-11 14:41:48 +00:00
```
#### 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