@whop/sdk 0.0.24 → 0.0.26
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 +68 -0
- package/README.md +2 -2
- package/client.d.mts +30 -18
- package/client.d.mts.map +1 -1
- package/client.d.ts +30 -18
- package/client.d.ts.map +1 -1
- package/client.js +15 -2
- package/client.js.map +1 -1
- package/client.mjs +17 -4
- 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 +1 -1
- package/resources/ai-chats.d.mts +169 -0
- package/resources/ai-chats.d.mts.map +1 -0
- package/resources/ai-chats.d.ts +169 -0
- package/resources/ai-chats.d.ts.map +1 -0
- package/resources/ai-chats.js +53 -0
- package/resources/ai-chats.js.map +1 -0
- package/resources/ai-chats.mjs +49 -0
- package/resources/ai-chats.mjs.map +1 -0
- package/resources/apps.d.mts +1 -1
- package/resources/apps.d.mts.map +1 -1
- package/resources/apps.d.ts +1 -1
- package/resources/apps.d.ts.map +1 -1
- package/resources/authorized-users.d.mts +39 -5
- package/resources/authorized-users.d.mts.map +1 -1
- package/resources/authorized-users.d.ts +39 -5
- 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/checkout-configurations.d.mts +12 -0
- package/resources/checkout-configurations.d.mts.map +1 -1
- package/resources/checkout-configurations.d.ts +12 -0
- package/resources/checkout-configurations.d.ts.map +1 -1
- package/resources/company-token-transactions.d.mts +339 -0
- package/resources/company-token-transactions.d.mts.map +1 -0
- package/resources/company-token-transactions.d.ts +339 -0
- package/resources/company-token-transactions.d.ts.map +1 -0
- package/resources/company-token-transactions.js +59 -0
- package/resources/company-token-transactions.js.map +1 -0
- package/resources/company-token-transactions.mjs +55 -0
- package/resources/company-token-transactions.mjs.map +1 -0
- 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 +190 -0
- package/resources/dm-members.d.mts.map +1 -0
- package/resources/dm-members.d.ts +190 -0
- package/resources/dm-members.d.ts.map +1 -0
- package/resources/dm-members.js +94 -0
- package/resources/dm-members.js.map +1 -0
- package/resources/dm-members.mjs +90 -0
- package/resources/dm-members.mjs.map +1 -0
- package/resources/files.d.mts +7 -3
- package/resources/files.d.mts.map +1 -1
- package/resources/files.d.ts +7 -3
- package/resources/files.d.ts.map +1 -1
- package/resources/index.d.mts +13 -9
- package/resources/index.d.mts.map +1 -1
- package/resources/index.d.ts +13 -9
- package/resources/index.d.ts.map +1 -1
- package/resources/index.js +9 -1
- package/resources/index.js.map +1 -1
- package/resources/index.mjs +6 -2
- package/resources/index.mjs.map +1 -1
- package/resources/leads.d.mts +9 -177
- package/resources/leads.d.mts.map +1 -1
- package/resources/leads.d.ts +9 -177
- package/resources/leads.d.ts.map +1 -1
- package/resources/ledger-accounts.d.mts +3 -2
- package/resources/ledger-accounts.d.mts.map +1 -1
- package/resources/ledger-accounts.d.ts +3 -2
- 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 +13 -5
- package/resources/members.d.mts.map +1 -1
- package/resources/members.d.ts +13 -5
- 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 +32 -2
- package/resources/memberships.d.mts.map +1 -1
- package/resources/memberships.d.ts +32 -2
- package/resources/memberships.d.ts.map +1 -1
- package/resources/memberships.js +18 -0
- package/resources/memberships.js.map +1 -1
- package/resources/memberships.mjs +18 -0
- package/resources/memberships.mjs.map +1 -1
- package/resources/messages.d.mts +17 -1
- package/resources/messages.d.mts.map +1 -1
- package/resources/messages.d.ts +17 -1
- package/resources/messages.d.ts.map +1 -1
- package/resources/messages.js +10 -0
- package/resources/messages.js.map +1 -1
- package/resources/messages.mjs +10 -0
- package/resources/messages.mjs.map +1 -1
- package/resources/payments.d.mts +42 -1
- package/resources/payments.d.mts.map +1 -1
- package/resources/payments.d.ts +42 -1
- package/resources/payments.d.ts.map +1 -1
- package/resources/payout-methods.d.mts +26 -3
- package/resources/payout-methods.d.mts.map +1 -1
- package/resources/payout-methods.d.ts +26 -3
- 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/reactions.d.mts +24 -1
- package/resources/reactions.d.mts.map +1 -1
- package/resources/reactions.d.ts +24 -1
- package/resources/reactions.d.ts.map +1 -1
- package/resources/reactions.js +11 -0
- package/resources/reactions.js.map +1 -1
- package/resources/reactions.mjs +11 -0
- package/resources/reactions.mjs.map +1 -1
- package/resources/refunds.d.mts +1 -1
- package/resources/refunds.d.mts.map +1 -1
- package/resources/refunds.d.ts +1 -1
- package/resources/refunds.d.ts.map +1 -1
- package/resources/shared.d.mts +73 -1
- package/resources/shared.d.mts.map +1 -1
- package/resources/shared.d.ts +73 -1
- package/resources/shared.d.ts.map +1 -1
- package/resources/verifications.d.mts +11 -3
- package/resources/verifications.d.mts.map +1 -1
- package/resources/verifications.d.ts +11 -3
- package/resources/verifications.d.ts.map +1 -1
- package/resources/webhooks.d.mts +43 -293
- package/resources/webhooks.d.mts.map +1 -1
- package/resources/webhooks.d.ts +43 -293
- 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 +21 -128
- package/resources/withdrawals.d.mts.map +1 -1
- package/resources/withdrawals.d.ts +21 -128
- package/resources/withdrawals.d.ts.map +1 -1
- package/src/client.ts +133 -18
- package/src/internal/parse.ts +6 -0
- package/src/resources/ai-chats.ts +227 -0
- package/src/resources/apps.ts +6 -0
- package/src/resources/authorized-users.ts +45 -5
- package/src/resources/checkout-configurations.ts +15 -0
- package/src/resources/company-token-transactions.ts +433 -0
- package/src/resources/dm-channels.ts +212 -0
- package/src/resources/dm-members.ts +248 -0
- package/src/resources/files.ts +8 -2
- package/src/resources/index.ts +64 -9
- package/src/resources/leads.ts +9 -205
- package/src/resources/ledger-accounts.ts +3 -35
- package/src/resources/members.ts +16 -6
- package/src/resources/memberships.ts +45 -9
- package/src/resources/messages.ts +22 -0
- package/src/resources/payments.ts +109 -57
- package/src/resources/payout-methods.ts +37 -2
- package/src/resources/reactions.ts +36 -0
- package/src/resources/refunds.ts +2 -1
- package/src/resources/shared.ts +110 -11
- package/src/resources/verifications.ts +49 -36
- package/src/resources/webhooks.ts +78 -728
- package/src/resources/withdrawals.ts +29 -205
- 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
|
@@ -258,6 +258,11 @@ export declare namespace CheckoutConfigurationCreateParams {
|
|
|
258
258
|
* The URL to redirect the user to after the checkout configuration is created
|
|
259
259
|
*/
|
|
260
260
|
redirect_url?: string | null;
|
|
261
|
+
|
|
262
|
+
/**
|
|
263
|
+
* The URL of the page where the checkout is being initiated from.
|
|
264
|
+
*/
|
|
265
|
+
source_url?: string | null;
|
|
261
266
|
}
|
|
262
267
|
|
|
263
268
|
export namespace CreateCheckoutSessionInputModePaymentWithPlan {
|
|
@@ -601,6 +606,11 @@ export declare namespace CheckoutConfigurationCreateParams {
|
|
|
601
606
|
* The URL to redirect the user to after the checkout configuration is created
|
|
602
607
|
*/
|
|
603
608
|
redirect_url?: string | null;
|
|
609
|
+
|
|
610
|
+
/**
|
|
611
|
+
* The URL of the page where the checkout is being initiated from.
|
|
612
|
+
*/
|
|
613
|
+
source_url?: string | null;
|
|
604
614
|
}
|
|
605
615
|
|
|
606
616
|
export namespace CreateCheckoutSessionInputModePaymentWithPlanID {
|
|
@@ -663,6 +673,11 @@ export declare namespace CheckoutConfigurationCreateParams {
|
|
|
663
673
|
* The URL to redirect the user to after the checkout configuration is created
|
|
664
674
|
*/
|
|
665
675
|
redirect_url?: string | null;
|
|
676
|
+
|
|
677
|
+
/**
|
|
678
|
+
* The URL of the page where the checkout is being initiated from.
|
|
679
|
+
*/
|
|
680
|
+
source_url?: string | null;
|
|
666
681
|
}
|
|
667
682
|
|
|
668
683
|
export namespace CreateCheckoutSessionInputModeSetup {
|
|
@@ -0,0 +1,433 @@
|
|
|
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 { CursorPage, type CursorPageParams, PagePromise } from '../core/pagination';
|
|
6
|
+
import { RequestOptions } from '../internal/request-options';
|
|
7
|
+
import { path } from '../internal/utils/path';
|
|
8
|
+
|
|
9
|
+
export class CompanyTokenTransactions extends APIResource {
|
|
10
|
+
/**
|
|
11
|
+
* Create a token transaction (add/subtract/transfer) for a member
|
|
12
|
+
*
|
|
13
|
+
* Required permissions:
|
|
14
|
+
*
|
|
15
|
+
* - `company_token_transaction:create`
|
|
16
|
+
* - `member:basic:read`
|
|
17
|
+
* - `company:basic:read`
|
|
18
|
+
*
|
|
19
|
+
* @example
|
|
20
|
+
* ```ts
|
|
21
|
+
* const companyTokenTransaction =
|
|
22
|
+
* await client.companyTokenTransactions.create({
|
|
23
|
+
* amount: 6.9,
|
|
24
|
+
* company_id: 'biz_xxxxxxxxxxxxxx',
|
|
25
|
+
* destination_user_id: 'destination_user_id',
|
|
26
|
+
* transaction_type: 'transfer',
|
|
27
|
+
* user_id: 'user_xxxxxxxxxxxxx',
|
|
28
|
+
* });
|
|
29
|
+
* ```
|
|
30
|
+
*/
|
|
31
|
+
create(
|
|
32
|
+
body: CompanyTokenTransactionCreateParams,
|
|
33
|
+
options?: RequestOptions,
|
|
34
|
+
): APIPromise<CompanyTokenTransaction> {
|
|
35
|
+
return this._client.post('/company_token_transactions', { body, ...options });
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* Retrieves a token transaction by ID
|
|
40
|
+
*
|
|
41
|
+
* Required permissions:
|
|
42
|
+
*
|
|
43
|
+
* - `company_token_transaction:read`
|
|
44
|
+
* - `member:basic:read`
|
|
45
|
+
* - `company:basic:read`
|
|
46
|
+
*/
|
|
47
|
+
retrieve(id: string, options?: RequestOptions): APIPromise<CompanyTokenTransaction> {
|
|
48
|
+
return this._client.get(path`/company_token_transactions/${id}`, options);
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
/**
|
|
52
|
+
* Lists token transactions for a company
|
|
53
|
+
*
|
|
54
|
+
* Required permissions:
|
|
55
|
+
*
|
|
56
|
+
* - `company_token_transaction:read`
|
|
57
|
+
* - `member:basic:read`
|
|
58
|
+
* - `company:basic:read`
|
|
59
|
+
*/
|
|
60
|
+
list(
|
|
61
|
+
query: CompanyTokenTransactionListParams,
|
|
62
|
+
options?: RequestOptions,
|
|
63
|
+
): PagePromise<CompanyTokenTransactionListResponsesCursorPage, CompanyTokenTransactionListResponse> {
|
|
64
|
+
return this._client.getAPIList(
|
|
65
|
+
'/company_token_transactions',
|
|
66
|
+
CursorPage<CompanyTokenTransactionListResponse>,
|
|
67
|
+
{ query, ...options },
|
|
68
|
+
);
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
export type CompanyTokenTransactionListResponsesCursorPage = CursorPage<CompanyTokenTransactionListResponse>;
|
|
73
|
+
|
|
74
|
+
/**
|
|
75
|
+
* The type of token transaction
|
|
76
|
+
*/
|
|
77
|
+
export type BotTokenTransactionTypes = 'add' | 'subtract' | 'transfer';
|
|
78
|
+
|
|
79
|
+
/**
|
|
80
|
+
* A token transaction within a company
|
|
81
|
+
*/
|
|
82
|
+
export interface CompanyTokenTransaction {
|
|
83
|
+
/**
|
|
84
|
+
* The ID of the transaction
|
|
85
|
+
*/
|
|
86
|
+
id: string;
|
|
87
|
+
|
|
88
|
+
/**
|
|
89
|
+
* The transaction amount (always positive)
|
|
90
|
+
*/
|
|
91
|
+
amount: number;
|
|
92
|
+
|
|
93
|
+
/**
|
|
94
|
+
* The company
|
|
95
|
+
*/
|
|
96
|
+
company: CompanyTokenTransaction.Company;
|
|
97
|
+
|
|
98
|
+
/**
|
|
99
|
+
* When the transaction was created
|
|
100
|
+
*/
|
|
101
|
+
created_at: string;
|
|
102
|
+
|
|
103
|
+
/**
|
|
104
|
+
* Optional description
|
|
105
|
+
*/
|
|
106
|
+
description: string | null;
|
|
107
|
+
|
|
108
|
+
/**
|
|
109
|
+
* Optional idempotency key to prevent duplicate transactions
|
|
110
|
+
*/
|
|
111
|
+
idempotency_key: string | null;
|
|
112
|
+
|
|
113
|
+
/**
|
|
114
|
+
* For transfers, the ID of the linked transaction
|
|
115
|
+
*/
|
|
116
|
+
linked_transaction_id: string | null;
|
|
117
|
+
|
|
118
|
+
/**
|
|
119
|
+
* The member
|
|
120
|
+
*/
|
|
121
|
+
member: CompanyTokenTransaction.Member;
|
|
122
|
+
|
|
123
|
+
/**
|
|
124
|
+
* The type of transaction
|
|
125
|
+
*/
|
|
126
|
+
transaction_type: BotTokenTransactionTypes;
|
|
127
|
+
|
|
128
|
+
/**
|
|
129
|
+
* The user whose balance changed
|
|
130
|
+
*/
|
|
131
|
+
user: CompanyTokenTransaction.User;
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
export namespace CompanyTokenTransaction {
|
|
135
|
+
/**
|
|
136
|
+
* The company
|
|
137
|
+
*/
|
|
138
|
+
export interface Company {
|
|
139
|
+
/**
|
|
140
|
+
* The ID of the company
|
|
141
|
+
*/
|
|
142
|
+
id: string;
|
|
143
|
+
|
|
144
|
+
/**
|
|
145
|
+
* The slug/route of the company on the Whop site.
|
|
146
|
+
*/
|
|
147
|
+
route: string;
|
|
148
|
+
|
|
149
|
+
/**
|
|
150
|
+
* The written name of the company.
|
|
151
|
+
*/
|
|
152
|
+
title: string;
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
/**
|
|
156
|
+
* The member
|
|
157
|
+
*/
|
|
158
|
+
export interface Member {
|
|
159
|
+
/**
|
|
160
|
+
* The ID of the member
|
|
161
|
+
*/
|
|
162
|
+
id: string;
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
/**
|
|
166
|
+
* The user whose balance changed
|
|
167
|
+
*/
|
|
168
|
+
export interface User {
|
|
169
|
+
/**
|
|
170
|
+
* The internal ID of the user.
|
|
171
|
+
*/
|
|
172
|
+
id: string;
|
|
173
|
+
|
|
174
|
+
/**
|
|
175
|
+
* The name of the user from their Whop account.
|
|
176
|
+
*/
|
|
177
|
+
name: string | null;
|
|
178
|
+
|
|
179
|
+
/**
|
|
180
|
+
* The username of the user from their Whop account.
|
|
181
|
+
*/
|
|
182
|
+
username: string;
|
|
183
|
+
}
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
/**
|
|
187
|
+
* A token transaction within a company
|
|
188
|
+
*/
|
|
189
|
+
export interface CompanyTokenTransactionListResponse {
|
|
190
|
+
/**
|
|
191
|
+
* The ID of the transaction
|
|
192
|
+
*/
|
|
193
|
+
id: string;
|
|
194
|
+
|
|
195
|
+
/**
|
|
196
|
+
* The transaction amount (always positive)
|
|
197
|
+
*/
|
|
198
|
+
amount: number;
|
|
199
|
+
|
|
200
|
+
/**
|
|
201
|
+
* The company
|
|
202
|
+
*/
|
|
203
|
+
company: CompanyTokenTransactionListResponse.Company;
|
|
204
|
+
|
|
205
|
+
/**
|
|
206
|
+
* When the transaction was created
|
|
207
|
+
*/
|
|
208
|
+
created_at: string;
|
|
209
|
+
|
|
210
|
+
/**
|
|
211
|
+
* Optional description
|
|
212
|
+
*/
|
|
213
|
+
description: string | null;
|
|
214
|
+
|
|
215
|
+
/**
|
|
216
|
+
* Optional idempotency key to prevent duplicate transactions
|
|
217
|
+
*/
|
|
218
|
+
idempotency_key: string | null;
|
|
219
|
+
|
|
220
|
+
/**
|
|
221
|
+
* For transfers, the ID of the linked transaction
|
|
222
|
+
*/
|
|
223
|
+
linked_transaction_id: string | null;
|
|
224
|
+
|
|
225
|
+
/**
|
|
226
|
+
* The member
|
|
227
|
+
*/
|
|
228
|
+
member: CompanyTokenTransactionListResponse.Member;
|
|
229
|
+
|
|
230
|
+
/**
|
|
231
|
+
* The type of transaction
|
|
232
|
+
*/
|
|
233
|
+
transaction_type: BotTokenTransactionTypes;
|
|
234
|
+
|
|
235
|
+
/**
|
|
236
|
+
* The user whose balance changed
|
|
237
|
+
*/
|
|
238
|
+
user: CompanyTokenTransactionListResponse.User;
|
|
239
|
+
}
|
|
240
|
+
|
|
241
|
+
export namespace CompanyTokenTransactionListResponse {
|
|
242
|
+
/**
|
|
243
|
+
* The company
|
|
244
|
+
*/
|
|
245
|
+
export interface Company {
|
|
246
|
+
/**
|
|
247
|
+
* The ID of the company
|
|
248
|
+
*/
|
|
249
|
+
id: string;
|
|
250
|
+
|
|
251
|
+
/**
|
|
252
|
+
* The slug/route of the company on the Whop site.
|
|
253
|
+
*/
|
|
254
|
+
route: string;
|
|
255
|
+
|
|
256
|
+
/**
|
|
257
|
+
* The written name of the company.
|
|
258
|
+
*/
|
|
259
|
+
title: string;
|
|
260
|
+
}
|
|
261
|
+
|
|
262
|
+
/**
|
|
263
|
+
* The member
|
|
264
|
+
*/
|
|
265
|
+
export interface Member {
|
|
266
|
+
/**
|
|
267
|
+
* The ID of the member
|
|
268
|
+
*/
|
|
269
|
+
id: string;
|
|
270
|
+
}
|
|
271
|
+
|
|
272
|
+
/**
|
|
273
|
+
* The user whose balance changed
|
|
274
|
+
*/
|
|
275
|
+
export interface User {
|
|
276
|
+
/**
|
|
277
|
+
* The internal ID of the user.
|
|
278
|
+
*/
|
|
279
|
+
id: string;
|
|
280
|
+
|
|
281
|
+
/**
|
|
282
|
+
* The name of the user from their Whop account.
|
|
283
|
+
*/
|
|
284
|
+
name: string | null;
|
|
285
|
+
|
|
286
|
+
/**
|
|
287
|
+
* The username of the user from their Whop account.
|
|
288
|
+
*/
|
|
289
|
+
username: string;
|
|
290
|
+
}
|
|
291
|
+
}
|
|
292
|
+
|
|
293
|
+
export type CompanyTokenTransactionCreateParams =
|
|
294
|
+
| CompanyTokenTransactionCreateParams.CreateCompanyTokenTransactionInputTransactionTypeTransfer
|
|
295
|
+
| CompanyTokenTransactionCreateParams.CreateCompanyTokenTransactionInputTransactionTypeAdd
|
|
296
|
+
| CompanyTokenTransactionCreateParams.CreateCompanyTokenTransactionInputTransactionTypeSubtract;
|
|
297
|
+
|
|
298
|
+
export declare namespace CompanyTokenTransactionCreateParams {
|
|
299
|
+
export interface CreateCompanyTokenTransactionInputTransactionTypeTransfer {
|
|
300
|
+
/**
|
|
301
|
+
* The positive amount of tokens
|
|
302
|
+
*/
|
|
303
|
+
amount: number;
|
|
304
|
+
|
|
305
|
+
/**
|
|
306
|
+
* The company ID
|
|
307
|
+
*/
|
|
308
|
+
company_id: string;
|
|
309
|
+
|
|
310
|
+
/**
|
|
311
|
+
* Required for transfers - the user to receive tokens
|
|
312
|
+
*/
|
|
313
|
+
destination_user_id: string;
|
|
314
|
+
|
|
315
|
+
transaction_type: 'transfer';
|
|
316
|
+
|
|
317
|
+
/**
|
|
318
|
+
* The user ID whose balance will change
|
|
319
|
+
*/
|
|
320
|
+
user_id: string;
|
|
321
|
+
|
|
322
|
+
/**
|
|
323
|
+
* Optional description for the transaction
|
|
324
|
+
*/
|
|
325
|
+
description?: string | null;
|
|
326
|
+
|
|
327
|
+
/**
|
|
328
|
+
* Optional key to prevent duplicate transactions
|
|
329
|
+
*/
|
|
330
|
+
idempotency_key?: string | null;
|
|
331
|
+
}
|
|
332
|
+
|
|
333
|
+
export interface CreateCompanyTokenTransactionInputTransactionTypeAdd {
|
|
334
|
+
/**
|
|
335
|
+
* The positive amount of tokens
|
|
336
|
+
*/
|
|
337
|
+
amount: number;
|
|
338
|
+
|
|
339
|
+
/**
|
|
340
|
+
* The company ID
|
|
341
|
+
*/
|
|
342
|
+
company_id: string;
|
|
343
|
+
|
|
344
|
+
transaction_type: 'add';
|
|
345
|
+
|
|
346
|
+
/**
|
|
347
|
+
* The user ID whose balance will change
|
|
348
|
+
*/
|
|
349
|
+
user_id: string;
|
|
350
|
+
|
|
351
|
+
/**
|
|
352
|
+
* Optional description for the transaction
|
|
353
|
+
*/
|
|
354
|
+
description?: string | null;
|
|
355
|
+
|
|
356
|
+
/**
|
|
357
|
+
* Optional key to prevent duplicate transactions
|
|
358
|
+
*/
|
|
359
|
+
idempotency_key?: string | null;
|
|
360
|
+
}
|
|
361
|
+
|
|
362
|
+
export interface CreateCompanyTokenTransactionInputTransactionTypeSubtract {
|
|
363
|
+
/**
|
|
364
|
+
* The positive amount of tokens
|
|
365
|
+
*/
|
|
366
|
+
amount: number;
|
|
367
|
+
|
|
368
|
+
/**
|
|
369
|
+
* The company ID
|
|
370
|
+
*/
|
|
371
|
+
company_id: string;
|
|
372
|
+
|
|
373
|
+
transaction_type: 'subtract';
|
|
374
|
+
|
|
375
|
+
/**
|
|
376
|
+
* The user ID whose balance will change
|
|
377
|
+
*/
|
|
378
|
+
user_id: string;
|
|
379
|
+
|
|
380
|
+
/**
|
|
381
|
+
* Optional description for the transaction
|
|
382
|
+
*/
|
|
383
|
+
description?: string | null;
|
|
384
|
+
|
|
385
|
+
/**
|
|
386
|
+
* Optional key to prevent duplicate transactions
|
|
387
|
+
*/
|
|
388
|
+
idempotency_key?: string | null;
|
|
389
|
+
}
|
|
390
|
+
}
|
|
391
|
+
|
|
392
|
+
export interface CompanyTokenTransactionListParams extends CursorPageParams {
|
|
393
|
+
/**
|
|
394
|
+
* The ID of the company
|
|
395
|
+
*/
|
|
396
|
+
company_id: string;
|
|
397
|
+
|
|
398
|
+
/**
|
|
399
|
+
* Returns the elements in the list that come before the specified cursor.
|
|
400
|
+
*/
|
|
401
|
+
before?: string | null;
|
|
402
|
+
|
|
403
|
+
/**
|
|
404
|
+
* Returns the first _n_ elements from the list.
|
|
405
|
+
*/
|
|
406
|
+
first?: number | null;
|
|
407
|
+
|
|
408
|
+
/**
|
|
409
|
+
* Returns the last _n_ elements from the list.
|
|
410
|
+
*/
|
|
411
|
+
last?: number | null;
|
|
412
|
+
|
|
413
|
+
/**
|
|
414
|
+
* The type of token transaction
|
|
415
|
+
*/
|
|
416
|
+
transaction_type?: BotTokenTransactionTypes | null;
|
|
417
|
+
|
|
418
|
+
/**
|
|
419
|
+
* Filter by user ID
|
|
420
|
+
*/
|
|
421
|
+
user_id?: string | null;
|
|
422
|
+
}
|
|
423
|
+
|
|
424
|
+
export declare namespace CompanyTokenTransactions {
|
|
425
|
+
export {
|
|
426
|
+
type BotTokenTransactionTypes as BotTokenTransactionTypes,
|
|
427
|
+
type CompanyTokenTransaction as CompanyTokenTransaction,
|
|
428
|
+
type CompanyTokenTransactionListResponse as CompanyTokenTransactionListResponse,
|
|
429
|
+
type CompanyTokenTransactionListResponsesCursorPage as CompanyTokenTransactionListResponsesCursorPage,
|
|
430
|
+
type CompanyTokenTransactionCreateParams as CompanyTokenTransactionCreateParams,
|
|
431
|
+
type CompanyTokenTransactionListParams as CompanyTokenTransactionListParams,
|
|
432
|
+
};
|
|
433
|
+
}
|
|
@@ -0,0 +1,212 @@
|
|
|
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 { CursorPage, type CursorPageParams, PagePromise } from '../core/pagination';
|
|
6
|
+
import { RequestOptions } from '../internal/request-options';
|
|
7
|
+
import { path } from '../internal/utils/path';
|
|
8
|
+
|
|
9
|
+
export class DmChannels extends APIResource {
|
|
10
|
+
/**
|
|
11
|
+
* Creates a DM channel
|
|
12
|
+
*
|
|
13
|
+
* @example
|
|
14
|
+
* ```ts
|
|
15
|
+
* const dmChannel = await client.dmChannels.create({
|
|
16
|
+
* with_user_ids: ['string'],
|
|
17
|
+
* });
|
|
18
|
+
* ```
|
|
19
|
+
*/
|
|
20
|
+
create(body: DmChannelCreateParams, options?: RequestOptions): APIPromise<DmChannel> {
|
|
21
|
+
return this._client.post('/dm_channels', { body, ...options });
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* Retrieves a DM channel
|
|
26
|
+
*
|
|
27
|
+
* Required permissions:
|
|
28
|
+
*
|
|
29
|
+
* - `dms:read`
|
|
30
|
+
*
|
|
31
|
+
* @example
|
|
32
|
+
* ```ts
|
|
33
|
+
* const dmChannel = await client.dmChannels.retrieve('id');
|
|
34
|
+
* ```
|
|
35
|
+
*/
|
|
36
|
+
retrieve(id: string, options?: RequestOptions): APIPromise<DmChannel> {
|
|
37
|
+
return this._client.get(path`/dm_channels/${id}`, options);
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
/**
|
|
41
|
+
* Updates a DM channel
|
|
42
|
+
*
|
|
43
|
+
* Required permissions:
|
|
44
|
+
*
|
|
45
|
+
* - `dms:channel:manage`
|
|
46
|
+
*
|
|
47
|
+
* @example
|
|
48
|
+
* ```ts
|
|
49
|
+
* const dmChannel = await client.dmChannels.update('id');
|
|
50
|
+
* ```
|
|
51
|
+
*/
|
|
52
|
+
update(
|
|
53
|
+
id: string,
|
|
54
|
+
body: DmChannelUpdateParams | null | undefined = {},
|
|
55
|
+
options?: RequestOptions,
|
|
56
|
+
): APIPromise<DmChannel> {
|
|
57
|
+
return this._client.patch(path`/dm_channels/${id}`, { body, ...options });
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
/**
|
|
61
|
+
* Lists DM channels for the current user
|
|
62
|
+
*
|
|
63
|
+
* Required permissions:
|
|
64
|
+
*
|
|
65
|
+
* - `dms:read`
|
|
66
|
+
*
|
|
67
|
+
* @example
|
|
68
|
+
* ```ts
|
|
69
|
+
* // Automatically fetches more pages as needed.
|
|
70
|
+
* for await (const dmChannelListResponse of client.dmChannels.list()) {
|
|
71
|
+
* // ...
|
|
72
|
+
* }
|
|
73
|
+
* ```
|
|
74
|
+
*/
|
|
75
|
+
list(
|
|
76
|
+
query: DmChannelListParams | null | undefined = {},
|
|
77
|
+
options?: RequestOptions,
|
|
78
|
+
): PagePromise<DmChannelListResponsesCursorPage, DmChannelListResponse> {
|
|
79
|
+
return this._client.getAPIList('/dm_channels', CursorPage<DmChannelListResponse>, { query, ...options });
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
/**
|
|
83
|
+
* Deletes a DM channel
|
|
84
|
+
*
|
|
85
|
+
* Required permissions:
|
|
86
|
+
*
|
|
87
|
+
* - `dms:channel:manage`
|
|
88
|
+
*
|
|
89
|
+
* @example
|
|
90
|
+
* ```ts
|
|
91
|
+
* const dmChannel = await client.dmChannels.delete('id');
|
|
92
|
+
* ```
|
|
93
|
+
*/
|
|
94
|
+
delete(id: string, options?: RequestOptions): APIPromise<DmChannelDeleteResponse> {
|
|
95
|
+
return this._client.delete(path`/dm_channels/${id}`, options);
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
export type DmChannelListResponsesCursorPage = CursorPage<DmChannelListResponse>;
|
|
100
|
+
|
|
101
|
+
/**
|
|
102
|
+
* Represents a DM channel
|
|
103
|
+
*/
|
|
104
|
+
export interface DmChannel {
|
|
105
|
+
/**
|
|
106
|
+
* The unique identifier for the entity
|
|
107
|
+
*/
|
|
108
|
+
id: string;
|
|
109
|
+
|
|
110
|
+
/**
|
|
111
|
+
* The time the entity was created (in milliseconds since Unix epoch)
|
|
112
|
+
*/
|
|
113
|
+
created_at: string;
|
|
114
|
+
|
|
115
|
+
/**
|
|
116
|
+
* When the last message was sent
|
|
117
|
+
*/
|
|
118
|
+
last_message_at: string | null;
|
|
119
|
+
|
|
120
|
+
/**
|
|
121
|
+
* The custom name of the DM channel, if any
|
|
122
|
+
*/
|
|
123
|
+
name: string | null;
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
/**
|
|
127
|
+
* Represents a DM channel
|
|
128
|
+
*/
|
|
129
|
+
export interface DmChannelListResponse {
|
|
130
|
+
/**
|
|
131
|
+
* The unique identifier for the entity
|
|
132
|
+
*/
|
|
133
|
+
id: string;
|
|
134
|
+
|
|
135
|
+
/**
|
|
136
|
+
* The time the entity was created (in milliseconds since Unix epoch)
|
|
137
|
+
*/
|
|
138
|
+
created_at: string;
|
|
139
|
+
|
|
140
|
+
/**
|
|
141
|
+
* When the last message was sent
|
|
142
|
+
*/
|
|
143
|
+
last_message_at: string | null;
|
|
144
|
+
|
|
145
|
+
/**
|
|
146
|
+
* The custom name of the DM channel, if any
|
|
147
|
+
*/
|
|
148
|
+
name: string | null;
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
/**
|
|
152
|
+
* Represents `true` or `false` values.
|
|
153
|
+
*/
|
|
154
|
+
export type DmChannelDeleteResponse = boolean;
|
|
155
|
+
|
|
156
|
+
export interface DmChannelCreateParams {
|
|
157
|
+
/**
|
|
158
|
+
* The user ids to create a DM with. Can be email, username or user_id (tag)
|
|
159
|
+
*/
|
|
160
|
+
with_user_ids: Array<string>;
|
|
161
|
+
|
|
162
|
+
/**
|
|
163
|
+
* The ID of the company to scope this DM channel to.
|
|
164
|
+
*/
|
|
165
|
+
company_id?: string | null;
|
|
166
|
+
|
|
167
|
+
/**
|
|
168
|
+
* The custom name for the DM channel
|
|
169
|
+
*/
|
|
170
|
+
custom_name?: string | null;
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
export interface DmChannelUpdateParams {
|
|
174
|
+
/**
|
|
175
|
+
* The custom name for the DM channel
|
|
176
|
+
*/
|
|
177
|
+
custom_name?: string | null;
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
export interface DmChannelListParams extends CursorPageParams {
|
|
181
|
+
/**
|
|
182
|
+
* Returns the elements in the list that come before the specified cursor.
|
|
183
|
+
*/
|
|
184
|
+
before?: string | null;
|
|
185
|
+
|
|
186
|
+
/**
|
|
187
|
+
* Filter DM channels scoped to a specific company
|
|
188
|
+
*/
|
|
189
|
+
company_id?: string | null;
|
|
190
|
+
|
|
191
|
+
/**
|
|
192
|
+
* Returns the first _n_ elements from the list.
|
|
193
|
+
*/
|
|
194
|
+
first?: number | null;
|
|
195
|
+
|
|
196
|
+
/**
|
|
197
|
+
* Returns the last _n_ elements from the list.
|
|
198
|
+
*/
|
|
199
|
+
last?: number | null;
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
export declare namespace DmChannels {
|
|
203
|
+
export {
|
|
204
|
+
type DmChannel as DmChannel,
|
|
205
|
+
type DmChannelListResponse as DmChannelListResponse,
|
|
206
|
+
type DmChannelDeleteResponse as DmChannelDeleteResponse,
|
|
207
|
+
type DmChannelListResponsesCursorPage as DmChannelListResponsesCursorPage,
|
|
208
|
+
type DmChannelCreateParams as DmChannelCreateParams,
|
|
209
|
+
type DmChannelUpdateParams as DmChannelUpdateParams,
|
|
210
|
+
type DmChannelListParams as DmChannelListParams,
|
|
211
|
+
};
|
|
212
|
+
}
|