Doc fixed
This commit is contained in:
parent
ede8271b88
commit
d5ddddc09d
15
README.md
15
README.md
@ -32,28 +32,27 @@ client, err := discogs.NewClient(&discogs.Options{
|
|||||||
UserAgent: "Some Name",
|
UserAgent: "Some Name",
|
||||||
Currency: "EUR", // optional, "USD" (default), "GBP", "EUR", "CAD", "AUD", "JPY", "CHF", "MXN", "BRL", "NZD", "SEK", "ZAR" are allowed
|
Currency: "EUR", // optional, "USD" (default), "GBP", "EUR", "CAD", "AUD", "JPY", "CHF", "MXN", "BRL", "NZD", "SEK", "ZAR" are allowed
|
||||||
Token: "Some Token", // optional
|
Token: "Some Token", // optional
|
||||||
URL: "https://api.discogs.com",
|
|
||||||
})
|
})
|
||||||
```
|
```
|
||||||
|
|
||||||
#### Releases
|
#### Releases
|
||||||
```go
|
```go
|
||||||
release, err := client.Release.Release(9893847)
|
release, _ := client.Release.Release(9893847)
|
||||||
fmt.Println(release.Artists[0].Name, " - ", release.Title)
|
fmt.Println(release.Artists[0].Name, " - ", release.Title)
|
||||||
// St. Petersburg Ska-Jazz Review - Elephant Riddim
|
// St. Petersburg Ska-Jazz Review - Elephant Riddim
|
||||||
```
|
```
|
||||||
|
|
||||||
#### Search
|
#### Search
|
||||||
Issue a search query to discogs database. This endpoint accepts pagination parameters
|
Issue a search query to discogs database. This endpoint accepts pagination parameters.
|
||||||
Authentication (as any user) is required.
|
Authentication (as any user) is required.
|
||||||
|
|
||||||
Use `SearchRequest` struct to create a request
|
Use `SearchRequest` struct to create a request.
|
||||||
```go
|
```go
|
||||||
type SearchRequest struct {
|
type SearchRequest struct {
|
||||||
Q string // search query (optional)
|
Q string // search query (optional)
|
||||||
Type string // one of release, master, artist, label (optional)
|
Type string // one of release, master, artist, label (optional)
|
||||||
Title string // search by combined “Artist Name - Release Title” title field (optional)
|
Title string // search by combined “Artist Name - Release Title” title field (optional)
|
||||||
Release_title string // search release titles (optional)
|
ReleaseTitle string // search release titles (optional)
|
||||||
Credit string // search release credits (optional)
|
Credit string // search release credits (optional)
|
||||||
Artist string // search artist names (optional)
|
Artist string // search artist names (optional)
|
||||||
Anv string // search artist ANV (optional)
|
Anv string // search artist ANV (optional)
|
||||||
@ -70,14 +69,14 @@ type SearchRequest struct {
|
|||||||
Contributer string // search contributor usernames (optional)
|
Contributer string // search contributor usernames (optional)
|
||||||
|
|
||||||
Page int // optional
|
Page int // optional
|
||||||
Per_page int // optional
|
PerPage int // optional
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
Example
|
Example
|
||||||
```go
|
```go
|
||||||
request:= &discogs.SearchRequest{Artist: "reggaenauts", Release_title: "river rock", Page: 0, Per_page: 1}
|
request := discogs.SearchRequest{Artist: "reggaenauts", ReleaseTitle: "river rock", Page: 0, PerPage: 1}
|
||||||
search, _, err := client.Search(request)
|
search, _ := client.Search(request)
|
||||||
|
|
||||||
for _, r := range search.Results {
|
for _, r := range search.Results {
|
||||||
fmt.Println(r.Title)
|
fmt.Println(r.Title)
|
||||||
|
Reference in New Issue
Block a user