1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
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.
|