@privy-io/node 0.10.0 → 0.11.0

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 (230) hide show
  1. package/CHANGELOG.md +64 -0
  2. package/client.d.mts +38 -20
  3. package/client.d.mts.map +1 -1
  4. package/client.d.ts +38 -20
  5. package/client.d.ts.map +1 -1
  6. package/client.js +31 -12
  7. package/client.js.map +1 -1
  8. package/client.mjs +32 -13
  9. package/client.mjs.map +1 -1
  10. package/index.d.mts +2 -0
  11. package/index.d.mts.map +1 -1
  12. package/index.d.ts +2 -0
  13. package/index.d.ts.map +1 -1
  14. package/index.js.map +1 -1
  15. package/index.mjs.map +1 -1
  16. package/internal/tslib.js +17 -17
  17. package/internal/utils/query.d.mts +2 -0
  18. package/internal/utils/query.d.mts.map +1 -0
  19. package/internal/utils/query.d.ts +2 -0
  20. package/internal/utils/query.d.ts.map +1 -0
  21. package/internal/utils/query.js +10 -0
  22. package/internal/utils/query.js.map +1 -0
  23. package/internal/utils/query.mjs +6 -0
  24. package/internal/utils/query.mjs.map +1 -0
  25. package/internal/utils.d.mts +1 -0
  26. package/internal/utils.d.ts +1 -0
  27. package/internal/utils.js +1 -0
  28. package/internal/utils.js.map +1 -1
  29. package/internal/utils.mjs +1 -0
  30. package/package.json +12 -1
  31. package/public-api/PrivyClient.d.mts +3 -0
  32. package/public-api/PrivyClient.d.mts.map +1 -1
  33. package/public-api/PrivyClient.d.ts +3 -0
  34. package/public-api/PrivyClient.d.ts.map +1 -1
  35. package/public-api/PrivyClient.js +5 -0
  36. package/public-api/PrivyClient.js.map +1 -1
  37. package/public-api/PrivyClient.mjs +5 -0
  38. package/public-api/PrivyClient.mjs.map +1 -1
  39. package/public-api/services/apps.d.mts +25 -0
  40. package/public-api/services/apps.d.mts.map +1 -0
  41. package/public-api/services/apps.d.ts +25 -0
  42. package/public-api/services/apps.d.ts.map +1 -0
  43. package/public-api/services/apps.js +56 -0
  44. package/public-api/services/apps.js.map +1 -0
  45. package/public-api/services/apps.mjs +52 -0
  46. package/public-api/services/apps.mjs.map +1 -0
  47. package/public-api/services/policies.d.mts +6 -2
  48. package/public-api/services/policies.d.mts.map +1 -1
  49. package/public-api/services/policies.d.ts +6 -2
  50. package/public-api/services/policies.d.ts.map +1 -1
  51. package/public-api/services/policies.js +6 -0
  52. package/public-api/services/policies.js.map +1 -1
  53. package/public-api/services/policies.mjs +6 -0
  54. package/public-api/services/policies.mjs.map +1 -1
  55. package/public-api/services/wallets.d.mts +5 -1
  56. package/public-api/services/wallets.d.mts.map +1 -1
  57. package/public-api/services/wallets.d.ts +5 -1
  58. package/public-api/services/wallets.d.ts.map +1 -1
  59. package/public-api/services/wallets.js +6 -0
  60. package/public-api/services/wallets.js.map +1 -1
  61. package/public-api/services/wallets.mjs +6 -0
  62. package/public-api/services/wallets.mjs.map +1 -1
  63. package/resources/accounts.d.mts +195 -4
  64. package/resources/accounts.d.mts.map +1 -1
  65. package/resources/accounts.d.ts +195 -4
  66. package/resources/accounts.d.ts.map +1 -1
  67. package/resources/apps/allowlist.d.mts +81 -0
  68. package/resources/apps/allowlist.d.mts.map +1 -0
  69. package/resources/apps/allowlist.d.ts +81 -0
  70. package/resources/apps/allowlist.d.ts.map +1 -0
  71. package/resources/apps/allowlist.js +56 -0
  72. package/resources/apps/allowlist.js.map +1 -0
  73. package/resources/apps/allowlist.mjs +52 -0
  74. package/resources/apps/allowlist.mjs.map +1 -0
  75. package/resources/apps/apps.d.mts +238 -0
  76. package/resources/apps/apps.d.mts.map +1 -0
  77. package/resources/apps/apps.d.ts +238 -0
  78. package/resources/apps/apps.d.ts.map +1 -0
  79. package/resources/apps/apps.js +44 -0
  80. package/resources/apps/apps.js.map +1 -0
  81. package/resources/apps/apps.mjs +39 -0
  82. package/resources/apps/apps.mjs.map +1 -0
  83. package/resources/apps/index.d.mts +3 -0
  84. package/resources/apps/index.d.mts.map +1 -0
  85. package/resources/apps/index.d.ts +3 -0
  86. package/resources/apps/index.d.ts.map +1 -0
  87. package/resources/apps/index.js +9 -0
  88. package/resources/apps/index.js.map +1 -0
  89. package/resources/apps/index.mjs +4 -0
  90. package/resources/apps/index.mjs.map +1 -0
  91. package/resources/apps.d.mts +1 -151
  92. package/resources/apps.d.mts.map +1 -1
  93. package/resources/apps.d.ts +1 -151
  94. package/resources/apps.d.ts.map +1 -1
  95. package/resources/apps.js +2 -5
  96. package/resources/apps.js.map +1 -1
  97. package/resources/apps.mjs +1 -3
  98. package/resources/apps.mjs.map +1 -1
  99. package/resources/client-auth.d.mts +144 -1
  100. package/resources/client-auth.d.mts.map +1 -1
  101. package/resources/client-auth.d.ts +144 -1
  102. package/resources/client-auth.d.ts.map +1 -1
  103. package/resources/index.d.mts +11 -10
  104. package/resources/index.d.mts.map +1 -1
  105. package/resources/index.d.ts +11 -10
  106. package/resources/index.d.ts.map +1 -1
  107. package/resources/index.js +4 -2
  108. package/resources/index.js.map +1 -1
  109. package/resources/index.mjs +3 -2
  110. package/resources/index.mjs.map +1 -1
  111. package/resources/intents.d.mts +2815 -31
  112. package/resources/intents.d.mts.map +1 -1
  113. package/resources/intents.d.ts +2815 -31
  114. package/resources/intents.d.ts.map +1 -1
  115. package/resources/intents.js +156 -0
  116. package/resources/intents.js.map +1 -1
  117. package/resources/intents.mjs +156 -0
  118. package/resources/intents.mjs.map +1 -1
  119. package/resources/key-quorums.d.mts +45 -2
  120. package/resources/key-quorums.d.mts.map +1 -1
  121. package/resources/key-quorums.d.ts +45 -2
  122. package/resources/key-quorums.d.ts.map +1 -1
  123. package/resources/key-quorums.js +18 -1
  124. package/resources/key-quorums.js.map +1 -1
  125. package/resources/key-quorums.mjs +18 -1
  126. package/resources/key-quorums.mjs.map +1 -1
  127. package/resources/kraken-embed.d.mts +62 -0
  128. package/resources/kraken-embed.d.mts.map +1 -0
  129. package/resources/kraken-embed.d.ts +62 -0
  130. package/resources/kraken-embed.d.ts.map +1 -0
  131. package/resources/kraken-embed.js +9 -0
  132. package/resources/kraken-embed.js.map +1 -0
  133. package/resources/kraken-embed.mjs +5 -0
  134. package/resources/kraken-embed.mjs.map +1 -0
  135. package/resources/policies.d.mts +63 -56
  136. package/resources/policies.d.mts.map +1 -1
  137. package/resources/policies.d.ts +63 -56
  138. package/resources/policies.d.ts.map +1 -1
  139. package/resources/policies.js +3 -0
  140. package/resources/policies.js.map +1 -1
  141. package/resources/policies.mjs +3 -0
  142. package/resources/policies.mjs.map +1 -1
  143. package/resources/transactions.d.mts +3 -0
  144. package/resources/transactions.d.mts.map +1 -1
  145. package/resources/transactions.d.ts +3 -0
  146. package/resources/transactions.d.ts.map +1 -1
  147. package/resources/transactions.js +3 -0
  148. package/resources/transactions.js.map +1 -1
  149. package/resources/transactions.mjs +3 -0
  150. package/resources/transactions.mjs.map +1 -1
  151. package/resources/users.d.mts +50 -47
  152. package/resources/users.d.mts.map +1 -1
  153. package/resources/users.d.ts +50 -47
  154. package/resources/users.d.ts.map +1 -1
  155. package/resources/users.js +3 -0
  156. package/resources/users.js.map +1 -1
  157. package/resources/users.mjs +3 -0
  158. package/resources/users.mjs.map +1 -1
  159. package/resources/wallets/balance.d.mts +7 -4
  160. package/resources/wallets/balance.d.mts.map +1 -1
  161. package/resources/wallets/balance.d.ts +7 -4
  162. package/resources/wallets/balance.d.ts.map +1 -1
  163. package/resources/wallets/balance.js +3 -0
  164. package/resources/wallets/balance.js.map +1 -1
  165. package/resources/wallets/balance.mjs +3 -0
  166. package/resources/wallets/balance.mjs.map +1 -1
  167. package/resources/wallets/index.d.mts +1 -1
  168. package/resources/wallets/index.d.mts.map +1 -1
  169. package/resources/wallets/index.d.ts +1 -1
  170. package/resources/wallets/index.d.ts.map +1 -1
  171. package/resources/wallets/index.js.map +1 -1
  172. package/resources/wallets/index.mjs.map +1 -1
  173. package/resources/wallets/transactions.d.mts +9 -6
  174. package/resources/wallets/transactions.d.mts.map +1 -1
  175. package/resources/wallets/transactions.d.ts +9 -6
  176. package/resources/wallets/transactions.d.ts.map +1 -1
  177. package/resources/wallets/transactions.js +3 -0
  178. package/resources/wallets/transactions.js.map +1 -1
  179. package/resources/wallets/transactions.mjs +3 -0
  180. package/resources/wallets/transactions.mjs.map +1 -1
  181. package/resources/wallets/wallets.d.mts +129 -72
  182. package/resources/wallets/wallets.d.mts.map +1 -1
  183. package/resources/wallets/wallets.d.ts +129 -72
  184. package/resources/wallets/wallets.d.ts.map +1 -1
  185. package/resources/wallets/wallets.js +11 -5
  186. package/resources/wallets/wallets.js.map +1 -1
  187. package/resources/wallets/wallets.mjs +11 -5
  188. package/resources/wallets/wallets.mjs.map +1 -1
  189. package/resources/webhooks.d.mts +319 -283
  190. package/resources/webhooks.d.mts.map +1 -1
  191. package/resources/webhooks.d.ts +319 -283
  192. package/resources/webhooks.d.ts.map +1 -1
  193. package/resources/webhooks.js.map +1 -1
  194. package/resources/webhooks.mjs.map +1 -1
  195. package/resources/yield.d.mts +26 -9
  196. package/resources/yield.d.mts.map +1 -1
  197. package/resources/yield.d.ts +26 -9
  198. package/resources/yield.d.ts.map +1 -1
  199. package/src/client.ts +203 -42
  200. package/src/index.ts +10 -0
  201. package/src/internal/utils/query.ts +7 -0
  202. package/src/internal/utils.ts +1 -0
  203. package/src/public-api/PrivyClient.ts +7 -0
  204. package/src/public-api/services/apps.ts +85 -0
  205. package/src/public-api/services/policies.ts +15 -1
  206. package/src/public-api/services/wallets.ts +14 -0
  207. package/src/resources/accounts.ts +233 -3
  208. package/src/resources/apps/allowlist.ts +126 -0
  209. package/src/resources/apps/apps.ts +391 -0
  210. package/src/resources/apps/index.ts +20 -0
  211. package/src/resources/apps.ts +1 -257
  212. package/src/resources/client-auth.ts +202 -0
  213. package/src/resources/index.ts +94 -21
  214. package/src/resources/intents.ts +4579 -40
  215. package/src/resources/key-quorums.ts +50 -2
  216. package/src/resources/kraken-embed.ts +85 -0
  217. package/src/resources/policies.ts +83 -76
  218. package/src/resources/transactions.ts +3 -0
  219. package/src/resources/users.ts +66 -63
  220. package/src/resources/wallets/balance.ts +9 -2
  221. package/src/resources/wallets/index.ts +4 -2
  222. package/src/resources/wallets/transactions.ts +10 -4
  223. package/src/resources/wallets/wallets.ts +175 -97
  224. package/src/resources/webhooks.ts +454 -438
  225. package/src/resources/yield.ts +39 -10
  226. package/src/version.ts +1 -1
  227. package/version.d.mts +1 -1
  228. package/version.d.ts +1 -1
  229. package/version.js +1 -1
  230. package/version.mjs +1 -1
