From 16fe9cfdf6fe755e5effc6915fcaeecb9b0f15d0 Mon Sep 17 00:00:00 2001 From: md-y Date: Wed, 15 Sep 2021 22:14:29 -0600 Subject: [PATCH] Rewrite readme --- README.md | 2347 +++-------------------------------------------------- 1 file changed, 134 insertions(+), 2213 deletions(-) diff --git a/README.md b/README.md index 8b8aeef..06eeaa5 100644 --- a/README.md +++ b/README.md @@ -1,2213 +1,134 @@ -# MangaDex Full API -An unofficial [MangaDex](https://www.mangadex.org) API built with the [official JSON API](https://api.mangadex.org/docs.html). - -[Documentation](#Classes)
-[Browser Usage](#Browser) - -[![Version](https://img.shields.io/npm/v/mangadex-full-api.svg?style=flat)](https://www.npmjs.com/package/mangadex-full-api) -[![License](https://img.shields.io/github/license/md-y/mangadex-full-api.svg?style=flat)](https://github.com/md-y/mangadex-full-api/blob/master/LICENSE) -[![Downloads](https://img.shields.io/npm/dm/mangadex-full-api.svg?style=flat)](https://www.npmjs.com/package/mangadex-full-api) - -```bash -npm install mangadex-full-api -``` - -## Examples - -```javascript -const MFA = require('mangadex-full-api'); - -MFA.login('username', 'password123', './bin/.md_cache').then(() => { - MFA.Manga.search({ - title: 'isekai', - limit: Infinity // API Max is 100 per request, but this function accepts more - }).then(results => { - console.log(`There are ${results.length} manga with 'isekai' in the title:`); - results.forEach((elem, i) => console.log(`[${i + 1}] ${elem.title}`)); - }).catch(console.error); -}).catch(console.error); - -``` - -```javascript -const MFA = require('mangadex-full-api'); - -MFA.login('username', 'password123', './bin/.md_cache').then(async () => { - // Get a manga: - let manga = await MFA.Manga.getByQuery('Ancient Magus Bride'); - - // Get the manga's chapters: - let chapters = await manga.getFeed({ translatedLanguage: ['en'] }, true); - // True means that related objects are returned with the base request - // See Release 5.2.0 for more info: https://github.com/md-y/mangadex-full-api/releases/tag/5.2.0 - let chapter = chapters[0]; - - // Get the chapter's pages: - let pages = await chapter.getReadablePages(); - // Please read the following page if you are creating a chapter-reading application: - // https://api.mangadex.org/docs.html#section/Reading-a-chapter-using-the-API/Report - - // Get who uploaded the chapter: - let uploader = await chapter.uploader.resolve(); - - // Get the names of the groups who scanlated the chapter: - let resolvedGroups = await MFA.resolveArray(chapter.groups) // You can resolve Relationship arrays with this shortcut - let groupNames = resolvedGroups.map(elem => elem.name); - - console.log(`Manga "${manga.title}" has a chapter titled "${chapter.title}" that was uploaded by ${uploader.username} and scanlated by ${groupNames.join('and')}.`); - console.log(`Here is the first page: ${pages[0]}`); -}).catch(console.error); - -``` - -```javascript -/* - Upload a chapter with node modules: -*/ -const MFA = require('mangadex-full-api'); -const fs = require('fs'); -const path = require('path'); - -MFA.login('username', 'password123', './bin/.md_cache').then(async () => { - let currentSession = await MFA.Manga.getCurrentUploadSession(); - if (currentSession) { - await currentSession.close(); - console.log('Closed existing session.'); - } - - let mangaId = 'f9c33607-9180-4ba6-b85c-e4b5faee7192'; // Official test manga - let session = await MFA.Manga.createUploadSession(mangaId); - console.log('Created new upload session.'); - - let chapterDir = './chapter'; // Directory to retrieve page images - let files = fs.readdirSync(chapterDir) - await session.uploadPages(files.map(name => { - return { - data: fs.readFileSync(path.join(chapterDir, name)), // Buffer-like data - name: name // The name of this image - }; - })); - console.log('Uploaded pages.'); - - let chapter = await session.commit({ - chapter: '0', // Change chapter number - volume: null, // Change volume number - title: 'New Chapter', // Change chapter name - translatedLanguage: 'en' - }); - - console.log(`Uploaded new chapter at: https://mangadex.org/chapter/${chapter.id}`); -}).catch(console.error); - -``` - -## Classes - -
-
Author
-

Represents an author or artist -https://api.mangadex.org/docs.html#tag/Author

-
-
Chapter
-

Represents a chapter with readable pages -https://api.mangadex.org/docs.html#tag/Chapter

-
-
Cover
-

Represents the cover art of a manga volume -https://api.mangadex.org/docs.html#tag/Cover

-
-
Group
-

Represents a scanlation group -https://api.mangadex.org/docs.html#tag/Group

-
-
List
-

Represents a custom, user-created list of manga -https://api.mangadex.org/docs.html#tag/CustomList

-
-
Manga
-

Represents a manga object -https://api.mangadex.org/docs.html#tag/Manga

-
-
User
-

Represents an user -https://api.mangadex.org/docs.html#tag/User

-
-
Links
-

Represents the links that represent manga on different websites -https://api.mangadex.org/docs.html#section/Static-data/Manga-links-data

-
-
LocalizedString
-

Represents a string, but in different languages. -Generates properties for each language available -(ie you can index with language codes through localizedString['en'] or localizedString.jp)

-
-
Relationship
-

Represents a relationship from one Mangadex object to another such as a manga, author, etc via its id.

-
-
APIRequestError
-

This error respresents when the API responds with an error or invalid response. -In other words, this error represents 400 and 500 status code responses.

-
-
Tag
-

Represents a manga tag

-
-
UploadSession
-

Represents a chapter upload session -https://api.mangadex.org/docs.html#tag/Upload

-
-
- -## Functions - -
-
convertLegacyId(type, ...ids)Promise.<Array.<String>>
-

Converts old (pre v5, numeric ids) Mangadex ids to v5 ids. -Any invalid legacy ids will be skipped by Mangadex when remapping, so -call this function for each individual id if this is an issue.

-
-
setGlobalLocale(newLocale)
-

Sets the global locaization for LocalizedStrings. -Uses 2-letter Mangadex region codes.

-
-
login(username, password, [cacheLocation])Promise.<void>
-

Required for authorization -https://api.mangadex.org/docs.html#operation/post-auth-login

-
-
resolveArray(relationshipArray)Promise
-

A shortcut for resolving all relationships in an array

-
-
- - - -## Author -Represents an author or artist https://api.mangadex.org/docs.html#tag/Author - -**Kind**: global class - -* [Author](#Author) - * [new Author(context)](#new_Author_new) - * _instance_ - * [.id](#Author+id) : String - * [.name](#Author+name) : String - * [.imageUrl](#Author+imageUrl) : String - * [.biography](#Author+biography) : Array.<String> - * [.createdAt](#Author+createdAt) : Date - * [.updatedAt](#Author+updatedAt) : Date - * [.manga](#Author+manga) : [Array.<Relationship>](#Relationship) - * _static_ - * [.search([searchParameters], [includeSubObjects])](#Author.search) ⇒ Promise.<Array.<Author>> - * [.getMultiple(...ids)](#Author.getMultiple) ⇒ Promise.<Array.<Author>> - * [.get(id, [includeSubObjects])](#Author.get) ⇒ [Promise.<Author>](#Author) - * [.getByQuery([searchParameters])](#Author.getByQuery) ⇒ [Promise.<Author>](#Author) - - - -### new Author(context) -There is no reason to directly create an author object. Use static methods, ie 'get()'. - - -| Param | Type | Description | -| --- | --- | --- | -| context | Object \| String | Either an API response or Mangadex id | - - - -### author.id : String -Mangadex id for this object - -**Kind**: instance property of [Author](#Author) - - -### author.name : String -Name of this author/artist - -**Kind**: instance property of [Author](#Author) - - -### author.imageUrl : String -Image URL for this author/artist - -**Kind**: instance property of [Author](#Author) - - -### author.biography : Array.<String> -Author/Artist biography - -**Kind**: instance property of [Author](#Author) - - -### author.createdAt : Date -The date of this author/artist page creation - -**Kind**: instance property of [Author](#Author) - - -### author.updatedAt : Date -The date the author/artist was last updated - -**Kind**: instance property of [Author](#Author) - - -### author.manga : [Array.<Relationship>](#Relationship) -Manga this author/artist has been attributed to - -**Kind**: instance property of [Author](#Author) - - -### Author.search([searchParameters], [includeSubObjects]) ⇒ Promise.<Array.<Author>> -Peforms a search and returns an array of a authors/artists. https://api.mangadex.org/docs.html#operation/get-author - -**Kind**: static method of [Author](#Author) - -| Param | Type | Default | Description | -| --- | --- | --- | --- | -| [searchParameters] | AuthorParameterObject \| String | | An object of offical search parameters, or a string representing the name | -| [includeSubObjects] | Boolean | false | Attempt to resolve sub objects (eg author, artists, etc) when available through the base request | - - - -### Author.getMultiple(...ids) ⇒ Promise.<Array.<Author>> -Gets multiple authors - -**Kind**: static method of [Author](#Author) - -| Param | Type | -| --- | --- | -| ...ids | String \| [Author](#Author) \| [Relationship](#Relationship) | - - - -### Author.get(id, [includeSubObjects]) ⇒ [Promise.<Author>](#Author) -Retrieves and returns a author by its id - -**Kind**: static method of [Author](#Author) - -| Param | Type | Default | Description | -| --- | --- | --- | --- | -| id | String | | Mangadex id | -| [includeSubObjects] | Boolean | false | Attempt to resolve sub objects (eg author, artists, etc) when available through the base request | - - - -### Author.getByQuery([searchParameters]) ⇒ [Promise.<Author>](#Author) -Performs a search for one author and returns that author - -**Kind**: static method of [Author](#Author) - -| Param | Type | Description | -| --- | --- | --- | -| [searchParameters] | AuthorParameterObject \| String | An object of offical search parameters, or a string representing the name | - - - -## Chapter -Represents a chapter with readable pages https://api.mangadex.org/docs.html#tag/Chapter - -**Kind**: global class - -* [Chapter](#Chapter) - * [new Chapter(context)](#new_Chapter_new) - * _instance_ - * [.id](#Chapter+id) : String - * [.volume](#Chapter+volume) : String - * [.chapter](#Chapter+chapter) : String - * [.title](#Chapter+title) : String - * [.translatedLanguage](#Chapter+translatedLanguage) : String - * [.hash](#Chapter+hash) : String - * [.createdAt](#Chapter+createdAt) : Date - * [.updatedAt](#Chapter+updatedAt) : Date - * [.publishAt](#Chapter+publishAt) : Date - * [.pageNames](#Chapter+pageNames) : Array.<String> - * [.saverPageNames](#Chapter+saverPageNames) : Array.<String> - * [.isExternal](#Chapter+isExternal) : Boolean - * [.externalUrl](#Chapter+externalUrl) : String - * [.groups](#Chapter+groups) : [Array.<Relationship>](#Relationship) - * [.manga](#Chapter+manga) : [Relationship](#Relationship) - * [.uploader](#Chapter+uploader) : [Relationship](#Relationship) - * [.getReadablePages([saver])](#Chapter+getReadablePages) ⇒ Promise.<Array.<String>> - * [.changeReadMarker([read])](#Chapter+changeReadMarker) ⇒ [Promise.<Chapter>](#Chapter) - * _static_ - * [.search([searchParameters], [includeSubObjects])](#Chapter.search) ⇒ Promise.<Array.<Chapter>> - * [.getMultiple(...ids)](#Chapter.getMultiple) ⇒ Promise.<Array.<Chapter>> - * [.get(id, [includeSubObjects])](#Chapter.get) ⇒ [Promise.<Chapter>](#Chapter) - * [.getByQuery([searchParameters])](#Chapter.getByQuery) ⇒ [Promise.<Chapter>](#Chapter) - * [.changeReadMarker(id, [read])](#Chapter.changeReadMarker) ⇒ Promise.<void> - - - -### new Chapter(context) -There is no reason to directly create a chapter object. Use static methods, ie 'get()'. - - -| Param | Type | Description | -| --- | --- | --- | -| context | Object \| String | Either an API response or Mangadex id | - - - -### chapter.id : String -Mangadex id for this object - -**Kind**: instance property of [Chapter](#Chapter) - - -### chapter.volume : String -This chapter's volume number/string - -**Kind**: instance property of [Chapter](#Chapter) - - -### chapter.chapter : String -This chapter's number/string identifier - -**Kind**: instance property of [Chapter](#Chapter) - - -### chapter.title : String -Title of this chapter - -**Kind**: instance property of [Chapter](#Chapter) - - -### chapter.translatedLanguage : String -Translated language code (2 Letters) - -**Kind**: instance property of [Chapter](#Chapter) - - -### chapter.hash : String -Hash id of this chapter - -**Kind**: instance property of [Chapter](#Chapter) - - -### chapter.createdAt : Date -The date of this chapter's creation - -**Kind**: instance property of [Chapter](#Chapter) - - -### chapter.updatedAt : Date -The date this chapter was last updated - -**Kind**: instance property of [Chapter](#Chapter) - - -### chapter.publishAt : Date -The date this chapter was published - -**Kind**: instance property of [Chapter](#Chapter) - - -### chapter.pageNames : Array.<String> -Dont Use. This is an array of partial URLs. Use 'getReadablePages()' to retrieve full urls. - -**Kind**: instance property of [Chapter](#Chapter) - - -### chapter.saverPageNames : Array.<String> -Dont Use. This is an array of partial URLs. Use 'getReadablePages()' to retrieve full urls. - -**Kind**: instance property of [Chapter](#Chapter) - - -### chapter.isExternal : Boolean -Is this chapter only a link to another website (eg Mangaplus) instead of being hosted on MD? - -**Kind**: instance property of [Chapter](#Chapter) - - -### chapter.externalUrl : String -The external URL to this chapter if it is not hosted on MD. Null if it is hosted on MD - -**Kind**: instance property of [Chapter](#Chapter) - - -### chapter.groups : [Array.<Relationship>](#Relationship) -The scanlation groups that are attributed to this chapter - -**Kind**: instance property of [Chapter](#Chapter) - - -### chapter.manga : [Relationship](#Relationship) -The manga this chapter belongs to - -**Kind**: instance property of [Chapter](#Chapter) - - -### chapter.uploader : [Relationship](#Relationship) -The user who uploaded this chapter - -**Kind**: instance property of [Chapter](#Chapter) - - -### chapter.getReadablePages([saver]) ⇒ Promise.<Array.<String>> -Retrieves URLs for actual images from Mangadex @ Home. This only gives URLs, so it does not report the status of the server to Mangadex @ Home. Therefore applications that download image data pleaese report failures as stated here: https://api.mangadex.org/docs.html#section/Reading-a-chapter-using-the-API/Report - -**Kind**: instance method of [Chapter](#Chapter) - -| Param | Type | Default | Description | -| --- | --- | --- | --- | -| [saver] | Boolean | false | Use data saver images? | - - - -### chapter.changeReadMarker([read]) ⇒ [Promise.<Chapter>](#Chapter) -Marks this chapter as either read or unread - -**Kind**: instance method of [Chapter](#Chapter) - -| Param | Type | Default | Description | -| --- | --- | --- | --- | -| [read] | Boolean | true | True to mark as read, false to mark unread | - - - -### Chapter.search([searchParameters], [includeSubObjects]) ⇒ Promise.<Array.<Chapter>> -Peforms a search and returns an array of chapters. https://api.mangadex.org/docs.html#operation/get-chapter - -**Kind**: static method of [Chapter](#Chapter) - -| Param | Type | Default | Description | -| --- | --- | --- | --- | -| [searchParameters] | ChapterParameterObject \| String | | An object of offical search parameters, or a string representing the title | -| [includeSubObjects] | Boolean | false | Attempt to resolve sub objects (eg author, artists, etc) when available through the base request | - - - -### Chapter.getMultiple(...ids) ⇒ Promise.<Array.<Chapter>> -Gets multiple chapters - -**Kind**: static method of [Chapter](#Chapter) - -| Param | Type | -| --- | --- | -| ...ids | String \| [Chapter](#Chapter) \| [Relationship](#Relationship) | - - - -### Chapter.get(id, [includeSubObjects]) ⇒ [Promise.<Chapter>](#Chapter) -Retrieves and returns a chapter by its id - -**Kind**: static method of [Chapter](#Chapter) - -| Param | Type | Default | Description | -| --- | --- | --- | --- | -| id | String | | Mangadex id | -| [includeSubObjects] | Boolean | false | Attempt to resolve sub objects (eg author, artists, etc) when available through the base request | - - - -### Chapter.getByQuery([searchParameters]) ⇒ [Promise.<Chapter>](#Chapter) -Performs a search for one chapter and returns that chapter - -**Kind**: static method of [Chapter](#Chapter) - -| Param | Type | Description | -| --- | --- | --- | -| [searchParameters] | ChapterParameterObject \| String | An object of offical search parameters, or a string representing the title | - - - -### Chapter.changeReadMarker(id, [read]) ⇒ Promise.<void> -Marks a chapter as either read or unread - -**Kind**: static method of [Chapter](#Chapter) - -| Param | Type | Default | Description | -| --- | --- | --- | --- | -| id | String | | | -| [read] | Boolean | true | True to mark as read, false to mark unread | - - - -## Cover -Represents the cover art of a manga volume https://api.mangadex.org/docs.html#tag/Cover - -**Kind**: global class - -* [Cover](#Cover) - * [new Cover(context)](#new_Cover_new) - * _instance_ - * [.id](#Cover+id) : String - * [.volume](#Cover+volume) : String - * [.description](#Cover+description) : String - * [.createdAt](#Cover+createdAt) : Date - * [.updatedAt](#Cover+updatedAt) : Date - * [.manga](#Cover+manga) : [Relationship](#Relationship) - * [.uploader](#Cover+uploader) : [Relationship](#Relationship) - * [.imageSource](#Cover+imageSource) : String - * [.image512](#Cover+image512) : String - * [.image256](#Cover+image256) : String - * _static_ - * [.get(id, [includeSubObjects])](#Cover.get) ⇒ [Promise.<Cover>](#Cover) - * [.search([searchParameters], [includeSubObjects])](#Cover.search) ⇒ Promise.<Array.<Cover>> - * [.getMultiple(...ids)](#Cover.getMultiple) ⇒ Promise.<Array.<Cover>> - * [.getByQuery([searchParameters])](#Cover.getByQuery) ⇒ [Promise.<Cover>](#Cover) - * [.getMangaCovers(...manga)](#Cover.getMangaCovers) ⇒ Promise.<Array.<Cover>> - - - -### new Cover(context) -There is no reason to directly create a cover art object. Use static methods, ie 'get()'. - - -| Param | Type | Description | -| --- | --- | --- | -| context | Object \| String | Either an API response or Mangadex id | - - - -### cover.id : String -Mangadex id for this object - -**Kind**: instance property of [Cover](#Cover) - - -### cover.volume : String -Manga volume this is a cover for - -**Kind**: instance property of [Cover](#Cover) - - -### cover.description : String -Description of this cover - -**Kind**: instance property of [Cover](#Cover) - - -### cover.createdAt : Date -The date of the cover's creation - -**Kind**: instance property of [Cover](#Cover) - - -### cover.updatedAt : Date -The date the cover was last updated - -**Kind**: instance property of [Cover](#Cover) - - -### cover.manga : [Relationship](#Relationship) -Manga this is a cover for - -**Kind**: instance property of [Cover](#Cover) - - -### cover.uploader : [Relationship](#Relationship) -The user who uploaded this cover - -**Kind**: instance property of [Cover](#Cover) - - -### cover.imageSource : String -URL to the source image of the cover - -**Kind**: instance property of [Cover](#Cover) - - -### cover.image512 : String -URL to the 512px image of the cover - -**Kind**: instance property of [Cover](#Cover) - - -### cover.image256 : String -URL to the 256px image of the cover - -**Kind**: instance property of [Cover](#Cover) - - -### Cover.get(id, [includeSubObjects]) ⇒ [Promise.<Cover>](#Cover) -Retrieves and returns a cover by its id - -**Kind**: static method of [Cover](#Cover) - -| Param | Type | Default | Description | -| --- | --- | --- | --- | -| id | String | | Mangadex id | -| [includeSubObjects] | Boolean | false | Attempt to resolve sub objects (eg author, artists, etc) when available through the base request | - - - -### Cover.search([searchParameters], [includeSubObjects]) ⇒ Promise.<Array.<Cover>> -Peforms a search and returns an array of covers. https://api.mangadex.org/docs.html#operation/get-cover - -**Kind**: static method of [Cover](#Cover) - -| Param | Type | Default | Description | -| --- | --- | --- | --- | -| [searchParameters] | CoverParameterObject | | | -| [includeSubObjects] | Boolean | false | Attempt to resolve sub objects (eg author, artists, etc) when available through the base request | - - - -### Cover.getMultiple(...ids) ⇒ Promise.<Array.<Cover>> -Gets multiple covers - -**Kind**: static method of [Cover](#Cover) - -| Param | Type | -| --- | --- | -| ...ids | String \| [Cover](#Cover) \| [Relationship](#Relationship) | - - - -### Cover.getByQuery([searchParameters]) ⇒ [Promise.<Cover>](#Cover) -Performs a search for one manga and returns that manga - -**Kind**: static method of [Cover](#Cover) - -| Param | Type | -| --- | --- | -| [searchParameters] | CoverParameterObject | - - - -### Cover.getMangaCovers(...manga) ⇒ Promise.<Array.<Cover>> -Get an array of manga's covers - -**Kind**: static method of [Cover](#Cover) - -| Param | Type | -| --- | --- | -| ...manga | String \| [Manga](#Manga) \| [Relationship](#Relationship) | - - - -## Group -Represents a scanlation group https://api.mangadex.org/docs.html#tag/Group - -**Kind**: global class - -* [Group](#Group) - * [new Group(context)](#new_Group_new) - * _instance_ - * [.id](#Group+id) : String - * [.name](#Group+name) : String - * [.createdAt](#Group+createdAt) : Date - * [.updatedAt](#Group+updatedAt) : Date - * [.locked](#Group+locked) : Boolean - * [.website](#Group+website) : String - * [.ircServer](#Group+ircServer) : String - * [.ircChannel](#Group+ircChannel) : String - * [.discord](#Group+discord) : String - * [.description](#Group+description) : String - * [.official](#Group+official) : Boolean - * [.verified](#Group+verified) : Boolean - * [.leader](#Group+leader) : [Relationship](#Relationship) - * [.members](#Group+members) : [Array.<Relationship>](#Relationship) - * [.changeFollowship([follow])](#Group+changeFollowship) ⇒ [Promise.<Group>](#Group) - * _static_ - * [.search([searchParameters], [includeSubObjects])](#Group.search) ⇒ Promise.<Array.<Group>> - * [.getMultiple(...ids)](#Group.getMultiple) ⇒ Promise.<Array.<Group>> - * [.get(id, [includeSubObjects])](#Group.get) ⇒ [Promise.<Group>](#Group) - * [.getByQuery([searchParameters])](#Group.getByQuery) ⇒ [Promise.<Group>](#Group) - * [.getFollowedGroups([limit], [offset])](#Group.getFollowedGroups) ⇒ Promise.<Array.<Group>> - * [.changeFollowship(id, [follow])](#Group.changeFollowship) ⇒ Promise.<void> - - - -### new Group(context) -There is no reason to directly create a group object. Use static methods, ie 'get()'. - - -| Param | Type | Description | -| --- | --- | --- | -| context | Object \| String | Either an API response or Mangadex id | - - - -### group.id : String -Mangadex id for this object - -**Kind**: instance property of [Group](#Group) - - -### group.name : String -Name of this group - -**Kind**: instance property of [Group](#Group) - - -### group.createdAt : Date -The date of this group's creation - -**Kind**: instance property of [Group](#Group) - - -### group.updatedAt : Date -The date the group was last updated - -**Kind**: instance property of [Group](#Group) - - -### group.locked : Boolean -Is this group locked? - -**Kind**: instance property of [Group](#Group) - - -### group.website : String -Website URL for this group - -**Kind**: instance property of [Group](#Group) - - -### group.ircServer : String -IRC Server for this group - -**Kind**: instance property of [Group](#Group) - - -### group.ircChannel : String -IRC Channel for this group - -**Kind**: instance property of [Group](#Group) - - -### group.discord : String -Discord Invite Code for this group - -**Kind**: instance property of [Group](#Group) - - -### group.description : String -The group's custom description - -**Kind**: instance property of [Group](#Group) - - -### group.official : Boolean -Is this group an official publisher? - -**Kind**: instance property of [Group](#Group) - - -### group.verified : Boolean -Is this group managed by an official publisher? - -**Kind**: instance property of [Group](#Group) - - -### group.leader : [Relationship](#Relationship) -This group's leader - -**Kind**: instance property of [Group](#Group) - - -### group.members : [Array.<Relationship>](#Relationship) -Array of this group's members - -**Kind**: instance property of [Group](#Group) - - -### group.changeFollowship([follow]) ⇒ [Promise.<Group>](#Group) -Makes the logged in user either follow or unfollow this group - -**Kind**: instance method of [Group](#Group) - -| Param | Type | Default | Description | -| --- | --- | --- | --- | -| [follow] | Boolean | true | True to follow, false to unfollow | - - - -### Group.search([searchParameters], [includeSubObjects]) ⇒ Promise.<Array.<Group>> -Peforms a search and returns an array of groups. https://api.mangadex.org/docs.html#operation/get-search-group - -**Kind**: static method of [Group](#Group) - -| Param | Type | Default | Description | -| --- | --- | --- | --- | -| [searchParameters] | GroupParameterObject \| String | | An object of offical search parameters, or a string representing the name | -| [includeSubObjects] | Boolean | false | Attempt to resolve sub objects (eg author, artists, etc) when available through the base request | - - - -### Group.getMultiple(...ids) ⇒ Promise.<Array.<Group>> -Gets multiple groups - -**Kind**: static method of [Group](#Group) - -| Param | Type | -| --- | --- | -| ...ids | String \| [Group](#Group) \| [Relationship](#Relationship) | - - - -### Group.get(id, [includeSubObjects]) ⇒ [Promise.<Group>](#Group) -Retrieves and returns a group by its id - -**Kind**: static method of [Group](#Group) - -| Param | Type | Default | Description | -| --- | --- | --- | --- | -| id | String | | Mangadex id | -| [includeSubObjects] | Boolean | false | Attempt to resolve sub objects (eg author, artists, etc) when available through the base request | - - - -### Group.getByQuery([searchParameters]) ⇒ [Promise.<Group>](#Group) -Performs a search for one group and returns that group - -**Kind**: static method of [Group](#Group) - -| Param | Type | Description | -| --- | --- | --- | -| [searchParameters] | GroupParameterObject \| String | An object of offical search parameters, or a string representing the name | - - - -### Group.getFollowedGroups([limit], [offset]) ⇒ Promise.<Array.<Group>> -Returns all groups followed by the logged in user - -**Kind**: static method of [Group](#Group) - -| Param | Type | Default | Description | -| --- | --- | --- | --- | -| [limit] | Number | 100 | Amount of groups to return (0 to Infinity) | -| [offset] | Number | 0 | How many groups to skip before returning | - - - -### Group.changeFollowship(id, [follow]) ⇒ Promise.<void> -Makes the logged in user either follow or unfollow a group - -**Kind**: static method of [Group](#Group) - -| Param | Type | Default | Description | -| --- | --- | --- | --- | -| id | String | | | -| [follow] | Boolean | true | True to follow, false to unfollow | - - - -## List -Represents a custom, user-created list of manga https://api.mangadex.org/docs.html#tag/CustomList - -**Kind**: global class - -* [List](#List) - * [new List(context)](#new_List_new) - * _instance_ - * [.id](#List+id) : String - * [.name](#List+name) : String - * [.version](#List+version) : String - * [.visibility](#List+visibility) : 'public' \| 'private' - * [.manga](#List+manga) : [Array.<Relationship>](#Relationship) - * [.owner](#List+owner) : [Relationship](#Relationship) - * [.public](#List+public) : Boolean - * [.getFeed([parameterObject])](#List+getFeed) ⇒ Promise.<Array.<Chapter>> - * [.delete()](#List+delete) ⇒ Promise.<void> - * [.rename(newName)](#List+rename) ⇒ [Promise.<List>](#List) - * [.changeVisibility([newVis])](#List+changeVisibility) ⇒ [Promise.<List>](#List) - * [.updateMangaList(newList)](#List+updateMangaList) ⇒ [Promise.<List>](#List) - * [.addManga(manga)](#List+addManga) ⇒ [Promise.<List>](#List) - * [.removeManga(manga)](#List+removeManga) ⇒ [Promise.<List>](#List) - * _static_ - * [.get(id, [includeSubObjects])](#List.get) ⇒ [Promise.<List>](#List) - * [.create(name, manga, [visibility])](#List.create) ⇒ [Promise.<List>](#List) - * [.delete(id)](#List.delete) ⇒ Promise.<void> - * [.addManga(listId, manga)](#List.addManga) ⇒ Promise.<void> - * [.removeManga(listId, manga)](#List.removeManga) ⇒ Promise.<void> - * [.getLoggedInUserLists([limit], [offset], [includeSubObjects])](#List.getLoggedInUserLists) ⇒ Promise.<Array.<List>> - * [.getUserLists(user, [limit], [offset], [includeSubObjects])](#List.getUserLists) ⇒ Promise.<Array.<List>> - * [.getFeed(id, parameterObject, [includeSubObjects])](#List.getFeed) ⇒ Promise.<Array.<Chapter>> - - - -### new List(context) -There is no reason to directly create a custom list object. Use static methods, ie 'get()'. - - -| Param | Type | Description | -| --- | --- | --- | -| context | Object \| String | Either an API response or Mangadex id | - - - -### list.id : String -Mangadex id for this object - -**Kind**: instance property of [List](#List) - - -### list.name : String -Name of this custom list - -**Kind**: instance property of [List](#List) - - -### list.version : String -Version of this custom list - -**Kind**: instance property of [List](#List) - - -### list.visibility : 'public' \| 'private' -String form of this list's visibility - -**Kind**: instance property of [List](#List) - - -### list.manga : [Array.<Relationship>](#Relationship) -Relationships to all of the manga in this custom list - -**Kind**: instance property of [List](#List) - - -### list.owner : [Relationship](#Relationship) -This list's owner - -**Kind**: instance property of [List](#List) - - -### list.public : Boolean -Is this list public? - -**Kind**: instance property of [List](#List) - - -### list.getFeed([parameterObject]) ⇒ Promise.<Array.<Chapter>> -Returns a list of the most recent chapters from the manga in a list https://api.mangadex.org/docs.html#operation/get-list-id-feed - -**Kind**: instance method of [List](#List) - -| Param | Type | Description | -| --- | --- | --- | -| [parameterObject] | FeedParameterObject | Information on which chapters to be returned | - - - -### list.delete() ⇒ Promise.<void> -Delete a custom list. Must be logged in - -**Kind**: instance method of [List](#List) - - -### list.rename(newName) ⇒ [Promise.<List>](#List) -Renames a custom list. Must be logged in - -**Kind**: instance method of [List](#List) - -| Param | Type | -| --- | --- | -| newName | String | - - - -### list.changeVisibility([newVis]) ⇒ [Promise.<List>](#List) -Changes the visibility a custom list. Must be logged in - -**Kind**: instance method of [List](#List) - -| Param | Type | Description | -| --- | --- | --- | -| [newVis] | 'public' \| 'private' | Leave blank to toggle | - - - -### list.updateMangaList(newList) ⇒ [Promise.<List>](#List) -Changes the manga in a custom list. Must be logged in - -**Kind**: instance method of [List](#List) - -| Param | Type | -| --- | --- | -| newList | [Array.<Manga>](#Manga) \| Array.<String> | - - - -### list.addManga(manga) ⇒ [Promise.<List>](#List) -Adds a manga to this list - -**Kind**: instance method of [List](#List) - -| Param | Type | -| --- | --- | -| manga | [Manga](#Manga) \| String | - - - -### list.removeManga(manga) ⇒ [Promise.<List>](#List) -Removes a manga from this list - -**Kind**: instance method of [List](#List) - -| Param | Type | -| --- | --- | -| manga | [Manga](#Manga) \| String | - - - -### List.get(id, [includeSubObjects]) ⇒ [Promise.<List>](#List) -Retrieves and returns a list by its id - -**Kind**: static method of [List](#List) - -| Param | Type | Default | Description | -| --- | --- | --- | --- | -| id | String | | Mangadex id | -| [includeSubObjects] | Boolean | false | Attempt to resolve sub objects (eg author, artists, etc) when available through the base request | - - - -### List.create(name, manga, [visibility]) ⇒ [Promise.<List>](#List) -Create a new custom list. Must be logged in - -**Kind**: static method of [List](#List) - -| Param | Type | Default | -| --- | --- | --- | -| name | String | | -| manga | [Array.<Manga>](#Manga) \| Array.<String> | | -| [visibility] | 'public' \| 'private' | 'private' | - - - -### List.delete(id) ⇒ Promise.<void> -Deletes a custom list. Must be logged in - -**Kind**: static method of [List](#List) - -| Param | Type | -| --- | --- | -| id | String | - - - -### List.addManga(listId, manga) ⇒ Promise.<void> -Adds a manga to a custom list. Must be logged in - -**Kind**: static method of [List](#List) - -| Param | Type | -| --- | --- | -| listId | String | -| manga | [Manga](#Manga) \| String | - - - -### List.removeManga(listId, manga) ⇒ Promise.<void> -Removes a manga from a custom list. Must be logged in - -**Kind**: static method of [List](#List) - -| Param | Type | -| --- | --- | -| listId | String | -| manga | [Manga](#Manga) \| String | - - - -### List.getLoggedInUserLists([limit], [offset], [includeSubObjects]) ⇒ Promise.<Array.<List>> -Returns all lists created by the logged in user. - -**Kind**: static method of [List](#List) - -| Param | Type | Default | Description | -| --- | --- | --- | --- | -| [limit] | Number | 100 | Amount of lists to return (0 to Infinity) | -| [offset] | Number | 0 | How many lists to skip before returning | -| [includeSubObjects] | Boolean | false | Attempt to resolve sub objects (eg author, artists, etc) when available through the base request | - - - -### List.getUserLists(user, [limit], [offset], [includeSubObjects]) ⇒ Promise.<Array.<List>> -Returns all public lists created by a user. - -**Kind**: static method of [List](#List) - -| Param | Type | Default | Description | -| --- | --- | --- | --- | -| user | String \| [User](#User) \| [Relationship](#Relationship) | | | -| [limit] | Number | 100 | Amount of lists to return (0 to Infinity) | -| [offset] | Number | 0 | How many lists to skip before returning | -| [includeSubObjects] | Boolean | false | Attempt to resolve sub objects (eg author, artists, etc) when available through the base request | - - - -### List.getFeed(id, parameterObject, [includeSubObjects]) ⇒ Promise.<Array.<Chapter>> -Returns a list of the most recent chapters from the manga in a list - -**Kind**: static method of [List](#List) - -| Param | Type | Default | Description | -| --- | --- | --- | --- | -| id | String | | Mangadex id of the list | -| parameterObject | FeedParameterObject | | Information on which chapters to be returned | -| [includeSubObjects] | Boolean | false | Attempt to resolve sub objects (eg author, artists, etc) when available through the base request | - - - -## Manga -Represents a manga object https://api.mangadex.org/docs.html#tag/Manga - -**Kind**: global class - -* [Manga](#Manga) - * [new Manga(context)](#new_Manga_new) - * _instance_ - * [.id](#Manga+id) : String - * [.localizedTitle](#Manga+localizedTitle) : [LocalizedString](#LocalizedString) - * [.localizedAltTitles](#Manga+localizedAltTitles) : [Array.<LocalizedString>](#LocalizedString) - * [.localizedDescription](#Manga+localizedDescription) : [LocalizedString](#LocalizedString) - * [.isLocked](#Manga+isLocked) : Boolean - * [.links](#Manga+links) : [Links](#Links) - * [.originalLanguage](#Manga+originalLanguage) : String - * [.lastVolume](#Manga+lastVolume) : String - * [.lastChapter](#Manga+lastChapter) : String - * [.publicationDemographic](#Manga+publicationDemographic) : 'shounen' \| 'shoujo' \| 'josei' \| 'seinen' - * [.status](#Manga+status) : 'ongoing' \| 'completed' \| 'hiatus' \| 'cancelled' - * [.year](#Manga+year) : Number - * [.contentRating](#Manga+contentRating) : 'safe' \| 'suggestive' \| 'erotica' \| 'pornographic' - * [.createdAt](#Manga+createdAt) : Date - * [.updatedAt](#Manga+updatedAt) : Date - * [.authors](#Manga+authors) : [Array.<Relationship>](#Relationship) - * [.artists](#Manga+artists) : [Array.<Relationship>](#Relationship) - * [.mainCover](#Manga+mainCover) : [Relationship](#Relationship) - * [.tags](#Manga+tags) : [Array.<Tag>](#Tag) - * [.title](#Manga+title) : String - * [.altTitles](#Manga+altTitles) : Array.<String> - * [.description](#Manga+description) : String - * [.createUploadSession([...groups])](#Manga+createUploadSession) ⇒ [Promise.<UploadSession>](#UploadSession) - * [.getCovers()](#Manga+getCovers) ⇒ Promise.<Array.<Cover>> - * [.getFeed([parameterObject], [includeSubObjects])](#Manga+getFeed) ⇒ Promise.<Array.<Chapter>> - * [.addToList(list)](#Manga+addToList) ⇒ Promise.<void> - * [.getReadingStatus()](#Manga+getReadingStatus) ⇒ Promise.<('reading'\|'on\_hold'\|'plan\_to\_read'\|'dropped'\|'re\_reading'\|'completed')> - * [.setReadingStatus([status])](#Manga+setReadingStatus) ⇒ [Promise.<Manga>](#Manga) - * [.changeFollowship([follow])](#Manga+changeFollowship) ⇒ [Promise.<Manga>](#Manga) - * [.getReadChapters()](#Manga+getReadChapters) ⇒ Promise.<Array.<Chapter>> - * [.getAggregate(...languages)](#Manga+getAggregate) ⇒ Promise.<Object> - * _static_ - * [.search([searchParameters], [includeSubObjects])](#Manga.search) ⇒ Promise.<Array.<Manga>> - * [.getMultiple(...ids)](#Manga.getMultiple) ⇒ Promise.<Array.<Manga>> - * [.get(id, [includeSubObjects])](#Manga.get) ⇒ [Promise.<Manga>](#Manga) - * [.getByQuery([searchParameters], [includeSubObjects])](#Manga.getByQuery) ⇒ [Promise.<Manga>](#Manga) - * [.getFeed(id, [parameterObject], [includeSubObjects])](#Manga.getFeed) ⇒ Promise.<Array.<Chapter>> - * [.getRandom([includeSubObjects])](#Manga.getRandom) ⇒ [Promise.<Manga>](#Manga) - * [.getFollowedManga([limit], [offset])](#Manga.getFollowedManga) ⇒ Promise.<Array.<Manga>> - * [.getTag(indentity)](#Manga.getTag) ⇒ [Promise.<Tag>](#Tag) - * [.getAllTags()](#Manga.getAllTags) ⇒ Promise.<Array.<Tag>> - * [.getReadingStatus(id)](#Manga.getReadingStatus) ⇒ Promise.<('reading'\|'on\_hold'\|'plan\_to\_read'\|'dropped'\|'re\_reading'\|'completed')> - * [.setReadingStatus(id, [status])](#Manga.setReadingStatus) ⇒ Promise.<void> - * [.getAllReadingStatuses()](#Manga.getAllReadingStatuses) ⇒ Object.<string, ('reading'\|'on\_hold'\|'plan\_to\_read'\|'dropped'\|'re\_reading'\|'completed')> - * [.getFollowedFeed([parameterObject], [includeSubObjects])](#Manga.getFollowedFeed) ⇒ Promise.<Array.<Chapter>> - * [.changeFollowship(id, [follow])](#Manga.changeFollowship) ⇒ Promise.<void> - * [.getReadChapters(...ids)](#Manga.getReadChapters) ⇒ Promise.<Array.<Chapter>> - * [.getCovers(...id)](#Manga.getCovers) ⇒ Promise.<Array.<Cover>> - * [.getAggregate(id, ...languages)](#Manga.getAggregate) ⇒ Promise.<Object.<string, AggregateVolume>> - * [.createUploadSession(id, [...groups])](#Manga.createUploadSession) ⇒ [Promise.<UploadSession>](#UploadSession) - * [.getCurrentUploadSession()](#Manga.getCurrentUploadSession) ⇒ [Promise.<UploadSession>](#UploadSession) - - - -### new Manga(context) -There is no reason to directly create a manga object. Use static methods, ie 'get()'. - - -| Param | Type | Description | -| --- | --- | --- | -| context | Object \| String | Either an API response or Mangadex id | - - - -### manga.id : String -Mangadex id for this object - -**Kind**: instance property of [Manga](#Manga) - - -### manga.localizedTitle : [LocalizedString](#LocalizedString) -Main title with different localization options - -**Kind**: instance property of [Manga](#Manga) - - -### manga.localizedAltTitles : [Array.<LocalizedString>](#LocalizedString) -Alt titles with different localization options - -**Kind**: instance property of [Manga](#Manga) - - -### manga.localizedDescription : [LocalizedString](#LocalizedString) -Description with different localization options - -**Kind**: instance property of [Manga](#Manga) - - -### manga.isLocked : Boolean -Is this Manga locked? - -**Kind**: instance property of [Manga](#Manga) - - -### manga.links : [Links](#Links) -Link object representing links to other websites about this manga https://api.mangadex.org/docs.html#section/Static-data/Manga-links-data - -**Kind**: instance property of [Manga](#Manga) - - -### manga.originalLanguage : String -2-letter code for the original language of this manga - -**Kind**: instance property of [Manga](#Manga) - - -### manga.lastVolume : String -This manga's last volume based on the default feed order - -**Kind**: instance property of [Manga](#Manga) - - -### manga.lastChapter : String -This manga's last chapter based on the default feed order - -**Kind**: instance property of [Manga](#Manga) - - -### manga.publicationDemographic : 'shounen' \| 'shoujo' \| 'josei' \| 'seinen' -Publication demographic of this manga https://api.mangadex.org/docs.html#section/Static-data/Manga-publication-demographic - -**Kind**: instance property of [Manga](#Manga) - - -### manga.status : 'ongoing' \| 'completed' \| 'hiatus' \| 'cancelled' -Publication/Scanlation status of this manga - -**Kind**: instance property of [Manga](#Manga) - - -### manga.year : Number -Year of this manga's publication - -**Kind**: instance property of [Manga](#Manga) - - -### manga.contentRating : 'safe' \| 'suggestive' \| 'erotica' \| 'pornographic' -The content rating of this manga - -**Kind**: instance property of [Manga](#Manga) - - -### manga.createdAt : Date -The date of this manga's page creation - -**Kind**: instance property of [Manga](#Manga) - - -### manga.updatedAt : Date -The date the manga was last updated - -**Kind**: instance property of [Manga](#Manga) - - -### manga.authors : [Array.<Relationship>](#Relationship) -Authors attributed to this manga - -**Kind**: instance property of [Manga](#Manga) - - -### manga.artists : [Array.<Relationship>](#Relationship) -Artists attributed to this manga - -**Kind**: instance property of [Manga](#Manga) - - -### manga.mainCover : [Relationship](#Relationship) -This manga's main cover. Use 'getCovers' to retrive other covers - -**Kind**: instance property of [Manga](#Manga) - - -### manga.tags : [Array.<Tag>](#Tag) -Array of tags for this manga - -**Kind**: instance property of [Manga](#Manga) - - -### manga.title : String -Main title string based on global locale - -**Kind**: instance property of [Manga](#Manga) - - -### manga.altTitles : Array.<String> -Alt titles array based on global locale - -**Kind**: instance property of [Manga](#Manga) - - -### manga.description : String -Description string based on global locale - -**Kind**: instance property of [Manga](#Manga) - - -### manga.createUploadSession([...groups]) ⇒ [Promise.<UploadSession>](#UploadSession) -Creates a new upload session with this manga as the target - -**Kind**: instance method of [Manga](#Manga) - -| Param | Type | -| --- | --- | -| [...groups] | String \| [Group](#Group) | - - - -### manga.getCovers() ⇒ Promise.<Array.<Cover>> -Returns all covers for this manga - -**Kind**: instance method of [Manga](#Manga) - - -### manga.getFeed([parameterObject], [includeSubObjects]) ⇒ Promise.<Array.<Chapter>> -Returns a feed of this manga's chapters. - -**Kind**: instance method of [Manga](#Manga) - -| Param | Type | Default | Description | -| --- | --- | --- | --- | -| [parameterObject] | FeedParameterObject \| Number | | Either a parameter object or a number representing the limit | -| [includeSubObjects] | Boolean | false | Attempt to resolve sub objects (eg author, artists, etc) when available through the base request | - - - -### manga.addToList(list) ⇒ Promise.<void> -Adds this manga to a list - -**Kind**: instance method of [Manga](#Manga) - -| Param | Type | -| --- | --- | -| list | [List](#List) \| String | - - - -### manga.getReadingStatus() ⇒ Promise.<('reading'\|'on\_hold'\|'plan\_to\_read'\|'dropped'\|'re\_reading'\|'completed')> -Retrieves the logged in user's reading status for this manga. If there is no status, null is returned - -**Kind**: instance method of [Manga](#Manga) - - -### manga.setReadingStatus([status]) ⇒ [Promise.<Manga>](#Manga) -Sets the logged in user's reading status for this manga. Call without arguments to clear the reading status - -**Kind**: instance method of [Manga](#Manga) - -| Param | Type | Default | -| --- | --- | --- | -| [status] | 'reading' \| 'on\_hold' \| 'plan\_to\_read' \| 'dropped' \| 're\_reading' \| 'completed' | | - - - -### manga.changeFollowship([follow]) ⇒ [Promise.<Manga>](#Manga) -Makes the logged in user either follow or unfollow this manga - -**Kind**: instance method of [Manga](#Manga) - -| Param | Type | Default | Description | -| --- | --- | --- | --- | -| [follow] | Boolean | true | True to follow, false to unfollow | - - - -### manga.getReadChapters() ⇒ Promise.<Array.<Chapter>> -Returns an array of every chapter that has been marked as read for this manga - -**Kind**: instance method of [Manga](#Manga) - - -### manga.getAggregate(...languages) ⇒ Promise.<Object> -Returns a summary of every chapter for this manga including each of their numbers and volumes they belong to https://api.mangadex.org/docs.html#operation/post-manga - -**Kind**: instance method of [Manga](#Manga) - -| Param | Type | -| --- | --- | -| ...languages | String | - - - -### Manga.search([searchParameters], [includeSubObjects]) ⇒ Promise.<Array.<Manga>> -Peforms a search and returns an array of manga. https://api.mangadex.org/docs.html#operation/get-search-manga - -**Kind**: static method of [Manga](#Manga) - -| Param | Type | Default | Description | -| --- | --- | --- | --- | -| [searchParameters] | MangaParameterObject \| String | | An object of offical search parameters, or a string representing the title | -| [includeSubObjects] | Boolean | false | Attempt to resolve sub objects (eg author, artists, etc) when available through the base request | - - - -### Manga.getMultiple(...ids) ⇒ Promise.<Array.<Manga>> -Gets multiple manga - -**Kind**: static method of [Manga](#Manga) - -| Param | Type | -| --- | --- | -| ...ids | String \| [Relationship](#Relationship) | - - - -### Manga.get(id, [includeSubObjects]) ⇒ [Promise.<Manga>](#Manga) -Retrieves and returns a manga by its id - -**Kind**: static method of [Manga](#Manga) - -| Param | Type | Default | Description | -| --- | --- | --- | --- | -| id | String | | Mangadex id | -| [includeSubObjects] | Boolean | false | Attempt to resolve sub objects (eg author, artists, etc) when available through the base request | - - - -### Manga.getByQuery([searchParameters], [includeSubObjects]) ⇒ [Promise.<Manga>](#Manga) -Performs a search for one manga and returns that manga - -**Kind**: static method of [Manga](#Manga) - -| Param | Type | Default | Description | -| --- | --- | --- | --- | -| [searchParameters] | MangaParameterObject \| String | | An object of offical search parameters, or a string representing the title | -| [includeSubObjects] | Boolean | false | Attempt to resolve sub objects (eg author, artists, etc) when available through the base request | - - - -### Manga.getFeed(id, [parameterObject], [includeSubObjects]) ⇒ Promise.<Array.<Chapter>> -Returns a feed of chapters for a manga - -**Kind**: static method of [Manga](#Manga) - -| Param | Type | Default | Description | -| --- | --- | --- | --- | -| id | String | | | -| [parameterObject] | FeedParameterObject \| Number | | Either a parameter object or a number representing the limit | -| [includeSubObjects] | Boolean | false | Attempt to resolve sub objects (eg author, artists, etc) when available through the base request | - - - -### Manga.getRandom([includeSubObjects]) ⇒ [Promise.<Manga>](#Manga) -Returns one random manga - -**Kind**: static method of [Manga](#Manga) - -| Param | Type | Default | Description | -| --- | --- | --- | --- | -| [includeSubObjects] | Boolean | false | Attempt to resolve sub objects (eg author, artists, etc) when available through the base request | - - - -### Manga.getFollowedManga([limit], [offset]) ⇒ Promise.<Array.<Manga>> -Returns all manga followed by the logged in user - -**Kind**: static method of [Manga](#Manga) - -| Param | Type | Default | Description | -| --- | --- | --- | --- | -| [limit] | Number | 100 | Amount of manga to return (0 to Infinity) | -| [offset] | Number | 0 | How many manga to skip before returning | - - - -### Manga.getTag(indentity) ⇒ [Promise.<Tag>](#Tag) -Retrieves a tag object based on its id or name ('Oneshot', 'Thriller,' etc). The result of every available tag is cached, so subsequent tag requests will have no delay https://api.mangadex.org/docs.html#operation/get-manga-tag - -**Kind**: static method of [Manga](#Manga) - -| Param | Type | -| --- | --- | -| indentity | String | - - - -### Manga.getAllTags() ⇒ Promise.<Array.<Tag>> -Returns an array of every tag available on Mangadex right now. The result is cached, so subsequent tag requests will have no delay https://api.mangadex.org/docs.html#operation/get-manga-tag - -**Kind**: static method of [Manga](#Manga) - - -### Manga.getReadingStatus(id) ⇒ Promise.<('reading'\|'on\_hold'\|'plan\_to\_read'\|'dropped'\|'re\_reading'\|'completed')> -Retrieves the logged in user's reading status for a manga. If there is no status, null is returned - -**Kind**: static method of [Manga](#Manga) - -| Param | Type | -| --- | --- | -| id | String | - - - -### Manga.setReadingStatus(id, [status]) ⇒ Promise.<void> -Sets the logged in user's reading status for this manga. Call without arguments to clear the reading status - -**Kind**: static method of [Manga](#Manga) - -| Param | Type | Default | -| --- | --- | --- | -| id | String | | -| [status] | 'reading' \| 'on\_hold' \| 'plan\_to\_read' \| 'dropped' \| 're\_reading' \| 'completed' | | - - - -### Manga.getAllReadingStatuses() ⇒ Object.<string, ('reading'\|'on\_hold'\|'plan\_to\_read'\|'dropped'\|'re\_reading'\|'completed')> -Returns the reading status for every manga for this logged in user as an object with Manga ids as keys - -**Kind**: static method of [Manga](#Manga) - - -### Manga.getFollowedFeed([parameterObject], [includeSubObjects]) ⇒ Promise.<Array.<Chapter>> -Gets the combined feed of every manga followed by the logged in user - -**Kind**: static method of [Manga](#Manga) - -| Param | Type | Default | Description | -| --- | --- | --- | --- | -| [parameterObject] | FeedParameterObject \| Number | | Either a parameter object or a number representing the limit | -| [includeSubObjects] | Boolean | false | Attempt to resolve sub objects (eg author, artists, etc) when available through the base request | - - - -### Manga.changeFollowship(id, [follow]) ⇒ Promise.<void> -Makes the logged in user either follow or unfollow a manga - -**Kind**: static method of [Manga](#Manga) - -| Param | Type | Default | Description | -| --- | --- | --- | --- | -| id | String | | | -| [follow] | Boolean | true | True to follow, false to unfollow | - - - -### Manga.getReadChapters(...ids) ⇒ Promise.<Array.<Chapter>> -Retrieves the read chapters for multiple manga - -**Kind**: static method of [Manga](#Manga) - -| Param | Type | -| --- | --- | -| ...ids | String \| [Manga](#Manga) \| [Relationship](#Relationship) | - - - -### Manga.getCovers(...id) ⇒ Promise.<Array.<Cover>> -Returns all covers for a manga - -**Kind**: static method of [Manga](#Manga) - -| Param | Type | Description | -| --- | --- | --- | -| ...id | String \| [Manga](#Manga) \| [Relationship](#Relationship) | Manga id(s) | - - - -### Manga.getAggregate(id, ...languages) ⇒ Promise.<Object.<string, AggregateVolume>> -Returns a summary of every chapter for a manga including each of their numbers and volumes they belong to https://api.mangadex.org/docs.html#operation/post-manga - -**Kind**: static method of [Manga](#Manga) - -| Param | Type | -| --- | --- | -| id | String | -| ...languages | String | - - - -### Manga.createUploadSession(id, [...groups]) ⇒ [Promise.<UploadSession>](#UploadSession) -Creates a new upload session with a manga as the target - -**Kind**: static method of [Manga](#Manga) - -| Param | Type | -| --- | --- | -| id | String | -| [...groups] | String \| [Group](#Group) | - - - -### Manga.getCurrentUploadSession() ⇒ [Promise.<UploadSession>](#UploadSession) -Returns the currently open upload session for the logged in user. Returns null if there is no current session - -**Kind**: static method of [Manga](#Manga) - - -## User -Represents an user https://api.mangadex.org/docs.html#tag/User - -**Kind**: global class - -* [User](#User) - * [new User(context)](#new_User_new) - * _instance_ - * [.id](#User+id) : String - * [.username](#User+username) : String - * [.changeFollowship([follow])](#User+changeFollowship) ⇒ [Promise.<User>](#User) - * _static_ - * [.get(id)](#User.get) ⇒ [Promise.<User>](#User) - * [.getFollowedUsers([limit], [offset])](#User.getFollowedUsers) ⇒ Promise.<Array.<User>> - * [.getLoggedInUser()](#User.getLoggedInUser) ⇒ [Promise.<User>](#User) - * [.changeFollowship(id, [follow])](#User.changeFollowship) ⇒ Promise.<void> - - - -### new User(context) -There is no reason to directly create a user object. Use static methods, ie 'get()'. - - -| Param | Type | Description | -| --- | --- | --- | -| context | Object \| String | Either an API response or Mangadex id | - - - -### user.id : String -Mangadex id for this object - -**Kind**: instance property of [User](#User) - - -### user.username : String -Username of this user - -**Kind**: instance property of [User](#User) - - -### user.changeFollowship([follow]) ⇒ [Promise.<User>](#User) -Makes the logged in user either follow or unfollow this user - -**Kind**: instance method of [User](#User) - -| Param | Type | Default | Description | -| --- | --- | --- | --- | -| [follow] | Boolean | true | True to follow, false to unfollow | - - - -### User.get(id) ⇒ [Promise.<User>](#User) -Retrieves and returns a user by its id - -**Kind**: static method of [User](#User) - -| Param | Type | Description | -| --- | --- | --- | -| id | String | Mangadex id | - - - -### User.getFollowedUsers([limit], [offset]) ⇒ Promise.<Array.<User>> -Returns all users followed by the logged in user - -**Kind**: static method of [User](#User) - -| Param | Type | Default | Description | -| --- | --- | --- | --- | -| [limit] | Number | 100 | Amount of users to return (0 to Infinity) | -| [offset] | Number | 0 | How many users to skip before returning | - - - -### User.getLoggedInUser() ⇒ [Promise.<User>](#User) -Returns the logged in user as a user object - -**Kind**: static method of [User](#User) - - -### User.changeFollowship(id, [follow]) ⇒ Promise.<void> -Makes the logged in user either follow or unfollow a user - -**Kind**: static method of [User](#User) - -| Param | Type | Default | Description | -| --- | --- | --- | --- | -| id | String | | | -| [follow] | Boolean | true | True to follow, false to unfollow | - - - -## Links -Represents the links that represent manga on different websites https://api.mangadex.org/docs.html#section/Static-data/Manga-links-data - -**Kind**: global class - -* [Links](#Links) - * [.al](#Links+al) : String - * [.ap](#Links+ap) : String - * [.bw](#Links+bw) : String - * [.mu](#Links+mu) : String - * [.nu](#Links+nu) : String - * [.mal](#Links+mal) : String - * [.kt](#Links+kt) : String - * [.amz](#Links+amz) : String - * [.ebj](#Links+ebj) : String - * [.raw](#Links+raw) : String - * [.engtl](#Links+engtl) : String - * [.cdj](#Links+cdj) : String - * [.availableLinks](#Links+availableLinks) : Array.<String> - - - -### links.al : String -Anilist (https://anilist.co) link to manga - -**Kind**: instance property of [Links](#Links) - - -### links.ap : String -AnimePlanet (https://anime-planet.com) link to manga - -**Kind**: instance property of [Links](#Links) - - -### links.bw : String -Bookwalker (https://bookwalker.jp/) link to manga - -**Kind**: instance property of [Links](#Links) - - -### links.mu : String -Mangaupdates (https://mangaupdates.com) link to manga - -**Kind**: instance property of [Links](#Links) - - -### links.nu : String -Novelupdates (https://novelupdates.com) link to manga - -**Kind**: instance property of [Links](#Links) - - -### links.mal : String -MyAnimeList (https://myanimelist.net) link to manga - -**Kind**: instance property of [Links](#Links) - - -### links.kt : String -Kitsu (https://kitsu.io) link to manga - -**Kind**: instance property of [Links](#Links) - - -### links.amz : String -Amazon (https://amazon.com) link to manga - -**Kind**: instance property of [Links](#Links) - - -### links.ebj : String -EBookJapan (https://ebookjapan.yahoo.co.jp) link to manga - -**Kind**: instance property of [Links](#Links) - - -### links.raw : String -Link to manga raws - -**Kind**: instance property of [Links](#Links) - - -### links.engtl : String -Link to offical english manga translation - -**Kind**: instance property of [Links](#Links) - - -### links.cdj : String -CDJapan (https://www.cdjapan.co.jp/) link to manga - -**Kind**: instance property of [Links](#Links) - - -### links.availableLinks : Array.<String> -All of the links that have valid values - -**Kind**: instance property of [Links](#Links) - - -## LocalizedString -Represents a string, but in different languages. Generates properties for each language available (ie you can index with language codes through localizedString['en'] or localizedString.jp) - -**Kind**: global class - -* [LocalizedString](#LocalizedString) - * [.availableLocales](#LocalizedString+availableLocales) : Array.<String> - * [.localString](#LocalizedString+localString) ⇒ String - - - -### localizedString.availableLocales : Array.<String> -Array with all locales with values in this object - -**Kind**: instance property of [LocalizedString](#LocalizedString) - - -### localizedString.localString ⇒ String -String from global locale setting (setGlobalLocale) - -**Kind**: instance property of [LocalizedString](#LocalizedString) - - -## Relationship -Represents a relationship from one Mangadex object to another such as a manga, author, etc via its id. - -**Kind**: global class - -* [Relationship](#Relationship) - * [.id](#Relationship+id) : String - * [.type](#Relationship+type) : String - * [.cached](#Relationship+cached) : Boolean - * [.resolve()](#Relationship+resolve) ⇒ Promise.<(Manga\|Author\|Chapter\|User\|Group\|List\|Cover)> - - - -### relationship.id : String -Id of the object this is a relationship to - -**Kind**: instance property of [Relationship](#Relationship) - - -### relationship.type : String -The type of the object this is a relationship to - -**Kind**: instance property of [Relationship](#Relationship) - - -### relationship.cached : Boolean -True if this relationship will instantly return with an included object instead of sending a request when resolve() is called - -**Kind**: instance property of [Relationship](#Relationship) - - -### relationship.resolve() ⇒ Promise.<(Manga\|Author\|Chapter\|User\|Group\|List\|Cover)> -This function must be called to return the proper and complete object representation of this relationship. Essentially, it calls and returns Manga.get(), Author.get(), Cover.get(), etc. - -**Kind**: instance method of [Relationship](#Relationship) - - -## APIRequestError -This error respresents when the API responds with an error or invalid response. In other words, this error represents 400 and 500 status code responses. - -**Kind**: global class - -* [APIRequestError](#APIRequestError) - * [new APIRequestError(reason, code, ...params)](#new_APIRequestError_new) - * [.OTHER](#APIRequestError+OTHER) : Number - * [.AUTHORIZATION](#APIRequestError+AUTHORIZATION) : Number - * [.INVALID_REQUEST](#APIRequestError+INVALID_REQUEST) : Number - * [.INVALID_RESPONSE](#APIRequestError+INVALID_RESPONSE) : Number - * [.code](#APIRequestError+code) : Number - * [.name](#APIRequestError+name) : String - * [.message](#APIRequestError+message) : String - - - -### new APIRequestError(reason, code, ...params) - -| Param | Type | Default | Description | -| --- | --- | --- | --- | -| reason | String \| Object | Unknown Request Error | An error message or response from the API | -| code | Number | 0 | | -| ...params | any | | | - - - -### apiRequestError.OTHER : Number -**Kind**: instance property of [APIRequestError](#APIRequestError) - - -### apiRequestError.AUTHORIZATION : Number -**Kind**: instance property of [APIRequestError](#APIRequestError) - - -### apiRequestError.INVALID\_REQUEST : Number -**Kind**: instance property of [APIRequestError](#APIRequestError) - - -### apiRequestError.INVALID\_RESPONSE : Number -**Kind**: instance property of [APIRequestError](#APIRequestError) - - -### apiRequestError.code : Number -What type of error is this? AUTHORIZATION, INVALID_RESPONSE, etc. - -**Kind**: instance property of [APIRequestError](#APIRequestError) - - -### apiRequestError.name : String -**Kind**: instance property of [APIRequestError](#APIRequestError) - - -### apiRequestError.message : String -**Kind**: instance property of [APIRequestError](#APIRequestError) - - -## Tag -Represents a manga tag - -**Kind**: global class - -* [Tag](#Tag) - * [.cache](#Tag+cache) : [Array.<Tag>](#Tag) - * [.id](#Tag+id) : String - * [.localizedName](#Tag+localizedName) : [LocalizedString](#LocalizedString) - * [.localizedDescription](#Tag+localizedDescription) : [LocalizedString](#LocalizedString) - * [.group](#Tag+group) : String - * [.name](#Tag+name) : String - * [.description](#Tag+description) : String - - - -### tag.cache : [Array.<Tag>](#Tag) -A cached response from https://api.mangadex.org/manga/tag - -**Kind**: instance property of [Tag](#Tag) - - -### tag.id : String -Mangadex id of this tag - -**Kind**: instance property of [Tag](#Tag) - - -### tag.localizedName : [LocalizedString](#LocalizedString) -Name with different localization options - -**Kind**: instance property of [Tag](#Tag) - - -### tag.localizedDescription : [LocalizedString](#LocalizedString) -Description with different localization options - -**Kind**: instance property of [Tag](#Tag) - - -### tag.group : String -What type of tag group this tag belongs to - -**Kind**: instance property of [Tag](#Tag) - - -### tag.name : String -Name string based on global locale - -**Kind**: instance property of [Tag](#Tag) - - -### tag.description : String -Description string based on global locale - -**Kind**: instance property of [Tag](#Tag) - - -## UploadSession -Represents a chapter upload session https://api.mangadex.org/docs.html#tag/Upload - -**Kind**: global class - -* [UploadSession](#UploadSession) - * [new UploadSession(res)](#new_UploadSession_new) - * _instance_ - * [.id](#UploadSession+id) : String - * [.manga](#UploadSession+manga) : [Relationship](#Relationship) - * [.groups](#UploadSession+groups) : [Relationship](#Relationship) - * [.uploader](#UploadSession+uploader) : [Relationship](#Relationship) - * [.isCommitted](#UploadSession+isCommitted) : Boolean - * [.isProcessed](#UploadSession+isProcessed) : Boolean - * [.isDeleted](#UploadSession+isDeleted) : Boolean - * [.open](#UploadSession+open) : Boolean - * [.pages](#UploadSession+pages) : Array.<String> - * [.uploadPages(pages)](#UploadSession+uploadPages) ⇒ Promise.<Array.<String>> - * [.close()](#UploadSession+close) ⇒ Promise.<void> - * [.commit(chapterDraft, pageOrder)](#UploadSession+commit) ⇒ [Promise.<Chapter>](#Chapter) - * [.deletePage(...page)](#UploadSession+deletePage) ⇒ Promise.<void> - * _static_ - * [.open(manga, [...groups])](#UploadSession.open) ⇒ [UploadSession](#UploadSession) - * [.getCurrentSession()](#UploadSession.getCurrentSession) ⇒ [UploadSession](#UploadSession) \| null - - - -### new UploadSession(res) -There is no reason to directly create an upload session object. Use static methods, ie 'open()'. - - -| Param | Type | Description | -| --- | --- | --- | -| res | Object | API response | - - - -### uploadSession.id : String -Id of this upload session - -**Kind**: instance property of [UploadSession](#UploadSession) - - -### uploadSession.manga : [Relationship](#Relationship) -Relationship of the target manga - -**Kind**: instance property of [UploadSession](#UploadSession) - - -### uploadSession.groups : [Relationship](#Relationship) -Relationships to the groups attributed to this chapter - -**Kind**: instance property of [UploadSession](#UploadSession) - - -### uploadSession.uploader : [Relationship](#Relationship) -Relationship to the uploader (the current user) - -**Kind**: instance property of [UploadSession](#UploadSession) - - -### uploadSession.isCommitted : Boolean -Is this session commited? - -**Kind**: instance property of [UploadSession](#UploadSession) - - -### uploadSession.isProcessed : Boolean -Is this session processed? - -**Kind**: instance property of [UploadSession](#UploadSession) - - -### uploadSession.isDeleted : Boolean -Is this session deleted? - -**Kind**: instance property of [UploadSession](#UploadSession) - - -### uploadSession.open : Boolean -Is this session open for uploading pages? - -**Kind**: instance property of [UploadSession](#UploadSession) - - -### uploadSession.pages : Array.<String> -The ids of every page uploaded THIS session - -**Kind**: instance property of [UploadSession](#UploadSession) - - -### uploadSession.uploadPages(pages) ⇒ Promise.<Array.<String>> -Uploads pages through this upload session - -**Kind**: instance method of [UploadSession](#UploadSession) -**Returns**: Promise.<Array.<String>> - Returns the ids of every newly uploaded file - -| Param | Type | -| --- | --- | -| pages | Array.<PageFileObject> | - - - -### uploadSession.close() ⇒ Promise.<void> -Closes this upload session - -**Kind**: instance method of [UploadSession](#UploadSession) - - -### uploadSession.commit(chapterDraft, pageOrder) ⇒ [Promise.<Chapter>](#Chapter) -**Kind**: instance method of [UploadSession](#UploadSession) -**Returns**: [Promise.<Chapter>](#Chapter) - Returns the new chapter - -| Param | Type | Description | -| --- | --- | --- | -| chapterDraft | ChapterDraftObject | | -| pageOrder | Array.<String> | Array of file ids sorted by their proper order. Default is the upload order | - - - -### uploadSession.deletePage(...page) ⇒ Promise.<void> -Deletes an uploaded page via its upload file id. - -**Kind**: instance method of [UploadSession](#UploadSession) - -| Param | Type | -| --- | --- | -| ...page | String | - - - -### UploadSession.open(manga, [...groups]) ⇒ [UploadSession](#UploadSession) -Requests MD to start an upload session - -**Kind**: static method of [UploadSession](#UploadSession) - -| Param | Type | -| --- | --- | -| manga | String \| [Manga](#Manga) | -| [...groups] | String \| [Group](#Group) \| [Relationship](#Relationship) | - - - -### UploadSession.getCurrentSession() ⇒ [UploadSession](#UploadSession) \| null -Returns the currently open upload session for the logged in user. Returns null if there is no current session - -**Kind**: static method of [UploadSession](#UploadSession) - - -## convertLegacyId(type, ...ids) ⇒ Promise.<Array.<String>> -Converts old (pre v5, numeric ids) Mangadex ids to v5 ids. Any invalid legacy ids will be skipped by Mangadex when remapping, so call this function for each individual id if this is an issue. - -**Kind**: global function - -| Param | Type | Description | -| --- | --- | --- | -| type | 'group' \| 'manga' \| 'chapter' \| 'tag' | Type of id | -| ...ids | Number \| Array.<Number> | Array of ids to convert | - - - -## setGlobalLocale(newLocale) -Sets the global locaization for LocalizedStrings. Uses 2-letter Mangadex region codes. - -**Kind**: global function - -| Param | Type | -| --- | --- | -| newLocale | String | - - - -## login(username, password, [cacheLocation]) ⇒ Promise.<void> -Required for authorization https://api.mangadex.org/docs.html#operation/post-auth-login - -**Kind**: global function - -| Param | Type | Description | -| --- | --- | --- | -| username | String | | -| password | String | | -| [cacheLocation] | String | File location (or localStorage key for browsers) to store the persistent token IN PLAIN TEXT | - - - -## resolveArray(relationshipArray) ⇒ Promise -A shortcut for resolving all relationships in an array - -**Kind**: global function - -| Param | Type | -| --- | --- | -| relationshipArray | [Array.<Relationship>](#Relationship) | - -*Documentation created with [jsdoc2md](https://github.com/jsdoc2md/jsdoc-to-markdown)* - -## Browser - -Mangadex Full API works out of the box with [Browserify](https://browserify.org/) and does not require additional configuration. - -```bash -browserify yourproject.js > bundle.js -``` - -As for [Webpack](https://webpack.js.org/) and similar applications, Mangadex Full API is untested and may require additional configuration. -However, the only node-specific module used by the program is ```HTTPS```, so if that is substituted by something like [https-browserify](https://www.npmjs.com/package/https-browserify), there should be no issues. -The ```fs``` and ```Path``` modules are also included in ```auth.js```, but are only required for node environments and can be excluded for browsers. +# MangaDex Full API +An unofficial [MangaDex](https://www.mangadex.org) API built with the [official JSON API](https://api.mangadex.org/docs.html). + +[More Information](#Info) + +[![Version](https://img.shields.io/npm/v/mangadex-full-api.svg?style=flat)](https://www.npmjs.com/package/mangadex-full-api) +[![License](https://img.shields.io/github/license/md-y/mangadex-full-api.svg?style=flat)](https://github.com/md-y/mangadex-full-api/blob/master/LICENSE) +[![Downloads](https://img.shields.io/npm/dm/mangadex-full-api.svg?style=flat)](https://www.npmjs.com/package/mangadex-full-api) + +```bash +npm install mangadex-full-api +``` + +## Examples + +```javascript +const MFA = require('mangadex-full-api'); + +MFA.login('username', 'password123', './bin/.md_cache').then(() => { + MFA.Manga.search({ + title: 'isekai', + limit: Infinity // API Max is 100 per request, but this function accepts more + }).then(results => { + console.log(`There are ${results.length} manga with 'isekai' in the title:`); + results.forEach((elem, i) => console.log(`[${i + 1}] ${elem.title}`)); + }).catch(console.error); +}).catch(console.error); + +``` + +```javascript +const MFA = require('mangadex-full-api'); + +MFA.login('username', 'password123', './bin/.md_cache').then(async () => { + // Get a manga: + let manga = await MFA.Manga.getByQuery('Ancient Magus Bride'); + + // Get the manga's chapters: + let chapters = await manga.getFeed({ translatedLanguage: ['en'] }, true); + // True means that related objects are returned with the base request + // See Release 5.2.0 for more info: https://github.com/md-y/mangadex-full-api/releases/tag/5.2.0 + let chapter = chapters[0]; + + // Get the chapter's pages: + let pages = await chapter.getReadablePages(); + // Please read the following page if you are creating a chapter-reading application: + // https://api.mangadex.org/docs.html#section/Reading-a-chapter-using-the-API/Report + + // Get who uploaded the chapter: + let uploader = await chapter.uploader.resolve(); + + // Get the names of the groups who scanlated the chapter: + let resolvedGroups = await MFA.resolveArray(chapter.groups) // You can resolve Relationship arrays with this shortcut + let groupNames = resolvedGroups.map(elem => elem.name); + + console.log(`Manga "${manga.title}" has a chapter titled "${chapter.title}" that was uploaded by ${uploader.username} and scanlated by ${groupNames.join('and')}.`); + console.log(`Here is the first page: ${pages[0]}`); +}).catch(console.error); + +``` + +```javascript +/* + Upload a chapter with node modules: +*/ +const MFA = require('mangadex-full-api'); +const fs = require('fs'); +const path = require('path'); + +MFA.login('username', 'password123', './bin/.md_cache').then(async () => { + let currentSession = await MFA.Manga.getCurrentUploadSession(); + if (currentSession) { + await currentSession.close(); + console.log('Closed existing session.'); + } + + let mangaId = 'f9c33607-9180-4ba6-b85c-e4b5faee7192'; // Official test manga + let session = await MFA.Manga.createUploadSession(mangaId); + console.log('Created new upload session.'); + + let chapterDir = './chapter'; // Directory to retrieve page images + let files = fs.readdirSync(chapterDir) + await session.uploadPages(files.map(name => { + return { + data: fs.readFileSync(path.join(chapterDir, name)), // Buffer-like data + name: name // The name of this image + }; + })); + console.log('Uploaded pages.'); + + let chapter = await session.commit({ + chapter: '0', // Change chapter number + volume: null, // Change volume number + title: 'New Chapter', // Change chapter name + translatedLanguage: 'en' + }); + + console.log(`Uploaded new chapter at: https://mangadex.org/chapter/${chapter.id}`); +}).catch(console.error); + +``` + +```typescript +// TypeScript Example: +import MFA from 'mangadex-full-api'; +// You can also import directly like: +// import { Manga, login } from 'mangadex-full-api'; + +MFA.login('username', 'password123').then(async () => { + const query = 'Ancient Magus Bride'; + const list = await MFA.Manga.search({ title: query, limit: Infinity }); + console.log(list.length, 'results for', query); + console.log('The first result was written by', (await list[0].authors[0].resolve()).name); +}); +``` + +## Info + +* Requests will automatically be rate limited to about 5 requests/second. +* The entire package is typed thanks to JSDoc and the included ```index.d.ts``` file, so TypeScript is supported. +* If you are wondering why the documentation is no longer in the README, it became too difficult to maintain due to JSDoc issues. However, the examples and in-line JSDoc comments should (hopefully) be enough for using the package. Though, here is the [old documentation](https://github.com/md-y/mangadex-full-api/blob/5.5.1/README.md) +* The entire project is written as regular NodeJS with CommonJS imports/exports. As for browser support, see below: + +#### Browser + +Mangadex Full API works out of the box with [Browserify](https://browserify.org/) and does not require additional configuration. + +```bash +browserify yourproject.js > bundle.js +``` + +As for [Webpack](https://webpack.js.org/) and similar applications, Mangadex Full API is untested and may require additional configuration. +However, the only node-specific module used by the program is ```HTTPS```, so if that is substituted by something like [https-browserify](https://www.npmjs.com/package/https-browserify), there should be no issues. +The ```fs``` and ```Path``` modules are also included in ```auth.js```, but are only required for node environments and can be excluded for browsers.