@whop/sdk 0.0.25 → 0.0.26

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 (133) hide show
  1. package/CHANGELOG.md +21 -0
  2. package/client.d.mts +23 -20
  3. package/client.d.mts.map +1 -1
  4. package/client.d.ts +23 -20
  5. package/client.d.ts.map +1 -1
  6. package/client.js +6 -2
  7. package/client.js.map +1 -1
  8. package/client.mjs +8 -4
  9. package/client.mjs.map +1 -1
  10. package/internal/parse.d.mts.map +1 -1
  11. package/internal/parse.d.ts.map +1 -1
  12. package/internal/parse.js +5 -0
  13. package/internal/parse.js.map +1 -1
  14. package/internal/parse.mjs +5 -0
  15. package/internal/parse.mjs.map +1 -1
  16. package/package.json +1 -1
  17. package/resources/ai-chats.d.mts +7 -103
  18. package/resources/ai-chats.d.mts.map +1 -1
  19. package/resources/ai-chats.d.ts +7 -103
  20. package/resources/ai-chats.d.ts.map +1 -1
  21. package/resources/ai-chats.js.map +1 -1
  22. package/resources/ai-chats.mjs.map +1 -1
  23. package/resources/authorized-users.d.mts +39 -5
  24. package/resources/authorized-users.d.mts.map +1 -1
  25. package/resources/authorized-users.d.ts +39 -5
  26. package/resources/authorized-users.d.ts.map +1 -1
  27. package/resources/authorized-users.js +1 -1
  28. package/resources/authorized-users.js.map +1 -1
  29. package/resources/authorized-users.mjs +1 -1
  30. package/resources/authorized-users.mjs.map +1 -1
  31. package/resources/company-token-transactions.d.mts +13 -99
  32. package/resources/company-token-transactions.d.mts.map +1 -1
  33. package/resources/company-token-transactions.d.ts +13 -99
  34. package/resources/company-token-transactions.d.ts.map +1 -1
  35. package/resources/dm-channels.d.mts +161 -0
  36. package/resources/dm-channels.d.mts.map +1 -0
  37. package/resources/dm-channels.d.ts +161 -0
  38. package/resources/dm-channels.d.ts.map +1 -0
  39. package/resources/dm-channels.js +87 -0
  40. package/resources/dm-channels.js.map +1 -0
  41. package/resources/dm-channels.mjs +83 -0
  42. package/resources/dm-channels.mjs.map +1 -0
  43. package/resources/dm-members.d.mts +14 -66
  44. package/resources/dm-members.d.mts.map +1 -1
  45. package/resources/dm-members.d.ts +14 -66
  46. package/resources/dm-members.d.ts.map +1 -1
  47. package/resources/files.d.mts +7 -3
  48. package/resources/files.d.mts.map +1 -1
  49. package/resources/files.d.ts +7 -3
  50. package/resources/files.d.ts.map +1 -1
  51. package/resources/index.d.mts +11 -10
  52. package/resources/index.d.mts.map +1 -1
  53. package/resources/index.d.ts +11 -10
  54. package/resources/index.d.ts.map +1 -1
  55. package/resources/index.js +3 -1
  56. package/resources/index.js.map +1 -1
  57. package/resources/index.mjs +3 -2
  58. package/resources/index.mjs.map +1 -1
  59. package/resources/leads.d.mts +9 -177
  60. package/resources/leads.d.mts.map +1 -1
  61. package/resources/leads.d.ts +9 -177
  62. package/resources/leads.d.ts.map +1 -1
  63. package/resources/ledger-accounts.d.mts +3 -2
  64. package/resources/ledger-accounts.d.mts.map +1 -1
  65. package/resources/ledger-accounts.d.ts +3 -2
  66. package/resources/ledger-accounts.d.ts.map +1 -1
  67. package/resources/ledger-accounts.js.map +1 -1
  68. package/resources/ledger-accounts.mjs.map +1 -1
  69. package/resources/members.d.mts +5 -5
  70. package/resources/members.d.mts.map +1 -1
  71. package/resources/members.d.ts +5 -5
  72. package/resources/members.d.ts.map +1 -1
  73. package/resources/members.js +1 -1
  74. package/resources/members.js.map +1 -1
  75. package/resources/members.mjs +1 -1
  76. package/resources/members.mjs.map +1 -1
  77. package/resources/memberships.d.mts +8 -3
  78. package/resources/memberships.d.mts.map +1 -1
  79. package/resources/memberships.d.ts +8 -3
  80. package/resources/memberships.d.ts.map +1 -1
  81. package/resources/payments.d.mts +33 -0
  82. package/resources/payments.d.mts.map +1 -1
  83. package/resources/payments.d.ts +33 -0
  84. package/resources/payments.d.ts.map +1 -1
  85. package/resources/payout-methods.d.mts +8 -3
  86. package/resources/payout-methods.d.mts.map +1 -1
  87. package/resources/payout-methods.d.ts +8 -3
  88. package/resources/payout-methods.d.ts.map +1 -1
  89. package/resources/payout-methods.js.map +1 -1
  90. package/resources/payout-methods.mjs.map +1 -1
  91. package/resources/shared.d.mts +35 -1
  92. package/resources/shared.d.mts.map +1 -1
  93. package/resources/shared.d.ts +35 -1
  94. package/resources/shared.d.ts.map +1 -1
  95. package/resources/verifications.d.mts +11 -3
  96. package/resources/verifications.d.mts.map +1 -1
  97. package/resources/verifications.d.ts +11 -3
  98. package/resources/verifications.d.ts.map +1 -1
  99. package/resources/webhooks.d.mts +34 -293
  100. package/resources/webhooks.d.mts.map +1 -1
  101. package/resources/webhooks.d.ts +34 -293
  102. package/resources/webhooks.d.ts.map +1 -1
  103. package/resources/webhooks.js.map +1 -1
  104. package/resources/webhooks.mjs +2 -2
  105. package/resources/webhooks.mjs.map +1 -1
  106. package/resources/withdrawals.d.mts +17 -128
  107. package/resources/withdrawals.d.mts.map +1 -1
  108. package/resources/withdrawals.d.ts +17 -128
  109. package/resources/withdrawals.d.ts.map +1 -1
  110. package/src/client.ts +68 -34
  111. package/src/internal/parse.ts +6 -0
  112. package/src/resources/ai-chats.ts +7 -126
  113. package/src/resources/authorized-users.ts +45 -5
  114. package/src/resources/company-token-transactions.ts +14 -116
  115. package/src/resources/dm-channels.ts +212 -0
  116. package/src/resources/dm-members.ts +16 -78
  117. package/src/resources/files.ts +8 -2
  118. package/src/resources/index.ts +36 -17
  119. package/src/resources/leads.ts +9 -205
  120. package/src/resources/ledger-accounts.ts +3 -35
  121. package/src/resources/members.ts +6 -6
  122. package/src/resources/memberships.ts +16 -18
  123. package/src/resources/payments.ts +40 -0
  124. package/src/resources/payout-methods.ts +15 -2
  125. package/src/resources/shared.ts +42 -9
  126. package/src/resources/verifications.ts +49 -36
  127. package/src/resources/webhooks.ts +67 -728
  128. package/src/resources/withdrawals.ts +24 -205
  129. package/src/version.ts +1 -1
  130. package/version.d.mts +1 -1
  131. package/version.d.ts +1 -1
  132. package/version.js +1 -1
  133. package/version.mjs +1 -1
