@kaiban/sdk 0.3.0 → 0.4.0

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 CHANGED
@@ -35,12 +35,11 @@ The SDK provides clients for the following API resources:
35
35
 
36
36
  ### Available Resource Clients
37
37
 
38
- - **agents**: `list`, `listAll`, `get`, `create`, `update`, `createFeedback`, `listSupervisorFeedback`
39
- - **teamMembers**: `list`, `listAll`, `get`
38
+ - **agents**: `list`, `listAll`, `get`, `update`, `createFeedback`, `listSupervisorFeedback`
40
39
  - **cards**: `list`, `listAll`, `get`, `create`, `update`, `delete`, `moveToColumn`, `createActivity`, `createBatchActivities`, `listActivities`, `listAllActivities`
41
40
  - **activities**: `list`, `listAll`, `create`, `createBatch`
42
41
  - **teams**: `list`, `listAll`, `get`
43
- - **boards**: `list`, `listAll`, `get`, `create`
42
+ - **boards**: `list`, `listAll`, `get`
44
43
  - **resources**: `list`, `listAll`, `get`
45
44
  - **external_channels**: `list`, `listAll`, `get`
46
45
  - **costs**: `calculateCosts` (offline utility for model cost calculations)
@@ -359,19 +358,6 @@ for await (const agent of client.agents.listAll({ limit: 100 })) {
359
358
  // Get agent by id
360
359
  const agent = await client.agents.get('agent-123');
361
360
 
362
- // Create a new agent
363
- const newAgent = await client.agents.create({
364
- name: 'SupportAgent',
365
- description: 'Handles support tickets',
366
- team_id: 'team_123',
367
- owner_id: 'user_123',
368
- created_by: 'user_123',
369
- type: 'a2a',
370
- status: 'active',
371
- monthly_budget: 200,
372
- examples: [],
373
- });
374
-
375
361
  // Update agent
376
362
  const updated = await client.agents.update('agent-123', {
377
363
  name: 'Updated Name',
@@ -414,24 +400,6 @@ for await (const team of client.teams.listAll()) {
414
400
  const team = await client.teams.get('team-123');
415
401
  ```
416
402
 
417
- ### Team Members
418
-
419
- ```ts
420
- // List team members with pagination
421
- const result = await client.teamMembers.list({
422
- limit: 20,
423
- order_by: '-joined_at',
424
- });
425
-
426
- // Iterate through all team members
427
- for await (const member of client.teamMembers.listAll({ limit: 100 })) {
428
- console.log(member.id, member.user_id, member.role);
429
- }
430
-
431
- // Get a specific team member
432
- const member = await client.teamMembers.get('tm-123');
433
- ```
434
-
435
403
  ### Boards
436
404
 
437
405
  ```ts
@@ -445,17 +413,6 @@ for await (const board of client.boards.listAll()) {
445
413
 
446
414
  // Get a specific board
447
415
  const board = await client.boards.get('board-123');
448
-
449
- // Create a new board
450
- const newBoard = await client.boards.create({
451
- name: 'Sales',
452
- team_id: 'team_123',
453
- owner_id: 'user_123',
454
- created_by: 'user_123',
455
- description: 'Manage pipeline',
456
- columns: [],
457
- // agent_ids, member_ids, and allowed_roles are optional (default to [])
458
- });
459
416
  ```
460
417
 
461
418
  ### Cards
@@ -9,7 +9,6 @@ const CardsClient_1 = require("./resources/CardsClient");
9
9
  const ExternalChannelsClient_1 = require("./resources/ExternalChannelsClient");
10
10
  const ModelCost_1 = require("./resources/ModelCost");
11
11
  const ResourcesClient_1 = require("./resources/ResourcesClient");
12
- const TeamMembersClient_1 = require("./resources/TeamMembersClient");
13
12
  const TeamsClient_1 = require("./resources/TeamsClient");
14
13
  /**
15
14
  * Create a Kaiban SDK client instance
@@ -47,7 +46,6 @@ function createKaibanClient(config) {
47
46
  cards: new CardsClient_1.CardsClient(http),
48
47
  activities: new ActivitiesClient_1.ActivitiesClient(http),
49
48
  teams: new TeamsClient_1.TeamsClient(http),
50
- teamMembers: new TeamMembersClient_1.TeamMembersClient(http),
51
49
  boards: new BoardsClient_1.BoardsClient(http),
52
50
  resources: new ResourcesClient_1.ResourcesClient(http),
53
51
  external_channels: new ExternalChannelsClient_1.ExternalChannelsClient(http),
@@ -105,34 +105,6 @@ class AgentsClient {
105
105
  get(id, options) {
106
106
  return this.http.get(`/agent/${encodeURIComponent(id)}`, options);
107
107
  }
108
- /**
109
- * Create a new agent
110
- *
111
- * @param data - Agent creation data
112
- * @param options - Optional request configuration
113
- *
114
- * @returns The newly created agent object
115
- *
116
- * @throws {Error} If creation fails
117
- *
118
- * @example
119
- * ```typescript
120
- * const agent = await client.agents.create({
121
- * name: 'SupportAgent',
122
- * description: 'Handles support tickets',
123
- * team_id: 'team_123',
124
- * owner_id: 'user_123',
125
- * created_by: 'user_123',
126
- * type: 'a2a',
127
- * status: 'active',
128
- * monthly_budget: 200,
129
- * examples: []
130
- * });
131
- * ```
132
- */
133
- create(data, options) {
134
- return this.http.post('/agents', data, options);
135
- }
136
108
  /**
137
109
  * Update an agent's properties
138
110
  *
@@ -74,47 +74,5 @@ class BoardsClient {
74
74
  get(id, options) {
75
75
  return this.http.get(`/board/${encodeURIComponent(id)}`, options);
76
76
  }
77
- /**
78
- * Create a new board
79
- *
80
- * @param data - Board creation data
81
- * @param data.name - The board name
82
- * @param data.team_id - The team this board belongs to
83
- * @param data.owner_id - The owner of the board
84
- * @param data.created_by - The user creating the board
85
- * @param data.description - Board description
86
- * @param data.agent_ids - Array of agent IDs
87
- * @param data.member_ids - Array of member IDs
88
- * @param data.allowed_roles - Array of allowed roles
89
- * @param data.columns - Array of columns
90
- * @param options - Optional request configuration
91
- *
92
- * @returns The newly created board
93
- *
94
- * @throws {Error} If creation fails
95
- *
96
- * @example
97
- * ```typescript
98
- * const board = await client.boards.create({
99
- * name: 'Sales',
100
- * team_id: 'team_123',
101
- * owner_id: 'user_123',
102
- * created_by: 'user_123',
103
- * description: 'Manage pipeline',
104
- * columns: []
105
- * // agent_ids, member_ids, and allowed_roles are optional (default to [])
106
- * });
107
- * ```
108
- */
109
- create(data, options) {
110
- // Default empty arrays for optional fields
111
- const payload = {
112
- ...data,
113
- agent_ids: data.agent_ids ?? [],
114
- member_ids: data.member_ids ?? [],
115
- allowed_roles: data.allowed_roles ?? [],
116
- };
117
- return this.http.post('/boards', payload, options);
118
- }
119
77
  }
120
78
  exports.BoardsClient = BoardsClient;
@@ -24,6 +24,8 @@ exports.ActivityType = {
24
24
  CARD_CLONED: 'card_cloned',
25
25
  CARD_COLUMN_CHANGED: 'card_column_changed',
26
26
  // A2A task status activities
27
+ // "submitted" | "working" | "input-required" | "completed" | "canceled" | "failed" | "rejected"
28
+ // | "auth-required" | "unknown"
27
29
  A2A_TASK_STATUS_SUBMITTED: 'submitted',
28
30
  A2A_TASK_STATUS_WORKING: 'working',
29
31
  A2A_TASK_STATUS_INPUT_REQUIRED: 'required',
@@ -6,7 +6,6 @@ import { CardsClient } from './resources/CardsClient.js';
6
6
  import { ExternalChannelsClient } from './resources/ExternalChannelsClient.js';
7
7
  import { ModelCost } from './resources/ModelCost.js';
8
8
  import { ResourcesClient } from './resources/ResourcesClient.js';
9
- import { TeamMembersClient } from './resources/TeamMembersClient.js';
10
9
  import { TeamsClient } from './resources/TeamsClient.js';
11
10
  /**
12
11
  * Create a Kaiban SDK client instance
@@ -44,7 +43,6 @@ export function createKaibanClient(config) {
44
43
  cards: new CardsClient(http),
45
44
  activities: new ActivitiesClient(http),
46
45
  teams: new TeamsClient(http),
47
- teamMembers: new TeamMembersClient(http),
48
46
  boards: new BoardsClient(http),
49
47
  resources: new ResourcesClient(http),
50
48
  external_channels: new ExternalChannelsClient(http),
@@ -102,34 +102,6 @@ export class AgentsClient {
102
102
  get(id, options) {
103
103
  return this.http.get(`/agent/${encodeURIComponent(id)}`, options);
104
104
  }
105
- /**
106
- * Create a new agent
107
- *
108
- * @param data - Agent creation data
109
- * @param options - Optional request configuration
110
- *
111
- * @returns The newly created agent object
112
- *
113
- * @throws {Error} If creation fails
114
- *
115
- * @example
116
- * ```typescript
117
- * const agent = await client.agents.create({
118
- * name: 'SupportAgent',
119
- * description: 'Handles support tickets',
120
- * team_id: 'team_123',
121
- * owner_id: 'user_123',
122
- * created_by: 'user_123',
123
- * type: 'a2a',
124
- * status: 'active',
125
- * monthly_budget: 200,
126
- * examples: []
127
- * });
128
- * ```
129
- */
130
- create(data, options) {
131
- return this.http.post('/agents', data, options);
132
- }
133
105
  /**
134
106
  * Update an agent's properties
135
107
  *
@@ -71,46 +71,4 @@ export class BoardsClient {
71
71
  get(id, options) {
72
72
  return this.http.get(`/board/${encodeURIComponent(id)}`, options);
73
73
  }
74
- /**
75
- * Create a new board
76
- *
77
- * @param data - Board creation data
78
- * @param data.name - The board name
79
- * @param data.team_id - The team this board belongs to
80
- * @param data.owner_id - The owner of the board
81
- * @param data.created_by - The user creating the board
82
- * @param data.description - Board description
83
- * @param data.agent_ids - Array of agent IDs
84
- * @param data.member_ids - Array of member IDs
85
- * @param data.allowed_roles - Array of allowed roles
86
- * @param data.columns - Array of columns
87
- * @param options - Optional request configuration
88
- *
89
- * @returns The newly created board
90
- *
91
- * @throws {Error} If creation fails
92
- *
93
- * @example
94
- * ```typescript
95
- * const board = await client.boards.create({
96
- * name: 'Sales',
97
- * team_id: 'team_123',
98
- * owner_id: 'user_123',
99
- * created_by: 'user_123',
100
- * description: 'Manage pipeline',
101
- * columns: []
102
- * // agent_ids, member_ids, and allowed_roles are optional (default to [])
103
- * });
104
- * ```
105
- */
106
- create(data, options) {
107
- // Default empty arrays for optional fields
108
- const payload = {
109
- ...data,
110
- agent_ids: data.agent_ids ?? [],
111
- member_ids: data.member_ids ?? [],
112
- allowed_roles: data.allowed_roles ?? [],
113
- };
114
- return this.http.post('/boards', payload, options);
115
- }
116
74
  }
@@ -21,6 +21,8 @@ export const ActivityType = {
21
21
  CARD_CLONED: 'card_cloned',
22
22
  CARD_COLUMN_CHANGED: 'card_column_changed',
23
23
  // A2A task status activities
24
+ // "submitted" | "working" | "input-required" | "completed" | "canceled" | "failed" | "rejected"
25
+ // | "auth-required" | "unknown"
24
26
  A2A_TASK_STATUS_SUBMITTED: 'submitted',
25
27
  A2A_TASK_STATUS_WORKING: 'working',
26
28
  A2A_TASK_STATUS_INPUT_REQUIRED: 'required',
@@ -6,7 +6,6 @@ import { CardsClient } from './resources/CardsClient';
6
6
  import { ExternalChannelsClient } from './resources/ExternalChannelsClient';
7
7
  import { ModelCost } from './resources/ModelCost';
8
8
  import { ResourcesClient } from './resources/ResourcesClient';
9
- import { TeamMembersClient } from './resources/TeamMembersClient';
10
9
  import { TeamsClient } from './resources/TeamsClient';
11
10
  /**
12
11
  * Main Kaiban SDK client interface providing access to all API resources
@@ -26,8 +25,6 @@ export interface KaibanClient {
26
25
  activities: ActivitiesClient;
27
26
  /** Client for managing teams */
28
27
  teams: TeamsClient;
29
- /** Client for managing team members */
30
- teamMembers: TeamMembersClient;
31
28
  /** Client for managing boards */
32
29
  boards: BoardsClient;
33
30
  /** Client for managing resources */
@@ -93,32 +93,6 @@ export declare class AgentsClient {
93
93
  * ```
94
94
  */
95
95
  get(id: string, options?: RequestOptions): Promise<Agent>;
96
- /**
97
- * Create a new agent
98
- *
99
- * @param data - Agent creation data
100
- * @param options - Optional request configuration
101
- *
102
- * @returns The newly created agent object
103
- *
104
- * @throws {Error} If creation fails
105
- *
106
- * @example
107
- * ```typescript
108
- * const agent = await client.agents.create({
109
- * name: 'SupportAgent',
110
- * description: 'Handles support tickets',
111
- * team_id: 'team_123',
112
- * owner_id: 'user_123',
113
- * created_by: 'user_123',
114
- * type: 'a2a',
115
- * status: 'active',
116
- * monthly_budget: 200,
117
- * examples: []
118
- * });
119
- * ```
120
- */
121
- create(data: Omit<Agent, 'id' | 'created_at' | 'updated_at' | 'last_active'>, options?: RequestOptions): Promise<Agent>;
122
96
  /**
123
97
  * Update an agent's properties
124
98
  *
@@ -1,4 +1,4 @@
1
- import { Board, CreateBoardInput } from '../../types/entities';
1
+ import { Board } from '../../types/entities';
2
2
  import { ListParams, Paginated } from '../../types/responses';
3
3
  import { HttpClient } from '../http/HttpClient';
4
4
  import { RequestOptions } from '../http/types';
@@ -62,37 +62,4 @@ export declare class BoardsClient {
62
62
  * ```
63
63
  */
64
64
  get(id: string, options?: RequestOptions): Promise<Board>;
65
- /**
66
- * Create a new board
67
- *
68
- * @param data - Board creation data
69
- * @param data.name - The board name
70
- * @param data.team_id - The team this board belongs to
71
- * @param data.owner_id - The owner of the board
72
- * @param data.created_by - The user creating the board
73
- * @param data.description - Board description
74
- * @param data.agent_ids - Array of agent IDs
75
- * @param data.member_ids - Array of member IDs
76
- * @param data.allowed_roles - Array of allowed roles
77
- * @param data.columns - Array of columns
78
- * @param options - Optional request configuration
79
- *
80
- * @returns The newly created board
81
- *
82
- * @throws {Error} If creation fails
83
- *
84
- * @example
85
- * ```typescript
86
- * const board = await client.boards.create({
87
- * name: 'Sales',
88
- * team_id: 'team_123',
89
- * owner_id: 'user_123',
90
- * created_by: 'user_123',
91
- * description: 'Manage pipeline',
92
- * columns: []
93
- * // agent_ids, member_ids, and allowed_roles are optional (default to [])
94
- * });
95
- * ```
96
- */
97
- create(data: CreateBoardInput, options?: RequestOptions): Promise<Board>;
98
65
  }
@@ -68,18 +68,16 @@ export interface ActivityChange {
68
68
  new_value: unknown;
69
69
  }
70
70
  export interface Activity {
71
- id?: string;
71
+ id: string;
72
72
  board_id: string;
73
+ team_id: string;
73
74
  card_id: string;
74
75
  type: (typeof ActivityType)[keyof typeof ActivityType];
75
76
  description: string;
76
77
  actor: ActivityActor;
77
78
  changes?: ActivityChange[];
78
- created_at?: ISODate;
79
- created_by_session_id?: string;
80
79
  metadata?: Record<string, unknown>;
81
80
  user_id?: string;
82
- team_id: string;
83
- marked_for_display?: boolean;
81
+ created_at: ISODate;
84
82
  }
85
83
  export type ActivityCreate = Omit<Activity, 'id' | 'created_at'>;
@@ -16,22 +16,22 @@ export interface AgentExample {
16
16
  }
17
17
  export interface Agent {
18
18
  id: string;
19
- created_by: string;
20
- description: string;
21
- examples: AgentExample[];
22
- integrations?: string[];
23
- last_active: ISODate;
24
- monthly_budget: number;
25
19
  name: string;
26
- owner_id: string;
27
- roles?: string[];
28
- status: (typeof AgentStatus)[keyof typeof AgentStatus];
20
+ description: string;
29
21
  team_id: string;
22
+ status: (typeof AgentStatus)[keyof typeof AgentStatus];
30
23
  type: (typeof AgentType)[keyof typeof AgentType];
31
- updated_at: ISODate;
32
- active_cards?: number;
33
- created_at?: ISODate;
24
+ roles: string[];
25
+ owner_id: string;
26
+ created_by: string;
27
+ monthly_budget: number;
34
28
  config?: Record<string, unknown>;
29
+ created_at: ISODate;
30
+ updated_at?: ISODate;
31
+ last_active: ISODate;
32
+ examples: AgentExample[];
33
+ integrations?: string[];
34
+ active_cards?: number;
35
35
  }
36
36
  export declare const AgentFeedbackStatus: {
37
37
  readonly UNPROCESSED: "unprocessed";
@@ -61,10 +61,10 @@ export interface AgentFeedback {
61
61
  }
62
62
  export interface AgentSupervisorFeedback {
63
63
  id: string;
64
- activity_id: string;
64
+ agent_id: string;
65
65
  team_id: string;
66
+ activity_id: string;
66
67
  board_id: string;
67
- agent_id: string;
68
68
  feedback: string;
69
69
  created_by: string;
70
70
  created_at: ISODate;
@@ -9,23 +9,17 @@ export interface Column {
9
9
  }
10
10
  export interface Board {
11
11
  id: string;
12
- agent_ids: string[];
13
- created_at: ISODate;
14
- created_by: string;
15
- description: string;
16
- member_ids: string[];
17
12
  name: string;
18
- owner_id: string;
13
+ description: string;
19
14
  team_id: string;
20
- columns: Column[];
15
+ owner_id: string;
16
+ created_by: string;
17
+ created_at: ISODate;
18
+ agent_ids: string[];
19
+ member_ids: string[];
21
20
  allowed_roles: string[];
21
+ columns: Column[];
22
+ tags: string[];
23
+ dashboard_id?: string | null;
24
+ is_favorite?: boolean;
22
25
  }
23
- /**
24
- * Input type for creating a new board
25
- * Fields agent_ids, member_ids, and allowed_roles are optional and default to []
26
- */
27
- export type CreateBoardInput = Omit<Board, 'id' | 'created_at'> & {
28
- agent_ids?: string[];
29
- member_ids?: string[];
30
- allowed_roles?: string[];
31
- };
@@ -6,28 +6,19 @@ export declare const CardStatus: {
6
6
  readonly BLOCKED: "blocked";
7
7
  readonly DONE: "done";
8
8
  };
9
- export interface TextPart {
9
+ export type CardPart = {
10
10
  type: 'text';
11
- text: string;
12
- metadata?: Record<string, unknown>;
13
- }
14
- export interface FileContent {
15
- name: string;
16
- mimeType: string;
17
- bytes?: string;
18
- uri?: string;
19
- }
20
- export interface FilePart {
11
+ text: {
12
+ content: string;
13
+ };
14
+ } | {
21
15
  type: 'file';
22
- file: FileContent;
23
- metadata?: Record<string, unknown>;
24
- }
25
- export interface DataPart {
26
- type: 'data';
27
- data: Record<string, unknown>;
28
- metadata?: Record<string, unknown>;
29
- }
30
- export type CardPart = TextPart | FilePart | DataPart;
16
+ file: {
17
+ name: string;
18
+ mimeType: string;
19
+ uri: string;
20
+ };
21
+ };
31
22
  export interface Card {
32
23
  id: string;
33
24
  team_id: string;
@@ -38,12 +29,12 @@ export interface Card {
38
29
  description?: string;
39
30
  status: (typeof CardStatus)[keyof typeof CardStatus];
40
31
  column_key: string;
41
- created_at?: ISODate;
42
- updated_at?: ISODate;
43
32
  priority: string;
44
33
  result?: string;
45
34
  member_ids: string[];
46
35
  metadata?: Record<string, unknown>;
47
36
  enabled?: boolean;
48
37
  parts?: CardPart[];
38
+ created_at: ISODate;
39
+ updated_at?: ISODate;
49
40
  }
@@ -27,6 +27,6 @@ export interface ExternalChannel {
27
27
  status: (typeof ExternalChannelStatus)[keyof typeof ExternalChannelStatus];
28
28
  priority: (typeof ExternalChannelPriority)[keyof typeof ExternalChannelPriority];
29
29
  metadata?: Record<string, unknown>;
30
- created_at?: ISODate;
30
+ created_at: ISODate;
31
31
  updated_at?: ISODate;
32
32
  }
@@ -7,10 +7,9 @@ export interface Team {
7
7
  }
8
8
  export interface TeamMember {
9
9
  id: string;
10
+ team_id: string;
11
+ role: string;
10
12
  is_agent: boolean;
11
13
  joined_at: ISODate;
12
- role: string;
13
- team_id: string;
14
- user_id: string;
15
14
  created_at: ISODate;
16
15
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kaiban/sdk",
3
- "version": "0.3.0",
3
+ "version": "0.4.0",
4
4
  "description": "Official TypeScript SDK for the Kaiban API",
5
5
  "keywords": [
6
6
  "kaiban",
@@ -76,7 +76,7 @@
76
76
  },
77
77
  "devDependencies": {
78
78
  "@eslint/js": "^9.12.0",
79
- "@vitest/coverage-v8": "^4.0.16",
79
+ "@vitest/coverage-v8": "^2.1.1",
80
80
  "eslint": "^9.12.0",
81
81
  "eslint-config-prettier": "^9.1.0",
82
82
  "prettier": "^3.3.3",
@@ -85,6 +85,6 @@
85
85
  "typedoc": "^0.28.14",
86
86
  "typescript": "^5.4.0",
87
87
  "typescript-eslint": "^8.8.0",
88
- "vitest": "^4.0.16"
88
+ "vitest": "^2.1.1"
89
89
  }
90
90
  }
@@ -1,102 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.TeamMembersClient = void 0;
4
- /**
5
- * Client for managing team members in the Kaiban platform
6
- * @category Resources
7
- */
8
- class TeamMembersClient {
9
- constructor(http) {
10
- this.http = http;
11
- }
12
- /**
13
- * List team members with pagination, filters, and sorting
14
- *
15
- * @param params - Optional query parameters for filtering and pagination
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
21
- * @param options - Optional request configuration
22
- *
23
- * @returns A paginated list of team members
24
- *
25
- * @example
26
- * ```typescript
27
- * // List first page of team members
28
- * const result = await client.teamMembers.list({ limit: 10 });
29
- * console.log(result.data); // Array of TeamMember objects
30
- * console.log(result.pagination.next_cursor); // Cursor for next page
31
- *
32
- * // Get next page using cursor
33
- * if (result.pagination.next_cursor) {
34
- * const nextPage = await client.teamMembers.list({
35
- * limit: 10,
36
- * after: result.pagination.next_cursor
37
- * });
38
- * }
39
- * ```
40
- */
41
- list(params, options) {
42
- return this.http.list('/team-members', params, options);
43
- }
44
- /**
45
- * Iterate through all team members using async generator
46
- * Automatically handles pagination by following next_cursor
47
- *
48
- * @param params - Optional query parameters (excluding after/before cursors)
49
- * @param params.limit - Number of items per page (used internally for pagination)
50
- * @param params.order_by - Fields to sort by (prefix with - for descending order)
51
- * @param params.filters - Filter parameters to narrow results
52
- * @param options - Optional request configuration
53
- *
54
- * @yields Individual TeamMember objects
55
- *
56
- * @example
57
- * ```typescript
58
- * // Iterate through all team members
59
- * for await (const member of client.teamMembers.listAll()) {
60
- * console.log(member.id, member.user_id, member.role);
61
- * }
62
- *
63
- * // With custom page size and sorting
64
- * for await (const member of client.teamMembers.listAll({
65
- * limit: 100,
66
- * order_by: '-joined_at',
67
- * filters: { team_id: 'team_123' }
68
- * })) {
69
- * console.log(member);
70
- * }
71
- * ```
72
- */
73
- async *listAll(params, options) {
74
- let cursor = undefined;
75
- do {
76
- const page = await this.list({ ...(params || {}), after: cursor }, options);
77
- for (const item of page.data)
78
- yield item;
79
- cursor = page.pagination.next_cursor;
80
- } while (cursor);
81
- }
82
- /**
83
- * Get a single team member by ID
84
- *
85
- * @param id - The unique identifier of the team member
86
- * @param options - Optional request configuration
87
- *
88
- * @returns The team member object
89
- *
90
- * @throws {Error} If the team member is not found or request fails
91
- *
92
- * @example
93
- * ```typescript
94
- * const member = await client.teamMembers.get('tm-123');
95
- * console.log(member.user_id, member.role);
96
- * ```
97
- */
98
- get(id, options) {
99
- return this.http.get(`/team-member/${encodeURIComponent(id)}`, options);
100
- }
101
- }
102
- exports.TeamMembersClient = TeamMembersClient;
@@ -1,98 +0,0 @@
1
- /**
2
- * Client for managing team members in the Kaiban platform
3
- * @category Resources
4
- */
5
- export class TeamMembersClient {
6
- constructor(http) {
7
- this.http = http;
8
- }
9
- /**
10
- * List team members with pagination, filters, and sorting
11
- *
12
- * @param params - Optional query parameters for filtering and pagination
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
18
- * @param options - Optional request configuration
19
- *
20
- * @returns A paginated list of team members
21
- *
22
- * @example
23
- * ```typescript
24
- * // List first page of team members
25
- * const result = await client.teamMembers.list({ limit: 10 });
26
- * console.log(result.data); // Array of TeamMember objects
27
- * console.log(result.pagination.next_cursor); // Cursor for next page
28
- *
29
- * // Get next page using cursor
30
- * if (result.pagination.next_cursor) {
31
- * const nextPage = await client.teamMembers.list({
32
- * limit: 10,
33
- * after: result.pagination.next_cursor
34
- * });
35
- * }
36
- * ```
37
- */
38
- list(params, options) {
39
- return this.http.list('/team-members', params, options);
40
- }
41
- /**
42
- * Iterate through all team members using async generator
43
- * Automatically handles pagination by following next_cursor
44
- *
45
- * @param params - Optional query parameters (excluding after/before cursors)
46
- * @param params.limit - Number of items per page (used internally for pagination)
47
- * @param params.order_by - Fields to sort by (prefix with - for descending order)
48
- * @param params.filters - Filter parameters to narrow results
49
- * @param options - Optional request configuration
50
- *
51
- * @yields Individual TeamMember objects
52
- *
53
- * @example
54
- * ```typescript
55
- * // Iterate through all team members
56
- * for await (const member of client.teamMembers.listAll()) {
57
- * console.log(member.id, member.user_id, member.role);
58
- * }
59
- *
60
- * // With custom page size and sorting
61
- * for await (const member of client.teamMembers.listAll({
62
- * limit: 100,
63
- * order_by: '-joined_at',
64
- * filters: { team_id: 'team_123' }
65
- * })) {
66
- * console.log(member);
67
- * }
68
- * ```
69
- */
70
- async *listAll(params, options) {
71
- let cursor = undefined;
72
- do {
73
- const page = await this.list({ ...(params || {}), after: cursor }, options);
74
- for (const item of page.data)
75
- yield item;
76
- cursor = page.pagination.next_cursor;
77
- } while (cursor);
78
- }
79
- /**
80
- * Get a single team member by ID
81
- *
82
- * @param id - The unique identifier of the team member
83
- * @param options - Optional request configuration
84
- *
85
- * @returns The team member object
86
- *
87
- * @throws {Error} If the team member is not found or request fails
88
- *
89
- * @example
90
- * ```typescript
91
- * const member = await client.teamMembers.get('tm-123');
92
- * console.log(member.user_id, member.role);
93
- * ```
94
- */
95
- get(id, options) {
96
- return this.http.get(`/team-member/${encodeURIComponent(id)}`, options);
97
- }
98
- }
@@ -1,89 +0,0 @@
1
- import { TeamMember } from '../../types/entities';
2
- import { ListParams, Paginated } from '../../types/responses';
3
- import { HttpClient } from '../http/HttpClient';
4
- import { RequestOptions } from '../http/types';
5
- /**
6
- * Client for managing team members in the Kaiban platform
7
- * @category Resources
8
- */
9
- export declare class TeamMembersClient {
10
- private readonly http;
11
- constructor(http: HttpClient);
12
- /**
13
- * List team members with pagination, filters, and sorting
14
- *
15
- * @param params - Optional query parameters for filtering and pagination
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
21
- * @param options - Optional request configuration
22
- *
23
- * @returns A paginated list of team members
24
- *
25
- * @example
26
- * ```typescript
27
- * // List first page of team members
28
- * const result = await client.teamMembers.list({ limit: 10 });
29
- * console.log(result.data); // Array of TeamMember objects
30
- * console.log(result.pagination.next_cursor); // Cursor for next page
31
- *
32
- * // Get next page using cursor
33
- * if (result.pagination.next_cursor) {
34
- * const nextPage = await client.teamMembers.list({
35
- * limit: 10,
36
- * after: result.pagination.next_cursor
37
- * });
38
- * }
39
- * ```
40
- */
41
- list(params?: ListParams, options?: RequestOptions): Promise<Paginated<TeamMember>>;
42
- /**
43
- * Iterate through all team members using async generator
44
- * Automatically handles pagination by following next_cursor
45
- *
46
- * @param params - Optional query parameters (excluding after/before cursors)
47
- * @param params.limit - Number of items per page (used internally for pagination)
48
- * @param params.order_by - Fields to sort by (prefix with - for descending order)
49
- * @param params.filters - Filter parameters to narrow results
50
- * @param options - Optional request configuration
51
- *
52
- * @yields Individual TeamMember objects
53
- *
54
- * @example
55
- * ```typescript
56
- * // Iterate through all team members
57
- * for await (const member of client.teamMembers.listAll()) {
58
- * console.log(member.id, member.user_id, member.role);
59
- * }
60
- *
61
- * // With custom page size and sorting
62
- * for await (const member of client.teamMembers.listAll({
63
- * limit: 100,
64
- * order_by: '-joined_at',
65
- * filters: { team_id: 'team_123' }
66
- * })) {
67
- * console.log(member);
68
- * }
69
- * ```
70
- */
71
- listAll(params?: Omit<ListParams, 'after' | 'before'>, options?: RequestOptions): AsyncGenerator<TeamMember, void, unknown>;
72
- /**
73
- * Get a single team member by ID
74
- *
75
- * @param id - The unique identifier of the team member
76
- * @param options - Optional request configuration
77
- *
78
- * @returns The team member object
79
- *
80
- * @throws {Error} If the team member is not found or request fails
81
- *
82
- * @example
83
- * ```typescript
84
- * const member = await client.teamMembers.get('tm-123');
85
- * console.log(member.user_id, member.role);
86
- * ```
87
- */
88
- get(id: string, options?: RequestOptions): Promise<TeamMember>;
89
- }