Skip to content

akrossu/Taki-MAL-API-Wrapper

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Version Code-Size Issues CodeCoverage License

  Taki is a simple MAL API wrapper made for Kumiko as none of the API wrappers I found were neither as fast, or as streamlined as I would have liked them. This is my first interaction with node's Fetch API, json querying, jest, environment variables, and propper workflow Actions. With all of that listed, I don't know what I don't know and if there's any improvements as I develop this wrapper, please say so!

Table of Contents

Gettings Started

Creating your MAL Client ID

This is incredibly simple, all you have to do is head here. Inline with the section heading "Clients Accessing the MAL API", click the "Create ID" button. Once the required information has been filled out, all there is to do is agree to the license and click submit!

Now to find your Client ID, again under the section header "Clients Accessing the MAL API", click "Edit" and your Client ID will be listed there for you to copy and do whatever you will with it.

A more detailed post can be found here.

Installation

Since I am not yet done, if you would like to install it, you will have to do so manually

  • Download the latest release
  • Run: npm install [your-file-location]/taki-{version}.tgz
    • Example: npm install ../../downloads/myfolder/taki-0.1.0.tgz

Constructors

Taki(nApiKey: string): Taki

Remeber, When interacting with anime data, you MUST set your client key!

We will also assume that this call to the constructor exists in all of the rest of the provided examples.

const Taki = require('../taki/index.js');
require("dotenv").config();

// Honestly you could just copy/paste it lol
new Taki(process.env.CLIENT_KEY);

Methods

Taki.getAnimeInfo(param: string | number, fields?: string | undefined): Promise<any>

Returns an Anime Info Data Model

/**
 * Gets anime info of a provided ID or from a full-length MAL URL
 * @param {string|number} param - Anime ID or MAL webpage URL
 * @param {string} [fields] - Optional argument that if specified, by default will return
 *     `{id, title, main_picture}`, but if not, returns ALL avaliable fields
 * @returns {Promise} Anime Info Model Json Object
 */

Taki.searchAnime(animeName: string): Promise<any>

Returns an array of the Anime Info Data Models

 /**
 * Searches for an anime on a best-match case
 * @param {string} animeName
 * @param {number} [limit=10] limitvalue
 * @returns {Promise} Array of the Anime Info Model Json Data Object
 */

Taki.getAnimeRanking(): Promise<any>

Returns an Anime Ranking Model

/**
 * Get the current top anime
 * @param {string} [rankingType='all'] rankingType
 * @param {number} [limit=10] limit
 * @returns {Promise} Anime Ranking Json Data Object
 */

Taki.getSeason(nSeason: any, year: number): Promise<any>

Returns an Anime Season Data Models

/**
 * Gets Anime from a specified season and year
 * @param {string} season 
 * @param {number} year 
 * @param {number} [limit=10] limit
 * @returns {Promise} Anime Season Model Json Data Object
 */

Taki.getMangaInfo(param: string | number, fields?: string | undefined): Promise<any>

Returns a Manga Info Model

/**
 * Gets manga info of a provided ID or from a full-length MAL URL
 * @param {string|number} param  - Manga ID or MAL webpage URL
 * @param {string} [fields] - Optional argument that if specified, by default will return
 *     `{id, title, main_picture}`, but if not, returns ALL avaliable fields
 * @returns {Promise} Manga Info Model Json Data Object
 */

Taki.searchManga(mangaName: string): Promise<any>

Returns an array of the Manga Info Model

/**
 * Searches for a manga on a best-match case
 * @param {string} mangaName 
 * @param {number} [limit=10] limit
 * @returns {Promise} Array of the Manga Info Model Json Data Object
 */

Taki.getMangaRanking(): Promise<any>

Returns a Manga Ranking Model

/**
 * Get the current top manga
 * @param {string} [rankingType='all'] rankingType
 * @param {number} [limit=10] limit
 * @returns {Promise} Manga Ranking Json Data Object
 */

Taki.getWatchList(user: string): Promise<any>

Returns a User's Anime List Model

/**
 * Retrieves a user's watched anime list
 * @param {string} user
 * @param {number} [limit=10] limit
 * @param {string} [status='watching'] status
 * @param {string} [sort='list_score'] sort
 * @returns {Promise} User Anime List Json Data Object
 */

Taki.getReadList(user: string): Promise<any>

Returns a User's Manga List Model

Will support custom arguments soon

/**
 * Retrieves a user's read manga list
 * @param {string} user 
 * @returns {Promise} User Manga List Json Data Object
 */

Data Models

To view a specific data model on the MAL API page, under "Responses", selecting "200 OK" to open the drop down, we can find all of the the accessable data provided by the default queries.

Anime

Manga

User

License

MIT License

Copyright (c) 2023 Akross