@whop/sdk 0.0.4 → 0.0.6

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 (117) hide show
  1. package/CHANGELOG.md +51 -0
  2. package/README.md +0 -4
  3. package/client.d.mts +14 -8
  4. package/client.d.mts.map +1 -1
  5. package/client.d.ts +14 -8
  6. package/client.d.ts.map +1 -1
  7. package/client.js +8 -5
  8. package/client.js.map +1 -1
  9. package/client.mjs +8 -5
  10. package/client.mjs.map +1 -1
  11. package/lib/verify-user-token.d.mts.map +1 -1
  12. package/lib/verify-user-token.d.ts.map +1 -1
  13. package/lib/verify-user-token.js +6 -3
  14. package/lib/verify-user-token.js.map +1 -1
  15. package/lib/verify-user-token.mjs +6 -3
  16. package/lib/verify-user-token.mjs.map +1 -1
  17. package/package.json +1 -1
  18. package/resources/access-tokens.d.mts +58 -0
  19. package/resources/access-tokens.d.mts.map +1 -0
  20. package/resources/access-tokens.d.ts +58 -0
  21. package/resources/access-tokens.d.ts.map +1 -0
  22. package/resources/access-tokens.js +25 -0
  23. package/resources/access-tokens.js.map +1 -0
  24. package/resources/access-tokens.mjs +21 -0
  25. package/resources/access-tokens.mjs.map +1 -0
  26. package/resources/checkout-configurations.d.mts +2 -2
  27. package/resources/checkout-configurations.d.ts +2 -2
  28. package/resources/course-lessons.d.mts +121 -1
  29. package/resources/course-lessons.d.mts.map +1 -1
  30. package/resources/course-lessons.d.ts +121 -1
  31. package/resources/course-lessons.d.ts.map +1 -1
  32. package/resources/courses.d.mts +45 -1
  33. package/resources/courses.d.mts.map +1 -1
  34. package/resources/courses.d.ts +45 -1
  35. package/resources/courses.d.ts.map +1 -1
  36. package/resources/entries.d.mts +2 -2
  37. package/resources/entries.d.ts +2 -2
  38. package/resources/forum-posts.d.mts +1 -1
  39. package/resources/forum-posts.d.ts +1 -1
  40. package/resources/index.d.mts +4 -2
  41. package/resources/index.d.mts.map +1 -1
  42. package/resources/index.d.ts +4 -2
  43. package/resources/index.d.ts.map +1 -1
  44. package/resources/index.js +5 -1
  45. package/resources/index.js.map +1 -1
  46. package/resources/index.mjs +2 -0
  47. package/resources/index.mjs.map +1 -1
  48. package/resources/invoices.d.mts +14 -25
  49. package/resources/invoices.d.mts.map +1 -1
  50. package/resources/invoices.d.ts +14 -25
  51. package/resources/invoices.d.ts.map +1 -1
  52. package/resources/ledger-accounts.d.mts +1 -1
  53. package/resources/ledger-accounts.d.ts +1 -1
  54. package/resources/ledger-accounts.js +1 -1
  55. package/resources/ledger-accounts.mjs +1 -1
  56. package/resources/members.d.mts +11 -11
  57. package/resources/members.d.mts.map +1 -1
  58. package/resources/members.d.ts +11 -11
  59. package/resources/members.d.ts.map +1 -1
  60. package/resources/memberships.d.mts +4 -4
  61. package/resources/memberships.d.mts.map +1 -1
  62. package/resources/memberships.d.ts +4 -4
  63. package/resources/memberships.d.ts.map +1 -1
  64. package/resources/messages.d.mts +1 -1
  65. package/resources/messages.d.ts +1 -1
  66. package/resources/notifications.d.mts +105 -0
  67. package/resources/notifications.d.mts.map +1 -0
  68. package/resources/notifications.d.ts +105 -0
  69. package/resources/notifications.d.ts.map +1 -0
  70. package/resources/notifications.js +24 -0
  71. package/resources/notifications.js.map +1 -0
  72. package/resources/notifications.mjs +20 -0
  73. package/resources/notifications.mjs.map +1 -0
  74. package/resources/payments.d.mts +2 -2
  75. package/resources/payments.d.ts +2 -2
  76. package/resources/plans.d.mts +6 -4
  77. package/resources/plans.d.mts.map +1 -1
  78. package/resources/plans.d.ts +6 -4
  79. package/resources/plans.d.ts.map +1 -1
  80. package/resources/products.d.mts +5 -5
  81. package/resources/products.d.ts +5 -5
  82. package/resources/promo-codes.d.mts +4 -4
  83. package/resources/promo-codes.d.ts +4 -4
  84. package/resources/shared.d.mts +22 -20
  85. package/resources/shared.d.mts.map +1 -1
  86. package/resources/shared.d.ts +22 -20
  87. package/resources/shared.d.ts.map +1 -1
  88. package/resources/users.d.mts +3 -0
  89. package/resources/users.d.mts.map +1 -1
  90. package/resources/users.d.ts +3 -0
  91. package/resources/users.d.ts.map +1 -1
  92. package/src/client.ts +31 -10
  93. package/src/lib/verify-user-token.ts +6 -3
  94. package/src/resources/access-tokens.ts +72 -0
  95. package/src/resources/checkout-configurations.ts +2 -2
  96. package/src/resources/course-lessons.ts +146 -0
  97. package/src/resources/courses.ts +54 -0
  98. package/src/resources/entries.ts +2 -2
  99. package/src/resources/forum-posts.ts +1 -1
  100. package/src/resources/index.ts +8 -0
  101. package/src/resources/invoices.ts +14 -26
  102. package/src/resources/ledger-accounts.ts +1 -1
  103. package/src/resources/members.ts +12 -12
  104. package/src/resources/memberships.ts +5 -5
  105. package/src/resources/messages.ts +1 -1
  106. package/src/resources/notifications.ts +131 -0
  107. package/src/resources/payments.ts +2 -2
  108. package/src/resources/plans.ts +6 -4
  109. package/src/resources/products.ts +5 -5
  110. package/src/resources/promo-codes.ts +4 -4
  111. package/src/resources/shared.ts +22 -20
  112. package/src/resources/users.ts +3 -0
  113. package/src/version.ts +1 -1
  114. package/version.d.mts +1 -1
  115. package/version.d.ts +1 -1
  116. package/version.js +1 -1
  117. package/version.mjs +1 -1
