From bce16b5ed15a6b4f23c3bf5ad1e7c633eb86f661 Mon Sep 17 00:00:00 2001 From: irlndts Date: Sun, 16 Apr 2017 23:49:50 +0300 Subject: [PATCH] Some comments edited --- README.md | 2 +- search.go | 5 +++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index b0a289c..24ac8e1 100644 --- a/README.md +++ b/README.md @@ -34,7 +34,7 @@ import "github.com/irlndts/go-discogs" ```go 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 client := discogs.NewClient("TestDiscogsClient/0.0.1 +example.com", "sometoken") ``` diff --git a/search.go b/search.go index d5a43eb..1bd9bc3 100644 --- a/search.go +++ b/search.go @@ -6,10 +6,12 @@ import ( "github.com/irlndts/go-apirequest" ) +// SearchService ... type SearchService struct { api *apirequest.API } +// SerachRequest implements search request model type SearchRequest struct { Q string // search query (optional) Type string // one of release, master, artist, label (optional) @@ -34,11 +36,13 @@ type SearchRequest struct { Per_page int // optional } +// Search describes search response type Search struct { Pagination Page `json:"pagination"` Results []Result `json:"results"` } +// Result describes a part of search result type Result struct { Style []string `json:"style"` 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) { search := new(Search) apiError := new(APIError)