From e62e8f2623cad37e4211d187f49d9d7c5c5bdb0d Mon Sep 17 00:00:00 2001 From: Vidhu Kant Sharma Date: Wed, 21 Sep 2022 22:07:00 +0530 Subject: added MAL2Go/user/manga docs --- content/docs/mal2go/v4/user/anime/set-priority.md | 2 +- .../docs/mal2go/v4/user/anime/set-rewatch-count.md | 2 +- content/docs/mal2go/v4/user/anime/set-status.md | 2 +- content/docs/mal2go/v4/user/anime/setting-up.md | 4 +- content/docs/mal2go/v4/user/manga/delete-manga.md | 44 ++++++++++++++++ .../docs/mal2go/v4/user/manga/get-manga-list.md | 53 +++++++++++++++++++ content/docs/mal2go/v4/user/manga/set-priority.md | 48 +++++++++++++++++ .../docs/mal2go/v4/user/manga/set-read-chapters.md | 41 +++++++++++++++ .../docs/mal2go/v4/user/manga/set-read-volumes.md | 41 +++++++++++++++ .../docs/mal2go/v4/user/manga/set-reread-count.md | 41 +++++++++++++++ .../docs/mal2go/v4/user/manga/set-reread-value.md | 51 ++++++++++++++++++ .../mal2go/v4/user/manga/set-rereading-status.md | 42 +++++++++++++++ content/docs/mal2go/v4/user/manga/set-score.md | 41 +++++++++++++++ content/docs/mal2go/v4/user/manga/set-status.md | 41 +++++++++++++++ content/docs/mal2go/v4/user/manga/setting-up.md | 34 ++++++++++++ content/docs/mal2go/v4/user/manga/types.md | 35 +++++++++++++ .../docs/mal2go/v4/user/manga/update-comments.md | 41 +++++++++++++++ content/docs/mal2go/v4/user/manga/update-manga.md | 60 ++++++++++++++++++++++ content/docs/mal2go/v4/user/manga/update-tags.md | 41 +++++++++++++++ 19 files changed, 659 insertions(+), 5 deletions(-) create mode 100644 content/docs/mal2go/v4/user/manga/delete-manga.md create mode 100644 content/docs/mal2go/v4/user/manga/get-manga-list.md create mode 100644 content/docs/mal2go/v4/user/manga/set-priority.md create mode 100644 content/docs/mal2go/v4/user/manga/set-read-chapters.md create mode 100644 content/docs/mal2go/v4/user/manga/set-read-volumes.md create mode 100644 content/docs/mal2go/v4/user/manga/set-reread-count.md create mode 100644 content/docs/mal2go/v4/user/manga/set-reread-value.md create mode 100644 content/docs/mal2go/v4/user/manga/set-rereading-status.md create mode 100644 content/docs/mal2go/v4/user/manga/set-score.md create mode 100644 content/docs/mal2go/v4/user/manga/set-status.md create mode 100644 content/docs/mal2go/v4/user/manga/setting-up.md create mode 100644 content/docs/mal2go/v4/user/manga/types.md create mode 100644 content/docs/mal2go/v4/user/manga/update-comments.md create mode 100644 content/docs/mal2go/v4/user/manga/update-manga.md create mode 100644 content/docs/mal2go/v4/user/manga/update-tags.md (limited to 'content/docs/mal2go/v4/user') diff --git a/content/docs/mal2go/v4/user/anime/set-priority.md b/content/docs/mal2go/v4/user/anime/set-priority.md index 50788f1..9c76ff3 100644 --- a/content/docs/mal2go/v4/user/anime/set-priority.md +++ b/content/docs/mal2go/v4/user/anime/set-priority.md @@ -1,7 +1,7 @@ --- title: "Set Priority" description: "Set Priority of The Anime" -weight: 9 +weight: 10 --- Use the `SetPriority` method to set the priority of the anime. diff --git a/content/docs/mal2go/v4/user/anime/set-rewatch-count.md b/content/docs/mal2go/v4/user/anime/set-rewatch-count.md index 0f11590..ffe88af 100644 --- a/content/docs/mal2go/v4/user/anime/set-rewatch-count.md +++ b/content/docs/mal2go/v4/user/anime/set-rewatch-count.md @@ -1,7 +1,7 @@ --- title: "Set Rewatch Count" description: "Set times rewatched" -weight: 10 +weight: 9 --- Use the `SetRewatchCount` method to set the number of times the user has rewatched this anime. diff --git a/content/docs/mal2go/v4/user/anime/set-status.md b/content/docs/mal2go/v4/user/anime/set-status.md index 72256e9..f4c6a84 100644 --- a/content/docs/mal2go/v4/user/anime/set-status.md +++ b/content/docs/mal2go/v4/user/anime/set-status.md @@ -1,6 +1,6 @@ --- title: "Set Anime Status" -description: "Set anime's status" +description: "Set an anime's status" weight: 4 --- diff --git a/content/docs/mal2go/v4/user/anime/setting-up.md b/content/docs/mal2go/v4/user/anime/setting-up.md index 397955e..4a3fdad 100644 --- a/content/docs/mal2go/v4/user/anime/setting-up.md +++ b/content/docs/mal2go/v4/user/anime/setting-up.md @@ -6,7 +6,7 @@ weight: 1 How to use the anime package: -1. Install the anime package using this command +1. Install the MAL2Go/user/anime package using this command ``` fish go get github.com/MikunoNaka/MAL2Go/v4/user/anime @@ -31,4 +31,4 @@ func main() { ``` Every program using MAL2Go needs something like this to initialise everything (that you need). -And now we are ready to use the MAL2Go/anime package! +And now we are ready to use the MAL2Go/user/anime package! diff --git a/content/docs/mal2go/v4/user/manga/delete-manga.md b/content/docs/mal2go/v4/user/manga/delete-manga.md new file mode 100644 index 0000000..47d737a --- /dev/null +++ b/content/docs/mal2go/v4/user/manga/delete-manga.md @@ -0,0 +1,44 @@ +--- +title: "Delete Manga" +description: "Delete a manga from the user's mangalist" +weight: 3 +--- + +Use the `DeleteManga` method to remove an entry from the user's mangalist. +This method takes these arguments: + +- `id int` ID of the manga + +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, + } + + res, err := myClient.DeleteManga(82745) + if err != nil { + log.Fatal(err) + } + + if res == "200" { + fmt.Println("Manga successfully deleted from your list") + } else { + fmt.Println("Something went wrong. Is the manga even in your list?") + } +} +``` + +The above example deletes "Demi-chan wa Kataritai" from your list + +This method returns `"200"` on a successful attempt in deleting the manga from your list. It returns `"404"` if the manga is not in your list. 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. diff --git a/content/docs/mal2go/v4/user/manga/set-priority.md b/content/docs/mal2go/v4/user/manga/set-priority.md new file mode 100644 index 0000000..7362f89 --- /dev/null +++ b/content/docs/mal2go/v4/user/manga/set-priority.md @@ -0,0 +1,48 @@ +--- +title: "Set Priority" +description: "Set Priority of The Manga" +weight: 11 +--- + +Use the `SetPriority` method to set the priority of the manga. +This method takes these arguments: + +- `id int` ID of the manga +- `priority int` Self explanatory + +The accepted values for priority are integers 1 to 2. Each meaning: + +0. Low +1. Medium +2. High + + +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, + } + + res, err := myClient.SetPriority(82745, 2) + if err != nil { + log.Fatal(err) + } + + fmt.Println("Priority has been set to", res.Priority) +} +``` + +The above example sets the priority of "Demi-chan wa Kataritai" to 2 (High). + +The [response](/docs/mal2go/v4/user/manga/types/#mal2gousermangaupdateresponse) from the API can be used to show the information of the manga after being updated. diff --git a/content/docs/mal2go/v4/user/manga/set-read-chapters.md b/content/docs/mal2go/v4/user/manga/set-read-chapters.md new file mode 100644 index 0000000..f87da43 --- /dev/null +++ b/content/docs/mal2go/v4/user/manga/set-read-chapters.md @@ -0,0 +1,41 @@ +--- +title: "Set Chapters Read" +description: "Set Number of Chapters Read" +weight: 5 +--- + +Use the `SetChaptersRead` method to set the number of chapters read. +This method takes these arguments: + +- `id int` ID of the manga +- `chaptersRead int` Self explanatory + +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, + } + + res, err := myClient.SetChaptersRead(82745, 3) + if err != nil { + log.Fatal(err) + } + + fmt.Println("Number of chapters has been set to", res.ChaptersRead) +} +``` + +The above example sets the number of chapters read of "Demi-chan wa Kataritai" to 3. + +The [response](/docs/mal2go/v4/user/manga/types/#mal2gousermangaupdateresponse) from the API can be used to show the information of the manga after being updated. diff --git a/content/docs/mal2go/v4/user/manga/set-read-volumes.md b/content/docs/mal2go/v4/user/manga/set-read-volumes.md new file mode 100644 index 0000000..1738f61 --- /dev/null +++ b/content/docs/mal2go/v4/user/manga/set-read-volumes.md @@ -0,0 +1,41 @@ +--- +title: "Set Volumes Read" +description: "Set Number of Volumes Read" +weight: 6 +--- + +Use the `SetVolumesRead` method to set the number of volumes read. +This method takes these arguments: + +- `id int` ID of the manga +- `volumesRead int` Self explanatory + +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, + } + + res, err := myClient.SetVolumesRead(82745, 3) + if err != nil { + log.Fatal(err) + } + + fmt.Println("Number of volumes has been set to", res.VolumesRead) +} +``` + +The above example sets the number of volumes read of "Demi-chan wa Kataritai" to 3. + +The [response](/docs/mal2go/v4/user/manga/types/#mal2gousermangaupdateresponse) from the API can be used to show the information of the manga after being updated. diff --git a/content/docs/mal2go/v4/user/manga/set-reread-count.md b/content/docs/mal2go/v4/user/manga/set-reread-count.md new file mode 100644 index 0000000..1e51eaf --- /dev/null +++ b/content/docs/mal2go/v4/user/manga/set-reread-count.md @@ -0,0 +1,41 @@ +--- +title: "Set Reread Count" +description: "Set times reread" +weight: 10 +--- + +Use the `SetRereadCount` method to set the number of times the user has reread this manga. +This method takes these arguments: + +- `id int` ID of the manga +- `rereadCount int` Self explanatory + +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, + } + + res, err := myClient.SetRereadCount(82745, 2) + if err != nil { + log.Fatal(err) + } + + fmt.Println("You have reread this manga", res.TimesReread, "times.") +} +``` + +The above example sets the number of times reread for "Demi-chan wa Kataritai" to 2. + +The [response](/docs/mal2go/v4/user/manga/types/#mal2gousermangaupdateresponse) from the API can be used to show the information of the manga after being updated. diff --git a/content/docs/mal2go/v4/user/manga/set-reread-value.md b/content/docs/mal2go/v4/user/manga/set-reread-value.md new file mode 100644 index 0000000..044f9a5 --- /dev/null +++ b/content/docs/mal2go/v4/user/manga/set-reread-value.md @@ -0,0 +1,51 @@ +--- +title: "Set Reread Value" +description: "Set Reread Value of The Manga" +weight: 9 +--- + +Use the `SetRereadValue` method to set the reread value. +This method takes these arguments: + +- `id int` ID of the manga +- `rereadValue int` Self explanatory + +The accepted values for rereadValue are integers 1 to 5. Each meaning: + +0. Never +1. Very Low +2. Low +3. Medium +4. High +5. Very High + + +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, + } + + res, err := myClient.SetRereadValue(82745, 3) + if err != nil { + log.Fatal(err) + } + + fmt.Println("Reread Value has been set to", res.RereadValue) +} +``` + +The above example sets the reread value of "Demi-chan wa Kataritai" to 3 (Medium). + +The [response](/docs/mal2go/v4/user/manga/types/#mal2gousermangaupdateresponse) from the API can be used to show the information of the manga after being updated. diff --git a/content/docs/mal2go/v4/user/manga/set-rereading-status.md b/content/docs/mal2go/v4/user/manga/set-rereading-status.md new file mode 100644 index 0000000..cd62050 --- /dev/null +++ b/content/docs/mal2go/v4/user/manga/set-rereading-status.md @@ -0,0 +1,42 @@ +--- +title: "Set Rereading Status" +description: "Set Rereading to true or false" +weight: 8 +--- + +Use the `SetIsRereading` method to set the rereading status. +This method takes these arguments: + +- `id int` ID of the manga +- `isRereading bool` Self explanatory + +Example: + +``` go +package main + +import ( + "github.com/MikunoNaka/MAL2Go/v4/user/manga" + "log" + "fmt" + "strconv" +) + +func main() { + authToken := "YOUR_TOKEN_HERE" + myClient := manga.Client { + AuthToken: "Bearer " + authToken, + } + + res, err := myClient.SetIsRereading(82745, true) + if err != nil { + log.Fatal(err) + } + + fmt.Println("Rereading status has been set to ", strconv.FormatBool(res.IsRereading)) +} +``` + +The above example sets the rereading status of "Demi-chan wa Kataritai" to true. + +The [response](/docs/mal2go/v4/user/manga/types/#mal2gousermangaupdateresponse) from the API can be used to show the information of the manga after being updated. diff --git a/content/docs/mal2go/v4/user/manga/set-score.md b/content/docs/mal2go/v4/user/manga/set-score.md new file mode 100644 index 0000000..94c15e3 --- /dev/null +++ b/content/docs/mal2go/v4/user/manga/set-score.md @@ -0,0 +1,41 @@ +--- +title: "Set Manga Score" +description: "Set Score of The Manga" +weight: 7 +--- + +Use the `SetScore` method to set the score. +This method takes these arguments: + +- `id int` ID of the manga +- `score int` Self explanatory + +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, + } + + res, err := myClient.SetScore(82745, 10) + if err != nil { + log.Fatal(err) + } + + fmt.Println("Score has been set to", res.Score) +} +``` + +The above example sets the score of "Demi-chan wa Kataritai" to 10. + +The [response](/docs/mal2go/v4/user/manga/types/#mal2gousermangaupdateresponse) from the API can be used to show the information of the manga after being updated. diff --git a/content/docs/mal2go/v4/user/manga/set-status.md b/content/docs/mal2go/v4/user/manga/set-status.md new file mode 100644 index 0000000..f8c1d1c --- /dev/null +++ b/content/docs/mal2go/v4/user/manga/set-status.md @@ -0,0 +1,41 @@ +--- +title: "Set Manga Status" +description: "Set a manga's status" +weight: 4 +--- + +Use the `SetStatus` method to set the status of a manga. +This method takes these arguments: + +- `id int` ID of the manga +- `status string` Status to set. Accepted values are `reading`, `completed`, `on_hold`, `dropped`, `plan_to_read` + +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, + } + + res, err := myClient.SetStatus(82745, "plan_to_read") + if err != nil { + log.Fatal(err) + } + + fmt.Println("Status has been set to", res.Status) +} +``` + +The above example adds "Demi-chan wa Kataritai" to your plan to read list. + +The [response](/docs/mal2go/v4/user/manga/types/#mal2gousermangaupdateresponse) from the API can be used to show the information of the manga after being updated. diff --git a/content/docs/mal2go/v4/user/manga/setting-up.md b/content/docs/mal2go/v4/user/manga/setting-up.md new file mode 100644 index 0000000..e5db990 --- /dev/null +++ b/content/docs/mal2go/v4/user/manga/setting-up.md @@ -0,0 +1,34 @@ +--- +title: "Setting up" +description: "Install MAL2Go/user/manga and write some boilerplate" +weight: 1 +--- + +How to use the anime package: + +1. Install the MAL2Go/user/manga package using this command + +``` fish +go get github.com/MikunoNaka/MAL2Go/v4/user/manga +``` + +2. Import and initialise the manga client. The client holds the authentication token of the user. The OAuth token should be set as "Bearer TOKEN". Refer to below example + +``` go +package main + +import ( + "github.com/MikunoNaka/MAL2Go/v4/user/manga" +) + +func main() { + // you should never hard-code tokens. This is just an example + authToken := "YOUR_TOKEN_HERE" + myClient := anime.Client { + AuthToken: "Bearer " + authToken, + } +} +``` + +Every program using MAL2Go needs something like this to initialise everything (that you need). +And now we are ready to use the MAL2Go/user/manga package! diff --git a/content/docs/mal2go/v4/user/manga/types.md b/content/docs/mal2go/v4/user/manga/types.md new file mode 100644 index 0000000..21ce7f6 --- /dev/null +++ b/content/docs/mal2go/v4/user/manga/types.md @@ -0,0 +1,35 @@ +--- +title: "Types" +description: "The structs defined in this package" +weight: 15 +--- + +## MAL2Go/user/manga/UpdateMangadata + +| Struct Field | Type | Description | +|--------------|----------|-------------------------| +| Status | `string` | Status to be set | +| IsRereading | `bool` | Rereading status | +| Score | `int` | Score of the manga | +| VolumesRead | `int` | Number of volumes read | +| ChaptersRead | `int` | Number of chapters read | +| Priority | `int` | Priority of the manga | +| TimesReread | `int` | Number of times rereads | +| RereadValue | `int` | Frequency of rereads | +| Tags | `string` | Tags for the manga | +| Comments | `string` | Comments for the manga | + +## MAL2Go/user/manga/UpdateResponse + +| Struct Field | Type | Description | +|--------------|----------|--------------------------------------| +| Status | `string` | Status of the manga | +| Score | `int` | Score of the manga | +| VolumesRead | `int` | Number of volumes read | +| ChaptersRead | `int` | Number of chapters read | +| IsRereading | `bool` | true if user is rereading this manga | +| Priority | `string` | Priority of this manga | +| TimesReread | `string` | Number of times reread | +| RereadValue | `string` | Frequency of rereads | +| Tags | `string` | Tags set for this manga | +| Comments | `string` | Comments set for this manga | diff --git a/content/docs/mal2go/v4/user/manga/update-comments.md b/content/docs/mal2go/v4/user/manga/update-comments.md new file mode 100644 index 0000000..a33fe65 --- /dev/null +++ b/content/docs/mal2go/v4/user/manga/update-comments.md @@ -0,0 +1,41 @@ +--- +title: "Update Comments" +description: "Update the Comments for this manga" +weight: 13 +--- + +Use the `UpdateComments` method to set the comments for this manga. +This method takes these arguments: + +- `id int` ID of the manga +- `comments string` Self explanatory + +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, + } + + res, err := myClient.UpdateComments(82745, "This is a comment.") + if err != nil { + log.Fatal(err) + } + + fmt.Println("Comments have been set to \"", res.Comments, "\"" ) +} +``` + +The above example sets the comments for "Demi-chan wa Kataritai" to "This is a comment.". + +The [response](/docs/mal2go/v4/user/manga/types/#mal2gousermangaupdateresponse) from the API can be used to show the information of the manga after being updated. diff --git a/content/docs/mal2go/v4/user/manga/update-manga.md b/content/docs/mal2go/v4/user/manga/update-manga.md new file mode 100644 index 0000000..abf70cb --- /dev/null +++ b/content/docs/mal2go/v4/user/manga/update-manga.md @@ -0,0 +1,60 @@ +--- +title: "Update Manga" +description: "Update every field of an manga" +weight: 14 +--- + +The `UpdateManga` method combines all the other methods used to update any of the fields of an entry in the mangalist. + +**Warning: This method will overwrite every field of the specified manga. +If you don't specify a field it'd be set back to the default option. +Use it with caution at your own risk.** + +- `id int` ID of the manga +- `updateData `[`UpdateMangaData`](/docs/mal2go/v4/user/manga/types/#mal2gousermangaupdatemangadata) +A struct containing all the fields that need to be updated. **If a field is missing it will be set to the default option.** + +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, + } + + updateData := manga.UpdateMangaData { + Status: "reading", + IsRereading: false, + Score: 10, + ChaptersRead: 20, + Priority: 2, + TimesReread: 0, + RereadValue: 0, + Tags: "", + Comments: "", + } + + res, err := myClient.UpdateManga(82745, updateData) + if err != nil { + log.Fatal(err) + } + + fmt.Println(res) +} +``` + +This is useful if you want to update many things without making too many API calls. +You can get the previously set data with the `GetMangaById` method, if a value needs to be +unchanged, just use the previously set value returned by GetMangaById. This way, +you can update multiple fields with only two API calls. + +The [response](/docs/mal2go/v4/user/manga/types/#mal2gousermangaupdateresponse) from the API can be used to show the information of the manga after being updated. diff --git a/content/docs/mal2go/v4/user/manga/update-tags.md b/content/docs/mal2go/v4/user/manga/update-tags.md new file mode 100644 index 0000000..f0d4a23 --- /dev/null +++ b/content/docs/mal2go/v4/user/manga/update-tags.md @@ -0,0 +1,41 @@ +--- +title: "Update Tags" +description: "Update tags for this manga" +weight: 12 +--- + +Use the `UpdateTags` method to set the tags for this manga. +This method takes these arguments: + +- `id int` ID of the manga +- `tags string` Self explanatory + +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, + } + + res, err := myClient.UpdateTags(82745, "tag1, tag2") + if err != nil { + log.Fatal(err) + } + + fmt.Println("Tags have been set to \"", res.Tags, "\"" ) +} +``` + +The above example sets the tags for "Demi-chan wa Kataritai" to "tag1, tag2". + +The [response](/docs/mal2go/v4/user/manga/types/#mal2gousermangaupdateresponse) from the API can be used to show the information of the manga after being updated. -- cgit v1.2.3