@@ -0,0 +1,131 @@
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 { RequestOptions } from '../internal/request-options';
6
+
7
+ export class Notifications extends APIResource {
8
+ /**
9
+ * Queues a notification to be sent to users in an experience or company team
10
+ *
11
+ * @example
12
+ * ```ts
13
+ * const notification = await client.notifications.create({
14
+ * company_id: 'biz_xxxxxxxxxxxxxx',
15
+ * content: 'content',
16
+ * title: 'title',
17
+ * });
18
+ * ```
19
+ */
20
+ create(body: NotificationCreateParams, options?: RequestOptions): APIPromise<NotificationCreateResponse> {
21
+ return this._client.post('/notifications', { body, ...options });
22
+ }
23
+ }
24
+
25
+ /**
26
+ * Response from queuing a notification
27
+ */
28
+ export interface NotificationCreateResponse {
29
+ /**
30
+ * Whether the notification was successfully queued for delivery
31
+ */
32
+ success: boolean;
33
+ }
34
+
35
+ export type NotificationCreateParams =
36
+ | NotificationCreateParams.SendNotificationV2InputWithCompanyID
37
+ | NotificationCreateParams.SendNotificationV2InputWithExperienceID;
38
+
39
+ export declare namespace NotificationCreateParams {
40
+ export interface SendNotificationV2InputWithCompanyID {
41
+ /**
42
+ * The id of the company to target. Only team members of this company will receive
43
+ * the notification. When clicked will take the user to your dashboard app view.
44
+ */
45
+ company_id: string;
46
+
47
+ /**
48
+ * The content of the notification
49
+ */
50
+ content: string;
51
+
52
+ /**
53
+ * The title of the notification
54
+ */
55
+ title: string;
56
+
57
+ /**
58
+ * Optional: ID of a Whop user whose profile picture will be used as the
59
+ * notification icon. If not provided, defaults to the experience or company
60
+ * avatar.
61
+ */
62
+ icon_user_id?: string | null;
63
+
64
+ /**
65
+ * The rest path to append to the generated deep link that opens your app. Use
66
+ * [restPath] in your app path in the dashboard to read this parameter.
67
+ */
68
+ rest_path?: string | null;
69
+
70
+ /**
71
+ * The subtitle of the notification
72
+ */
73
+ subtitle?: string | null;
74
+
75
+ /**
76
+ * If provided, this will only send to these users if they are also in the main
77
+ * scope (experience or company)
78
+ */
79
+ user_ids?: Array<string> | null;
80
+ }
81
+
82
+ export interface SendNotificationV2InputWithExperienceID {
83
+ /**
84
+ * The content of the notification
85
+ */
86
+ content: string;
87
+
88
+ /**
89
+ * The id of the experience to target. All users with access to this experience
90
+ * (customers and admins) will receive the notification. When clicked, open your
91
+ * experience view.
92
+ */
93
+ experience_id: string;
94
+
95
+ /**
96
+ * The title of the notification
97
+ */
98
+ title: string;
99
+
100
+ /**
101
+ * Optional: ID of a Whop user whose profile picture will be used as the
102
+ * notification icon. If not provided, defaults to the experience or company
103
+ * avatar.
104
+ */
105
+ icon_user_id?: string | null;
106
+
107
+ /**
108
+ * The rest path to append to the generated deep link that opens your app. Use
109
+ * [restPath] in your app path in the dashboard to read this parameter.
110
+ */
111
+ rest_path?: string | null;
112
+
113
+ /**
114
+ * The subtitle of the notification
115
+ */
116
+ subtitle?: string | null;
117
+
118
+ /**
119
+ * If provided, this will only send to these users if they are also in the main
120
+ * scope (experience or company)
121
+ */
122
+ user_ids?: Array<string> | null;
123
+ }
124
+ }
125
+
126
+ export declare namespace Notifications {
127
+ export {
128
+ type NotificationCreateResponse as NotificationCreateResponse,
129
+ type NotificationCreateParams as NotificationCreateParams,
130
+ };
131
+ }
@@ -364,7 +364,7 @@ export interface PaymentListResponse {
364
364
  plan: PaymentListResponse.Plan | null;
365
365
 
366
366
  /**
367
- * The access pass attached to this payment.
367
+ * The product this payment was made for
368
368
  */
369
369
  product: PaymentListResponse.Product | null;
370
370
 
@@ -535,7 +535,7 @@ export namespace PaymentListResponse {
535
535
  }
536
536
 
537
537
  /**
538
- * The access pass attached to this payment.
538
+ * The product this payment was made for
539
539
  */
540
540
  export interface Product {
541
541
  /**
@@ -118,7 +118,9 @@ export class Plans extends APIResource {
118
118
  export type PlanListResponsesCursorPage = CursorPage<PlanListResponse>;
119
119
 
120
120
  /**
121
- * An object representing a (sanitized) plan of an access pass.
121
+ * A plan for an product. Plans define the core parameters that define a checkout
122
+ * and payment on whop. Use plans to create different ways to price your products
123
+ * (Eg renewal / one_time)
122
124
  */
123
125
  export interface PlanListResponse {
124
126
  /**
@@ -187,7 +189,7 @@ export interface PlanListResponse {
187
189
  plan_type: Shared.PlanType;
188
190
 
189
191
  /**
190
- * The access pass for the plan.
192
+ * The product that this plan belongs to.
191
193
  */
192
194
  product: PlanListResponse.Product | null;
193
195
 
@@ -290,7 +292,7 @@ export namespace PlanListResponse {
290
292
  }
291
293
 
292
294
  /**
293
- * The access pass for the plan.
295
+ * The product that this plan belongs to.
294
296
  */
295
297
  export interface Product {
296
298
  /**
@@ -376,7 +378,7 @@ export interface PlanCreateParams {
376
378
  payment_method_configuration?: PlanCreateParams.PaymentMethodConfiguration | null;
377
379
 
378
380
  /**
379
- * The type of plan that can be attached to an access pass
381
+ * The type of plan that can be attached to a product
380
382
  */
381
383
  plan_type?: Shared.PlanType | null;
382
384
 
@@ -172,7 +172,7 @@ export interface ProductCreateParams {
172
172
  global_affiliate_percentage?: number | null;
173
173
 
174
174
  /**
175
- * The different statuses of the global affiliate program for an access pass.
175
+ * The different statuses of the global affiliate program for a product.
176
176
  */
177
177
  global_affiliate_status?: Shared.GlobalAffiliateStatus | null;
178
178
 
@@ -192,7 +192,7 @@ export interface ProductCreateParams {
192
192
  member_affiliate_percentage?: number | null;
193
193
 
194
194
  /**
195
- * The different statuses of the global affiliate program for an access pass.
195
+ * The different statuses of the global affiliate program for a product.
196
196
  */
197
197
  member_affiliate_status?: Shared.GlobalAffiliateStatus | null;
198
198
 
@@ -253,7 +253,7 @@ export namespace ProductCreateParams {
253
253
  initial_price?: number | null;
254
254
 
255
255
  /**
256
- * The type of plan that can be attached to an access pass
256
+ * The type of plan that can be attached to a product
257
257
  */
258
258
  plan_type?: Shared.PlanType | null;
259
259
 
@@ -376,7 +376,7 @@ export interface ProductUpdateParams {
376
376
  global_affiliate_percentage?: number | null;
377
377
 
378
378
  /**
379
- * The different statuses of the global affiliate program for an access pass.
379
+ * The different statuses of the global affiliate program for a product.
380
380
  */
381
381
  global_affiliate_status?: Shared.GlobalAffiliateStatus | null;
382
382
 
@@ -396,7 +396,7 @@ export interface ProductUpdateParams {
396
396
  member_affiliate_percentage?: number | null;
397
397
 
398
398
  /**
399
- * The different statuses of the global affiliate program for an access pass.
399
+ * The different statuses of the global affiliate program for a product.
400
400
  */
401
401
  member_affiliate_status?: Shared.GlobalAffiliateStatus | null;
402
402
 
@@ -164,7 +164,7 @@ export interface PromoCode {
164
164
  one_per_customer: boolean;
165
165
 
166
166
  /**
167
- * The access pass associated with the promo code.
167
+ * The product this promo code applies to
168
168
  */
169
169
  product: PromoCode.Product | null;
170
170
 
@@ -216,7 +216,7 @@ export namespace PromoCode {
216
216
  }
217
217
 
218
218
  /**
219
- * The access pass associated with the promo code.
219
+ * The product this promo code applies to
220
220
  */
221
221
  export interface Product {
222
222
  /**
@@ -302,7 +302,7 @@ export interface PromoCodeListResponse {
302
302
  one_per_customer: boolean;
303
303
 
304
304
  /**
305
- * The access pass associated with the promo code.
305
+ * The product this promo code applies to
306
306
  */
307
307
  product: PromoCodeListResponse.Product | null;
308
308
 
@@ -339,7 +339,7 @@ export interface PromoCodeListResponse {
339
339
 
340
340
  export namespace PromoCodeListResponse {
341
341
  /**
342
- * The access pass associated with the promo code.
342
+ * The product this promo code applies to
343
343
  */
344
344
  export interface Product {
345
345
  /**
@@ -5,12 +5,13 @@ import * as PaymentsAPI from './payments';
5
5
  import { CursorPage } from '../core/pagination';
6
6
 
7
7
  /**
8
- * The access level a given user (or company) has to an access pass or company.
8
+ * The access level a given user (or company) has to a product or company.
9
9
  */
10
10
  export type AccessLevel = 'no_access' | 'admin' | 'customer';
11
11
 
12
12
  /**
13
- * The different types an access pass can be.
13
+ * The different types an product can be. Only use 'regular'. The rest are for
14
+ * internal use
14
15
  */
15
16
  export type AccessPassType = 'regular' | 'app' | 'experience_upsell' | 'api_only';
16
17
 
@@ -970,7 +971,7 @@ export interface Entry {
970
971
  plan: Entry.Plan | null;
971
972
 
972
973
  /**
973
- * The access pass tied to this entry, if there is one.
974
+ * The product tied to this entry, if there is one.
974
975
  */
975
976
  product: Entry.Product | null;
976
977
 
@@ -1017,7 +1018,7 @@ export namespace Entry {
1017
1018
  }
1018
1019
 
1019
1020
  /**
1020
- * The access pass tied to this entry, if there is one.
1021
+ * The product tied to this entry, if there is one.
1021
1022
  */
1022
1023
  export interface Product {
1023
1024
  /**
@@ -1102,10 +1103,9 @@ export interface Experience {
1102
1103
  order: string | null;
1103
1104
 
1104
1105
  /**
1105
- * The access passes that are associated with this experience. This should not be
1106
- * used unless you are trying to list all access passes the experience has, for
1107
- * some reason. You probably don't want to use this though and should be using
1108
- * accessPass.
1106
+ * The products that this experience is attached to. This defines which set of
1107
+ * customers have access and can view this experience. If empty, this experience is
1108
+ * only visible to authorized users of the company
1109
1109
  */
1110
1110
  products: Array<Experience.Product>;
1111
1111
  }
@@ -1178,7 +1178,7 @@ export namespace Experience {
1178
1178
  }
1179
1179
 
1180
1180
  /**
1181
- * An object representing a (sanitized) access pass.
1181
+ * Represents a product on whop. Use products to sell anything on the platform.
1182
1182
  */
1183
1183
  export interface Product {
1184
1184
  /**
@@ -1250,7 +1250,7 @@ export namespace Forum {
1250
1250
  */
1251
1251
  export interface ForumPost {
1252
1252
  /**
1253
- * The unique identifier for the entity
1253
+ * The unique identifier of the resource.
1254
1254
  */
1255
1255
  id: string;
1256
1256
 
@@ -1359,7 +1359,7 @@ export type FriendlyReceiptStatus =
1359
1359
  | 'canceled';
1360
1360
 
1361
1361
  /**
1362
- * The different statuses of the global affiliate program for an access pass.
1362
+ * The different statuses of the global affiliate program for a product.
1363
1363
  */
1364
1364
  export type GlobalAffiliateStatus = 'enabled' | 'disabled';
1365
1365
 
@@ -1852,7 +1852,7 @@ export type MembershipStatus =
1852
1852
  */
1853
1853
  export interface Message {
1854
1854
  /**
1855
- * The unique identifier for the entity
1855
+ * The unique identifier of the resource.
1856
1856
  */
1857
1857
  id: string;
1858
1858
 
@@ -2122,7 +2122,7 @@ export interface Payment {
2122
2122
  plan: Payment.Plan | null;
2123
2123
 
2124
2124
  /**
2125
- * The access pass attached to this payment.
2125
+ * The product this payment was made for
2126
2126
  */
2127
2127
  product: Payment.Product | null;
2128
2128
 
@@ -2293,7 +2293,7 @@ export namespace Payment {
2293
2293
  }
2294
2294
 
2295
2295
  /**
2296
- * The access pass attached to this payment.
2296
+ * The product this payment was made for
2297
2297
  */
2298
2298
  export interface Product {
2299
2299
  /**
@@ -2374,7 +2374,9 @@ export namespace Payment {
2374
2374
  }
2375
2375
 
2376
2376
  /**
2377
- * An object representing a (sanitized) plan of an access pass.
2377
+ * A plan for an product. Plans define the core parameters that define a checkout
2378
+ * and payment on whop. Use plans to create different ways to price your products
2379
+ * (Eg renewal / one_time)
2378
2380
  */
2379
2381
  export interface Plan {
2380
2382
  /**
@@ -2453,7 +2455,7 @@ export interface Plan {
2453
2455
  plan_type: PlanType;
2454
2456
 
2455
2457
  /**
2456
- * The access pass for the plan.
2458
+ * The product that this plan belongs to.
2457
2459
  */
2458
2460
  product: Plan.Product | null;
2459
2461
 
@@ -2596,7 +2598,7 @@ export namespace Plan {
2596
2598
  }
2597
2599
 
2598
2600
  /**
2599
- * The access pass for the plan.
2601
+ * The product that this plan belongs to.
2600
2602
  */
2601
2603
  export interface Product {
2602
2604
  /**
@@ -2612,12 +2614,12 @@ export namespace Plan {
2612
2614
  }
2613
2615
 
2614
2616
  /**
2615
- * The type of plan that can be attached to an access pass
2617
+ * The type of plan that can be attached to a product
2616
2618
  */
2617
2619
  export type PlanType = 'renewal' | 'one_time';
2618
2620
 
2619
2621
  /**
2620
- * An object representing a (sanitized) access pass.
2622
+ * Represents a product on whop. Use products to sell anything on the platform.
2621
2623
  */
2622
2624
  export interface Product {
2623
2625
  /**
@@ -2808,7 +2810,7 @@ export namespace Product {
2808
2810
  }
2809
2811
 
2810
2812
  /**
2811
- * An object representing a (sanitized) access pass.
2813
+ * Represents a product on whop. Use products to sell anything on the platform.
2812
2814
  */
2813
2815
  export interface ProductListItem {
2814
2816
  /**
@@ -91,6 +91,9 @@ export interface UserCheckAccessResponse {
91
91
  }
92
92
 
93
93
  export interface UserCheckAccessParams {
94
+ /**
95
+ * The ID (user_xxx) or username of the user
96
+ */
94
97
  id: string;
95
98
  }
96
99
 
package/src/version.ts CHANGED
@@ -1 +1 @@
1
- export const VERSION = '0.0.4'; // x-release-please-version
1
+ export const VERSION = '0.0.6'; // x-release-please-version
package/version.d.mts CHANGED
@@ -1,2 +1,2 @@
1
- export declare const VERSION = "0.0.4";
1
+ export declare const VERSION = "0.0.6";
2
2
  //# sourceMappingURL=version.d.mts.map
package/version.d.ts CHANGED
@@ -1,2 +1,2 @@
1
- export declare const VERSION = "0.0.4";
1
+ export declare const VERSION = "0.0.6";
2
2
  //# sourceMappingURL=version.d.ts.map
package/version.js CHANGED
@@ -1,5 +1,5 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.VERSION = void 0;
4
- exports.VERSION = '0.0.4'; // x-release-please-version
4
+ exports.VERSION = '0.0.6'; // x-release-please-version
5
5
  //# sourceMappingURL=version.js.map
package/version.mjs CHANGED
@@ -1,2 +1,2 @@
1
- export const VERSION = '0.0.4'; // x-release-please-version
1
+ export const VERSION = '0.0.6'; // x-release-please-version
2
2
  //# sourceMappingURL=version.mjs.map