aboutsummaryrefslogtreecommitdiff
path: root/content/docs/mal2go/v4/user/anime/get-anime-list.md
diff options
context:
space:
mode:
authorVidhu Kant Sharma <vidhukant@vidhukant.xyz>2022-09-21 20:02:49 +0530
committerVidhu Kant Sharma <vidhukant@vidhukant.xyz>2022-09-21 20:02:49 +0530
commitfdd266052a6f64e67712a0bffdfca5469bef23c7 (patch)
tree147ed11cb4ff5f514ee6f1c11310cdb2a84ea611 /content/docs/mal2go/v4/user/anime/get-anime-list.md
parent451de26b401a992114eae377a9bcab74c6d92c58 (diff)
added MAL2Go/user/anime docs
Diffstat (limited to 'content/docs/mal2go/v4/user/anime/get-anime-list.md')
-rw-r--r--content/docs/mal2go/v4/user/anime/get-anime-list.md53
1 files changed, 53 insertions, 0 deletions
diff --git a/content/docs/mal2go/v4/user/anime/get-anime-list.md b/content/docs/mal2go/v4/user/anime/get-anime-list.md
new file mode 100644
index 0000000..22f6f4a
--- /dev/null
+++ b/content/docs/mal2go/v4/user/anime/get-anime-list.md
@@ -0,0 +1,53 @@
+---
+title: "Get anime list"
+description: "Get an arbitrary user's animelist"
+weight: 2
+---
+
+Use the `GetAnimeList` method to get the animelist of a user.
+This method takes these arguments:
+
+- `username string` Username of the user to get animelist of. An empty string or `"@me"` will return the logged-in user's list
+- `status string` Status of the animes, accepted values are `watching`, `completed`, `on_hold`, `dropped` and `plan_to_watch`
+- `sort string` How to sort the list, accepted values are `list_score`, `list_updated_at`, `anime_title`, `anime_start_date` and `anime_id`
+- `limit int` Limit of results to pull, Max is 1000
+- `offset int` Offset for the results
+- `nsfw bool` To include NSFW elements or not
+- `fields []string` Specify which fields to get for each anime. [List of valid fields](/docs/mal2go/v4/anime/types/#mal2goanimeanime)
+
+Example:
+
+``` go
+package main
+
+import (
+ "github.com/MikunoNaka/MAL2Go/v4/user/anime"
+ "log"
+ "fmt"
+)
+
+func main() {
+ authToken := "YOUR_TOKEN_HERE"
+ myClient := anime.Client {
+ AuthToken: "Bearer " + authToken,
+ }
+
+ animeList, nextPageExists, err := myClient.GetAnimeList("0ZeroTsu", "completed", "list_score", 1000, 0, true, []string{"title"})
+ if err != nil {
+ log.Fatal(err)
+ }
+
+ for _, i := range animeList {
+ fmt.Println(i.Title)
+ }
+
+ if nextPageExists {
+ fmt.Println("This user has even more animes in their animelist.")
+ fmt.Println("Please increase the offset to look at the hidden entries.")
+ }
+}
+```
+
+The above example prints the first 1000 entries from 0ZeroTsu's (mine) completed anime list.
+If the list has more than 1000 items, the `nextPageExists` becomes true, which can be used to show
+a notice like this, or maybe append the remaining items to animeList by calling `anime.GetAnimeList` with a higher offset.