@ablanc/nakanim-api 中文文档教程

发布于 4年前 浏览 24 项目主页 更新于 3年前

Nakanim API

npm 版本 构建状态 覆盖状态

Description

这是一个用 Typescript 编写的 Node.js 模块,包装了 http://www.nakanim.com API。

Installation

npm install @ablanc/nakanim-api

or

yarn add @ablanc/nakanim-api

Examples

在顶部,您必须包含包

Using Typescript
//index.ts
import { getAllAnimes, getAnime, getRandomAnime, getCalendar } from "@ablanc/nakanim-api";
Using Javascript
//index.js
const { getAllAnimes, getAnime, getRandomAnime, getCalendar } = require("@ablanc/nakanim-api");

然后,您可以使用不同的函数来访问 API:

async function example() {
  const animes = await getAllAnimes();
  const animeSpecific = await getAnime("6532362183218") // id of the anime (this one is incorrect)

  const randomAnime = await getRandomAnime(); // returns the random anime of the day
  const randomAnimeSpecific = await getRandomAnime("25/12/2019"); // returns the random anime for a specific date

  const calendar = await getCalendar(); // returns the calendar for the current week
  const calendarSpecific = await getCalendar("2019-12-23"); // returns the calendar for the given week (you must pass monday's date)
}

Tests

测试使用 Jest 框架运行。
<代码>$ npm 测试

Nakanim API

npm version build status Coverage Status

Description

This is a Node.js module written in Typescript that wraps http://www.nakanim.com API.

Installation

npm install @ablanc/nakanim-api

or

yarn add @ablanc/nakanim-api

Examples

On the top, you must include the package

Using Typescript
//index.ts
import { getAllAnimes, getAnime, getRandomAnime, getCalendar } from "@ablanc/nakanim-api";
Using Javascript
//index.js
const { getAllAnimes, getAnime, getRandomAnime, getCalendar } = require("@ablanc/nakanim-api");

Then, you can use the different functions to access the API :

async function example() {
  const animes = await getAllAnimes();
  const animeSpecific = await getAnime("6532362183218") // id of the anime (this one is incorrect)

  const randomAnime = await getRandomAnime(); // returns the random anime of the day
  const randomAnimeSpecific = await getRandomAnime("25/12/2019"); // returns the random anime for a specific date

  const calendar = await getCalendar(); // returns the calendar for the current week
  const calendarSpecific = await getCalendar("2019-12-23"); // returns the calendar for the given week (you must pass monday's date)
}

Tests

Tests are run using Jest framework.
$ npm test

    我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
    原文