diff options
Diffstat (limited to 'content')
51 files changed, 0 insertions, 2149 deletions
diff --git a/content/docs/mal2go/_index.md b/content/docs/mal2go/_index.md deleted file mode 100644 index 66f369a..0000000 --- a/content/docs/mal2go/_index.md +++ /dev/null @@ -1,4 +0,0 @@ ---- -title: MAL2Go -description: MyAnimeList V2 API wrapper for Go ---- diff --git a/content/docs/mal2go/v4/_index.md b/content/docs/mal2go/v4/_index.md deleted file mode 100644 index 61cac83..0000000 --- a/content/docs/mal2go/v4/_index.md +++ /dev/null @@ -1,11 +0,0 @@ ---- -title: MAL2Go V4 -description: Version 4 of MAL2Go MyAnimeList API Wrapper ---- - -MAL2Go V4 supports almost all of the functionality provided by the MyAnimeList API. Only working with the forums is not supported. -Everything else is supposed to properly work. If there is any bug please open an issue on the [GitHub repo](https://github.com/MikunoNaka/MAL2Go) or email me at [vidhukant@vidhukant.xyz](mailto:vidhukant@vidhukant.xyz). Forums support coming soon. - -### MAL2Go is divided into multiple packages that perform various API interactions. - -**MAL2Go documentation is incomplete but has been tested and works properly with MAL2Go v4.0.1** diff --git a/content/docs/mal2go/v4/anime/_index.md b/content/docs/mal2go/v4/anime/_index.md deleted file mode 100644 index 764cb33..0000000 --- a/content/docs/mal2go/v4/anime/_index.md +++ /dev/null @@ -1,6 +0,0 @@ ---- -title: Anime -description: Everything related to anime (except animelists) -weight: 1 ---- - diff --git a/content/docs/mal2go/v4/anime/get-anime-by-id.md b/content/docs/mal2go/v4/anime/get-anime-by-id.md deleted file mode 100644 index ca310b3..0000000 --- a/content/docs/mal2go/v4/anime/get-anime-by-id.md +++ /dev/null @@ -1,42 +0,0 @@ ---- -title: "Getting an anime's information" -description: "Specify an anime's ID to get all the data about it." -weight: 3 ---- - -`GetAnimeById` takes in an anime's ID (which can be obtained using [`SearchAnime`](/docs/mal2go/v4/anime/search-for-an-anime) or through the URL of the anime's page on MAL) and returns information about it. This method takes these arguments: - -- `id int` The anime's ID -- `fields []string` The fields to include in the response. [Here](/docs/mal2go/v4/anime/types#mal2goanimeanime) is a list of the valid fields. Just using an empty slice (`[]string{}`) will include all the fields. - -Example: - -``` go -package main - -import ( - "github.com/MikunoNaka/MAL2Go/v4/anime" - "log" - "fmt" -) - -func main() { - authToken := "YOUR_TOKEN_HERE" - myClient := anime.Client { - AuthToken: "Bearer " + authToken, - } - - id := 457 - fields := []string{"title", "my_list_status", "num_episodes"} - - anime, err := myClient.GetAnimeById(id, fields) - if err != nil { - log.Fatal(err) // remember kids, always handle errors - } - - fmt.Printf("You have watched %d out of %d episodes in %s. Your list status for %s is %s.\n", anime.MyListStatus.EpWatched, anime.NumEpisodes, anime.Title, anime.Title, anime.MyListStatus.Status) -} -``` - -Above example prints something like -`"You have watched 26 out of 26 episodes in Mushishi. Your list status for Mushishi is completed."` diff --git a/content/docs/mal2go/v4/anime/get-anime-ranking.md b/content/docs/mal2go/v4/anime/get-anime-ranking.md deleted file mode 100644 index 6479b6c..0000000 --- a/content/docs/mal2go/v4/anime/get-anime-ranking.md +++ /dev/null @@ -1,57 +0,0 @@ ---- -title: "Get anime ranking list" -description: "Returns a list of animes sorted by their rank" -weight: 4 ---- - -`GetAnimeRanking` returns a list of animes sorted by their rank. It accepts these arguments: - -- `rankingType string` Ranking type can be: - + `all` - + `airing` - + `upcoming` - + `tv` - + `ova` - + `movie` - + `special` - + `bypopularity` - + `favorite` -- `limit int` Is the max amount of results to get. Max is 500. -- `offset int` Is the "offset" for results. If offset is greater than 0 the first n number of reults will be ignored. -- `nsfw bool` Wether to include NSFW rated results -- `fields []string` The fields to include in the response. [Here](/docs/mal2go/v4/anime/types#mal2goanimeanime) is a list of the valid fields. Just using an empty slice (`[]string{}`) will include all the fields. - -Example: - -``` go -package main - -import ( - "github.com/MikunoNaka/MAL2Go/v4/anime" - "log" - "fmt" -) - -func main() { - authToken := "YOUR_TOKEN_HERE" - myClient := anime.Client { - AuthToken: "Bearer " + authToken, - } - - rankingType := "movie" - limit, offset := 10, 0 - nsfw := true // include NSFW results - fields := []string{"title"} - - ranking, err := myClient.GetAnimeRanking(rankingType, limit, offset, nsfw, fields) - if err != nil { - log.Fatal(err) // remember kids, always handle errors - } - - for _, i := range ranking { - fmt.Printf("#%d: %s\n", i.RankNum, i.Title) - } -} -``` - -Above example prints the top 10 ranked anime movies on MyAnimeList. diff --git a/content/docs/mal2go/v4/anime/get-seasonal-anime.md b/content/docs/mal2go/v4/anime/get-seasonal-anime.md deleted file mode 100644 index f473a02..0000000 --- a/content/docs/mal2go/v4/anime/get-seasonal-anime.md +++ /dev/null @@ -1,61 +0,0 @@ ---- -title: "Get seasonal anime list" -description: "Specify an year and season to get animes from" -weight: 5 ---- - -`GetSeasonalAnime` returns a list of animes that released in the specified season and year. Accepted arguments are: - -- `year string` Is the max amount of search results to get. Max is 500. -- `season string` Is the "offset" for the search results. If offset is greater than 0 the first n number of search reults will be ignored. -Possible seasons: - + `winter` - + `spring` - + `summer` - + `fall` -- `sort string` Wether to include NSFW rated search results -Possible sorts: - + `anime_score` - + `anime_num_list_users` -- `limit int` Is the max amount of results to get. Max is 500. -- `offset int` Is the "offset" for results. If offset is greater than 0 the first n number of reults will be ignored. -- `nsfw bool` Wether to include NSFW rated results -- `fields []string` The fields to include in the response. [Here](/docs/mal2go/v4/anime/types#mal2goanimeanime) is a list of the valid fields. Just using an empty slice (`[]string{}`) will include all the fields. - -Example: - -``` go -package main - -import ( - "github.com/MikunoNaka/MAL2Go/v4/anime" - "log" - "fmt" -) - -func main() { - authToken := "YOUR_TOKEN_HERE" - myClient := anime.Client { - AuthToken: "Bearer " + authToken, - } - - year := "2022" - season := "spring" - sort := "anime_num_list_users" - limit, offset := 10, 0 - nsfw := true // include NSFW results - fields := []string{"title"} - - seasonalAnimes, err := myClient.GetSeasonalAnime(year, season, sort, limit, offset, nsfw, fields) - if err != nil { - log.Fatal(err) // remember kids, always handle errors - } - - fmt.Printf("Here are some popular animes from %s, %d\n", seasonalAnimes.Season.Name, seasonalAnimes.Season.Year) - for _, i := range seasonalAnimes.Animes { - fmt.Println(i.Title) - } -} -``` - -Above example prints 10 animes from spring 2022 with the most users. diff --git a/content/docs/mal2go/v4/anime/get-suggested-anime.md b/content/docs/mal2go/v4/anime/get-suggested-anime.md deleted file mode 100644 index 98dc01c..0000000 --- a/content/docs/mal2go/v4/anime/get-suggested-anime.md +++ /dev/null @@ -1,46 +0,0 @@ ---- -title: "Get suggested animes" -description: "Returns some suggestions for the user" -weight: 6 ---- - -`GetSuggestedAnime` returns a list of animes suggested to the authenticated user. - -- `limit int` Is the max amount of results to get. Max is 100. -- `offset int` Is the "offset" for results. If offset is greater than 0 the first n number of reults will be ignored. -- `nsfw bool` Wether to include NSFW rated results -- `fields []string` The fields to include in the response. [Here](/docs/mal2go/v4/anime/types#mal2goanimeanime) is a list of the valid fields. Just using an empty slice (`[]string{}`) will include all the fields. - -Example: - -``` go -package main - -import ( - "github.com/MikunoNaka/MAL2Go/v4/anime" - "log" - "fmt" -) - -func main() { - authToken := "YOUR_TOKEN_HERE" - myClient := anime.Client { - AuthToken: "Bearer " + authToken, - } - - limit, offset := 10, 0 - nsfw := true // include NSFW results - fields := []string{"title"} - - suggestedAnimes, err := myClient.GetSuggestedAnime(limit, offset, nsfw, fields) - if err != nil { - log.Fatal(err) // remember kids, always handle errors - } - - for _, i := range suggestedAnimes { - fmt.Println(i.Title) - } -} -``` - -Above example prints 10 animes suggested to the authenticated user. diff --git a/content/docs/mal2go/v4/anime/search-for-an-anime.md b/content/docs/mal2go/v4/anime/search-for-an-anime.md deleted file mode 100644 index addf43a..0000000 --- a/content/docs/mal2go/v4/anime/search-for-an-anime.md +++ /dev/null @@ -1,50 +0,0 @@ ---- -title: "Searching for an anime" -description: "Use a search string to get a list of animes" -weight: 2 ---- - -Use the `SearchAnime` method to search for an anime. This method takes these arguments: - -- `searchString string` Is pretty obvious. This term is used to search for an anime on MyAnimeList. -- `limit int` Is the max amount of search results to get. Max is 100. -- `offset int` Is the "offset" for the search results. If offset is greater than 0 the first n number of search reults will be ignored. -- `nsfw bool` Wether to include NSFW rated search results -- `fields []string` The fields to include in the response. [Here](/docs/mal2go/v4/anime/types#mal2goanimeanime) is a list of the valid fields. Just using an empty slice (`[]string{}`) will include all the fields. -The MyAnimeList API is picky about what fields to actually include with search results. To be sure that you are getting all the data it is recommended to use the [`GetAnimeById`](/docs/mal2go/v4/anime/get-anime-by-id) method which ensures that all the required fields are included. - - -Example: - -``` go -package main - -import ( - "github.com/MikunoNaka/MAL2Go/v4/anime" - "log" - "fmt" -) - -func main() { - authToken := "YOUR_TOKEN_HERE" - myClient := anime.Client { - AuthToken: "Bearer " + authToken, - } - - searchString := "mushishi" // search for mushishi - limit := 10 // get 10 search results - offset := 0 // no offset - searchNsfw := false // don't include NSFW results - fields := []string{"title"} // only pull the title - - searchResults, err := myClient.SearchAnime(searchString, limit, offset, searchNsfw, fields) - if err != nil { - log.Fatal(err) // remember kids, always handle errors - } - - // loop over the search results and print the title - for _, anime := range searchResults { - fmt.Println(anime.Title) - } -} -``` diff --git a/content/docs/mal2go/v4/anime/setting-up.md b/content/docs/mal2go/v4/anime/setting-up.md deleted file mode 100644 index 30c4339..0000000 --- a/content/docs/mal2go/v4/anime/setting-up.md +++ /dev/null @@ -1,34 +0,0 @@ ---- -title: "Setting up" -description: "Install MAL2Go/anime and write some boilerplate" -weight: 1 ---- - -How to use the anime package: - -1. Install the anime package using this command - -``` fish -go get github.com/MikunoNaka/MAL2Go/v4/anime -``` - -2. Import and initialise the anime 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/anime" -) - -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/anime package! diff --git a/content/docs/mal2go/v4/anime/types.md b/content/docs/mal2go/v4/anime/types.md deleted file mode 100644 index 176c774..0000000 --- a/content/docs/mal2go/v4/anime/types.md +++ /dev/null @@ -1,141 +0,0 @@ ---- -title: "Types" -description: "The structs defined in this package" -weight: 7 ---- - -## MAL2Go/anime.Anime - -These are the valid fields you can use while getting data using MAL2Go/anime package. - -| Search Field | Struct Field | Type | Description | -|-------------------------------|-----------------|--------------------------------------------------|--------------------------------------------------------| -| id | Id | `int` | ID of the anime | -| title | Title | `string` | Title | -| main\_picture | MainPicture | [`util.Picture`](#mal2goutilgenre) | Cover picture | -| alternative\_titles | AltTitles | [`util.AltTitles`](#mal2goutilalttitles) | Alternative titles | -| start_date | StartDate | `string` | Date started airing | -| end\_date | EndDate | `string` | Date ended airing | -| synopsis | Synopsis | `string` | Synopsis | -| mean | MeanScore | `float32` | Mean score | -| rank | Rank | `int` | Rank of the anime (0 when cannot be calculated) | -| popularity | Popularity | `int` | Popularity | -| num\_list\_users | NumListUsers | `int` | Number of List Users | -| num\_scoring\_users | NumScoringUsers | `int` | Number of Scoring List Users | -| nsfw | NsfwStatus | `string` | NSFW rating (white = SFW, black = NSFW, gray = medium) | -| created\_at | CreatedAt | `string` | Created At | -| updated\_at | UpdatedAt | `string` | Updated At | -| media\_type | MediaType | `string` | Media Type | -| status | Status | `string` | Status | -| genres | Genres | [`[]util.Genre`](#mal2goutilgenre) | List of Genres | -| my\_list\_status | MyListStatus | [`ListStatus`](#mal2goanimeliststatus) | Authenticated user's List Status | -| *none, automatically applied* | ListStatus | [`ListStatus`](#mal2goanimeliststatus) | List status (for when looking up another user's list) | -| num\_episodes | NumEpisodes | `int` | Number of Episodes | -| start\_season | StartSeason | [`Season`](#mal2goanimeseason) | Season in Which the Anime Started Airing | -| broadcast | Broadcast | [`Broadcast`](#mal2goanimebroadcast) | Broadcast Info | -| source | Source | `string` | Source Media | -| average\_episode\_duration | DurationSeconds | `int` | Average Episode Duration (seconds) | -| rating | Rating | `string` | Rating (pg\_13, etc) | -| pictures | Pictures | [`[]util.Picture`](#mal2goutilgenre) | Pictures | -| background | Background | `string` | Background Info | -| related\_anime | RelatedAnime | [`[]Related`](#mal2goanimerelated) | Related Anime | -| related\_manga | RelatedManga | `not supported yet` | Related Manga (currently not supported) | -| recommendations | Recommendations | [`[]Recommendation`](#mal2goanimerecommendation) | Recommendations | -| studios | Studios | [`[]Studio`](#mal2goanimestudio) | List of Studios | -| statistics | Statistics | [`AnimeStatistics`](#mal2goanimeanimestatistics) | Statistics | - -## MAL2Go/anime.Season - -| Struct Field | Type | Description | Potential Values | -|--------------|----------|--------------------|-------------------------------------------------| -| Year | `int` | Year | Any positive integer | -| Season | `string` | Season of the year | `"winter"` / `"spring"` / `"summer"` / `"fall"` | - -## MAL2Go/anime.AnimeStatistics - -| Struct Field | Type | Description | -|--------------|---------------|----------------------| -| NumListUsers | `int` | Number of list users | -| Status | `to be added` | List status of user | - -## MAL2Go/anime.Broadcast - -| Struct Field | Type | Description | Potential Values | -|--------------|----------|-------------------|------------------------------| -| Day | `string` | Day of the week | Day of the week or `"other"` | -| Time | `string` | Time of broadcast | String like "01:25" or `nil` | - -## MAL2Go/anime.Related - -| Struct Field | Type | Description | Potential Values | -|-----------------------|------------------------------|------------------------------------------|------------------------------------------------------------------------------------------------------------------------------------------| -| Anime | [`Anime`](#mal2goanimeanime) | Related anime | Any Anime | -| RelationType | `string` | Relation of this anime with selected one | `"sequel"`, `"prequel"`, `"alternative_setting"`, `"alternative_version"`, `"side_story"`, `"parent_story"`, `"summary"`, `"full_story"` | -| RelationTypeFormatted | `string` | RelationType with pretty formatting | Same as RelationType but with pretty formatting | - -## MAL2Go/anime.Studio - -| Struct Field | Type | Description | -|--------------|----------|-------------| -| Id | `int` | Studio ID | -| Name | `string` | Studio name | - -## MAL2Go/anime.Recommendation - -| Struct Field | Type | Description | -|--------------|------------------------------|---------------------------------------------------| -| Anime | [`Anime`](#mal2goanimeanime) | Recommendated anime for those who like this anime | -| Num | `int` | Number of recommendations (times recommended) | - -## MAL2Go/anime.ListStatus - -| Struct Field | Type | Description | Potential Values | -|----------------|----------|-----------------------------------------|------------------------------------------------------------------------------------| -| Status | `string` | Status | `"watching"`, `"completed"`, `"on_hold"`, `"dropped"`, `"plan_to_watch"`, or `nil` | -| Score | `int` | Score | 0 to 10 | -| StartDate | `string` | Start date for the user | date string or `nil` | -| FinishDate | `string` | Finish date for the user | date string or `nil` | -| Priority | `int` | Priority | | -| Tags | `string` | probably broken | | -| Comments | `string` | Comments | | -| UpdatedAt | `string` | Time last updated by the user | | -| EpWatched | `int` | Number of episodes watched | | -| IsRewatching | `bool` | If user is rewatching this anime or not | `true` or `false` | -| TimesRewatched | `int` | Times user has rewatched this | | -| RewatchValue | `int` | Frequency of rewatches | 0 to 5 (never, very low, low, medium, high, very high) | - -## MAL2Go/*util*.Picture - -Holds the cover picture/related picture's URLs in different sizes - -| Struct Field | Type | Description | Potential Values | -|--------------|----------|----------------------|----------------------------------------------| -| Medium | `string` | Medium sized picture | non empty string containing URL of picture | -| Large | `string` | Large sized picture | string containing the URL or an empty string | - -## MAL2Go/*util*.AltTitles - -| Struct Field | Type | Description | Potential Values | -|--------------|------------|-----------------------|---------------------------| -| Synonyms | `[]string` | Synonyms of the title | `[]string` or empty slice | -| En | `string` | English title | any string or `""` | -| Ja | `string` | Japanese title | any string or `""` | - -## MAL2Go/*util*.Genre - -| Struct Field | Type | Description | -|--------------|----------|-------------------| -| Id | `int` | ID of the genre | -| Name | `string` | Name of the genre | - -## MAL2Go/*util*.StatusStatistics - -**NOTE:** Due to changes with the MyAnimeList API, this might be broken in versions upto v4.1.0, this will be fixed in the next update. - -| Struct Field | Type | Description | -|--------------|----------|-------------------------------------------------| -| Watching | `string` | Number of users watching this anime | -| Completed | `string` | Number of users who have completed this anime | -| OnHold | `string` | Number of users who have put this anime on hold | -| Dropped | `string` | Number of users who have dropped this anime | -| PlanToWatch | `string` | Number of users planning to watch this anime | diff --git a/content/docs/mal2go/v4/manga/_index.md b/content/docs/mal2go/v4/manga/_index.md deleted file mode 100644 index 185d116..0000000 --- a/content/docs/mal2go/v4/manga/_index.md +++ /dev/null @@ -1,6 +0,0 @@ ---- -title: Manga -description: Everything related to manga (except mangalists) -weight: 2 ---- - diff --git a/content/docs/mal2go/v4/manga/get-manga-by-id.md b/content/docs/mal2go/v4/manga/get-manga-by-id.md deleted file mode 100644 index b138785..0000000 --- a/content/docs/mal2go/v4/manga/get-manga-by-id.md +++ /dev/null @@ -1,44 +0,0 @@ ---- -title: "Getting a manga's information" -description: "Specify a manga's ID to get all the data about it." -weight: 3 ---- - -`GetMangaById` takes in a manga's ID (which can be obtained using [`SearchManga`](/docs/mal2go/v4/manga/search-for-a-manga) or through the URL of the manga's page on MAL) and returns information about it. This method takes these arguments: - -- `id int` The manga's ID -- `fields []string` The fields to include in the response. [Here]() is a list of the valid fields. Just using an empty slice (`[]string{}`) will include all the fields. - -Example: - -``` go -package main - -import ( - "github.com/MikunoNaka/MAL2Go/v4/manga" - "log" - "fmt" -) - -func main() { - authToken := "YOUR_TOKEN_HERE" - myClient := manga.Client { - AuthToken: "Bearer " + authToken, - } - - id := 103890 - fields := []string{"title", "my_list_status", "num_chapters"} - - manga, err := myClient.GetMangaById(id, fields) - if err != nil { - log.Fatal(err) // remember kids, always handle errors - } - - fmt.Printf("You have read %d out of %d chapters in %s. Your list status for %s is %s.\n", manga.MyListStatus.ChaptersRead, manga.NumChapters, manga.Title, manga.Title, manga.MyListStatus.Status) -} -``` - -Above example prints something like -`"You have read 7 out of 187 chapters in Bokutachi wa Benkyou ga Dekinai. Your list status for Bokutachi wa Benkyou ga Dekinai is reading."` - -Above output shows blank status because mushishi is not in my list. This is expected. diff --git a/content/docs/mal2go/v4/manga/get-manga-ranking.md b/content/docs/mal2go/v4/manga/get-manga-ranking.md deleted file mode 100644 index c8f968d..0000000 --- a/content/docs/mal2go/v4/manga/get-manga-ranking.md +++ /dev/null @@ -1,57 +0,0 @@ ---- -title: "Get manga ranking list" -description: "Returns a list of mangas sorted by their rank" -weight: 4 ---- - -`GetMangaRanking` returns a list of mangas sorted by their rank. It accepts these arguments: - -- `rankingType string` Ranking type can be: - + `all` - + `manga` - + `novels` - + `oneshots` - + `doujin` - + `manhwa` - + `manhua` - + `bypopularity` - + `favorite` -- `limit int` Is the max amount of results to get. Max is 500. -- `offset int` Is the "offset" for results. If offset is greater than 0 the first n number of reults will be ignored. -- `nsfw bool` Wether to include NSFW rated results -- `fields []string` The fields to include in the results. [Here]() is a list of the valid fields. Just using an empty slice (`[]string{}`) will include all the fields. Again, to get some very specific fields, [`GetMangaById`](/docs/mal2go/v4/manga/get-manga-by-id) is the most reliable option. - -Example: - -``` go -package main - -import ( - "github.com/MikunoNaka/MAL2Go/v4/manga" - "log" - "fmt" -) - -func main() { - authToken := "YOUR_TOKEN_HERE" - myClient := manga.Client { - AuthToken: "Bearer " + authToken, - } - - rankingType := "novels" - limit, offset := 10, 0 - nsfw := true // include NSFW results - fields := []string{"title"} - - ranking, err := myClient.GetMangaRanking(rankingType, limit, offset, nsfw, fields) - if err != nil { - log.Fatal(err) // remember kids, always handle errors - } - - for _, i := range ranking { - fmt.Printf("#%d: %s\n", i.RankNum, i.Title) - } -} -``` - -Above example prints the top 10 ranked novels on MyAnimeList. diff --git a/content/docs/mal2go/v4/manga/search-for-a-manga.md b/content/docs/mal2go/v4/manga/search-for-a-manga.md deleted file mode 100644 index 3d28ef4..0000000 --- a/content/docs/mal2go/v4/manga/search-for-a-manga.md +++ /dev/null @@ -1,51 +0,0 @@ ---- -title: "Search for a manga" -description: "Use a search string to get a list of mangas" -weight: 2 ---- - -Use the `SearchManga` method to search for a manga. This method takes these arguments: - -- `searchString string` Is pretty obvious. This term is used to search for a manga on MyAnimeList. -- `limit int` Is the max amount of search results to get. Max is 100. -- `offset int` Is the "offset" for the search results. If offset is greater than 0 the first n number of search reults will be ignored. -- `nsfw bool` Wether to include NSFW rated search results -- `fields []string` The fields to include in the search results. [Here]() is a list of the valid fields. Just using an empty slice (`[]string{}`) will include all the fields. -The MyAnimeList API is picky about what fields to actually include with search results. To be sure that you are getting all the data it is recommended to use the [`GetMangaById`](/docs/mal2go/v4/manga/get-manga-by-id/) method which ensures that all the required fields are included. - - -Example: - -``` go -package main - -import ( - "github.com/MikunoNaka/MAL2Go/v4/manga" - "log" - "fmt" -) - -func main() { - authToken := "YOUR_TOKEN_HERE" - myClient := manga.Client { - AuthToken: "Bearer " + authToken, - } - - searchString := "mushishi" // search for mushishi - limit := 10 // get 10 search results - offset := 0 // no offset - searchNsfw := false // don't include NSFW results - fields := []string{"title"} // only pull the title - - searchResults, err := myClient.SearchManga(searchString, limit, offset, searchNsfw, fields) - if err != nil { - log.Fatal(err) // remember kids, always handle errors - } - - // loop over the search results and print the title - for _, manga := range searchResults { - fmt.Println(manga.Title) - } -} -``` - diff --git a/content/docs/mal2go/v4/manga/setting-up.md b/content/docs/mal2go/v4/manga/setting-up.md deleted file mode 100644 index baa77cb..0000000 --- a/content/docs/mal2go/v4/manga/setting-up.md +++ /dev/null @@ -1,34 +0,0 @@ ---- -title: "Setting up" -description: "Install MAL2Go/manga and write some boilerplate" -weight: 1 ---- - -How to use the manga package: - -1. Install the manga package using this command - -``` fish -go get github.com/MikunoNaka/MAL2Go/v4/manga -``` - -2. Import and initialise the anime 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/manga" -) - -func main() { - // you should never hard-code tokens. This is just an example - authToken := "YOUR_TOKEN_HERE" - myClient := manga.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/manga package! diff --git a/content/docs/mal2go/v4/manga/types.md b/content/docs/mal2go/v4/manga/types.md deleted file mode 100644 index 6d3e297..0000000 --- a/content/docs/mal2go/v4/manga/types.md +++ /dev/null @@ -1,108 +0,0 @@ ---- -title: "Types" -description: "The structs defined in this package" -weight: 5 ---- - -## MAL2Go/manga.Manga - -These are the valid fields you can use while getting data using MAL2Go/manga package. **(INCOMPLETE)** - -| Search Field | Struct Field | Type | Description | -|-------------------------------|-----------------|--------------------------------------------------|--------------------------------------------------------| -| id | Id | `int` | ID of the manga | -| title | Title | `string` | Title | -| main\_picture | MainPicture | [`util.Picture`](#mal2goutilgenre) | Cover picture | -| alternative\_titles | AltTitles | [`util.AltTitles`](#mal2goutilalttitles) | Alternative titles | -| start_date | StartDate | `string` | Date started publishing | -| end\_date | EndDate | `string` | Date ended publishing | -| synopsis | Synopsis | `string` | Synopsis | -| mean | MeanScore | `float32` | Mean score | -| rank | Rank | `int` | Rank of the manga (0 when cannot be calculated) | -| popularity | Popularity | `int` | Popularity | -| num\_list\_users | NumListUsers | `int` | Number of List Users | -| num\_scoring\_users | NumScoringUsers | `int` | Number of Scoring List Users | -| nsfw | NsfwStatus | `string` | NSFW rating (white = SFW, black = NSFW, gray = medium) | -| created\_at | CreatedAt | `string` | Created At | -| updated\_at | UpdatedAt | `string` | Updated At | -| media\_type | MediaType | `string` | Media Type | -| status | Status | `string` | Status | -| genres | Genres | [`[]util.Genre`](#mal2goutilgenre) | List of Genres | -| my\_list\_status | MyListStatus | [`ListStatus`](#mal2gomangaliststatus) | Authenticated user's list status | -| *none, automatically applied* | ListStatus | [`ListStatus`](#mal2gomangaliststatus) | List status (for when looking up another user's list) | -| num\_volumes | NumVolumes | `int` | | -| num\_chapters | NumChapters | `int` | | -| authors | Authors | [`[]MangaAuthor`](#mal2gomangamangaauthor) | | -| pictures | Pictures | [`[]util.Picture`](#mal2goutilgenre) | Pictures | -| background | Background | `string` | Background Info | -| related\_anime| RelatedAnime | [`[]anime.Related`](/docs/mal2go/v4/anime/types#mal2goanimerelated) | Related Anime| -| related\_manga | RelatedManga | [`[]Related`](#mal2gomangarelated) | Related Manga (currently not supported) | -| recommendations | Recommendations | [`[]Recommendation`](#mal2goanimerecommendation) | Recommendations | -| serialization | Serialization | | | - -## MAL2Go/manga.ListStatus - -| Struct Field | Type | Description | Potential Values | -|--------------|----------|----------------------------------------|------------------------------------------------------------------------------------| -| Status | `string` | Status | `"watching"`, `"completed"`, `"on_hold"`, `"dropped"`, `"plan_to_watch"`, or `nil` | -| Score | `int` | Score | 0 to 10 | -| StartDate | `string` | Start date for the user | date string or `nil` | -| FinishDate | `string` | Finish date for the user | date string or `nil` | -| Priority | `int` | Priority | | -| Tags | `string` | probably broken | | -| Comments | `string` | Comments | | -| UpdatedAt | `string` | Time last updated by the user | | -| VolumesRead | `int` | Number of volumes read | | -| ChaptersRead | `int` | Number of chapters read | | -| IsRereading | `bool` | If user is rereading this manga or not | `true` or `false` | -| TimesReread | `int` | Times user has reread this | | -| RereadValue | `int` | Frequency of rereads | 0 to 5 (never, very low, low, medium, high, very high) | - -## MAL2Go/manga.Author - -| Struct Field | Type | Description | -|--------------|----------|---------------------| -| Id | `int` | Author ID | -| FirstName | `string` | Author's first name | -| LastName | `string` | Author's last name | - -## MAL2Go/manga.MangaAuthor - -| Struct Field | Type | Description | -|--------------|----------|----------------------------------| -| Id | `int` | Author ID | -| FirstName | `string` | Author's first name | -| LastName | `string` | Author's last name | -| Role | `string` | Role of the author in the series | - -## MAL2Go/manga.Related - -| Struct Field | Type | Description | Potential Values | -|-----------------------|------------------------------|------------------------------------------|------------------------------------------------------------------------------------------------------------------------------------------| -| Manga | [`Manga`](#mal2gomangamanga) | Related manga | Any Anime | -| RelationType | `string` | Relation of this manga with selected one | `"sequel"`, `"prequel"`, `"alternative_setting"`, `"alternative_version"`, `"side_story"`, `"parent_story"`, `"summary"`, `"full_story"` | -| RelationTypeFormatted | `string` | RelationType with pretty formatting | Same as RelationType but with pretty formatting | - -## MAL2Go/*util*.Picture - -Holds the cover picture/related picture's URLs in different sizes - -| Struct Field | Type | Description | Potential Values | -|--------------|----------|----------------------|----------------------------------------------| -| Medium | `string` | Medium sized picture | non empty string containing URL of picture | -| Large | `string` | Large sized picture | string containing the URL or an empty string | - -## MAL2Go/*util*.AltTitles - -| Struct Field | Type | Description | Potential Values | -|--------------|------------|-----------------------|---------------------------| -| Synonyms | `[]string` | Synonyms of the title | `[]string` or empty slice | -| En | `string` | English title | any string or `""` | -| Ja | `string` | Japanese title | any string or `""` | - -## MAL2Go/*util*.Genre - -| Struct Field | Type | Description | -|--------------|----------|-------------------| -| Id | `int` | ID of the genre | -| Name | `string` | Name of the genre | diff --git a/content/docs/mal2go/v4/tips-and-tricks/_index.md b/content/docs/mal2go/v4/tips-and-tricks/_index.md deleted file mode 100644 index b172763..0000000 --- a/content/docs/mal2go/v4/tips-and-tricks/_index.md +++ /dev/null @@ -1,28 +0,0 @@ ---- -title: "Tips and Tricks" -description: "Some tips and best practises for using MAL2Go (optional)" -weight: 4 ---- - -These are some tips and best practises, and other notes for using MAL2Go. Following this is optional but might make your life easier! - -## Better ways to store/read auth tokens: - -- Use [godotenv](https://github.com/joho/godotenv) to read the auth token from a config file -- [Viper](https://github.com/spf13/viper) can do the same thing, but can also write to the file easily; also with viper you can locate the file anywhere on your system -- [go-keyring](https://github.com/zalando/go-keyring) can be used to read/write the secret token to the system's keyring. It is by far the most secure way but only works on some systems (windows, macos and linux with gnome-keyring) - -## SearchManga and SearchAnime functions are quirky! - -While you *can* specify fields to these functions, in order to get specific data, searching for some reason only returns limited fields most of the times. -It's not like it just doesn't support all of the fields but many times it just.. doesn't. So if you want to search *and* get ALL fields about an anime, or just -be sure that the data is complete, use [`SearchAnime`](/docs/mal2go/v4/anime/search-for-an-anime/)/[`SearchManga`](/docs/mal2go/v4/manga/search-for-a-manga/) -just to get the ID. After that, use [`GetAnimeById`](/docs/mal2go/v4/anime/get-anime-by-id/)/[`GetMangaById`](/docs/mal2go/v4/manga/get-manga-by-id/). - -## macli has a good example on how to generate your own tokens with go - -MAL2Go was made for my other project, [macli](https://github.com/MikunoNaka/macli). -Macli's `auth` package uses [`github.com/zalando/go-keyring`](https://github.com/zalando/go-keyring) -and the `net/http` package to prompt the user and generate an auth token with the given client id. - -You can look at [the code](https://github.com/MikunoNaka/macli/tree/master/auth) to see how it works. diff --git a/content/docs/mal2go/v4/user/_index.md b/content/docs/mal2go/v4/user/_index.md deleted file mode 100644 index 02c62bc..0000000 --- a/content/docs/mal2go/v4/user/_index.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -title: User -description: Actions related to a user's account/lists -weight: 3 ---- diff --git a/content/docs/mal2go/v4/user/anime/_index.md b/content/docs/mal2go/v4/user/anime/_index.md deleted file mode 100644 index 4e48940..0000000 --- a/content/docs/mal2go/v4/user/anime/_index.md +++ /dev/null @@ -1,7 +0,0 @@ ---- -title: User's Animelist -description: Actions related to a user's animelist -weight: 3 ---- - -The `MAL2Go/user/anime` package supports updating the currently authenticated user's anime list along with reading the anime lists of the current user as well as other users. diff --git a/content/docs/mal2go/v4/user/anime/delete-anime.md b/content/docs/mal2go/v4/user/anime/delete-anime.md deleted file mode 100644 index b3476cb..0000000 --- a/content/docs/mal2go/v4/user/anime/delete-anime.md +++ /dev/null @@ -1,44 +0,0 @@ ---- -title: "Delete Anime" -description: "Delete an anime from the user's animelist" -weight: 3 ---- - -Use the `DeleteAnime` method to remove an entry from the user's animelist. -This method takes these arguments: - -- `id int` ID of the anime - -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, - } - - res, err := myClient.DeleteAnime(50172) - if err != nil { - log.Fatal(err) - } - - if res == "200" { - fmt.Println("Anime successfully deleted from your list") - } else { - fmt.Println("Something went wrong. Is the anime even in your list?") - } -} -``` - -The above example deletes "Summertime Render" from your list - -This method returns `"200"` on a successful attempt in deleting the anime from your list. It returns `"404"` if the anime is not in your list. diff --git a/content/docs/mal2go/v4/user/anime/get-anime-list.md b/content/docs/mal2go/v4/user/anime/get-anime-list.md deleted file mode 100644 index 22f6f4a..0000000 --- a/content/docs/mal2go/v4/user/anime/get-anime-list.md +++ /dev/null @@ -1,53 +0,0 @@ ---- -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. diff --git a/content/docs/mal2go/v4/user/anime/set-priority.md b/content/docs/mal2go/v4/user/anime/set-priority.md deleted file mode 100644 index 9c76ff3..0000000 --- a/content/docs/mal2go/v4/user/anime/set-priority.md +++ /dev/null @@ -1,48 +0,0 @@ ---- -title: "Set Priority" -description: "Set Priority of The Anime" -weight: 10 ---- - -Use the `SetPriority` method to set the priority of the anime. -This method takes these arguments: - -- `id int` ID of the anime -- `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/anime" - "log" - "fmt" -) - -func main() { - authToken := "YOUR_TOKEN_HERE" - myClient := anime.Client { - AuthToken: "Bearer " + authToken, - } - - res, err := myClient.SetPriority(47194, 2) - if err != nil { - log.Fatal(err) - } - - fmt.Println("Priority has been set to", res.Priority) -} -``` - -The above example sets the priority of "Summertime Render" to 2 (High). - -The [response](/docs/mal2go/v4/user/anime/types/#mal2gouseranimeupdateresponse) from the API can be used to show the information of the anime after being updated. diff --git a/content/docs/mal2go/v4/user/anime/set-rewatch-count.md b/content/docs/mal2go/v4/user/anime/set-rewatch-count.md deleted file mode 100644 index ffe88af..0000000 --- a/content/docs/mal2go/v4/user/anime/set-rewatch-count.md +++ /dev/null @@ -1,41 +0,0 @@ ---- -title: "Set Rewatch Count" -description: "Set times rewatched" -weight: 9 ---- - -Use the `SetRewatchCount` method to set the number of times the user has rewatched this anime. -This method takes these arguments: - -- `id int` ID of the anime -- `rewatchCount int` Self explanatory - -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, - } - - res, err := myClient.SetRewatchCount(47194, 2) - if err != nil { - log.Fatal(err) - } - - fmt.Println("You have rewatched this anime", res.TimesRewatched, "times.") -} -``` - -The above example sets the number of times rewatched for "Summertime Render" to 2. - -The [response](/docs/mal2go/v4/user/anime/types/#mal2gouseranimeupdateresponse) from the API can be used to show the information of the anime after being updated. diff --git a/content/docs/mal2go/v4/user/anime/set-rewatch-value.md b/content/docs/mal2go/v4/user/anime/set-rewatch-value.md deleted file mode 100644 index 10e0b76..0000000 --- a/content/docs/mal2go/v4/user/anime/set-rewatch-value.md +++ /dev/null @@ -1,51 +0,0 @@ ---- -title: "Set Rewatch Value" -description: "Set Rewatch Value of The Anime" -weight: 8 ---- - -Use the `SetRewatchValue` method to set the rewatch value. -This method takes these arguments: - -- `id int` ID of the anime -- `rewatchValue int` Self explanatory - -The accepted values for rewatchValue 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/anime" - "log" - "fmt" -) - -func main() { - authToken := "YOUR_TOKEN_HERE" - myClient := anime.Client { - AuthToken: "Bearer " + authToken, - } - - res, err := myClient.SetRewatchValue(47194, 3) - if err != nil { - log.Fatal(err) - } - - fmt.Println("Rewatch Value has been set to", res.RewatchValue) -} -``` - -The above example sets the rewatch value of "Summertime Render" to 3 (Medium). - -The [response](/docs/mal2go/v4/user/anime/types/#mal2gouseranimeupdateresponse) from the API can be used to show the information of the anime after being updated. diff --git a/content/docs/mal2go/v4/user/anime/set-rewatching-status.md b/content/docs/mal2go/v4/user/anime/set-rewatching-status.md deleted file mode 100644 index 3c4a767..0000000 --- a/content/docs/mal2go/v4/user/anime/set-rewatching-status.md +++ /dev/null @@ -1,42 +0,0 @@ ---- -title: "Set Rewatching Status" -description: "Set Rewatching to true or false" -weight: 7 ---- - -Use the `SetIsRewatching` method to set the rewatching status. -This method takes these arguments: - -- `id int` ID of the anime -- `isRewatching bool` Self explanatory - -Example: - -``` go -package main - -import ( - "github.com/MikunoNaka/MAL2Go/v4/user/anime" - "log" - "fmt" - "strconv" -) - -func main() { - authToken := "YOUR_TOKEN_HERE" - myClient := anime.Client { - AuthToken: "Bearer " + authToken, - } - - res, err := myClient.SetIsRewatching(47194, true) - if err != nil { - log.Fatal(err) - } - - fmt.Println("Rewatching status has been set to ", strconv.FormatBool(res.IsRewatching)) -} -``` - -The above example sets the rewatching status of "Summertime Render" to true. - -The [response](/docs/mal2go/v4/user/anime/types/#mal2gouseranimeupdateresponse) from the API can be used to show the information of the anime after being updated. diff --git a/content/docs/mal2go/v4/user/anime/set-score.md b/content/docs/mal2go/v4/user/anime/set-score.md deleted file mode 100644 index 1268f9c..0000000 --- a/content/docs/mal2go/v4/user/anime/set-score.md +++ /dev/null @@ -1,41 +0,0 @@ ---- -title: "Set Anime Score" -description: "Set Score of The Anime" -weight: 6 ---- - -Use the `SetScore` method to set the score. -This method takes these arguments: - -- `id int` ID of the anime -- `score int` Self explanatory - -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, - } - - res, err := myClient.SetScore(47194, 10) - if err != nil { - log.Fatal(err) - } - - fmt.Println("Score has been set to", res.Score) -} -``` - -The above example sets the score of "Summertime Render" to 10. - -The [response](/docs/mal2go/v4/user/anime/types/#mal2gouseranimeupdateresponse) from the API can be used to show the information of the anime after being updated. diff --git a/content/docs/mal2go/v4/user/anime/set-status.md b/content/docs/mal2go/v4/user/anime/set-status.md deleted file mode 100644 index f4c6a84..0000000 --- a/content/docs/mal2go/v4/user/anime/set-status.md +++ /dev/null @@ -1,41 +0,0 @@ ---- -title: "Set Anime Status" -description: "Set an anime's status" -weight: 4 ---- - -Use the `SetStatus` method to set the status of an anime. -This method takes these arguments: - -- `id int` ID of the anime -- `status string` Status to set. Accepted values are `watching`, `completed`, `on_hold`, `dropped`, `plan_to_watch` - -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, - } - - res, err := myClient.SetStatus(47194, "plan_to_watch") - if err != nil { - log.Fatal(err) - } - - fmt.Println("Status has been set to", res.Status) -} -``` - -The above example adds "Summertime Render" to your plan to watch list. - -The [response](/docs/mal2go/v4/user/anime/types/#mal2gouseranimeupdateresponse) from the API can be used to show the information of the anime after being updated. diff --git a/content/docs/mal2go/v4/user/anime/set-watched-episodes.md b/content/docs/mal2go/v4/user/anime/set-watched-episodes.md deleted file mode 100644 index b2ced63..0000000 --- a/content/docs/mal2go/v4/user/anime/set-watched-episodes.md +++ /dev/null @@ -1,41 +0,0 @@ ---- -title: "Set Watched Episodes" -description: "Set Number of Episodes Watched" -weight: 5 ---- - -Use the `SetWatchedEpisodes` method to set the number of episodes watched. -This method takes these arguments: - -- `id int` ID of the anime -- `episodesWatched int` Self explanatory - -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, - } - - res, err := myClient.SetWatchedEpisodes(47194, 3) - if err != nil { - log.Fatal(err) - } - - fmt.Println("Number of episodes has been set to", res.EpWatched) -} -``` - -The above example sets the episodes watched of "Summertime Render" to 3. - -The [response](/docs/mal2go/v4/user/anime/types/#mal2gouseranimeupdateresponse) from the API can be used to show the information of the anime after being updated. diff --git a/content/docs/mal2go/v4/user/anime/setting-up.md b/content/docs/mal2go/v4/user/anime/setting-up.md deleted file mode 100644 index 4a3fdad..0000000 --- a/content/docs/mal2go/v4/user/anime/setting-up.md +++ /dev/null @@ -1,34 +0,0 @@ ---- -title: "Setting up" -description: "Install MAL2Go/user/anime and write some boilerplate" -weight: 1 ---- - -How to use the anime package: - -1. Install the MAL2Go/user/anime package using this command - -``` fish -go get github.com/MikunoNaka/MAL2Go/v4/user/anime -``` - -2. Import and initialise the anime 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/anime" -) - -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/anime package! diff --git a/content/docs/mal2go/v4/user/anime/types.md b/content/docs/mal2go/v4/user/anime/types.md deleted file mode 100644 index e9383da..0000000 --- a/content/docs/mal2go/v4/user/anime/types.md +++ /dev/null @@ -1,36 +0,0 @@ ---- -title: "Types" -description: "The structs defined in this package" -weight: 14 ---- - -## MAL2Go/user/anime/UpdateAnimedata - -| Struct Field | Type | Description | -|----------------|----------|----------------------------| -| Status | `string` | Status to be set | -| IsRewatching | `bool` | Rewatching status | -| Score | `int` | Score of the anime | -| EpWatched | `int` | Number of episodes watched | -| Priority | `int` | Priority of the anime | -| TimesRewatched | `int` | Number of times rewatched | -| RewatchValue | `int` | Frequency of rewatches | -| Tags | `string` | Tags for the anime | -| Comments | `string` | Comments for the anime | - -## MAL2Go/user/anime/UpdateResponse - -| Struct Field | Type | Description | -|----------------|----------|----------------------------------------------------| -| Status | `string` | Status of the anime | -| Score | `int` | Score of the anime | -| EpWatched | `int` | Number of episodes watched | -| IsRewatching | `bool` | true if user is rewatching this anime | -| StartDate | `string` | Date user started watching this | -| FinishDate | `string` | Date user finished watching this | -| Priority | `string` | Priority of this anime | -| TimesRewatched | `string` | Number of times rewatched | -| RewatchValue | `string` | Frequency of rewatches | -| Tags | `string` | Tags set for this anime | -| Comments | `string` | Comments set for this anime | -| UpdatedAt | `string` | Time stamp of the last time this entry was updated | diff --git a/content/docs/mal2go/v4/user/anime/update-anime.md b/content/docs/mal2go/v4/user/anime/update-anime.md deleted file mode 100644 index b2cfbce..0000000 --- a/content/docs/mal2go/v4/user/anime/update-anime.md +++ /dev/null @@ -1,60 +0,0 @@ ---- -title: "Update Anime" -description: "Update every field of an anime" -weight: 13 ---- - -The `UpdateAnime` method combines all the other methods used to update any of the fields of an entry in the animelist. - -**Warning: This method will overwrite every field of the specified anime. -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 anime -- `updateData `[`UpdateAnimeData`](/docs/mal2go/v4/user/anime/types/#mal2gouseranimeupdateanimedata) -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/anime" - "log" - "fmt" -) - -func main() { - authToken := "YOUR_TOKEN_HERE" - myClient := anime.Client { - AuthToken: "Bearer " + authToken, - } - - updateData := anime.UpdateAnimeData { - Status: "watching", - IsRewatching: false, - Score: 10, - EpWatched: 20, - Priority: 2, - TimesRewatched: 0, - RewatchValue: 0, - Tags: "", - Comments: "", - } - - res, err := myClient.UpdateAnime(47194, 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 `GetAnimeById` method, if a value needs to be -unchanged, just use the previously set value returned by GetAnimeById. This way, -you can update multiple fields with only two API calls. - -The [response](/docs/mal2go/v4/user/anime/types/#mal2gouseranimeupdateresponse) from the API can be used to show the information of the anime after being updated. diff --git a/content/docs/mal2go/v4/user/anime/update-comments.md b/content/docs/mal2go/v4/user/anime/update-comments.md deleted file mode 100644 index 18d1775..0000000 --- a/content/docs/mal2go/v4/user/anime/update-comments.md +++ /dev/null @@ -1,41 +0,0 @@ ---- -title: "Update Comments" -description: "Update the Comments for this anime" -weight: 12 ---- - -Use the `UpdateComments` method to set the comments for this anime. -This method takes these arguments: - -- `id int` ID of the anime -- `comments string` Self explanatory - -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, - } - - res, err := myClient.UpdateComments(47194, "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 "Summertime Render" to "This is a comment.". - -The [response](/docs/mal2go/v4/user/anime/types/#mal2gouseranimeupdateresponse) from the API can be used to show the information of the anime after being updated. diff --git a/content/docs/mal2go/v4/user/anime/update-tags.md b/content/docs/mal2go/v4/user/anime/update-tags.md deleted file mode 100644 index 8792151..0000000 --- a/content/docs/mal2go/v4/user/anime/update-tags.md +++ /dev/null @@ -1,41 +0,0 @@ ---- -title: "Update Tags" -description: "Update tags for this anime" -weight: 11 ---- - -Use the `UpdateTags` method to set the tags for this anime. -This method takes these arguments: - -- `id int` ID of the anime -- `tags string` Self explanatory - -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, - } - - res, err := myClient.UpdateTags(47194, "tag1, tag2") - if err != nil { - log.Fatal(err) - } - - fmt.Println("Tags have been set to \"", res.Tags, "\"" ) -} -``` - -The above example sets the tags for "Summertime Render" to "tag1, tag2". - -The [response](/docs/mal2go/v4/user/anime/types/#mal2gouseranimeupdateresponse) from the API can be used to show the information of the anime after being updated. diff --git a/content/docs/mal2go/v4/user/get-self-user-info/_index.md b/content/docs/mal2go/v4/user/get-self-user-info/_index.md deleted file mode 100644 index 31b943c..0000000 --- a/content/docs/mal2go/v4/user/get-self-user-info/_index.md +++ /dev/null @@ -1,48 +0,0 @@ ---- -title: Getting authenticated user's info -description: Returns information about currenlty logged in user -weight: 2 ---- - -## Getting self user's info - -The `GetSelfUserInfo` function can be used to get information about the currently logged in user. - -``` go -package main - -import ( - "fmt" - "log" - "github.com/MikunoNaka/MAL2Go/v4/user" -) - -func main() { - authToken := "YOUR_TOKEN_HERE" - myClient := user.Client { - AuthToken: "Bearer " + authToken, - } - - userInfo, err := myClient.GetSelfUserInfo() - if err != nil { - log.Fatal(err) - } - - fmt.Printf("Username: %s\n", userInfo.Name) - fmt.Printf("Profile Picture: %s\n", userInfo.Picture) - fmt.Printf("Gender: %s\n", userInfo.Gender) - fmt.Printf("Location: %s\n", userInfo.Location) - fmt.Printf("Birthday: %s\n", userInfo.Birthday) - fmt.Printf("Time Zone: %s\n", userInfo.TimeZone) - fmt.Printf("Joined At: %s\n", userInfo.JoinedAt) - fmt.Printf("User ID: %d\n", userInfo.Id) - - if userInfo.IsSupporter { - fmt.Println("You are a MyAnimeList Supporter.") - } else { - fmt.Println("You are not a MyAnimeList Supporter.") - } -} -``` - -**MyAnimeList's Official API only allows getting info about the currently logged in user.** diff --git a/content/docs/mal2go/v4/user/manga/_index.md b/content/docs/mal2go/v4/user/manga/_index.md deleted file mode 100644 index c2060d8..0000000 --- a/content/docs/mal2go/v4/user/manga/_index.md +++ /dev/null @@ -1,7 +0,0 @@ ---- -title: User's Mangalist -description: Actions related to a user's mangalist -weight: 4 ---- - -The `MAL2Go/user/manga` package supports updating the currently authenticated user's manga list along with reading the manga lists of the current user as well as other users. diff --git a/content/docs/mal2go/v4/user/manga/delete-manga.md b/content/docs/mal2go/v4/user/manga/delete-manga.md deleted file mode 100644 index 47d737a..0000000 --- a/content/docs/mal2go/v4/user/manga/delete-manga.md +++ /dev/null @@ -1,44 +0,0 @@ ---- -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 deleted file mode 100644 index 004e764..0000000 --- a/content/docs/mal2go/v4/user/manga/get-manga-list.md +++ /dev/null @@ -1,53 +0,0 @@ ---- -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 deleted file mode 100644 index 7362f89..0000000 --- a/content/docs/mal2go/v4/user/manga/set-priority.md +++ /dev/null @@ -1,48 +0,0 @@ ---- -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 deleted file mode 100644 index f87da43..0000000 --- a/content/docs/mal2go/v4/user/manga/set-read-chapters.md +++ /dev/null @@ -1,41 +0,0 @@ ---- -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 deleted file mode 100644 index 1738f61..0000000 --- a/content/docs/mal2go/v4/user/manga/set-read-volumes.md +++ /dev/null @@ -1,41 +0,0 @@ ---- -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 deleted file mode 100644 index 1e51eaf..0000000 --- a/content/docs/mal2go/v4/user/manga/set-reread-count.md +++ /dev/null @@ -1,41 +0,0 @@ ---- -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 deleted file mode 100644 index 044f9a5..0000000 --- a/content/docs/mal2go/v4/user/manga/set-reread-value.md +++ /dev/null @@ -1,51 +0,0 @@ ---- -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 deleted file mode 100644 index cd62050..0000000 --- a/content/docs/mal2go/v4/user/manga/set-rereading-status.md +++ /dev/null @@ -1,42 +0,0 @@ ---- -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 deleted file mode 100644 index 94c15e3..0000000 --- a/content/docs/mal2go/v4/user/manga/set-score.md +++ /dev/null @@ -1,41 +0,0 @@ ---- -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 deleted file mode 100644 index f8c1d1c..0000000 --- a/content/docs/mal2go/v4/user/manga/set-status.md +++ /dev/null @@ -1,41 +0,0 @@ ---- -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 deleted file mode 100644 index e5db990..0000000 --- a/content/docs/mal2go/v4/user/manga/setting-up.md +++ /dev/null @@ -1,34 +0,0 @@ ---- -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 deleted file mode 100644 index 21ce7f6..0000000 --- a/content/docs/mal2go/v4/user/manga/types.md +++ /dev/null @@ -1,35 +0,0 @@ ---- -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 deleted file mode 100644 index a33fe65..0000000 --- a/content/docs/mal2go/v4/user/manga/update-comments.md +++ /dev/null @@ -1,41 +0,0 @@ ---- -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 deleted file mode 100644 index abf70cb..0000000 --- a/content/docs/mal2go/v4/user/manga/update-manga.md +++ /dev/null @@ -1,60 +0,0 @@ ---- -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 deleted file mode 100644 index f0d4a23..0000000 --- a/content/docs/mal2go/v4/user/manga/update-tags.md +++ /dev/null @@ -1,41 +0,0 @@ ---- -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. diff --git a/content/docs/mal2go/v4/user/setting-up/_index.md b/content/docs/mal2go/v4/user/setting-up/_index.md deleted file mode 100644 index 0b2b890..0000000 --- a/content/docs/mal2go/v4/user/setting-up/_index.md +++ /dev/null @@ -1,34 +0,0 @@ ---- -title: "Setting up" -description: "Install MAL2Go/user and write some boilerplate" -weight: 1 ---- - -How to use the user package: - -1. Install the user package using this command - -``` fish -go get github.com/MikunoNaka/MAL2Go/v4/user -``` - -2. Import and initialise the user 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" -) - -func main() { - // you should never hard-code tokens. This is just an example - authToken := "YOUR_TOKEN_HERE" - myClient := user.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/anime package! |