@whop/sdk 0.0.21 → 0.0.23

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 (103) hide show
  1. package/CHANGELOG.md +24 -0
  2. package/client.d.mts +16 -4
  3. package/client.d.mts.map +1 -1
  4. package/client.d.ts +16 -4
  5. package/client.d.ts.map +1 -1
  6. package/client.js +12 -0
  7. package/client.js.map +1 -1
  8. package/client.mjs +12 -0
  9. package/client.mjs.map +1 -1
  10. package/lib/upload-file.d.mts +39 -0
  11. package/lib/upload-file.d.mts.map +1 -0
  12. package/lib/upload-file.d.ts +39 -0
  13. package/lib/upload-file.d.ts.map +1 -0
  14. package/lib/upload-file.js +68 -0
  15. package/lib/upload-file.js.map +1 -0
  16. package/lib/upload-file.mjs +65 -0
  17. package/lib/upload-file.mjs.map +1 -0
  18. package/package.json +1 -1
  19. package/resources/files.d.mts +104 -0
  20. package/resources/files.d.mts.map +1 -0
  21. package/resources/files.d.ts +104 -0
  22. package/resources/files.d.ts.map +1 -0
  23. package/resources/files.js +35 -0
  24. package/resources/files.js.map +1 -0
  25. package/resources/files.mjs +31 -0
  26. package/resources/files.mjs.map +1 -0
  27. package/resources/index.d.mts +6 -2
  28. package/resources/index.d.mts.map +1 -1
  29. package/resources/index.d.ts +6 -2
  30. package/resources/index.d.ts.map +1 -1
  31. package/resources/index.js +9 -1
  32. package/resources/index.js.map +1 -1
  33. package/resources/index.mjs +4 -0
  34. package/resources/index.mjs.map +1 -1
  35. package/resources/leads.d.mts +489 -0
  36. package/resources/leads.d.mts.map +1 -0
  37. package/resources/leads.d.ts +489 -0
  38. package/resources/leads.d.ts.map +1 -0
  39. package/resources/leads.js +94 -0
  40. package/resources/leads.js.map +1 -0
  41. package/resources/leads.mjs +90 -0
  42. package/resources/leads.mjs.map +1 -0
  43. package/resources/ledger-accounts.d.mts +25 -0
  44. package/resources/ledger-accounts.d.mts.map +1 -1
  45. package/resources/ledger-accounts.d.ts +25 -0
  46. package/resources/ledger-accounts.d.ts.map +1 -1
  47. package/resources/payments.d.mts +1 -1
  48. package/resources/payments.d.mts.map +1 -1
  49. package/resources/payments.d.ts +1 -1
  50. package/resources/payments.d.ts.map +1 -1
  51. package/resources/payout-methods.d.mts +69 -1
  52. package/resources/payout-methods.d.mts.map +1 -1
  53. package/resources/payout-methods.d.ts +69 -1
  54. package/resources/payout-methods.d.ts.map +1 -1
  55. package/resources/payout-methods.js +11 -0
  56. package/resources/payout-methods.js.map +1 -1
  57. package/resources/payout-methods.mjs +11 -0
  58. package/resources/payout-methods.mjs.map +1 -1
  59. package/resources/plans.d.mts +8 -0
  60. package/resources/plans.d.mts.map +1 -1
  61. package/resources/plans.d.ts +8 -0
  62. package/resources/plans.d.ts.map +1 -1
  63. package/resources/topups.d.mts +79 -0
  64. package/resources/topups.d.mts.map +1 -0
  65. package/resources/topups.d.ts +79 -0
  66. package/resources/topups.d.ts.map +1 -0
  67. package/resources/topups.js +29 -0
  68. package/resources/topups.js.map +1 -0
  69. package/resources/topups.mjs +25 -0
  70. package/resources/topups.mjs.map +1 -0
  71. package/resources/verifications.d.mts +38 -0
  72. package/resources/verifications.d.mts.map +1 -0
  73. package/resources/verifications.d.ts +38 -0
  74. package/resources/verifications.d.ts.map +1 -0
  75. package/resources/verifications.js +20 -0
  76. package/resources/verifications.js.map +1 -0
  77. package/resources/verifications.mjs +16 -0
  78. package/resources/verifications.mjs.map +1 -0
  79. package/resources/webhooks.d.mts +431 -1
  80. package/resources/webhooks.d.mts.map +1 -1
  81. package/resources/webhooks.d.ts +431 -1
  82. package/resources/webhooks.d.ts.map +1 -1
  83. package/resources/webhooks.js +90 -0
  84. package/resources/webhooks.js.map +1 -1
  85. package/resources/webhooks.mjs +90 -0
  86. package/resources/webhooks.mjs.map +1 -1
  87. package/src/client.ts +72 -0
  88. package/src/lib/upload-file.ts +115 -0
  89. package/src/resources/files.ts +140 -0
  90. package/src/resources/index.ts +24 -0
  91. package/src/resources/leads.ts +583 -0
  92. package/src/resources/ledger-accounts.ts +63 -0
  93. package/src/resources/payments.ts +30 -30
  94. package/src/resources/payout-methods.ts +83 -0
  95. package/src/resources/plans.ts +10 -0
  96. package/src/resources/topups.ts +95 -0
  97. package/src/resources/verifications.ts +81 -0
  98. package/src/resources/webhooks.ts +793 -0
  99. package/src/version.ts +1 -1
  100. package/version.d.mts +1 -1
  101. package/version.d.ts +1 -1
  102. package/version.js +1 -1
  103. package/version.mjs +1 -1
