-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathActivities.ts
More file actions
55 lines (50 loc) · 1.86 KB
/
Activities.ts
File metadata and controls
55 lines (50 loc) · 1.86 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
52
53
54
import { BaseResource } from "../BaseResource";
import { Configuration } from "../../Configuration";
import { AgentRunActivity, CreateAgentRunActivityRequest } from "../../models/AgentRun";
import { PaginatedResponse } from "../../models/common";
/**
* Agent Run Activities API resource
* Handles all agent run activity operations
*/
export class Activities extends BaseResource {
constructor(config: Configuration) {
super(config);
}
/**
* List activities for an agent run
* @param workspaceSlug - The workspace slug
* @param runId - The agent run ID
* @param params - Optional query parameters for pagination
* @returns Paginated list of agent run activities
*/
async list(
workspaceSlug: string,
runId: string,
params?: { per_page?: number; cursor?: string }
): Promise<PaginatedResponse<AgentRunActivity>> {
return this.get<PaginatedResponse<AgentRunActivity>>(
`/workspaces/${workspaceSlug}/runs/${runId}/activities/`,
params
);
}
/**
* Retrieve a specific agent run activity by ID
* @param workspaceSlug - The workspace slug
* @param runId - The agent run ID
* @param activityId - The activity ID
* @returns The agent run activity
*/
async retrieve(workspaceSlug: string, runId: string, activityId: string): Promise<AgentRunActivity> {
return this.get<AgentRunActivity>(`/workspaces/${workspaceSlug}/runs/${runId}/activities/${activityId}/`);
}
/**
* Create a new agent run activity
* @param workspaceSlug - The workspace slug
* @param runId - The agent run ID
* @param data - The activity data to create
* @returns The created agent run activity
*/
async create(workspaceSlug: string, runId: string, data: CreateAgentRunActivityRequest): Promise<AgentRunActivity> {
return this.post<AgentRunActivity>(`/workspaces/${workspaceSlug}/runs/${runId}/activities/`, data);
}
}