aboutsummaryrefslogtreecommitdiff
path: root/content/docs/mal2go/v4/manga
diff options
context:
space:
mode:
Diffstat (limited to 'content/docs/mal2go/v4/manga')
-rw-r--r--content/docs/mal2go/v4/manga/_index.md6
-rw-r--r--content/docs/mal2go/v4/manga/get-manga-by-id.md44
-rw-r--r--content/docs/mal2go/v4/manga/get-manga-ranking.md57
-rw-r--r--content/docs/mal2go/v4/manga/search-for-a-manga.md51
-rw-r--r--content/docs/mal2go/v4/manga/setting-up.md34
-rw-r--r--content/docs/mal2go/v4/manga/types.md108
6 files changed, 300 insertions, 0 deletions
diff --git a/content/docs/mal2go/v4/manga/_index.md b/content/docs/mal2go/v4/manga/_index.md
new file mode 100644
index 0000000..185d116
--- /dev/null
+++ b/content/docs/mal2go/v4/manga/_index.md
@@ -0,0 +1,6 @@
+---
+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
new file mode 100644
index 0000000..682ef29
--- /dev/null
+++ b/content/docs/mal2go/v4/manga/get-manga-by-id.md
@@ -0,0 +1,44 @@
+---
+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`](#searching-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
new file mode 100644
index 0000000..ef5435f
--- /dev/null
+++ b/content/docs/mal2go/v4/manga/get-manga-ranking.md
@@ -0,0 +1,57 @@
+---
+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`](#get-data-about-a-manga) 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
new file mode 100644
index 0000000..5d519aa
--- /dev/null
+++ b/content/docs/mal2go/v4/manga/search-for-a-manga.md
@@ -0,0 +1,51 @@
+---
+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`](#get-data-about-a-manga) 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
new file mode 100644
index 0000000..baa77cb
--- /dev/null
+++ b/content/docs/mal2go/v4/manga/setting-up.md
@@ -0,0 +1,34 @@
+---
+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
new file mode 100644
index 0000000..6d3e297
--- /dev/null
+++ b/content/docs/mal2go/v4/manga/types.md
@@ -0,0 +1,108 @@
+---
+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 |