deno.land / x / anilist_js@0.1.0 / src / people.ts

نووسراو ببینە
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
import { req } from './utils/req.ts';import { character as chara_query } from '../graphql/character.ts';import { staff as staff_query } from '../graphql/staff.ts';
/** * Sub class for people related functions * @since 1.0.0 * @memberof Anilist */export class People { /** * Fetch a character based on character id * @since 1.0.0 * @param {number} id * @returns {Character} Character */ async character(id: number) { if (!id || typeof id !== 'number') { throw new TypeError( 'Argument id is required and must be a number', ); } return await req({ query: chara_query, variables: { id: id, }, }) .then((body) => body.Character); } /** * Fetch a staff based on staff id * @since 1.0.0 * @param {number} id * @returns {Staff} Staff */ async staff(id: number) { if (!id || typeof id !== 'number') { throw new TypeError( 'Argument id is required and must be a number', ); } return await req({ query: staff_query, variables: { id: id, }, }) .then((body) => body.Staff); }}
anilist_js

Version Info

Tagged at
a year ago

External Dependencies

No external dependencies 🎉