From 419e08bc3a369a0c1138871184e1a30320032afd Mon Sep 17 00:00:00 2001 From: Vidhu Kant Sharma Date: Sun, 13 Feb 2022 16:56:09 +0530 Subject: added functionality to update anime list of authenticated user --- user/anime/animelist.go | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) (limited to 'user/anime/animelist.go') diff --git a/user/anime/animelist.go b/user/anime/animelist.go index 120bdea..4f5eac5 100644 --- a/user/anime/animelist.go +++ b/user/anime/animelist.go @@ -37,9 +37,19 @@ func (c AnimeListClient)DeleteAnime(id int) string { } // Update/Add an anime to user's anime list -// func UpdateAnime(id int) { +func (c AnimeListClient)UpdateAnime(id int, data UpdateAnimeData) string { + endpoint := fmt.Sprintf("%s/anime/%d/my_list_status", BASE_URL, id) + + // turn data struct into json + pepe, err := json.Marshal(data) + if err != nil { + fmt.Println(err) + } -// } + // finally make API request + res := c.putRequestHandler(endpoint, pepe) + return res +} // Get authenticated user's anime list func (c AnimeListClient) GetAnimeList(user, status, sort string, limit, offset int) (a.AnimeList, error){ -- cgit v1.2.3