feat: add shared query param helpers for jikan

This commit is contained in:
2026-06-11 12:27:56 +02:00
parent 4b95f85d4d
commit 5ada1f72e4
6 changed files with 103 additions and 45 deletions

View File

@@ -5,6 +5,8 @@ import (
"encoding/json"
"fmt"
"math/rand"
"net/url"
"strconv"
"time"
)
@@ -30,7 +32,9 @@ func (c *Client) getSeasonList(ctx context.Context, page int, season string) (To
cacheKey := fmt.Sprintf("seasons_%s:%d", season, page)
var result TopAnimeResponse
reqURL := fmt.Sprintf("%s/seasons/%s?page=%d", c.baseURL, season, page)
params := url.Values{}
params.Set("page", strconv.Itoa(page))
reqURL := buildRequestURL(c.baseURL, fmt.Sprintf("/seasons/%s", season), params)
err := c.getWithCache(ctx, cacheKey, shortCacheTTL, reqURL, &result)
if err != nil {