@whop/sdk 0.0.1-canary.0 → 0.0.2

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 (91) hide show
  1. package/CHANGELOG.md +21 -0
  2. package/client.d.mts +16 -3
  3. package/client.d.mts.map +1 -1
  4. package/client.d.ts +16 -3
  5. package/client.d.ts.map +1 -1
  6. package/client.js +7 -1
  7. package/client.js.map +1 -1
  8. package/client.mjs +7 -1
  9. package/client.mjs.map +1 -1
  10. package/package.json +1 -1
  11. package/resources/apps.d.mts +16 -0
  12. package/resources/apps.d.mts.map +1 -1
  13. package/resources/apps.d.ts +16 -0
  14. package/resources/apps.d.ts.map +1 -1
  15. package/resources/checkout-configurations.d.mts +21 -18
  16. package/resources/checkout-configurations.d.mts.map +1 -1
  17. package/resources/checkout-configurations.d.ts +21 -18
  18. package/resources/checkout-configurations.d.ts.map +1 -1
  19. package/resources/checkout-configurations.js +1 -1
  20. package/resources/checkout-configurations.mjs +1 -1
  21. package/resources/experiences.d.mts +32 -0
  22. package/resources/experiences.d.mts.map +1 -1
  23. package/resources/experiences.d.ts +32 -0
  24. package/resources/experiences.d.ts.map +1 -1
  25. package/resources/forums.d.mts +112 -0
  26. package/resources/forums.d.mts.map +1 -0
  27. package/resources/forums.d.ts +112 -0
  28. package/resources/forums.d.ts.map +1 -0
  29. package/resources/forums.js +41 -0
  30. package/resources/forums.js.map +1 -0
  31. package/resources/forums.mjs +37 -0
  32. package/resources/forums.mjs.map +1 -0
  33. package/resources/index.d.mts +3 -1
  34. package/resources/index.d.mts.map +1 -1
  35. package/resources/index.d.ts +3 -1
  36. package/resources/index.d.ts.map +1 -1
  37. package/resources/index.js +5 -1
  38. package/resources/index.js.map +1 -1
  39. package/resources/index.mjs +2 -0
  40. package/resources/index.mjs.map +1 -1
  41. package/resources/invoices.d.mts +5 -2
  42. package/resources/invoices.d.mts.map +1 -1
  43. package/resources/invoices.d.ts +5 -2
  44. package/resources/invoices.d.ts.map +1 -1
  45. package/resources/members.d.mts +270 -0
  46. package/resources/members.d.mts.map +1 -0
  47. package/resources/members.d.ts +270 -0
  48. package/resources/members.d.ts.map +1 -0
  49. package/resources/members.js +35 -0
  50. package/resources/members.js.map +1 -0
  51. package/resources/members.mjs +31 -0
  52. package/resources/members.mjs.map +1 -0
  53. package/resources/plans.d.mts +5 -2
  54. package/resources/plans.d.mts.map +1 -1
  55. package/resources/plans.d.ts +5 -2
  56. package/resources/plans.d.ts.map +1 -1
  57. package/resources/shared.d.mts +176 -11
  58. package/resources/shared.d.mts.map +1 -1
  59. package/resources/shared.d.ts +176 -11
  60. package/resources/shared.d.ts.map +1 -1
  61. package/resources/users.d.mts +18 -1
  62. package/resources/users.d.mts.map +1 -1
  63. package/resources/users.d.ts +18 -1
  64. package/resources/users.d.ts.map +1 -1
  65. package/resources/users.js.map +1 -1
  66. package/resources/users.mjs.map +1 -1
  67. package/resources/webhooks.d.mts +224 -2
  68. package/resources/webhooks.d.mts.map +1 -1
  69. package/resources/webhooks.d.ts +224 -2
  70. package/resources/webhooks.d.ts.map +1 -1
  71. package/src/client.ts +63 -2
  72. package/src/resources/apps.ts +18 -0
  73. package/src/resources/checkout-configurations.ts +21 -18
  74. package/src/resources/experiences.ts +36 -0
  75. package/src/resources/forums.ts +152 -0
  76. package/src/resources/index.ts +24 -0
  77. package/src/resources/invoices.ts +5 -2
  78. package/src/resources/members.ts +337 -0
  79. package/src/resources/plans.ts +5 -2
  80. package/src/resources/shared.ts +217 -11
  81. package/src/resources/users.ts +20 -1
  82. package/src/resources/webhooks.ts +293 -1
  83. package/src/version.ts +1 -1
  84. package/version.d.mts +1 -1
  85. package/version.d.mts.map +1 -1
  86. package/version.d.ts +1 -1
  87. package/version.d.ts.map +1 -1
  88. package/version.js +1 -1
  89. package/version.js.map +1 -1
  90. package/version.mjs +1 -1
  91. package/version.mjs.map +1 -1
@@ -9,7 +9,7 @@ import { path } from '../internal/utils/path';
9
9
 
10
10
  export class CheckoutConfigurations extends APIResource {
11
11
  /**
12
- * Creates a new checkout session
12
+ * Creates a new checkout configuration
13
13
  *
14
14
  * Required permissions:
15
15
  *
@@ -80,48 +80,51 @@ export class CheckoutConfigurations extends APIResource {
80
80
  export type CheckoutConfigurationListResponsesCursorPage = CursorPage<CheckoutConfigurationListResponse>;
81
81
 
82
82
  /**
83
- * A checkout session
83
+ * A checkout configuration object.
84
+ * Can be used to create a reusable custom configuration for a checkout, including attaching plans, affiliates and custom metadata to the checkout.
85
+ * This configuration can be re-used by multiple users.
86
+ * All successful payments and memberships resulting from a checkout will contain the passed metadata.
84
87
  */
85
88
  export interface CheckoutConfigurationListResponse {
86
89
  /**
87
- * The ID of the checkout session
90
+ * The ID of the checkout configuration
88
91
  */
89
92
  id: string;
90
93
 
91
94
  /**
92
- * The affiliate code to use for the checkout session
95
+ * The affiliate code to use for the checkout configuration
93
96
  */
94
- affiliate_code: string;
97
+ affiliate_code: string | null;
95
98
 
96
99
  /**
97
- * The ID of the company to use for the checkout session
100
+ * The ID of the company to use for the checkout configuration
98
101
  */
99
102
  company_id: string;
100
103
 
101
104
  /**
102
- * The metadata to use for the checkout session
105
+ * The metadata to use for the checkout configuration
103
106
  */
104
107
  metadata: { [key: string]: unknown };
105
108
 
106
109
  /**
107
- * The plan to use for the checkout session
110
+ * The plan to use for the checkout configuration
108
111
  */
109
112
  plan: CheckoutConfigurationListResponse.Plan;
110
113
 
111
114
  /**
112
- * The URL to redirect the user to after the checkout session is created
115
+ * The URL to redirect the user to after the checkout configuration is created
113
116
  */
114
117
  purchase_url: string;
115
118
 
116
119
  /**
117
- * The URL to redirect the user to after the checkout session is created
120
+ * The URL to redirect the user to after the checkout configuration is created
118
121
  */
119
- redirect_url: string;
122
+ redirect_url: string | null;
120
123
  }
121
124
 
122
125
  export namespace CheckoutConfigurationListResponse {
123
126
  /**
124
- * The plan to use for the checkout session
127
+ * The plan to use for the checkout configuration
125
128
  */
126
129
  export interface Plan {
127
130
  /**
@@ -178,34 +181,34 @@ export namespace CheckoutConfigurationListResponse {
178
181
 
179
182
  export interface CheckoutConfigurationCreateParams {
180
183
  /**
181
- * The affiliate code to use for the checkout session
184
+ * The affiliate code to use for the checkout configuration
182
185
  */
183
186
  affiliate_code?: string | null;
184
187
 
185
188
  /**
186
- * The metadata to use for the checkout session
189
+ * The metadata to use for the checkout configuration
187
190
  */
188
191
  metadata?: { [key: string]: unknown } | null;
189
192
 
190
193
  /**
191
- * Pass this object to create a new plan for this checkout session
194
+ * Pass this object to create a new plan for this checkout configuration
192
195
  */
193
196
  plan?: CheckoutConfigurationCreateParams.Plan | null;
194
197
 
195
198
  /**
196
- * The ID of the plan to use for the checkout session
199
+ * The ID of the plan to use for the checkout configuration
197
200
  */
198
201
  plan_id?: string | null;
199
202
 
200
203
  /**
201
- * The URL to redirect the user to after the checkout session is created
204
+ * The URL to redirect the user to after the checkout configuration is created
202
205
  */
203
206
  redirect_url?: string | null;
204
207
  }
205
208
 
206
209
  export namespace CheckoutConfigurationCreateParams {
207
210
  /**
208
- * Pass this object to create a new plan for this checkout session
211
+ * Pass this object to create a new plan for this checkout configuration
209
212
  */
210
213
  export interface Plan {
211
214
  /**
@@ -166,6 +166,11 @@ export interface ExperienceListResponse {
166
166
  */
167
167
  created_at: string;
168
168
 
169
+ /**
170
+ * The logo for the experience.
171
+ */
172
+ image: ExperienceListResponse.Image | null;
173
+
169
174
  /**
170
175
  * The written name of the description.
171
176
  */
@@ -187,12 +192,32 @@ export namespace ExperienceListResponse {
187
192
  */
188
193
  id: string;
189
194
 
195
+ /**
196
+ * The icon for the app. This icon is shown on discovery, on the product page, on
197
+ * checkout, and as a default icon for the experiences.
198
+ */
199
+ icon: App.Icon | null;
200
+
190
201
  /**
191
202
  * The name of the app
192
203
  */
193
204
  name: string;
194
205
  }
195
206
 
207
+ export namespace App {
208
+ /**
209
+ * The icon for the app. This icon is shown on discovery, on the product page, on
210
+ * checkout, and as a default icon for the experiences.
211
+ */
212
+ export interface Icon {
213
+ /**
214
+ * This is the URL you use to render optimized attachments on the client. This
215
+ * should be used for apps.
216
+ */
217
+ url: string | null;
218
+ }
219
+ }
220
+
196
221
  /**
197
222
  * The company that owns this experience.
198
223
  */
@@ -212,6 +237,17 @@ export namespace ExperienceListResponse {
212
237
  */
213
238
  title: string;
214
239
  }
240
+
241
+ /**
242
+ * The logo for the experience.
243
+ */
244
+ export interface Image {
245
+ /**
246
+ * This is the URL you use to render optimized attachments on the client. This
247
+ * should be used for apps.
248
+ */
249
+ url: string | null;
250
+ }
215
251
  }
216
252
 
217
253
  /**
@@ -0,0 +1,152 @@
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 Forums extends APIResource {
11
+ /**
12
+ * Retrieves a forum
13
+ *
14
+ * Required permissions:
15
+ *
16
+ * - `forum:read`
17
+ */
18
+ retrieve(id: string, options?: RequestOptions): APIPromise<Shared.Forum> {
19
+ return this._client.get(path`/forums/${id}`, options);
20
+ }
21
+
22
+ /**
23
+ * Updates a forum
24
+ *
25
+ * Required permissions:
26
+ *
27
+ * - `forum:moderate`
28
+ */
29
+ update(
30
+ id: string,
31
+ body: ForumUpdateParams | null | undefined = {},
32
+ options?: RequestOptions,
33
+ ): APIPromise<Shared.Forum> {
34
+ return this._client.patch(path`/forums/${id}`, { body, ...options });
35
+ }
36
+
37
+ /**
38
+ * Lists forums inside a company
39
+ *
40
+ * Required permissions:
41
+ *
42
+ * - `forum:read`
43
+ */
44
+ list(
45
+ query: ForumListParams,
46
+ options?: RequestOptions,
47
+ ): PagePromise<ForumListResponsesCursorPage, ForumListResponse> {
48
+ return this._client.getAPIList('/forums', CursorPage<ForumListResponse>, { query, ...options });
49
+ }
50
+ }
51
+
52
+ export type ForumListResponsesCursorPage = CursorPage<ForumListResponse>;
53
+
54
+ /**
55
+ * Represents a forum feed
56
+ */
57
+ export interface ForumListResponse {
58
+ /**
59
+ * The unique identifier for the entity
60
+ */
61
+ id: string;
62
+
63
+ /**
64
+ * The email notification preference for this forum
65
+ */
66
+ email_notification_preference: Shared.EmailNotificationPreferences;
67
+
68
+ /**
69
+ * The experience for this forum
70
+ */
71
+ experience: ForumListResponse.Experience;
72
+
73
+ /**
74
+ * Who can comment on this forum
75
+ */
76
+ who_can_comment: Shared.WhoCanCommentTypes;
77
+
78
+ /**
79
+ * Who can post on this forum
80
+ */
81
+ who_can_post: Shared.WhoCanPostTypes;
82
+ }
83
+
84
+ export namespace ForumListResponse {
85
+ /**
86
+ * The experience for this forum
87
+ */
88
+ export interface Experience {
89
+ /**
90
+ * The unique ID representing this experience
91
+ */
92
+ id: string;
93
+
94
+ /**
95
+ * The written name of the description.
96
+ */
97
+ name: string;
98
+ }
99
+ }
100
+
101
+ export interface ForumUpdateParams {
102
+ /**
103
+ * Email notification preference option for a forum feed
104
+ */
105
+ email_notification_preference?: Shared.EmailNotificationPreferences | null;
106
+
107
+ /**
108
+ * Who can comment on a forum feed
109
+ */
110
+ who_can_comment?: Shared.WhoCanCommentTypes | null;
111
+
112
+ /**
113
+ * Who can post on a forum feed
114
+ */
115
+ who_can_post?: Shared.WhoCanPostTypes | null;
116
+ }
117
+
118
+ export interface ForumListParams extends CursorPageParams {
119
+ /**
120
+ * The ID of the company to list forums for
121
+ */
122
+ company_id: string;
123
+
124
+ /**
125
+ * Returns the elements in the list that come before the specified cursor.
126
+ */
127
+ before?: string | null;
128
+
129
+ /**
130
+ * Returns the first _n_ elements from the list.
131
+ */
132
+ first?: number | null;
133
+
134
+ /**
135
+ * Returns the last _n_ elements from the list.
136
+ */
137
+ last?: number | null;
138
+
139
+ /**
140
+ * If provided, only forums connected to this product are returned
141
+ */
142
+ product_id?: string | null;
143
+ }
144
+
145
+ export declare namespace Forums {
146
+ export {
147
+ type ForumListResponse as ForumListResponse,
148
+ type ForumListResponsesCursorPage as ForumListResponsesCursorPage,
149
+ type ForumUpdateParams as ForumUpdateParams,
150
+ type ForumListParams as ForumListParams,
151
+ };
152
+ }
@@ -67,6 +67,13 @@ export {
67
67
  type ForumPostListParams,
68
68
  type ForumPostListResponsesCursorPage,
69
69
  } from './forum-posts';
70
+ export {
71
+ Forums,
72
+ type ForumListResponse,
73
+ type ForumUpdateParams,
74
+ type ForumListParams,
75
+ type ForumListResponsesCursorPage,
76
+ } from './forums';
70
77
  export {
71
78
  Invoices,
72
79
  type InvoiceCreateResponse,
@@ -75,6 +82,13 @@ export {
75
82
  type InvoiceListParams,
76
83
  } from './invoices';
77
84
  export { LedgerAccounts, type LedgerAccountRetrieveResponse } from './ledger-accounts';
85
+ export {
86
+ Members,
87
+ type MemberRetrieveResponse,
88
+ type MemberListResponse,
89
+ type MemberListParams,
90
+ type MemberListResponsesCursorPage,
91
+ } from './members';
78
92
  export {
79
93
  Memberships,
80
94
  type MembershipListResponse,
@@ -154,5 +168,15 @@ export {
154
168
  type InvoicePaidWebhookEvent,
155
169
  type InvoicePastDueWebhookEvent,
156
170
  type InvoiceVoidedWebhookEvent,
171
+ type MembershipActivatedWebhookEvent,
172
+ type MembershipDeactivatedWebhookEvent,
173
+ type EntryCreatedWebhookEvent,
174
+ type EntryApprovedWebhookEvent,
175
+ type EntryDeniedWebhookEvent,
176
+ type EntryDeletedWebhookEvent,
177
+ type CourseLessonInteractionCompletedWebhookEvent,
178
+ type PaymentSucceededWebhookEvent,
179
+ type PaymentFailedWebhookEvent,
180
+ type PaymentPendingWebhookEvent,
157
181
  type UnwrapWebhookEvent,
158
182
  } from './webhooks';
@@ -206,7 +206,9 @@ export namespace InvoiceCreateParams {
206
206
  expiration_days?: number | null;
207
207
 
208
208
  /**
209
- * An additional amount charged upon first purchase.
209
+ * An additional amount charged upon first purchase. Use only if a one time payment
210
+ * OR you want to charge an additional amount on top of the renewal price. Provided
211
+ * as a number in dollars. Eg: 10.43 for $10.43
210
212
  */
211
213
  initial_price?: number | null;
212
214
 
@@ -226,7 +228,8 @@ export namespace InvoiceCreateParams {
226
228
  release_method?: Shared.ReleaseMethod | null;
227
229
 
228
230
  /**
229
- * The amount the customer is charged every billing period.
231
+ * The amount the customer is charged every billing period. Use only if a recurring
232
+ * payment. Provided as a number in dollars. Eg: 10.43 for $10.43
230
233
  */
231
234
  renewal_price?: number | null;
232
235