Skip to content

Commit

Permalink
Merge pull request #7 from LuckyYam/v3.0.0
Browse files Browse the repository at this point in the history
Marika now supports all the jikan methods
  • Loading branch information
LuckyYam authored Sep 23, 2023
2 parents 25bb06d + c433458 commit 12b6976
Show file tree
Hide file tree
Showing 65 changed files with 3,686 additions and 2,218 deletions.
41 changes: 41 additions & 0 deletions .github/workflows/docs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
name: Docs workflow

on:
push:
branches:
- main
jobs:
Build:
runs-on: ubuntu-latest
outputs:
package-name: ${{ steps.packageInfo.outputs.package-name }}
package-version: ${{ steps.packageInfo.outputs.package-version }}
commit-msg: ${{ steps.packageInfo.outputs.commit-msg }}
# Steps represent a sequence of tasks that will be executed as part of the job
steps:
- name: Checkout Commit
uses: actions/checkout@v2

- name: Parsing Package Info
id: packageInfo
run: |
echo "::set-output name=package-name::$(jq -r .name package.json)"
echo "::set-output name=package-version::$(jq -r .version package.json)"
echo "::set-output name=commit-msg::$(git log -1 --pretty=%B)"
- name: Setup Node.js environment
uses: actions/setup-node@v2.1.1

- name: Install Dependencies
run: yarn install

- name: Docs Build
run: yarn docs

- name: Publish to Pages
uses: crazy-max/ghaction-github-pages@v2
with:
target_branch: gh-pages
build_dir: docs
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -101,3 +101,4 @@ dist
# TernJS port file
.tern-port

docs
9 changes: 0 additions & 9 deletions .npmignore

This file was deleted.

146 changes: 48 additions & 98 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
<div align=center>
<a href="https://github.com/ShineiIchijo/Marika"><img src="https://wallpapermemory.com/uploads/816/marika-tachibana-wallpaper-hd-1920x1080-323797.jpg" alt="chitoge" border="0"></a>
<a href="https://github.com/LuckyYam/Marika"><img src="https://wallpapermemory.com/uploads/816/marika-tachibana-wallpaper-hd-1920x1080-323797.jpg" alt="I Love Chitoge more tbh" border="0"></a>

# Marika

