mirror of
https://git.sr.ht/~phw/scotty
synced 2025-04-30 13:47:05 +02:00
listenbrainz: Read data from newest first
Very low min_ts parameters lead to empty results from LB and there is no easy way to determine the oldest valid timestamp.
This commit is contained in:
parent
6047a9b274
commit
49cb2774e2
2 changed files with 19 additions and 10 deletions
|
@ -52,13 +52,14 @@ func New(token string) Client {
|
|||
return client
|
||||
}
|
||||
|
||||
func (c Client) GetListens(user string, minTs time.Time) (GetListensResult, error) {
|
||||
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().
|
||||
SetPathParam("username", user).
|
||||
SetQueryParams(map[string]string{
|
||||
"min_ts": strconv.FormatInt(minTs.Unix(), 10),
|
||||
"max_ts": strconv.FormatInt(maxTime.Unix(), 10),
|
||||
"min_ts": strconv.FormatInt(minTime.Unix(), 10),
|
||||
"count": strconv.FormatInt(int64(c.MaxResults), 10),
|
||||
}).
|
||||
SetResult(result).
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue