aniql 1.2.0 → 1.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.ts +39 -2
- package/dist/index.js +4 -4
- package/package.json +4 -3
package/dist/index.d.ts
CHANGED
|
@@ -23,9 +23,37 @@ export type AniQLOptions = ClientOptions & {
|
|
|
23
23
|
export type AniQLRequestOptions = {
|
|
24
24
|
token?: string;
|
|
25
25
|
};
|
|
26
|
+
/**
|
|
27
|
+
* AniQLClientError is an error class for errors that occur in the AniQL client.
|
|
28
|
+
*
|
|
29
|
+
* It extends the built-in Error class and includes a status code.
|
|
30
|
+
*/
|
|
31
|
+
export declare class AniQLClientError extends Error {
|
|
32
|
+
status: number;
|
|
33
|
+
constructor(status: number, message: string);
|
|
34
|
+
}
|
|
35
|
+
export type RateLimitData = {
|
|
36
|
+
limit: number;
|
|
37
|
+
remaining: number;
|
|
38
|
+
reset: number;
|
|
39
|
+
};
|
|
40
|
+
export interface AniQLClientEvents {
|
|
41
|
+
rate_limit: Array<(data: RateLimitData) => Awaitable<any>>;
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* AniQLClient is a client for interacting with the AniList GraphQL API.
|
|
45
|
+
* It allows you to perform queries and mutations against the AniList API.
|
|
46
|
+
* You can also get the login URL to authenticate users.
|
|
47
|
+
*
|
|
48
|
+
* The client will automatically include the token, if provided via options, in the Authorization header for requests.
|
|
49
|
+
*
|
|
50
|
+
* For documentation on the AniList API, see https://docs.anilist.co/
|
|
51
|
+
*/
|
|
26
52
|
export declare class AniQLClient {
|
|
27
|
-
|
|
53
|
+
#private;
|
|
28
54
|
static base_url: string;
|
|
55
|
+
rate_limit: RateLimitData;
|
|
56
|
+
on<K extends keyof AniQLClientEvents>(event: K, listener: AniQLClientEvents[K][number]): this;
|
|
29
57
|
constructor(opts: AniQLOptions);
|
|
30
58
|
query<R extends QueryGenqlSelection>(request: R & {
|
|
31
59
|
__name?: string;
|
|
@@ -33,7 +61,16 @@ export declare class AniQLClient {
|
|
|
33
61
|
mutation<R extends MutationGenqlSelection>(request: R & {
|
|
34
62
|
__name?: string;
|
|
35
63
|
}, opts?: AniQLRequestOptions): Promise<FieldsSelection<Mutation, R>>;
|
|
36
|
-
|
|
64
|
+
make_query: <R extends QueryGenqlSelection>(request: R & {
|
|
65
|
+
__name?: string;
|
|
66
|
+
}) => R & {
|
|
67
|
+
__name?: string;
|
|
68
|
+
};
|
|
69
|
+
make_mutation: <R extends MutationGenqlSelection>(request: R & {
|
|
70
|
+
__name?: string;
|
|
71
|
+
}) => R & {
|
|
72
|
+
__name?: string;
|
|
73
|
+
};
|
|
37
74
|
get auth_url(): string;
|
|
38
75
|
auth_exchange(code: string): Promise<{
|
|
39
76
|
access_token: string;
|