package/src/client.ts CHANGED
@@ -22,15 +22,13 @@ import { APIPromise } from './core/api-promise';
22
22
  import { AccessTokenCreateParams, AccessTokenCreateResponse, AccessTokens } from './resources/access-tokens';
23
23
  import { AccountLinkCreateParams, AccountLinkCreateResponse, AccountLinks } from './resources/account-links';
24
24
  import {
25
+ AIChat,
25
26
  AIChatCreateParams,
26
- AIChatCreateResponse,
27
27
  AIChatDeleteResponse,
28
28
  AIChatListParams,
29
29
  AIChatListResponse,
30
30
  AIChatListResponsesCursorPage,
31
- AIChatRetrieveResponse,
32
31
  AIChatUpdateParams,
33
- AIChatUpdateResponse,
34
32
  AIChats,
35
33
  } from './resources/ai-chats';
36
34
  import {
@@ -80,12 +78,12 @@ import {
80
78
  CompanyUpdateParams,
81
79
  } from './resources/companies';
82
80
  import {
81
+ BotTokenTransactionTypes,
82
+ CompanyTokenTransaction,
83
83
  CompanyTokenTransactionCreateParams,
84
- CompanyTokenTransactionCreateResponse,
85
84
  CompanyTokenTransactionListParams,
86
85
  CompanyTokenTransactionListResponse,
87
86
  CompanyTokenTransactionListResponsesCursorPage,
88
- CompanyTokenTransactionRetrieveResponse,
89
87
  CompanyTokenTransactions,
90
88
  } from './resources/company-token-transactions';
91
89
  import {
@@ -149,15 +147,25 @@ import {
149
147
  Disputes,
150
148
  } from './resources/disputes';
151
149
  import {
150
+ DmChannel,
151
+ DmChannelCreateParams,
152
+ DmChannelDeleteResponse,
153
+ DmChannelListParams,
154
+ DmChannelListResponse,
155
+ DmChannelListResponsesCursorPage,
156
+ DmChannelUpdateParams,
157
+ DmChannels,
158
+ } from './resources/dm-channels';
159
+ import {
160
+ DmFeedMemberNotificationPreferences,
161
+ DmFeedMemberStatuses,
162
+ DmMember,
152
163
  DmMemberCreateParams,
153
- DmMemberCreateResponse,
154
164
  DmMemberDeleteResponse,
155
165
  DmMemberListParams,
156
166
  DmMemberListResponse,
157
167
  DmMemberListResponsesCursorPage,
158
- DmMemberRetrieveResponse,
159
168
  DmMemberUpdateParams,
160
- DmMemberUpdateResponse,
161
169
  DmMembers,
162
170
  } from './resources/dm-members';
163
171
  import {
@@ -189,7 +197,13 @@ import {
189
197
  FeeMarkupType,
190
198
  FeeMarkups,
191
199
  } from './resources/fee-markups';
192
- import { FileCreateParams, FileCreateResponse, FileRetrieveResponse, Files } from './resources/files';
200
+ import {
201
+ FileCreateParams,
202
+ FileCreateResponse,
203
+ FileRetrieveResponse,
204
+ Files,
205
+ UploadStatus,
206
+ } from './resources/files';
193
207
  import {
194
208
  ForumPostCreateParams,
195
209
  ForumPostListParams,
@@ -208,14 +222,12 @@ import {
208
222
  } from './resources/forums';
209
223
  import { InvoiceCreateParams, InvoiceListParams, InvoiceVoidResponse, Invoices } from './resources/invoices';
210
224
  import {
225
+ Lead,
211
226
  LeadCreateParams,
212
- LeadCreateResponse,
213
227
  LeadListParams,
214
228
  LeadListResponse,
215
229
  LeadListResponsesCursorPage,
216
- LeadRetrieveResponse,
217
230
  LeadUpdateParams,
218
- LeadUpdateResponse,
219
231
  Leads,
220
232
  } from './resources/leads';
221
233
  import { LedgerAccountRetrieveResponse, LedgerAccounts } from './resources/ledger-accounts';
@@ -227,6 +239,7 @@ import {
227
239
  Members,
228
240
  } from './resources/members';
229
241
  import {
242
+ CancelOptions,
230
243
  MembershipCancelParams,
231
244
  MembershipListParams,
232
245
  MembershipListResponse,
@@ -272,6 +285,7 @@ import {
272
285
  Payments,
273
286
  } from './resources/payments';
274
287
  import {
288
+ PayoutDestinationCategory,
275
289
  PayoutMethodListParams,
276
290
  PayoutMethodListResponse,
277
291
  PayoutMethodListResponsesCursorPage,
@@ -369,8 +383,14 @@ import {
369
383
  UserRetrieveResponse,
370
384
  Users,
371
385
  } from './resources/users';
372
- import { VerificationRetrieveResponse, Verifications } from './resources/verifications';
373
386
  import {
387
+ VerificationErrorCode,
388
+ VerificationRetrieveResponse,
389
+ VerificationStatus,
390
+ Verifications,
391
+ } from './resources/verifications';
392
+ import {
393
+ APIVersion,
374
394
  CourseLessonInteractionCompletedWebhookEvent,
375
395
  DisputeCreatedWebhookEvent,
376
396
  DisputeUpdatedWebhookEvent,
@@ -397,27 +417,26 @@ import {
397
417
  SetupIntentSucceededWebhookEvent,
398
418
  UnwrapWebhookEvent,
399
419
  VerificationSucceededWebhookEvent,
420
+ Webhook,
400
421
  WebhookCreateParams,
401
422
  WebhookCreateResponse,
402
423
  WebhookDeleteResponse,
424
+ WebhookEvent,
403
425
  WebhookListParams,
404
426
  WebhookListResponse,
405
427
  WebhookListResponsesCursorPage,
406
- WebhookRetrieveResponse,
407
428
  WebhookUpdateParams,
408
- WebhookUpdateResponse,
409
429
  Webhooks,
410
430
  WithdrawalCreatedWebhookEvent,
411
431
  WithdrawalUpdatedWebhookEvent,
412
432
  } from './resources/webhooks';
413
433
  import {
434
+ Withdrawal,
414
435
  WithdrawalCreateParams,
415
- WithdrawalCreateResponse,
416
436
  WithdrawalFeeTypes,
417
437
  WithdrawalListParams,
418
438
  WithdrawalListResponse,
419
439
  WithdrawalListResponsesCursorPage,
420
- WithdrawalRetrieveResponse,
421
440
  WithdrawalSpeeds,
422
441
  WithdrawalStatus,
423
442
  Withdrawals,
@@ -920,9 +939,10 @@ export class Whop {
920
939
  controller: AbortController,
921
940
  ): Promise<Response> {
922
941
  const { signal, method, ...options } = init || {};
923
- if (signal) signal.addEventListener('abort', () => controller.abort());
942
+ const abort = controller.abort.bind(controller);
943
+ if (signal) signal.addEventListener('abort', abort, { once: true });
924
944
 
925
- const timeout = setTimeout(() => controller.abort(), ms);
945
+ const timeout = setTimeout(abort, ms);
926
946
 
927
947
  const isReadableBody =
928
948
  ((globalThis as any).ReadableStream && options.body instanceof (globalThis as any).ReadableStream) ||
@@ -1196,6 +1216,7 @@ export class Whop {
1196
1216
  companyTokenTransactions: API.CompanyTokenTransactions = new API.CompanyTokenTransactions(this);
1197
1217
  dmMembers: API.DmMembers = new API.DmMembers(this);
1198
1218
  aiChats: API.AIChats = new API.AIChats(this);
1219
+ dmChannels: API.DmChannels = new API.DmChannels(this);
1199
1220
  }
1200
1221
 
1201
1222
  Whop.Apps = Apps;
@@ -1246,6 +1267,7 @@ Whop.Files = Files;
1246
1267
  Whop.CompanyTokenTransactions = CompanyTokenTransactions;
1247
1268
  Whop.DmMembers = DmMembers;
1248
1269
  Whop.AIChats = AIChats;
1270
+ Whop.DmChannels = DmChannels;
1249
1271
 
1250
1272
  export declare namespace Whop {
1251
1273
  export type RequestOptions = Opts.RequestOptions;
@@ -1294,9 +1316,10 @@ export declare namespace Whop {
1294
1316
 
1295
1317
  export {
1296
1318
  Webhooks as Webhooks,
1319
+ type APIVersion as APIVersion,
1320
+ type Webhook as Webhook,
1321
+ type WebhookEvent as WebhookEvent,
1297
1322
  type WebhookCreateResponse as WebhookCreateResponse,
1298
- type WebhookRetrieveResponse as WebhookRetrieveResponse,
1299
- type WebhookUpdateResponse as WebhookUpdateResponse,
1300
1323
  type WebhookListResponse as WebhookListResponse,
1301
1324
  type WebhookDeleteResponse as WebhookDeleteResponse,
1302
1325
  type InvoiceCreatedWebhookEvent as InvoiceCreatedWebhookEvent,
@@ -1376,6 +1399,7 @@ export declare namespace Whop {
1376
1399
 
1377
1400
  export {
1378
1401
  Memberships as Memberships,
1402
+ type CancelOptions as CancelOptions,
1379
1403
  type MembershipListResponse as MembershipListResponse,
1380
1404
  type MembershipListResponsesCursorPage as MembershipListResponsesCursorPage,
1381
1405
  type MembershipUpdateParams as MembershipUpdateParams,
@@ -1612,11 +1636,10 @@ export declare namespace Whop {
1612
1636
 
1613
1637
  export {
1614
1638
  Withdrawals as Withdrawals,
1639
+ type Withdrawal as Withdrawal,
1615
1640
  type WithdrawalFeeTypes as WithdrawalFeeTypes,
1616
1641
  type WithdrawalSpeeds as WithdrawalSpeeds,
1617
1642
  type WithdrawalStatus as WithdrawalStatus,
1618
- type WithdrawalCreateResponse as WithdrawalCreateResponse,
1619
- type WithdrawalRetrieveResponse as WithdrawalRetrieveResponse,
1620
1643
  type WithdrawalListResponse as WithdrawalListResponse,
1621
1644
  type WithdrawalListResponsesCursorPage as WithdrawalListResponsesCursorPage,
1622
1645
  type WithdrawalCreateParams as WithdrawalCreateParams,
@@ -1660,6 +1683,7 @@ export declare namespace Whop {
1660
1683
 
1661
1684
  export {
1662
1685
  PayoutMethods as PayoutMethods,
1686
+ type PayoutDestinationCategory as PayoutDestinationCategory,
1663
1687
  type PayoutMethodRetrieveResponse as PayoutMethodRetrieveResponse,
1664
1688
  type PayoutMethodListResponse as PayoutMethodListResponse,
1665
1689
  type PayoutMethodListResponsesCursorPage as PayoutMethodListResponsesCursorPage,
@@ -1668,14 +1692,14 @@ export declare namespace Whop {
1668
1692
 
1669
1693
  export {
1670
1694
  Verifications as Verifications,
1695
+ type VerificationErrorCode as VerificationErrorCode,
1696
+ type VerificationStatus as VerificationStatus,
1671
1697
  type VerificationRetrieveResponse as VerificationRetrieveResponse,
1672
1698
  };
1673
1699
 
1674
1700
  export {
1675
1701
  Leads as Leads,
1676
- type LeadCreateResponse as LeadCreateResponse,
1677
- type LeadRetrieveResponse as LeadRetrieveResponse,
1678
- type LeadUpdateResponse as LeadUpdateResponse,
1702
+ type Lead as Lead,
1679
1703
  type LeadListResponse as LeadListResponse,
1680
1704
  type LeadListResponsesCursorPage as LeadListResponsesCursorPage,
1681
1705
  type LeadCreateParams as LeadCreateParams,
@@ -1691,6 +1715,7 @@ export declare namespace Whop {
1691
1715
 
1692
1716
  export {
1693
1717
  Files as Files,
1718
+ type UploadStatus as UploadStatus,
1694
1719
  type FileCreateResponse as FileCreateResponse,
1695
1720
  type FileRetrieveResponse as FileRetrieveResponse,
1696
1721
  type FileCreateParams as FileCreateParams,
@@ -1698,8 +1723,8 @@ export declare namespace Whop {
1698
1723
 
1699
1724
  export {
1700
1725
  CompanyTokenTransactions as CompanyTokenTransactions,
1701
- type CompanyTokenTransactionCreateResponse as CompanyTokenTransactionCreateResponse,
1702
- type CompanyTokenTransactionRetrieveResponse as CompanyTokenTransactionRetrieveResponse,
1726
+ type BotTokenTransactionTypes as BotTokenTransactionTypes,
1727
+ type CompanyTokenTransaction as CompanyTokenTransaction,
1703
1728
  type CompanyTokenTransactionListResponse as CompanyTokenTransactionListResponse,
1704
1729
  type CompanyTokenTransactionListResponsesCursorPage as CompanyTokenTransactionListResponsesCursorPage,
1705
1730
  type CompanyTokenTransactionCreateParams as CompanyTokenTransactionCreateParams,
@@ -1708,9 +1733,9 @@ export declare namespace Whop {
1708
1733
 
1709
1734
  export {
1710
1735
  DmMembers as DmMembers,
1711
- type DmMemberCreateResponse as DmMemberCreateResponse,
1712
- type DmMemberRetrieveResponse as DmMemberRetrieveResponse,
1713
- type DmMemberUpdateResponse as DmMemberUpdateResponse,
1736
+ type DmFeedMemberNotificationPreferences as DmFeedMemberNotificationPreferences,
1737
+ type DmFeedMemberStatuses as DmFeedMemberStatuses,
1738
+ type DmMember as DmMember,
1714
1739
  type DmMemberListResponse as DmMemberListResponse,
1715
1740
  type DmMemberDeleteResponse as DmMemberDeleteResponse,
1716
1741
  type DmMemberListResponsesCursorPage as DmMemberListResponsesCursorPage,
@@ -1721,9 +1746,7 @@ export declare namespace Whop {
1721
1746
 
1722
1747
  export {
1723
1748
  AIChats as AIChats,
1724
- type AIChatCreateResponse as AIChatCreateResponse,
1725
- type AIChatRetrieveResponse as AIChatRetrieveResponse,
1726
- type AIChatUpdateResponse as AIChatUpdateResponse,
1749
+ type AIChat as AIChat,
1727
1750
  type AIChatListResponse as AIChatListResponse,
1728
1751
  type AIChatDeleteResponse as AIChatDeleteResponse,
1729
1752
  type AIChatListResponsesCursorPage as AIChatListResponsesCursorPage,
@@ -1732,6 +1755,17 @@ export declare namespace Whop {
1732
1755
  type AIChatListParams as AIChatListParams,
1733
1756
  };
1734
1757
 
1758
+ export {
1759
+ DmChannels as DmChannels,
1760
+ type DmChannel as DmChannel,
1761
+ type DmChannelListResponse as DmChannelListResponse,
1762
+ type DmChannelDeleteResponse as DmChannelDeleteResponse,
1763
+ type DmChannelListResponsesCursorPage as DmChannelListResponsesCursorPage,
1764
+ type DmChannelCreateParams as DmChannelCreateParams,
1765
+ type DmChannelUpdateParams as DmChannelUpdateParams,
1766
+ type DmChannelListParams as DmChannelListParams,
1767
+ };
1768
+
1735
1769
  export type AccessLevel = API.AccessLevel;
1736
1770
  export type AccessPassType = API.AccessPassType;
1737
1771
  export type App = API.App;
@@ -29,6 +29,12 @@ export async function defaultParseResponse<T>(client: Whop, props: APIResponsePr
29
29
  const mediaType = contentType?.split(';')[0]?.trim();
30
30
  const isJSON = mediaType?.includes('application/json') || mediaType?.endsWith('+json');
31
31
  if (isJSON) {
32
+ const contentLength = response.headers.get('content-length');
33
+ if (contentLength === '0') {
34
+ // if there is no content we can't do anything
35
+ return undefined as T;
36
+ }
37
+
32
38
  const json = await response.json();
33
39
  return json as T;
34
40
  }
@@ -14,17 +14,14 @@ export class AIChats extends APIResource {
14
14
  *
15
15
  * - `ai_chat:create`
16
16
  */
17
- create(
18
- body: AIChatCreateParams | null | undefined = {},
19
- options?: RequestOptions,
20
- ): APIPromise<AIChatCreateResponse> {
17
+ create(body: AIChatCreateParams | null | undefined = {}, options?: RequestOptions): APIPromise<AIChat> {
21
18
  return this._client.post('/ai_chats', { body, ...options });
22
19
  }
23
20
 
24
21
  /**
25
22
  * Fetches a single AI chat by ID
26
23
  */
27
- retrieve(id: string, options?: RequestOptions): APIPromise<AIChatRetrieveResponse> {
24
+ retrieve(id: string, options?: RequestOptions): APIPromise<AIChat> {
28
25
  return this._client.get(path`/ai_chats/${id}`, options);
29
26
  }
30
27
 
@@ -39,7 +36,7 @@ export class AIChats extends APIResource {
39
36
  id: string,
40
37
  body: AIChatUpdateParams | null | undefined = {},
41
38
  options?: RequestOptions,
42
- ): APIPromise<AIChatUpdateResponse> {
39
+ ): APIPromise<AIChat> {
43
40
  return this._client.patch(path`/ai_chats/${id}`, { body, ...options });
44
41
  }
45
42
 
@@ -70,121 +67,7 @@ export type AIChatListResponsesCursorPage = CursorPage<AIChatListResponse>;
70
67
  /**
71
68
  * An AI chat conversation belonging to a user
72
69
  */
73
- export interface AIChatCreateResponse {
74
- /**
75
- * The unique identifier for the AI chat
76
- */
77
- id: string;
78
-
79
- /**
80
- * The total number of tokens used in the chat
81
- */
82
- blended_token_usage: string;
83
-
84
- /**
85
- * When the AI chat was created
86
- */
87
- created_at: string;
88
-
89
- /**
90
- * When the last message was sent
91
- */
92
- last_message_at: string | null;
93
-
94
- /**
95
- * The number of messages in the chat
96
- */
97
- message_count: number;
98
-
99
- /**
100
- * The title of the AI chat
101
- */
102
- title: string | null;
103
-
104
- /**
105
- * When the AI chat was last updated
106
- */
107
- updated_at: string;
108
-
109
- /**
110
- * The user who owns the AI chat
111
- */
112
- user: AIChatCreateResponse.User;
113
- }
114
-
115
- export namespace AIChatCreateResponse {
116
- /**
117
- * The user who owns the AI chat
118
- */
119
- export interface User {
120
- /**
121
- * The internal ID of the user.
122
- */
123
- id: string;
124
- }
125
- }
126
-
127
- /**
128
- * An AI chat conversation belonging to a user
129
- */
130
- export interface AIChatRetrieveResponse {
131
- /**
132
- * The unique identifier for the AI chat
133
- */
134
- id: string;
135
-
136
- /**
137
- * The total number of tokens used in the chat
138
- */
139
- blended_token_usage: string;
140
-
141
- /**
142
- * When the AI chat was created
143
- */
144
- created_at: string;
145
-
146
- /**
147
- * When the last message was sent
148
- */
149
- last_message_at: string | null;
150
-
151
- /**
152
- * The number of messages in the chat
153
- */
154
- message_count: number;
155
-
156
- /**
157
- * The title of the AI chat
158
- */
159
- title: string | null;
160
-
161
- /**
162
- * When the AI chat was last updated
163
- */
164
- updated_at: string;
165
-
166
- /**
167
- * The user who owns the AI chat
168
- */
169
- user: AIChatRetrieveResponse.User;
170
- }
171
-
172
- export namespace AIChatRetrieveResponse {
173
- /**
174
- * The user who owns the AI chat
175
- */
176
- export interface User {
177
- /**
178
- * The internal ID of the user.
179
- */
180
- id: string;
181
- }
182
- }
183
-
184
- /**
185
- * An AI chat conversation belonging to a user
186
- */
187
- export interface AIChatUpdateResponse {
70
+ export interface AIChat {
188
71
  /**
189
72
  * The unique identifier for the AI chat
190
73
  */
@@ -223,10 +106,10 @@ export interface AIChatUpdateResponse {
223
106
  /**
224
107
  * The user who owns the AI chat
225
108
  */
226
- user: AIChatUpdateResponse.User;
109
+ user: AIChat.User;
227
110
  }
228
111
 
229
- export namespace AIChatUpdateResponse {
112
+ export namespace AIChat {
230
113
  /**
231
114
  * The user who owns the AI chat
232
115
  */
@@ -333,9 +216,7 @@ export interface AIChatListParams extends CursorPageParams {
333
216
 
334
217
  export declare namespace AIChats {
335
218
  export {
336
- type AIChatCreateResponse as AIChatCreateResponse,
337
- type AIChatRetrieveResponse as AIChatRetrieveResponse,
338
- type AIChatUpdateResponse as AIChatUpdateResponse,
219
+ type AIChat as AIChat,
339
220
  type AIChatListResponse as AIChatListResponse,
340
221
  type AIChatDeleteResponse as AIChatDeleteResponse,
341
222
  type AIChatListResponsesCursorPage as AIChatListResponsesCursorPage,
@@ -29,7 +29,7 @@ export class AuthorizedUsers extends APIResource {
29
29
  * - `member:email:read`
30
30
  */
31
31
  list(
32
- query: AuthorizedUserListParams,
32
+ query: AuthorizedUserListParams | null | undefined = {},
33
33
  options?: RequestOptions,
34
34
  ): PagePromise<AuthorizedUserListResponsesCursorPage, AuthorizedUserListResponse> {
35
35
  return this._client.getAPIList('/authorized_users', CursorPage<AuthorizedUserListResponse>, {
@@ -50,6 +50,11 @@ export interface AuthorizedUserRetrieveResponse {
50
50
  */
51
51
  id: string;
52
52
 
53
+ /**
54
+ * The company associated with the authorized user.
55
+ */
56
+ company: AuthorizedUserRetrieveResponse.Company;
57
+
53
58
  /**
54
59
  * The role of the authorized user in the company.
55
60
  */
@@ -62,6 +67,21 @@ export interface AuthorizedUserRetrieveResponse {
62
67
  }
63
68
 
64
69
  export namespace AuthorizedUserRetrieveResponse {
70
+ /**
71
+ * The company associated with the authorized user.
72
+ */
73
+ export interface Company {
74
+ /**
75
+ * The ID (tag) of the company.
76
+ */
77
+ id: string;
78
+
79
+ /**
80
+ * The title of the company.
81
+ */
82
+ title: string;
83
+ }
84
+
65
85
  /**
66
86
  * The user associated with the authorized user.
67
87
  */
@@ -97,6 +117,11 @@ export interface AuthorizedUserListResponse {
97
117
  */
98
118
  id: string;
99
119
 
120
+ /**
121
+ * The company associated with the authorized user.
122
+ */
123
+ company: AuthorizedUserListResponse.Company;
124
+
100
125
  /**
101
126
  * The role of the authorized user in the company.
102
127
  */
@@ -109,6 +134,21 @@ export interface AuthorizedUserListResponse {
109
134
  }
110
135
 
111
136
  export namespace AuthorizedUserListResponse {
137
+ /**
138
+ * The company associated with the authorized user.
139
+ */
140
+ export interface Company {
141
+ /**
142
+ * The ID (tag) of the company.
143
+ */
144
+ id: string;
145
+
146
+ /**
147
+ * The title of the company.
148
+ */
149
+ title: string;
150
+ }
151
+
112
152
  /**
113
153
  * The user associated with the authorized user.
114
154
  */
@@ -137,14 +177,14 @@ export namespace AuthorizedUserListResponse {
137
177
 
138
178
  export interface AuthorizedUserListParams extends CursorPageParams {
139
179
  /**
140
- * The ID of the company to list authorized users for
180
+ * Returns the elements in the list that come before the specified cursor.
141
181
  */
142
- company_id: string;
182
+ before?: string | null;
143
183
 
144
184
  /**
145
- * Returns the elements in the list that come before the specified cursor.
185
+ * The ID of the company to list authorized users for
146
186
  */
147
- before?: string | null;
187
+ company_id?: string | null;
148
188
 
149
189
  /**
150
190
  * The minimum creation date to filter by