forked from Lilly-Protocol/lily-sdk
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathagent-client.ts
More file actions
51 lines (46 loc) · 1.23 KB
/
Copy pathagent-client.ts
File metadata and controls
51 lines (46 loc) · 1.23 KB
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
import { encodePathSegment } from '../http/path';
import type {
Agent,
CreateAgentRequest,
ListAgentsQuery,
UpdateAgentRequest,
} from '../models';
import type { AgentClientContract } from '../types/contracts';
import { BaseClient } from './base-client';
export class AgentClient extends BaseClient implements AgentClientContract {
public list(query: ListAgentsQuery = {}): Promise<readonly Agent[]> {
return this.request({
method: 'GET',
path: '/v1/agents',
query: {
...query,
},
});
}
public get(agentId: string): Promise<Agent> {
return this.request({
method: 'GET',
path: `/v1/agents/${encodePathSegment(agentId)}`,
});
}
public create(input: CreateAgentRequest): Promise<Agent> {
return this.request({
method: 'POST',
path: '/v1/agents',
body: input,
});
}
public update(agentId: string, input: UpdateAgentRequest): Promise<Agent> {
return this.request({
method: 'PATCH',
path: `/v1/agents/${encodePathSegment(agentId)}`,
body: input,
});
}
public delete(agentId: string): Promise<void> {
return this.request({
method: 'DELETE',
path: `/v1/agents/${encodePathSegment(agentId)}`,
});
}
}