mirror of
https://git.sr.ht/~phw/scotty
synced 2025-04-30 05:37:05 +02:00
Code style: All uppercase acronyms URL, ISRC, ID, HTTP
This commit is contained in:
parent
39b31fc664
commit
d51c97c648
26 changed files with 137 additions and 137 deletions
|
@ -33,13 +33,13 @@ import (
|
|||
const MaxItemsPerGet = 50
|
||||
|
||||
type Client struct {
|
||||
HttpClient *resty.Client
|
||||
HTTPClient *resty.Client
|
||||
token string
|
||||
}
|
||||
|
||||
func NewClient(serverUrl string, token string) Client {
|
||||
func NewClient(serverURL string, token string) Client {
|
||||
client := resty.New()
|
||||
client.SetBaseURL(serverUrl)
|
||||
client.SetBaseURL(serverURL)
|
||||
client.SetAuthScheme("Bearer")
|
||||
client.SetAuthToken(token)
|
||||
client.SetHeader("Accept", "application/json")
|
||||
|
@ -49,14 +49,14 @@ func NewClient(serverUrl string, token string) Client {
|
|||
ratelimit.EnableHTTPHeaderRateLimit(client, "Retry-After")
|
||||
|
||||
return Client{
|
||||
HttpClient: client,
|
||||
HTTPClient: client,
|
||||
token: token,
|
||||
}
|
||||
}
|
||||
|
||||
func (c Client) GetHistoryListenings(user string, page int, perPage int) (result ListeningsResult, err error) {
|
||||
const path = "/api/v1/history/listenings"
|
||||
response, err := c.HttpClient.R().
|
||||
response, err := c.HTTPClient.R().
|
||||
SetQueryParams(map[string]string{
|
||||
"username": user,
|
||||
"page": strconv.Itoa(page),
|
||||
|
@ -75,7 +75,7 @@ func (c Client) GetHistoryListenings(user string, page int, perPage int) (result
|
|||
|
||||
func (c Client) GetFavoriteTracks(page int, perPage int) (result FavoriteTracksResult, err error) {
|
||||
const path = "/api/v1/favorites/tracks"
|
||||
response, err := c.HttpClient.R().
|
||||
response, err := c.HTTPClient.R().
|
||||
SetQueryParams(map[string]string{
|
||||
"page": strconv.Itoa(page),
|
||||
"page_size": strconv.Itoa(perPage),
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue