@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.
Files changed (67) hide show
  1. package/README.md +376 -80
  2. package/dist/index.d.ts +6 -7
  3. package/dist/index.js +6 -7
  4. package/dist/lib/client.d.ts +5 -8
  5. package/dist/lib/client.js +5 -7
  6. package/dist/lib/http/HttpClient.js +5 -3
  7. package/dist/lib/resources/ActivitiesClient.d.ts +86 -27
  8. package/dist/lib/resources/ActivitiesClient.js +90 -29
  9. package/dist/lib/resources/AgentsClient.d.ts +68 -15
  10. package/dist/lib/resources/AgentsClient.js +75 -17
  11. package/dist/lib/resources/BoardsClient.d.ts +3 -3
  12. package/dist/lib/resources/BoardsClient.js +2 -2
  13. package/dist/lib/resources/CardsClient.d.ts +139 -12
  14. package/dist/lib/resources/CardsClient.js +171 -25
  15. package/dist/lib/resources/ExternalChannelsClient.d.ts +3 -3
  16. package/dist/lib/resources/ExternalChannelsClient.js +2 -2
  17. package/dist/lib/resources/ResourcesClient.d.ts +3 -30
  18. package/dist/lib/resources/ResourcesClient.js +2 -26
  19. package/dist/lib/resources/TeamsClient.d.ts +3 -3
  20. package/dist/lib/resources/TeamsClient.js +2 -2
  21. package/dist/types/a2a-data-parts.d.ts +2 -2
  22. package/dist/types/entities/activities.d.ts +56 -14
  23. package/dist/types/entities/activities.js +73 -1
  24. package/dist/types/entities/agent.d.ts +47 -5
  25. package/dist/types/entities/agent.js +25 -1
  26. package/dist/types/entities/card.d.ts +16 -26
  27. package/dist/types/entities/card.js +26 -1
  28. package/dist/types/entities/external-channel.d.ts +25 -5
  29. package/dist/types/entities/external-channel.js +16 -1
  30. package/dist/types/entities/index.d.ts +4 -5
  31. package/dist/types/entities/index.js +4 -5
  32. package/dist/types/entities/resource.d.ts +21 -12
  33. package/dist/types/entities/resource.js +7 -1
  34. package/dist/types/responses.d.ts +10 -10
  35. package/package.json +33 -6
  36. package/dist/lib/resources/BenchmarkExecutionsClient.d.ts +0 -250
  37. package/dist/lib/resources/BenchmarkExecutionsClient.js +0 -261
  38. package/dist/lib/resources/BenchmarksClient.d.ts +0 -159
  39. package/dist/lib/resources/BenchmarksClient.js +0 -158
  40. package/dist/lib/resources/SupervisorFeedbackClient.d.ts +0 -75
  41. package/dist/lib/resources/SupervisorFeedbackClient.js +0 -67
  42. package/dist/lib/resources/TeamMembersClient.d.ts +0 -66
  43. package/dist/lib/resources/TeamMembersClient.js +0 -75
  44. package/dist/lib/resources/__tests__/ActivitiesClient.test.d.ts +0 -1
  45. package/dist/lib/resources/__tests__/ActivitiesClient.test.js +0 -33
  46. package/dist/lib/resources/__tests__/AgentsClient.test.d.ts +0 -1
  47. package/dist/lib/resources/__tests__/AgentsClient.test.js +0 -37
  48. package/dist/lib/resources/__tests__/BenchmarkExecutionsClient.test.d.ts +0 -1
  49. package/dist/lib/resources/__tests__/BenchmarkExecutionsClient.test.js +0 -59
  50. package/dist/lib/resources/__tests__/BenchmarksClient.test.d.ts +0 -1
  51. package/dist/lib/resources/__tests__/BenchmarksClient.test.js +0 -42
  52. package/dist/lib/resources/__tests__/BoardsClient.test.d.ts +0 -1
  53. package/dist/lib/resources/__tests__/BoardsClient.test.js +0 -26
  54. package/dist/lib/resources/__tests__/CardsClient.test.d.ts +0 -1
  55. package/dist/lib/resources/__tests__/CardsClient.test.js +0 -62
  56. package/dist/lib/resources/__tests__/ExternalChannelsClient.test.d.ts +0 -1
  57. package/dist/lib/resources/__tests__/ExternalChannelsClient.test.js +0 -26
  58. package/dist/lib/resources/__tests__/ResourcesClient.test.d.ts +0 -1
  59. package/dist/lib/resources/__tests__/ResourcesClient.test.js +0 -28
  60. package/dist/lib/resources/__tests__/SupervisorFeedbackClient.test.d.ts +0 -1
  61. package/dist/lib/resources/__tests__/SupervisorFeedbackClient.test.js +0 -24
  62. package/dist/lib/resources/__tests__/TeamMembersClient.test.d.ts +0 -1
  63. package/dist/lib/resources/__tests__/TeamMembersClient.test.js +0 -26
  64. package/dist/lib/resources/__tests__/TeamsClient.test.d.ts +0 -1
  65. package/dist/lib/resources/__tests__/TeamsClient.test.js +0 -26
  66. package/dist/types/entities/benchmark.d.ts +0 -82
  67. package/dist/types/entities/benchmark.js +0 -1
