@kaiban/sdk 0.1.1 → 0.1.2
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/README.md +376 -80
- package/dist/index.d.ts +6 -7
- package/dist/index.js +6 -7
- package/dist/lib/client.d.ts +5 -8
- package/dist/lib/client.js +5 -7
- package/dist/lib/http/HttpClient.js +5 -3
- package/dist/lib/resources/ActivitiesClient.d.ts +86 -27
- package/dist/lib/resources/ActivitiesClient.js +90 -29
- package/dist/lib/resources/AgentsClient.d.ts +68 -15
- package/dist/lib/resources/AgentsClient.js +75 -17
- package/dist/lib/resources/BoardsClient.d.ts +3 -3
- package/dist/lib/resources/BoardsClient.js +2 -2
- package/dist/lib/resources/CardsClient.d.ts +139 -12
- package/dist/lib/resources/CardsClient.js +171 -25
- package/dist/lib/resources/ExternalChannelsClient.d.ts +3 -3
- package/dist/lib/resources/ExternalChannelsClient.js +2 -2
- package/dist/lib/resources/ResourcesClient.d.ts +3 -30
- package/dist/lib/resources/ResourcesClient.js +2 -26
- package/dist/lib/resources/TeamsClient.d.ts +3 -3
- package/dist/lib/resources/TeamsClient.js +2 -2
- package/dist/types/a2a-data-parts.d.ts +2 -2
- package/dist/types/entities/activities.d.ts +56 -14
- package/dist/types/entities/activities.js +73 -1
- package/dist/types/entities/agent.d.ts +47 -5
- package/dist/types/entities/agent.js +25 -1
- package/dist/types/entities/card.d.ts +16 -26
- package/dist/types/entities/card.js +26 -1
- package/dist/types/entities/external-channel.d.ts +25 -5
- package/dist/types/entities/external-channel.js +16 -1
- package/dist/types/entities/index.d.ts +4 -5
- package/dist/types/entities/index.js +4 -5
- package/dist/types/entities/resource.d.ts +21 -12
- package/dist/types/entities/resource.js +7 -1
- package/dist/types/responses.d.ts +10 -10
- package/package.json +33 -6
- package/dist/lib/resources/BenchmarkExecutionsClient.d.ts +0 -250
- package/dist/lib/resources/BenchmarkExecutionsClient.js +0 -261
- package/dist/lib/resources/BenchmarksClient.d.ts +0 -159
- package/dist/lib/resources/BenchmarksClient.js +0 -158
- package/dist/lib/resources/SupervisorFeedbackClient.d.ts +0 -75
- package/dist/lib/resources/SupervisorFeedbackClient.js +0 -67
- package/dist/lib/resources/TeamMembersClient.d.ts +0 -66
- package/dist/lib/resources/TeamMembersClient.js +0 -75
- package/dist/lib/resources/__tests__/ActivitiesClient.test.d.ts +0 -1
- package/dist/lib/resources/__tests__/ActivitiesClient.test.js +0 -33
- package/dist/lib/resources/__tests__/AgentsClient.test.d.ts +0 -1
- package/dist/lib/resources/__tests__/AgentsClient.test.js +0 -37
- package/dist/lib/resources/__tests__/BenchmarkExecutionsClient.test.d.ts +0 -1
- package/dist/lib/resources/__tests__/BenchmarkExecutionsClient.test.js +0 -59
- package/dist/lib/resources/__tests__/BenchmarksClient.test.d.ts +0 -1
- package/dist/lib/resources/__tests__/BenchmarksClient.test.js +0 -42
- package/dist/lib/resources/__tests__/BoardsClient.test.d.ts +0 -1
- package/dist/lib/resources/__tests__/BoardsClient.test.js +0 -26
- package/dist/lib/resources/__tests__/CardsClient.test.d.ts +0 -1
- package/dist/lib/resources/__tests__/CardsClient.test.js +0 -62
- package/dist/lib/resources/__tests__/ExternalChannelsClient.test.d.ts +0 -1
- package/dist/lib/resources/__tests__/ExternalChannelsClient.test.js +0 -26
- package/dist/lib/resources/__tests__/ResourcesClient.test.d.ts +0 -1
- package/dist/lib/resources/__tests__/ResourcesClient.test.js +0 -28
- package/dist/lib/resources/__tests__/SupervisorFeedbackClient.test.d.ts +0 -1
- package/dist/lib/resources/__tests__/SupervisorFeedbackClient.test.js +0 -24
- package/dist/lib/resources/__tests__/TeamMembersClient.test.d.ts +0 -1
- package/dist/lib/resources/__tests__/TeamMembersClient.test.js +0 -26
- package/dist/lib/resources/__tests__/TeamsClient.test.d.ts +0 -1
- package/dist/lib/resources/__tests__/TeamsClient.test.js +0 -26
- package/dist/types/entities/benchmark.d.ts +0 -82
- package/dist/types/entities/benchmark.js +0 -1
|
@@ -1,7 +1,7 @@
|
|
|
1
|
+
import { Activity, ActivityCreate } from '../../types/entities';
|
|
2
|
+
import { ListParams, Paginated } from '../../types/responses';
|
|
1
3
|
import { HttpClient } from '../http/HttpClient';
|
|
2
4
|
import { RequestOptions } from '../http/types';
|
|
3
|
-
import { CardActivity, ActivityCreate } from '../../types/entities';
|
|
4
|
-
import { ListParams, Paginated } from '../../types/responses';
|
|
5
5
|
/**
|
|
6
6
|
* Client for managing card activities
|
|
7
7
|
* Activities track changes, comments, and events on cards
|
|
@@ -11,70 +11,94 @@ export declare class ActivitiesClient {
|
|
|
11
11
|
private readonly http;
|
|
12
12
|
constructor(http: HttpClient);
|
|
13
13
|
/**
|
|
14
|
-
* List activities
|
|
15
|
-
*
|
|
14
|
+
* List all activities with pagination, filters, and sorting
|
|
15
|
+
* Returns activities across all cards (use filters to narrow down)
|
|
16
16
|
*
|
|
17
|
-
* @param cardId - The unique identifier of the card
|
|
18
17
|
* @param params - Optional query parameters for filtering and pagination
|
|
19
|
-
* @param params.
|
|
20
|
-
* @param params.
|
|
21
|
-
* @param params.
|
|
18
|
+
* @param params.limit - Number of items per page (default: 50, max: 100)
|
|
19
|
+
* @param params.after - Cursor to navigate forwards (get items after this cursor)
|
|
20
|
+
* @param params.before - Cursor to navigate backwards (get items before this cursor)
|
|
21
|
+
* @param params.order_by - Fields to sort by (prefix with - for descending order)
|
|
22
|
+
* @param params.filters - Filter parameters (e.g., { card_id: '123', type: 'comment' })
|
|
22
23
|
* @param options - Optional request configuration
|
|
23
24
|
*
|
|
24
25
|
* @returns A paginated list of activities
|
|
25
26
|
*
|
|
26
27
|
* @example
|
|
27
28
|
* ```typescript
|
|
28
|
-
* // Get activities
|
|
29
|
-
* const result = await client.activities.list(
|
|
29
|
+
* // Get activities with filters
|
|
30
|
+
* const result = await client.activities.list({
|
|
30
31
|
* limit: 20,
|
|
31
|
-
* order_by:
|
|
32
|
+
* order_by: '-created_at',
|
|
33
|
+
* filters: { card_id: 'card-123', type: 'comment' }
|
|
32
34
|
* });
|
|
35
|
+
* console.log(result.data); // Array of Activity objects
|
|
33
36
|
*
|
|
34
|
-
*
|
|
37
|
+
* // Get next page
|
|
38
|
+
* if (result.pagination.next_cursor) {
|
|
39
|
+
* const nextPage = await client.activities.list({
|
|
40
|
+
* limit: 20,
|
|
41
|
+
* after: result.pagination.next_cursor
|
|
42
|
+
* });
|
|
43
|
+
* }
|
|
35
44
|
* ```
|
|
36
45
|
*/
|
|
37
|
-
list(
|
|
46
|
+
list(params?: ListParams, options?: RequestOptions): Promise<Paginated<Activity>>;
|
|
38
47
|
/**
|
|
39
|
-
* Iterate through all activities
|
|
40
|
-
* Automatically handles pagination by following
|
|
48
|
+
* Iterate through all activities using async generator
|
|
49
|
+
* Automatically handles pagination by following next_cursor
|
|
41
50
|
*
|
|
42
|
-
* @param
|
|
43
|
-
* @param params -
|
|
51
|
+
* @param params - Optional query parameters (excluding after/before cursors)
|
|
52
|
+
* @param params.limit - Number of items per page (used internally for pagination)
|
|
53
|
+
* @param params.order_by - Fields to sort by (prefix with - for descending)
|
|
54
|
+
* @param params.filters - Filter parameters to narrow results
|
|
44
55
|
* @param options - Optional request configuration
|
|
45
56
|
*
|
|
46
|
-
* @yields Individual
|
|
57
|
+
* @yields Individual Activity objects
|
|
47
58
|
*
|
|
48
59
|
* @example
|
|
49
60
|
* ```typescript
|
|
50
|
-
* // Process all activities
|
|
51
|
-
* for await (const activity of client.activities.listAll(
|
|
61
|
+
* // Process all activities
|
|
62
|
+
* for await (const activity of client.activities.listAll()) {
|
|
52
63
|
* console.log(activity.type, activity.description);
|
|
53
64
|
* }
|
|
65
|
+
*
|
|
66
|
+
* // With filters and custom page size
|
|
67
|
+
* for await (const activity of client.activities.listAll({
|
|
68
|
+
* limit: 100,
|
|
69
|
+
* order_by: '-created_at',
|
|
70
|
+
* filters: { card_id: 'card-123', type: 'comment' }
|
|
71
|
+
* })) {
|
|
72
|
+
* console.log(activity);
|
|
73
|
+
* }
|
|
54
74
|
* ```
|
|
55
75
|
*/
|
|
56
|
-
listAll(
|
|
76
|
+
listAll(params?: Omit<ListParams, 'after' | 'before'>, options?: RequestOptions): AsyncGenerator<Activity, void, unknown>;
|
|
57
77
|
/**
|
|
58
|
-
* Create a new activity
|
|
78
|
+
* Create a new activity
|
|
59
79
|
* Activities can track various events such as comments, status changes, or custom events
|
|
60
80
|
*
|
|
61
|
-
* @param cardId - The unique identifier of the card
|
|
62
81
|
* @param data - Activity creation data
|
|
82
|
+
* @param data.card_id - The unique identifier of the card
|
|
83
|
+
* @param data.board_id - The board ID
|
|
84
|
+
* @param data.team_id - The team ID
|
|
63
85
|
* @param data.type - The type of activity (e.g., 'card_created', 'card_updated', 'comment')
|
|
64
86
|
* @param data.description - A description of the activity
|
|
65
87
|
* @param data.actor - The actor who performed the activity
|
|
88
|
+
* @param data.changes - Optional array of field changes
|
|
89
|
+
* @param data.metadata - Optional additional metadata
|
|
66
90
|
* @param options - Optional request configuration
|
|
67
91
|
*
|
|
68
92
|
* @returns The created activity object
|
|
69
93
|
*
|
|
70
|
-
* @throws {Error} If
|
|
94
|
+
* @throws {Error} If creation fails
|
|
71
95
|
*
|
|
72
96
|
* @example
|
|
73
97
|
* ```typescript
|
|
74
|
-
* const activity = await client.activities.create(
|
|
98
|
+
* const activity = await client.activities.create({
|
|
99
|
+
* card_id: 'card-123',
|
|
75
100
|
* board_id: 'board-456',
|
|
76
101
|
* team_id: 'team-789',
|
|
77
|
-
* card_id: 'card-123',
|
|
78
102
|
* type: 'comment',
|
|
79
103
|
* description: 'Added a comment',
|
|
80
104
|
* actor: {
|
|
@@ -85,5 +109,40 @@ export declare class ActivitiesClient {
|
|
|
85
109
|
* });
|
|
86
110
|
* ```
|
|
87
111
|
*/
|
|
88
|
-
create(
|
|
112
|
+
create(data: ActivityCreate, options?: RequestOptions): Promise<Activity>;
|
|
113
|
+
/**
|
|
114
|
+
* Create multiple activities in a single batch request
|
|
115
|
+
* This is more efficient than creating activities one by one
|
|
116
|
+
*
|
|
117
|
+
* @param data - Array of activity creation data
|
|
118
|
+
* @param options - Optional request configuration
|
|
119
|
+
*
|
|
120
|
+
* @returns The batch creation result
|
|
121
|
+
*
|
|
122
|
+
* @throws {Error} If batch creation fails
|
|
123
|
+
*
|
|
124
|
+
* @example
|
|
125
|
+
* ```typescript
|
|
126
|
+
* const activities = await client.activities.createBatch([
|
|
127
|
+
* {
|
|
128
|
+
* card_id: 'card-123',
|
|
129
|
+
* board_id: 'board-456',
|
|
130
|
+
* team_id: 'team-789',
|
|
131
|
+
* type: 'comment',
|
|
132
|
+
* description: 'First comment',
|
|
133
|
+
* actor: { id: 'user-001', type: 'user', name: 'Jane Doe' }
|
|
134
|
+
* },
|
|
135
|
+
* {
|
|
136
|
+
* card_id: 'card-123',
|
|
137
|
+
* board_id: 'board-456',
|
|
138
|
+
* team_id: 'team-789',
|
|
139
|
+
* type: 'card_updated',
|
|
140
|
+
* description: 'Updated priority',
|
|
141
|
+
* actor: { id: 'user-001', type: 'user', name: 'Jane Doe' },
|
|
142
|
+
* changes: [{ field: 'priority', old_value: 'low', new_value: 'high' }]
|
|
143
|
+
* }
|
|
144
|
+
* ]);
|
|
145
|
+
* ```
|
|
146
|
+
*/
|
|
147
|
+
createBatch(data: ActivityCreate[], options?: RequestOptions): Promise<Activity>;
|
|
89
148
|
}
|
|
@@ -9,80 +9,104 @@ export class ActivitiesClient {
|
|
|
9
9
|
this.http = http;
|
|
10
10
|
}
|
|
11
11
|
/**
|
|
12
|
-
* List activities
|
|
13
|
-
*
|
|
12
|
+
* List all activities with pagination, filters, and sorting
|
|
13
|
+
* Returns activities across all cards (use filters to narrow down)
|
|
14
14
|
*
|
|
15
|
-
* @param cardId - The unique identifier of the card
|
|
16
15
|
* @param params - Optional query parameters for filtering and pagination
|
|
17
|
-
* @param params.
|
|
18
|
-
* @param params.
|
|
19
|
-
* @param params.
|
|
16
|
+
* @param params.limit - Number of items per page (default: 50, max: 100)
|
|
17
|
+
* @param params.after - Cursor to navigate forwards (get items after this cursor)
|
|
18
|
+
* @param params.before - Cursor to navigate backwards (get items before this cursor)
|
|
19
|
+
* @param params.order_by - Fields to sort by (prefix with - for descending order)
|
|
20
|
+
* @param params.filters - Filter parameters (e.g., { card_id: '123', type: 'comment' })
|
|
20
21
|
* @param options - Optional request configuration
|
|
21
22
|
*
|
|
22
23
|
* @returns A paginated list of activities
|
|
23
24
|
*
|
|
24
25
|
* @example
|
|
25
26
|
* ```typescript
|
|
26
|
-
* // Get activities
|
|
27
|
-
* const result = await client.activities.list(
|
|
27
|
+
* // Get activities with filters
|
|
28
|
+
* const result = await client.activities.list({
|
|
28
29
|
* limit: 20,
|
|
29
|
-
* order_by:
|
|
30
|
+
* order_by: '-created_at',
|
|
31
|
+
* filters: { card_id: 'card-123', type: 'comment' }
|
|
30
32
|
* });
|
|
33
|
+
* console.log(result.data); // Array of Activity objects
|
|
31
34
|
*
|
|
32
|
-
*
|
|
35
|
+
* // Get next page
|
|
36
|
+
* if (result.pagination.next_cursor) {
|
|
37
|
+
* const nextPage = await client.activities.list({
|
|
38
|
+
* limit: 20,
|
|
39
|
+
* after: result.pagination.next_cursor
|
|
40
|
+
* });
|
|
41
|
+
* }
|
|
33
42
|
* ```
|
|
34
43
|
*/
|
|
35
|
-
list(
|
|
36
|
-
return this.http.list(`/
|
|
44
|
+
list(params, options) {
|
|
45
|
+
return this.http.list(`/activities`, params, options);
|
|
37
46
|
}
|
|
38
47
|
/**
|
|
39
|
-
* Iterate through all activities
|
|
40
|
-
* Automatically handles pagination by following
|
|
48
|
+
* Iterate through all activities using async generator
|
|
49
|
+
* Automatically handles pagination by following next_cursor
|
|
41
50
|
*
|
|
42
|
-
* @param
|
|
43
|
-
* @param params -
|
|
51
|
+
* @param params - Optional query parameters (excluding after/before cursors)
|
|
52
|
+
* @param params.limit - Number of items per page (used internally for pagination)
|
|
53
|
+
* @param params.order_by - Fields to sort by (prefix with - for descending)
|
|
54
|
+
* @param params.filters - Filter parameters to narrow results
|
|
44
55
|
* @param options - Optional request configuration
|
|
45
56
|
*
|
|
46
|
-
* @yields Individual
|
|
57
|
+
* @yields Individual Activity objects
|
|
47
58
|
*
|
|
48
59
|
* @example
|
|
49
60
|
* ```typescript
|
|
50
|
-
* // Process all activities
|
|
51
|
-
* for await (const activity of client.activities.listAll(
|
|
61
|
+
* // Process all activities
|
|
62
|
+
* for await (const activity of client.activities.listAll()) {
|
|
52
63
|
* console.log(activity.type, activity.description);
|
|
53
64
|
* }
|
|
65
|
+
*
|
|
66
|
+
* // With filters and custom page size
|
|
67
|
+
* for await (const activity of client.activities.listAll({
|
|
68
|
+
* limit: 100,
|
|
69
|
+
* order_by: '-created_at',
|
|
70
|
+
* filters: { card_id: 'card-123', type: 'comment' }
|
|
71
|
+
* })) {
|
|
72
|
+
* console.log(activity);
|
|
73
|
+
* }
|
|
54
74
|
* ```
|
|
55
75
|
*/
|
|
56
|
-
async *listAll(
|
|
76
|
+
async *listAll(params, options) {
|
|
57
77
|
let cursor = undefined;
|
|
58
78
|
do {
|
|
59
|
-
const page = await this.list(
|
|
79
|
+
const page = await this.list({ ...(params || {}), after: cursor }, options);
|
|
60
80
|
for (const item of page.data)
|
|
61
81
|
yield item;
|
|
62
|
-
cursor = page.
|
|
82
|
+
cursor = page.pagination.next_cursor;
|
|
63
83
|
} while (cursor);
|
|
64
84
|
}
|
|
65
85
|
/**
|
|
66
|
-
* Create a new activity
|
|
86
|
+
* Create a new activity
|
|
67
87
|
* Activities can track various events such as comments, status changes, or custom events
|
|
68
88
|
*
|
|
69
|
-
* @param cardId - The unique identifier of the card
|
|
70
89
|
* @param data - Activity creation data
|
|
90
|
+
* @param data.card_id - The unique identifier of the card
|
|
91
|
+
* @param data.board_id - The board ID
|
|
92
|
+
* @param data.team_id - The team ID
|
|
71
93
|
* @param data.type - The type of activity (e.g., 'card_created', 'card_updated', 'comment')
|
|
72
94
|
* @param data.description - A description of the activity
|
|
73
95
|
* @param data.actor - The actor who performed the activity
|
|
96
|
+
* @param data.changes - Optional array of field changes
|
|
97
|
+
* @param data.metadata - Optional additional metadata
|
|
74
98
|
* @param options - Optional request configuration
|
|
75
99
|
*
|
|
76
100
|
* @returns The created activity object
|
|
77
101
|
*
|
|
78
|
-
* @throws {Error} If
|
|
102
|
+
* @throws {Error} If creation fails
|
|
79
103
|
*
|
|
80
104
|
* @example
|
|
81
105
|
* ```typescript
|
|
82
|
-
* const activity = await client.activities.create(
|
|
106
|
+
* const activity = await client.activities.create({
|
|
107
|
+
* card_id: 'card-123',
|
|
83
108
|
* board_id: 'board-456',
|
|
84
109
|
* team_id: 'team-789',
|
|
85
|
-
* card_id: 'card-123',
|
|
86
110
|
* type: 'comment',
|
|
87
111
|
* description: 'Added a comment',
|
|
88
112
|
* actor: {
|
|
@@ -93,7 +117,44 @@ export class ActivitiesClient {
|
|
|
93
117
|
* });
|
|
94
118
|
* ```
|
|
95
119
|
*/
|
|
96
|
-
create(
|
|
97
|
-
return this.http.post(`/
|
|
120
|
+
create(data, options) {
|
|
121
|
+
return this.http.post(`/activities:batch`, { items: [data] }, options);
|
|
122
|
+
}
|
|
123
|
+
/**
|
|
124
|
+
* Create multiple activities in a single batch request
|
|
125
|
+
* This is more efficient than creating activities one by one
|
|
126
|
+
*
|
|
127
|
+
* @param data - Array of activity creation data
|
|
128
|
+
* @param options - Optional request configuration
|
|
129
|
+
*
|
|
130
|
+
* @returns The batch creation result
|
|
131
|
+
*
|
|
132
|
+
* @throws {Error} If batch creation fails
|
|
133
|
+
*
|
|
134
|
+
* @example
|
|
135
|
+
* ```typescript
|
|
136
|
+
* const activities = await client.activities.createBatch([
|
|
137
|
+
* {
|
|
138
|
+
* card_id: 'card-123',
|
|
139
|
+
* board_id: 'board-456',
|
|
140
|
+
* team_id: 'team-789',
|
|
141
|
+
* type: 'comment',
|
|
142
|
+
* description: 'First comment',
|
|
143
|
+
* actor: { id: 'user-001', type: 'user', name: 'Jane Doe' }
|
|
144
|
+
* },
|
|
145
|
+
* {
|
|
146
|
+
* card_id: 'card-123',
|
|
147
|
+
* board_id: 'board-456',
|
|
148
|
+
* team_id: 'team-789',
|
|
149
|
+
* type: 'card_updated',
|
|
150
|
+
* description: 'Updated priority',
|
|
151
|
+
* actor: { id: 'user-001', type: 'user', name: 'Jane Doe' },
|
|
152
|
+
* changes: [{ field: 'priority', old_value: 'low', new_value: 'high' }]
|
|
153
|
+
* }
|
|
154
|
+
* ]);
|
|
155
|
+
* ```
|
|
156
|
+
*/
|
|
157
|
+
createBatch(data, options) {
|
|
158
|
+
return this.http.post(`/activities:batch`, { items: data }, options);
|
|
98
159
|
}
|
|
99
160
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
+
import { Agent, AgentFeedback, AgentSupervisorFeedback } from '../../types/entities';
|
|
2
|
+
import { ListParams, Paginated } from '../../types/responses';
|
|
1
3
|
import { HttpClient } from '../http/HttpClient';
|
|
2
4
|
import { RequestOptions } from '../http/types';
|
|
3
|
-
import { Agent, AgentFeedback } from '../../types/entities';
|
|
4
|
-
import { ListParams, Paginated } from '../../types/responses';
|
|
5
5
|
/**
|
|
6
6
|
* Client for managing agents in the Kaiban platform
|
|
7
7
|
* @category Resources
|
|
@@ -13,9 +13,11 @@ export declare class AgentsClient {
|
|
|
13
13
|
* List agents with pagination, filters, and sorting
|
|
14
14
|
*
|
|
15
15
|
* @param params - Optional query parameters for filtering and pagination
|
|
16
|
-
* @param params.
|
|
17
|
-
* @param params.
|
|
18
|
-
* @param params.
|
|
16
|
+
* @param params.limit - Number of items per page (default: 50, max: 100)
|
|
17
|
+
* @param params.after - Cursor to navigate forwards (get items after this cursor)
|
|
18
|
+
* @param params.before - Cursor to navigate backwards (get items before this cursor)
|
|
19
|
+
* @param params.order_by - Fields to sort by (prefix with - for descending order)
|
|
20
|
+
* @param params.filters - Filter parameters to narrow results
|
|
19
21
|
* @param options - Optional request configuration
|
|
20
22
|
*
|
|
21
23
|
* @returns A paginated list of agents
|
|
@@ -24,22 +26,34 @@ export declare class AgentsClient {
|
|
|
24
26
|
* ```typescript
|
|
25
27
|
* // List first page of agents
|
|
26
28
|
* const result = await client.agents.list({ limit: 10 });
|
|
27
|
-
* console.log(result.
|
|
29
|
+
* console.log(result.data); // Array of Agent objects
|
|
30
|
+
* console.log(result.pagination.next_cursor); // Cursor for next page
|
|
28
31
|
*
|
|
29
32
|
* // Get next page using cursor
|
|
30
|
-
* if (result.
|
|
33
|
+
* if (result.pagination.next_cursor) {
|
|
31
34
|
* const nextPage = await client.agents.list({
|
|
32
|
-
*
|
|
35
|
+
* limit: 10,
|
|
36
|
+
* after: result.pagination.next_cursor
|
|
33
37
|
* });
|
|
34
38
|
* }
|
|
39
|
+
*
|
|
40
|
+
* // With filters and sorting
|
|
41
|
+
* const filtered = await client.agents.list({
|
|
42
|
+
* limit: 20,
|
|
43
|
+
* order_by: '-created_at',
|
|
44
|
+
* filters: { status: 'active' }
|
|
45
|
+
* });
|
|
35
46
|
* ```
|
|
36
47
|
*/
|
|
37
48
|
list(params?: ListParams, options?: RequestOptions): Promise<Paginated<Agent>>;
|
|
38
49
|
/**
|
|
39
50
|
* Iterate through all agents using async generator
|
|
40
|
-
* Automatically handles pagination by following
|
|
51
|
+
* Automatically handles pagination by following next_cursor
|
|
41
52
|
*
|
|
42
|
-
* @param params - Optional query parameters (excluding
|
|
53
|
+
* @param params - Optional query parameters (excluding after/before cursors)
|
|
54
|
+
* @param params.limit - Number of items per page (used internally for pagination)
|
|
55
|
+
* @param params.order_by - Fields to sort by (prefix with - for descending order)
|
|
56
|
+
* @param params.filters - Filter parameters to narrow results
|
|
43
57
|
* @param options - Optional request configuration
|
|
44
58
|
*
|
|
45
59
|
* @yields Individual Agent objects
|
|
@@ -51,15 +65,17 @@ export declare class AgentsClient {
|
|
|
51
65
|
* console.log(agent.id, agent.name);
|
|
52
66
|
* }
|
|
53
67
|
*
|
|
54
|
-
* // With
|
|
68
|
+
* // With custom page size and sorting
|
|
55
69
|
* for await (const agent of client.agents.listAll({
|
|
56
|
-
*
|
|
70
|
+
* limit: 100,
|
|
71
|
+
* order_by: '-created_at',
|
|
72
|
+
* filters: { status: 'active' }
|
|
57
73
|
* })) {
|
|
58
74
|
* console.log(agent);
|
|
59
75
|
* }
|
|
60
76
|
* ```
|
|
61
77
|
*/
|
|
62
|
-
listAll(params?: Omit<ListParams, '
|
|
78
|
+
listAll(params?: Omit<ListParams, 'after' | 'before'>, options?: RequestOptions): AsyncGenerator<Agent, void, unknown>;
|
|
63
79
|
/**
|
|
64
80
|
* Get a single agent by ID
|
|
65
81
|
*
|
|
@@ -100,7 +116,7 @@ export declare class AgentsClient {
|
|
|
100
116
|
/**
|
|
101
117
|
* Create feedback for an agent
|
|
102
118
|
*
|
|
103
|
-
* @param
|
|
119
|
+
* @param agentId - The unique identifier of the agent
|
|
104
120
|
* @param feedback - Feedback data to submit
|
|
105
121
|
* @param options - Optional request configuration
|
|
106
122
|
*
|
|
@@ -117,5 +133,42 @@ export declare class AgentsClient {
|
|
|
117
133
|
* });
|
|
118
134
|
* ```
|
|
119
135
|
*/
|
|
120
|
-
createFeedback(
|
|
136
|
+
createFeedback(agentId: string, feedback: Omit<AgentFeedback, 'id' | 'agent_id' | 'created_at'>, options?: RequestOptions): Promise<AgentFeedback>;
|
|
137
|
+
/**
|
|
138
|
+
* List supervisor feedback for a specific agent with pagination
|
|
139
|
+
*
|
|
140
|
+
* @param agentId - The unique identifier of the agent
|
|
141
|
+
* @param params - Optional query parameters for filtering and pagination
|
|
142
|
+
* @param params.limit - Number of items per page (default: 50, max: 100)
|
|
143
|
+
* @param params.after - Cursor to navigate forwards (get items after this cursor)
|
|
144
|
+
* @param params.before - Cursor to navigate backwards (get items before this cursor)
|
|
145
|
+
* @param params.order_by - Fields to sort by (prefix with - for descending order)
|
|
146
|
+
* @param options - Optional request configuration
|
|
147
|
+
*
|
|
148
|
+
* @returns A paginated list of supervisor feedback for the agent
|
|
149
|
+
*
|
|
150
|
+
* @throws {Error} If the agent is not found or request fails
|
|
151
|
+
*
|
|
152
|
+
* @example
|
|
153
|
+
* ```typescript
|
|
154
|
+
* // List supervisor feedback for an agent
|
|
155
|
+
* const result = await client.agents.listSupervisorFeedbacks('agent-123', {
|
|
156
|
+
* limit: 10,
|
|
157
|
+
* order_by: '-created_at'
|
|
158
|
+
* });
|
|
159
|
+
*
|
|
160
|
+
* for (const feedback of result.data) {
|
|
161
|
+
* console.log(feedback.rating, feedback.comment);
|
|
162
|
+
* }
|
|
163
|
+
*
|
|
164
|
+
* // Get next page if available
|
|
165
|
+
* if (result.pagination.next_cursor) {
|
|
166
|
+
* const nextPage = await client.agents.listSupervisorFeedbacks('agent-123', {
|
|
167
|
+
* limit: 10,
|
|
168
|
+
* after: result.pagination.next_cursor
|
|
169
|
+
* });
|
|
170
|
+
* }
|
|
171
|
+
* ```
|
|
172
|
+
*/
|
|
173
|
+
listSupervisorFeedback(agentId: string, params?: ListParams, options?: RequestOptions): Promise<Paginated<AgentSupervisorFeedback>>;
|
|
121
174
|
}
|
|
@@ -10,9 +10,11 @@ export class AgentsClient {
|
|
|
10
10
|
* List agents with pagination, filters, and sorting
|
|
11
11
|
*
|
|
12
12
|
* @param params - Optional query parameters for filtering and pagination
|
|
13
|
-
* @param params.
|
|
14
|
-
* @param params.
|
|
15
|
-
* @param params.
|
|
13
|
+
* @param params.limit - Number of items per page (default: 50, max: 100)
|
|
14
|
+
* @param params.after - Cursor to navigate forwards (get items after this cursor)
|
|
15
|
+
* @param params.before - Cursor to navigate backwards (get items before this cursor)
|
|
16
|
+
* @param params.order_by - Fields to sort by (prefix with - for descending order)
|
|
17
|
+
* @param params.filters - Filter parameters to narrow results
|
|
16
18
|
* @param options - Optional request configuration
|
|
17
19
|
*
|
|
18
20
|
* @returns A paginated list of agents
|
|
@@ -21,14 +23,23 @@ export class AgentsClient {
|
|
|
21
23
|
* ```typescript
|
|
22
24
|
* // List first page of agents
|
|
23
25
|
* const result = await client.agents.list({ limit: 10 });
|
|
24
|
-
* console.log(result.
|
|
26
|
+
* console.log(result.data); // Array of Agent objects
|
|
27
|
+
* console.log(result.pagination.next_cursor); // Cursor for next page
|
|
25
28
|
*
|
|
26
29
|
* // Get next page using cursor
|
|
27
|
-
* if (result.
|
|
30
|
+
* if (result.pagination.next_cursor) {
|
|
28
31
|
* const nextPage = await client.agents.list({
|
|
29
|
-
*
|
|
32
|
+
* limit: 10,
|
|
33
|
+
* after: result.pagination.next_cursor
|
|
30
34
|
* });
|
|
31
35
|
* }
|
|
36
|
+
*
|
|
37
|
+
* // With filters and sorting
|
|
38
|
+
* const filtered = await client.agents.list({
|
|
39
|
+
* limit: 20,
|
|
40
|
+
* order_by: '-created_at',
|
|
41
|
+
* filters: { status: 'active' }
|
|
42
|
+
* });
|
|
32
43
|
* ```
|
|
33
44
|
*/
|
|
34
45
|
list(params, options) {
|
|
@@ -36,9 +47,12 @@ export class AgentsClient {
|
|
|
36
47
|
}
|
|
37
48
|
/**
|
|
38
49
|
* Iterate through all agents using async generator
|
|
39
|
-
* Automatically handles pagination by following
|
|
50
|
+
* Automatically handles pagination by following next_cursor
|
|
40
51
|
*
|
|
41
|
-
* @param params - Optional query parameters (excluding
|
|
52
|
+
* @param params - Optional query parameters (excluding after/before cursors)
|
|
53
|
+
* @param params.limit - Number of items per page (used internally for pagination)
|
|
54
|
+
* @param params.order_by - Fields to sort by (prefix with - for descending order)
|
|
55
|
+
* @param params.filters - Filter parameters to narrow results
|
|
42
56
|
* @param options - Optional request configuration
|
|
43
57
|
*
|
|
44
58
|
* @yields Individual Agent objects
|
|
@@ -50,22 +64,24 @@ export class AgentsClient {
|
|
|
50
64
|
* console.log(agent.id, agent.name);
|
|
51
65
|
* }
|
|
52
66
|
*
|
|
53
|
-
* // With
|
|
67
|
+
* // With custom page size and sorting
|
|
54
68
|
* for await (const agent of client.agents.listAll({
|
|
55
|
-
*
|
|
69
|
+
* limit: 100,
|
|
70
|
+
* order_by: '-created_at',
|
|
71
|
+
* filters: { status: 'active' }
|
|
56
72
|
* })) {
|
|
57
73
|
* console.log(agent);
|
|
58
74
|
* }
|
|
59
75
|
* ```
|
|
60
76
|
*/
|
|
61
77
|
async *listAll(params, options) {
|
|
62
|
-
let
|
|
78
|
+
let cursor = undefined;
|
|
63
79
|
do {
|
|
64
|
-
const page = await this.list({ ...(params || {}),
|
|
80
|
+
const page = await this.list({ ...(params || {}), after: cursor }, options);
|
|
65
81
|
for (const item of page.data)
|
|
66
82
|
yield item;
|
|
67
|
-
|
|
68
|
-
} while (
|
|
83
|
+
cursor = page.pagination.next_cursor;
|
|
84
|
+
} while (cursor);
|
|
69
85
|
}
|
|
70
86
|
/**
|
|
71
87
|
* Get a single agent by ID
|
|
@@ -111,7 +127,7 @@ export class AgentsClient {
|
|
|
111
127
|
/**
|
|
112
128
|
* Create feedback for an agent
|
|
113
129
|
*
|
|
114
|
-
* @param
|
|
130
|
+
* @param agentId - The unique identifier of the agent
|
|
115
131
|
* @param feedback - Feedback data to submit
|
|
116
132
|
* @param options - Optional request configuration
|
|
117
133
|
*
|
|
@@ -128,7 +144,49 @@ export class AgentsClient {
|
|
|
128
144
|
* });
|
|
129
145
|
* ```
|
|
130
146
|
*/
|
|
131
|
-
createFeedback(
|
|
132
|
-
return this.http.post(`/agent/${encodeURIComponent(
|
|
147
|
+
createFeedback(agentId, feedback, options) {
|
|
148
|
+
return this.http.post(`/agent/${encodeURIComponent(agentId)}/feedback`, {
|
|
149
|
+
...feedback,
|
|
150
|
+
agent_id: agentId,
|
|
151
|
+
}, options);
|
|
152
|
+
}
|
|
153
|
+
/**
|
|
154
|
+
* List supervisor feedback for a specific agent with pagination
|
|
155
|
+
*
|
|
156
|
+
* @param agentId - The unique identifier of the agent
|
|
157
|
+
* @param params - Optional query parameters for filtering and pagination
|
|
158
|
+
* @param params.limit - Number of items per page (default: 50, max: 100)
|
|
159
|
+
* @param params.after - Cursor to navigate forwards (get items after this cursor)
|
|
160
|
+
* @param params.before - Cursor to navigate backwards (get items before this cursor)
|
|
161
|
+
* @param params.order_by - Fields to sort by (prefix with - for descending order)
|
|
162
|
+
* @param options - Optional request configuration
|
|
163
|
+
*
|
|
164
|
+
* @returns A paginated list of supervisor feedback for the agent
|
|
165
|
+
*
|
|
166
|
+
* @throws {Error} If the agent is not found or request fails
|
|
167
|
+
*
|
|
168
|
+
* @example
|
|
169
|
+
* ```typescript
|
|
170
|
+
* // List supervisor feedback for an agent
|
|
171
|
+
* const result = await client.agents.listSupervisorFeedbacks('agent-123', {
|
|
172
|
+
* limit: 10,
|
|
173
|
+
* order_by: '-created_at'
|
|
174
|
+
* });
|
|
175
|
+
*
|
|
176
|
+
* for (const feedback of result.data) {
|
|
177
|
+
* console.log(feedback.rating, feedback.comment);
|
|
178
|
+
* }
|
|
179
|
+
*
|
|
180
|
+
* // Get next page if available
|
|
181
|
+
* if (result.pagination.next_cursor) {
|
|
182
|
+
* const nextPage = await client.agents.listSupervisorFeedbacks('agent-123', {
|
|
183
|
+
* limit: 10,
|
|
184
|
+
* after: result.pagination.next_cursor
|
|
185
|
+
* });
|
|
186
|
+
* }
|
|
187
|
+
* ```
|
|
188
|
+
*/
|
|
189
|
+
listSupervisorFeedback(agentId, params, options) {
|
|
190
|
+
return this.http.list(`/supervisor-feedback/${encodeURIComponent(agentId)}`, params, options);
|
|
133
191
|
}
|
|
134
192
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { HttpClient } from '../http/HttpClient';
|
|
2
|
-
import { RequestOptions } from '../http/types';
|
|
3
1
|
import { Board } from '../../types/entities';
|
|
4
2
|
import { ListParams, Paginated } from '../../types/responses';
|
|
3
|
+
import { HttpClient } from '../http/HttpClient';
|
|
4
|
+
import { RequestOptions } from '../http/types';
|
|
5
5
|
/**
|
|
6
6
|
* Client for managing boards in the Kaiban platform
|
|
7
7
|
* Boards organize cards into columns for workflow management
|
|
@@ -44,7 +44,7 @@ export declare class BoardsClient {
|
|
|
44
44
|
* }
|
|
45
45
|
* ```
|
|
46
46
|
*/
|
|
47
|
-
listAll(params?: Omit<ListParams, '
|
|
47
|
+
listAll(params?: Omit<ListParams, 'after' | 'before'>, options?: RequestOptions): AsyncGenerator<Board, void, unknown>;
|
|
48
48
|
/**
|
|
49
49
|
* Get a single board by ID
|
|
50
50
|
*
|
|
@@ -46,10 +46,10 @@ export class BoardsClient {
|
|
|
46
46
|
async *listAll(params, options) {
|
|
47
47
|
let cursor = undefined;
|
|
48
48
|
do {
|
|
49
|
-
const page = await this.list({ ...(params || {}),
|
|
49
|
+
const page = await this.list({ ...(params || {}), after: cursor }, options);
|
|
50
50
|
for (const item of page.data)
|
|
51
51
|
yield item;
|
|
52
|
-
cursor = page.
|
|
52
|
+
cursor = page.pagination.next_cursor;
|
|
53
53
|
} while (cursor);
|
|
54
54
|
}
|
|
55
55
|
/**
|