@whop/sdk 0.0.24 → 0.0.25

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 (125) hide show
  1. package/CHANGELOG.md +47 -0
  2. package/README.md +2 -2
  3. package/client.d.mts +13 -4
  4. package/client.d.mts.map +1 -1
  5. package/client.d.ts +13 -4
  6. package/client.d.ts.map +1 -1
  7. package/client.js +9 -0
  8. package/client.js.map +1 -1
  9. package/client.mjs +9 -0
  10. package/client.mjs.map +1 -1
  11. package/package.json +1 -1
  12. package/resources/ai-chats.d.mts +265 -0
  13. package/resources/ai-chats.d.mts.map +1 -0
  14. package/resources/ai-chats.d.ts +265 -0
  15. package/resources/ai-chats.d.ts.map +1 -0
  16. package/resources/ai-chats.js +53 -0
  17. package/resources/ai-chats.js.map +1 -0
  18. package/resources/ai-chats.mjs +49 -0
  19. package/resources/ai-chats.mjs.map +1 -0
  20. package/resources/apps.d.mts +1 -1
  21. package/resources/apps.d.mts.map +1 -1
  22. package/resources/apps.d.ts +1 -1
  23. package/resources/apps.d.ts.map +1 -1
  24. package/resources/checkout-configurations.d.mts +12 -0
  25. package/resources/checkout-configurations.d.mts.map +1 -1
  26. package/resources/checkout-configurations.d.ts +12 -0
  27. package/resources/checkout-configurations.d.ts.map +1 -1
  28. package/resources/company-token-transactions.d.mts +425 -0
  29. package/resources/company-token-transactions.d.mts.map +1 -0
  30. package/resources/company-token-transactions.d.ts +425 -0
  31. package/resources/company-token-transactions.d.ts.map +1 -0
  32. package/resources/company-token-transactions.js +59 -0
  33. package/resources/company-token-transactions.js.map +1 -0
  34. package/resources/company-token-transactions.mjs +55 -0
  35. package/resources/company-token-transactions.mjs.map +1 -0
  36. package/resources/dm-members.d.mts +242 -0
  37. package/resources/dm-members.d.mts.map +1 -0
  38. package/resources/dm-members.d.ts +242 -0
  39. package/resources/dm-members.d.ts.map +1 -0
  40. package/resources/dm-members.js +94 -0
  41. package/resources/dm-members.js.map +1 -0
  42. package/resources/dm-members.mjs +90 -0
  43. package/resources/dm-members.mjs.map +1 -0
  44. package/resources/index.d.mts +5 -2
  45. package/resources/index.d.mts.map +1 -1
  46. package/resources/index.d.ts +5 -2
  47. package/resources/index.d.ts.map +1 -1
  48. package/resources/index.js +7 -1
  49. package/resources/index.js.map +1 -1
  50. package/resources/index.mjs +3 -0
  51. package/resources/index.mjs.map +1 -1
  52. package/resources/members.d.mts +8 -0
  53. package/resources/members.d.mts.map +1 -1
  54. package/resources/members.d.ts +8 -0
  55. package/resources/members.d.ts.map +1 -1
  56. package/resources/memberships.d.mts +25 -0
  57. package/resources/memberships.d.mts.map +1 -1
  58. package/resources/memberships.d.ts +25 -0
  59. package/resources/memberships.d.ts.map +1 -1
  60. package/resources/memberships.js +18 -0
  61. package/resources/memberships.js.map +1 -1
  62. package/resources/memberships.mjs +18 -0
  63. package/resources/memberships.mjs.map +1 -1
  64. package/resources/messages.d.mts +17 -1
  65. package/resources/messages.d.mts.map +1 -1
  66. package/resources/messages.d.ts +17 -1
  67. package/resources/messages.d.ts.map +1 -1
  68. package/resources/messages.js +10 -0
  69. package/resources/messages.js.map +1 -1
  70. package/resources/messages.mjs +10 -0
  71. package/resources/messages.mjs.map +1 -1
  72. package/resources/payments.d.mts +9 -1
  73. package/resources/payments.d.mts.map +1 -1
  74. package/resources/payments.d.ts +9 -1
  75. package/resources/payments.d.ts.map +1 -1
  76. package/resources/payout-methods.d.mts +18 -0
  77. package/resources/payout-methods.d.mts.map +1 -1
  78. package/resources/payout-methods.d.ts +18 -0
  79. package/resources/payout-methods.d.ts.map +1 -1
  80. package/resources/reactions.d.mts +24 -1
  81. package/resources/reactions.d.mts.map +1 -1
  82. package/resources/reactions.d.ts +24 -1
  83. package/resources/reactions.d.ts.map +1 -1
  84. package/resources/reactions.js +11 -0
  85. package/resources/reactions.js.map +1 -1
  86. package/resources/reactions.mjs +11 -0
  87. package/resources/reactions.mjs.map +1 -1
  88. package/resources/refunds.d.mts +1 -1
  89. package/resources/refunds.d.mts.map +1 -1
  90. package/resources/refunds.d.ts +1 -1
  91. package/resources/refunds.d.ts.map +1 -1
  92. package/resources/shared.d.mts +39 -1
  93. package/resources/shared.d.mts.map +1 -1
  94. package/resources/shared.d.ts +39 -1
  95. package/resources/shared.d.ts.map +1 -1
  96. package/resources/webhooks.d.mts +9 -0
  97. package/resources/webhooks.d.mts.map +1 -1
  98. package/resources/webhooks.d.ts +9 -0
  99. package/resources/webhooks.d.ts.map +1 -1
  100. package/resources/withdrawals.d.mts +4 -0
  101. package/resources/withdrawals.d.mts.map +1 -1
  102. package/resources/withdrawals.d.ts +4 -0
  103. package/resources/withdrawals.d.ts.map +1 -1
  104. package/src/client.ts +81 -0
  105. package/src/resources/ai-chats.ts +346 -0
  106. package/src/resources/apps.ts +6 -0
  107. package/src/resources/checkout-configurations.ts +15 -0
  108. package/src/resources/company-token-transactions.ts +535 -0
  109. package/src/resources/dm-members.ts +310 -0
  110. package/src/resources/index.ts +36 -0
  111. package/src/resources/members.ts +10 -0
  112. package/src/resources/memberships.ts +38 -0
  113. package/src/resources/messages.ts +22 -0
  114. package/src/resources/payments.ts +69 -57
  115. package/src/resources/payout-methods.ts +22 -0
  116. package/src/resources/reactions.ts +36 -0
  117. package/src/resources/refunds.ts +2 -1
  118. package/src/resources/shared.ts +77 -11
  119. package/src/resources/webhooks.ts +11 -0
  120. package/src/resources/withdrawals.ts +5 -0
  121. package/src/version.ts +1 -1
  122. package/version.d.mts +1 -1
  123. package/version.d.ts +1 -1
  124. package/version.js +1 -1
  125. package/version.mjs +1 -1