@@ -1,7 +1,7 @@
1
+ import { Activity, ActivityActor, ActivityCreate, Card } 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 { Card, CreateCardInput, UpdateCardInput, ActivityActor } from '../../types/entities';
4
- import { ListParams, Paginated } from '../../types/responses';
5
5
  /**
6
6
  * Client for managing cards in the Kaiban platform
7
7
  * Cards represent work items, tasks, or tickets within boards
@@ -48,11 +48,11 @@ export declare class CardsClient {
48
48
  * }
49
49
  * ```
50
50
  */
51
- listAll(params?: Omit<ListParams, 'cursor'>, options?: RequestOptions): AsyncGenerator<Card, void, unknown>;
51
+ listAll(params?: Omit<ListParams, 'after' | 'before'>, options?: RequestOptions): AsyncGenerator<Card, void, unknown>;
52
52
  /**
53
53
  * Get a single card by ID
54
54
  *
55
- * @param id - The unique identifier of the card
55
+ * @param cardId - The unique identifier of the card
56
56
  * @param options - Optional request configuration
57
57
  *
58
58
  * @returns The card object
@@ -65,7 +65,7 @@ export declare class CardsClient {
65
65
  * console.log(card.title, card.description);
66
66
  * ```
67
67
  */
68
- get(id: string, options?: RequestOptions): Promise<Card>;
68
+ get(cardId: string, options?: RequestOptions): Promise<Card>;
69
69
  /**
70
70
  * Create a new card with optional activity tracking
71
71
  *
@@ -91,13 +91,13 @@ export declare class CardsClient {
91
91
  * }, { create_activity: true });
92
92
  * ```
93
93
  */
