@acedatacloud/sdk 2026.805.0 → 2026.807.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.mts +40 -0
- package/dist/index.d.ts +40 -0
- package/dist/index.js +62 -5
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +62 -5
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
- package/src/client.ts +3 -0
- package/src/resources/captcha.ts +66 -0
- package/src/resources/tasks.ts +1 -0
package/package.json
CHANGED
package/src/client.ts
CHANGED
|
@@ -4,6 +4,7 @@ import { Transport, TransportOptions } from './runtime/transport';
|
|
|
4
4
|
import type { PaymentHandler } from './runtime/payment';
|
|
5
5
|
import { AiChat } from './resources/aichat';
|
|
6
6
|
import { Chat } from './resources/chat';
|
|
7
|
+
import { Captcha } from './resources/captcha';
|
|
7
8
|
import { Images } from './resources/images';
|
|
8
9
|
import { Audio } from './resources/audio';
|
|
9
10
|
import { Video } from './resources/video';
|
|
@@ -38,6 +39,7 @@ export interface AceDataCloudOptions {
|
|
|
38
39
|
export class AceDataCloud {
|
|
39
40
|
readonly aichat: AiChat;
|
|
40
41
|
readonly chat: Chat;
|
|
42
|
+
readonly captcha: Captcha;
|
|
41
43
|
readonly images: Images;
|
|
42
44
|
readonly audio: Audio;
|
|
43
45
|
readonly video: Video;
|
|
@@ -68,6 +70,7 @@ export class AceDataCloud {
|
|
|
68
70
|
|
|
69
71
|
this.aichat = new AiChat(this.transport);
|
|
70
72
|
this.chat = new Chat(this.transport);
|
|
73
|
+
this.captcha = new Captcha(this.transport);
|
|
71
74
|
this.images = new Images(this.transport);
|
|
72
75
|
this.audio = new Audio(this.transport);
|
|
73
76
|
this.video = new Video(this.transport);
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
/** Captcha resources (`/captcha/*`). */
|
|
2
|
+
|
|
3
|
+
import { Transport } from '../runtime/transport';
|
|
4
|
+
|
|
5
|
+
class Recognition {
|
|
6
|
+
constructor(private transport: Transport) {}
|
|
7
|
+
|
|
8
|
+
hcaptcha(opts: {
|
|
9
|
+
queries?: string[];
|
|
10
|
+
question?: string;
|
|
11
|
+
async?: boolean;
|
|
12
|
+
[key: string]: unknown;
|
|
13
|
+
} = {}): Promise<Record<string, unknown>> {
|
|
14
|
+
const { queries, question, ...rest } = opts;
|
|
15
|
+
const body: Record<string, unknown> = { ...rest };
|
|
16
|
+
if (queries !== undefined) body.queries = queries;
|
|
17
|
+
if (question !== undefined) body.question = question;
|
|
18
|
+
return this.transport.request('POST', '/captcha/recognition/hcaptcha', { json: body });
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
class Token {
|
|
23
|
+
constructor(private transport: Transport) {}
|
|
24
|
+
|
|
25
|
+
hcaptcha(opts: {
|
|
26
|
+
websiteKey: string;
|
|
27
|
+
websiteUrl: string;
|
|
28
|
+
rqdata?: string;
|
|
29
|
+
proxy?: string;
|
|
30
|
+
async?: boolean;
|
|
31
|
+
[key: string]: unknown;
|
|
32
|
+
}): Promise<Record<string, unknown>> {
|
|
33
|
+
const { websiteKey, websiteUrl, rqdata, proxy, ...rest } = opts;
|
|
34
|
+
const body: Record<string, unknown> = {
|
|
35
|
+
website_key: websiteKey,
|
|
36
|
+
website_url: websiteUrl,
|
|
37
|
+
...rest,
|
|
38
|
+
};
|
|
39
|
+
if (rqdata !== undefined) body.rqdata = rqdata;
|
|
40
|
+
if (proxy !== undefined) body.proxy = proxy;
|
|
41
|
+
return this.transport.request('POST', '/captcha/token/hcaptcha', { json: body });
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
class Tasks {
|
|
46
|
+
constructor(private transport: Transport) {}
|
|
47
|
+
|
|
48
|
+
retrieve(opts: { taskId: string; [key: string]: unknown }): Promise<Record<string, unknown>> {
|
|
49
|
+
const { taskId, ...rest } = opts;
|
|
50
|
+
return this.transport.request('POST', '/captcha/tasks', {
|
|
51
|
+
json: { task_id: taskId, ...rest },
|
|
52
|
+
});
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
export class Captcha {
|
|
57
|
+
readonly recognition: Recognition;
|
|
58
|
+
readonly token: Token;
|
|
59
|
+
readonly tasks: Tasks;
|
|
60
|
+
|
|
61
|
+
constructor(transport: Transport) {
|
|
62
|
+
this.recognition = new Recognition(transport);
|
|
63
|
+
this.token = new Token(transport);
|
|
64
|
+
this.tasks = new Tasks(transport);
|
|
65
|
+
}
|
|
66
|
+
}
|