@whop/sdk 0.0.2 → 0.0.3
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.
- package/CHANGELOG.md +23 -0
- package/client.d.mts +23 -8
- package/client.d.mts.map +1 -1
- package/client.d.ts +23 -8
- package/client.d.ts.map +1 -1
- package/client.js +16 -1
- package/client.js.map +1 -1
- package/client.mjs +16 -1
- package/client.mjs.map +1 -1
- package/package.json +1 -1
- package/resources/checkout-configurations.d.mts +76 -2
- package/resources/checkout-configurations.d.mts.map +1 -1
- package/resources/checkout-configurations.d.ts +76 -2
- package/resources/checkout-configurations.d.ts.map +1 -1
- package/resources/checkout-configurations.js +2 -0
- package/resources/checkout-configurations.js.map +1 -1
- package/resources/checkout-configurations.mjs +2 -0
- package/resources/checkout-configurations.mjs.map +1 -1
- package/resources/course-chapters.d.mts +185 -0
- package/resources/course-chapters.d.mts.map +1 -0
- package/resources/course-chapters.d.ts +185 -0
- package/resources/course-chapters.d.ts.map +1 -0
- package/resources/course-chapters.js +103 -0
- package/resources/course-chapters.js.map +1 -0
- package/resources/course-chapters.mjs +99 -0
- package/resources/course-chapters.mjs.map +1 -0
- package/resources/course-lessons.d.mts +523 -0
- package/resources/course-lessons.d.mts.map +1 -0
- package/resources/course-lessons.d.ts +523 -0
- package/resources/course-lessons.d.ts.map +1 -0
- package/resources/course-lessons.js +101 -0
- package/resources/course-lessons.js.map +1 -0
- package/resources/course-lessons.mjs +97 -0
- package/resources/course-lessons.mjs.map +1 -0
- package/resources/courses.d.mts +465 -0
- package/resources/courses.d.mts.map +1 -0
- package/resources/courses.d.ts +465 -0
- package/resources/courses.d.ts.map +1 -0
- package/resources/courses.js +98 -0
- package/resources/courses.js.map +1 -0
- package/resources/courses.mjs +94 -0
- package/resources/courses.mjs.map +1 -0
- package/resources/experiences.d.mts +27 -1
- package/resources/experiences.d.mts.map +1 -1
- package/resources/experiences.d.ts +27 -1
- package/resources/experiences.d.ts.map +1 -1
- package/resources/experiences.js +22 -0
- package/resources/experiences.js.map +1 -1
- package/resources/experiences.mjs +22 -0
- package/resources/experiences.mjs.map +1 -1
- package/resources/forum-posts.d.mts +56 -1
- package/resources/forum-posts.d.mts.map +1 -1
- package/resources/forum-posts.d.ts +56 -1
- package/resources/forum-posts.d.ts.map +1 -1
- package/resources/forum-posts.js +11 -0
- package/resources/forum-posts.js.map +1 -1
- package/resources/forum-posts.mjs +11 -0
- package/resources/forum-posts.mjs.map +1 -1
- package/resources/index.d.mts +9 -4
- package/resources/index.d.mts.map +1 -1
- package/resources/index.d.ts +9 -4
- package/resources/index.d.ts.map +1 -1
- package/resources/index.js +11 -1
- package/resources/index.js.map +1 -1
- package/resources/index.mjs +5 -0
- package/resources/index.mjs.map +1 -1
- package/resources/ledger-accounts.d.mts +1 -1
- package/resources/ledger-accounts.d.mts.map +1 -1
- package/resources/ledger-accounts.d.ts +1 -1
- package/resources/ledger-accounts.d.ts.map +1 -1
- package/resources/members.d.mts +4 -0
- package/resources/members.d.mts.map +1 -1
- package/resources/members.d.ts +4 -0
- package/resources/members.d.ts.map +1 -1
- package/resources/memberships.d.mts +26 -5
- package/resources/memberships.d.mts.map +1 -1
- package/resources/memberships.d.ts +26 -5
- package/resources/memberships.d.ts.map +1 -1
- package/resources/memberships.js +1 -1
- package/resources/memberships.js.map +1 -1
- package/resources/memberships.mjs +1 -1
- package/resources/memberships.mjs.map +1 -1
- package/resources/messages.d.mts +38 -1
- package/resources/messages.d.mts.map +1 -1
- package/resources/messages.d.ts +38 -1
- package/resources/messages.d.ts.map +1 -1
- package/resources/messages.js +6 -0
- package/resources/messages.js.map +1 -1
- package/resources/messages.mjs +6 -0
- package/resources/messages.mjs.map +1 -1
- package/resources/payments.d.mts +28 -13
- package/resources/payments.d.mts.map +1 -1
- package/resources/payments.d.ts +28 -13
- package/resources/payments.d.ts.map +1 -1
- package/resources/plans.d.mts +49 -1
- package/resources/plans.d.mts.map +1 -1
- package/resources/plans.d.ts +49 -1
- package/resources/plans.d.ts.map +1 -1
- package/resources/products.d.mts +17 -25
- package/resources/products.d.mts.map +1 -1
- package/resources/products.d.ts +17 -25
- package/resources/products.d.ts.map +1 -1
- package/resources/promo-codes.d.mts +394 -0
- package/resources/promo-codes.d.mts.map +1 -0
- package/resources/promo-codes.d.ts +394 -0
- package/resources/promo-codes.d.ts.map +1 -0
- package/resources/promo-codes.js +91 -0
- package/resources/promo-codes.js.map +1 -0
- package/resources/promo-codes.mjs +87 -0
- package/resources/promo-codes.mjs.map +1 -0
- package/resources/reviews.d.mts +277 -0
- package/resources/reviews.d.mts.map +1 -0
- package/resources/reviews.d.ts +277 -0
- package/resources/reviews.d.ts.map +1 -0
- package/resources/reviews.js +23 -0
- package/resources/reviews.js.map +1 -0
- package/resources/reviews.mjs +19 -0
- package/resources/reviews.mjs.map +1 -0
- package/resources/shared.d.mts +70 -14
- package/resources/shared.d.mts.map +1 -1
- package/resources/shared.d.ts +70 -14
- package/resources/shared.d.ts.map +1 -1
- package/src/client.ts +134 -1
- package/src/resources/checkout-configurations.ts +91 -2
- package/src/resources/course-chapters.ts +236 -0
- package/src/resources/course-lessons.ts +646 -0
- package/src/resources/courses.ts +594 -0
- package/src/resources/experiences.ts +35 -0
- package/src/resources/forum-posts.ts +71 -0
- package/src/resources/index.ts +59 -0
- package/src/resources/ledger-accounts.ts +13 -1
- package/src/resources/members.ts +5 -0
- package/src/resources/memberships.ts +31 -6
- package/src/resources/messages.ts +50 -0
- package/src/resources/payments.ts +139 -19
- package/src/resources/plans.ts +60 -1
- package/src/resources/products.ts +20 -29
- package/src/resources/promo-codes.ts +490 -0
- package/src/resources/reviews.ts +348 -0
- package/src/resources/shared.ts +80 -14
- package/src/version.ts +1 -1
- package/version.d.mts +1 -1
- package/version.d.ts +1 -1
- package/version.js +1 -1
- package/version.mjs +1 -1
package/src/resources/plans.ts
CHANGED
|
@@ -200,11 +200,26 @@ export interface PlanListResponse {
|
|
|
200
200
|
*/
|
|
201
201
|
renewal_price: number;
|
|
202
202
|
|
|
203
|
+
/**
|
|
204
|
+
* The number of units available for purchase. Only displayed to authorized actors
|
|
205
|
+
*/
|
|
206
|
+
stock: number | null;
|
|
207
|
+
|
|
208
|
+
/**
|
|
209
|
+
* The title of the plan. This will be visible on the product page to customers.
|
|
210
|
+
*/
|
|
211
|
+
title: string | null;
|
|
212
|
+
|
|
203
213
|
/**
|
|
204
214
|
* The number of free trial days added before a renewal plan.
|
|
205
215
|
*/
|
|
206
216
|
trial_period_days: number | null;
|
|
207
217
|
|
|
218
|
+
/**
|
|
219
|
+
* Limits/doesn't limit the number of units available for purchase.
|
|
220
|
+
*/
|
|
221
|
+
unlimited_stock: boolean;
|
|
222
|
+
|
|
208
223
|
/**
|
|
209
224
|
* When the plan was last updated.
|
|
210
225
|
*/
|
|
@@ -275,7 +290,7 @@ export interface PlanCreateParams {
|
|
|
275
290
|
product_id: string;
|
|
276
291
|
|
|
277
292
|
/**
|
|
278
|
-
* The interval at which the plan charges (renewal plans).
|
|
293
|
+
* The interval in days at which the plan charges (renewal plans).
|
|
279
294
|
*/
|
|
280
295
|
billing_period?: number | null;
|
|
281
296
|
|
|
@@ -338,6 +353,23 @@ export interface PlanCreateParams {
|
|
|
338
353
|
*/
|
|
339
354
|
renewal_price?: number | null;
|
|
340
355
|
|
|
356
|
+
/**
|
|
357
|
+
* The number of units available for purchase.
|
|
358
|
+
*/
|
|
359
|
+
stock?: number | null;
|
|
360
|
+
|
|
361
|
+
/**
|
|
362
|
+
* The price to display with a strikethrough for the initial price. Provided as a
|
|
363
|
+
* number in dollars. Eg: 19.99 for $19.99
|
|
364
|
+
*/
|
|
365
|
+
strike_through_initial_price?: number | null;
|
|
366
|
+
|
|
367
|
+
/**
|
|
368
|
+
* The price to display with a strikethrough for the renewal price. Provided as a
|
|
369
|
+
* number in dollars. Eg: 19.99 for $19.99
|
|
370
|
+
*/
|
|
371
|
+
strike_through_renewal_price?: number | null;
|
|
372
|
+
|
|
341
373
|
/**
|
|
342
374
|
* The title of the plan. This will be visible on the product page to customers.
|
|
343
375
|
*/
|
|
@@ -348,6 +380,11 @@ export interface PlanCreateParams {
|
|
|
348
380
|
*/
|
|
349
381
|
trial_period_days?: number | null;
|
|
350
382
|
|
|
383
|
+
/**
|
|
384
|
+
* Limits/doesn't limit the number of units available for purchase.
|
|
385
|
+
*/
|
|
386
|
+
unlimited_stock?: boolean | null;
|
|
387
|
+
|
|
351
388
|
/**
|
|
352
389
|
* Visibility of a resource
|
|
353
390
|
*/
|
|
@@ -464,6 +501,23 @@ export interface PlanUpdateParams {
|
|
|
464
501
|
*/
|
|
465
502
|
renewal_price?: number | null;
|
|
466
503
|
|
|
504
|
+
/**
|
|
505
|
+
* The number of units available for purchase.
|
|
506
|
+
*/
|
|
507
|
+
stock?: number | null;
|
|
508
|
+
|
|
509
|
+
/**
|
|
510
|
+
* The price to display with a strikethrough for the initial price. Provided as a
|
|
511
|
+
* number in dollars. Eg: 19.99 for $19.99
|
|
512
|
+
*/
|
|
513
|
+
strike_through_initial_price?: number | null;
|
|
514
|
+
|
|
515
|
+
/**
|
|
516
|
+
* The price to display with a strikethrough for the renewal price. Provided as a
|
|
517
|
+
* number in dollars. Eg: 19.99 for $19.99
|
|
518
|
+
*/
|
|
519
|
+
strike_through_renewal_price?: number | null;
|
|
520
|
+
|
|
467
521
|
/**
|
|
468
522
|
* The title of the plan. This will be visible on the product page to customers.
|
|
469
523
|
*/
|
|
@@ -474,6 +528,11 @@ export interface PlanUpdateParams {
|
|
|
474
528
|
*/
|
|
475
529
|
trial_period_days?: number | null;
|
|
476
530
|
|
|
531
|
+
/**
|
|
532
|
+
* Limits/doesn't limit the number of units available for purchase.
|
|
533
|
+
*/
|
|
534
|
+
unlimited_stock?: boolean | null;
|
|
535
|
+
|
|
477
536
|
/**
|
|
478
537
|
* Visibility of a resource
|
|
479
538
|
*/
|
|
@@ -129,16 +129,6 @@ export interface ProductCreateParams {
|
|
|
129
129
|
*/
|
|
130
130
|
title: string;
|
|
131
131
|
|
|
132
|
-
/**
|
|
133
|
-
* The different types an access pass can be.
|
|
134
|
-
*/
|
|
135
|
-
access_pass_type?: Shared.AccessPassType | null;
|
|
136
|
-
|
|
137
|
-
/**
|
|
138
|
-
* A banner image for the product in png, jpeg format
|
|
139
|
-
*/
|
|
140
|
-
banner_image?: ProductCreateParams.BannerImage | null;
|
|
141
|
-
|
|
142
132
|
/**
|
|
143
133
|
* The different business types a company can be.
|
|
144
134
|
*/
|
|
@@ -238,25 +228,6 @@ export interface ProductCreateParams {
|
|
|
238
228
|
}
|
|
239
229
|
|
|
240
230
|
export namespace ProductCreateParams {
|
|
241
|
-
/**
|
|
242
|
-
* A banner image for the product in png, jpeg format
|
|
243
|
-
*/
|
|
244
|
-
export interface BannerImage {
|
|
245
|
-
/**
|
|
246
|
-
* The ID of an existing attachment object. Use this when updating a resource and
|
|
247
|
-
* keeping a subset of the attachments. Don't use this unless you know what you're
|
|
248
|
-
* doing.
|
|
249
|
-
*/
|
|
250
|
-
id?: string | null;
|
|
251
|
-
|
|
252
|
-
/**
|
|
253
|
-
* This ID should be used the first time you upload an attachment. It is the ID of
|
|
254
|
-
* the direct upload that was created when uploading the file to S3 via the
|
|
255
|
-
* mediaDirectUpload mutation.
|
|
256
|
-
*/
|
|
257
|
-
direct_upload_id?: string | null;
|
|
258
|
-
}
|
|
259
|
-
|
|
260
231
|
/**
|
|
261
232
|
* The details to assign an autogenerated plan.
|
|
262
233
|
*/
|
|
@@ -441,6 +412,11 @@ export interface ProductUpdateParams {
|
|
|
441
412
|
*/
|
|
442
413
|
route?: string | null;
|
|
443
414
|
|
|
415
|
+
/**
|
|
416
|
+
* Configuration for a product on the company's store page.
|
|
417
|
+
*/
|
|
418
|
+
store_page_config?: ProductUpdateParams.StorePageConfig | null;
|
|
419
|
+
|
|
444
420
|
/**
|
|
445
421
|
* The title of the product.
|
|
446
422
|
*/
|
|
@@ -471,6 +447,21 @@ export namespace ProductUpdateParams {
|
|
|
471
447
|
*/
|
|
472
448
|
direct_upload_id?: string | null;
|
|
473
449
|
}
|
|
450
|
+
|
|
451
|
+
/**
|
|
452
|
+
* Configuration for a product on the company's store page.
|
|
453
|
+
*/
|
|
454
|
+
export interface StorePageConfig {
|
|
455
|
+
/**
|
|
456
|
+
* Custom call-to-action text for the product's store page.
|
|
457
|
+
*/
|
|
458
|
+
custom_cta?: string | null;
|
|
459
|
+
|
|
460
|
+
/**
|
|
461
|
+
* Whether or not to show the price on the product's store page.
|
|
462
|
+
*/
|
|
463
|
+
show_price?: boolean | null;
|
|
464
|
+
}
|
|
474
465
|
}
|
|
475
466
|
|
|
476
467
|
export interface ProductListParams extends CursorPageParams {
|
|
@@ -0,0 +1,490 @@
|
|
|
1
|
+
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
2
|
+
|
|
3
|
+
import { APIResource } from '../core/resource';
|
|
4
|
+
import * as Shared from './shared';
|
|
5
|
+
import { APIPromise } from '../core/api-promise';
|
|
6
|
+
import { CursorPage, type CursorPageParams, PagePromise } from '../core/pagination';
|
|
7
|
+
import { RequestOptions } from '../internal/request-options';
|
|
8
|
+
import { path } from '../internal/utils/path';
|
|
9
|
+
|
|
10
|
+
export class PromoCodes extends APIResource {
|
|
11
|
+
/**
|
|
12
|
+
* Create a new promo code for a product or plan
|
|
13
|
+
*
|
|
14
|
+
* Required permissions:
|
|
15
|
+
*
|
|
16
|
+
* - `promo_code:create`
|
|
17
|
+
* - `access_pass:basic:read`
|
|
18
|
+
*
|
|
19
|
+
* @example
|
|
20
|
+
* ```ts
|
|
21
|
+
* const promoCode = await client.promoCodes.create({
|
|
22
|
+
* amount_off: 6.9,
|
|
23
|
+
* base_currency: 'usd',
|
|
24
|
+
* code: 'code',
|
|
25
|
+
* company_id: 'biz_xxxxxxxxxxxxxx',
|
|
26
|
+
* new_users_only: true,
|
|
27
|
+
* promo_duration_months: 42,
|
|
28
|
+
* promo_type: 'percentage',
|
|
29
|
+
* });
|
|
30
|
+
* ```
|
|
31
|
+
*/
|
|
32
|
+
create(body: PromoCodeCreateParams, options?: RequestOptions): APIPromise<PromoCode> {
|
|
33
|
+
return this._client.post('/promo_codes', { body, ...options });
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
/**
|
|
37
|
+
* Retrieves a promo code by ID
|
|
38
|
+
*
|
|
39
|
+
* Required permissions:
|
|
40
|
+
*
|
|
41
|
+
* - `promo_code:basic:read`
|
|
42
|
+
* - `access_pass:basic:read`
|
|
43
|
+
*
|
|
44
|
+
* @example
|
|
45
|
+
* ```ts
|
|
46
|
+
* const promoCode = await client.promoCodes.retrieve(
|
|
47
|
+
* 'promo_xxxxxxxxxxxx',
|
|
48
|
+
* );
|
|
49
|
+
* ```
|
|
50
|
+
*/
|
|
51
|
+
retrieve(id: string, options?: RequestOptions): APIPromise<PromoCode> {
|
|
52
|
+
return this._client.get(path`/promo_codes/${id}`, options);
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
/**
|
|
56
|
+
* Lists promo codes for a company
|
|
57
|
+
*
|
|
58
|
+
* Required permissions:
|
|
59
|
+
*
|
|
60
|
+
* - `promo_code:basic:read`
|
|
61
|
+
* - `access_pass:basic:read`
|
|
62
|
+
*
|
|
63
|
+
* @example
|
|
64
|
+
* ```ts
|
|
65
|
+
* // Automatically fetches more pages as needed.
|
|
66
|
+
* for await (const promoCodeListResponse of client.promoCodes.list(
|
|
67
|
+
* { company_id: 'biz_xxxxxxxxxxxxxx' },
|
|
68
|
+
* )) {
|
|
69
|
+
* // ...
|
|
70
|
+
* }
|
|
71
|
+
* ```
|
|
72
|
+
*/
|
|
73
|
+
list(
|
|
74
|
+
query: PromoCodeListParams,
|
|
75
|
+
options?: RequestOptions,
|
|
76
|
+
): PagePromise<PromoCodeListResponsesCursorPage, PromoCodeListResponse> {
|
|
77
|
+
return this._client.getAPIList('/promo_codes', CursorPage<PromoCodeListResponse>, { query, ...options });
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
/**
|
|
81
|
+
* Archive a promo code, preventing further use
|
|
82
|
+
*
|
|
83
|
+
* Required permissions:
|
|
84
|
+
*
|
|
85
|
+
* - `promo_code:delete`
|
|
86
|
+
*
|
|
87
|
+
* @example
|
|
88
|
+
* ```ts
|
|
89
|
+
* const promoCode = await client.promoCodes.delete(
|
|
90
|
+
* 'promo_xxxxxxxxxxxx',
|
|
91
|
+
* );
|
|
92
|
+
* ```
|
|
93
|
+
*/
|
|
94
|
+
delete(id: string, options?: RequestOptions): APIPromise<PromoCodeDeleteResponse> {
|
|
95
|
+
return this._client.delete(path`/promo_codes/${id}`, options);
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
export type PromoCodeListResponsesCursorPage = CursorPage<PromoCodeListResponse>;
|
|
100
|
+
|
|
101
|
+
/**
|
|
102
|
+
* An object representing a promo code for a plan.
|
|
103
|
+
*/
|
|
104
|
+
export interface PromoCode {
|
|
105
|
+
/**
|
|
106
|
+
* The ID of the promo.
|
|
107
|
+
*/
|
|
108
|
+
id: string;
|
|
109
|
+
|
|
110
|
+
/**
|
|
111
|
+
* The amount off (% or flat amount) for the promo.
|
|
112
|
+
*/
|
|
113
|
+
amount_off: number;
|
|
114
|
+
|
|
115
|
+
/**
|
|
116
|
+
* Restricts promo use to only users who have churned from the company before.
|
|
117
|
+
*/
|
|
118
|
+
churned_users_only: boolean;
|
|
119
|
+
|
|
120
|
+
/**
|
|
121
|
+
* The specific code used to apply the promo at checkout.
|
|
122
|
+
*/
|
|
123
|
+
code: string | null;
|
|
124
|
+
|
|
125
|
+
/**
|
|
126
|
+
* The company for the promo code.
|
|
127
|
+
*/
|
|
128
|
+
company: PromoCode.Company;
|
|
129
|
+
|
|
130
|
+
/**
|
|
131
|
+
* The timestamp of when the promo was created.
|
|
132
|
+
*/
|
|
133
|
+
created_at: string;
|
|
134
|
+
|
|
135
|
+
/**
|
|
136
|
+
* The monetary currency of the promo code.
|
|
137
|
+
*/
|
|
138
|
+
currency: Shared.Currency;
|
|
139
|
+
|
|
140
|
+
/**
|
|
141
|
+
* The duration setting for the promo code
|
|
142
|
+
*/
|
|
143
|
+
duration: PromoDuration | null;
|
|
144
|
+
|
|
145
|
+
/**
|
|
146
|
+
* Restricts promo use to only be applied to already purchased memberships.
|
|
147
|
+
*/
|
|
148
|
+
existing_memberships_only: boolean;
|
|
149
|
+
|
|
150
|
+
/**
|
|
151
|
+
* The date/time of when the promo expires.
|
|
152
|
+
*/
|
|
153
|
+
expires_at: string | null;
|
|
154
|
+
|
|
155
|
+
/**
|
|
156
|
+
* Restricts promo use to only users who have never purchased from the company
|
|
157
|
+
* before.
|
|
158
|
+
*/
|
|
159
|
+
new_users_only: boolean;
|
|
160
|
+
|
|
161
|
+
/**
|
|
162
|
+
* Restricts promo use to only be applied once per customer.
|
|
163
|
+
*/
|
|
164
|
+
one_per_customer: boolean;
|
|
165
|
+
|
|
166
|
+
/**
|
|
167
|
+
* The access pass associated with the promo code.
|
|
168
|
+
*/
|
|
169
|
+
product: PromoCode.Product | null;
|
|
170
|
+
|
|
171
|
+
/**
|
|
172
|
+
* The number of months the promo is applied for.
|
|
173
|
+
*/
|
|
174
|
+
promo_duration_months: number | null;
|
|
175
|
+
|
|
176
|
+
/**
|
|
177
|
+
* The type (% or flat amount) of the promo.
|
|
178
|
+
*/
|
|
179
|
+
promo_type: Shared.PromoType;
|
|
180
|
+
|
|
181
|
+
/**
|
|
182
|
+
* Indicates if the promo code is live or disabled.
|
|
183
|
+
*/
|
|
184
|
+
status: PromoCodeStatus;
|
|
185
|
+
|
|
186
|
+
/**
|
|
187
|
+
* The quantity limit on the number of uses.
|
|
188
|
+
*/
|
|
189
|
+
stock: number;
|
|
190
|
+
|
|
191
|
+
/**
|
|
192
|
+
* Whether or not the promo code has unlimited stock.
|
|
193
|
+
*/
|
|
194
|
+
unlimited_stock: boolean;
|
|
195
|
+
|
|
196
|
+
/**
|
|
197
|
+
* The amount of times the promo codes has been used.
|
|
198
|
+
*/
|
|
199
|
+
uses: number;
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
export namespace PromoCode {
|
|
203
|
+
/**
|
|
204
|
+
* The company for the promo code.
|
|
205
|
+
*/
|
|
206
|
+
export interface Company {
|
|
207
|
+
/**
|
|
208
|
+
* The ID of the company
|
|
209
|
+
*/
|
|
210
|
+
id: string;
|
|
211
|
+
|
|
212
|
+
/**
|
|
213
|
+
* The written name of the company.
|
|
214
|
+
*/
|
|
215
|
+
title: string;
|
|
216
|
+
}
|
|
217
|
+
|
|
218
|
+
/**
|
|
219
|
+
* The access pass associated with the promo code.
|
|
220
|
+
*/
|
|
221
|
+
export interface Product {
|
|
222
|
+
/**
|
|
223
|
+
* The internal ID of the public product.
|
|
224
|
+
*/
|
|
225
|
+
id: string;
|
|
226
|
+
|
|
227
|
+
/**
|
|
228
|
+
* The title of the product. Use for Whop 4.0.
|
|
229
|
+
*/
|
|
230
|
+
title: string;
|
|
231
|
+
}
|
|
232
|
+
}
|
|
233
|
+
|
|
234
|
+
/**
|
|
235
|
+
* Statuses for promo codes
|
|
236
|
+
*/
|
|
237
|
+
export type PromoCodeStatus = 'active' | 'inactive' | 'archived';
|
|
238
|
+
|
|
239
|
+
/**
|
|
240
|
+
* The duration setting for the promo code
|
|
241
|
+
*/
|
|
242
|
+
export type PromoDuration = 'forever' | 'once' | 'repeating';
|
|
243
|
+
|
|
244
|
+
/**
|
|
245
|
+
* An object representing a promo code for a plan.
|
|
246
|
+
*/
|
|
247
|
+
export interface PromoCodeListResponse {
|
|
248
|
+
/**
|
|
249
|
+
* The ID of the promo.
|
|
250
|
+
*/
|
|
251
|
+
id: string;
|
|
252
|
+
|
|
253
|
+
/**
|
|
254
|
+
* The amount off (% or flat amount) for the promo.
|
|
255
|
+
*/
|
|
256
|
+
amount_off: number;
|
|
257
|
+
|
|
258
|
+
/**
|
|
259
|
+
* Restricts promo use to only users who have churned from the company before.
|
|
260
|
+
*/
|
|
261
|
+
churned_users_only: boolean;
|
|
262
|
+
|
|
263
|
+
/**
|
|
264
|
+
* The specific code used to apply the promo at checkout.
|
|
265
|
+
*/
|
|
266
|
+
code: string | null;
|
|
267
|
+
|
|
268
|
+
/**
|
|
269
|
+
* The timestamp of when the promo was created.
|
|
270
|
+
*/
|
|
271
|
+
created_at: string;
|
|
272
|
+
|
|
273
|
+
/**
|
|
274
|
+
* The monetary currency of the promo code.
|
|
275
|
+
*/
|
|
276
|
+
currency: Shared.Currency;
|
|
277
|
+
|
|
278
|
+
/**
|
|
279
|
+
* The duration setting for the promo code
|
|
280
|
+
*/
|
|
281
|
+
duration: PromoDuration | null;
|
|
282
|
+
|
|
283
|
+
/**
|
|
284
|
+
* Restricts promo use to only be applied to already purchased memberships.
|
|
285
|
+
*/
|
|
286
|
+
existing_memberships_only: boolean;
|
|
287
|
+
|
|
288
|
+
/**
|
|
289
|
+
* The date/time of when the promo expires.
|
|
290
|
+
*/
|
|
291
|
+
expires_at: string | null;
|
|
292
|
+
|
|
293
|
+
/**
|
|
294
|
+
* Restricts promo use to only users who have never purchased from the company
|
|
295
|
+
* before.
|
|
296
|
+
*/
|
|
297
|
+
new_users_only: boolean;
|
|
298
|
+
|
|
299
|
+
/**
|
|
300
|
+
* Restricts promo use to only be applied once per customer.
|
|
301
|
+
*/
|
|
302
|
+
one_per_customer: boolean;
|
|
303
|
+
|
|
304
|
+
/**
|
|
305
|
+
* The access pass associated with the promo code.
|
|
306
|
+
*/
|
|
307
|
+
product: PromoCodeListResponse.Product | null;
|
|
308
|
+
|
|
309
|
+
/**
|
|
310
|
+
* The number of months the promo is applied for.
|
|
311
|
+
*/
|
|
312
|
+
promo_duration_months: number | null;
|
|
313
|
+
|
|
314
|
+
/**
|
|
315
|
+
* The type (% or flat amount) of the promo.
|
|
316
|
+
*/
|
|
317
|
+
promo_type: Shared.PromoType;
|
|
318
|
+
|
|
319
|
+
/**
|
|
320
|
+
* Indicates if the promo code is live or disabled.
|
|
321
|
+
*/
|
|
322
|
+
status: PromoCodeStatus;
|
|
323
|
+
|
|
324
|
+
/**
|
|
325
|
+
* The quantity limit on the number of uses.
|
|
326
|
+
*/
|
|
327
|
+
stock: number;
|
|
328
|
+
|
|
329
|
+
/**
|
|
330
|
+
* Whether or not the promo code has unlimited stock.
|
|
331
|
+
*/
|
|
332
|
+
unlimited_stock: boolean;
|
|
333
|
+
|
|
334
|
+
/**
|
|
335
|
+
* The amount of times the promo codes has been used.
|
|
336
|
+
*/
|
|
337
|
+
uses: number;
|
|
338
|
+
}
|
|
339
|
+
|
|
340
|
+
export namespace PromoCodeListResponse {
|
|
341
|
+
/**
|
|
342
|
+
* The access pass associated with the promo code.
|
|
343
|
+
*/
|
|
344
|
+
export interface Product {
|
|
345
|
+
/**
|
|
346
|
+
* The internal ID of the public product.
|
|
347
|
+
*/
|
|
348
|
+
id: string;
|
|
349
|
+
|
|
350
|
+
/**
|
|
351
|
+
* The title of the product. Use for Whop 4.0.
|
|
352
|
+
*/
|
|
353
|
+
title: string;
|
|
354
|
+
}
|
|
355
|
+
}
|
|
356
|
+
|
|
357
|
+
/**
|
|
358
|
+
* Represents `true` or `false` values.
|
|
359
|
+
*/
|
|
360
|
+
export type PromoCodeDeleteResponse = boolean;
|
|
361
|
+
|
|
362
|
+
export interface PromoCodeCreateParams {
|
|
363
|
+
/**
|
|
364
|
+
* The amount off (% or flat amount) for the promo.
|
|
365
|
+
*/
|
|
366
|
+
amount_off: number;
|
|
367
|
+
|
|
368
|
+
/**
|
|
369
|
+
* The monetary currency of the promo code.
|
|
370
|
+
*/
|
|
371
|
+
base_currency: Shared.Currency;
|
|
372
|
+
|
|
373
|
+
/**
|
|
374
|
+
* The specific code used to apply the promo at checkout.
|
|
375
|
+
*/
|
|
376
|
+
code: string;
|
|
377
|
+
|
|
378
|
+
/**
|
|
379
|
+
* The id of the company to create the promo code for.
|
|
380
|
+
*/
|
|
381
|
+
company_id: string;
|
|
382
|
+
|
|
383
|
+
/**
|
|
384
|
+
* Restricts promo use to only users who have never purchased from the company
|
|
385
|
+
* before.
|
|
386
|
+
*/
|
|
387
|
+
new_users_only: boolean;
|
|
388
|
+
|
|
389
|
+
/**
|
|
390
|
+
* The number of months this promo code is applied and valid for.
|
|
391
|
+
*/
|
|
392
|
+
promo_duration_months: number;
|
|
393
|
+
|
|
394
|
+
/**
|
|
395
|
+
* The type (% or flat amount) of the promo.
|
|
396
|
+
*/
|
|
397
|
+
promo_type: Shared.PromoType;
|
|
398
|
+
|
|
399
|
+
/**
|
|
400
|
+
* Restricts promo use to only users who have churned from the company before.
|
|
401
|
+
*/
|
|
402
|
+
churned_users_only?: boolean | null;
|
|
403
|
+
|
|
404
|
+
/**
|
|
405
|
+
* Whether this promo code is for existing memberships only (cancelations)
|
|
406
|
+
*/
|
|
407
|
+
existing_memberships_only?: boolean | null;
|
|
408
|
+
|
|
409
|
+
/**
|
|
410
|
+
* The date/time of when the promo expires.
|
|
411
|
+
*/
|
|
412
|
+
expires_at?: string | null;
|
|
413
|
+
|
|
414
|
+
/**
|
|
415
|
+
* Restricts promo use to only be applied once per customer.
|
|
416
|
+
*/
|
|
417
|
+
one_per_customer?: boolean | null;
|
|
418
|
+
|
|
419
|
+
/**
|
|
420
|
+
* The IDs of the plans that the promo code applies to. If product_id is provided,
|
|
421
|
+
* it will only apply to plans attached to that product
|
|
422
|
+
*/
|
|
423
|
+
plan_ids?: Array<string> | null;
|
|
424
|
+
|
|
425
|
+
/**
|
|
426
|
+
* The product to lock the promo code to, if any. If provided will filter out any
|
|
427
|
+
* plan ids not attached to this product
|
|
428
|
+
*/
|
|
429
|
+
product_id?: string | null;
|
|
430
|
+
|
|
431
|
+
/**
|
|
432
|
+
* The quantity limit on the number of uses.
|
|
433
|
+
*/
|
|
434
|
+
stock?: number | null;
|
|
435
|
+
|
|
436
|
+
/**
|
|
437
|
+
* Whether or not the promo code should have unlimited stock.
|
|
438
|
+
*/
|
|
439
|
+
unlimited_stock?: boolean | null;
|
|
440
|
+
}
|
|
441
|
+
|
|
442
|
+
export interface PromoCodeListParams extends CursorPageParams {
|
|
443
|
+
/**
|
|
444
|
+
* The ID of the company to list promo codes for
|
|
445
|
+
*/
|
|
446
|
+
company_id: string;
|
|
447
|
+
|
|
448
|
+
/**
|
|
449
|
+
* Returns the elements in the list that come before the specified cursor.
|
|
450
|
+
*/
|
|
451
|
+
before?: string | null;
|
|
452
|
+
|
|
453
|
+
/**
|
|
454
|
+
* Returns the first _n_ elements from the list.
|
|
455
|
+
*/
|
|
456
|
+
first?: number | null;
|
|
457
|
+
|
|
458
|
+
/**
|
|
459
|
+
* Returns the last _n_ elements from the list.
|
|
460
|
+
*/
|
|
461
|
+
last?: number | null;
|
|
462
|
+
|
|
463
|
+
/**
|
|
464
|
+
* Filter promo codes by plan ID(s)
|
|
465
|
+
*/
|
|
466
|
+
plan_ids?: Array<string> | null;
|
|
467
|
+
|
|
468
|
+
/**
|
|
469
|
+
* Filter promo codes by product ID(s)
|
|
470
|
+
*/
|
|
471
|
+
product_ids?: Array<string> | null;
|
|
472
|
+
|
|
473
|
+
/**
|
|
474
|
+
* Statuses for promo codes
|
|
475
|
+
*/
|
|
476
|
+
status?: PromoCodeStatus | null;
|
|
477
|
+
}
|
|
478
|
+
|
|
479
|
+
export declare namespace PromoCodes {
|
|
480
|
+
export {
|
|
481
|
+
type PromoCode as PromoCode,
|
|
482
|
+
type PromoCodeStatus as PromoCodeStatus,
|
|
483
|
+
type PromoDuration as PromoDuration,
|
|
484
|
+
type PromoCodeListResponse as PromoCodeListResponse,
|
|
485
|
+
type PromoCodeDeleteResponse as PromoCodeDeleteResponse,
|
|
486
|
+
type PromoCodeListResponsesCursorPage as PromoCodeListResponsesCursorPage,
|
|
487
|
+
type PromoCodeCreateParams as PromoCodeCreateParams,
|
|
488
|
+
type PromoCodeListParams as PromoCodeListParams,
|
|
489
|
+
};
|
|
490
|
+
}
|