@whop/sdk 0.0.25 → 0.0.27
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 +58 -0
- package/client.d.mts +29 -25
- package/client.d.mts.map +1 -1
- package/client.d.ts +29 -25
- package/client.d.ts.map +1 -1
- package/client.js +14 -3
- package/client.js.map +1 -1
- package/client.mjs +16 -5
- package/client.mjs.map +1 -1
- package/internal/parse.d.mts.map +1 -1
- package/internal/parse.d.ts.map +1 -1
- package/internal/parse.js +5 -0
- package/internal/parse.js.map +1 -1
- package/internal/parse.mjs +5 -0
- package/internal/parse.mjs.map +1 -1
- package/package.json +3 -3
- package/resources/access-tokens.d.mts +32 -51
- package/resources/access-tokens.d.mts.map +1 -1
- package/resources/access-tokens.d.ts +32 -51
- package/resources/access-tokens.d.ts.map +1 -1
- package/resources/access-tokens.js +6 -8
- package/resources/access-tokens.js.map +1 -1
- package/resources/access-tokens.mjs +6 -8
- package/resources/access-tokens.mjs.map +1 -1
- package/resources/ai-chats.d.mts +36 -104
- package/resources/ai-chats.d.mts.map +1 -1
- package/resources/ai-chats.d.ts +36 -104
- package/resources/ai-chats.d.ts.map +1 -1
- package/resources/ai-chats.js +1 -1
- package/resources/ai-chats.js.map +1 -1
- package/resources/ai-chats.mjs +1 -1
- package/resources/ai-chats.mjs.map +1 -1
- package/resources/app-builds.d.mts +2 -2
- package/resources/app-builds.d.ts +2 -2
- package/resources/apps.d.mts +5 -4
- package/resources/apps.d.mts.map +1 -1
- package/resources/apps.d.ts +5 -4
- package/resources/apps.d.ts.map +1 -1
- package/resources/authorized-users.d.mts +43 -9
- package/resources/authorized-users.d.mts.map +1 -1
- package/resources/authorized-users.d.ts +43 -9
- package/resources/authorized-users.d.ts.map +1 -1
- package/resources/authorized-users.js +1 -1
- package/resources/authorized-users.js.map +1 -1
- package/resources/authorized-users.mjs +1 -1
- package/resources/authorized-users.mjs.map +1 -1
- package/resources/chat-channels.d.mts +1 -1
- package/resources/chat-channels.d.ts +1 -1
- package/resources/checkout-configurations.d.mts +24 -16
- package/resources/checkout-configurations.d.mts.map +1 -1
- package/resources/checkout-configurations.d.ts +24 -16
- package/resources/checkout-configurations.d.ts.map +1 -1
- package/resources/companies.d.mts +38 -25
- package/resources/companies.d.mts.map +1 -1
- package/resources/companies.d.ts +38 -25
- package/resources/companies.d.ts.map +1 -1
- package/resources/companies.js +7 -4
- package/resources/companies.js.map +1 -1
- package/resources/companies.mjs +7 -4
- package/resources/companies.mjs.map +1 -1
- package/resources/company-token-transactions.d.mts +23 -109
- package/resources/company-token-transactions.d.mts.map +1 -1
- package/resources/company-token-transactions.d.ts +23 -109
- package/resources/company-token-transactions.d.ts.map +1 -1
- package/resources/course-chapters.d.mts +3 -3
- package/resources/course-chapters.d.ts +3 -3
- package/resources/course-lessons.d.mts +15 -15
- package/resources/course-lessons.d.ts +15 -15
- package/resources/course-students.d.mts +6 -6
- package/resources/course-students.d.ts +6 -6
- package/resources/courses.d.mts +8 -8
- package/resources/courses.d.ts +8 -8
- package/resources/disputes.d.mts +20 -18
- package/resources/disputes.d.mts.map +1 -1
- package/resources/disputes.d.ts +20 -18
- package/resources/disputes.d.ts.map +1 -1
- package/resources/dm-channels.d.mts +161 -0
- package/resources/dm-channels.d.mts.map +1 -0
- package/resources/dm-channels.d.ts +161 -0
- package/resources/dm-channels.d.ts.map +1 -0
- package/resources/dm-channels.js +87 -0
- package/resources/dm-channels.js.map +1 -0
- package/resources/dm-channels.mjs +83 -0
- package/resources/dm-channels.mjs.map +1 -0
- package/resources/dm-members.d.mts +14 -66
- package/resources/dm-members.d.mts.map +1 -1
- package/resources/dm-members.d.ts +14 -66
- package/resources/dm-members.d.ts.map +1 -1
- package/resources/entries.d.mts +6 -6
- package/resources/entries.d.ts +6 -6
- package/resources/experiences.d.mts +6 -5
- package/resources/experiences.d.mts.map +1 -1
- package/resources/experiences.d.ts +6 -5
- package/resources/experiences.d.ts.map +1 -1
- package/resources/fee-markups.d.mts +6 -6
- package/resources/fee-markups.d.ts +6 -6
- package/resources/files.d.mts +9 -5
- package/resources/files.d.mts.map +1 -1
- package/resources/files.d.ts +9 -5
- package/resources/files.d.ts.map +1 -1
- package/resources/forum-posts.d.mts +8 -4
- package/resources/forum-posts.d.mts.map +1 -1
- package/resources/forum-posts.d.ts +8 -4
- package/resources/forum-posts.d.ts.map +1 -1
- package/resources/forums.d.mts +1 -1
- package/resources/forums.d.ts +1 -1
- package/resources/index.d.mts +12 -11
- package/resources/index.d.mts.map +1 -1
- package/resources/index.d.ts +12 -11
- package/resources/index.d.ts.map +1 -1
- package/resources/index.js +3 -1
- package/resources/index.js.map +1 -1
- package/resources/index.mjs +3 -2
- package/resources/index.mjs.map +1 -1
- package/resources/invoices.d.mts +28 -20
- package/resources/invoices.d.mts.map +1 -1
- package/resources/invoices.d.ts +28 -20
- package/resources/invoices.d.ts.map +1 -1
- package/resources/leads.d.mts +21 -189
- package/resources/leads.d.mts.map +1 -1
- package/resources/leads.d.ts +21 -189
- package/resources/leads.d.ts.map +1 -1
- package/resources/ledger-accounts.d.mts +12 -9
- package/resources/ledger-accounts.d.mts.map +1 -1
- package/resources/ledger-accounts.d.ts +12 -9
- package/resources/ledger-accounts.d.ts.map +1 -1
- package/resources/ledger-accounts.js.map +1 -1
- package/resources/ledger-accounts.mjs.map +1 -1
- package/resources/members.d.mts +14 -14
- package/resources/members.d.mts.map +1 -1
- package/resources/members.d.ts +14 -14
- package/resources/members.d.ts.map +1 -1
- package/resources/members.js +1 -1
- package/resources/members.js.map +1 -1
- package/resources/members.mjs +1 -1
- package/resources/members.mjs.map +1 -1
- package/resources/memberships.d.mts +25 -15
- package/resources/memberships.d.mts.map +1 -1
- package/resources/memberships.d.ts +25 -15
- package/resources/memberships.d.ts.map +1 -1
- package/resources/messages.d.mts +7 -3
- package/resources/messages.d.mts.map +1 -1
- package/resources/messages.d.ts +7 -3
- package/resources/messages.d.ts.map +1 -1
- package/resources/payments.d.mts +59 -19
- package/resources/payments.d.mts.map +1 -1
- package/resources/payments.d.ts +59 -19
- package/resources/payments.d.ts.map +1 -1
- package/resources/payout-methods.d.mts +14 -9
- package/resources/payout-methods.d.mts.map +1 -1
- package/resources/payout-methods.d.ts +14 -9
- package/resources/payout-methods.d.ts.map +1 -1
- package/resources/payout-methods.js.map +1 -1
- package/resources/payout-methods.mjs.map +1 -1
- package/resources/plans.d.mts +34 -24
- package/resources/plans.d.mts.map +1 -1
- package/resources/plans.d.ts +34 -24
- package/resources/plans.d.ts.map +1 -1
- package/resources/products.d.mts +4 -2
- package/resources/products.d.mts.map +1 -1
- package/resources/products.d.ts +4 -2
- package/resources/products.d.ts.map +1 -1
- package/resources/promo-codes.d.mts +22 -12
- package/resources/promo-codes.d.mts.map +1 -1
- package/resources/promo-codes.d.ts +22 -12
- package/resources/promo-codes.d.ts.map +1 -1
- package/resources/reactions.d.mts +1 -1
- package/resources/reactions.d.ts +1 -1
- package/resources/refunds.d.mts +19 -15
- package/resources/refunds.d.mts.map +1 -1
- package/resources/refunds.d.ts +19 -15
- package/resources/refunds.d.ts.map +1 -1
- package/resources/reviews.d.mts +10 -10
- package/resources/reviews.d.ts +10 -10
- package/resources/setup-intents.d.mts +18 -20
- package/resources/setup-intents.d.mts.map +1 -1
- package/resources/setup-intents.d.ts +18 -20
- package/resources/setup-intents.d.ts.map +1 -1
- package/resources/shared.d.mts +209 -137
- package/resources/shared.d.mts.map +1 -1
- package/resources/shared.d.ts +209 -137
- package/resources/shared.d.ts.map +1 -1
- package/resources/shipments.d.mts +4 -4
- package/resources/shipments.d.ts +4 -4
- package/resources/support-channels.d.mts +1 -1
- package/resources/support-channels.d.ts +1 -1
- package/resources/topups.d.mts +6 -4
- package/resources/topups.d.mts.map +1 -1
- package/resources/topups.d.ts +6 -4
- package/resources/topups.d.ts.map +1 -1
- package/resources/transfers.d.mts +8 -5
- package/resources/transfers.d.mts.map +1 -1
- package/resources/transfers.d.ts +8 -5
- package/resources/transfers.d.ts.map +1 -1
- package/resources/users.d.mts +46 -8
- package/resources/users.d.mts.map +1 -1
- package/resources/users.d.ts +46 -8
- package/resources/users.d.ts.map +1 -1
- package/resources/users.js +10 -0
- package/resources/users.js.map +1 -1
- package/resources/users.mjs +10 -0
- package/resources/users.mjs.map +1 -1
- package/resources/verifications.d.mts +12 -4
- package/resources/verifications.d.mts.map +1 -1
- package/resources/verifications.d.ts +12 -4
- package/resources/verifications.d.ts.map +1 -1
- package/resources/webhooks.d.mts +105 -350
- package/resources/webhooks.d.mts.map +1 -1
- package/resources/webhooks.d.ts +105 -350
- package/resources/webhooks.d.ts.map +1 -1
- package/resources/webhooks.js.map +1 -1
- package/resources/webhooks.mjs +2 -2
- package/resources/webhooks.mjs.map +1 -1
- package/resources/withdrawals.d.mts +32 -139
- package/resources/withdrawals.d.mts.map +1 -1
- package/resources/withdrawals.d.ts +32 -139
- package/resources/withdrawals.d.ts.map +1 -1
- package/src/client.ts +87 -41
- package/src/internal/parse.ts +6 -0
- package/src/resources/access-tokens.ts +35 -56
- package/src/resources/ai-chats.ts +36 -122
- package/src/resources/app-builds.ts +2 -2
- package/src/resources/apps.ts +5 -4
- package/src/resources/authorized-users.ts +49 -9
- package/src/resources/chat-channels.ts +1 -1
- package/src/resources/checkout-configurations.ts +24 -16
- package/src/resources/companies.ts +41 -26
- package/src/resources/company-token-transactions.ts +24 -126
- package/src/resources/course-chapters.ts +3 -3
- package/src/resources/course-lessons.ts +15 -15
- package/src/resources/course-students.ts +6 -6
- package/src/resources/courses.ts +8 -8
- package/src/resources/disputes.ts +20 -18
- package/src/resources/dm-channels.ts +212 -0
- package/src/resources/dm-members.ts +16 -78
- package/src/resources/entries.ts +6 -6
- package/src/resources/experiences.ts +6 -5
- package/src/resources/fee-markups.ts +6 -6
- package/src/resources/files.ts +10 -4
- package/src/resources/forum-posts.ts +8 -4
- package/src/resources/forums.ts +1 -1
- package/src/resources/index.ts +38 -18
- package/src/resources/invoices.ts +28 -20
- package/src/resources/leads.ts +21 -217
- package/src/resources/ledger-accounts.ts +12 -42
- package/src/resources/members.ts +15 -15
- package/src/resources/memberships.ts +34 -30
- package/src/resources/messages.ts +7 -3
- package/src/resources/payments.ts +67 -17
- package/src/resources/payout-methods.ts +21 -8
- package/src/resources/plans.ts +34 -24
- package/src/resources/products.ts +4 -2
- package/src/resources/promo-codes.ts +22 -12
- package/src/resources/reactions.ts +1 -1
- package/src/resources/refunds.ts +20 -15
- package/src/resources/reviews.ts +10 -10
- package/src/resources/setup-intents.ts +18 -20
- package/src/resources/shared.ts +217 -145
- package/src/resources/shipments.ts +4 -4
- package/src/resources/support-channels.ts +1 -1
- package/src/resources/topups.ts +6 -4
- package/src/resources/transfers.ts +8 -5
- package/src/resources/users.ts +58 -8
- package/src/resources/verifications.ts +50 -37
- package/src/resources/webhooks.ts +138 -785
- package/src/resources/withdrawals.ts +39 -216
- 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
|
@@ -21,7 +21,7 @@ export declare class Withdrawals extends APIResource {
|
|
|
21
21
|
* });
|
|
22
22
|
* ```
|
|
23
23
|
*/
|
|
24
|
-
create(body: WithdrawalCreateParams, options?: RequestOptions): APIPromise<
|
|
24
|
+
create(body: WithdrawalCreateParams, options?: RequestOptions): APIPromise<Withdrawal>;
|
|
25
25
|
/**
|
|
26
26
|
* Retrieves a withdrawal by ID
|
|
27
27
|
*
|
|
@@ -37,7 +37,7 @@ export declare class Withdrawals extends APIResource {
|
|
|
37
37
|
* );
|
|
38
38
|
* ```
|
|
39
39
|
*/
|
|
40
|
-
retrieve(id: string, options?: RequestOptions): APIPromise<
|
|
40
|
+
retrieve(id: string, options?: RequestOptions): APIPromise<Withdrawal>;
|
|
41
41
|
/**
|
|
42
42
|
* Lists withdrawals
|
|
43
43
|
*
|
|
@@ -59,31 +59,21 @@ export declare class Withdrawals extends APIResource {
|
|
|
59
59
|
}
|
|
60
60
|
export type WithdrawalListResponsesCursorPage = CursorPage<WithdrawalListResponse>;
|
|
61
61
|
/**
|
|
62
|
-
*
|
|
63
|
-
|
|
64
|
-
export type WithdrawalFeeTypes = 'exclusive' | 'inclusive';
|
|
65
|
-
/**
|
|
66
|
-
* The different speeds of withdrawals
|
|
62
|
+
* A withdrawal represents a request to transfer funds from a company's ledger
|
|
63
|
+
* account to an external payout method.
|
|
67
64
|
*/
|
|
68
|
-
export
|
|
69
|
-
/**
|
|
70
|
-
* The status of a withdrawal request
|
|
71
|
-
*/
|
|
72
|
-
export type WithdrawalStatus = 'requested' | 'awaiting_payment' | 'in_transit' | 'completed' | 'failed' | 'canceled' | 'denied';
|
|
73
|
-
/**
|
|
74
|
-
* A withdrawal request.
|
|
75
|
-
*/
|
|
76
|
-
export interface WithdrawalCreateResponse {
|
|
65
|
+
export interface Withdrawal {
|
|
77
66
|
/**
|
|
78
|
-
*
|
|
67
|
+
* The unique identifier for the withdrawal.
|
|
79
68
|
*/
|
|
80
69
|
id: string;
|
|
81
70
|
/**
|
|
82
|
-
*
|
|
71
|
+
* The withdrawal amount. Provided as a number in the specified currency. Eg:
|
|
72
|
+
* 100.00 for $100.00 USD.
|
|
83
73
|
*/
|
|
84
74
|
amount: number;
|
|
85
75
|
/**
|
|
86
|
-
*
|
|
76
|
+
* The datetime the withdrawal was created.
|
|
87
77
|
*/
|
|
88
78
|
created_at: string;
|
|
89
79
|
/**
|
|
@@ -114,7 +104,7 @@ export interface WithdrawalCreateResponse {
|
|
|
114
104
|
/**
|
|
115
105
|
* The ledger account associated with the withdrawal.
|
|
116
106
|
*/
|
|
117
|
-
ledger_account:
|
|
107
|
+
ledger_account: Withdrawal.LedgerAccount;
|
|
118
108
|
/**
|
|
119
109
|
* The markup fee that was charged for the withdrawal. This is in the same currency
|
|
120
110
|
* as the withdrawal amount. This only applies to platform accounts using Whop
|
|
@@ -124,7 +114,7 @@ export interface WithdrawalCreateResponse {
|
|
|
124
114
|
/**
|
|
125
115
|
* The payout token used for the withdrawal, if applicable.
|
|
126
116
|
*/
|
|
127
|
-
payout_token:
|
|
117
|
+
payout_token: Withdrawal.PayoutToken | null;
|
|
128
118
|
/**
|
|
129
119
|
* The speed of the withdrawal.
|
|
130
120
|
*/
|
|
@@ -139,13 +129,13 @@ export interface WithdrawalCreateResponse {
|
|
|
139
129
|
*/
|
|
140
130
|
trace_code: string | null;
|
|
141
131
|
}
|
|
142
|
-
export declare namespace
|
|
132
|
+
export declare namespace Withdrawal {
|
|
143
133
|
/**
|
|
144
134
|
* The ledger account associated with the withdrawal.
|
|
145
135
|
*/
|
|
146
136
|
interface LedgerAccount {
|
|
147
137
|
/**
|
|
148
|
-
* The
|
|
138
|
+
* The unique identifier for the ledger account.
|
|
149
139
|
*/
|
|
150
140
|
id: string;
|
|
151
141
|
/**
|
|
@@ -158,11 +148,11 @@ export declare namespace WithdrawalCreateResponse {
|
|
|
158
148
|
*/
|
|
159
149
|
interface PayoutToken {
|
|
160
150
|
/**
|
|
161
|
-
* The
|
|
151
|
+
* The unique identifier for the payout token.
|
|
162
152
|
*/
|
|
163
153
|
id: string;
|
|
164
154
|
/**
|
|
165
|
-
* The
|
|
155
|
+
* The datetime the payout token was created.
|
|
166
156
|
*/
|
|
167
157
|
created_at: string;
|
|
168
158
|
/**
|
|
@@ -182,130 +172,33 @@ export declare namespace WithdrawalCreateResponse {
|
|
|
182
172
|
}
|
|
183
173
|
}
|
|
184
174
|
/**
|
|
185
|
-
*
|
|
175
|
+
* The different fee types for a withdrawal.
|
|
186
176
|
*/
|
|
187
|
-
export
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
/**
|
|
197
|
-
* When the withdrawal request was created.
|
|
198
|
-
*/
|
|
199
|
-
created_at: string;
|
|
200
|
-
/**
|
|
201
|
-
* The currency of the withdrawal request.
|
|
202
|
-
*/
|
|
203
|
-
currency: Shared.Currency;
|
|
204
|
-
/**
|
|
205
|
-
* The different error codes a payout can be in.
|
|
206
|
-
*/
|
|
207
|
-
error_code: 'account_closed' | 'account_does_not_exist' | 'account_information_invalid' | 'account_number_invalid_region' | 'account_frozen' | 'account_lookup_failed' | 'account_not_found' | 'amount_out_of_bounds' | 'attributes_not_validated' | 'b2b_payments_prohibited' | 'bank_statement_required' | 'compliance_review' | 'currency_not_supported' | 'deposit_canceled' | 'deposit_failed' | 'deposit_rejected' | 'destination_unavailable' | 'exceeded_account_limit' | 'expired_quote' | 'generic_payout_error' | 'technical_problem' | 'identification_number_invalid' | 'invalid_account_number' | 'invalid_bank_code' | 'invalid_beneficiary' | 'invalid_mailing_address' | 'invalid_branch_number' | 'invalid_branch_code' | 'invalid_phone_number' | 'invalid_routing_number' | 'invalid_swift_code' | 'invalid_company_details' | 'manual_cancelation' | 'misc_error' | 'missing_city_and_country' | 'missing_phone_number' | 'missing_remittance_info' | 'payee_name_invalid' | 'receiving_account_locked' | 'rejected_by_compliance' | 'rtp_not_supported' | 'non_transaction_account' | 'source_token_insufficient_funds' | 'ssn_invalid' | 'wallet_screenshot_required' | 'unsupported_region' | null;
|
|
208
|
-
/**
|
|
209
|
-
* The error message for the withdrawal, if any.
|
|
210
|
-
*/
|
|
211
|
-
error_message: string | null;
|
|
212
|
-
/**
|
|
213
|
-
* The estimated availability date for the withdrawal, if any.
|
|
214
|
-
*/
|
|
215
|
-
estimated_availability: string | null;
|
|
216
|
-
/**
|
|
217
|
-
* The fee amount that was charged for the withdrawal. This is in the same currency
|
|
218
|
-
* as the withdrawal amount.
|
|
219
|
-
*/
|
|
220
|
-
fee_amount: number;
|
|
221
|
-
/**
|
|
222
|
-
* The different fee types for a withdrawal.
|
|
223
|
-
*/
|
|
224
|
-
fee_type: WithdrawalFeeTypes | null;
|
|
225
|
-
/**
|
|
226
|
-
* The ledger account associated with the withdrawal.
|
|
227
|
-
*/
|
|
228
|
-
ledger_account: WithdrawalRetrieveResponse.LedgerAccount;
|
|
229
|
-
/**
|
|
230
|
-
* The markup fee that was charged for the withdrawal. This is in the same currency
|
|
231
|
-
* as the withdrawal amount. This only applies to platform accounts using Whop
|
|
232
|
-
* Rails.
|
|
233
|
-
*/
|
|
234
|
-
markup_fee: number;
|
|
235
|
-
/**
|
|
236
|
-
* The payout token used for the withdrawal, if applicable.
|
|
237
|
-
*/
|
|
238
|
-
payout_token: WithdrawalRetrieveResponse.PayoutToken | null;
|
|
239
|
-
/**
|
|
240
|
-
* The speed of the withdrawal.
|
|
241
|
-
*/
|
|
242
|
-
speed: WithdrawalSpeeds;
|
|
243
|
-
/**
|
|
244
|
-
* Status of the withdrawal.
|
|
245
|
-
*/
|
|
246
|
-
status: WithdrawalStatus;
|
|
247
|
-
/**
|
|
248
|
-
* The trace code for the payout, if applicable. Provided on ACH transactions when
|
|
249
|
-
* available.
|
|
250
|
-
*/
|
|
251
|
-
trace_code: string | null;
|
|
252
|
-
}
|
|
253
|
-
export declare namespace WithdrawalRetrieveResponse {
|
|
254
|
-
/**
|
|
255
|
-
* The ledger account associated with the withdrawal.
|
|
256
|
-
*/
|
|
257
|
-
interface LedgerAccount {
|
|
258
|
-
/**
|
|
259
|
-
* The ID of the LedgerAccount.
|
|
260
|
-
*/
|
|
261
|
-
id: string;
|
|
262
|
-
/**
|
|
263
|
-
* The ID of the company associated with this ledger account.
|
|
264
|
-
*/
|
|
265
|
-
company_id: string | null;
|
|
266
|
-
}
|
|
267
|
-
/**
|
|
268
|
-
* The payout token used for the withdrawal, if applicable.
|
|
269
|
-
*/
|
|
270
|
-
interface PayoutToken {
|
|
271
|
-
/**
|
|
272
|
-
* The ID of the payout token
|
|
273
|
-
*/
|
|
274
|
-
id: string;
|
|
275
|
-
/**
|
|
276
|
-
* The date and time the payout token was created
|
|
277
|
-
*/
|
|
278
|
-
created_at: string;
|
|
279
|
-
/**
|
|
280
|
-
* The currency code of the payout destination. This is the currency that payouts
|
|
281
|
-
* will be made in for this token.
|
|
282
|
-
*/
|
|
283
|
-
destination_currency_code: string;
|
|
284
|
-
/**
|
|
285
|
-
* An optional nickname for the payout token to help the user identify it. This is
|
|
286
|
-
* not used by the provider and is only for the user's reference.
|
|
287
|
-
*/
|
|
288
|
-
nickname: string | null;
|
|
289
|
-
/**
|
|
290
|
-
* The name of the payer associated with the payout token.
|
|
291
|
-
*/
|
|
292
|
-
payer_name: string | null;
|
|
293
|
-
}
|
|
294
|
-
}
|
|
177
|
+
export type WithdrawalFeeTypes = 'exclusive' | 'inclusive';
|
|
178
|
+
/**
|
|
179
|
+
* The different speeds of withdrawals
|
|
180
|
+
*/
|
|
181
|
+
export type WithdrawalSpeeds = 'standard' | 'instant';
|
|
182
|
+
/**
|
|
183
|
+
* The status of a withdrawal request
|
|
184
|
+
*/
|
|
185
|
+
export type WithdrawalStatus = 'requested' | 'awaiting_payment' | 'in_transit' | 'completed' | 'failed' | 'canceled' | 'denied';
|
|
295
186
|
/**
|
|
296
|
-
* A withdrawal request
|
|
187
|
+
* A withdrawal represents a request to transfer funds from a company's ledger
|
|
188
|
+
* account to an external payout method.
|
|
297
189
|
*/
|
|
298
190
|
export interface WithdrawalListResponse {
|
|
299
191
|
/**
|
|
300
|
-
*
|
|
192
|
+
* The unique identifier for the withdrawal.
|
|
301
193
|
*/
|
|
302
194
|
id: string;
|
|
303
195
|
/**
|
|
304
|
-
*
|
|
196
|
+
* The withdrawal amount. Provided as a number in the specified currency. Eg:
|
|
197
|
+
* 100.00 for $100.00 USD.
|
|
305
198
|
*/
|
|
306
199
|
amount: number;
|
|
307
200
|
/**
|
|
308
|
-
*
|
|
201
|
+
* The datetime the withdrawal was created.
|
|
309
202
|
*/
|
|
310
203
|
created_at: string;
|
|
311
204
|
/**
|
|
@@ -394,6 +287,6 @@ export interface WithdrawalListParams extends CursorPageParams {
|
|
|
394
287
|
last?: number | null;
|
|
395
288
|
}
|
|
396
289
|
export declare namespace Withdrawals {
|
|
397
|
-
export { type
|
|
290
|
+
export { type Withdrawal as Withdrawal, type WithdrawalFeeTypes as WithdrawalFeeTypes, type WithdrawalSpeeds as WithdrawalSpeeds, type WithdrawalStatus as WithdrawalStatus, type WithdrawalListResponse as WithdrawalListResponse, type WithdrawalListResponsesCursorPage as WithdrawalListResponsesCursorPage, type WithdrawalCreateParams as WithdrawalCreateParams, type WithdrawalListParams as WithdrawalListParams, };
|
|
398
291
|
}
|
|
399
292
|
//# sourceMappingURL=withdrawals.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"withdrawals.d.ts","sourceRoot":"","sources":["../src/resources/withdrawals.ts"],"names":[],"mappings":"OAEO,EAAE,WAAW,EAAE;OACf,KAAK,MAAM;OACX,EAAE,UAAU,EAAE;OACd,EAAE,UAAU,EAAE,KAAK,gBAAgB,EAAE,WAAW,EAAE;OAClD,EAAE,cAAc,EAAE;AAGzB,qBAAa,WAAY,SAAQ,WAAW;IAC1C;;;;;;;;;;;;;;;;OAgBG;IACH,MAAM,CAAC,IAAI,EAAE,sBAAsB,EAAE,OAAO,CAAC,EAAE,cAAc,GAAG,UAAU,CAAC,
|
|
1
|
+
{"version":3,"file":"withdrawals.d.ts","sourceRoot":"","sources":["../src/resources/withdrawals.ts"],"names":[],"mappings":"OAEO,EAAE,WAAW,EAAE;OACf,KAAK,MAAM;OACX,EAAE,UAAU,EAAE;OACd,EAAE,UAAU,EAAE,KAAK,gBAAgB,EAAE,WAAW,EAAE;OAClD,EAAE,cAAc,EAAE;AAGzB,qBAAa,WAAY,SAAQ,WAAW;IAC1C;;;;;;;;;;;;;;;;OAgBG;IACH,MAAM,CAAC,IAAI,EAAE,sBAAsB,EAAE,OAAO,CAAC,EAAE,cAAc,GAAG,UAAU,CAAC,UAAU,CAAC;IAItF;;;;;;;;;;;;;;OAcG;IACH,QAAQ,CAAC,EAAE,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,cAAc,GAAG,UAAU,CAAC,UAAU,CAAC;IAItE;;;;;;;;;;;;;;;;OAgBG;IACH,IAAI,CACF,KAAK,EAAE,oBAAoB,EAC3B,OA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,IAAI,UAAU,EAC7B,KAAK,kBAAkB,IAAI,kBAAkB,EAC7C,KAAK,gBAAgB,IAAI,gBAAgB,EACzC,KAAK,gBAAgB,IAAI,gBAAgB,EACzC,KAAK,sBAAsB,IAAI,sBAAsB,EACrD,KAAK,iCAAiC,IAAI,iCAAiC,EAC3E,KAAK,sBAAsB,IAAI,sBAAsB,EACrD,KAAK,oBAAoB,IAAI,oBAAoB,GAClD,CAAC;CACH"}
|
package/src/client.ts
CHANGED
|
@@ -22,15 +22,13 @@ import { APIPromise } from './core/api-promise';
|
|
|
22
22
|
import { AccessTokenCreateParams, AccessTokenCreateResponse, AccessTokens } from './resources/access-tokens';
|
|
23
23
|
import { AccountLinkCreateParams, AccountLinkCreateResponse, AccountLinks } from './resources/account-links';
|
|
24
24
|
import {
|
|
25
|
+
AIChat,
|
|
25
26
|
AIChatCreateParams,
|
|
26
|
-
AIChatCreateResponse,
|
|
27
27
|
AIChatDeleteResponse,
|
|
28
28
|
AIChatListParams,
|
|
29
29
|
AIChatListResponse,
|
|
30
30
|
AIChatListResponsesCursorPage,
|
|
31
|
-
AIChatRetrieveResponse,
|
|
32
31
|
AIChatUpdateParams,
|
|
33
|
-
AIChatUpdateResponse,
|
|
34
32
|
AIChats,
|
|
35
33
|
} from './resources/ai-chats';
|
|
36
34
|
import {
|
|
@@ -80,12 +78,12 @@ import {
|
|
|
80
78
|
CompanyUpdateParams,
|
|
81
79
|
} from './resources/companies';
|
|
82
80
|
import {
|
|
81
|
+
BotTokenTransactionTypes,
|
|
82
|
+
CompanyTokenTransaction,
|
|
83
83
|
CompanyTokenTransactionCreateParams,
|
|
84
|
-
CompanyTokenTransactionCreateResponse,
|
|
85
84
|
CompanyTokenTransactionListParams,
|
|
86
85
|
CompanyTokenTransactionListResponse,
|
|
87
86
|
CompanyTokenTransactionListResponsesCursorPage,
|
|
88
|
-
CompanyTokenTransactionRetrieveResponse,
|
|
89
87
|
CompanyTokenTransactions,
|
|
90
88
|
} from './resources/company-token-transactions';
|
|
91
89
|
import {
|
|
@@ -149,15 +147,25 @@ import {
|
|
|
149
147
|
Disputes,
|
|
150
148
|
} from './resources/disputes';
|
|
151
149
|
import {
|
|
150
|
+
DmChannel,
|
|
151
|
+
DmChannelCreateParams,
|
|
152
|
+
DmChannelDeleteResponse,
|
|
153
|
+
DmChannelListParams,
|
|
154
|
+
DmChannelListResponse,
|
|
155
|
+
DmChannelListResponsesCursorPage,
|
|
156
|
+
DmChannelUpdateParams,
|
|
157
|
+
DmChannels,
|
|
158
|
+
} from './resources/dm-channels';
|
|
159
|
+
import {
|
|
160
|
+
DmFeedMemberNotificationPreferences,
|
|
161
|
+
DmFeedMemberStatuses,
|
|
162
|
+
DmMember,
|
|
152
163
|
DmMemberCreateParams,
|
|
153
|
-
DmMemberCreateResponse,
|
|
154
164
|
DmMemberDeleteResponse,
|
|
155
165
|
DmMemberListParams,
|
|
156
166
|
DmMemberListResponse,
|
|
157
167
|
DmMemberListResponsesCursorPage,
|
|
158
|
-
DmMemberRetrieveResponse,
|
|
159
168
|
DmMemberUpdateParams,
|
|
160
|
-
DmMemberUpdateResponse,
|
|
161
169
|
DmMembers,
|
|
162
170
|
} from './resources/dm-members';
|
|
163
171
|
import {
|
|
@@ -189,7 +197,13 @@ import {
|
|
|
189
197
|
FeeMarkupType,
|
|
190
198
|
FeeMarkups,
|
|
191
199
|
} from './resources/fee-markups';
|
|
192
|
-
import {
|
|
200
|
+
import {
|
|
201
|
+
FileCreateParams,
|
|
202
|
+
FileCreateResponse,
|
|
203
|
+
FileRetrieveResponse,
|
|
204
|
+
Files,
|
|
205
|
+
UploadStatus,
|
|
206
|
+
} from './resources/files';
|
|
193
207
|
import {
|
|
194
208
|
ForumPostCreateParams,
|
|
195
209
|
ForumPostListParams,
|
|
@@ -208,14 +222,12 @@ import {
|
|
|
208
222
|
} from './resources/forums';
|
|
209
223
|
import { InvoiceCreateParams, InvoiceListParams, InvoiceVoidResponse, Invoices } from './resources/invoices';
|
|
210
224
|
import {
|
|
225
|
+
Lead,
|
|
211
226
|
LeadCreateParams,
|
|
212
|
-
LeadCreateResponse,
|
|
213
227
|
LeadListParams,
|
|
214
228
|
LeadListResponse,
|
|
215
229
|
LeadListResponsesCursorPage,
|
|
216
|
-
LeadRetrieveResponse,
|
|
217
230
|
LeadUpdateParams,
|
|
218
|
-
LeadUpdateResponse,
|
|
219
231
|
Leads,
|
|
220
232
|
} from './resources/leads';
|
|
221
233
|
import { LedgerAccountRetrieveResponse, LedgerAccounts } from './resources/ledger-accounts';
|
|
@@ -227,6 +239,7 @@ import {
|
|
|
227
239
|
Members,
|
|
228
240
|
} from './resources/members';
|
|
229
241
|
import {
|
|
242
|
+
CancelOptions,
|
|
230
243
|
MembershipCancelParams,
|
|
231
244
|
MembershipListParams,
|
|
232
245
|
MembershipListResponse,
|
|
@@ -272,6 +285,7 @@ import {
|
|
|
272
285
|
Payments,
|
|
273
286
|
} from './resources/payments';
|
|
274
287
|
import {
|
|
288
|
+
PayoutDestinationCategory,
|
|
275
289
|
PayoutMethodListParams,
|
|
276
290
|
PayoutMethodListResponse,
|
|
277
291
|
PayoutMethodListResponsesCursorPage,
|
|
@@ -364,13 +378,20 @@ import {
|
|
|
364
378
|
Transfers,
|
|
365
379
|
} from './resources/transfers';
|
|
366
380
|
import {
|
|
381
|
+
User,
|
|
367
382
|
UserCheckAccessParams,
|
|
368
383
|
UserCheckAccessResponse,
|
|
369
|
-
|
|
384
|
+
UserUpdateProfileParams,
|
|
370
385
|
Users,
|
|
371
386
|
} from './resources/users';
|
|
372
|
-
import { VerificationRetrieveResponse, Verifications } from './resources/verifications';
|
|
373
387
|
import {
|
|
388
|
+
VerificationErrorCode,
|
|
389
|
+
VerificationRetrieveResponse,
|
|
390
|
+
VerificationStatus,
|
|
391
|
+
Verifications,
|
|
392
|
+
} from './resources/verifications';
|
|
393
|
+
import {
|
|
394
|
+
APIVersion,
|
|
374
395
|
CourseLessonInteractionCompletedWebhookEvent,
|
|
375
396
|
DisputeCreatedWebhookEvent,
|
|
376
397
|
DisputeUpdatedWebhookEvent,
|
|
@@ -397,27 +418,26 @@ import {
|
|
|
397
418
|
SetupIntentSucceededWebhookEvent,
|
|
398
419
|
UnwrapWebhookEvent,
|
|
399
420
|
VerificationSucceededWebhookEvent,
|
|
421
|
+
Webhook,
|
|
400
422
|
WebhookCreateParams,
|
|
401
423
|
WebhookCreateResponse,
|
|
402
424
|
WebhookDeleteResponse,
|
|
425
|
+
WebhookEvent,
|
|
403
426
|
WebhookListParams,
|
|
404
427
|
WebhookListResponse,
|
|
405
428
|
WebhookListResponsesCursorPage,
|
|
406
|
-
WebhookRetrieveResponse,
|
|
407
429
|
WebhookUpdateParams,
|
|
408
|
-
WebhookUpdateResponse,
|
|
409
430
|
Webhooks,
|
|
410
431
|
WithdrawalCreatedWebhookEvent,
|
|
411
432
|
WithdrawalUpdatedWebhookEvent,
|
|
412
433
|
} from './resources/webhooks';
|
|
413
434
|
import {
|
|
435
|
+
Withdrawal,
|
|
414
436
|
WithdrawalCreateParams,
|
|
415
|
-
WithdrawalCreateResponse,
|
|
416
437
|
WithdrawalFeeTypes,
|
|
417
438
|
WithdrawalListParams,
|
|
418
439
|
WithdrawalListResponse,
|
|
419
440
|
WithdrawalListResponsesCursorPage,
|
|
420
|
-
WithdrawalRetrieveResponse,
|
|
421
441
|
WithdrawalSpeeds,
|
|
422
442
|
WithdrawalStatus,
|
|
423
443
|
Withdrawals,
|
|
@@ -438,7 +458,7 @@ import { makeUserTokenVerifierFromSdk } from './lib/verify-user-token';
|
|
|
438
458
|
|
|
439
459
|
export interface ClientOptions {
|
|
440
460
|
/**
|
|
441
|
-
*
|
|
461
|
+
* A company API key, company scoped JWT, app API key, or user OAuth token. You must prepend your key/token with the word 'Bearer', which will look like `Bearer ***************************`
|
|
442
462
|
*/
|
|
443
463
|
apiKey?: string | undefined;
|
|
444
464
|
|
|
@@ -528,7 +548,6 @@ export class Whop {
|
|
|
528
548
|
apiKey: string;
|
|
529
549
|
webhookKey: string | null;
|
|
530
550
|
appID: string | null;
|
|
531
|
-
|
|
532
551
|
baseURL: string;
|
|
533
552
|
maxRetries: number;
|
|
534
553
|
timeout: number;
|
|
@@ -897,9 +916,14 @@ export class Whop {
|
|
|
897
916
|
getAPIList<Item, PageClass extends Pagination.AbstractPage<Item> = Pagination.AbstractPage<Item>>(
|
|
898
917
|
path: string,
|
|
899
918
|
Page: new (...args: any[]) => PageClass,
|
|
900
|
-
opts?: RequestOptions
|
|
919
|
+
opts?: PromiseOrValue<RequestOptions>,
|
|
901
920
|
): Pagination.PagePromise<PageClass, Item> {
|
|
902
|
-
return this.requestAPIList(
|
|
921
|
+
return this.requestAPIList(
|
|
922
|
+
Page,
|
|
923
|
+
opts && 'then' in opts ?
|
|
924
|
+
opts.then((opts) => ({ method: 'get', path, ...opts }))
|
|
925
|
+
: { method: 'get', path, ...opts },
|
|
926
|
+
);
|
|
903
927
|
}
|
|
904
928
|
|
|
905
929
|
requestAPIList<
|
|
@@ -907,7 +931,7 @@ export class Whop {
|
|
|
907
931
|
PageClass extends Pagination.AbstractPage<Item> = Pagination.AbstractPage<Item>,
|
|
908
932
|
>(
|
|
909
933
|
Page: new (...args: ConstructorParameters<typeof Pagination.AbstractPage>) => PageClass,
|
|
910
|
-
options: FinalRequestOptions
|
|
934
|
+
options: PromiseOrValue<FinalRequestOptions>,
|
|
911
935
|
): Pagination.PagePromise<PageClass, Item> {
|
|
912
936
|
const request = this.makeRequest(options, null, undefined);
|
|
913
937
|
return new Pagination.PagePromise<PageClass, Item>(this as any as Whop, request, Page);
|
|
@@ -920,9 +944,10 @@ export class Whop {
|
|
|
920
944
|
controller: AbortController,
|
|
921
945
|
): Promise<Response> {
|
|
922
946
|
const { signal, method, ...options } = init || {};
|
|
923
|
-
|
|
947
|
+
const abort = this._makeAbort(controller);
|
|
948
|
+
if (signal) signal.addEventListener('abort', abort, { once: true });
|
|
924
949
|
|
|
925
|
-
const timeout = setTimeout(
|
|
950
|
+
const timeout = setTimeout(abort, ms);
|
|
926
951
|
|
|
927
952
|
const isReadableBody =
|
|
928
953
|
((globalThis as any).ReadableStream && options.body instanceof (globalThis as any).ReadableStream) ||
|
|
@@ -1090,6 +1115,12 @@ export class Whop {
|
|
|
1090
1115
|
return headers.values;
|
|
1091
1116
|
}
|
|
1092
1117
|
|
|
1118
|
+
private _makeAbort(controller: AbortController) {
|
|
1119
|
+
// note: we can't just inline this method inside `fetchWithTimeout()` because then the closure
|
|
1120
|
+
// would capture all request options, and cause a memory leak.
|
|
1121
|
+
return () => controller.abort();
|
|
1122
|
+
}
|
|
1123
|
+
|
|
1093
1124
|
private buildBody({ options: { body, headers: rawHeaders } }: { options: FinalRequestOptions }): {
|
|
1094
1125
|
bodyHeaders: HeadersLike;
|
|
1095
1126
|
body: BodyInit | undefined;
|
|
@@ -1196,6 +1227,7 @@ export class Whop {
|
|
|
1196
1227
|
companyTokenTransactions: API.CompanyTokenTransactions = new API.CompanyTokenTransactions(this);
|
|
1197
1228
|
dmMembers: API.DmMembers = new API.DmMembers(this);
|
|
1198
1229
|
aiChats: API.AIChats = new API.AIChats(this);
|
|
1230
|
+
dmChannels: API.DmChannels = new API.DmChannels(this);
|
|
1199
1231
|
}
|
|
1200
1232
|
|
|
1201
1233
|
Whop.Apps = Apps;
|
|
@@ -1246,6 +1278,7 @@ Whop.Files = Files;
|
|
|
1246
1278
|
Whop.CompanyTokenTransactions = CompanyTokenTransactions;
|
|
1247
1279
|
Whop.DmMembers = DmMembers;
|
|
1248
1280
|
Whop.AIChats = AIChats;
|
|
1281
|
+
Whop.DmChannels = DmChannels;
|
|
1249
1282
|
|
|
1250
1283
|
export declare namespace Whop {
|
|
1251
1284
|
export type RequestOptions = Opts.RequestOptions;
|
|
@@ -1294,9 +1327,10 @@ export declare namespace Whop {
|
|
|
1294
1327
|
|
|
1295
1328
|
export {
|
|
1296
1329
|
Webhooks as Webhooks,
|
|
1330
|
+
type APIVersion as APIVersion,
|
|
1331
|
+
type Webhook as Webhook,
|
|
1332
|
+
type WebhookEvent as WebhookEvent,
|
|
1297
1333
|
type WebhookCreateResponse as WebhookCreateResponse,
|
|
1298
|
-
type WebhookRetrieveResponse as WebhookRetrieveResponse,
|
|
1299
|
-
type WebhookUpdateResponse as WebhookUpdateResponse,
|
|
1300
1334
|
type WebhookListResponse as WebhookListResponse,
|
|
1301
1335
|
type WebhookDeleteResponse as WebhookDeleteResponse,
|
|
1302
1336
|
type InvoiceCreatedWebhookEvent as InvoiceCreatedWebhookEvent,
|
|
@@ -1376,6 +1410,7 @@ export declare namespace Whop {
|
|
|
1376
1410
|
|
|
1377
1411
|
export {
|
|
1378
1412
|
Memberships as Memberships,
|
|
1413
|
+
type CancelOptions as CancelOptions,
|
|
1379
1414
|
type MembershipListResponse as MembershipListResponse,
|
|
1380
1415
|
type MembershipListResponsesCursorPage as MembershipListResponsesCursorPage,
|
|
1381
1416
|
type MembershipUpdateParams as MembershipUpdateParams,
|
|
@@ -1437,9 +1472,10 @@ export declare namespace Whop {
|
|
|
1437
1472
|
|
|
1438
1473
|
export {
|
|
1439
1474
|
Users as Users,
|
|
1440
|
-
type
|
|
1475
|
+
type User as User,
|
|
1441
1476
|
type UserCheckAccessResponse as UserCheckAccessResponse,
|
|
1442
1477
|
type UserCheckAccessParams as UserCheckAccessParams,
|
|
1478
|
+
type UserUpdateProfileParams as UserUpdateProfileParams,
|
|
1443
1479
|
};
|
|
1444
1480
|
|
|
1445
1481
|
export {
|
|
@@ -1612,11 +1648,10 @@ export declare namespace Whop {
|
|
|
1612
1648
|
|
|
1613
1649
|
export {
|
|
1614
1650
|
Withdrawals as Withdrawals,
|
|
1651
|
+
type Withdrawal as Withdrawal,
|
|
1615
1652
|
type WithdrawalFeeTypes as WithdrawalFeeTypes,
|
|
1616
1653
|
type WithdrawalSpeeds as WithdrawalSpeeds,
|
|
1617
1654
|
type WithdrawalStatus as WithdrawalStatus,
|
|
1618
|
-
type WithdrawalCreateResponse as WithdrawalCreateResponse,
|
|
1619
|
-
type WithdrawalRetrieveResponse as WithdrawalRetrieveResponse,
|
|
1620
1655
|
type WithdrawalListResponse as WithdrawalListResponse,
|
|
1621
1656
|
type WithdrawalListResponsesCursorPage as WithdrawalListResponsesCursorPage,
|
|
1622
1657
|
type WithdrawalCreateParams as WithdrawalCreateParams,
|
|
@@ -1660,6 +1695,7 @@ export declare namespace Whop {
|
|
|
1660
1695
|
|
|
1661
1696
|
export {
|
|
1662
1697
|
PayoutMethods as PayoutMethods,
|
|
1698
|
+
type PayoutDestinationCategory as PayoutDestinationCategory,
|
|
1663
1699
|
type PayoutMethodRetrieveResponse as PayoutMethodRetrieveResponse,
|
|
1664
1700
|
type PayoutMethodListResponse as PayoutMethodListResponse,
|
|
1665
1701
|
type PayoutMethodListResponsesCursorPage as PayoutMethodListResponsesCursorPage,
|
|
@@ -1668,14 +1704,14 @@ export declare namespace Whop {
|
|
|
1668
1704
|
|
|
1669
1705
|
export {
|
|
1670
1706
|
Verifications as Verifications,
|
|
1707
|
+
type VerificationErrorCode as VerificationErrorCode,
|
|
1708
|
+
type VerificationStatus as VerificationStatus,
|
|
1671
1709
|
type VerificationRetrieveResponse as VerificationRetrieveResponse,
|
|
1672
1710
|
};
|
|
1673
1711
|
|
|
1674
1712
|
export {
|
|
1675
1713
|
Leads as Leads,
|
|
1676
|
-
type
|
|
1677
|
-
type LeadRetrieveResponse as LeadRetrieveResponse,
|
|
1678
|
-
type LeadUpdateResponse as LeadUpdateResponse,
|
|
1714
|
+
type Lead as Lead,
|
|
1679
1715
|
type LeadListResponse as LeadListResponse,
|
|
1680
1716
|
type LeadListResponsesCursorPage as LeadListResponsesCursorPage,
|
|
1681
1717
|
type LeadCreateParams as LeadCreateParams,
|
|
@@ -1691,6 +1727,7 @@ export declare namespace Whop {
|
|
|
1691
1727
|
|
|
1692
1728
|
export {
|
|
1693
1729
|
Files as Files,
|
|
1730
|
+
type UploadStatus as UploadStatus,
|
|
1694
1731
|
type FileCreateResponse as FileCreateResponse,
|
|
1695
1732
|
type FileRetrieveResponse as FileRetrieveResponse,
|
|
1696
1733
|
type FileCreateParams as FileCreateParams,
|
|
@@ -1698,8 +1735,8 @@ export declare namespace Whop {
|
|
|
1698
1735
|
|
|
1699
1736
|
export {
|
|
1700
1737
|
CompanyTokenTransactions as CompanyTokenTransactions,
|
|
1701
|
-
type
|
|
1702
|
-
type
|
|
1738
|
+
type BotTokenTransactionTypes as BotTokenTransactionTypes,
|
|
1739
|
+
type CompanyTokenTransaction as CompanyTokenTransaction,
|
|
1703
1740
|
type CompanyTokenTransactionListResponse as CompanyTokenTransactionListResponse,
|
|
1704
1741
|
type CompanyTokenTransactionListResponsesCursorPage as CompanyTokenTransactionListResponsesCursorPage,
|
|
1705
1742
|
type CompanyTokenTransactionCreateParams as CompanyTokenTransactionCreateParams,
|
|
@@ -1708,9 +1745,9 @@ export declare namespace Whop {
|
|
|
1708
1745
|
|
|
1709
1746
|
export {
|
|
1710
1747
|
DmMembers as DmMembers,
|
|
1711
|
-
type
|
|
1712
|
-
type
|
|
1713
|
-
type
|
|
1748
|
+
type DmFeedMemberNotificationPreferences as DmFeedMemberNotificationPreferences,
|
|
1749
|
+
type DmFeedMemberStatuses as DmFeedMemberStatuses,
|
|
1750
|
+
type DmMember as DmMember,
|
|
1714
1751
|
type DmMemberListResponse as DmMemberListResponse,
|
|
1715
1752
|
type DmMemberDeleteResponse as DmMemberDeleteResponse,
|
|
1716
1753
|
type DmMemberListResponsesCursorPage as DmMemberListResponsesCursorPage,
|
|
@@ -1721,9 +1758,7 @@ export declare namespace Whop {
|
|
|
1721
1758
|
|
|
1722
1759
|
export {
|
|
1723
1760
|
AIChats as AIChats,
|
|
1724
|
-
type
|
|
1725
|
-
type AIChatRetrieveResponse as AIChatRetrieveResponse,
|
|
1726
|
-
type AIChatUpdateResponse as AIChatUpdateResponse,
|
|
1761
|
+
type AIChat as AIChat,
|
|
1727
1762
|
type AIChatListResponse as AIChatListResponse,
|
|
1728
1763
|
type AIChatDeleteResponse as AIChatDeleteResponse,
|
|
1729
1764
|
type AIChatListResponsesCursorPage as AIChatListResponsesCursorPage,
|
|
@@ -1732,6 +1767,17 @@ export declare namespace Whop {
|
|
|
1732
1767
|
type AIChatListParams as AIChatListParams,
|
|
1733
1768
|
};
|
|
1734
1769
|
|
|
1770
|
+
export {
|
|
1771
|
+
DmChannels as DmChannels,
|
|
1772
|
+
type DmChannel as DmChannel,
|
|
1773
|
+
type DmChannelListResponse as DmChannelListResponse,
|
|
1774
|
+
type DmChannelDeleteResponse as DmChannelDeleteResponse,
|
|
1775
|
+
type DmChannelListResponsesCursorPage as DmChannelListResponsesCursorPage,
|
|
1776
|
+
type DmChannelCreateParams as DmChannelCreateParams,
|
|
1777
|
+
type DmChannelUpdateParams as DmChannelUpdateParams,
|
|
1778
|
+
type DmChannelListParams as DmChannelListParams,
|
|
1779
|
+
};
|
|
1780
|
+
|
|
1735
1781
|
export type AccessLevel = API.AccessLevel;
|
|
1736
1782
|
export type AccessPassType = API.AccessPassType;
|
|
1737
1783
|
export type App = API.App;
|
package/src/internal/parse.ts
CHANGED
|
@@ -29,6 +29,12 @@ export async function defaultParseResponse<T>(client: Whop, props: APIResponsePr
|
|
|
29
29
|
const mediaType = contentType?.split(';')[0]?.trim();
|
|
30
30
|
const isJSON = mediaType?.includes('application/json') || mediaType?.endsWith('+json');
|
|
31
31
|
if (isJSON) {
|
|
32
|
+
const contentLength = response.headers.get('content-length');
|
|
33
|
+
if (contentLength === '0') {
|
|
34
|
+
// if there is no content we can't do anything
|
|
35
|
+
return undefined as T;
|
|
36
|
+
}
|
|
37
|
+
|
|
32
38
|
const json = await response.json();
|
|
33
39
|
return json as T;
|
|
34
40
|
}
|