@whop/sdk 0.0.6 → 0.0.7

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 (78) hide show
  1. package/CHANGELOG.md +28 -0
  2. package/client.d.mts +5 -2
  3. package/client.d.mts.map +1 -1
  4. package/client.d.ts +5 -2
  5. package/client.d.ts.map +1 -1
  6. package/client.js +3 -0
  7. package/client.js.map +1 -1
  8. package/client.mjs +3 -0
  9. package/client.mjs.map +1 -1
  10. package/package.json +1 -1
  11. package/resources/access-tokens.d.mts +48 -26
  12. package/resources/access-tokens.d.mts.map +1 -1
  13. package/resources/access-tokens.d.ts +48 -26
  14. package/resources/access-tokens.d.ts.map +1 -1
  15. package/resources/access-tokens.js +5 -5
  16. package/resources/access-tokens.mjs +5 -5
  17. package/resources/checkout-configurations.d.mts +4 -4
  18. package/resources/checkout-configurations.d.mts.map +1 -1
  19. package/resources/checkout-configurations.d.ts +4 -4
  20. package/resources/checkout-configurations.d.ts.map +1 -1
  21. package/resources/disputes.d.mts +704 -0
  22. package/resources/disputes.d.mts.map +1 -0
  23. package/resources/disputes.d.ts +704 -0
  24. package/resources/disputes.d.ts.map +1 -0
  25. package/resources/disputes.js +77 -0
  26. package/resources/disputes.js.map +1 -0
  27. package/resources/disputes.mjs +73 -0
  28. package/resources/disputes.mjs.map +1 -0
  29. package/resources/forum-posts.d.mts +8 -0
  30. package/resources/forum-posts.d.mts.map +1 -1
  31. package/resources/forum-posts.d.ts +8 -0
  32. package/resources/forum-posts.d.ts.map +1 -1
  33. package/resources/index.d.mts +2 -1
  34. package/resources/index.d.mts.map +1 -1
  35. package/resources/index.d.ts +2 -1
  36. package/resources/index.d.ts.map +1 -1
  37. package/resources/index.js +3 -1
  38. package/resources/index.js.map +1 -1
  39. package/resources/index.mjs +1 -0
  40. package/resources/index.mjs.map +1 -1
  41. package/resources/ledger-accounts.d.mts +1 -1
  42. package/resources/ledger-accounts.d.mts.map +1 -1
  43. package/resources/ledger-accounts.d.ts +1 -1
  44. package/resources/ledger-accounts.d.ts.map +1 -1
  45. package/resources/payments.d.mts +1 -1
  46. package/resources/payments.d.mts.map +1 -1
  47. package/resources/payments.d.ts +1 -1
  48. package/resources/payments.d.ts.map +1 -1
  49. package/resources/shared.d.mts +3 -3
  50. package/resources/shared.d.mts.map +1 -1
  51. package/resources/shared.d.ts +3 -3
  52. package/resources/shared.d.ts.map +1 -1
  53. package/resources/shipments.d.mts +1 -1
  54. package/resources/shipments.d.mts.map +1 -1
  55. package/resources/shipments.d.ts +1 -1
  56. package/resources/shipments.d.ts.map +1 -1
  57. package/resources/webhooks.d.mts +47 -2
  58. package/resources/webhooks.d.mts.map +1 -1
  59. package/resources/webhooks.d.ts +47 -2
  60. package/resources/webhooks.d.ts.map +1 -1
  61. package/resources/webhooks.js.map +1 -1
  62. package/resources/webhooks.mjs.map +1 -1
  63. package/src/client.ts +25 -0
  64. package/src/resources/access-tokens.ts +53 -26
  65. package/src/resources/checkout-configurations.ts +4 -4
  66. package/src/resources/disputes.ts +873 -0
  67. package/src/resources/forum-posts.ts +10 -0
  68. package/src/resources/index.ts +11 -0
  69. package/src/resources/ledger-accounts.ts +1 -0
  70. package/src/resources/payments.ts +1 -0
  71. package/src/resources/shared.ts +13 -3
  72. package/src/resources/shipments.ts +1 -1
  73. package/src/resources/webhooks.ts +60 -1
  74. package/src/version.ts +1 -1
  75. package/version.d.mts +1 -1
  76. package/version.d.ts +1 -1
  77. package/version.js +1 -1
  78. package/version.mjs +1 -1