[![NPM](https://img.shields.io/badge/Available%20On-NPM-lightgrey.svg?logo=npm&logoColor=339933&labelColor=white&style=flat-square)](https://www.npmjs.com/package/@shineiichijo/marika)

A promise based API wrapper for the unofficial [MyAnimeList API](https://jikan.moe/)
A promise based API wrapper for the unofficial [MyAnimeList API](https://docs.api.jikan.moe/)

[Documentation](https://luckyyam.github.io/Marika/)

</div>

Expand All @@ -19,111 +21,59 @@ npm i @shineiichijo/marika
yarn add @shineiichijo/marika
```

## 🚀 Importing
## 🚀 Usage Examples

```ts
import { Anime, Character, Manga } from "@shineiichijo/marika"; // const { Anime, Character, Manga } = require("@shineiichijo/marika")
const animeClient = new Anime();
const charaClient = new Character();
const mangaClient = new Manga();
import { Marika } from '@shineiichijo/marika'

;(async () => {
const { anime } = new Marika()
await anime.getAnimeById(1)
.then(console.log)
.catch(console.error)
})()
```

### 💙 Anime Methods

```ts
await animeClient.getRandomAnime(); //will return random anime with info

await animeClient.getAnimeById(id); //will return the info of the given anime id

await animeClient.getAnimeFullById(id) //will return the complete info of the given anime id

await animeClient.getAnimeCharacters(id); //will return characters of the given anime id

await animeClient.getAnimeStaff(id); //will return staff list for the given anime id

await animeClient.getAnimeEpisodes(id); //will return episodes list of the given anime id. You can also query the page. Example: await animeClient.getAnimeEpisodes(id, { query: page_number })

await animeClient.getAnimeEpisodeById(id, { query: episode_number }); //will return the info of the given anime id episode

await animeClient.getAnimeNews(id); //will return the list of anime news for the given anime id. You can also query the page. Example: await animeClient.getAnimeNews(id, { query: page_number })

await animeClient.getAnimeForum(id); //will return the forum of the given anime id. You can also select the filter. Example: await animeClient.getAnimeForum(id, { filter: "episode" }). You can check the filters here - https://github.com/ShineiIchijo/Marika/blob/main/src/typings/searchOptions.ts#L85

await animeClient.getAnimeVideos(id); //will return the list of videos for the given anime id

await animeClient.getAnimePictures(id); //will return pictures of the given anime id

await animeClient.getAnimeStats(id); //will return the stats for the given anime id

await animeClient.getAnimeRecommendations(id); //will return recommendations of the given anime id

await animeClient.getAnimeMoreInfo(id); //will return more info for the given anime id

await animeClient.getAnimeUserUpdates(id); //will return user updates of the given anime id. You can also query the page. Example: await animeClient.getAnimeUserUpdates(id, { query: page_number })

await animeClient.getAnimeReviews(id); //will return reviews of the given anime id. You can also query the page. Example: await animeClient.getAnimeReviews(id, { query: page_number })

await animeClient.getAnimeRelations(id); //will return relations of the given anime id

await animeClient.getAnimeThemes(id); //will return themes of the given anime id

await animeClient.getAnimeExternals(id); //will return externals of the given anime id

await animeClient.searchAnime(query); //will search the given anime title. You can pass several options. You can check it out at here - https://github.com/ShineiIchijo/Marika/blob/main/src/typings/searchOptions.ts#L1

await animeClient.getTopAnime(); //will return list for the ranking of anime in MyAnimeList. You can also query the page. Example - await animeClient.getTopAnime({ query: page_number })
import { Manga } from '@shineiichijo/marika'

;(async () => {
const manga = new Manga()
await manga.getMangaSearch({ q: 'Nisekoi', page: 1, genres: [22, 4], limit: 1 })
.then(console.log)
.catch(console.error)
})()
```

### 💚 Manga Methods

```ts
await mangaClient.getRandomManga(); //will return random manga with info

await mangaClient.getMangaById(id); //will return the info of the given manga id

await mangaClient.getMangaCharacters(id); //will return characters of the given manga id

await mangaClient.getMangaNews(id); //will return news of the given manga id. You can also query the page. Example: await mangaClient.getMangaNews(id, { query: page_number })

await mangaClient.getMangaTopics(id); //will return topics of the given Manga ID

await mangaClient.getMangaPictures(id); //will return pictures of the given manga id

await mangaClient.getMangaStats(id); //will return the stats for the given manga id

await mangaClient.getMangaMoreInfo(id); //will return more info for the given manga id

await mangaClient.getMangaRecommendations(id); //will rerturn recommendations of the given manga id

await mangaClient.getMangaUserUpdates(id); //will return user updates of the given manga id. You can also query the page. Example: await mangaClient.getMangaUserUpdates(id, { query: page_number })

await mangaClient.getMangaReviews(id); //will return reviews of the given manga id. You can also query the page. Example: await mangaClient.getMangaReviews(id, { query: page_number })

await mangaClient.getMangaRelations(id); //will return relations of the given manga id

await mangaClient.getMangaExternal(id); //will return external of the given manga id

await mangaClient.searchManga(query); //will search the given manga. You can pass several options. You can check it out at here - https://github.com/ShineiIchijo/Marika/blob/main/src/typings/searchOptions.ts#L27

await mangaClient.getTopManga(); //will return list for ranking of manga in MyAnimeList. You can also query the page. Example - await mangaClient.getTopManga({ query: page_number })
import { Marika, AnimeSeasons, AnimeTypes } from '@shineiichijo/marika'

;(async () => {
const { seasons } = new Marika()
await seasons.getSeason(2023, AnimeSeasons['FALL'], { sfw: true, filter: AnimeTypes['TV'] })
.then(console.log)
.catch(console.error)
})()
```

### 🤍 Character Methods

```ts
await charaClient.getRandomCharacter(); //will return random anime character with info

await charaClient.getCharacterById(id); //will return the info for the given character id

await charaClient.getCharacterManga(id); //will return the manga for the given character id

await charaClient.getCharacterAnime(id); //will return the anime for the given character id

await charaClient.getCharacterVoiceActors(id); //will return the voice actors of the given character id

await charaClient.getCharacterPictures(id); //will return pictures of the given character id

await charaClient.searchCharacter(query); //will search the given character. You can also pass several options. You can check it out at here - https://github.com/ShineiIchijo/Marika/blob/main/src/typings/searchOptions.ts#L19

await charaClient.getTopCharacters(); //will return ranking of characters in MyAnimeList. You can also query the page. Example - await charaClient.getTopCharacters({ query: page_number })
import { Characters } from '@shineiichijo/marika'

;(async () => {
const characters = new Characters()
await characters.getCharacterFullById(66597)
.then(console.log)
.catch(console.error)
})()
```

```ts
import { Marika, Days } from '@shineiichijo/marika'

;(async () => {
const { schedules } = new Marika()
await schedules.getSchedules({ filter: Days['MONDAY'] })
.then(console.log)
.catch(console.error)
})()
```
33 changes: 20 additions & 13 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,18 +1,23 @@
{
"name": "@shineiichijo/marika",
"version": "2.0.6",
"version": "3.0.0",
"description": "An API wrapper for the unofficial MyAnimeList API jikan.moe v4",
"main": "dist/index.js",
"types": "dist/index.d.ts",
"dependencies": {
"axios": "^0.27.2"
"axios": "^1.5.0",
"axios-cache-interceptor": "^1.3.0"
},
"files": [
"dist"
],
"scripts": {
"build": "yarn rimraf dist/ && yarn tsc",
"build": "yarn rimraf dist/ && yarn tsc && yarn docs",
"lint": "eslint . --ignore-path .gitignore --ext .ts",
"lint:fix": "eslint . --ignore-path .gitignore --ext .ts --fix",
"format": "prettier --write --config .prettierrc.json \"src/**/*.ts\"",
"prepack": "yarn build"
"format": "yarn prettier --write --config .prettierrc.json \"src/**/*.ts\"",
"prepack": "yarn build",
"docs": "yarn typedoc"
},
"repository": {
"type": "git",
Expand All @@ -37,13 +42,15 @@
},
"homepage": "https://github.com/LuckyYam/Marika",
"devDependencies": {
"@types/mocha": "^9.1.0",
"@types/node": "^17.0.17",
"@typescript-eslint/eslint-plugin": "^5.10.2",
"@typescript-eslint/parser": "^5.10.2",
"eslint": "^8.8.0",
"mocha": "^9.2.0",
"ts-node": "^10.4.0",
"typescript": "^4.5.5"
"@types/mocha": "^10.0.1",
"@types/node": "^20.6.2",
"@typescript-eslint/eslint-plugin": "^6.7.2",
"@typescript-eslint/parser": "^6.7.2",
"eslint": "^8.49.0",
"mocha": "^10.2.0",
"prettier": "^3.0.3",
"ts-node": "^10.9.1",
"typedoc": "^0.25.1",
"typescript": "^5.2.2"
}
}
29 changes: 29 additions & 0 deletions src/constants/anime.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
export enum AnimeTypes {
TV = 'TV',
MOVIE = 'Movie',
SPECIAL = 'Special',
OVA = 'OVA',
ONA = 'ONA',
MUSIC = 'Music'
}

export enum Ratings {
/** G - All Ages */
G = 'g',
/** PG - Children */
PG = 'pg',
/** PG-13 - Teens 13 or older */
PG_13 = 'pg13',
/** R - 17+ (violence & profanity) */
R_17 = 'r17',
/** R+ - Mild Nudity */
R = 'r',
/** Rx - Hentai */
RX = 'rx'
}

export enum AnimeStatus {
AIRING = 'airing',
COMPLETE = 'complete',
UPCOMING = 'upcoming'
}
20 changes: 20 additions & 0 deletions src/constants/clubs.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
export enum ClubAccess {
PUBLIC = 'public',
PRIVATE = 'private',
SECRET = 'secret'
}

export enum ClubCategories {
ANIME = 'anime',
MANGA = 'manga',
ACTORS_AND_ARTISTS = 'actors_and_artists',
CHARACTERS = 'characters',
CITIES_AND_NEIGHBORHOODS = 'cities_and_neighborhoods',
COMPANIES = 'companies',
CONVENTIONS = 'conventions',
GAMES = 'games',
JAPAN = 'japan',
MUSIC = 'music',
OTHER = 'other',
SCHOOLS = 'schools'
}
6 changes: 6 additions & 0 deletions src/constants/genres.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
export enum GenresFilter {
GENRES = 'genres',
EXPLICIT_GENRES = 'explicit_genres',
THEMES = 'themes',
DEMOGRAPHICS = 'demographics'
}
21 changes: 21 additions & 0 deletions src/constants/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
export const API_URL = 'https://api.jikan.moe/v4'

export enum Sorting {
DESCENDING = 'desc',
ASCENDING = 'asc'
}

export enum Forums {
ALL = 'all',
EPISODE = 'episode',
OTHER = 'other'
}

export * from './anime'
export * from './clubs'
export * from './genres'
export * from './manga'
export * from './schedules'
export * from './seasons'
export * from './users'
export * from './top'
17 changes: 17 additions & 0 deletions src/constants/manga.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
export enum MangaTypes {
Manga = 'manga',
Novel = 'novel',
'Light Novel' = 'lightnovel',
'One-shot' = 'oneshot',
Doujin = 'doujin',
Manhwa = 'manhwa',
Manhua = 'manhua'
}

export enum MangaStatus {
PUBLISHING = 'publishing',
COMPLETE = 'complete',
HIATUS = 'hiatus',
DISCONTINUED = 'discontinued',
UPCOMING = 'upcoming'
}
9 changes: 9 additions & 0 deletions src/constants/schedules.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
export enum Days {
MONDAY = 'monday',
TUESDAY = 'tuesday',
WEDNESDAY = 'wednesday',
THURSDAY = 'thursday',
FRIDAY = 'friday',
SATURDAY = 'saturday',
SUNDAY = 'sunday'
}
Loading

0 comments on commit 12b6976

Please # to comment.