diff options
Diffstat (limited to 'content/docs/mal2go/v4/user/manga/get-manga-list.md')
-rw-r--r-- | content/docs/mal2go/v4/user/manga/get-manga-list.md | 53 |
1 files changed, 53 insertions, 0 deletions
diff --git a/content/docs/mal2go/v4/user/manga/get-manga-list.md b/content/docs/mal2go/v4/user/manga/get-manga-list.md new file mode 100644 index 0000000..004e764 --- /dev/null +++ b/content/docs/mal2go/v4/user/manga/get-manga-list.md @@ -0,0 +1,53 @@ +--- +title: "Get manga list" +description: "Get an arbitrary user's mangalist" +weight: 2 +--- + +Use the `GetMangaList` method to get the mangalist of a user. +This method takes these arguments: + +- `username string` Username of the user to get mangalist of. An empty string or `"@me"` will return the logged-in user's list +- `status string` Status of the mangas, accepted values are `reading`, `completed`, `on_hold`, `dropped` and `plan_to_read` +- `sort string` How to sort the list, accepted values are `list_score`, `list_updated_at`, `manga_title`, `manga_start_date` and `manga_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 manga. [List of valid fields](/docs/mal2go/v4/manga/types/#mal2gomangamanga) + +Example: + +``` go +package main + +import ( + "github.com/MikunoNaka/MAL2Go/v4/user/manga" + "log" + "fmt" +) + +func main() { + authToken := "YOUR_TOKEN_HERE" + myClient := manga.Client { + AuthToken: "Bearer " + authToken, + } + + mangaList, nextPageExists, err := myClient.GetMangaList("0ZeroTsu", "completed", "list_score", 1000, 0, true, []string{"title"}) + if err != nil { + log.Fatal(err) + } + + for _, i := range mangaList { + fmt.Println(i.Title) + } + + if nextPageExists { + fmt.Println("This user has even more mangas in their mangalist.") + 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 manga 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 mangaList by calling `manga.GetMangaList` with a higher offset. |