aniql 1.0.1 → 1.2.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 +34 -25
- package/dist/index.js +4 -4
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -1,36 +1,45 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import type
|
|
1
|
+
import type { FieldsSelection, Mutation, MutationGenqlSelection, Query, QueryGenqlSelection } from './genql';
|
|
2
|
+
import { type ClientOptions } from './genql/runtime';
|
|
3
3
|
/** Represents a value that can be awaited. */
|
|
4
|
-
type Awaitable<T> = Promise<T> | T;
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
4
|
+
export type Awaitable<T> = Promise<T> | T;
|
|
5
|
+
interface AniQLAuthBase {
|
|
6
|
+
client_id: number;
|
|
7
|
+
}
|
|
8
|
+
interface AniQLAuthResCode extends AniQLAuthBase {
|
|
9
|
+
response_type: 'code';
|
|
10
|
+
client_secret: string;
|
|
11
|
+
redirect_uri: string;
|
|
12
|
+
}
|
|
13
|
+
interface AniQLAuthResToken extends AniQLAuthBase {
|
|
14
|
+
response_type: 'token';
|
|
15
|
+
}
|
|
16
|
+
export type AniQLAuth = AniQLAuthResCode | AniQLAuthResToken;
|
|
9
17
|
/** Options for the AniQL client. */
|
|
10
|
-
type AniQLOptions = ClientOptions & {
|
|
18
|
+
export type AniQLOptions = ClientOptions & {
|
|
19
|
+
auth: AniQLAuth;
|
|
11
20
|
get_token?: () => Awaitable<string | undefined>;
|
|
12
21
|
};
|
|
13
|
-
/**
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
*
|
|
20
|
-
* For documentation on the AniList API, see https://docs.anilist.co/
|
|
21
|
-
*/
|
|
22
|
-
declare class AniQLClient {
|
|
23
|
-
#private;
|
|
24
|
-
client_id: number;
|
|
22
|
+
/** Options for the request made by the AniQL client. */
|
|
23
|
+
export type AniQLRequestOptions = {
|
|
24
|
+
token?: string;
|
|
25
|
+
};
|
|
26
|
+
export declare class AniQLClient {
|
|
27
|
+
_opts: AniQLOptions;
|
|
25
28
|
static base_url: string;
|
|
26
|
-
constructor(
|
|
29
|
+
constructor(opts: AniQLOptions);
|
|
27
30
|
query<R extends QueryGenqlSelection>(request: R & {
|
|
28
31
|
__name?: string;
|
|
29
|
-
}): Promise<
|
|
32
|
+
}, opts?: AniQLRequestOptions): Promise<FieldsSelection<Query, R>>;
|
|
30
33
|
mutation<R extends MutationGenqlSelection>(request: R & {
|
|
31
34
|
__name?: string;
|
|
32
|
-
}): Promise<
|
|
33
|
-
|
|
35
|
+
}, opts?: AniQLRequestOptions): Promise<FieldsSelection<Mutation, R>>;
|
|
36
|
+
_fetcher(_token?: string): import("./genql/runtime/fetcher").Fetcher;
|
|
37
|
+
get auth_url(): string;
|
|
38
|
+
auth_exchange(code: string): Promise<{
|
|
39
|
+
access_token: string;
|
|
40
|
+
token_type: string;
|
|
41
|
+
expires_in: number;
|
|
42
|
+
refresh_token: string;
|
|
43
|
+
}>;
|
|
34
44
|
}
|
|
35
45
|
export * from './genql';
|
|
36
|
-
export { AniQLClient, type AniQLOptions, type Awaitable, type Prettify };
|