From fff3dadabc321871e6819392efc605c6dffe2e69 Mon Sep 17 00:00:00 2001 From: Vidhu Kant Sharma Date: Tue, 15 Aug 2023 10:57:27 +0530 Subject: migrated from MAL2Go to mg package --- mal/episodes.go | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) (limited to 'mal/episodes.go') diff --git a/mal/episodes.go b/mal/episodes.go index 0940af5..caea1a8 100644 --- a/mal/episodes.go +++ b/mal/episodes.go @@ -19,15 +19,15 @@ along with this program. If not, see . package mal import ( + "vidhukant.com/macli/util" + "vidhukant.com/mg" "fmt" "os" - a "github.com/MikunoNaka/MAL2Go/v4/user/anime" - m "github.com/MikunoNaka/MAL2Go/v4/user/manga" - "github.com/MikunoNaka/macli/util" ) -func SetEpisodes(animeId, prevValue int, ep string) a.UpdateResponse { - res, err := userAnimeClient.SetWatchedEpisodes(animeId, util.ParseNumeric(ep, prevValue)) +func SetEpisodes(animeId, prevValue int, ep string) mg.AnimeUpdateResponse { + var res mg.AnimeUpdateResponse + err := MALClient.UpdateAnime(&res, animeId, map[string]interface{}{mg.EpisodesWatched: util.ParseNumeric(ep, prevValue)}) if err != nil { fmt.Println("MyAnimeList returned error while updating episodes:", err) os.Exit(1) @@ -35,8 +35,9 @@ func SetEpisodes(animeId, prevValue int, ep string) a.UpdateResponse { return res } -func SetChapters(mangaId, prevValue int, ch string) m.UpdateResponse { - res, err := userMangaClient.SetChaptersRead(mangaId, util.ParseNumeric(ch, prevValue)) +func SetChapters(mangaId, prevValue int, ch string) mg.MangaUpdateResponse { + var res mg.MangaUpdateResponse + err := MALClient.UpdateManga(&res, mangaId, map[string]interface{}{mg.ChaptersRead: util.ParseNumeric(ch, prevValue)}) if err != nil { fmt.Println("MyAnimeList returned error while updating chapters:", err) os.Exit(1) @@ -44,8 +45,9 @@ func SetChapters(mangaId, prevValue int, ch string) m.UpdateResponse { return res } -func SetVolumes(mangaId, prevValue int, vol string) m.UpdateResponse { - res, err := userMangaClient.SetVolumesRead(mangaId, util.ParseNumeric(vol, prevValue)) +func SetVolumes(mangaId, prevValue int, vol string) mg.MangaUpdateResponse { + var res mg.MangaUpdateResponse + err := MALClient.UpdateManga(&res, mangaId, map[string]interface{}{mg.VolumesRead: util.ParseNumeric(vol, prevValue)}) if err != nil { fmt.Println("MyAnimeList returned error while updating volumes:", err) os.Exit(1) -- cgit v1.2.3