From 0eb32bb339f66d3416c1088d6372bc7219b6e323 Mon Sep 17 00:00:00 2001 From: Vidhu Kant Sharma Date: Sun, 6 Feb 2022 19:02:33 +0530 Subject: now a single http.Client is responsible for all the HTTP requests. --- anime/anime.go | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'anime/anime.go') diff --git a/anime/anime.go b/anime/anime.go index 617ed22..90231e3 100644 --- a/anime/anime.go +++ b/anime/anime.go @@ -51,7 +51,7 @@ func (c AnimeClient) SearchAnime(searchString string, limit, offset int, fields // gets data from API and stores it in a struct var animeSearchData AnimeSearchRaw - data := requestHandler(c.AuthToken, endpoint) + data := c.requestHandler(endpoint) json.Unmarshal([]byte(data), &animeSearchData) // Adding all the animes to another list to get formatted results later @@ -89,7 +89,7 @@ func (c AnimeClient) GetAnimeById(animeId int, fields []string) (Anime, error) { true, ) - data := requestHandler(c.AuthToken, endpoint) + data := c.requestHandler(endpoint) json.Unmarshal([]byte(data), &anime) return anime, nil @@ -125,7 +125,7 @@ func (c AnimeClient) GetAnimeRanking(rankingType string, limit, offset int, fiel // gets data from API and stores it in a struct var rankingData RawRanking - data := requestHandler(c.AuthToken, endpoint) + data := c.requestHandler(endpoint) json.Unmarshal([]byte(data), &rankingData) // Adding all the animes in ranking list to a slice @@ -187,7 +187,7 @@ func (c AnimeClient) GetSeasonalAnime(year, season, sort string, limit, offset i // gets data from API and stores it in a struct var seasonalAnimeData SeasonalAnimeRaw - data := requestHandler(c.AuthToken, endpoint) + data := c.requestHandler(endpoint) json.Unmarshal([]byte(data), &seasonalAnimeData) // Adding all the animes to another list to get formatted results later @@ -231,7 +231,7 @@ func (c AnimeClient) GetSuggestedAnime(limit, offset int, fields []string) (Sugg // gets data from API and stores it in a struct var suggestedAnimeData SuggestedAnimeRaw - data := requestHandler(c.AuthToken, endpoint) + data := c.requestHandler(endpoint) json.Unmarshal([]byte(data), &suggestedAnimeData) // Adding all the animes to another list to get formatted results later -- cgit v1.2.3