-
Notifications
You must be signed in to change notification settings - Fork 60
/
autosolve-client.d.ts
68 lines (61 loc) · 1.76 KB
/
autosolve-client.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
declare module 'autosolve-client';
type Stringify<T> = string;
type AutoSolveCancelProps = Stringify<{
taskId: string;
siteKey: string;
}>;
type AutoSolveResponseProps = Stringify<{
taskId: string;
token: string;
createdAt: string;
request: any; // loosely type this for now...
}>;
type AutoSolveErrorProps = Stringify<{
type: string;
event: any; // loosely type this for now...
}>;
interface AutoSolve {
init: () => Promise<this>;
ee: AutoSolveEventEmitter;
cancelAllRequests: () => void;
errors: {
INVALID_ACCESS_TOKEN: 'Invalid access token';
INVALID_CLIENT_ID: 'Invalid client ID';
INVALID_API_OR_ACCESS_TOKEN: 'Invalid API Key or Access Token';
TOO_MANY_REQUESTS: 'Too many requests are being attempted. Cooling down';
CONNECTION_ERROR_INIT: 'Connection error when initializing. Please retry';
CONNECTION_ERROR: 'Error establishing connection';
CHANNEL_ERROR: 'Error creating channel';
EXCHANGE_ERROR: 'Error asserting rabbit exchange';
QUEUE_ERROR: 'Error asserting queue';
BINDING_ERROR: 'Error binding queue to exchange';
MESSAGE_RECEIEVE_ERROR: 'Error receiving message';
SEND_TOKEN_REQUEST_ERROR: 'Send token request error';
UNKNOWN_ERROR: 'An unknown error occured';
};
}
type AutoSolveProps = {
autoSolve: any;
id: string;
url: string;
proxy?: string;
siteKey: string;
version: string;
action?: string;
renderParameters?: any;
platform?: string;
};
interface AutoSolveEventEmitter {
on(
event: 'AutoSolveResponse',
listener: (data: AutoSolveResponseProps) => void
): this;
on(
event: 'AutoSolveResponse_Cancel',
listener: (data: AutoSolveCancelProps) => void
): this;
on(
event: 'AutoSolveError',
listener: (data: AutoSolveErrorProps) => void
): this;
}