@@ -0,0 +1,535 @@
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 CompanyTokenTransactions extends APIResource {
10
+ /**
11
+ * Create a token transaction (add/subtract/transfer) for a member
12
+ *
13
+ * Required permissions:
14
+ *
15
+ * - `company_token_transaction:create`
16
+ * - `member:basic:read`
17
+ * - `company:basic:read`
18
+ *
19
+ * @example
20
+ * ```ts
21
+ * const companyTokenTransaction =
22
+ * await client.companyTokenTransactions.create({
23
+ * amount: 6.9,
24
+ * company_id: 'biz_xxxxxxxxxxxxxx',
25
+ * destination_user_id: 'destination_user_id',
26
+ * transaction_type: 'transfer',
27
+ * user_id: 'user_xxxxxxxxxxxxx',
28
+ * });
29
+ * ```
30
+ */
31
+ create(
32
+ body: CompanyTokenTransactionCreateParams,
33
+ options?: RequestOptions,
34
+ ): APIPromise<CompanyTokenTransactionCreateResponse> {
35
+ return this._client.post('/company_token_transactions', { body, ...options });
36
+ }
37
+
38
+ /**
39
+ * Retrieves a token transaction by ID
40
+ *
41
+ * Required permissions:
42
+ *
43
+ * - `company_token_transaction:read`
44
+ * - `member:basic:read`
45
+ * - `company:basic:read`
46
+ */
47
+ retrieve(id: string, options?: RequestOptions): APIPromise<CompanyTokenTransactionRetrieveResponse> {
48
+ return this._client.get(path`/company_token_transactions/${id}`, options);
49
+ }
50
+
51
+ /**
52
+ * Lists token transactions for a company
53
+ *
54
+ * Required permissions:
55
+ *
56
+ * - `company_token_transaction:read`
57
+ * - `member:basic:read`
58
+ * - `company:basic:read`
59
+ */
60
+ list(
61
+ query: CompanyTokenTransactionListParams,
62
+ options?: RequestOptions,
63
+ ): PagePromise<CompanyTokenTransactionListResponsesCursorPage, CompanyTokenTransactionListResponse> {
64
+ return this._client.getAPIList(
65
+ '/company_token_transactions',
66
+ CursorPage<CompanyTokenTransactionListResponse>,
67
+ { query, ...options },
68
+ );
69
+ }
70
+ }
71
+
72
+ export type CompanyTokenTransactionListResponsesCursorPage = CursorPage<CompanyTokenTransactionListResponse>;
73
+
74
+ /**
75
+ * A token transaction within a company
76
+ */
77
+ export interface CompanyTokenTransactionCreateResponse {
78
+ /**
79
+ * The ID of the transaction
80
+ */
81
+ id: string;
82
+
83
+ /**
84
+ * The transaction amount (always positive)
85
+ */
86
+ amount: number;
87
+
88
+ /**
89
+ * The company
90
+ */
91
+ company: CompanyTokenTransactionCreateResponse.Company;
92
+
93
+ /**
94
+ * When the transaction was created
95
+ */
96
+ created_at: string;
97
+
98
+ /**
99
+ * Optional description
100
+ */
101
+ description: string | null;
102
+
103
+ /**
104
+ * Optional idempotency key to prevent duplicate transactions
105
+ */
106
+ idempotency_key: string | null;
107
+
108
+ /**
109
+ * For transfers, the ID of the linked transaction
110
+ */
111
+ linked_transaction_id: string | null;
112
+
113
+ /**
114
+ * The member
115
+ */
116
+ member: CompanyTokenTransactionCreateResponse.Member;
117
+
118
+ /**
119
+ * The type of transaction
120
+ */
121
+ transaction_type: 'add' | 'subtract' | 'transfer';
122
+
123
+ /**
124
+ * The user whose balance changed
125
+ */
126
+ user: CompanyTokenTransactionCreateResponse.User;
127
+ }
128
+
129
+ export namespace CompanyTokenTransactionCreateResponse {
130
+ /**
131
+ * The company
132
+ */
133
+ export interface Company {
134
+ /**
135
+ * The ID of the company
136
+ */
137
+ id: string;
138
+
139
+ /**
140
+ * The slug/route of the company on the Whop site.
141
+ */
142
+ route: string;
143
+
144
+ /**
145
+ * The written name of the company.
146
+ */
147
+ title: string;
148
+ }
149
+
150
+ /**
151
+ * The member
152
+ */
153
+ export interface Member {
154
+ /**
155
+ * The ID of the member
156
+ */
157
+ id: string;
158
+ }
159
+
160
+ /**
161
+ * The user whose balance changed
162
+ */
163
+ export interface User {
164
+ /**
165
+ * The internal ID of the user.
166
+ */
167
+ id: string;
168
+
169
+ /**
170
+ * The name of the user from their Whop account.
171
+ */
172
+ name: string | null;
173
+
174
+ /**
175
+ * The username of the user from their Whop account.
176
+ */
177
+ username: string;
178
+ }
179
+ }
180
+
181
+ /**
182
+ * A token transaction within a company
183
+ */
184
+ export interface CompanyTokenTransactionRetrieveResponse {
185
+ /**
186
+ * The ID of the transaction
187
+ */
188
+ id: string;
189
+
190
+ /**
191
+ * The transaction amount (always positive)
192
+ */
193
+ amount: number;
194
+
195
+ /**
196
+ * The company
197
+ */
198
+ company: CompanyTokenTransactionRetrieveResponse.Company;
199
+
200
+ /**
201
+ * When the transaction was created
202
+ */
203
+ created_at: string;
204
+
205
+ /**
206
+ * Optional description
207
+ */
208
+ description: string | null;
209
+
210
+ /**
211
+ * Optional idempotency key to prevent duplicate transactions
212
+ */
213
+ idempotency_key: string | null;
214
+
215
+ /**
216
+ * For transfers, the ID of the linked transaction
217
+ */
218
+ linked_transaction_id: string | null;
219
+
220
+ /**
221
+ * The member
222
+ */
223
+ member: CompanyTokenTransactionRetrieveResponse.Member;
224
+
225
+ /**
226
+ * The type of transaction
227
+ */
228
+ transaction_type: 'add' | 'subtract' | 'transfer';
229
+
230
+ /**
231
+ * The user whose balance changed
232
+ */
233
+ user: CompanyTokenTransactionRetrieveResponse.User;
234
+ }
235
+
236
+ export namespace CompanyTokenTransactionRetrieveResponse {
237
+ /**
238
+ * The company
239
+ */
240
+ export interface Company {
241
+ /**
242
+ * The ID of the company
243
+ */
244
+ id: string;
245
+
246
+ /**
247
+ * The slug/route of the company on the Whop site.
248
+ */
249
+ route: string;
250
+
251
+ /**
252
+ * The written name of the company.
253
+ */
254
+ title: string;
255
+ }
256
+
257
+ /**
258
+ * The member
259
+ */
260
+ export interface Member {
261
+ /**
262
+ * The ID of the member
263
+ */
264
+ id: string;
265
+ }
266
+
267
+ /**
268
+ * The user whose balance changed
269
+ */
270
+ export interface User {
271
+ /**
272
+ * The internal ID of the user.
273
+ */
274
+ id: string;
275
+
276
+ /**
277
+ * The name of the user from their Whop account.
278
+ */
279
+ name: string | null;
280
+
281
+ /**
282
+ * The username of the user from their Whop account.
283
+ */
284
+ username: string;
285
+ }
286
+ }
287
+
288
+ /**
289
+ * A token transaction within a company
290
+ */
291
+ export interface CompanyTokenTransactionListResponse {
292
+ /**
293
+ * The ID of the transaction
294
+ */
295
+ id: string;
296
+
297
+ /**
298
+ * The transaction amount (always positive)
299
+ */
300
+ amount: number;
301
+
302
+ /**
303
+ * The company
304
+ */
305
+ company: CompanyTokenTransactionListResponse.Company;
306
+
307
+ /**
308
+ * When the transaction was created
309
+ */
310
+ created_at: string;
311
+
312
+ /**
313
+ * Optional description
314
+ */
315
+ description: string | null;
316
+
317
+ /**
318
+ * Optional idempotency key to prevent duplicate transactions
319
+ */
320
+ idempotency_key: string | null;
321
+
322
+ /**
323
+ * For transfers, the ID of the linked transaction
324
+ */
325
+ linked_transaction_id: string | null;
326
+
327
+ /**
328
+ * The member
329
+ */
330
+ member: CompanyTokenTransactionListResponse.Member;
331
+
332
+ /**
333
+ * The type of transaction
334
+ */
335
+ transaction_type: 'add' | 'subtract' | 'transfer';
336
+
337
+ /**
338
+ * The user whose balance changed
339
+ */
340
+ user: CompanyTokenTransactionListResponse.User;
341
+ }
342
+
343
+ export namespace CompanyTokenTransactionListResponse {
344
+ /**
345
+ * The company
346
+ */
347
+ export interface Company {
348
+ /**
349
+ * The ID of the company
350
+ */
351
+ id: string;
352
+
353
+ /**
354
+ * The slug/route of the company on the Whop site.
355
+ */
356
+ route: string;
357
+
358
+ /**
359
+ * The written name of the company.
360
+ */
361
+ title: string;
362
+ }
363
+
364
+ /**
365
+ * The member
366
+ */
367
+ export interface Member {
368
+ /**
369
+ * The ID of the member
370
+ */
371
+ id: string;
372
+ }
373
+
374
+ /**
375
+ * The user whose balance changed
376
+ */
377
+ export interface User {
378
+ /**
379
+ * The internal ID of the user.
380
+ */
381
+ id: string;
382
+
383
+ /**
384
+ * The name of the user from their Whop account.
385
+ */
386
+ name: string | null;
387
+
388
+ /**
389
+ * The username of the user from their Whop account.
390
+ */
391
+ username: string;
392
+ }
393
+ }
394
+
395
+ export type CompanyTokenTransactionCreateParams =
396
+ | CompanyTokenTransactionCreateParams.CreateCompanyTokenTransactionInputTransactionTypeTransfer
397
+ | CompanyTokenTransactionCreateParams.CreateCompanyTokenTransactionInputTransactionTypeAdd
398
+ | CompanyTokenTransactionCreateParams.CreateCompanyTokenTransactionInputTransactionTypeSubtract;
399
+
400
+ export declare namespace CompanyTokenTransactionCreateParams {
401
+ export interface CreateCompanyTokenTransactionInputTransactionTypeTransfer {
402
+ /**
403
+ * The positive amount of tokens
404
+ */
405
+ amount: number;
406
+
407
+ /**
408
+ * The company ID
409
+ */
410
+ company_id: string;
411
+
412
+ /**
413
+ * Required for transfers - the user to receive tokens
414
+ */
415
+ destination_user_id: string;
416
+
417
+ transaction_type: 'transfer';
418
+
419
+ /**
420
+ * The user ID whose balance will change
421
+ */
422
+ user_id: string;
423
+
424
+ /**
425
+ * Optional description for the transaction
426
+ */
427
+ description?: string | null;
428
+
429
+ /**
430
+ * Optional key to prevent duplicate transactions
431
+ */
432
+ idempotency_key?: string | null;
433
+ }
434
+
435
+ export interface CreateCompanyTokenTransactionInputTransactionTypeAdd {
436
+ /**
437
+ * The positive amount of tokens
438
+ */
439
+ amount: number;
440
+
441
+ /**
442
+ * The company ID
443
+ */
444
+ company_id: string;
445
+
446
+ transaction_type: 'add';
447
+
448
+ /**
449
+ * The user ID whose balance will change
450
+ */
451
+ user_id: string;
452
+
453
+ /**
454
+ * Optional description for the transaction
455
+ */
456
+ description?: string | null;
457
+
458
+ /**
459
+ * Optional key to prevent duplicate transactions
460
+ */
461
+ idempotency_key?: string | null;
462
+ }
463
+
464
+ export interface CreateCompanyTokenTransactionInputTransactionTypeSubtract {
465
+ /**
466
+ * The positive amount of tokens
467
+ */
468
+ amount: number;
469
+
470
+ /**
471
+ * The company ID
472
+ */
473
+ company_id: string;
474
+
475
+ transaction_type: 'subtract';
476
+
477
+ /**
478
+ * The user ID whose balance will change
479
+ */
480
+ user_id: string;
481
+
482
+ /**
483
+ * Optional description for the transaction
484
+ */
485
+ description?: string | null;
486
+
487
+ /**
488
+ * Optional key to prevent duplicate transactions
489
+ */
490
+ idempotency_key?: string | null;
491
+ }
492
+ }
493
+
494
+ export interface CompanyTokenTransactionListParams extends CursorPageParams {
495
+ /**
496
+ * The ID of the company
497
+ */
498
+ company_id: string;
499
+
500
+ /**
501
+ * Returns the elements in the list that come before the specified cursor.
502
+ */
503
+ before?: string | null;
504
+
505
+ /**
506
+ * Returns the first _n_ elements from the list.
507
+ */
508
+ first?: number | null;
509
+
510
+ /**
511
+ * Returns the last _n_ elements from the list.
512
+ */
513
+ last?: number | null;
514
+
515
+ /**
516
+ * The type of token transaction
517
+ */
518
+ transaction_type?: 'add' | 'subtract' | 'transfer' | null;
519
+
520
+ /**
521
+ * Filter by user ID
522
+ */
523
+ user_id?: string | null;
524
+ }
525
+
526
+ export declare namespace CompanyTokenTransactions {
527
+ export {
528
+ type CompanyTokenTransactionCreateResponse as CompanyTokenTransactionCreateResponse,
529
+ type CompanyTokenTransactionRetrieveResponse as CompanyTokenTransactionRetrieveResponse,
530
+ type CompanyTokenTransactionListResponse as CompanyTokenTransactionListResponse,
531
+ type CompanyTokenTransactionListResponsesCursorPage as CompanyTokenTransactionListResponsesCursorPage,
532
+ type CompanyTokenTransactionCreateParams as CompanyTokenTransactionCreateParams,
533
+ type CompanyTokenTransactionListParams as CompanyTokenTransactionListParams,
534
+ };
535
+ }