diff options
author | Vidhu Kant Sharma <vidhukant@vidhukant.com> | 2023-08-15 10:57:27 +0530 |
---|---|---|
committer | Vidhu Kant Sharma <vidhukant@vidhukant.com> | 2023-08-15 10:57:27 +0530 |
commit | fff3dadabc321871e6819392efc605c6dffe2e69 (patch) | |
tree | 25aceed23b73b2ad975a06d73fad091d0886a2a6 /mal/list.go | |
parent | a44d6eb2fdddc75983c735e1a0fa744014db9593 (diff) |
migrated from MAL2Go to mg package
Diffstat (limited to 'mal/list.go')
-rw-r--r-- | mal/list.go | 31 |
1 files changed, 26 insertions, 5 deletions
diff --git a/mal/list.go b/mal/list.go index 3e9e737..f00edd9 100644 --- a/mal/list.go +++ b/mal/list.go @@ -19,28 +19,49 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. package mal import ( + "vidhukant.com/mg" "fmt" "os" - a "github.com/MikunoNaka/MAL2Go/v4/anime" - m "github.com/MikunoNaka/MAL2Go/v4/manga" ) // TODO: return all the list items using loop -func AnimeList(user, status, sort string) []a.Anime { - res, _, err := userAnimeClient.GetAnimeList(user, status, sort, 1000, 0, SearchNSFW, []string{"title", "num_episodes", "media_type"}) +func AnimeList(user, status, sort string) []mg.Anime { + var res []mg.Anime + _, err := MALClient.GetAnimeList(&res, &mg.ListParams{ + Username: user, + Status: status, + Sort: sort, + Limit: 1000, + Offset: 0, + NSFW: SearchNSFW, + Fields: []string{"title", "num_episodes", "media_type"}, + }) + if err != nil { fmt.Println(err) os.Exit(1) } + return res } // TODO: return all the list items using loop func MangaList(user, status, sort string) []m.Manga { - res, _, err := userMangaClient.GetMangaList(user, status, sort, 1000, 0, SearchNSFW, []string{"title", "num_chapters", "num_volumes", "media_type"}) + var res []mg.Manga + _, err := MALClient.GetMangaList(&res, &mg.ListParams{ + Username: user, + Status: status, + Sort: sort, + Limit: 1000, + Offset: 0, + NSFW: SearchNSFW, + Fields: []string{"title", "num_chapters", "num_volumes", "media_type"}, + }) + if err != nil { fmt.Println(err) os.Exit(1) } + return res } |