Some comments edited
This commit is contained in:
parent
4e7c6c065a
commit
bce16b5ed1
@ -34,7 +34,7 @@ import "github.com/irlndts/go-discogs"
|
|||||||
```go
|
```go
|
||||||
client := discogs.NewClient("TestDiscogsClient/0.0.1 +example.com", "")
|
client := discogs.NewClient("TestDiscogsClient/0.0.1 +example.com", "")
|
||||||
```
|
```
|
||||||
Some requests require authentication (as any user). According to [Discogs](https://www.discogs.com/developers/#page:authentication,header:authentication-discogs-auth-flow), to send requests with Discogs Auth, you have two options: sending your credentials in the query string with key and secret parameters or a token parameter. Key-secret doesn't implemented yet, but token is yes.
|
Some requests require authentification (as any user). According to [Discogs](https://www.discogs.com/developers/#page:authentication,header:authentication-discogs-auth-flow), to send requests with Discogs Auth, you have two options: sending your credentials in the query string with key and secret parameters or a token parameter. Key-secret doesn't implemented yet, but token is yes.
|
||||||
```go
|
```go
|
||||||
client := discogs.NewClient("TestDiscogsClient/0.0.1 +example.com", "sometoken")
|
client := discogs.NewClient("TestDiscogsClient/0.0.1 +example.com", "sometoken")
|
||||||
```
|
```
|
||||||
|
@ -6,10 +6,12 @@ import (
|
|||||||
"github.com/irlndts/go-apirequest"
|
"github.com/irlndts/go-apirequest"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
// SearchService ...
|
||||||
type SearchService struct {
|
type SearchService struct {
|
||||||
api *apirequest.API
|
api *apirequest.API
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// SerachRequest implements search request model
|
||||||
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)
|
||||||
@ -34,11 +36,13 @@ type SearchRequest struct {
|
|||||||
Per_page int // optional
|
Per_page int // optional
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Search describes search response
|
||||||
type Search struct {
|
type Search struct {
|
||||||
Pagination Page `json:"pagination"`
|
Pagination Page `json:"pagination"`
|
||||||
Results []Result `json:"results"`
|
Results []Result `json:"results"`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Result describes a part of search result
|
||||||
type Result struct {
|
type Result struct {
|
||||||
Style []string `json:"style"`
|
Style []string `json:"style"`
|
||||||
Thumb string `json:"thumb"`
|
Thumb string `json:"thumb"`
|
||||||
@ -62,6 +66,7 @@ func newSearchService(api *apirequest.API) *SearchService {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Search makes search request to discogs
|
||||||
func (self *SearchService) Search(params *SearchRequest) (*Search, *http.Response, error) {
|
func (self *SearchService) Search(params *SearchRequest) (*Search, *http.Response, error) {
|
||||||
search := new(Search)
|
search := new(Search)
|
||||||
apiError := new(APIError)
|
apiError := new(APIError)
|
||||||
|
Reference in New Issue
Block a user