@composio/client 0.1.0-alpha.10 → 0.1.0-alpha.12

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 (185) hide show
  1. package/CHANGELOG.md +36 -0
  2. package/README.md +7 -7
  3. package/client.d.mts +6 -6
  4. package/client.d.mts.map +1 -1
  5. package/client.d.ts +6 -6
  6. package/client.d.ts.map +1 -1
  7. package/client.js.map +1 -1
  8. package/client.mjs.map +1 -1
  9. package/package.json +1 -1
  10. package/resources/auth-configs.d.mts +168 -29
  11. package/resources/auth-configs.d.mts.map +1 -1
  12. package/resources/auth-configs.d.ts +168 -29
  13. package/resources/auth-configs.d.ts.map +1 -1
  14. package/resources/auth-configs.js +50 -4
  15. package/resources/auth-configs.js.map +1 -1
  16. package/resources/auth-configs.mjs +50 -4
  17. package/resources/auth-configs.mjs.map +1 -1
  18. package/resources/connected-accounts.d.mts +80 -17
  19. package/resources/connected-accounts.d.mts.map +1 -1
  20. package/resources/connected-accounts.d.ts +80 -17
  21. package/resources/connected-accounts.d.ts.map +1 -1
  22. package/resources/connected-accounts.js +56 -4
  23. package/resources/connected-accounts.js.map +1 -1
  24. package/resources/connected-accounts.mjs +56 -4
  25. package/resources/connected-accounts.mjs.map +1 -1
  26. package/resources/files.d.mts +72 -23
  27. package/resources/files.d.mts.map +1 -1
  28. package/resources/files.d.ts +72 -23
  29. package/resources/files.d.ts.map +1 -1
  30. package/resources/files.js +20 -2
  31. package/resources/files.js.map +1 -1
  32. package/resources/files.mjs +20 -2
  33. package/resources/files.mjs.map +1 -1
  34. package/resources/index.d.mts +3 -3
  35. package/resources/index.d.mts.map +1 -1
  36. package/resources/index.d.ts +3 -3
  37. package/resources/index.d.ts.map +1 -1
  38. package/resources/index.js.map +1 -1
  39. package/resources/index.mjs.map +1 -1
  40. package/resources/mcp/custom.d.mts +87 -0
  41. package/resources/mcp/custom.d.mts.map +1 -0
  42. package/resources/mcp/custom.d.ts +87 -0
  43. package/resources/mcp/custom.d.ts.map +1 -0
  44. package/resources/mcp/custom.js +26 -0
  45. package/resources/mcp/custom.js.map +1 -0
  46. package/resources/mcp/custom.mjs +22 -0
  47. package/resources/mcp/custom.mjs.map +1 -0
  48. package/resources/mcp/index.d.mts +2 -2
  49. package/resources/mcp/index.d.mts.map +1 -1
  50. package/resources/mcp/index.d.ts +2 -2
  51. package/resources/mcp/index.d.ts.map +1 -1
  52. package/resources/mcp/index.js +3 -3
  53. package/resources/mcp/index.js.map +1 -1
  54. package/resources/mcp/index.mjs +1 -1
  55. package/resources/mcp/index.mjs.map +1 -1
  56. package/resources/mcp/mcp.d.mts +322 -217
  57. package/resources/mcp/mcp.d.mts.map +1 -1
  58. package/resources/mcp/mcp.d.ts +322 -217
  59. package/resources/mcp/mcp.d.ts.map +1 -1
  60. package/resources/mcp/mcp.js +72 -25
  61. package/resources/mcp/mcp.js.map +1 -1
  62. package/resources/mcp/mcp.mjs +72 -25
  63. package/resources/mcp/mcp.mjs.map +1 -1
  64. package/resources/migration.d.mts +11 -2
  65. package/resources/migration.d.mts.map +1 -1
  66. package/resources/migration.d.ts +11 -2
  67. package/resources/migration.d.ts.map +1 -1
  68. package/resources/migration.js +3 -1
  69. package/resources/migration.js.map +1 -1
  70. package/resources/migration.mjs +3 -1
  71. package/resources/migration.mjs.map +1 -1
  72. package/resources/org/api-key.d.mts +23 -2
  73. package/resources/org/api-key.d.mts.map +1 -1
  74. package/resources/org/api-key.d.ts +23 -2
  75. package/resources/org/api-key.d.ts.map +1 -1
  76. package/resources/org/api-key.js +15 -2
  77. package/resources/org/api-key.js.map +1 -1
  78. package/resources/org/api-key.mjs +15 -2
  79. package/resources/org/api-key.mjs.map +1 -1
  80. package/resources/org/project/api-keys.d.mts +114 -22
  81. package/resources/org/project/api-keys.d.mts.map +1 -1
  82. package/resources/org/project/api-keys.d.ts +114 -22
  83. package/resources/org/project/api-keys.d.ts.map +1 -1
  84. package/resources/org/project/api-keys.js +57 -0
  85. package/resources/org/project/api-keys.js.map +1 -1
  86. package/resources/org/project/api-keys.mjs +57 -0
  87. package/resources/org/project/api-keys.mjs.map +1 -1
  88. package/resources/org/project/project.d.mts +176 -4
  89. package/resources/org/project/project.d.mts.map +1 -1
  90. package/resources/org/project/project.d.ts +176 -4
  91. package/resources/org/project/project.d.ts.map +1 -1
  92. package/resources/org/project/project.js +46 -3
  93. package/resources/org/project/project.js.map +1 -1
  94. package/resources/org/project/project.mjs +46 -3
  95. package/resources/org/project/project.mjs.map +1 -1
  96. package/resources/org/project/trigger.d.mts +101 -1
  97. package/resources/org/project/trigger.d.mts.map +1 -1
  98. package/resources/org/project/trigger.d.ts +101 -1
  99. package/resources/org/project/trigger.d.ts.map +1 -1
  100. package/resources/org/project/trigger.js +21 -0
  101. package/resources/org/project/trigger.js.map +1 -1
  102. package/resources/org/project/trigger.mjs +21 -0
  103. package/resources/org/project/trigger.mjs.map +1 -1
  104. package/resources/org/project/webhook.d.mts +86 -15
  105. package/resources/org/project/webhook.d.mts.map +1 -1
  106. package/resources/org/project/webhook.d.ts +86 -15
  107. package/resources/org/project/webhook.d.ts.map +1 -1
  108. package/resources/org/project/webhook.js +49 -2
  109. package/resources/org/project/webhook.js.map +1 -1
  110. package/resources/org/project/webhook.mjs +49 -2
  111. package/resources/org/project/webhook.mjs.map +1 -1
  112. package/resources/team-members.d.mts +7 -7
  113. package/resources/team-members.d.mts.map +1 -1
  114. package/resources/team-members.d.ts +7 -7
  115. package/resources/team-members.d.ts.map +1 -1
  116. package/resources/toolkits.d.mts +195 -7
  117. package/resources/toolkits.d.mts.map +1 -1
  118. package/resources/toolkits.d.ts +195 -7
  119. package/resources/toolkits.d.ts.map +1 -1
  120. package/resources/toolkits.js +14 -6
  121. package/resources/toolkits.js.map +1 -1
  122. package/resources/toolkits.mjs +14 -6
  123. package/resources/toolkits.mjs.map +1 -1
  124. package/resources/tools.d.mts +211 -44
  125. package/resources/tools.d.mts.map +1 -1
  126. package/resources/tools.d.ts +211 -44
  127. package/resources/tools.d.ts.map +1 -1
  128. package/resources/tools.js +62 -9
  129. package/resources/tools.js.map +1 -1
  130. package/resources/tools.mjs +62 -9
  131. package/resources/tools.mjs.map +1 -1
  132. package/resources/trigger-instances/index.d.mts +1 -1
  133. package/resources/trigger-instances/index.d.mts.map +1 -1
  134. package/resources/trigger-instances/index.d.ts +1 -1
  135. package/resources/trigger-instances/index.d.ts.map +1 -1
  136. package/resources/trigger-instances/trigger-instances.d.mts +86 -19
  137. package/resources/trigger-instances/trigger-instances.d.mts.map +1 -1
  138. package/resources/trigger-instances/trigger-instances.d.ts +86 -19
  139. package/resources/trigger-instances/trigger-instances.d.ts.map +1 -1
  140. package/resources/trigger-instances/trigger-instances.js +6 -6
  141. package/resources/trigger-instances/trigger-instances.js.map +1 -1
  142. package/resources/trigger-instances/trigger-instances.mjs +6 -6
  143. package/resources/trigger-instances/trigger-instances.mjs.map +1 -1
  144. package/resources/triggers-types.d.mts +96 -2
  145. package/resources/triggers-types.d.mts.map +1 -1
  146. package/resources/triggers-types.d.ts +96 -2
  147. package/resources/triggers-types.d.ts.map +1 -1
  148. package/resources/triggers-types.js +23 -1
  149. package/resources/triggers-types.js.map +1 -1
  150. package/resources/triggers-types.mjs +23 -1
  151. package/resources/triggers-types.mjs.map +1 -1
  152. package/src/client.ts +6 -6
  153. package/src/resources/auth-configs.ts +169 -29
  154. package/src/resources/connected-accounts.ts +80 -17
  155. package/src/resources/files.ts +75 -23
  156. package/src/resources/index.ts +3 -3
  157. package/src/resources/mcp/custom.ts +103 -0
  158. package/src/resources/mcp/index.ts +2 -3
  159. package/src/resources/mcp/mcp.ts +342 -256
  160. package/src/resources/migration.ts +11 -2
  161. package/src/resources/org/api-key.ts +23 -2
  162. package/src/resources/org/project/api-keys.ts +117 -22
  163. package/src/resources/org/project/project.ts +176 -4
  164. package/src/resources/org/project/trigger.ts +101 -1
  165. package/src/resources/org/project/webhook.ts +86 -15
  166. package/src/resources/team-members.ts +7 -7
  167. package/src/resources/toolkits.ts +200 -7
  168. package/src/resources/tools.ts +213 -46
  169. package/src/resources/trigger-instances/index.ts +1 -1
  170. package/src/resources/trigger-instances/trigger-instances.ts +106 -25
  171. package/src/resources/triggers-types.ts +96 -2
  172. package/src/version.ts +1 -1
  173. package/version.d.mts +1 -1
  174. package/version.d.ts +1 -1
  175. package/version.js +1 -1
  176. package/version.mjs +1 -1
  177. package/resources/mcp/command.d.mts +0 -37
  178. package/resources/mcp/command.d.mts.map +0 -1
  179. package/resources/mcp/command.d.ts +0 -37
  180. package/resources/mcp/command.d.ts.map +0 -1
  181. package/resources/mcp/command.js +0 -15
  182. package/resources/mcp/command.js.map +0 -1
  183. package/resources/mcp/command.mjs +0 -11
  184. package/resources/mcp/command.mjs.map +0 -1
  185. package/src/resources/mcp/command.ts +0 -50
