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

@@ -3,6 +3,8 @@ package jikan
import (
"context"
"fmt"
"net/url"
"strconv"
)
func (c *Client) GetAnimeStaff(ctx context.Context, id int) ([]StaffEntry, error) {
@@ -46,7 +48,9 @@ func (c *Client) GetAnimeReviews(ctx context.Context, id int, page int) ([]Revie
page = 1
}
url := fmt.Sprintf("%s/anime/%d/reviews?page=%d", c.baseURL, id, page)
params := url.Values{}
params.Set("page", strconv.Itoa(page))
url := buildRequestURL(c.baseURL, fmt.Sprintf("/anime/%d/reviews", id), params)
cacheKey := fmt.Sprintf("anime:reviews:%d:%d", id, page)
var resp ReviewsResponse