@kaiban/sdk 0.1.1

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 (86) hide show
  1. package/README.md +225 -0
  2. package/dist/index.d.ts +15 -0
  3. package/dist/index.js +15 -0
  4. package/dist/lib/client.d.ts +65 -0
  5. package/dist/lib/client.js +51 -0
  6. package/dist/lib/http/HttpClient.d.ts +16 -0
  7. package/dist/lib/http/HttpClient.js +237 -0
  8. package/dist/lib/http/errors.d.ts +50 -0
  9. package/dist/lib/http/errors.js +126 -0
  10. package/dist/lib/http/types.d.ts +40 -0
  11. package/dist/lib/http/types.js +1 -0
  12. package/dist/lib/resources/ActivitiesClient.d.ts +89 -0
  13. package/dist/lib/resources/ActivitiesClient.js +99 -0
  14. package/dist/lib/resources/AgentsClient.d.ts +121 -0
  15. package/dist/lib/resources/AgentsClient.js +134 -0
  16. package/dist/lib/resources/BenchmarkExecutionsClient.d.ts +250 -0
  17. package/dist/lib/resources/BenchmarkExecutionsClient.js +261 -0
  18. package/dist/lib/resources/BenchmarksClient.d.ts +159 -0
  19. package/dist/lib/resources/BenchmarksClient.js +158 -0
  20. package/dist/lib/resources/BoardsClient.d.ts +65 -0
  21. package/dist/lib/resources/BoardsClient.js +74 -0
  22. package/dist/lib/resources/CardsClient.d.ts +161 -0
  23. package/dist/lib/resources/CardsClient.js +202 -0
  24. package/dist/lib/resources/ExternalChannelsClient.d.ts +65 -0
  25. package/dist/lib/resources/ExternalChannelsClient.js +74 -0
  26. package/dist/lib/resources/ResourcesClient.d.ts +92 -0
  27. package/dist/lib/resources/ResourcesClient.js +98 -0
  28. package/dist/lib/resources/SupervisorFeedbackClient.d.ts +75 -0
  29. package/dist/lib/resources/SupervisorFeedbackClient.js +67 -0
  30. package/dist/lib/resources/TeamMembersClient.d.ts +66 -0
  31. package/dist/lib/resources/TeamMembersClient.js +75 -0
  32. package/dist/lib/resources/TeamsClient.d.ts +83 -0
  33. package/dist/lib/resources/TeamsClient.js +92 -0
  34. package/dist/lib/resources/__tests__/ActivitiesClient.test.d.ts +1 -0
  35. package/dist/lib/resources/__tests__/ActivitiesClient.test.js +33 -0
  36. package/dist/lib/resources/__tests__/AgentsClient.test.d.ts +1 -0
  37. package/dist/lib/resources/__tests__/AgentsClient.test.js +37 -0
  38. package/dist/lib/resources/__tests__/BenchmarkExecutionsClient.test.d.ts +1 -0
  39. package/dist/lib/resources/__tests__/BenchmarkExecutionsClient.test.js +59 -0
  40. package/dist/lib/resources/__tests__/BenchmarksClient.test.d.ts +1 -0
  41. package/dist/lib/resources/__tests__/BenchmarksClient.test.js +42 -0
  42. package/dist/lib/resources/__tests__/BoardsClient.test.d.ts +1 -0
  43. package/dist/lib/resources/__tests__/BoardsClient.test.js +26 -0
  44. package/dist/lib/resources/__tests__/CardsClient.test.d.ts +1 -0
  45. package/dist/lib/resources/__tests__/CardsClient.test.js +62 -0
  46. package/dist/lib/resources/__tests__/ExternalChannelsClient.test.d.ts +1 -0
  47. package/dist/lib/resources/__tests__/ExternalChannelsClient.test.js +26 -0
  48. package/dist/lib/resources/__tests__/ResourcesClient.test.d.ts +1 -0
  49. package/dist/lib/resources/__tests__/ResourcesClient.test.js +28 -0
  50. package/dist/lib/resources/__tests__/SupervisorFeedbackClient.test.d.ts +1 -0
  51. package/dist/lib/resources/__tests__/SupervisorFeedbackClient.test.js +24 -0
  52. package/dist/lib/resources/__tests__/TeamMembersClient.test.d.ts +1 -0
  53. package/dist/lib/resources/__tests__/TeamMembersClient.test.js +26 -0
  54. package/dist/lib/resources/__tests__/TeamsClient.test.d.ts +1 -0
  55. package/dist/lib/resources/__tests__/TeamsClient.test.js +26 -0
  56. package/dist/test/helpers/mockFetch.d.ts +8 -0
  57. package/dist/test/helpers/mockFetch.js +22 -0
  58. package/dist/types/a2a-data-parts.d.ts +64 -0
  59. package/dist/types/a2a-data-parts.js +13 -0
  60. package/dist/types/entities/activities.d.ts +32 -0
  61. package/dist/types/entities/activities.js +1 -0
  62. package/dist/types/entities/agent.d.ts +16 -0
  63. package/dist/types/entities/agent.js +1 -0
  64. package/dist/types/entities/benchmark.d.ts +82 -0
  65. package/dist/types/entities/benchmark.js +1 -0
  66. package/dist/types/entities/board.d.ts +20 -0
  67. package/dist/types/entities/board.js +1 -0
  68. package/dist/types/entities/card.d.ts +50 -0
  69. package/dist/types/entities/card.js +1 -0
  70. package/dist/types/entities/external-channel.d.ts +12 -0
  71. package/dist/types/entities/external-channel.js +1 -0
  72. package/dist/types/entities/index.d.ts +9 -0
  73. package/dist/types/entities/index.js +9 -0
  74. package/dist/types/entities/resource.d.ts +16 -0
  75. package/dist/types/entities/resource.js +1 -0
  76. package/dist/types/entities/shared.d.ts +1 -0
  77. package/dist/types/entities/shared.js +2 -0
  78. package/dist/types/entities/team.d.ts +14 -0
  79. package/dist/types/entities/team.js +1 -0
  80. package/dist/types/entities.d.ts +1 -0
  81. package/dist/types/entities.js +1 -0
  82. package/dist/types/requests.d.ts +22 -0
  83. package/dist/types/requests.js +1 -0
  84. package/dist/types/responses.d.ts +77 -0
  85. package/dist/types/responses.js +1 -0
  86. package/package.json +54 -0