94
- create(data: CreateCardInput, options?: RequestOptions & {
94
+ create(data: Omit<Card, 'id' | 'created_at'>, options?: RequestOptions & {
95
95
  create_activity?: boolean;
96
96
  }): Promise<Card>;
97
97
  /**
98
98
  * Update a card's properties
99
99
  *
100
- * @param id - The unique identifier of the card to update
100
+ * @param cardId - The unique identifier of the card to update
101
101
  * @param data - Card data with fields to update
102
102
  * @param options - Optional request configuration
103
103
  *
@@ -113,11 +113,11 @@ export declare class CardsClient {
113
113
  * });
114
114
  * ```
115
115
  */
116
- update(id: string, data: UpdateCardInput, options?: RequestOptions): Promise<Card>;
116
+ update(cardId: string, data: Partial<Omit<Card, 'id' | 'created_at' | 'updated_at'>>, options?: RequestOptions): Promise<Card>;
117
117
  /**
118
118
  * Delete a card by ID
119
119
  *
120
- * @param id - The unique identifier of the card to delete
120
+ * @param cardId - The unique identifier of the card to delete
121
121
  * @param options - Optional request configuration
122
122
  *
123
123
  * @returns Promise that resolves when the card is deleted
@@ -129,12 +129,12 @@ export declare class CardsClient {
129
129
  * await client.cards.delete('card-123');
130
130
  * ```
131
131
  */
132
- delete(id: string, options?: RequestOptions): Promise<void>;
132
+ delete(cardId: string, options?: RequestOptions): Promise<void>;
133
133
  /**
134
134
  * Move a card to a new column and automatically record the activity
135
135
  * This is a convenience method that combines update and activity creation
136
136
  *
137
- * @param id - The unique identifier of the card to move
137
+ * @param cardId - The unique identifier of the card to move
138
138
  * @param newColumnKey - The key of the destination column
139
139
  * @param options - Optional request configuration
140
140
  * @param options.actor - The actor performing the move (defaults to SDK system actor)
@@ -155,7 +155,134 @@ export declare class CardsClient {
155
155
  * });
156
156
  * ```
157
157
  */
158
- moveToColumn(id: string, newColumnKey: string, options?: RequestOptions & {
158
+ moveToColumn(cardId: string, newColumnKey: string, options?: RequestOptions & {
159
159
  actor?: ActivityActor;
160
160
  }): Promise<Card>;
161
+ /**
162
+ * Create a new activity for a card
163
+ * Activities track changes, comments, and events on cards
164
+ *
165
+ * @param cardId - The unique identifier of the card
166
+ * @param data - Activity creation data (card_id is automatically added)
167
+ * @param data.board_id - The board ID
168
+ * @param data.team_id - The team ID
169
+ * @param data.type - The type of activity (e.g., 'card_created', 'card_updated', 'comment')
170
+ * @param data.description - A description of the activity
171
+ * @param data.actor - The actor who performed the activity
172
+ * @param options - Optional request configuration
173
+ *
174
+ * @returns The created activity object
175
+ *
176
+ * @throws {Error} If the card is not found or creation fails
177
+ *
178
+ * @example
179
+ * ```typescript
180
+ * const activity = await client.cards.createActivity('card-123', {
181
+ * board_id: 'board-456',
182
+ * team_id: 'team-789',
183
+ * type: 'comment',
184
+ * description: 'Added a comment',
185
+ * actor: {
186
+ * id: 'user-001',
187
+ * type: 'user',
188
+ * name: 'Jane Doe'
189
+ * }
190
+ * });
191
+ * ```
192
+ */
193
+ createActivity(cardId: string, data: Omit<ActivityCreate, 'card_id'>, options?: RequestOptions): Promise<Activity>;
194
+ /**
195
+ * Create multiple activities for a card in a single batch request
196
+ * This is more efficient than creating activities one by one
197
+ *
198
+ * @param cardId - The unique identifier of the card
199
+ * @param data - Array of activity creation data (card_id is automatically added to each)
200
+ * @param options - Optional request configuration
201
+ *
202
+ * @returns The batch creation result
203
+ *
204
+ * @throws {Error} If the card is not found or batch creation fails
205
+ *
206
+ * @example
207
+ * ```typescript
208
+ * const activities = await client.cards.createBatchActivities('card-123', [
209
+ * {
210
+ * board_id: 'board-456',
211
+ * team_id: 'team-789',
212
+ * type: 'comment',
213
+ * description: 'First comment',
214
+ * actor: { id: 'user-001', type: 'user', name: 'Jane Doe' }
215
+ * },
216
+ * {
217
+ * board_id: 'board-456',
218
+ * team_id: 'team-789',
219
+ * type: 'card_updated',
220
+ * description: 'Updated priority',
221
+ * actor: { id: 'user-001', type: 'user', name: 'Jane Doe' }
222
+ * }
223
+ * ]);
224
+ * ```
225
+ */
226
+ createBatchActivities(cardId: string, data: Omit<ActivityCreate, 'card_id'>[], options?: RequestOptions): Promise<Activity>;
227
+ /**
228
+ * List activities for a specific card with pagination, filters, and sorting
229
+ *
230
+ * @param cardId - The unique identifier of the card
231
+ * @param params - Optional query parameters for filtering and pagination
232
+ * @param params.limit - Number of items per page
233
+ * @param params.after - Cursor to navigate forwards
234
+ * @param params.before - Cursor to navigate backwards
235
+ * @param params.order_by - Fields to sort by
236
+ * @param options - Optional request configuration
237
+ *
238
+ * @returns A paginated list of activities
239
+ *
240
+ * @example
241
+ * ```typescript
242
+ * // Get first page of activities
243
+ * const result = await client.cards.listActivities('card-123', {
244
+ * limit: 20,
245
+ * order_by: '-created_at'
246
+ * });
247
+ * console.log(result.data); // Array of Activity objects
248
+ *
249
+ * // Get next page
250
+ * if (result.pagination.next_cursor) {
251
+ * const nextPage = await client.cards.listActivities('card-123', {
252
+ * limit: 20,
253
+ * after: result.pagination.next_cursor
254
+ * });
255
+ * }
256
+ * ```
257
+ */
258
+ listActivities(cardId: string, params?: ListParams, options?: RequestOptions): Promise<Paginated<Activity>>;
259
+ /**
260
+ * Iterate through all activities for a card using async generator
261
+ * Automatically handles pagination by following next_cursor
262
+ *
263
+ * @param cardId - The unique identifier of the card
264
+ * @param params - Optional query parameters (excluding after/before cursors)
265
+ * @param params.limit - Number of items per page (used internally for pagination)
266
+ * @param params.order_by - Fields to sort by
267
+ * @param options - Optional request configuration
268
+ *
269
+ * @yields Individual Activity objects
270
+ *
271
+ * @example
272
+ * ```typescript
273
+ * // Process all activities for a card
274
+ * for await (const activity of client.cards.listAllActivities('card-123')) {
275
+ * console.log(activity.type, activity.description);
276
+ * }
277
+ *
278
+ * // With custom page size and ordering
279
+ * for await (const activity of client.cards.listAllActivities('card-123', {
280
+ * limit: 100,
281
+ * order_by: '-created_at'
282
+ * })) {
283
+ * console.log(activity);
284
+ * }
285
+ * ```
286
+ */
287
+ listAllActivities(cardId: string, params?: Omit<ListParams, 'after' | 'before'>, options?: RequestOptions): AsyncGenerator<Activity, void, unknown>;
161
288
  }
@@ -1,3 +1,4 @@
1
+ import { ActivityType } from '../../types/entities';
1
2
  // Minimal create-activity payload aligned to backend activity schema
2
3
  // Activity types are shared in entities
3
4
  /**
@@ -52,16 +53,16 @@ export class CardsClient {
52
53
  async *listAll(params, options) {
53
54
  let cursor = undefined;
54
55
  do {
55
- const page = await this.list({ ...(params || {}), cursor }, options);
56
+ const page = await this.list({ ...(params || {}), after: cursor }, options);
56
57
  for (const item of page.data)
57
58
  yield item;
58
- cursor = page.meta.next_cursor;
59
+ cursor = page.pagination.next_cursor;
59
60
  } while (cursor);
60
61
  }
61
62
  /**
62
63
  * Get a single card by ID
63
64
  *
64
- * @param id - The unique identifier of the card
65
+ * @param cardId - The unique identifier of the card
65
66
  * @param options - Optional request configuration
66
67
  *
67
68
  * @returns The card object
@@ -74,8 +75,8 @@ export class CardsClient {
74
75
  * console.log(card.title, card.description);
75
76
  * ```
76
77
  */
77
- get(id, options) {
78
- return this.http.get(`/card/${encodeURIComponent(id)}`, options);
78
+ get(cardId, options) {
79
+ return this.http.get(`/card/${encodeURIComponent(cardId)}`, options);
79
80
  }
80
81
  /**
81
82
  * Create a new card with optional activity tracking
@@ -105,22 +106,20 @@ export class CardsClient {
105
106
  async create(data, options) {
106
107
  const card = await this.http.post('/cards', data, options);
107
108
  if (options?.create_activity) {
108
- const activity = {
109
+ await this.createActivity(card.id, {
109
110
  board_id: card.board_id,
110
111
  team_id: card.team_id,
111
- card_id: card.id,
112
- type: 'card_created',
112
+ type: ActivityType.CARD_CREATED,
113
113
  description: 'Card created',
114
114
  actor: { id: 'sdk', type: 'system', name: 'Kaiban SDK' },
115
- };
116
- await this.http.post(`/card/${encodeURIComponent(card.id)}/activities`, activity, options);
115
+ }, options);
117
116
  }
118
117
  return card;
119
118
  }
120
119
  /**
121
120
  * Update a card's properties
122
121
  *
123
- * @param id - The unique identifier of the card to update
122
+ * @param cardId - The unique identifier of the card to update
124
123
  * @param data - Card data with fields to update
125
124
  * @param options - Optional request configuration
126
125
  *
@@ -136,13 +135,13 @@ export class CardsClient {
136
135
  * });
137
136
  * ```
138
137
  */
139
- update(id, data, options) {
140
- return this.http.put(`/card/${encodeURIComponent(id)}`, data, options);
138
+ update(cardId, data, options) {
139
+ return this.http.put(`/card/${encodeURIComponent(cardId)}`, data, options);
141
140
  }
142
141
  /**
143
142
  * Delete a card by ID
144
143
  *
145
- * @param id - The unique identifier of the card to delete
144
+ * @param cardId - The unique identifier of the card to delete
146
145
  * @param options - Optional request configuration
147
146
  *
148
147
  * @returns Promise that resolves when the card is deleted
@@ -154,15 +153,15 @@ export class CardsClient {
154
153
  * await client.cards.delete('card-123');
155
154
  * ```
156
155
  */
157
- delete(id, options) {
158
- return this.http.delete(`/card/${encodeURIComponent(id)}`, options);
156
+ delete(cardId, options) {
157
+ return this.http.delete(`/card/${encodeURIComponent(cardId)}`, options);
159
158
  }
160
159
  // Activity operations moved to ActivitiesClient
161
160
  /**
162
161
  * Move a card to a new column and automatically record the activity
163
162
  * This is a convenience method that combines update and activity creation
164
163
  *
165
- * @param id - The unique identifier of the card to move
164
+ * @param cardId - The unique identifier of the card to move
166
165
  * @param newColumnKey - The key of the destination column
167
166
  * @param options - Optional request configuration
168
167
  * @param options.actor - The actor performing the move (defaults to SDK system actor)
@@ -183,20 +182,167 @@ export class CardsClient {
183
182
  * });
184
183
  * ```
185
184
  */
186
- async moveToColumn(id, newColumnKey, options) {
187
- const current = await this.get(id, options);
185
+ async moveToColumn(cardId, newColumnKey, options) {
186
+ const current = await this.get(cardId, options);
188
187
  const oldColumn = current.column_key;
189
- const updated = await this.update(id, { column_key: newColumnKey }, options);
190
- const activity = {
188
+ const updated = await this.update(cardId, { column_key: newColumnKey }, options);
189
+ await this.createActivity(cardId, {
191
190
  board_id: updated.board_id,
192
191
  team_id: updated.team_id,
193
- card_id: updated.id,
194
- type: 'card_column_changed',
192
+ type: ActivityType.CARD_COLUMN_CHANGED,
195
193
  description: `Moved card from ${oldColumn} to ${newColumnKey}`,
196
194
  actor: options?.actor || { id: 'sdk', type: 'system', name: 'Kaiban SDK' },
197
195
  changes: [{ field: 'column_key', old_value: oldColumn, new_value: newColumnKey }],
198
- };
199
- await this.http.post(`/card/${encodeURIComponent(updated.id)}/activities`, activity, options);
196
+ }, options);
200
197
  return updated;
201
198
  }
199
+ /**
200
+ * Create a new activity for a card
201
+ * Activities track changes, comments, and events on cards
202
+ *
203
+ * @param cardId - The unique identifier of the card
204
+ * @param data - Activity creation data (card_id is automatically added)
205
+ * @param data.board_id - The board ID
206
+ * @param data.team_id - The team ID
207
+ * @param data.type - The type of activity (e.g., 'card_created', 'card_updated', 'comment')
208
+ * @param data.description - A description of the activity
209
+ * @param data.actor - The actor who performed the activity
210
+ * @param options - Optional request configuration
211
+ *
212
+ * @returns The created activity object
213
+ *
214
+ * @throws {Error} If the card is not found or creation fails
215
+ *
216
+ * @example
217
+ * ```typescript
218
+ * const activity = await client.cards.createActivity('card-123', {
219
+ * board_id: 'board-456',
220
+ * team_id: 'team-789',
221
+ * type: 'comment',
222
+ * description: 'Added a comment',
223
+ * actor: {
224
+ * id: 'user-001',
225
+ * type: 'user',
226
+ * name: 'Jane Doe'
227
+ * }
228
+ * });
229
+ * ```
230
+ */
231
+ createActivity(cardId, data, options) {
232
+ return this.http.post(`/card/${encodeURIComponent(cardId)}/activities`, {
233
+ ...data,
234
+ card_id: cardId,
235
+ }, options);
236
+ }
237
+ /**
238
+ * Create multiple activities for a card in a single batch request
239
+ * This is more efficient than creating activities one by one
240
+ *
241
+ * @param cardId - The unique identifier of the card
242
+ * @param data - Array of activity creation data (card_id is automatically added to each)
243
+ * @param options - Optional request configuration
244
+ *
245
+ * @returns The batch creation result
246
+ *
247
+ * @throws {Error} If the card is not found or batch creation fails
248
+ *
249
+ * @example
250
+ * ```typescript
251
+ * const activities = await client.cards.createBatchActivities('card-123', [
252
+ * {
253
+ * board_id: 'board-456',
254
+ * team_id: 'team-789',
255
+ * type: 'comment',
256
+ * description: 'First comment',
257
+ * actor: { id: 'user-001', type: 'user', name: 'Jane Doe' }
258
+ * },
259
+ * {
260
+ * board_id: 'board-456',
261
+ * team_id: 'team-789',
262
+ * type: 'card_updated',
263
+ * description: 'Updated priority',
264
+ * actor: { id: 'user-001', type: 'user', name: 'Jane Doe' }
265
+ * }
266
+ * ]);
267
+ * ```
268
+ */
269
+ createBatchActivities(cardId, data, options) {
270
+ return this.http.post(`/activities:batch`, {
271
+ items: data.map((item) => ({
272
+ ...item,
273
+ card_id: cardId,
274
+ })),
275
+ }, options);
276
+ }
277
+ /**
278
+ * List activities for a specific card with pagination, filters, and sorting
279
+ *
280
+ * @param cardId - The unique identifier of the card
281
+ * @param params - Optional query parameters for filtering and pagination
282
+ * @param params.limit - Number of items per page
283
+ * @param params.after - Cursor to navigate forwards
284
+ * @param params.before - Cursor to navigate backwards
285
+ * @param params.order_by - Fields to sort by
286
+ * @param options - Optional request configuration
287
+ *
288
+ * @returns A paginated list of activities
289
+ *
290
+ * @example
291
+ * ```typescript
292
+ * // Get first page of activities
293
+ * const result = await client.cards.listActivities('card-123', {
294
+ * limit: 20,
295
+ * order_by: '-created_at'
296
+ * });
297
+ * console.log(result.data); // Array of Activity objects
298
+ *
299
+ * // Get next page
300
+ * if (result.pagination.next_cursor) {
301
+ * const nextPage = await client.cards.listActivities('card-123', {
302
+ * limit: 20,
303
+ * after: result.pagination.next_cursor
304
+ * });
305
+ * }
306
+ * ```
307
+ */
308
+ listActivities(cardId, params, options) {
309
+ return this.http.list(`/card/${encodeURIComponent(cardId)}/activities`, params, options);
310
+ }
311
+ /**
312
+ * Iterate through all activities for a card using async generator
313
+ * Automatically handles pagination by following next_cursor
314
+ *
315
+ * @param cardId - The unique identifier of the card
316
+ * @param params - Optional query parameters (excluding after/before cursors)
317
+ * @param params.limit - Number of items per page (used internally for pagination)
318
+ * @param params.order_by - Fields to sort by
319
+ * @param options - Optional request configuration
320
+ *
321
+ * @yields Individual Activity objects
322
+ *
323
+ * @example
324
+ * ```typescript
325
+ * // Process all activities for a card
326
+ * for await (const activity of client.cards.listAllActivities('card-123')) {
327
+ * console.log(activity.type, activity.description);
328
+ * }
329
+ *
330
+ * // With custom page size and ordering
331
+ * for await (const activity of client.cards.listAllActivities('card-123', {
332
+ * limit: 100,
333
+ * order_by: '-created_at'
334
+ * })) {
335
+ * console.log(activity);
336
+ * }
337
+ * ```
338
+ */
339
+ async *listAllActivities(cardId, params, options) {
340
+ let cursor = undefined;
341
+ do {
342
+ const page = await this.listActivities(cardId, { ...(params || {}), after: cursor }, options);
343
+ for (const item of page.data)
344
+ yield item;
345
+ cursor = page.pagination.next_cursor;
346
+ } while (cursor);
347
+ }
202
348
  }
@@ -1,7 +1,7 @@
1
- import { HttpClient } from '../http/HttpClient';
2
- import { RequestOptions } from '../http/types';
3
1
  import { ExternalChannel } 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 external channels in the Kaiban platform
7
7
  * External channels represent integrations with external communication platforms
@@ -44,7 +44,7 @@ export declare class ExternalChannelsClient {
44
44
  * }
45
45
  * ```
46
46
  */
47
- listAll(params?: Omit<ListParams, 'cursor'>, options?: RequestOptions): AsyncGenerator<ExternalChannel, void, unknown>;
47
+ listAll(params?: Omit<ListParams, 'after' | 'before'>, options?: RequestOptions): AsyncGenerator<ExternalChannel, void, unknown>;
48
48
  /**
49
49
  * Get a single external channel by ID
50
50
  *
@@ -46,10 +46,10 @@ export class ExternalChannelsClient {
46
46
  async *listAll(params, options) {
47
47
  let cursor = undefined;
48
48
  do {
49
- const page = await this.list({ ...(params || {}), cursor }, options);
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.meta.next_cursor;
52
+ cursor = page.pagination.next_cursor;
53
53
  } while (cursor);
54
54
  }
55
55
  /**
@@ -1,7 +1,7 @@
1
- import { HttpClient } from '../http/HttpClient';
2
- import { RequestOptions } from '../http/types';
3
1
  import { Resource } 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 resources in the Kaiban platform
7
7
  * Resources can include documents, files, or other materials
@@ -44,7 +44,7 @@ export declare class ResourcesClient {
44
44
  * }
45
45
  * ```
46
46
  */
47
- listAll(params?: Omit<ListParams, 'cursor'>, options?: RequestOptions): AsyncGenerator<Resource, void, unknown>;
47
+ listAll(params?: Omit<ListParams, 'after' | 'before'>, options?: RequestOptions): AsyncGenerator<Resource, void, unknown>;
48
48
  /**
49
49
  * Get a single resource by ID
50
50
  *
@@ -62,31 +62,4 @@ export declare class ResourcesClient {
62
62
  * ```
63
63
  */
64
64
  get(id: string, options?: RequestOptions): Promise<Resource>;
65
- /**
66
- * Publish a resource to make it available
67
- *
68
- * @param params - Publish parameters
69
- * @param params.resource_id - The unique identifier of the resource to publish
70
- * @param params.userId - The ID of the user publishing the resource
71
- * @param options - Optional request configuration
72
- *
73
- * @returns A response with a success message
74
- *
75
- * @throws {Error} If the resource is not found or publish fails
76
- *
77
- * @example
78
- * ```typescript
79
- * const result = await client.resources.publish({
80
- * resource_id: 'resource-123',
81
- * userId: 'user-456'
82
- * });
83
- * console.log(result.message);
84
- * ```
85
- */
86
- publish(params: {
87
- resource_id: string;
88
- userId: string;
89
- }, options?: RequestOptions): Promise<{
90
- message: string;
91
- }>;
92
65
  }
@@ -46,10 +46,10 @@ export class ResourcesClient {
46
46
  async *listAll(params, options) {
47
47
  let cursor = undefined;
48
48
  do {
49
- const page = await this.list({ ...(params || {}), cursor }, options);
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.meta.next_cursor;
52
+ cursor = page.pagination.next_cursor;
53
53
  } while (cursor);
54
54
  }
55
55
  /**
@@ -71,28 +71,4 @@ export class ResourcesClient {
71
71
  get(id, options) {
72
72
  return this.http.get(`/resource/${encodeURIComponent(id)}`, options);
73
73
  }
74
- /**
75
- * Publish a resource to make it available
76
- *
77
- * @param params - Publish parameters
78
- * @param params.resource_id - The unique identifier of the resource to publish
79
- * @param params.userId - The ID of the user publishing the resource
80
- * @param options - Optional request configuration
81
- *
82
- * @returns A response with a success message
83
- *
84
- * @throws {Error} If the resource is not found or publish fails
85
- *
86
- * @example
87
- * ```typescript
88
- * const result = await client.resources.publish({
89
- * resource_id: 'resource-123',
90
- * userId: 'user-456'
91
- * });
92
- * console.log(result.message);
93
- * ```
94
- */
95
- publish(params, options) {
96
- return this.http.post(`/resource/${encodeURIComponent(params.resource_id)}/publish`, { userId: params.userId }, options);
97
- }
98
74
  }
@@ -1,7 +1,7 @@
1
- import { HttpClient } from '../http/HttpClient';
2
- import { RequestOptions } from '../http/types';
3
1
  import { Team } 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 teams in the Kaiban platform
7
7
  * @category Resources
@@ -62,7 +62,7 @@ export declare class TeamsClient {
62
62
  * }
63
63
  * ```
64
64
  */
65
- listAll(params?: Omit<ListParams, 'cursor'>, options?: RequestOptions): AsyncGenerator<Team, void, unknown>;
65
+ listAll(params?: Omit<ListParams, 'after' | 'before'>, options?: RequestOptions): AsyncGenerator<Team, void, unknown>;
66
66
  /**
67
67
  * Get a single team by ID
68
68
  *
@@ -64,10 +64,10 @@ export class TeamsClient {
64
64
  async *listAll(params, options) {
65
65
  let cursor = undefined;
66
66
  do {
67
- const page = await this.list({ ...(params || {}), cursor }, options);
67
+ const page = await this.list({ ...(params || {}), after: cursor }, options);
68
68
  for (const item of page.data)
69
69
  yield item;
70
- cursor = page.meta.next_cursor;
70
+ cursor = page.pagination.next_cursor;
71
71
  } while (cursor);
72
72
  }
73
73
  /**
@@ -1,4 +1,4 @@
1
- import { ActivityCreate } from './entities';
1
+ import { Activity } from './entities';
2
2
  export declare const A2ADataPartType: {
3
3
  readonly TOOL_CALL_START: "tool_call_start";
4
4
  readonly TOOL_CALL_ARGS: "tool_call_args";
@@ -56,7 +56,7 @@ export type UserThreadFeedbackPart = A2ADataPartBase<'user_thread_feedback', {
56
56
  feedback: string;
57
57
  }>;
58
58
  export type KaibanActivityPart = A2ADataPartBase<'kaiban_activity', {
59
- activity: ActivityCreate;
59
+ activity: Activity;
60
60
  }>;
61
61
  export type AgentStatusPart = A2ADataPartBase<'agent_status', {
62
62
  status: string;