-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathanimist.d.ts
80 lines (80 loc) · 2.03 KB
/
animist.d.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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
export default class Animist {
private id;
private secret;
private authInfo;
/**
* Create a new Animist instance with the passed id and secret.
*
* ### Examples
*
* Create a new Animist instance using the obtained id and secret:
*
* ~~~
* import Animist from "animist";
*
* const animist = new Animist(id, secret);
* ~~~
*
* @param {string} id The client id gotten from AniList developer settings
* @param {string} secret The client secret gotten from AniList developer
* settings
* @public
*/
constructor(id: string, secret: string);
/**
* Perform a get request to the AniList Api using the given route and passed
* parameters
*
* ### Examples
*
* Get an array of anime using the browse anime endpoint:
*
* ~~~
* import Animist from "animist";
*
* const animist = new Animist(process.env.ID, process.env.SECRET);
*
* let response;
*
* try {
* response = await animist.get("browse/anime", {
* airing_data: true,
* full_page: true,
* season: "winter",
* sort: "popularity-desc",
* status: "finished airing",
* type: 'TV',
* });
* } catch (e) {
* // Handle error
* }
*
* // Do something with the response
* ~~~
*
* Search for a character by a name:
*
* ~~~
* import Animist from "animist";
*
* const animist = new Animist(process.env.ID, process.enc.SECRET);
*
* let response;
*
* try {
* response = await animist.get(`character/search/${query}`;
* } catch(e) {
* // Handle error
* }
*
* // Do something with the response
* ~~~
*
* @param {string} route The route for the request
* @param {Object} urlParams The desired url parameters for the request
* @returns {Promise<any>}
* @public
*/
get(route: string, urlParams: object): Promise<any>;
private authenticate();
}