@@ -0,0 +1,583 @@
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 Leads extends APIResource {
10
+ /**
11
+ * Creates a new lead
12
+ *
13
+ * Required permissions:
14
+ *
15
+ * - `lead:manage`
16
+ * - `member:email:read`
17
+ * - `access_pass:basic:read`
18
+ * - `member:basic:read`
19
+ *
20
+ * @example
21
+ * ```ts
22
+ * const lead = await client.leads.create({
23
+ * company_id: 'biz_xxxxxxxxxxxxxx',
24
+ * });
25
+ * ```
26
+ */
27
+ create(body: LeadCreateParams, options?: RequestOptions): APIPromise<LeadCreateResponse> {
28
+ return this._client.post('/leads', { body, ...options });
29
+ }
30
+
31
+ /**
32
+ * Retrieves a lead by ID
33
+ *
34
+ * Required permissions:
35
+ *
36
+ * - `lead:basic:read`
37
+ * - `member:email:read`
38
+ * - `access_pass:basic:read`
39
+ * - `member:basic:read`
40
+ *
41
+ * @example
42
+ * ```ts
43
+ * const lead = await client.leads.retrieve(
44
+ * 'lead_xxxxxxxxxxxxx',
45
+ * );
46
+ * ```
47
+ */
48
+ retrieve(id: string, options?: RequestOptions): APIPromise<LeadRetrieveResponse> {
49
+ return this._client.get(path`/leads/${id}`, options);
50
+ }
51
+
52
+ /**
53
+ * Updates a lead
54
+ *
55
+ * Required permissions:
56
+ *
57
+ * - `lead:manage`
58
+ * - `member:email:read`
59
+ * - `access_pass:basic:read`
60
+ * - `member:basic:read`
61
+ *
62
+ * @example
63
+ * ```ts
64
+ * const lead = await client.leads.update(
65
+ * 'lead_xxxxxxxxxxxxx',
66
+ * );
67
+ * ```
68
+ */
69
+ update(
70
+ id: string,
71
+ body: LeadUpdateParams | null | undefined = {},
72
+ options?: RequestOptions,
73
+ ): APIPromise<LeadUpdateResponse> {
74
+ return this._client.patch(path`/leads/${id}`, { body, ...options });
75
+ }
76
+
77
+ /**
78
+ * Lists leads for a company
79
+ *
80
+ * Required permissions:
81
+ *
82
+ * - `lead:basic:read`
83
+ * - `member:email:read`
84
+ * - `access_pass:basic:read`
85
+ * - `member:basic:read`
86
+ *
87
+ * @example
88
+ * ```ts
89
+ * // Automatically fetches more pages as needed.
90
+ * for await (const leadListResponse of client.leads.list({
91
+ * company_id: 'biz_xxxxxxxxxxxxxx',
92
+ * })) {
93
+ * // ...
94
+ * }
95
+ * ```
96
+ */
97
+ list(
98
+ query: LeadListParams,
99
+ options?: RequestOptions,
100
+ ): PagePromise<LeadListResponsesCursorPage, LeadListResponse> {
101
+ return this._client.getAPIList('/leads', CursorPage<LeadListResponse>, { query, ...options });
102
+ }
103
+ }
104
+
105
+ export type LeadListResponsesCursorPage = CursorPage<LeadListResponse>;
106
+
107
+ /**
108
+ * An object representing a lead (someone who is interested in a whop).
109
+ */
110
+ export interface LeadCreateResponse {
111
+ /**
112
+ * The ID of the lead.
113
+ */
114
+ id: string;
115
+
116
+ /**
117
+ * The timestamp of when the lead was created.
118
+ */
119
+ created_at: string;
120
+
121
+ /**
122
+ * The converted member, if any.
123
+ */
124
+ member: LeadCreateResponse.Member | null;
125
+
126
+ /**
127
+ * Custom metadata for the lead.
128
+ */
129
+ metadata: { [key: string]: unknown } | null;
130
+
131
+ /**
132
+ * The access pass the lead is interested in, if available.
133
+ */
134
+ product: LeadCreateResponse.Product | null;
135
+
136
+ /**
137
+ * The referrer URL that brought this lead.
138
+ */
139
+ referrer: string | null;
140
+
141
+ /**
142
+ * The timestamp of when the lead was last updated.
143
+ */
144
+ updated_at: string;
145
+
146
+ /**
147
+ * The user who is the lead.
148
+ */
149
+ user: LeadCreateResponse.User;
150
+ }
151
+
152
+ export namespace LeadCreateResponse {
153
+ /**
154
+ * The converted member, if any.
155
+ */
156
+ export interface Member {
157
+ /**
158
+ * The ID of the member
159
+ */
160
+ id: string;
161
+ }
162
+
163
+ /**
164
+ * The access pass the lead is interested in, if available.
165
+ */
166
+ export interface Product {
167
+ /**
168
+ * The internal ID of the public product.
169
+ */
170
+ id: string;
171
+
172
+ /**
173
+ * The title of the product. Use for Whop 4.0.
174
+ */
175
+ title: string;
176
+ }
177
+
178
+ /**
179
+ * The user who is the lead.
180
+ */
181
+ export interface User {
182
+ /**
183
+ * The internal ID of the user.
184
+ */
185
+ id: string;
186
+
187
+ /**
188
+ * The email of the user
189
+ */
190
+ email: string | null;
191
+
192
+ /**
193
+ * The name of the user from their Whop account.
194
+ */
195
+ name: string | null;
196
+
197
+ /**
198
+ * The username of the user from their Whop account.
199
+ */
200
+ username: string;
201
+ }
202
+ }
203
+
204
+ /**
205
+ * An object representing a lead (someone who is interested in a whop).
206
+ */
207
+ export interface LeadRetrieveResponse {
208
+ /**
209
+ * The ID of the lead.
210
+ */
211
+ id: string;
212
+
213
+ /**
214
+ * The timestamp of when the lead was created.
215
+ */
216
+ created_at: string;
217
+
218
+ /**
219
+ * The converted member, if any.
220
+ */
221
+ member: LeadRetrieveResponse.Member | null;
222
+
223
+ /**
224
+ * Custom metadata for the lead.
225
+ */
226
+ metadata: { [key: string]: unknown } | null;
227
+
228
+ /**
229
+ * The access pass the lead is interested in, if available.
230
+ */
231
+ product: LeadRetrieveResponse.Product | null;
232
+
233
+ /**
234
+ * The referrer URL that brought this lead.
235
+ */
236
+ referrer: string | null;
237
+
238
+ /**
239
+ * The timestamp of when the lead was last updated.
240
+ */
241
+ updated_at: string;
242
+
243
+ /**
244
+ * The user who is the lead.
245
+ */
246
+ user: LeadRetrieveResponse.User;
247
+ }
248
+
249
+ export namespace LeadRetrieveResponse {
250
+ /**
251
+ * The converted member, if any.
252
+ */
253
+ export interface Member {
254
+ /**
255
+ * The ID of the member
256
+ */
257
+ id: string;
258
+ }
259
+
260
+ /**
261
+ * The access pass the lead is interested in, if available.
262
+ */
263
+ export interface Product {
264
+ /**
265
+ * The internal ID of the public product.
266
+ */
267
+ id: string;
268
+
269
+ /**
270
+ * The title of the product. Use for Whop 4.0.
271
+ */
272
+ title: string;
273
+ }
274
+
275
+ /**
276
+ * The user who is the lead.
277
+ */
278
+ export interface User {
279
+ /**
280
+ * The internal ID of the user.
281
+ */
282
+ id: string;
283
+
284
+ /**
285
+ * The email of the user
286
+ */
287
+ email: string | null;
288
+
289
+ /**
290
+ * The name of the user from their Whop account.
291
+ */
292
+ name: string | null;
293
+
294
+ /**
295
+ * The username of the user from their Whop account.
296
+ */
297
+ username: string;
298
+ }
299
+ }
300
+
301
+ /**
302
+ * An object representing a lead (someone who is interested in a whop).
303
+ */
304
+ export interface LeadUpdateResponse {
305
+ /**
306
+ * The ID of the lead.
307
+ */
308
+ id: string;
309
+
310
+ /**
311
+ * The timestamp of when the lead was created.
312
+ */
313
+ created_at: string;
314
+
315
+ /**
316
+ * The converted member, if any.
317
+ */
318
+ member: LeadUpdateResponse.Member | null;
319
+
320
+ /**
321
+ * Custom metadata for the lead.
322
+ */
323
+ metadata: { [key: string]: unknown } | null;
324
+
325
+ /**
326
+ * The access pass the lead is interested in, if available.
327
+ */
328
+ product: LeadUpdateResponse.Product | null;
329
+
330
+ /**
331
+ * The referrer URL that brought this lead.
332
+ */
333
+ referrer: string | null;
334
+
335
+ /**
336
+ * The timestamp of when the lead was last updated.
337
+ */
338
+ updated_at: string;
339
+
340
+ /**
341
+ * The user who is the lead.
342
+ */
343
+ user: LeadUpdateResponse.User;
344
+ }
345
+
346
+ export namespace LeadUpdateResponse {
347
+ /**
348
+ * The converted member, if any.
349
+ */
350
+ export interface Member {
351
+ /**
352
+ * The ID of the member
353
+ */
354
+ id: string;
355
+ }
356
+
357
+ /**
358
+ * The access pass the lead is interested in, if available.
359
+ */
360
+ export interface Product {
361
+ /**
362
+ * The internal ID of the public product.
363
+ */
364
+ id: string;
365
+
366
+ /**
367
+ * The title of the product. Use for Whop 4.0.
368
+ */
369
+ title: string;
370
+ }
371
+
372
+ /**
373
+ * The user who is the lead.
374
+ */
375
+ export interface User {
376
+ /**
377
+ * The internal ID of the user.
378
+ */
379
+ id: string;
380
+
381
+ /**
382
+ * The email of the user
383
+ */
384
+ email: string | null;
385
+
386
+ /**
387
+ * The name of the user from their Whop account.
388
+ */
389
+ name: string | null;
390
+
391
+ /**
392
+ * The username of the user from their Whop account.
393
+ */
394
+ username: string;
395
+ }
396
+ }
397
+
398
+ /**
399
+ * An object representing a lead (someone who is interested in a whop).
400
+ */
401
+ export interface LeadListResponse {
402
+ /**
403
+ * The ID of the lead.
404
+ */
405
+ id: string;
406
+
407
+ /**
408
+ * The timestamp of when the lead was created.
409
+ */
410
+ created_at: string;
411
+
412
+ /**
413
+ * The converted member, if any.
414
+ */
415
+ member: LeadListResponse.Member | null;
416
+
417
+ /**
418
+ * Custom metadata for the lead.
419
+ */
420
+ metadata: { [key: string]: unknown } | null;
421
+
422
+ /**
423
+ * The access pass the lead is interested in, if available.
424
+ */
425
+ product: LeadListResponse.Product | null;
426
+
427
+ /**
428
+ * The referrer URL that brought this lead.
429
+ */
430
+ referrer: string | null;
431
+
432
+ /**
433
+ * The timestamp of when the lead was last updated.
434
+ */
435
+ updated_at: string;
436
+
437
+ /**
438
+ * The user who is the lead.
439
+ */
440
+ user: LeadListResponse.User;
441
+ }
442
+
443
+ export namespace LeadListResponse {
444
+ /**
445
+ * The converted member, if any.
446
+ */
447
+ export interface Member {
448
+ /**
449
+ * The ID of the member
450
+ */
451
+ id: string;
452
+ }
453
+
454
+ /**
455
+ * The access pass the lead is interested in, if available.
456
+ */
457
+ export interface Product {
458
+ /**
459
+ * The internal ID of the public product.
460
+ */
461
+ id: string;
462
+
463
+ /**
464
+ * The title of the product. Use for Whop 4.0.
465
+ */
466
+ title: string;
467
+ }
468
+
469
+ /**
470
+ * The user who is the lead.
471
+ */
472
+ export interface User {
473
+ /**
474
+ * The internal ID of the user.
475
+ */
476
+ id: string;
477
+
478
+ /**
479
+ * The email of the user
480
+ */
481
+ email: string | null;
482
+
483
+ /**
484
+ * The name of the user from their Whop account.
485
+ */
486
+ name: string | null;
487
+
488
+ /**
489
+ * The username of the user from their Whop account.
490
+ */
491
+ username: string;
492
+ }
493
+ }
494
+
495
+ export interface LeadCreateParams {
496
+ /**
497
+ * The ID of the company to create a lead for.
498
+ */
499
+ company_id: string;
500
+
501
+ /**
502
+ * Custom metadata for the lead.
503
+ */
504
+ metadata?: { [key: string]: unknown } | null;
505
+
506
+ /**
507
+ * The ID of the product the lead is interested in.
508
+ */
509
+ product_id?: string | null;
510
+
511
+ /**
512
+ * The url referrer of the lead, if any.
513
+ */
514
+ referrer?: string | null;
515
+
516
+ /**
517
+ * The ID of the user to create a lead for. If the request is made by a user, that
518
+ * user will be used.
519
+ */
520
+ user_id?: string | null;
521
+ }
522
+
523
+ export interface LeadUpdateParams {
524
+ /**
525
+ * Custom metadata for the lead.
526
+ */
527
+ metadata?: { [key: string]: unknown } | null;
528
+
529
+ /**
530
+ * The url referrer of the lead.
531
+ */
532
+ referrer?: string | null;
533
+ }
534
+
535
+ export interface LeadListParams extends CursorPageParams {
536
+ /**
537
+ * The ID of the company to list leads for
538
+ */
539
+ company_id: string;
540
+
541
+ /**
542
+ * Returns the elements in the list that come before the specified cursor.
543
+ */
544
+ before?: string | null;
545
+
546
+ /**
547
+ * The minimum creation date to filter by
548
+ */
549
+ created_after?: string | null;
550
+
551
+ /**
552
+ * The maximum creation date to filter by
553
+ */
554
+ created_before?: string | null;
555
+
556
+ /**
557
+ * Returns the first _n_ elements from the list.
558
+ */
559
+ first?: number | null;
560
+
561
+ /**
562
+ * Returns the last _n_ elements from the list.
563
+ */
564
+ last?: number | null;
565
+
566
+ /**
567
+ * The product IDs to filter the leads by
568
+ */
569
+ product_ids?: Array<string> | null;
570
+ }
571
+
572
+ export declare namespace Leads {
573
+ export {
574
+ type LeadCreateResponse as LeadCreateResponse,
575
+ type LeadRetrieveResponse as LeadRetrieveResponse,
576
+ type LeadUpdateResponse as LeadUpdateResponse,
577
+ type LeadListResponse as LeadListResponse,
578
+ type LeadListResponsesCursorPage as LeadListResponsesCursorPage,
579
+ type LeadCreateParams as LeadCreateParams,
580
+ type LeadUpdateParams as LeadUpdateParams,
581
+ type LeadListParams as LeadListParams,
582
+ };
583
+ }
@@ -183,6 +183,11 @@ export namespace LedgerAccountRetrieveResponse {
183
183
  */
184
184
  email: string | null;
185
185
 
186
+ /**
187
+ * The latest verification for the connected account.
188
+ */
189
+ latest_verification: PayoutAccountDetails.LatestVerification | null;
190
+
186
191
  /**
187
192
  * The business representative's phone
188
193
  */
@@ -250,6 +255,64 @@ export namespace LedgerAccountRetrieveResponse {
250
255
  */
251
256
  middle_name: string | null;
252
257
  }
258
+
259
+ /**
260
+ * The latest verification for the connected account.
261
+ */
262
+ export interface LatestVerification {
263
+ /**
264
+ * A unique identifier for the verification.
265
+ */
266
+ id: string;
267
+
268
+ /**
269
+ * An error code for a verification attempt.
270
+ */
271
+ last_error_code:
272
+ | 'abandoned'
273
+ | 'consent_declined'
274
+ | 'country_not_supported'
275
+ | 'device_not_supported'
276
+ | 'document_expired'
277
+ | 'document_type_not_supported'
278
+ | 'document_unverified_other'
279
+ | 'email_unverified_other'
280
+ | 'email_verification_declined'
281
+ | 'id_number_insufficient_document_data'
282
+ | 'id_number_mismatch'
283
+ | 'id_number_unverified_other'
284
+ | 'phone_unverified_other'
285
+ | 'phone_verification_declined'
286
+ | 'selfie_document_missing_photo'
287
+ | 'selfie_face_mismatch'
288
+ | 'selfie_manipulated'
289
+ | 'selfie_unverified_other'
290
+ | 'under_supported_age'
291
+ | null;
292
+
293
+ /**
294
+ * The last error reason that occurred during the verification.
295
+ */
296
+ last_error_reason: string | null;
297
+
298
+ /**
299
+ * The status of the verification.
300
+ */
301
+ status:
302
+ | 'requires_input'
303
+ | 'processing'
304
+ | 'verified'
305
+ | 'canceled'
306
+ | 'created'
307
+ | 'started'
308
+ | 'submitted'
309
+ | 'approved'
310
+ | 'declined'
311
+ | 'resubmission_requested'
312
+ | 'expired'
313
+ | 'abandoned'
314
+ | 'review';
315
+ }
253
316
  }
254
317
  }
255
318