aboutsummaryrefslogtreecommitdiff
path: root/anime/anime.go
diff options
context:
space:
mode:
authorVidhu Kant Sharma <vidhukant@protonmail.ch>2022-02-06 19:02:33 +0530
committerVidhu Kant Sharma <vidhukant@protonmail.ch>2022-02-06 19:02:33 +0530
commit0eb32bb339f66d3416c1088d6372bc7219b6e323 (patch)
treebc5b2a5f60748f60d49f97d9eb934891369fb60e /anime/anime.go
parent0d97d71e135cf4fda87acaea56a376c264f90a59 (diff)
now a single http.Client is responsible for all the HTTP requests.
Diffstat (limited to 'anime/anime.go')
-rw-r--r--anime/anime.go10
1 files changed, 5 insertions, 5 deletions
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