feat: add trailer, characters, and recommendations to anime details

This commit is contained in:
2026-05-04 20:19:58 +02:00
parent d1433f54e2
commit c976e99f5a
5 changed files with 222 additions and 128 deletions

View File

@@ -6,6 +6,30 @@ import (
"time"
)
func (c *Client) GetAnimeCharacters(ctx context.Context, id int) ([]CharacterEntry, error) {
url := fmt.Sprintf("%s/anime/%d/characters", c.baseURL, id)
cacheKey := fmt.Sprintf("anime:characters:%d", id)
var resp CharactersResponse
if err := c.getWithCache(ctx, cacheKey, 24*time.Hour, url, &resp); err != nil {
return nil, err
}
return resp.Data, nil
}
func (c *Client) GetAnimeRecommendations(ctx context.Context, id int) ([]RecommendationEntry, error) {
url := fmt.Sprintf("%s/anime/%d/recommendations", c.baseURL, id)
cacheKey := fmt.Sprintf("anime:recommendations:%d", id)
var resp RecommendationsResponse
if err := c.getWithCache(ctx, cacheKey, 24*time.Hour, url, &resp); err != nil {
return nil, err
}
return resp.Data, nil
}
func (c *Client) GetAnimeByID(ctx context.Context, id int) (Anime, error) {
cacheKey := fmt.Sprintf("anime:%d", id)