mirror of
https://git.sr.ht/~phw/scotty
synced 2025-04-30 21:57:06 +02:00
Test ListenBrainz client
This commit is contained in:
parent
cf8a6d2ab6
commit
3ac3fac317
5 changed files with 153 additions and 3 deletions
|
@ -34,7 +34,7 @@ const DefaultItemsPerGet = 25
|
|||
const MaxItemsPerGet = 1000
|
||||
|
||||
type Client struct {
|
||||
resty *resty.Client
|
||||
HttpClient *resty.Client
|
||||
MaxResults int
|
||||
}
|
||||
|
||||
|
@ -45,7 +45,7 @@ func New(token string) Client {
|
|||
resty.SetAuthToken(token)
|
||||
resty.SetHeader("Accept", "application/json")
|
||||
client := Client{
|
||||
resty: resty,
|
||||
HttpClient: resty,
|
||||
MaxResults: DefaultItemsPerGet,
|
||||
}
|
||||
|
||||
|
@ -55,7 +55,7 @@ func New(token string) Client {
|
|||
func (c Client) GetListens(user string, maxTime time.Time, minTime time.Time) (GetListensResult, error) {
|
||||
const path = "/user/{username}/listens"
|
||||
result := &GetListensResult{}
|
||||
_, err := c.resty.R().
|
||||
_, err := c.HttpClient.R().
|
||||
SetPathParam("username", user).
|
||||
SetQueryParams(map[string]string{
|
||||
"max_ts": strconv.FormatInt(maxTime.Unix(), 10),
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue