@whop/sdk 0.0.24 → 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 (181) hide show
  1. package/CHANGELOG.md +68 -0
  2. package/README.md +2 -2
  3. package/client.d.mts +30 -18
  4. package/client.d.mts.map +1 -1
  5. package/client.d.ts +30 -18
  6. package/client.d.ts.map +1 -1
  7. package/client.js +15 -2
  8. package/client.js.map +1 -1
  9. package/client.mjs +17 -4
  10. package/client.mjs.map +1 -1
  11. package/internal/parse.d.mts.map +1 -1
  12. package/internal/parse.d.ts.map +1 -1
  13. package/internal/parse.js +5 -0
  14. package/internal/parse.js.map +1 -1
  15. package/internal/parse.mjs +5 -0
  16. package/internal/parse.mjs.map +1 -1
  17. package/package.json +1 -1
  18. package/resources/ai-chats.d.mts +169 -0
  19. package/resources/ai-chats.d.mts.map +1 -0
  20. package/resources/ai-chats.d.ts +169 -0
  21. package/resources/ai-chats.d.ts.map +1 -0
  22. package/resources/ai-chats.js +53 -0
  23. package/resources/ai-chats.js.map +1 -0
  24. package/resources/ai-chats.mjs +49 -0
  25. package/resources/ai-chats.mjs.map +1 -0
  26. package/resources/apps.d.mts +1 -1
  27. package/resources/apps.d.mts.map +1 -1
  28. package/resources/apps.d.ts +1 -1
  29. package/resources/apps.d.ts.map +1 -1
  30. package/resources/authorized-users.d.mts +39 -5
  31. package/resources/authorized-users.d.mts.map +1 -1
  32. package/resources/authorized-users.d.ts +39 -5
  33. package/resources/authorized-users.d.ts.map +1 -1
  34. package/resources/authorized-users.js +1 -1
  35. package/resources/authorized-users.js.map +1 -1
  36. package/resources/authorized-users.mjs +1 -1
  37. package/resources/authorized-users.mjs.map +1 -1
  38. package/resources/checkout-configurations.d.mts +12 -0
  39. package/resources/checkout-configurations.d.mts.map +1 -1
  40. package/resources/checkout-configurations.d.ts +12 -0
  41. package/resources/checkout-configurations.d.ts.map +1 -1
  42. package/resources/company-token-transactions.d.mts +339 -0
  43. package/resources/company-token-transactions.d.mts.map +1 -0
  44. package/resources/company-token-transactions.d.ts +339 -0
  45. package/resources/company-token-transactions.d.ts.map +1 -0
  46. package/resources/company-token-transactions.js +59 -0
  47. package/resources/company-token-transactions.js.map +1 -0
  48. package/resources/company-token-transactions.mjs +55 -0
  49. package/resources/company-token-transactions.mjs.map +1 -0
  50. package/resources/dm-channels.d.mts +161 -0
  51. package/resources/dm-channels.d.mts.map +1 -0
  52. package/resources/dm-channels.d.ts +161 -0
  53. package/resources/dm-channels.d.ts.map +1 -0
  54. package/resources/dm-channels.js +87 -0
  55. package/resources/dm-channels.js.map +1 -0
  56. package/resources/dm-channels.mjs +83 -0
  57. package/resources/dm-channels.mjs.map +1 -0
  58. package/resources/dm-members.d.mts +190 -0
  59. package/resources/dm-members.d.mts.map +1 -0
  60. package/resources/dm-members.d.ts +190 -0
  61. package/resources/dm-members.d.ts.map +1 -0
  62. package/resources/dm-members.js +94 -0
  63. package/resources/dm-members.js.map +1 -0
  64. package/resources/dm-members.mjs +90 -0
  65. package/resources/dm-members.mjs.map +1 -0
  66. package/resources/files.d.mts +7 -3
  67. package/resources/files.d.mts.map +1 -1
  68. package/resources/files.d.ts +7 -3
  69. package/resources/files.d.ts.map +1 -1
  70. package/resources/index.d.mts +13 -9
  71. package/resources/index.d.mts.map +1 -1
  72. package/resources/index.d.ts +13 -9
  73. package/resources/index.d.ts.map +1 -1
  74. package/resources/index.js +9 -1
  75. package/resources/index.js.map +1 -1
  76. package/resources/index.mjs +6 -2
  77. package/resources/index.mjs.map +1 -1
  78. package/resources/leads.d.mts +9 -177
  79. package/resources/leads.d.mts.map +1 -1
  80. package/resources/leads.d.ts +9 -177
  81. package/resources/leads.d.ts.map +1 -1
  82. package/resources/ledger-accounts.d.mts +3 -2
  83. package/resources/ledger-accounts.d.mts.map +1 -1
  84. package/resources/ledger-accounts.d.ts +3 -2
  85. package/resources/ledger-accounts.d.ts.map +1 -1
  86. package/resources/ledger-accounts.js.map +1 -1
  87. package/resources/ledger-accounts.mjs.map +1 -1
  88. package/resources/members.d.mts +13 -5
  89. package/resources/members.d.mts.map +1 -1
  90. package/resources/members.d.ts +13 -5
  91. package/resources/members.d.ts.map +1 -1
  92. package/resources/members.js +1 -1
  93. package/resources/members.js.map +1 -1
  94. package/resources/members.mjs +1 -1
  95. package/resources/members.mjs.map +1 -1
  96. package/resources/memberships.d.mts +32 -2
  97. package/resources/memberships.d.mts.map +1 -1
  98. package/resources/memberships.d.ts +32 -2
  99. package/resources/memberships.d.ts.map +1 -1
  100. package/resources/memberships.js +18 -0
  101. package/resources/memberships.js.map +1 -1
  102. package/resources/memberships.mjs +18 -0
  103. package/resources/memberships.mjs.map +1 -1
  104. package/resources/messages.d.mts +17 -1
  105. package/resources/messages.d.mts.map +1 -1
  106. package/resources/messages.d.ts +17 -1
  107. package/resources/messages.d.ts.map +1 -1
  108. package/resources/messages.js +10 -0
  109. package/resources/messages.js.map +1 -1
  110. package/resources/messages.mjs +10 -0
  111. package/resources/messages.mjs.map +1 -1
  112. package/resources/payments.d.mts +42 -1
  113. package/resources/payments.d.mts.map +1 -1
  114. package/resources/payments.d.ts +42 -1
  115. package/resources/payments.d.ts.map +1 -1
  116. package/resources/payout-methods.d.mts +26 -3
  117. package/resources/payout-methods.d.mts.map +1 -1
  118. package/resources/payout-methods.d.ts +26 -3
  119. package/resources/payout-methods.d.ts.map +1 -1
  120. package/resources/payout-methods.js.map +1 -1
  121. package/resources/payout-methods.mjs.map +1 -1
  122. package/resources/reactions.d.mts +24 -1
  123. package/resources/reactions.d.mts.map +1 -1
  124. package/resources/reactions.d.ts +24 -1
  125. package/resources/reactions.d.ts.map +1 -1
  126. package/resources/reactions.js +11 -0
  127. package/resources/reactions.js.map +1 -1
  128. package/resources/reactions.mjs +11 -0
  129. package/resources/reactions.mjs.map +1 -1
  130. package/resources/refunds.d.mts +1 -1
  131. package/resources/refunds.d.mts.map +1 -1
  132. package/resources/refunds.d.ts +1 -1
  133. package/resources/refunds.d.ts.map +1 -1
  134. package/resources/shared.d.mts +73 -1
  135. package/resources/shared.d.mts.map +1 -1
  136. package/resources/shared.d.ts +73 -1
  137. package/resources/shared.d.ts.map +1 -1
  138. package/resources/verifications.d.mts +11 -3
  139. package/resources/verifications.d.mts.map +1 -1
  140. package/resources/verifications.d.ts +11 -3
  141. package/resources/verifications.d.ts.map +1 -1
  142. package/resources/webhooks.d.mts +43 -293
  143. package/resources/webhooks.d.mts.map +1 -1
  144. package/resources/webhooks.d.ts +43 -293
  145. package/resources/webhooks.d.ts.map +1 -1
  146. package/resources/webhooks.js.map +1 -1
  147. package/resources/webhooks.mjs +2 -2
  148. package/resources/webhooks.mjs.map +1 -1
  149. package/resources/withdrawals.d.mts +21 -128
  150. package/resources/withdrawals.d.mts.map +1 -1
  151. package/resources/withdrawals.d.ts +21 -128
  152. package/resources/withdrawals.d.ts.map +1 -1
  153. package/src/client.ts +133 -18
  154. package/src/internal/parse.ts +6 -0
  155. package/src/resources/ai-chats.ts +227 -0
  156. package/src/resources/apps.ts +6 -0
  157. package/src/resources/authorized-users.ts +45 -5
  158. package/src/resources/checkout-configurations.ts +15 -0
  159. package/src/resources/company-token-transactions.ts +433 -0
  160. package/src/resources/dm-channels.ts +212 -0
  161. package/src/resources/dm-members.ts +248 -0
  162. package/src/resources/files.ts +8 -2
  163. package/src/resources/index.ts +64 -9
  164. package/src/resources/leads.ts +9 -205
  165. package/src/resources/ledger-accounts.ts +3 -35
  166. package/src/resources/members.ts +16 -6
  167. package/src/resources/memberships.ts +45 -9
  168. package/src/resources/messages.ts +22 -0
  169. package/src/resources/payments.ts +109 -57
  170. package/src/resources/payout-methods.ts +37 -2
  171. package/src/resources/reactions.ts +36 -0
  172. package/src/resources/refunds.ts +2 -1
  173. package/src/resources/shared.ts +110 -11
  174. package/src/resources/verifications.ts +49 -36
  175. package/src/resources/webhooks.ts +78 -728
  176. package/src/resources/withdrawals.ts +29 -205
  177. package/src/version.ts +1 -1
  178. package/version.d.mts +1 -1
  179. package/version.d.ts +1 -1
  180. package/version.js +1 -1
  181. package/version.mjs +1 -1
package/src/client.ts CHANGED
@@ -21,6 +21,16 @@ import * as API from './resources/index';
21
21
  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
+ import {
25
+ AIChat,
26
+ AIChatCreateParams,
27
+ AIChatDeleteResponse,
28
+ AIChatListParams,
29
+ AIChatListResponse,
30
+ AIChatListResponsesCursorPage,
31
+ AIChatUpdateParams,
32
+ AIChats,
33
+ } from './resources/ai-chats';
24
34
  import {
25
35
  AppBuildCreateParams,
26
36
  AppBuildListParams,
@@ -67,6 +77,15 @@ import {
67
77
  CompanyListResponsesCursorPage,
68
78
  CompanyUpdateParams,
69
79
  } from './resources/companies';
80
+ import {
81
+ BotTokenTransactionTypes,
82
+ CompanyTokenTransaction,
83
+ CompanyTokenTransactionCreateParams,
84
+ CompanyTokenTransactionListParams,
85
+ CompanyTokenTransactionListResponse,
86
+ CompanyTokenTransactionListResponsesCursorPage,
87
+ CompanyTokenTransactions,
88
+ } from './resources/company-token-transactions';
70
89
  import {
71
90
  CourseChapter,
72
91
  CourseChapterCreateParams,
@@ -127,6 +146,28 @@ import {
127
146
  DisputeUpdateEvidenceParams,
128
147
  Disputes,
129
148
  } from './resources/disputes';
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,
163
+ DmMemberCreateParams,
164
+ DmMemberDeleteResponse,
165
+ DmMemberListParams,
166
+ DmMemberListResponse,
167
+ DmMemberListResponsesCursorPage,
168
+ DmMemberUpdateParams,
169
+ DmMembers,
170
+ } from './resources/dm-members';
130
171
  import {
131
172
  Entries,
132
173
  EntryApproveResponse,
@@ -156,7 +197,13 @@ import {
156
197
  FeeMarkupType,
157
198
  FeeMarkups,
158
199
  } from './resources/fee-markups';
159
- import { FileCreateParams, FileCreateResponse, FileRetrieveResponse, Files } from './resources/files';
200
+ import {
201
+ FileCreateParams,
202
+ FileCreateResponse,
203
+ FileRetrieveResponse,
204
+ Files,
205
+ UploadStatus,
206
+ } from './resources/files';
160
207
  import {
161
208
  ForumPostCreateParams,
162
209
  ForumPostListParams,
@@ -175,14 +222,12 @@ import {
175
222
  } from './resources/forums';
176
223
  import { InvoiceCreateParams, InvoiceListParams, InvoiceVoidResponse, Invoices } from './resources/invoices';
177
224
  import {
225
+ Lead,
178
226
  LeadCreateParams,
179
- LeadCreateResponse,
180
227
  LeadListParams,
181
228
  LeadListResponse,
182
229
  LeadListResponsesCursorPage,
183
- LeadRetrieveResponse,
184
230
  LeadUpdateParams,
185
- LeadUpdateResponse,
186
231
  Leads,
187
232
  } from './resources/leads';
188
233
  import { LedgerAccountRetrieveResponse, LedgerAccounts } from './resources/ledger-accounts';
@@ -194,6 +239,7 @@ import {
194
239
  Members,
195
240
  } from './resources/members';
196
241
  import {
242
+ CancelOptions,
197
243
  MembershipCancelParams,
198
244
  MembershipListParams,
199
245
  MembershipListResponse,
@@ -204,6 +250,7 @@ import {
204
250
  } from './resources/memberships';
205
251
  import {
206
252
  MessageCreateParams,
253
+ MessageDeleteResponse,
207
254
  MessageListParams,
208
255
  MessageListResponse,
209
256
  MessageListResponsesCursorPage,
@@ -238,6 +285,7 @@ import {
238
285
  Payments,
239
286
  } from './resources/payments';
240
287
  import {
288
+ PayoutDestinationCategory,
241
289
  PayoutMethodListParams,
242
290
  PayoutMethodListResponse,
243
291
  PayoutMethodListResponsesCursorPage,
@@ -273,6 +321,8 @@ import {
273
321
  } from './resources/promo-codes';
274
322
  import {
275
323
  ReactionCreateParams,
324
+ ReactionDeleteParams,
325
+ ReactionDeleteResponse,
276
326
  ReactionListParams,
277
327
  ReactionListResponse,
278
328
  ReactionListResponsesCursorPage,
@@ -333,8 +383,14 @@ import {
333
383
  UserRetrieveResponse,
334
384
  Users,
335
385
  } from './resources/users';
336
- import { VerificationRetrieveResponse, Verifications } from './resources/verifications';
337
386
  import {
387
+ VerificationErrorCode,
388
+ VerificationRetrieveResponse,
389
+ VerificationStatus,
390
+ Verifications,
391
+ } from './resources/verifications';
392
+ import {
393
+ APIVersion,
338
394
  CourseLessonInteractionCompletedWebhookEvent,
339
395
  DisputeCreatedWebhookEvent,
340
396
  DisputeUpdatedWebhookEvent,
@@ -361,27 +417,26 @@ import {
361
417
  SetupIntentSucceededWebhookEvent,
362
418
  UnwrapWebhookEvent,
363
419
  VerificationSucceededWebhookEvent,
420
+ Webhook,
364
421
  WebhookCreateParams,
365
422
  WebhookCreateResponse,
366
423
  WebhookDeleteResponse,
424
+ WebhookEvent,
367
425
  WebhookListParams,
368
426
  WebhookListResponse,
369
427
  WebhookListResponsesCursorPage,
370
- WebhookRetrieveResponse,
371
428
  WebhookUpdateParams,
372
- WebhookUpdateResponse,
373
429
  Webhooks,
374
430
  WithdrawalCreatedWebhookEvent,
375
431
  WithdrawalUpdatedWebhookEvent,
376
432
  } from './resources/webhooks';
377
433
  import {
434
+ Withdrawal,
378
435
  WithdrawalCreateParams,
379
- WithdrawalCreateResponse,
380
436
  WithdrawalFeeTypes,
381
437
  WithdrawalListParams,
382
438
  WithdrawalListResponse,
383
439
  WithdrawalListResponsesCursorPage,
384
- WithdrawalRetrieveResponse,
385
440
  WithdrawalSpeeds,
386
441
  WithdrawalStatus,
387
442
  Withdrawals,
@@ -884,9 +939,10 @@ export class Whop {
884
939
  controller: AbortController,
885
940
  ): Promise<Response> {
886
941
  const { signal, method, ...options } = init || {};
887
- if (signal) signal.addEventListener('abort', () => controller.abort());
942
+ const abort = controller.abort.bind(controller);
943
+ if (signal) signal.addEventListener('abort', abort, { once: true });
888
944
 
889
- const timeout = setTimeout(() => controller.abort(), ms);
945
+ const timeout = setTimeout(abort, ms);
890
946
 
891
947
  const isReadableBody =
892
948
  ((globalThis as any).ReadableStream && options.body instanceof (globalThis as any).ReadableStream) ||
@@ -1157,6 +1213,10 @@ export class Whop {
1157
1213
  leads: API.Leads = new API.Leads(this);
1158
1214
  topups: API.Topups = new API.Topups(this);
1159
1215
  files: API.Files = new API.Files(this);
1216
+ companyTokenTransactions: API.CompanyTokenTransactions = new API.CompanyTokenTransactions(this);
1217
+ dmMembers: API.DmMembers = new API.DmMembers(this);
1218
+ aiChats: API.AIChats = new API.AIChats(this);
1219
+ dmChannels: API.DmChannels = new API.DmChannels(this);
1160
1220
  }
1161
1221
 
1162
1222
  Whop.Apps = Apps;
@@ -1204,6 +1264,10 @@ Whop.Verifications = Verifications;
1204
1264
  Whop.Leads = Leads;
1205
1265
  Whop.Topups = Topups;
1206
1266
  Whop.Files = Files;
1267
+ Whop.CompanyTokenTransactions = CompanyTokenTransactions;
1268
+ Whop.DmMembers = DmMembers;
1269
+ Whop.AIChats = AIChats;
1270
+ Whop.DmChannels = DmChannels;
1207
1271
 
1208
1272
  export declare namespace Whop {
1209
1273
  export type RequestOptions = Opts.RequestOptions;
@@ -1252,9 +1316,10 @@ export declare namespace Whop {
1252
1316
 
1253
1317
  export {
1254
1318
  Webhooks as Webhooks,
1319
+ type APIVersion as APIVersion,
1320
+ type Webhook as Webhook,
1321
+ type WebhookEvent as WebhookEvent,
1255
1322
  type WebhookCreateResponse as WebhookCreateResponse,
1256
- type WebhookRetrieveResponse as WebhookRetrieveResponse,
1257
- type WebhookUpdateResponse as WebhookUpdateResponse,
1258
1323
  type WebhookListResponse as WebhookListResponse,
1259
1324
  type WebhookDeleteResponse as WebhookDeleteResponse,
1260
1325
  type InvoiceCreatedWebhookEvent as InvoiceCreatedWebhookEvent,
@@ -1334,6 +1399,7 @@ export declare namespace Whop {
1334
1399
 
1335
1400
  export {
1336
1401
  Memberships as Memberships,
1402
+ type CancelOptions as CancelOptions,
1337
1403
  type MembershipListResponse as MembershipListResponse,
1338
1404
  type MembershipListResponsesCursorPage as MembershipListResponsesCursorPage,
1339
1405
  type MembershipUpdateParams as MembershipUpdateParams,
@@ -1378,6 +1444,7 @@ export declare namespace Whop {
1378
1444
  export {
1379
1445
  Messages as Messages,
1380
1446
  type MessageListResponse as MessageListResponse,
1447
+ type MessageDeleteResponse as MessageDeleteResponse,
1381
1448
  type MessageListResponsesCursorPage as MessageListResponsesCursorPage,
1382
1449
  type MessageCreateParams as MessageCreateParams,
1383
1450
  type MessageUpdateParams as MessageUpdateParams,
@@ -1438,9 +1505,11 @@ export declare namespace Whop {
1438
1505
  export {
1439
1506
  Reactions as Reactions,
1440
1507
  type ReactionListResponse as ReactionListResponse,
1508
+ type ReactionDeleteResponse as ReactionDeleteResponse,
1441
1509
  type ReactionListResponsesCursorPage as ReactionListResponsesCursorPage,
1442
1510
  type ReactionCreateParams as ReactionCreateParams,
1443
1511
  type ReactionListParams as ReactionListParams,
1512
+ type ReactionDeleteParams as ReactionDeleteParams,
1444
1513
  };
1445
1514
 
1446
1515
  export {
@@ -1567,11 +1636,10 @@ export declare namespace Whop {
1567
1636
 
1568
1637
  export {
1569
1638
  Withdrawals as Withdrawals,
1639
+ type Withdrawal as Withdrawal,
1570
1640
  type WithdrawalFeeTypes as WithdrawalFeeTypes,
1571
1641
  type WithdrawalSpeeds as WithdrawalSpeeds,
1572
1642
  type WithdrawalStatus as WithdrawalStatus,
1573
- type WithdrawalCreateResponse as WithdrawalCreateResponse,
1574
- type WithdrawalRetrieveResponse as WithdrawalRetrieveResponse,
1575
1643
  type WithdrawalListResponse as WithdrawalListResponse,
1576
1644
  type WithdrawalListResponsesCursorPage as WithdrawalListResponsesCursorPage,
1577
1645
  type WithdrawalCreateParams as WithdrawalCreateParams,
@@ -1615,6 +1683,7 @@ export declare namespace Whop {
1615
1683
 
1616
1684
  export {
1617
1685
  PayoutMethods as PayoutMethods,
1686
+ type PayoutDestinationCategory as PayoutDestinationCategory,
1618
1687
  type PayoutMethodRetrieveResponse as PayoutMethodRetrieveResponse,
1619
1688
  type PayoutMethodListResponse as PayoutMethodListResponse,
1620
1689
  type PayoutMethodListResponsesCursorPage as PayoutMethodListResponsesCursorPage,
@@ -1623,14 +1692,14 @@ export declare namespace Whop {
1623
1692
 
1624
1693
  export {
1625
1694
  Verifications as Verifications,
1695
+ type VerificationErrorCode as VerificationErrorCode,
1696
+ type VerificationStatus as VerificationStatus,
1626
1697
  type VerificationRetrieveResponse as VerificationRetrieveResponse,
1627
1698
  };
1628
1699
 
1629
1700
  export {
1630
1701
  Leads as Leads,
1631
- type LeadCreateResponse as LeadCreateResponse,
1632
- type LeadRetrieveResponse as LeadRetrieveResponse,
1633
- type LeadUpdateResponse as LeadUpdateResponse,
1702
+ type Lead as Lead,
1634
1703
  type LeadListResponse as LeadListResponse,
1635
1704
  type LeadListResponsesCursorPage as LeadListResponsesCursorPage,
1636
1705
  type LeadCreateParams as LeadCreateParams,
@@ -1646,11 +1715,57 @@ export declare namespace Whop {
1646
1715
 
1647
1716
  export {
1648
1717
  Files as Files,
1718
+ type UploadStatus as UploadStatus,
1649
1719
  type FileCreateResponse as FileCreateResponse,
1650
1720
  type FileRetrieveResponse as FileRetrieveResponse,
1651
1721
  type FileCreateParams as FileCreateParams,
1652
1722
  };
1653
1723
 
1724
+ export {
1725
+ CompanyTokenTransactions as CompanyTokenTransactions,
1726
+ type BotTokenTransactionTypes as BotTokenTransactionTypes,
1727
+ type CompanyTokenTransaction as CompanyTokenTransaction,
1728
+ type CompanyTokenTransactionListResponse as CompanyTokenTransactionListResponse,
1729
+ type CompanyTokenTransactionListResponsesCursorPage as CompanyTokenTransactionListResponsesCursorPage,
1730
+ type CompanyTokenTransactionCreateParams as CompanyTokenTransactionCreateParams,
1731
+ type CompanyTokenTransactionListParams as CompanyTokenTransactionListParams,
1732
+ };
1733
+
1734
+ export {
1735
+ DmMembers as DmMembers,
1736
+ type DmFeedMemberNotificationPreferences as DmFeedMemberNotificationPreferences,
1737
+ type DmFeedMemberStatuses as DmFeedMemberStatuses,
1738
+ type DmMember as DmMember,
1739
+ type DmMemberListResponse as DmMemberListResponse,
1740
+ type DmMemberDeleteResponse as DmMemberDeleteResponse,
1741
+ type DmMemberListResponsesCursorPage as DmMemberListResponsesCursorPage,
1742
+ type DmMemberCreateParams as DmMemberCreateParams,
1743
+ type DmMemberUpdateParams as DmMemberUpdateParams,
1744
+ type DmMemberListParams as DmMemberListParams,
1745
+ };
1746
+
1747
+ export {
1748
+ AIChats as AIChats,
1749
+ type AIChat as AIChat,
1750
+ type AIChatListResponse as AIChatListResponse,
1751
+ type AIChatDeleteResponse as AIChatDeleteResponse,
1752
+ type AIChatListResponsesCursorPage as AIChatListResponsesCursorPage,
1753
+ type AIChatCreateParams as AIChatCreateParams,
1754
+ type AIChatUpdateParams as AIChatUpdateParams,
1755
+ type AIChatListParams as AIChatListParams,
1756
+ };
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
+
1654
1769
  export type AccessLevel = API.AccessLevel;
1655
1770
  export type AccessPassType = API.AccessPassType;
1656
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
  }
@@ -0,0 +1,227 @@
1
+ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
+
3
+ import { APIResource } from '../core/resource';
4
+ import { APIPromise } from '../core/api-promise';
5
+ import { CursorPage, type CursorPageParams, PagePromise } from '../core/pagination';
6
+ import { RequestOptions } from '../internal/request-options';
7
+ import { path } from '../internal/utils/path';
8
+
9
+ export class AIChats extends APIResource {
10
+ /**
11
+ * Creates a new AI chat
12
+ *
13
+ * Required permissions:
14
+ *
15
+ * - `ai_chat:create`
16
+ */
17
+ create(body: AIChatCreateParams | null | undefined = {}, options?: RequestOptions): APIPromise<AIChat> {
18
+ return this._client.post('/ai_chats', { body, ...options });
19
+ }
20
+
21
+ /**
22
+ * Fetches a single AI chat by ID
23
+ */
24
+ retrieve(id: string, options?: RequestOptions): APIPromise<AIChat> {
25
+ return this._client.get(path`/ai_chats/${id}`, options);
26
+ }
27
+
28
+ /**
29
+ * Updates an AI chat
30
+ *
31
+ * Required permissions:
32
+ *
33
+ * - `ai_chat:update`
34
+ */
35
+ update(
36
+ id: string,
37
+ body: AIChatUpdateParams | null | undefined = {},
38
+ options?: RequestOptions,
39
+ ): APIPromise<AIChat> {
40
+ return this._client.patch(path`/ai_chats/${id}`, { body, ...options });
41
+ }
42
+
43
+ /**
44
+ * Fetches all AI chats for the current user
45
+ */
46
+ list(
47
+ query: AIChatListParams | null | undefined = {},
48
+ options?: RequestOptions,
49
+ ): PagePromise<AIChatListResponsesCursorPage, AIChatListResponse> {
50
+ return this._client.getAPIList('/ai_chats', CursorPage<AIChatListResponse>, { query, ...options });
51
+ }
52
+
53
+ /**
54
+ * Deletes an AI chat
55
+ *
56
+ * Required permissions:
57
+ *
58
+ * - `ai_chat:delete`
59
+ */
60
+ delete(id: string, options?: RequestOptions): APIPromise<AIChatDeleteResponse> {
61
+ return this._client.delete(path`/ai_chats/${id}`, options);
62
+ }
63
+ }
64
+
65
+ export type AIChatListResponsesCursorPage = CursorPage<AIChatListResponse>;
66
+
67
+ /**
68
+ * An AI chat conversation belonging to a user
69
+ */
70
+ export interface AIChat {
71
+ /**
72
+ * The unique identifier for the AI chat
73
+ */
74
+ id: string;
75
+
76
+ /**
77
+ * The total number of tokens used in the chat
78
+ */
79
+ blended_token_usage: string;
80
+
81
+ /**
82
+ * When the AI chat was created
83
+ */
84
+ created_at: string;
85
+
86
+ /**
87
+ * When the last message was sent
88
+ */
89
+ last_message_at: string | null;
90
+
91
+ /**
92
+ * The number of messages in the chat
93
+ */
94
+ message_count: number;
95
+
96
+ /**
97
+ * The title of the AI chat
98
+ */
99
+ title: string | null;
100
+
101
+ /**
102
+ * When the AI chat was last updated
103
+ */
104
+ updated_at: string;
105
+
106
+ /**
107
+ * The user who owns the AI chat
108
+ */
109
+ user: AIChat.User;
110
+ }
111
+
112
+ export namespace AIChat {
113
+ /**
114
+ * The user who owns the AI chat
115
+ */
116
+ export interface User {
117
+ /**
118
+ * The internal ID of the user.
119
+ */
120
+ id: string;
121
+ }
122
+ }
123
+
124
+ /**
125
+ * An AI chat conversation belonging to a user
126
+ */
127
+ export interface AIChatListResponse {
128
+ /**
129
+ * The unique identifier for the AI chat
130
+ */
131
+ id: string;
132
+
133
+ /**
134
+ * The total number of tokens used in the chat
135
+ */
136
+ blended_token_usage: string;
137
+
138
+ /**
139
+ * When the AI chat was created
140
+ */
141
+ created_at: string;
142
+
143
+ /**
144
+ * When the last message was sent
145
+ */
146
+ last_message_at: string | null;
147
+
148
+ /**
149
+ * The number of messages in the chat
150
+ */
151
+ message_count: number;
152
+
153
+ /**
154
+ * The title of the AI chat
155
+ */
156
+ title: string | null;
157
+
158
+ /**
159
+ * When the AI chat was last updated
160
+ */
161
+ updated_at: string;
162
+
163
+ /**
164
+ * The user who owns the AI chat
165
+ */
166
+ user: AIChatListResponse.User;
167
+ }
168
+
169
+ export namespace AIChatListResponse {
170
+ /**
171
+ * The user who owns the AI chat
172
+ */
173
+ export interface User {
174
+ /**
175
+ * The internal ID of the user.
176
+ */
177
+ id: string;
178
+ }
179
+ }
180
+
181
+ /**
182
+ * Represents `true` or `false` values.
183
+ */
184
+ export type AIChatDeleteResponse = boolean;
185
+
186
+ export interface AIChatCreateParams {
187
+ /**
188
+ * The title of the AI chat
189
+ */
190
+ title?: string | null;
191
+ }
192
+
193
+ export interface AIChatUpdateParams {
194
+ /**
195
+ * The new title for the AI chat
196
+ */
197
+ title?: string | null;
198
+ }
199
+
200
+ export interface AIChatListParams extends CursorPageParams {
201
+ /**
202
+ * Returns the elements in the list that come before the specified cursor.
203
+ */
204
+ before?: string | null;
205
+
206
+ /**
207
+ * Returns the first _n_ elements from the list.
208
+ */
209
+ first?: number | null;
210
+
211
+ /**
212
+ * Returns the last _n_ elements from the list.
213
+ */
214
+ last?: number | null;
215
+ }
216
+
217
+ export declare namespace AIChats {
218
+ export {
219
+ type AIChat as AIChat,
220
+ type AIChatListResponse as AIChatListResponse,
221
+ type AIChatDeleteResponse as AIChatDeleteResponse,
222
+ type AIChatListResponsesCursorPage as AIChatListResponsesCursorPage,
223
+ type AIChatCreateParams as AIChatCreateParams,
224
+ type AIChatUpdateParams as AIChatUpdateParams,
225
+ type AIChatListParams as AIChatListParams,
226
+ };
227
+ }
@@ -366,12 +366,18 @@ export interface AppListParams extends CursorPageParams {
366
366
  * The order to fetch the apps in for discovery.
367
367
  */
368
368
  order?:
369
+ | 'created_at'
369
370
  | 'discoverable_at'
370
371
  | 'total_installs_last_30_days'
371
372
  | 'total_installs_last_7_days'
372
373
  | 'time_spent'
373
374
  | 'time_spent_last_24_hours'
374
375
  | 'daily_active_users'
376
+ | 'ai_prompt_count'
377
+ | 'total_ai_cost_usd'
378
+ | 'total_ai_tokens'
379
+ | 'last_ai_prompt_at'
380
+ | 'ai_average_rating'
375
381
  | null;
376
382
 
377
383
  /**
@@ -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