package/src/client.ts CHANGED
@@ -110,6 +110,15 @@ import {
110
110
  Courses,
111
111
  Languages,
112
112
  } from './resources/courses';
113
+ import {
114
+ Dispute,
115
+ DisputeListParams,
116
+ DisputeListResponse,
117
+ DisputeListResponsesCursorPage,
118
+ DisputeStatuses,
119
+ DisputeUpdateEvidenceParams,
120
+ Disputes,
121
+ } from './resources/disputes';
113
122
  import {
114
123
  Entries,
115
124
  EntryApproveResponse,
@@ -256,6 +265,8 @@ import {
256
265
  } from './resources/users';
257
266
  import {
258
267
  CourseLessonInteractionCompletedWebhookEvent,
268
+ DisputeCreatedWebhookEvent,
269
+ DisputeUpdatedWebhookEvent,
259
270
  EntryApprovedWebhookEvent,
260
271
  EntryCreatedWebhookEvent,
261
272
  EntryDeletedWebhookEvent,
@@ -1031,6 +1042,7 @@ export class Whop {
1031
1042
  courseStudents: API.CourseStudents = new API.CourseStudents(this);
1032
1043
  accessTokens: API.AccessTokens = new API.AccessTokens(this);
1033
1044
  notifications: API.Notifications = new API.Notifications(this);
1045
+ disputes: API.Disputes = new API.Disputes(this);
1034
1046
  }
1035
1047
 
1036
1048
  Whop.Apps = Apps;
@@ -1066,6 +1078,7 @@ Whop.Reviews = Reviews;
1066
1078
  Whop.CourseStudents = CourseStudents;
1067
1079
  Whop.AccessTokens = AccessTokens;
1068
1080
  Whop.Notifications = Notifications;
1081
+ Whop.Disputes = Disputes;
1069
1082
 
1070
1083
  export declare namespace Whop {
1071
1084
  export type RequestOptions = Opts.RequestOptions;
@@ -1126,6 +1139,8 @@ export declare namespace Whop {
1126
1139
  type PaymentSucceededWebhookEvent as PaymentSucceededWebhookEvent,
1127
1140
  type PaymentFailedWebhookEvent as PaymentFailedWebhookEvent,
1128
1141
  type PaymentPendingWebhookEvent as PaymentPendingWebhookEvent,
1142
+ type DisputeCreatedWebhookEvent as DisputeCreatedWebhookEvent,
1143
+ type DisputeUpdatedWebhookEvent as DisputeUpdatedWebhookEvent,
1129
1144
  type UnwrapWebhookEvent as UnwrapWebhookEvent,
1130
1145
  };
1131
1146
 
@@ -1371,6 +1386,16 @@ export declare namespace Whop {
1371
1386
  type NotificationCreateParams as NotificationCreateParams,
1372
1387
  };
1373
1388
 
1389
+ export {
1390
+ Disputes as Disputes,
1391
+ type Dispute as Dispute,
1392
+ type DisputeStatuses as DisputeStatuses,
1393
+ type DisputeListResponse as DisputeListResponse,
1394
+ type DisputeListResponsesCursorPage as DisputeListResponsesCursorPage,
1395
+ type DisputeListParams as DisputeListParams,
1396
+ type DisputeUpdateEvidenceParams as DisputeUpdateEvidenceParams,
1397
+ };
1398
+
1374
1399
  export type AccessLevel = API.AccessLevel;
1375
1400
  export type AccessPassType = API.AccessPassType;
1376
1401
  export type App = API.App;
@@ -6,15 +6,15 @@ import { RequestOptions } from '../internal/request-options';
6
6
 
7
7
  export class AccessTokens extends APIResource {
8
8
  /**
9
- * Creates an access token for a user to access a specific resource. These access
10
- * tokens are designed to be used with Whop's embedded components.
9
+ * Create a short-lived access token to authenticate API requests on behalf of a
10
+ * Company or User. This token should be used with Whop's web and mobile embedded
11
+ * components. You must provide either a company_id or a user_id argument, but not
12
+ * both.
11
13
  *
12
14
  * @example
13
15
  * ```ts
14
16
  * const accessToken = await client.accessTokens.create({
15
- * scoped_actions: ['string'],
16
- * target_resource_id: 'target_resource_id',
17
- * target_resource_type: 'company',
17
+ * company_id: 'biz_xxxxxxxxxxxxxx',
18
18
  * });
19
19
  * ```
20
20
  */
@@ -38,30 +38,57 @@ export interface AccessTokenCreateResponse {
38
38
  expires_at: string;
39
39
  }
40
40
 
41
- export interface AccessTokenCreateParams {
42
- /**
43
- * Array of desired scoped actions for the access token. This list must be a subset
44
- * of the API keys's existing permissions. Otherwise, an error will be raised.
45
- */
46
- scoped_actions: Array<string>;
41
+ export type AccessTokenCreateParams =
42
+ | AccessTokenCreateParams.CreateAccessTokenInputWithCompanyID
43
+ | AccessTokenCreateParams.CreateAccessTokenInputWithUserID;
47
44
 
48
- /**
49
- * The ID of the target resource (Company, User, etc.) for which the access token
50
- * is being created.
51
- */
52
- target_resource_id: string;
45
+ export declare namespace AccessTokenCreateParams {
46
+ export interface CreateAccessTokenInputWithCompanyID {
47
+ /**
48
+ * The ID of the Company to generate the token for. The API key must have
49
+ * permission to access this Company, such as the being the company the API key
50
+ * belongs to or a sub-merchant of it
51
+ */
52
+ company_id: string;
53
53
 
54
- /**
55
- * The type of the target resource (company, user, product, experience, etc.).
56
- */
57
- target_resource_type: 'company' | 'product' | 'experience' | 'app' | 'user';
54
+ /**
55
+ * The expiration timestamp for the access token. If not provided, a default
56
+ * expiration time of 1 hour will be used. The expiration can be set to a maximum
57
+ * of 3 hours from the current time.
58
+ */
59
+ expires_at?: string | null;
58
60
 
59
- /**
60
- * The expiration timestamp for the access token. If not provided, a default
61
- * expiration time of 1 hour will be used. The expiration can be set to a maximum
62
- * of 3 hours from the current time.
63
- */
64
- expires_at?: string | null;
61
+ /**
62
+ * Array of desired scoped actions for the access token. If sent as an empty array
63
+ * or not provided, all permissions from the API key making the request will be
64
+ * available on the token. If sending an explicit list, they must be a subset of
65
+ * the API keys's existing permissions. Otherwise, an error will be raised.
66
+ */
67
+ scoped_actions?: Array<string> | null;
68
+ }
69
+
70
+ export interface CreateAccessTokenInputWithUserID {
71
+ /**
72
+ * The ID of the User to generate the token for. The API key must have permission
73
+ * to access this User.
74
+ */
75
+ user_id: string;
76
+
77
+ /**
78
+ * The expiration timestamp for the access token. If not provided, a default
79
+ * expiration time of 1 hour will be used. The expiration can be set to a maximum
80
+ * of 3 hours from the current time.
81
+ */
82
+ expires_at?: string | null;
83
+
84
+ /**
85
+ * Array of desired scoped actions for the access token. If sent as an empty array
86
+ * or not provided, all permissions from the API key making the request will be
87
+ * available on the token. If sending an explicit list, they must be a subset of
88
+ * the API keys's existing permissions. Otherwise, an error will be raised.
89
+ */
90
+ scoped_actions?: Array<string> | null;
91
+ }
65
92
  }
66
93
 
67
94
  export declare namespace AccessTokens {
@@ -205,14 +205,14 @@ export declare namespace CheckoutConfigurationCreateParams {
205
205
  company_id: string;
206
206
 
207
207
  /**
208
- * The interval at which the plan charges (renewal plans).
208
+ * The respective currency identifier for the plan.
209
209
  */
210
- billing_period?: number | null;
210
+ currency: Shared.Currency;
211
211
 
212
212
  /**
213
- * The available currencies on the platform
213
+ * The interval at which the plan charges (renewal plans).
214
214
  */
215
- currency?: Shared.Currency | null;
215
+ billing_period?: number | null;
216
216
 
217
217
  /**
218
218
  * An array of custom field objects.