-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathRequestService.ts
50 lines (46 loc) · 1.27 KB
/
RequestService.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
import { clientErrorWrapper } from '../utils/errors.js';
import { Options } from '../client.js';
import {
RequestServiceChatInput,
RequestServiceChatOutput,
RequestServiceDeleteInput,
RequestServiceDeleteOutput,
RequestServiceListInput,
RequestServiceListOutput,
} from '../schema.js';
import { BaseService } from './BaseService.js';
export class RequestService extends BaseService {
async list(
input: RequestServiceListInput,
opts?: Options,
): Promise<RequestServiceListOutput> {
return clientErrorWrapper(
this._client.GET('/v2/requests', {
...opts,
params: { query: { ...input, version: '2023-11-22' } },
}),
);
}
async delete(
input: RequestServiceDeleteInput,
opts?: Options,
): Promise<RequestServiceDeleteOutput> {
return clientErrorWrapper(
this._client.DELETE('/v2/requests/{id}', {
...opts,
params: { path: input, query: { version: '2023-11-22' } },
}),
);
}
async chat(
input: RequestServiceChatInput,
opts?: Options,
): Promise<RequestServiceChatOutput> {
return clientErrorWrapper(
this._client.GET('/v2/requests/chat/{conversation_id}', {
...opts,
params: { path: input, query: { version: '2024-03-19' } },
}),
);
}
}