@@ -8,20 +8,44 @@ import { path } from '../internal/utils/path';
8
8
  export class AuthConfigs extends APIResource {
9
9
  /**
10
10
  * Create new authentication configuration
11
+ *
12
+ * @example
13
+ * ```ts
14
+ * const authConfig = await client.authConfigs.create({
15
+ * toolkit: { slug: 'slug' },
16
+ * });
17
+ * ```
11
18
  */
12
19
  create(body: AuthConfigCreateParams, options?: RequestOptions): APIPromise<AuthConfigCreateResponse> {
13
20
  return this._client.post('/api/v3/auth_configs', { body, ...options });
14
21
  }
15
22
 
16
23
  /**
17
- * Get single authentication configuration by ID
24
+ * Retrieves detailed information about a specific authentication configuration
25
+ * using its unique identifier.
26
+ *
27
+ * @example
28
+ * ```ts
29
+ * const authConfig = await client.authConfigs.retrieve(
30
+ * 'nanoid',
31
+ * );
32
+ * ```
18
33
  */
19
34
  retrieve(nanoid: string, options?: RequestOptions): APIPromise<AuthConfigRetrieveResponse> {
20
35
  return this._client.get(path`/api/v3/auth_configs/${nanoid}`, options);
21
36
  }
22
37
 
23
38
  /**
24
- * Update an authentication configuration
39
+ * Modifies an existing authentication configuration with new credentials or other
40
+ * settings. Only specified fields will be updated.
41
+ *
42
+ * @example
43
+ * ```ts
44
+ * const authConfig = await client.authConfigs.update(
45
+ * 'nanoid',
46
+ * { credentials: { foo: 'bar' }, type: 'custom' },
47
+ * );
48
+ * ```
25
49
  */
26
50
  update(nanoid: string, body: AuthConfigUpdateParams, options?: RequestOptions): APIPromise<unknown> {
27
51
  return this._client.patch(path`/api/v3/auth_configs/${nanoid}`, { body, ...options });
@@ -29,6 +53,11 @@ export class AuthConfigs extends APIResource {
29
53
 
30
54
  /**
31
55
  * List authentication configurations with optional filters
56
+ *
57
+ * @example
58
+ * ```ts
59
+ * const authConfigs = await client.authConfigs.list();
60
+ * ```
32
61
  */
33
62
  list(
34
63
  query: AuthConfigListParams | null | undefined = {},
@@ -38,14 +67,31 @@ export class AuthConfigs extends APIResource {
38
67
  }
39
68
 
40
69
  /**
41
- * Delete an authentication configuration
70
+ * Soft-deletes an authentication configuration by marking it as deleted in the
71
+ * database. This operation cannot be undone.
72
+ *
73
+ * @example
74
+ * ```ts
75
+ * const authConfig = await client.authConfigs.delete(
76
+ * 'nanoid',
77
+ * );
78
+ * ```
42
79
  */
43
80
  delete(nanoid: string, options?: RequestOptions): APIPromise<unknown> {
44
81
  return this._client.delete(path`/api/v3/auth_configs/${nanoid}`, options);
45
82
  }
46
83
 
47
84
  /**
48
- * Enable or disable an authentication configuration
85
+ * Updates the status of an authentication configuration to either enabled or
86
+ * disabled. Disabled configurations cannot be used for new connections.
87
+ *
88
+ * @example
89
+ * ```ts
90
+ * const response = await client.authConfigs.updateStatus(
91
+ * 'ENABLED',
92
+ * { nanoid: 'nanoid' },
93
+ * );
94
+ * ```
49
95
  */
50
96
  updateStatus(
51
97
  status: 'ENABLED' | 'DISABLED',
@@ -66,12 +112,12 @@ export interface AuthConfigCreateResponse {
66
112
  export namespace AuthConfigCreateResponse {
67
113
  export interface AuthConfig {
68
114
  /**
69
- * The auth config id of the app (must be a valid auth config id)
115
+ * The auth config id of the toolkit (must be a valid auth config id)
70
116
  */
71
117
  id: string;
72
118
 
73
119
  /**
74
- * The authentication mode of the app
120
+ * The authentication mode of the toolkit
75
121
  */
76
122
  auth_scheme: string;
77
123
 
@@ -81,7 +127,7 @@ export namespace AuthConfigCreateResponse {
81
127
  is_composio_managed: boolean;
82
128
 
83
129
  /**
84
- * The actions that the user can perform on the auth config
130
+ * The tools that the user can use with the auth config
85
131
  */
86
132
  restrict_to_following_tools?: Array<string>;
87
133
  }
@@ -96,36 +142,48 @@ export namespace AuthConfigCreateResponse {
96
142
 
97
143
  export interface AuthConfigRetrieveResponse {
98
144
  /**
99
- * The unique id of the auth config
145
+ * The unique ID of the authentication configuration
100
146
  */
101
147
  id: string;
102
148
 
149
+ /**
150
+ * Deprecated parameters maintained for backward compatibility
151
+ */
103
152
  deprecated_params: AuthConfigRetrieveResponse.DeprecatedParams;
104
153
 
105
154
  /**
106
- * The name of the auth config
155
+ * The display name of the authentication configuration
107
156
  */
108
157
  name: string;
109
158
 
110
159
  /**
111
- * The number of connections for the auth config
160
+ * The number of active connections using this auth config
112
161
  */
113
162
  no_of_connections: number;
114
163
 
164
+ /**
165
+ * Current status of the authentication configuration
166
+ */
115
167
  status: 'ENABLED' | 'DISABLED';
116
168
 
169
+ /**
170
+ * Information about the associated integration
171
+ */
117
172
  toolkit: AuthConfigRetrieveResponse.Toolkit;
118
173
 
119
174
  /**
120
- * The type of the auth config
175
+ * The type of the authentication configuration (custom or default)
121
176
  */
122
177
  type: 'default' | 'custom';
123
178
 
124
179
  /**
125
- * The unique id of the auth config
180
+ * The UUID of the authentication configuration (for backward compatibility)
126
181
  */
127
182
  uuid: string;
128
183
 
184
+ /**
185
+ * The authentication scheme used (e.g., OAuth2, API Key, etc.)
186
+ */
129
187
  auth_scheme?:
130
188
  | 'OAUTH2'
131
189
  | 'OAUTH1'
@@ -142,48 +200,79 @@ export interface AuthConfigRetrieveResponse {
142
200
  | 'SNOWFLAKE';
143
201
 
144
202
  /**
145
- * The date and time the auth config was created
203
+ * ISO 8601 date-time when the auth config was created
146
204
  */
147
205
  created_at?: string;
148
206
 
149
207
  /**
150
- * The user who created the auth config
208
+ * The identifier of the user who created the auth config
151
209
  */
152
210
  created_by?: string;
153
211
 
212
+ /**
213
+ * The authentication credentials (tokens, keys, etc.) - may be partially hidden
214
+ * for security
215
+ */
154
216
  credentials?: Record<string, unknown>;
155
217
 
218
+ /**
219
+ * Fields expected during connection initialization
220
+ */
156
221
  expected_input_fields?: Array<unknown>;
157
222
 
223
+ /**
224
+ * Whether this authentication configuration is managed by Composio or the user
225
+ */
158
226
  is_composio_managed?: boolean;
159
227
 
160
228
  /**
161
- * The date and time the auth config was last updated
229
+ * ISO 8601 date-time when the auth config was last updated
162
230
  */
163
231
  last_updated_at?: string;
164
232
 
233
+ /**
234
+ * List of tool IDs this auth config is restricted to use with
235
+ */
165
236
  restrict_to_following_tools?: Array<string>;
166
237
  }
167
238
 
168
239
  export namespace AuthConfigRetrieveResponse {
240
+ /**
241
+ * Deprecated parameters maintained for backward compatibility
242
+ */
169
243
  export interface DeprecatedParams {
244
+ /**
245
+ * Deprecated: Default connector ID
246
+ */
170
247
  default_connector_id: string | null;
171
248
 
249
+ /**
250
+ * Deprecated: Fields expected during connection initialization
251
+ */
172
252
  expected_input_fields?: Array<Record<string, unknown>>;
173
253
 
254
+ /**
255
+ * Deprecated: Member UUID
256
+ */
174
257
  member_uuid?: string;
175
258
 
259
+ /**
260
+ * Deprecated: Toolkit ID
261
+ */
176
262
  toolkit_id?: string;
177
263
  }
178
264
 
265
+ /**
266
+ * Information about the associated integration
267
+ */
179
268
  export interface Toolkit {
180
269
  /**
181
- * The logo of the app
270
+ * The URL to the integration app's logo image
182
271
  */
183
272
  logo: string;
184
273
 
185
274
  /**
186
- * The unique key of the app
275
+ * The unique identifier of the integration app
187
276
  */
188
277
  slug: string;
189
278
  }
@@ -202,36 +291,48 @@ export interface AuthConfigListResponse {
202
291
  export namespace AuthConfigListResponse {
203
292
  export interface Item {
204
293
  /**
205
- * The unique id of the auth config
294
+ * The unique ID of the authentication configuration
206
295
  */
207
296
  id: string;
208
297
 
298
+ /**
299
+ * Deprecated parameters maintained for backward compatibility
300
+ */
209
301
  deprecated_params: Item.DeprecatedParams;
210
302
 
211
303
  /**
212
- * The name of the auth config
304
+ * The display name of the authentication configuration
213
305
  */
214
306
  name: string;
215
307
 
216
308
  /**
217
- * The number of connections for the auth config
309
+ * The number of active connections using this auth config
218
310
  */
219
311
  no_of_connections: number;
220
312
 
313
+ /**
314
+ * Current status of the authentication configuration
315
+ */
221
316
  status: 'ENABLED' | 'DISABLED';
222
317
 
318
+ /**
319
+ * Information about the associated integration
320
+ */
223
321
  toolkit: Item.Toolkit;
224
322
 
225
323
  /**
226
- * The type of the auth config
324
+ * The type of the authentication configuration (custom or default)
227
325
  */
228
326
  type: 'default' | 'custom';
229
327
 
230
328
  /**
231
- * The unique id of the auth config
329
+ * The UUID of the authentication configuration (for backward compatibility)
232
330
  */
233
331
  uuid: string;
234
332
 
333
+ /**
334
+ * The authentication scheme used (e.g., OAuth2, API Key, etc.)
335
+ */
235
336
  auth_scheme?:
236
337
  | 'OAUTH2'
237
338
  | 'OAUTH1'
@@ -248,48 +349,79 @@ export namespace AuthConfigListResponse {
248
349
  | 'SNOWFLAKE';
249
350
 
250
351
  /**
251
- * The date and time the auth config was created
352
+ * ISO 8601 date-time when the auth config was created
252
353
  */
253
354
  created_at?: string;
254
355
 
255
356
  /**
256
- * The user who created the auth config
357
+ * The identifier of the user who created the auth config
257
358
  */
258
359
  created_by?: string;
259
360
 
361
+ /**
362
+ * The authentication credentials (tokens, keys, etc.) - may be partially hidden
363
+ * for security
364
+ */
260
365
  credentials?: Record<string, unknown>;
261
366
 
367
+ /**
368
+ * Fields expected during connection initialization
369
+ */
262
370
  expected_input_fields?: Array<unknown>;
263
371
 
372
+ /**
373
+ * Whether this authentication configuration is managed by Composio or the user
374
+ */
264
375
  is_composio_managed?: boolean;
265
376
 
266
377
  /**
267
- * The date and time the auth config was last updated
378
+ * ISO 8601 date-time when the auth config was last updated
268
379
  */
269
380
  last_updated_at?: string;
270
381
 
382
+ /**
383
+ * List of tool IDs this auth config is restricted to use with
384
+ */
271
385
  restrict_to_following_tools?: Array<string>;
272
386
  }
273
387
 
274
388
  export namespace Item {
389
+ /**
390
+ * Deprecated parameters maintained for backward compatibility
391
+ */
275
392
  export interface DeprecatedParams {
393
+ /**
394
+ * Deprecated: Default connector ID
395
+ */
276
396
  default_connector_id: string | null;
277
397
 
398
+ /**
399
+ * Deprecated: Fields expected during connection initialization
400
+ */
278
401
  expected_input_fields?: Array<Record<string, unknown>>;
279
402
 
403
+ /**
404
+ * Deprecated: Member UUID
405
+ */
280
406
  member_uuid?: string;
281
407
 
408
+ /**
409
+ * Deprecated: Toolkit ID
410
+ */
282
411
  toolkit_id?: string;
283
412
  }
284
413
 
414
+ /**
415
+ * Information about the associated integration
416
+ */
285
417
  export interface Toolkit {
286
418
  /**
287
- * The logo of the app
419
+ * The URL to the integration app's logo image
288
420
  */
289
421
  logo: string;
290
422
 
291
423
  /**
292
- * The unique key of the app
424
+ * The unique identifier of the integration app
293
425
  */
294
426
  slug: string;
295
427
  }
@@ -309,7 +441,7 @@ export interface AuthConfigCreateParams {
309
441
  export namespace AuthConfigCreateParams {
310
442
  export interface Toolkit {
311
443
  /**
312
- * List of app unique keys to filter by
444
+ * List of toolkits unique keys to filter by
313
445
  */
314
446
  slug: string;
315
447
  }
@@ -403,7 +535,12 @@ export interface AuthConfigListParams {
403
535
  /**
404
536
  * The number of auth configs to return
405
537
  */
406
- limit?: string;
538
+ limit?: number | null;
539
+
540
+ /**
541
+ * Show disabled auth configs
542
+ */
543
+ show_disabled?: boolean;
407
544
 
408
545
  /**
409
546
  * The slug of the toolkit to filter by
@@ -412,6 +549,9 @@ export interface AuthConfigListParams {
412
549
  }
413
550
 
414
551
  export interface AuthConfigUpdateStatusParams {
552
+ /**
553
+ * The unique identifier of the authentication configuration to update
554
+ */
415
555
  nanoid: string;
416
556
  }
417
557
 
@@ -8,6 +8,15 @@ import { path } from '../internal/utils/path';
8
8
  export class ConnectedAccounts extends APIResource {
9
9
  /**
10
10
  * Create a new connected account
11
+ *
12
+ * @example
13
+ * ```ts
14
+ * const connectedAccount =
15
+ * await client.connectedAccounts.create({
16
+ * auth_config: { id: 'id' },
17
+ * connection: {},
18
+ * });
19
+ * ```
11
20
  */
12
21
  create(
13
22
  body: ConnectedAccountCreateParams,
@@ -17,7 +26,16 @@ export class ConnectedAccounts extends APIResource {
17
26
  }
18
27
 
19
28
  /**
20
- * Get connected account details by ID
29
+ * Retrieves comprehensive details of a connected account, including authentication
30
+ * configuration, connection status, and all parameters needed for API requests.
31
+ *
32
+ * @example
33
+ * ```ts
34
+ * const connectedAccount =
35
+ * await client.connectedAccounts.retrieve(
36
+ * 'con_1a2b3c4d5e6f',
37
+ * );
38
+ * ```
21
39
  */
22
40
  retrieve(nanoid: string, options?: RequestOptions): APIPromise<ConnectedAccountRetrieveResponse> {
23
41
  return this._client.get(path`/api/v3/connected_accounts/${nanoid}`, options);
@@ -25,6 +43,12 @@ export class ConnectedAccounts extends APIResource {
25
43
 
26
44
  /**
27
45
  * List connected accounts with optional filters
46
+ *
47
+ * @example
48
+ * ```ts
49
+ * const connectedAccounts =
50
+ * await client.connectedAccounts.list();
51
+ * ```
28
52
  */
29
53
  list(
30
54
  query: ConnectedAccountListParams | null | undefined = {},
@@ -34,21 +58,49 @@ export class ConnectedAccounts extends APIResource {
34
58
  }
35
59
 
36
60
  /**
37
- * Delete a connected account
61
+ * Soft-deletes a connected account by marking it as deleted in the database. This
62
+ * prevents the account from being used for API calls but preserves the record for
63
+ * audit purposes.
64
+ *
65
+ * @example
66
+ * ```ts
67
+ * const connectedAccount =
68
+ * await client.connectedAccounts.delete('con_1a2b3c4d5e6f');
69
+ * ```
38
70
  */
39
71
  delete(nanoid: string, options?: RequestOptions): APIPromise<ConnectedAccountDeleteResponse> {
40
72
  return this._client.delete(path`/api/v3/connected_accounts/${nanoid}`, options);
41
73
  }
42
74
 
43
75
  /**
44
- * Refresh authentication for a connected account
76
+ * Initiates a new authentication flow for a connected account when credentials
77
+ * have expired or become invalid. This may generate a new authentication URL for
78
+ * OAuth flows or refresh tokens for other auth schemes.
79
+ *
80
+ * @example
81
+ * ```ts
82
+ * const response = await client.connectedAccounts.refresh(
83
+ * 'con_1a2b3c4d5e6f',
84
+ * );
85
+ * ```
45
86
  */
46
87
  refresh(nanoid: string, options?: RequestOptions): APIPromise<ConnectedAccountRefreshResponse> {
47
88
  return this._client.post(path`/api/v3/connected_accounts/${nanoid}/refresh`, options);
48
89
  }
49
90
 
50
91
  /**
51
- * Enable or disable a connected account
92
+ * Updates the status of a connected account to either enabled (active) or disabled
93
+ * (inactive). Disabled accounts cannot be used for API calls but remain in the
94
+ * database.
95
+ *
96
+ * @example
97
+ * ```ts
98
+ * const response =
99
+ * await client.connectedAccounts.updateStatus(
100
+ * 'con_1a2b3c4d5e6f',
101
+ * { enabled: true },
102
+ * );
103
+ * ```
52
104
  */
53
105
  updateStatus(
54
106
  nanoID: string,
@@ -81,7 +133,7 @@ export interface ConnectedAccountCreateResponse {
81
133
  /**
82
134
  * The status of the connected account
83
135
  */
84
- status: 'ACTIVE' | 'INACTIVE' | 'DELETED' | 'INITIATED' | 'EXPIRED' | 'FAILED';
136
+ status: 'INITIALIZING' | 'INITIATED' | 'ACTIVE' | 'FAILED' | 'EXPIRED';
85
137
  }
86
138
 
87
139
  export namespace ConnectedAccountCreateResponse {
@@ -117,22 +169,23 @@ export interface ConnectedAccountRetrieveResponse {
117
169
  data: Record<string, unknown>;
118
170
 
119
171
  /**
120
- * Whether the connected account is disabled
172
+ * Whether the connected account is disabled. When true, the account cannot be used
173
+ * for API calls
121
174
  */
122
175
  is_disabled: boolean;
123
176
 
124
177
  /**
125
- * The init data of the connection
178
+ * The initialization data of the connection, including configuration parameters
126
179
  */
127
180
  params: Record<string, unknown>;
128
181
 
129
182
  /**
130
183
  * The status of the connection
131
184
  */
132
- status: 'ACTIVE' | 'INACTIVE' | 'DELETED' | 'INITIATED' | 'EXPIRED' | 'FAILED';
185
+ status: 'INITIALIZING' | 'INITIATED' | 'ACTIVE' | 'FAILED' | 'EXPIRED';
133
186
 
134
187
  /**
135
- * The reason the connected account is disabled
188
+ * The reason why the connected account is disabled, if applicable
136
189
  */
137
190
  status_reason: string | null;
138
191
 
@@ -258,7 +311,7 @@ export namespace ConnectedAccountListResponse {
258
311
  /**
259
312
  * The status of the connection
260
313
  */
261
- status: 'ACTIVE' | 'INACTIVE' | 'DELETED' | 'INITIATED' | 'EXPIRED' | 'FAILED';
314
+ status: 'INITIALIZING' | 'INITIATED' | 'ACTIVE' | 'FAILED' | 'EXPIRED';
262
315
 
263
316
  /**
264
317
  * The reason the connection is disabled
@@ -353,33 +406,40 @@ export namespace ConnectedAccountListResponse {
353
406
  }
354
407
  }
355
408
 
409
+ /**
410
+ * Response returned after successfully deleting a connected account
411
+ */
356
412
  export interface ConnectedAccountDeleteResponse {
357
413
  /**
358
- * The success of the update
414
+ * Indicates whether the connected account was successfully deleted
359
415
  */
360
416
  success: boolean;
361
417
  }
362
418
 
363
419
  export interface ConnectedAccountRefreshResponse {
364
420
  /**
365
- * The id of the connected account
421
+ * The unique identifier of the connected account
366
422
  */
367
423
  id: string;
368
424
 
369
425
  /**
370
- * The redirect URL of the app (previously named redirect_uri)
426
+ * The URL to which the user should be redirected to complete the authentication
427
+ * process (null for auth schemes that do not require redirection)
371
428
  */
372
429
  redirect_url: string | null;
373
430
 
374
431
  /**
375
- * The status of the connected account
432
+ * The current status of the connected account (e.g., active, pending, failed)
376
433
  */
377
- status: 'ACTIVE' | 'INACTIVE' | 'DELETED' | 'INITIATED' | 'EXPIRED' | 'FAILED';
434
+ status: 'INITIALIZING' | 'INITIATED' | 'ACTIVE' | 'FAILED' | 'EXPIRED';
378
435
  }
379
436
 
437
+ /**
438
+ * Response returned after successfully updating a connected account status
439
+ */
380
440
  export interface ConnectedAccountUpdateStatusResponse {
381
441
  /**
382
- * The success of the update
442
+ * Indicates whether the connected account status was successfully updated
383
443
  */
384
444
  success: boolean;
385
445
  }
@@ -456,7 +516,7 @@ export interface ConnectedAccountListParams {
456
516
  /**
457
517
  * The status of the connected account
458
518
  */
459
- statuses?: Array<'ACTIVE' | 'INACTIVE' | 'DELETED' | 'INITIATED' | 'EXPIRED' | 'FAILED'> | null;
519
+ statuses?: Array<'INITIALIZING' | 'INITIATED' | 'ACTIVE' | 'FAILED' | 'EXPIRED'> | null;
460
520
 
461
521
  /**
462
522
  * The toolkit slugs of the connected accounts
@@ -470,6 +530,9 @@ export interface ConnectedAccountListParams {
470
530
  }
471
531
 
472
532
  export interface ConnectedAccountUpdateStatusParams {
533
+ /**
534
+ * Set to true to enable the account or false to disable it
535
+ */
473
536
  enabled: boolean;
474
537
  }
475
538