@@ -1,9 +1,11 @@
1
1
  import { Prettify } from 'viem';
2
2
  import { PrivyAPI } from '../../client';
3
+ import { APIPromise } from '../../core/api-promise';
3
4
  import { generateAuthorizationSignatures } from '../../lib/authorization';
4
5
  import {
5
6
  Policies,
6
7
  Policy,
8
+ PolicyCreateParams,
7
9
  PolicyCreateRuleParams,
8
10
  PolicyCreateRuleResponse,
9
11
  PolicyDeleteParams,
@@ -15,7 +17,7 @@ import {
15
17
  PolicyUpdateRuleResponse,
16
18
  } from '../../resources';
17
19
  import { PrivyClient } from '../PrivyClient';
18
- import { WithAuthorization } from './types';
20
+ import { WithAuthorization, WithIdempotency } from './types';
19
21
 
20
22
  export class PrivyPoliciesService extends Policies {
21
23
  private privyClient: PrivyClient;
@@ -25,6 +27,16 @@ export class PrivyPoliciesService extends Policies {
25
27
  this.privyClient = privyClient;
26
28
  }
27
29
 
30
+ public override create({
31
+ idempotency_key: idempotencyKey,
32
+ ...params
33
+ }: PrivyPoliciesService.CreateInput): APIPromise<Policy> {
34
+ return super.create({
35
+ ...params,
36
+ ...(idempotencyKey && { 'privy-idempotency-key': idempotencyKey }),
37
+ });
38
+ }
39
+
28
40
  public async update(
29
41
  policyId: string,
30
42
  { authorization_context: authorizationContext = {}, ...params }: PrivyPoliciesService.UpdateInput,
@@ -162,6 +174,8 @@ export class PrivyPoliciesService extends Policies {
162
174
  }
163
175
 
164
176
  export namespace PrivyPoliciesService {
177
+ /** The input type for the {@link PrivyPoliciesService.create} method. */
178
+ export type CreateInput = Prettify<WithIdempotency<PolicyCreateParams>>;
165
179
  /** The input type for the {@link PrivyPoliciesService.update} method. */
166
180
  export type UpdateInput = Prettify<WithAuthorization<PolicyUpdateParams>>;
167
181
  /** The input type for the {@link PrivyPoliciesService.delete} method. */
@@ -1,10 +1,12 @@
1
1
  import { PrivyAPI } from '../../client';
2
+ import { APIPromise } from '../../core/api-promise';
2
3
  import { PrivyAPIError } from '../../core/error';
3
4
  import { generateAuthorizationSignatures } from '../../lib/authorization';
4
5
  import { setupHPKERecipient, setupHPKESender } from '../../lib/cryptography';
5
6
  import { entropyToBytes } from '../../lib/wallet-entropy';
6
7
  import {
7
8
  Wallet,
9
+ WalletCreateParams,
8
10
  WalletExportParams,
9
11
  WalletRawSignParams,
10
12
  WalletRawSignResponse,
@@ -39,6 +41,16 @@ export class PrivyWalletsService extends Wallets {
39
41
  return this.solanaService;
40
42
  }
41
43
 
44
+ public override create({
45
+ idempotency_key: idempotencyKey,
46
+ ...params
47
+ }: PrivyWalletsService.CreateInput): APIPromise<Wallet> {
48
+ return super.create({
49
+ ...params,
50
+ ...(idempotencyKey && { 'privy-idempotency-key': idempotencyKey }),
51
+ });
52
+ }
53
+
42
54
  public async rpc<Params extends PrivyWalletsService.RpcInput>(
43
55
  walletId: string,
44
56
  params: Params,
@@ -218,6 +230,8 @@ export class PrivyWalletsService extends Wallets {
218
230
  * @see {@link PrivyWalletsService} class.
219
231
  */
220
232
  export namespace PrivyWalletsService {
233
+ /** The input type for the {@link PrivyWalletsService.create} method. */
234
+ export type CreateInput = Prettify<WithIdempotency<WalletCreateParams>>;
221
235
  /** The input type for the {@link PrivyWalletsService.rpc} method. */
222
236
  export type RpcInput = Prettify<WithIdempotency<WithAuthorization<WalletRpcParams>>>;
223
237
  /** The input type for the {@link PrivyWalletsService.rawSign} method. */
@@ -65,19 +65,241 @@ export interface AccountWalletConfigurationItem {
65
65
  custody?: WalletsAPI.WalletCustodian;
66
66
  }
67
67
 
68
+ /**
69
+ * An optional display name for the account.
70
+ */
71
+ export type AccountDisplayName = string;
72
+
73
+ /**
74
+ * Configuration for the wallets on this account.
75
+ */
76
+ export type AccountWalletsConfiguration = Array<AccountWalletConfigurationItem>;
77
+
68
78
  /**
69
79
  * Input for creating a digital asset account.
70
80
  */
71
81
  export interface CreateAccountInput {
72
82
  /**
73
- * Configuration for wallets to create.
83
+ * Configuration for the wallets on this account.
84
+ */
85
+ wallets_configuration: AccountWalletsConfiguration;
86
+
87
+ /**
88
+ * An optional display name for the account.
89
+ */
90
+ display_name?: AccountDisplayName;
91
+ }
92
+
93
+ /**
94
+ * Input for updating a digital asset account.
95
+ */
96
+ export interface UpdateAccountInput {
97
+ /**
98
+ * An optional display name for the account.
99
+ */
100
+ display_name?: AccountDisplayName;
101
+
102
+ /**
103
+ * Configuration for the wallets on this account.
104
+ */
105
+ wallets_configuration?: AccountWalletsConfiguration;
106
+ }
107
+
108
+ /**
109
+ * Paginated list of digital asset accounts.
110
+ */
111
+ export interface AccountsListResponse {
112
+ /**
113
+ * The list of accounts.
114
+ */
115
+ data: Array<AccountResponse>;
116
+
117
+ /**
118
+ * Cursor for fetching the next page of results, or null if no more results.
119
+ */
120
+ next_cursor: string | null;
121
+ }
122
+
123
+ /**
124
+ * A digital asset account with its aggregated balance across all wallets and
125
+ * chains.
126
+ */
127
+ export interface AssetAccountWithBalance {
128
+ /**
129
+ * The account ID.
74
130
  */
75
- wallets_configuration: Array<AccountWalletConfigurationItem>;
131
+ id: string;
132
+
133
+ balance: AssetAccountWithBalance.Balance;
76
134
 
77
135
  /**
78
136
  * An optional display name for the account.
79
137
  */
80
- display_name?: string;
138
+ display_name: string | null;
139
+
140
+ /**
141
+ * The wallets belonging to this account.
142
+ */
143
+ wallets: Array<AccountWallet>;
144
+ }
145
+
146
+ export namespace AssetAccountWithBalance {
147
+ export interface Balance {
148
+ /**
149
+ * The individual asset balances, each computed across all supported chains.
150
+ */
151
+ assets: Array<Balance.Asset>;
152
+
153
+ /**
154
+ * The total balance across all assets.
155
+ */
156
+ total: Balance.Total;
157
+ }
158
+
159
+ export namespace Balance {
160
+ export interface Asset {
161
+ /**
162
+ * The amount of the asset held, denominated in the unit of the asset itself, with
163
+ * 1 decimal of precision.
164
+ */
165
+ amount: string;
166
+
167
+ /**
168
+ * The price of the asset in the provided currency.
169
+ */
170
+ price: Asset.Price;
171
+
172
+ /**
173
+ * The symbol of the asset (e.g. USDC, ETH).
174
+ */
175
+ symbol: string;
176
+ }
177
+
178
+ export namespace Asset {
179
+ /**
180
+ * The price of the asset in the provided currency.
181
+ */
182
+ export interface Price {
183
+ /**
184
+ * The currency code.
185
+ */
186
+ currency: 'usd';
187
+
188
+ /**
189
+ * The monetary value as a string.
190
+ */
191
+ value: string;
192
+ }
193
+ }
194
+
195
+ /**
196
+ * The total balance across all assets.
197
+ */
198
+ export interface Total {
199
+ /**
200
+ * The currency code.
201
+ */
202
+ currency: 'usd';
203
+
204
+ /**
205
+ * The monetary value as a string.
206
+ */
207
+ value: string;
208
+ }
209
+ }
210
+ }
211
+
212
+ /**
213
+ * Paginated list of digital asset accounts for the dashboard.
214
+ */
215
+ export interface AccountsDashboardListResponse {
216
+ /**
217
+ * The list of accounts, with balances included for dashboard display.
218
+ */
219
+ data: Array<AssetAccountWithBalance>;
220
+
221
+ /**
222
+ * Cursor for fetching the next page of results, or null if no more results.
223
+ */
224
+ next_cursor: string | null;
225
+ }
226
+
227
+ /**
228
+ * The balance of a digital asset account, aggregated across all wallets and
229
+ * supported chains.
230
+ */
231
+ export interface AccountBalanceResponse {
232
+ /**
233
+ * The individual asset balances, each computed across all supported chains.
234
+ */
235
+ assets: Array<AccountBalanceResponse.Asset>;
236
+
237
+ /**
238
+ * The total balance across all assets.
239
+ */
240
+ total: AccountBalanceResponse.Total;
241
+ }
242
+
243
+ export namespace AccountBalanceResponse {
244
+ export interface Asset {
245
+ /**
246
+ * The amount of the asset held, denominated in the unit of the asset itself, with
247
+ * 1 decimal of precision.
248
+ */
249
+ amount: string;
250
+
251
+ /**
252
+ * The price of the asset in the provided currency.
253
+ */
254
+ price: Asset.Price;
255
+
256
+ /**
257
+ * The symbol of the asset (e.g. USDC, ETH).
258
+ */
259
+ symbol: string;
260
+ }
261
+
262
+ export namespace Asset {
263
+ /**
264
+ * The price of the asset in the provided currency.
265
+ */
266
+ export interface Price {
267
+ /**
268
+ * The currency code.
269
+ */
270
+ currency: 'usd';
271
+
272
+ /**
273
+ * The monetary value as a string.
274
+ */
275
+ value: string;
276
+ }
277
+ }
278
+
279
+ /**
280
+ * The total balance across all assets.
281
+ */
282
+ export interface Total {
283
+ /**
284
+ * The currency code.
285
+ */
286
+ currency: 'usd';
287
+
288
+ /**
289
+ * The monetary value as a string.
290
+ */
291
+ value: string;
292
+ }
293
+ }
294
+
295
+ /**
296
+ * Query parameters for the account balance endpoint.
297
+ */
298
+ export interface AccountBalanceParams {
299
+ /**
300
+ * When set to true, returns balances from testnet chains instead of mainnets.
301
+ */
302
+ testnet_mode?: 'true' | 'false';
81
303
  }
82
304
 
83
305
  export declare namespace Accounts {
@@ -85,6 +307,14 @@ export declare namespace Accounts {
85
307
  type AccountWallet as AccountWallet,
86
308
  type AccountResponse as AccountResponse,
87
309
  type AccountWalletConfigurationItem as AccountWalletConfigurationItem,
310
+ type AccountDisplayName as AccountDisplayName,
311
+ type AccountWalletsConfiguration as AccountWalletsConfiguration,
88
312
  type CreateAccountInput as CreateAccountInput,
313
+ type UpdateAccountInput as UpdateAccountInput,
314
+ type AccountsListResponse as AccountsListResponse,
315
+ type AssetAccountWithBalance as AssetAccountWithBalance,
316
+ type AccountsDashboardListResponse as AccountsDashboardListResponse,
317
+ type AccountBalanceResponse as AccountBalanceResponse,
318
+ type AccountBalanceParams as AccountBalanceParams,
89
319
  };
90
320
  }
@@ -0,0 +1,126 @@
1
+ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
+
3
+ import { APIResource } from '../../core/resource';
4
+ import * as AppsAPI from './apps';
5
+ import { APIPromise } from '../../core/api-promise';
6
+ import { RequestOptions } from '../../internal/request-options';
7
+ import { path } from '../../internal/utils/path';
8
+
9
+ /**
10
+ * Operations related to app settings and allowlist management
11
+ */
12
+ export class Allowlist extends APIResource {
13
+ /**
14
+ * Add a new entry to the allowlist for an app. The allowlist must be enabled.
15
+ *
16
+ * @example
17
+ * ```ts
18
+ * const allowlistEntry = await client.apps.allowlist.create(
19
+ * 'app_id',
20
+ * { type: 'email', value: 'batman@privy.io' },
21
+ * );
22
+ * ```
23
+ */
24
+ create(
25
+ appID: string,
26
+ body: AllowlistCreateParams,
27
+ options?: RequestOptions,
28
+ ): APIPromise<AppsAPI.AllowlistEntry> {
29
+ return this._client.post(path`/v1/apps/${appID}/allowlist`, { body, ...options });
30
+ }
31
+
32
+ /**
33
+ * Get all allowlist entries for an app. Returns the list of users allowed to
34
+ * access the app when the allowlist is enabled.
35
+ *
36
+ * @example
37
+ * ```ts
38
+ * const allowlistEntries = await client.apps.allowlist.list(
39
+ * 'app_id',
40
+ * );
41
+ * ```
42
+ */
43
+ list(appID: string, options?: RequestOptions): APIPromise<AllowlistListResponse> {
44
+ return this._client.get(path`/v1/apps/${appID}/allowlist`, options);
45
+ }
46
+
47
+ /**
48
+ * Remove an entry from the allowlist for an app. The allowlist must be enabled.
49
+ *
50
+ * @example
51
+ * ```ts
52
+ * const allowlistDeletionResponse =
53
+ * await client.apps.allowlist.delete('app_id', {
54
+ * type: 'email',
55
+ * value: 'batman@privy.io',
56
+ * });
57
+ * ```
58
+ */
59
+ delete(
60
+ appID: string,
61
+ body: AllowlistDeleteParams,
62
+ options?: RequestOptions,
63
+ ): APIPromise<AppsAPI.AllowlistDeletionResponse> {
64
+ return this._client.delete(path`/v1/apps/${appID}/allowlist`, { body, ...options });
65
+ }
66
+ }
67
+
68
+ export type AllowlistListResponse = Array<AppsAPI.AllowlistEntry>;
69
+
70
+ export type AllowlistCreateParams =
71
+ | AllowlistCreateParams.EmailInviteInput
72
+ | AllowlistCreateParams.WalletInviteInput
73
+ | AllowlistCreateParams.PhoneInviteInput;
74
+
75
+ export declare namespace AllowlistCreateParams {
76
+ export interface EmailInviteInput {
77
+ type: 'email';
78
+
79
+ value: string;
80
+ }
81
+
82
+ export interface WalletInviteInput {
83
+ type: 'wallet';
84
+
85
+ value: string;
86
+ }
87
+
88
+ export interface PhoneInviteInput {
89
+ type: 'phone';
90
+
91
+ value: string;
92
+ }
93
+ }
94
+
95
+ export type AllowlistDeleteParams =
96
+ | AllowlistDeleteParams.EmailInviteInput
97
+ | AllowlistDeleteParams.WalletInviteInput
98
+ | AllowlistDeleteParams.PhoneInviteInput;
99
+
100
+ export declare namespace AllowlistDeleteParams {
101
+ export interface EmailInviteInput {
102
+ type: 'email';
103
+
104
+ value: string;
105
+ }
106
+
107
+ export interface WalletInviteInput {
108
+ type: 'wallet';
109
+
110
+ value: string;
111
+ }
112
+
113
+ export interface PhoneInviteInput {
114
+ type: 'phone';
115
+
116
+ value: string;
117
+ }
118
+ }
119
+
120
+ export declare namespace Allowlist {
121
+ export {
122
+ type AllowlistListResponse as AllowlistListResponse,
123
+ type AllowlistCreateParams as AllowlistCreateParams,
124
+ type AllowlistDeleteParams as AllowlistDeleteParams,
125
+ };
126
+ }