@@ -0,0 +1,65 @@
1
+ import { HttpClient } from '../http/HttpClient';
2
+ import { RequestOptions } from '../http/types';
3
+ import { ExternalChannel } from '../../types/entities';
4
+ import { ListParams, Paginated } from '../../types/responses';
5
+ /**
6
+ * Client for managing external channels in the Kaiban platform
7
+ * External channels represent integrations with external communication platforms
8
+ * @category Resources
9
+ */
10
+ export declare class ExternalChannelsClient {
11
+ private readonly http;
12
+ constructor(http: HttpClient);
13
+ /**
14
+ * List external channels with pagination, filters, and sorting
15
+ *
16
+ * @param params - Optional query parameters for filtering and pagination
17
+ * @param params.cursor - Cursor for the next page of results
18
+ * @param params.limit - Number of items per page
19
+ * @param params.order_by - Fields to sort by
20
+ * @param options - Optional request configuration
21
+ *
22
+ * @returns A paginated list of external channels
23
+ *
24
+ * @example
25
+ * ```typescript
26
+ * const result = await client.externalChannels.list({ limit: 15 });
27
+ * console.log(result.items);
28
+ * ```
29
+ */
30
+ list(params?: ListParams, options?: RequestOptions): Promise<Paginated<ExternalChannel>>;
31
+ /**
32
+ * Iterate through all external channels using async generator
33
+ * Automatically handles pagination by following next_page_token
34
+ *
35
+ * @param params - Optional query parameters (excluding cursor)
36
+ * @param options - Optional request configuration
37
+ *
38
+ * @yields Individual ExternalChannel objects
39
+ *
40
+ * @example
41
+ * ```typescript
42
+ * for await (const channel of client.externalChannels.listAll()) {
43
+ * console.log(channel.id, channel.platform, channel.name);
44
+ * }
45
+ * ```
46
+ */
47
+ listAll(params?: Omit<ListParams, 'cursor'>, options?: RequestOptions): AsyncGenerator<ExternalChannel, void, unknown>;
48
+ /**
49
+ * Get a single external channel by ID
50
+ *
51
+ * @param id - The unique identifier of the external channel
52
+ * @param options - Optional request configuration
53
+ *
54
+ * @returns The external channel object
55
+ *
56
+ * @throws {Error} If the channel is not found or request fails
57
+ *
58
+ * @example
59
+ * ```typescript
60
+ * const channel = await client.externalChannels.get('channel-123');
61
+ * console.log(channel.platform, channel.configuration);
62
+ * ```
63
+ */
64
+ get(id: string, options?: RequestOptions): Promise<ExternalChannel>;
65
+ }
@@ -0,0 +1,74 @@
1
+ /**
2
+ * Client for managing external channels in the Kaiban platform
3
+ * External channels represent integrations with external communication platforms
4
+ * @category Resources
5
+ */
6
+ export class ExternalChannelsClient {
7
+ constructor(http) {
8
+ this.http = http;
9
+ }
10
+ /**
11
+ * List external channels with pagination, filters, and sorting
12
+ *
13
+ * @param params - Optional query parameters for filtering and pagination
14
+ * @param params.cursor - Cursor for the next page of results
15
+ * @param params.limit - Number of items per page
16
+ * @param params.order_by - Fields to sort by
17
+ * @param options - Optional request configuration
18
+ *
19
+ * @returns A paginated list of external channels
20
+ *
21
+ * @example
22
+ * ```typescript
23
+ * const result = await client.externalChannels.list({ limit: 15 });
24
+ * console.log(result.items);
25
+ * ```
26
+ */
27
+ list(params, options) {
28
+ return this.http.list('/external-channels', params, options);
29
+ }
30
+ /**
31
+ * Iterate through all external channels using async generator
32
+ * Automatically handles pagination by following next_page_token
33
+ *
34
+ * @param params - Optional query parameters (excluding cursor)
35
+ * @param options - Optional request configuration
36
+ *
37
+ * @yields Individual ExternalChannel objects
38
+ *
39
+ * @example
40
+ * ```typescript
41
+ * for await (const channel of client.externalChannels.listAll()) {
42
+ * console.log(channel.id, channel.platform, channel.name);
43
+ * }
44
+ * ```
45
+ */
46
+ async *listAll(params, options) {
47
+ let cursor = undefined;
48
+ do {
49
+ const page = await this.list({ ...(params || {}), cursor }, options);
50
+ for (const item of page.data)
51
+ yield item;
52
+ cursor = page.meta.next_cursor;
53
+ } while (cursor);
54
+ }
55
+ /**
56
+ * Get a single external channel by ID
57
+ *
58
+ * @param id - The unique identifier of the external channel
59
+ * @param options - Optional request configuration
60
+ *
61
+ * @returns The external channel object
62
+ *
63
+ * @throws {Error} If the channel is not found or request fails
64
+ *
65
+ * @example
66
+ * ```typescript
67
+ * const channel = await client.externalChannels.get('channel-123');
68
+ * console.log(channel.platform, channel.configuration);
69
+ * ```
70
+ */
71
+ get(id, options) {
72
+ return this.http.get(`/external-channel/${encodeURIComponent(id)}`, options);
73
+ }
74
+ }
@@ -0,0 +1,92 @@
1
+ import { HttpClient } from '../http/HttpClient';
2
+ import { RequestOptions } from '../http/types';
3
+ import { Resource } from '../../types/entities';
4
+ import { ListParams, Paginated } from '../../types/responses';
5
+ /**
6
+ * Client for managing resources in the Kaiban platform
7
+ * Resources can include documents, files, or other materials
8
+ * @category Resources
9
+ */
10
+ export declare class ResourcesClient {
11
+ private readonly http;
12
+ constructor(http: HttpClient);
13
+ /**
14
+ * List resources with pagination, filters, and sorting
15
+ *
16
+ * @param params - Optional query parameters for filtering and pagination
17
+ * @param params.cursor - Cursor for the next page of results
18
+ * @param params.limit - Number of items per page
19
+ * @param params.order_by - Fields to sort by
20
+ * @param options - Optional request configuration
21
+ *
22
+ * @returns A paginated list of resources
23
+ *
24
+ * @example
25
+ * ```typescript
26
+ * const result = await client.resources.list({ limit: 25 });
27
+ * console.log(result.items);
28
+ * ```
29
+ */
30
+ list(params?: ListParams, options?: RequestOptions): Promise<Paginated<Resource>>;
31
+ /**
32
+ * Iterate through all resources using async generator
33
+ * Automatically handles pagination by following next_page_token
34
+ *
35
+ * @param params - Optional query parameters (excluding cursor)
36
+ * @param options - Optional request configuration
37
+ *
38
+ * @yields Individual Resource objects
39
+ *
40
+ * @example
41
+ * ```typescript
42
+ * for await (const resource of client.resources.listAll()) {
43
+ * console.log(resource.id, resource.name);
44
+ * }
45
+ * ```
46
+ */
47
+ listAll(params?: Omit<ListParams, 'cursor'>, options?: RequestOptions): AsyncGenerator<Resource, void, unknown>;
48
+ /**
49
+ * Get a single resource by ID
50
+ *
51
+ * @param id - The unique identifier of the resource
52
+ * @param options - Optional request configuration
53
+ *
54
+ * @returns The resource object
55
+ *
56
+ * @throws {Error} If the resource is not found or request fails
57
+ *
58
+ * @example
59
+ * ```typescript
60
+ * const resource = await client.resources.get('resource-123');
61
+ * console.log(resource.name, resource.type);
62
+ * ```
63
+ */
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
+ }
@@ -0,0 +1,98 @@
1
+ /**
2
+ * Client for managing resources in the Kaiban platform
3
+ * Resources can include documents, files, or other materials
4
+ * @category Resources
5
+ */
6
+ export class ResourcesClient {
7
+ constructor(http) {
8
+ this.http = http;
9
+ }
10
+ /**
11
+ * List resources with pagination, filters, and sorting
12
+ *
13
+ * @param params - Optional query parameters for filtering and pagination
14
+ * @param params.cursor - Cursor for the next page of results
15
+ * @param params.limit - Number of items per page
16
+ * @param params.order_by - Fields to sort by
17
+ * @param options - Optional request configuration
18
+ *
19
+ * @returns A paginated list of resources
20
+ *
21
+ * @example
22
+ * ```typescript
23
+ * const result = await client.resources.list({ limit: 25 });
24
+ * console.log(result.items);
25
+ * ```
26
+ */
27
+ list(params, options) {
28
+ return this.http.list('/resources', params, options);
29
+ }
30
+ /**
31
+ * Iterate through all resources using async generator
32
+ * Automatically handles pagination by following next_page_token
33
+ *
34
+ * @param params - Optional query parameters (excluding cursor)
35
+ * @param options - Optional request configuration
36
+ *
37
+ * @yields Individual Resource objects
38
+ *
39
+ * @example
40
+ * ```typescript
41
+ * for await (const resource of client.resources.listAll()) {
42
+ * console.log(resource.id, resource.name);
43
+ * }
44
+ * ```
45
+ */
46
+ async *listAll(params, options) {
47
+ let cursor = undefined;
48
+ do {
49
+ const page = await this.list({ ...(params || {}), cursor }, options);
50
+ for (const item of page.data)
51
+ yield item;
52
+ cursor = page.meta.next_cursor;
53
+ } while (cursor);
54
+ }
55
+ /**
56
+ * Get a single resource by ID
57
+ *
58
+ * @param id - The unique identifier of the resource
59
+ * @param options - Optional request configuration
60
+ *
61
+ * @returns The resource object
62
+ *
63
+ * @throws {Error} If the resource is not found or request fails
64
+ *
65
+ * @example
66
+ * ```typescript
67
+ * const resource = await client.resources.get('resource-123');
68
+ * console.log(resource.name, resource.type);
69
+ * ```
70
+ */
71
+ get(id, options) {
72
+ return this.http.get(`/resource/${encodeURIComponent(id)}`, options);
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
+ }
@@ -0,0 +1,75 @@
1
+ import { HttpClient } from '../http/HttpClient';
2
+ import { RequestOptions } from '../http/types';
3
+ import { ListParams, Paginated } from '../../types/responses';
4
+ /**
5
+ * Supervisor feedback item
6
+ */
7
+ export interface SupervisorFeedbackItem {
8
+ /** Unique identifier for the feedback */
9
+ id: string;
10
+ /** The ID of the agent receiving feedback */
11
+ agent_id: string;
12
+ /** The feedback text */
13
+ feedback: string;
14
+ /** Timestamp when the feedback was created */
15
+ created_at: string;
16
+ }
17
+ /**
18
+ * Client for managing supervisor feedback in the Kaiban platform
19
+ * Supervisor feedback tracks feedback given to agents by supervisors
20
+ * @category Resources
21
+ */
22
+ export declare class SupervisorFeedbackClient {
23
+ private readonly http;
24
+ constructor(http: HttpClient);
25
+ /**
26
+ * List supervisor feedback for a specific agent
27
+ *
28
+ * @param params - Query parameters including agent_id and pagination options
29
+ * @param params.agent_id - The unique identifier of the agent
30
+ * @param params.cursor - Optional cursor for the next page of results
31
+ * @param params.limit - Optional number of items per page
32
+ * @param params.order_by - Optional fields to sort by
33
+ * @param options - Optional request configuration
34
+ *
35
+ * @returns A paginated list of supervisor feedback items
36
+ *
37
+ * @example
38
+ * ```typescript
39
+ * const result = await client.supervisorFeedback.listByAgent({
40
+ * agent_id: 'agent-123',
41
+ * limit: 20,
42
+ * order_by: ['created_at']
43
+ * });
44
+ *
45
+ * result.items.forEach(feedback => {
46
+ * console.log(feedback.feedback, feedback.created_at);
47
+ * });
48
+ * ```
49
+ */
50
+ listByAgent(params: {
51
+ agent_id: string;
52
+ } & ListParams, options?: RequestOptions): Promise<Paginated<SupervisorFeedbackItem>>;
53
+ /**
54
+ * Iterate through all feedback for a specific agent using async generator
55
+ * Automatically handles pagination by following next_page_token
56
+ *
57
+ * @param params - Query parameters including agent_id (excluding cursor)
58
+ * @param params.agent_id - The unique identifier of the agent
59
+ * @param options - Optional request configuration
60
+ *
61
+ * @yields Individual SupervisorFeedbackItem objects
62
+ *
63
+ * @example
64
+ * ```typescript
65
+ * for await (const feedback of client.supervisorFeedback.listAllByAgent({
66
+ * agent_id: 'agent-123'
67
+ * })) {
68
+ * console.log(feedback.feedback, feedback.created_at);
69
+ * }
70
+ * ```
71
+ */
72
+ listAllByAgent(params: {
73
+ agent_id: string;
74
+ } & Omit<ListParams, 'cursor'>, options?: RequestOptions): AsyncGenerator<SupervisorFeedbackItem, void, unknown>;
75
+ }
@@ -0,0 +1,67 @@
1
+ /**
2
+ * Client for managing supervisor feedback in the Kaiban platform
3
+ * Supervisor feedback tracks feedback given to agents by supervisors
4
+ * @category Resources
5
+ */
6
+ export class SupervisorFeedbackClient {
7
+ constructor(http) {
8
+ this.http = http;
9
+ }
10
+ /**
11
+ * List supervisor feedback for a specific agent
12
+ *
13
+ * @param params - Query parameters including agent_id and pagination options
14
+ * @param params.agent_id - The unique identifier of the agent
15
+ * @param params.cursor - Optional cursor for the next page of results
16
+ * @param params.limit - Optional number of items per page
17
+ * @param params.order_by - Optional fields to sort by
18
+ * @param options - Optional request configuration
19
+ *
20
+ * @returns A paginated list of supervisor feedback items
21
+ *
22
+ * @example
23
+ * ```typescript
24
+ * const result = await client.supervisorFeedback.listByAgent({
25
+ * agent_id: 'agent-123',
26
+ * limit: 20,
27
+ * order_by: ['created_at']
28
+ * });
29
+ *
30
+ * result.items.forEach(feedback => {
31
+ * console.log(feedback.feedback, feedback.created_at);
32
+ * });
33
+ * ```
34
+ */
35
+ listByAgent(params, options) {
36
+ const { agent_id, ...rest } = params;
37
+ return this.http.list(`/supervisor-feedback/${encodeURIComponent(agent_id)}`, rest, options);
38
+ }
39
+ /**
40
+ * Iterate through all feedback for a specific agent using async generator
41
+ * Automatically handles pagination by following next_page_token
42
+ *
43
+ * @param params - Query parameters including agent_id (excluding cursor)
44
+ * @param params.agent_id - The unique identifier of the agent
45
+ * @param options - Optional request configuration
46
+ *
47
+ * @yields Individual SupervisorFeedbackItem objects
48
+ *
49
+ * @example
50
+ * ```typescript
51
+ * for await (const feedback of client.supervisorFeedback.listAllByAgent({
52
+ * agent_id: 'agent-123'
53
+ * })) {
54
+ * console.log(feedback.feedback, feedback.created_at);
55
+ * }
56
+ * ```
57
+ */
58
+ async *listAllByAgent(params, options) {
59
+ let cursor = undefined;
60
+ do {
61
+ const page = await this.listByAgent({ ...params, cursor }, options);
62
+ for (const item of page.data)
63
+ yield item;
64
+ cursor = page.meta.next_cursor;
65
+ } while (cursor);
66
+ }
67
+ }
@@ -0,0 +1,66 @@
1
+ import { HttpClient } from '../http/HttpClient';
2
+ import { RequestOptions } from '../http/types';
3
+ import { TeamMember } from '../../types/entities';
4
+ import { ListParams, Paginated } from '../../types/responses';
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.cursor - Cursor for the next page of results
17
+ * @param params.limit - Number of items per page
18
+ * @param params.order_by - Fields to sort by
19
+ * @param options - Optional request configuration
20
+ *
21
+ * @returns A paginated list of team members
22
+ *
23
+ * @example
24
+ * ```typescript
25
+ * const result = await client.teamMembers.list({
26
+ * limit: 50,
27
+ * order_by: ['name']
28
+ * });
29
+ * ```
30
+ */
31
+ list(params?: ListParams, options?: RequestOptions): Promise<Paginated<TeamMember>>;
32
+ /**
33
+ * Iterate through all team members using async generator
34
+ * Automatically handles pagination by following next_page_token
35
+ *
36
+ * @param params - Optional query parameters (excluding cursor)
37
+ * @param options - Optional request configuration
38
+ *
39
+ * @yields Individual TeamMember objects
40
+ *
41
+ * @example
42
+ * ```typescript
43
+ * for await (const member of client.teamMembers.listAll()) {
44
+ * console.log(member.id, member.name, member.role);
45
+ * }
46
+ * ```
47
+ */
48
+ listAll(params?: Omit<ListParams, 'cursor'>, options?: RequestOptions): AsyncGenerator<TeamMember, void, unknown>;
49
+ /**
50
+ * Get a single team member by ID
51
+ *
52
+ * @param id - The unique identifier of the team member
53
+ * @param options - Optional request configuration
54
+ *
55
+ * @returns The team member object
56
+ *
57
+ * @throws {Error} If the team member is not found or request fails
58
+ *
59
+ * @example
60
+ * ```typescript
61
+ * const member = await client.teamMembers.get('member-123');
62
+ * console.log(member.name, member.role);
63
+ * ```
64
+ */
65
+ get(id: string, options?: RequestOptions): Promise<TeamMember>;
66
+ }
@@ -0,0 +1,75 @@
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.cursor - Cursor for the next page of results
14
+ * @param params.limit - Number of items per page
15
+ * @param params.order_by - Fields to sort by
16
+ * @param options - Optional request configuration
17
+ *
18
+ * @returns A paginated list of team members
19
+ *
20
+ * @example
21
+ * ```typescript
22
+ * const result = await client.teamMembers.list({
23
+ * limit: 50,
24
+ * order_by: ['name']
25
+ * });
26
+ * ```
27
+ */
28
+ list(params, options) {
29
+ return this.http.list('/team-members', params, options);
30
+ }
31
+ /**
32
+ * Iterate through all team members using async generator
33
+ * Automatically handles pagination by following next_page_token
34
+ *
35
+ * @param params - Optional query parameters (excluding cursor)
36
+ * @param options - Optional request configuration
37
+ *
38
+ * @yields Individual TeamMember objects
39
+ *
40
+ * @example
41
+ * ```typescript
42
+ * for await (const member of client.teamMembers.listAll()) {
43
+ * console.log(member.id, member.name, member.role);
44
+ * }
45
+ * ```
46
+ */
47
+ async *listAll(params, options) {
48
+ let pageToken = undefined;
49
+ do {
50
+ const page = await this.list({ ...(params || {}), cursor: pageToken }, options);
51
+ for (const item of page.items)
52
+ yield item;
53
+ pageToken = page.next_page_token;
54
+ } while (pageToken);
55
+ }
56
+ /**
57
+ * Get a single team member by ID
58
+ *
59
+ * @param id - The unique identifier of the team member
60
+ * @param options - Optional request configuration
61
+ *
62
+ * @returns The team member object
63
+ *
64
+ * @throws {Error} If the team member is not found or request fails
65
+ *
66
+ * @example
67
+ * ```typescript
68
+ * const member = await client.teamMembers.get('member-123');
69
+ * console.log(member.name, member.role);
70
+ * ```
71
+ */
72
+ get(id, options) {
73
+ return this.http.get(`/team-member/${encodeURIComponent(id)}`, options);
74
+ }
75
+ }
@@ -0,0 +1,83 @@
1
+ import { HttpClient } from '../http/HttpClient';
2
+ import { RequestOptions } from '../http/types';
3
+ import { Team } from '../../types/entities';
4
+ import { ListParams, Paginated } from '../../types/responses';
5
+ /**
6
+ * Client for managing teams in the Kaiban platform
7
+ * @category Resources
8
+ */
9
+ export declare class TeamsClient {
10
+ private readonly http;
11
+ constructor(http: HttpClient);
12
+ /**
13
+ * List teams with pagination, filters, and sorting
14
+ *
15
+ * @param params - Optional query parameters for filtering and pagination
16
+ * @param params.cursor - Cursor for pagination (from previous/next response)
17
+ * @param params.limit - Number of items per page (default: 50, max: 100)
18
+ * @param params.order_by - Fields to sort by. Use - prefix for descending order
19
+ * @param params.filters - Filter parameters (e.g., { status: 'active' })
20
+ * @param options - Optional request configuration
21
+ *
22
+ * @returns A paginated list of teams
23
+ *
24
+ * @example
25
+ * ```typescript
26
+ * // Basic pagination
27
+ * const result = await client.teams.list({ limit: 20 });
28
+ * console.log(result.data); // Current page items
29
+ * console.log(result.pagination.next_cursor); // Use for next page
30
+ *
31
+ * // With sorting
32
+ * const sorted = await client.teams.list({
33
+ * order_by: '-created_at',
34
+ * limit: 50
35
+ * });
36
+ *
37
+ * // With filters
38
+ * const filtered = await client.teams.list({
39
+ * filters: { status: 'active' }
40
+ * });
41
+ *
42
+ * // Next page
43
+ * const nextPage = await client.teams.list({
44
+ * cursor: result.pagination.next_cursor
45
+ * });
46
+ * ```
47
+ */
48
+ list(params?: ListParams, options?: RequestOptions): Promise<Paginated<Team>>;
49
+ /**
50
+ * Iterate through all teams using async generator
51
+ * Automatically handles pagination by following next_page_token
52
+ *
53
+ * @param params - Optional query parameters (excluding cursor)
54
+ * @param options - Optional request configuration
55
+ *
56
+ * @yields Individual Team objects
57
+ *
58
+ * @example
59
+ * ```typescript
60
+ * for await (const team of client.teams.listAll()) {
61
+ * console.log(team.id, team.name);
62
+ * }
63
+ * ```
64
+ */
65
+ listAll(params?: Omit<ListParams, 'cursor'>, options?: RequestOptions): AsyncGenerator<Team, void, unknown>;
66
+ /**
67
+ * Get a single team by ID
68
+ *
69
+ * @param id - The unique identifier of the team
70
+ * @param options - Optional request configuration
71
+ *
72
+ * @returns The team object
73
+ *
74
+ * @throws {Error} If the team is not found or request fails
75
+ *
76
+ * @example
77
+ * ```typescript
78
+ * const team = await client.teams.get('team-123');
79
+ * console.log(team.name);
80
+ * ```
81
+ */
82
+ get(id: string, options?: RequestOptions): Promise<Team>;
83
+ }