@naturalpay/sdk 0.2.1 → 0.4.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 (234) hide show
  1. package/CHANGELOG.md +42 -0
  2. package/README.md +2 -2
  3. package/api-promise.d.mts +1 -0
  4. package/api-promise.d.mts.map +1 -1
  5. package/api-promise.d.ts +1 -0
  6. package/api-promise.d.ts.map +1 -1
  7. package/api-promise.mjs +1 -0
  8. package/api-promise.mjs.map +1 -1
  9. package/client.d.mts +37 -13
  10. package/client.d.mts.map +1 -1
  11. package/client.d.ts +37 -13
  12. package/client.d.ts.map +1 -1
  13. package/client.js +30 -6
  14. package/client.js.map +1 -1
  15. package/client.mjs +31 -7
  16. package/client.mjs.map +1 -1
  17. package/core/api-promise.d.mts.map +1 -1
  18. package/core/api-promise.d.ts.map +1 -1
  19. package/core/api-promise.mjs.map +1 -1
  20. package/core/error.mjs.map +1 -1
  21. package/core/resource.d.mts.map +1 -1
  22. package/core/resource.d.ts.map +1 -1
  23. package/core/uploads.d.mts.map +1 -1
  24. package/core/uploads.d.ts.map +1 -1
  25. package/core/uploads.mjs.map +1 -1
  26. package/error.d.mts +1 -0
  27. package/error.d.mts.map +1 -1
  28. package/error.d.ts +1 -0
  29. package/error.d.ts.map +1 -1
  30. package/error.mjs +1 -0
  31. package/error.mjs.map +1 -1
  32. package/index.d.mts.map +1 -1
  33. package/index.d.ts.map +1 -1
  34. package/index.mjs.map +1 -1
  35. package/internal/detect-platform.mjs.map +1 -1
  36. package/internal/headers.mjs.map +1 -1
  37. package/internal/parse.d.mts.map +1 -1
  38. package/internal/parse.d.ts.map +1 -1
  39. package/internal/parse.mjs.map +1 -1
  40. package/internal/qs/formats.d.mts.map +1 -1
  41. package/internal/qs/formats.d.ts.map +1 -1
  42. package/internal/qs/index.d.mts +2 -2
  43. package/internal/qs/index.d.mts.map +1 -1
  44. package/internal/qs/index.d.ts +2 -2
  45. package/internal/qs/index.d.ts.map +1 -1
  46. package/internal/qs/index.mjs.map +1 -1
  47. package/internal/qs/stringify.d.mts.map +1 -1
  48. package/internal/qs/stringify.d.ts.map +1 -1
  49. package/internal/qs/stringify.mjs.map +1 -1
  50. package/internal/qs/utils.d.mts.map +1 -1
  51. package/internal/qs/utils.d.ts.map +1 -1
  52. package/internal/qs/utils.mjs.map +1 -1
  53. package/internal/request-options.d.mts.map +1 -1
  54. package/internal/request-options.d.ts.map +1 -1
  55. package/internal/shims.d.mts +6 -0
  56. package/internal/shims.d.mts.map +1 -1
  57. package/internal/shims.d.ts +6 -0
  58. package/internal/shims.d.ts.map +1 -1
  59. package/internal/to-file.d.mts.map +1 -1
  60. package/internal/to-file.d.ts.map +1 -1
  61. package/internal/to-file.mjs.map +1 -1
  62. package/internal/types.d.mts +4 -4
  63. package/internal/types.d.mts.map +1 -1
  64. package/internal/types.d.ts +4 -4
  65. package/internal/types.d.ts.map +1 -1
  66. package/internal/uploads.d.mts.map +1 -1
  67. package/internal/uploads.d.ts.map +1 -1
  68. package/internal/uploads.mjs.map +1 -1
  69. package/internal/utils/base64.mjs.map +1 -1
  70. package/internal/utils/log.d.mts.map +1 -1
  71. package/internal/utils/log.d.ts.map +1 -1
  72. package/internal/utils/log.mjs.map +1 -1
  73. package/internal/utils/path.mjs.map +1 -1
  74. package/internal/utils/query.mjs.map +1 -1
  75. package/internal/utils/values.mjs.map +1 -1
  76. package/internal/utils.d.mts.map +1 -1
  77. package/internal/utils.d.ts.map +1 -1
  78. package/internal/utils.mjs.map +1 -1
  79. package/lib/envelope.d.mts.map +1 -1
  80. package/lib/envelope.d.ts.map +1 -1
  81. package/lib/envelope.mjs.map +1 -1
  82. package/package.json +1 -1
  83. package/resource.d.mts +1 -0
  84. package/resource.d.mts.map +1 -1
  85. package/resource.d.ts +1 -0
  86. package/resource.d.ts.map +1 -1
  87. package/resource.mjs +1 -0
  88. package/resource.mjs.map +1 -1
  89. package/resources/agents.d.mts +4 -153
  90. package/resources/agents.d.mts.map +1 -1
  91. package/resources/agents.d.ts +4 -153
  92. package/resources/agents.d.ts.map +1 -1
  93. package/resources/agents.js +5 -5
  94. package/resources/agents.js.map +1 -1
  95. package/resources/agents.mjs +5 -5
  96. package/resources/agents.mjs.map +1 -1
  97. package/resources/api-keys.d.mts +16 -2
  98. package/resources/api-keys.d.mts.map +1 -1
  99. package/resources/api-keys.d.ts +16 -2
  100. package/resources/api-keys.d.ts.map +1 -1
  101. package/resources/api-keys.js +7 -4
  102. package/resources/api-keys.js.map +1 -1
  103. package/resources/api-keys.mjs +7 -4
  104. package/resources/api-keys.mjs.map +1 -1
  105. package/resources/counterparties.d.mts +5 -55
  106. package/resources/counterparties.d.mts.map +1 -1
  107. package/resources/counterparties.d.ts +5 -55
  108. package/resources/counterparties.d.ts.map +1 -1
  109. package/resources/counterparties.js +1 -3
  110. package/resources/counterparties.js.map +1 -1
  111. package/resources/counterparties.mjs +1 -3
  112. package/resources/counterparties.mjs.map +1 -1
  113. package/resources/customers.d.mts.map +1 -1
  114. package/resources/customers.d.ts.map +1 -1
  115. package/resources/customers.mjs.map +1 -1
  116. package/resources/delegations.d.mts.map +1 -1
  117. package/resources/delegations.d.ts.map +1 -1
  118. package/resources/delegations.mjs.map +1 -1
  119. package/resources/escalations.d.mts +1124 -0
  120. package/resources/escalations.d.mts.map +1 -0
  121. package/resources/escalations.d.ts +1124 -0
  122. package/resources/escalations.d.ts.map +1 -0
  123. package/resources/escalations.js +110 -0
  124. package/resources/escalations.js.map +1 -0
  125. package/resources/escalations.mjs +106 -0
  126. package/resources/escalations.mjs.map +1 -0
  127. package/resources/external-accounts.d.mts +239 -0
  128. package/resources/external-accounts.d.mts.map +1 -0
  129. package/resources/external-accounts.d.ts +239 -0
  130. package/resources/external-accounts.d.ts.map +1 -0
  131. package/resources/external-accounts.js +47 -0
  132. package/resources/external-accounts.js.map +1 -0
  133. package/resources/external-accounts.mjs +43 -0
  134. package/resources/external-accounts.mjs.map +1 -0
  135. package/resources/index.d.mts +8 -4
  136. package/resources/index.d.mts.map +1 -1
  137. package/resources/index.d.ts +8 -4
  138. package/resources/index.d.ts.map +1 -1
  139. package/resources/index.js +9 -1
  140. package/resources/index.js.map +1 -1
  141. package/resources/index.mjs +5 -1
  142. package/resources/index.mjs.map +1 -1
  143. package/resources/invitations.d.mts +17 -8
  144. package/resources/invitations.d.mts.map +1 -1
  145. package/resources/invitations.d.ts +17 -8
  146. package/resources/invitations.d.ts.map +1 -1
  147. package/resources/invitations.js +7 -5
  148. package/resources/invitations.js.map +1 -1
  149. package/resources/invitations.mjs +7 -5
  150. package/resources/invitations.mjs.map +1 -1
  151. package/resources/parties.d.mts +55 -28
  152. package/resources/parties.d.mts.map +1 -1
  153. package/resources/parties.d.ts +55 -28
  154. package/resources/parties.d.ts.map +1 -1
  155. package/resources/parties.js +30 -4
  156. package/resources/parties.js.map +1 -1
  157. package/resources/parties.mjs +30 -4
  158. package/resources/parties.mjs.map +1 -1
  159. package/resources/payment-requests.d.mts +751 -39
  160. package/resources/payment-requests.d.mts.map +1 -1
  161. package/resources/payment-requests.d.ts +751 -39
  162. package/resources/payment-requests.d.ts.map +1 -1
  163. package/resources/payment-requests.js +82 -2
  164. package/resources/payment-requests.js.map +1 -1
  165. package/resources/payment-requests.mjs +82 -2
  166. package/resources/payment-requests.mjs.map +1 -1
  167. package/resources/payments.d.mts +390 -24
  168. package/resources/payments.d.mts.map +1 -1
  169. package/resources/payments.d.ts +390 -24
  170. package/resources/payments.d.ts.map +1 -1
  171. package/resources/payments.js +53 -3
  172. package/resources/payments.js.map +1 -1
  173. package/resources/payments.mjs +53 -3
  174. package/resources/payments.mjs.map +1 -1
  175. package/resources/transactions.d.mts +53 -113
  176. package/resources/transactions.d.mts.map +1 -1
  177. package/resources/transactions.d.ts +53 -113
  178. package/resources/transactions.d.ts.map +1 -1
  179. package/resources/transactions.js +3 -3
  180. package/resources/transactions.mjs +3 -3
  181. package/resources/transactions.mjs.map +1 -1
  182. package/resources/transfers.d.mts +1030 -0
  183. package/resources/transfers.d.mts.map +1 -0
  184. package/resources/transfers.d.ts +1030 -0
  185. package/resources/transfers.d.ts.map +1 -0
  186. package/resources/transfers.js +114 -0
  187. package/resources/transfers.js.map +1 -0
  188. package/resources/transfers.mjs +110 -0
  189. package/resources/transfers.mjs.map +1 -0
  190. package/resources/wallet.d.mts +117 -437
  191. package/resources/wallet.d.mts.map +1 -1
  192. package/resources/wallet.d.ts +117 -437
  193. package/resources/wallet.d.ts.map +1 -1
  194. package/resources/wallet.js +9 -122
  195. package/resources/wallet.js.map +1 -1
  196. package/resources/wallet.mjs +9 -122
  197. package/resources/wallet.mjs.map +1 -1
  198. package/resources/webhooks.d.mts +775 -0
  199. package/resources/webhooks.d.mts.map +1 -0
  200. package/resources/webhooks.d.ts +775 -0
  201. package/resources/webhooks.d.ts.map +1 -0
  202. package/resources/webhooks.js +163 -0
  203. package/resources/webhooks.js.map +1 -0
  204. package/resources/webhooks.mjs +159 -0
  205. package/resources/webhooks.mjs.map +1 -0
  206. package/resources.d.mts.map +1 -1
  207. package/resources.d.ts.map +1 -1
  208. package/resources.mjs.map +1 -1
  209. package/src/client.ts +156 -32
  210. package/src/resources/agents.ts +5 -185
  211. package/src/resources/api-keys.ts +26 -4
  212. package/src/resources/counterparties.ts +5 -64
  213. package/src/resources/escalations.ts +1422 -0
  214. package/src/resources/external-accounts.ts +324 -0
  215. package/src/resources/index.ts +65 -13
  216. package/src/resources/invitations.ts +27 -11
  217. package/src/resources/parties.ts +88 -33
  218. package/src/resources/payment-requests.ts +945 -44
  219. package/src/resources/payments.ts +518 -23
  220. package/src/resources/transactions.ts +53 -129
  221. package/src/resources/transfers.ts +1338 -0
  222. package/src/resources/wallet.ts +133 -597
  223. package/src/resources/webhooks.ts +1232 -0
  224. package/src/version.ts +1 -1
  225. package/uploads.d.mts +1 -0
  226. package/uploads.d.mts.map +1 -1
  227. package/uploads.d.ts +1 -0
  228. package/uploads.d.ts.map +1 -1
  229. package/uploads.mjs +1 -0
  230. package/uploads.mjs.map +1 -1
  231. package/version.d.mts +1 -1
  232. package/version.d.ts +1 -1
  233. package/version.js +1 -1
  234. package/version.mjs +1 -1
@@ -0,0 +1,1232 @@
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 { buildHeaders } from '../internal/headers';
6
+ import { RequestOptions } from '../internal/request-options';
7
+ import { path } from '../internal/utils/path';
8
+
9
+ /**
10
+ * Webhook endpoint management
11
+ */
12
+ export class Webhooks extends APIResource {
13
+ /**
14
+ * Create a new webhook endpoint. The signing secret is returned only once.
15
+ *
16
+ * @example
17
+ * ```ts
18
+ * const webhook = await client.webhooks.create({
19
+ * enabledEvents: ['*'],
20
+ * url: 'https://example.com',
21
+ * 'Idempotency-Key': 'Idempotency-Key',
22
+ * });
23
+ * ```
24
+ */
25
+ create(params: WebhookCreateParams, options?: RequestOptions): APIPromise<WebhookCreateResponse> {
26
+ const {
27
+ 'Idempotency-Key': idempotencyKey,
28
+ 'X-Agent-ID': xAgentID,
29
+ 'X-Instance-ID': xInstanceID,
30
+ ...body
31
+ } = params;
32
+ return this._client.post('/webhooks', {
33
+ body,
34
+ ...options,
35
+ headers: buildHeaders([
36
+ {
37
+ 'Idempotency-Key': idempotencyKey,
38
+ ...(xAgentID != null ? { 'X-Agent-ID': xAgentID } : undefined),
39
+ ...(xInstanceID != null ? { 'X-Instance-ID': xInstanceID } : undefined),
40
+ },
41
+ options?.headers,
42
+ ]),
43
+ });
44
+ }
45
+
46
+ /**
47
+ * Partially update a webhook endpoint.
48
+ *
49
+ * @example
50
+ * ```ts
51
+ * const webhook = await client.webhooks.update('webhookId', {
52
+ * 'Idempotency-Key': 'Idempotency-Key',
53
+ * });
54
+ * ```
55
+ */
56
+ update(
57
+ webhookID: string,
58
+ params: WebhookUpdateParams,
59
+ options?: RequestOptions,
60
+ ): APIPromise<WebhookUpdateResponse> {
61
+ const {
62
+ 'Idempotency-Key': idempotencyKey,
63
+ 'X-Agent-ID': xAgentID,
64
+ 'X-Instance-ID': xInstanceID,
65
+ ...body
66
+ } = params;
67
+ return this._client.put(path`/webhooks/${webhookID}`, {
68
+ body,
69
+ ...options,
70
+ headers: buildHeaders([
71
+ {
72
+ 'Idempotency-Key': idempotencyKey,
73
+ ...(xAgentID != null ? { 'X-Agent-ID': xAgentID } : undefined),
74
+ ...(xInstanceID != null ? { 'X-Instance-ID': xInstanceID } : undefined),
75
+ },
76
+ options?.headers,
77
+ ]),
78
+ });
79
+ }
80
+
81
+ /**
82
+ * List webhook endpoints for the authenticated party.
83
+ *
84
+ * @example
85
+ * ```ts
86
+ * const webhooks = await client.webhooks.list();
87
+ * ```
88
+ */
89
+ list(
90
+ params: WebhookListParams | null | undefined = {},
91
+ options?: RequestOptions,
92
+ ): APIPromise<WebhookListResponse> {
93
+ const { 'X-Agent-ID': xAgentID, 'X-Instance-ID': xInstanceID, ...query } = params ?? {};
94
+ return this._client.get('/webhooks', {
95
+ query,
96
+ ...options,
97
+ headers: buildHeaders([
98
+ {
99
+ ...(xAgentID != null ? { 'X-Agent-ID': xAgentID } : undefined),
100
+ ...(xInstanceID != null ? { 'X-Instance-ID': xInstanceID } : undefined),
101
+ },
102
+ options?.headers,
103
+ ]),
104
+ });
105
+ }
106
+
107
+ /**
108
+ * Get details of a specific webhook endpoint.
109
+ *
110
+ * @example
111
+ * ```ts
112
+ * const webhook = await client.webhooks.get('webhookId');
113
+ * ```
114
+ */
115
+ get(
116
+ webhookID: string,
117
+ params: WebhookGetParams | null | undefined = {},
118
+ options?: RequestOptions,
119
+ ): APIPromise<WebhookGetResponse> {
120
+ const { 'X-Agent-ID': xAgentID, 'X-Instance-ID': xInstanceID } = params ?? {};
121
+ return this._client.get(path`/webhooks/${webhookID}`, {
122
+ ...options,
123
+ headers: buildHeaders([
124
+ {
125
+ ...(xAgentID != null ? { 'X-Agent-ID': xAgentID } : undefined),
126
+ ...(xInstanceID != null ? { 'X-Instance-ID': xInstanceID } : undefined),
127
+ },
128
+ options?.headers,
129
+ ]),
130
+ });
131
+ }
132
+
133
+ /**
134
+ * Soft-delete a webhook endpoint.
135
+ *
136
+ * @example
137
+ * ```ts
138
+ * const webhook = await client.webhooks.remove('webhookId', {
139
+ * 'Idempotency-Key': 'Idempotency-Key',
140
+ * });
141
+ * ```
142
+ */
143
+ remove(
144
+ webhookID: string,
145
+ params: WebhookRemoveParams,
146
+ options?: RequestOptions,
147
+ ): APIPromise<WebhookRemoveResponse> {
148
+ const {
149
+ 'Idempotency-Key': idempotencyKey,
150
+ 'X-Agent-ID': xAgentID,
151
+ 'X-Instance-ID': xInstanceID,
152
+ } = params;
153
+ return this._client.delete(path`/webhooks/${webhookID}`, {
154
+ ...options,
155
+ headers: buildHeaders([
156
+ {
157
+ 'Idempotency-Key': idempotencyKey,
158
+ ...(xAgentID != null ? { 'X-Agent-ID': xAgentID } : undefined),
159
+ ...(xInstanceID != null ? { 'X-Instance-ID': xInstanceID } : undefined),
160
+ },
161
+ options?.headers,
162
+ ]),
163
+ });
164
+ }
165
+
166
+ /**
167
+ * Generate a new signing secret. The previous secret remains valid for the
168
+ * specified grace period. Requires Idempotency-Key header.
169
+ *
170
+ * @example
171
+ * ```ts
172
+ * const response = await client.webhooks.rotateSecret(
173
+ * 'webhookId',
174
+ * {
175
+ * expiresInSeconds: 0,
176
+ * 'Idempotency-Key': 'Idempotency-Key',
177
+ * },
178
+ * );
179
+ * ```
180
+ */
181
+ rotateSecret(
182
+ webhookID: string,
183
+ params: WebhookRotateSecretParams,
184
+ options?: RequestOptions,
185
+ ): APIPromise<WebhookRotateSecretResponse> {
186
+ const {
187
+ 'Idempotency-Key': idempotencyKey,
188
+ 'X-Agent-ID': xAgentID,
189
+ 'X-Instance-ID': xInstanceID,
190
+ ...body
191
+ } = params;
192
+ return this._client.post(path`/webhooks/${webhookID}/rotate-secret`, {
193
+ body,
194
+ ...options,
195
+ headers: buildHeaders([
196
+ {
197
+ 'Idempotency-Key': idempotencyKey,
198
+ ...(xAgentID != null ? { 'X-Agent-ID': xAgentID } : undefined),
199
+ ...(xInstanceID != null ? { 'X-Instance-ID': xInstanceID } : undefined),
200
+ },
201
+ options?.headers,
202
+ ]),
203
+ });
204
+ }
205
+ }
206
+
207
+ export interface WebhookCreateResponse {
208
+ data: WebhookCreateResponse.Data;
209
+ }
210
+
211
+ export namespace WebhookCreateResponse {
212
+ export interface Data {
213
+ /**
214
+ * Resource ID (whk_xxx)
215
+ */
216
+ id: string;
217
+
218
+ /**
219
+ * Resource attributes
220
+ */
221
+ attributes: Data.Attributes;
222
+
223
+ /**
224
+ * Resource relationships
225
+ */
226
+ relationships: Data.Relationships;
227
+
228
+ /**
229
+ * Resource type
230
+ */
231
+ type: string;
232
+ }
233
+
234
+ export namespace Data {
235
+ /**
236
+ * Resource attributes
237
+ */
238
+ export interface Attributes {
239
+ /**
240
+ * Creation timestamp (ISO 8601)
241
+ */
242
+ createdAt: string;
243
+
244
+ /**
245
+ * Human-readable description
246
+ */
247
+ description: string;
248
+
249
+ /**
250
+ * Event types this webhook listens to
251
+ */
252
+ enabledEvents: Array<
253
+ | '*'
254
+ | 'party.updated'
255
+ | 'party.delegation_granted'
256
+ | 'wallet.created'
257
+ | 'external_account.connected'
258
+ | 'agent_delegation_invitation.created'
259
+ | 'agent_delegation_invitation.accepted'
260
+ | 'agent_delegation_invitation.declined'
261
+ | 'agent_delegation_invitation.cancelled'
262
+ | 'agent_delegation.revoked'
263
+ | 'delegation.activated'
264
+ | 'delegation.revoked'
265
+ | 'deposit.created'
266
+ | 'deposit.completed'
267
+ | 'deposit.failed'
268
+ | 'deposit.returned'
269
+ | 'withdrawal.created'
270
+ | 'withdrawal.completed'
271
+ | 'withdrawal.failed'
272
+ | 'withdrawal.returned'
273
+ | 'payment.created'
274
+ | 'payment.completed'
275
+ | 'payment.failed'
276
+ | 'payment_request.created'
277
+ | 'payment_request.completed'
278
+ | 'payment_request.failed'
279
+ | 'payment_request.returned'
280
+ | 'payment_request.incoming'
281
+ >;
282
+
283
+ /**
284
+ * Webhook signing secret (shown only once — store securely!)
285
+ */
286
+ signingSecret: string;
287
+
288
+ /**
289
+ * Webhook status
290
+ */
291
+ status: 'ENABLED' | 'DISABLED';
292
+
293
+ /**
294
+ * Custom metadata tags
295
+ */
296
+ tags: { [key: string]: string };
297
+
298
+ /**
299
+ * Last update timestamp (ISO 8601)
300
+ */
301
+ updatedAt: string;
302
+
303
+ /**
304
+ * Webhook endpoint URL
305
+ */
306
+ url: string;
307
+ }
308
+
309
+ /**
310
+ * Resource relationships
311
+ */
312
+ export interface Relationships {
313
+ /**
314
+ * Party that owns the webhook
315
+ */
316
+ party: Relationships.Party;
317
+ }
318
+
319
+ export namespace Relationships {
320
+ /**
321
+ * Party that owns the webhook
322
+ */
323
+ export interface Party {
324
+ /**
325
+ * Related resource identifier
326
+ */
327
+ data: Party.Data;
328
+ }
329
+
330
+ export namespace Party {
331
+ /**
332
+ * Related resource identifier
333
+ */
334
+ export interface Data {
335
+ id: string;
336
+
337
+ /**
338
+ * Resource type
339
+ */
340
+ type: string;
341
+ }
342
+ }
343
+ }
344
+ }
345
+ }
346
+
347
+ export interface WebhookUpdateResponse {
348
+ data: WebhookUpdateResponse.Data;
349
+ }
350
+
351
+ export namespace WebhookUpdateResponse {
352
+ export interface Data {
353
+ /**
354
+ * Resource ID (whk_xxx)
355
+ */
356
+ id: string;
357
+
358
+ /**
359
+ * Resource attributes
360
+ */
361
+ attributes: Data.Attributes;
362
+
363
+ /**
364
+ * Resource relationships
365
+ */
366
+ relationships: Data.Relationships;
367
+
368
+ /**
369
+ * Resource type
370
+ */
371
+ type: string;
372
+ }
373
+
374
+ export namespace Data {
375
+ /**
376
+ * Resource attributes
377
+ */
378
+ export interface Attributes {
379
+ /**
380
+ * Creation timestamp (ISO 8601)
381
+ */
382
+ createdAt: string;
383
+
384
+ /**
385
+ * Human-readable description
386
+ */
387
+ description: string;
388
+
389
+ /**
390
+ * Event types this webhook listens to
391
+ */
392
+ enabledEvents: Array<
393
+ | '*'
394
+ | 'party.updated'
395
+ | 'party.delegation_granted'
396
+ | 'wallet.created'
397
+ | 'external_account.connected'
398
+ | 'agent_delegation_invitation.created'
399
+ | 'agent_delegation_invitation.accepted'
400
+ | 'agent_delegation_invitation.declined'
401
+ | 'agent_delegation_invitation.cancelled'
402
+ | 'agent_delegation.revoked'
403
+ | 'delegation.activated'
404
+ | 'delegation.revoked'
405
+ | 'deposit.created'
406
+ | 'deposit.completed'
407
+ | 'deposit.failed'
408
+ | 'deposit.returned'
409
+ | 'withdrawal.created'
410
+ | 'withdrawal.completed'
411
+ | 'withdrawal.failed'
412
+ | 'withdrawal.returned'
413
+ | 'payment.created'
414
+ | 'payment.completed'
415
+ | 'payment.failed'
416
+ | 'payment_request.created'
417
+ | 'payment_request.completed'
418
+ | 'payment_request.failed'
419
+ | 'payment_request.returned'
420
+ | 'payment_request.incoming'
421
+ >;
422
+
423
+ /**
424
+ * Webhook status
425
+ */
426
+ status: 'ENABLED' | 'DISABLED';
427
+
428
+ /**
429
+ * Custom metadata tags
430
+ */
431
+ tags: { [key: string]: string };
432
+
433
+ /**
434
+ * Last update timestamp (ISO 8601)
435
+ */
436
+ updatedAt: string;
437
+
438
+ /**
439
+ * Webhook endpoint URL
440
+ */
441
+ url: string;
442
+ }
443
+
444
+ /**
445
+ * Resource relationships
446
+ */
447
+ export interface Relationships {
448
+ /**
449
+ * Party that owns the webhook
450
+ */
451
+ party: Relationships.Party;
452
+ }
453
+
454
+ export namespace Relationships {
455
+ /**
456
+ * Party that owns the webhook
457
+ */
458
+ export interface Party {
459
+ /**
460
+ * Related resource identifier
461
+ */
462
+ data: Party.Data;
463
+ }
464
+
465
+ export namespace Party {
466
+ /**
467
+ * Related resource identifier
468
+ */
469
+ export interface Data {
470
+ id: string;
471
+
472
+ /**
473
+ * Resource type
474
+ */
475
+ type: string;
476
+ }
477
+ }
478
+ }
479
+ }
480
+ }
481
+
482
+ export interface WebhookListResponse {
483
+ data: Array<WebhookListResponse.Data>;
484
+
485
+ meta: WebhookListResponse.Meta;
486
+ }
487
+
488
+ export namespace WebhookListResponse {
489
+ export interface Data {
490
+ /**
491
+ * Resource ID (whk_xxx)
492
+ */
493
+ id: string;
494
+
495
+ /**
496
+ * Resource attributes
497
+ */
498
+ attributes: Data.Attributes;
499
+
500
+ /**
501
+ * Resource relationships
502
+ */
503
+ relationships: Data.Relationships;
504
+
505
+ /**
506
+ * Resource type
507
+ */
508
+ type: string;
509
+ }
510
+
511
+ export namespace Data {
512
+ /**
513
+ * Resource attributes
514
+ */
515
+ export interface Attributes {
516
+ /**
517
+ * Creation timestamp (ISO 8601)
518
+ */
519
+ createdAt: string;
520
+
521
+ /**
522
+ * Human-readable description
523
+ */
524
+ description: string;
525
+
526
+ /**
527
+ * Event types this webhook listens to
528
+ */
529
+ enabledEvents: Array<
530
+ | '*'
531
+ | 'party.updated'
532
+ | 'party.delegation_granted'
533
+ | 'wallet.created'
534
+ | 'external_account.connected'
535
+ | 'agent_delegation_invitation.created'
536
+ | 'agent_delegation_invitation.accepted'
537
+ | 'agent_delegation_invitation.declined'
538
+ | 'agent_delegation_invitation.cancelled'
539
+ | 'agent_delegation.revoked'
540
+ | 'delegation.activated'
541
+ | 'delegation.revoked'
542
+ | 'deposit.created'
543
+ | 'deposit.completed'
544
+ | 'deposit.failed'
545
+ | 'deposit.returned'
546
+ | 'withdrawal.created'
547
+ | 'withdrawal.completed'
548
+ | 'withdrawal.failed'
549
+ | 'withdrawal.returned'
550
+ | 'payment.created'
551
+ | 'payment.completed'
552
+ | 'payment.failed'
553
+ | 'payment_request.created'
554
+ | 'payment_request.completed'
555
+ | 'payment_request.failed'
556
+ | 'payment_request.returned'
557
+ | 'payment_request.incoming'
558
+ >;
559
+
560
+ /**
561
+ * Webhook status
562
+ */
563
+ status: 'ENABLED' | 'DISABLED';
564
+
565
+ /**
566
+ * Custom metadata tags
567
+ */
568
+ tags: { [key: string]: string };
569
+
570
+ /**
571
+ * Last update timestamp (ISO 8601)
572
+ */
573
+ updatedAt: string;
574
+
575
+ /**
576
+ * Webhook endpoint URL
577
+ */
578
+ url: string;
579
+ }
580
+
581
+ /**
582
+ * Resource relationships
583
+ */
584
+ export interface Relationships {
585
+ /**
586
+ * Party that owns the webhook
587
+ */
588
+ party: Relationships.Party;
589
+ }
590
+
591
+ export namespace Relationships {
592
+ /**
593
+ * Party that owns the webhook
594
+ */
595
+ export interface Party {
596
+ /**
597
+ * Related resource identifier
598
+ */
599
+ data: Party.Data;
600
+ }
601
+
602
+ export namespace Party {
603
+ /**
604
+ * Related resource identifier
605
+ */
606
+ export interface Data {
607
+ id: string;
608
+
609
+ /**
610
+ * Resource type
611
+ */
612
+ type: string;
613
+ }
614
+ }
615
+ }
616
+ }
617
+
618
+ export interface Meta {
619
+ pagination: Meta.Pagination;
620
+ }
621
+
622
+ export namespace Meta {
623
+ export interface Pagination {
624
+ hasMore: boolean;
625
+
626
+ nextCursor: string | null;
627
+ }
628
+ }
629
+ }
630
+
631
+ export interface WebhookGetResponse {
632
+ data: WebhookGetResponse.Data;
633
+ }
634
+
635
+ export namespace WebhookGetResponse {
636
+ export interface Data {
637
+ /**
638
+ * Resource ID (whk_xxx)
639
+ */
640
+ id: string;
641
+
642
+ /**
643
+ * Resource attributes
644
+ */
645
+ attributes: Data.Attributes;
646
+
647
+ /**
648
+ * Resource relationships
649
+ */
650
+ relationships: Data.Relationships;
651
+
652
+ /**
653
+ * Resource type
654
+ */
655
+ type: string;
656
+ }
657
+
658
+ export namespace Data {
659
+ /**
660
+ * Resource attributes
661
+ */
662
+ export interface Attributes {
663
+ /**
664
+ * Creation timestamp (ISO 8601)
665
+ */
666
+ createdAt: string;
667
+
668
+ /**
669
+ * Human-readable description
670
+ */
671
+ description: string;
672
+
673
+ /**
674
+ * Event types this webhook listens to
675
+ */
676
+ enabledEvents: Array<
677
+ | '*'
678
+ | 'party.updated'
679
+ | 'party.delegation_granted'
680
+ | 'wallet.created'
681
+ | 'external_account.connected'
682
+ | 'agent_delegation_invitation.created'
683
+ | 'agent_delegation_invitation.accepted'
684
+ | 'agent_delegation_invitation.declined'
685
+ | 'agent_delegation_invitation.cancelled'
686
+ | 'agent_delegation.revoked'
687
+ | 'delegation.activated'
688
+ | 'delegation.revoked'
689
+ | 'deposit.created'
690
+ | 'deposit.completed'
691
+ | 'deposit.failed'
692
+ | 'deposit.returned'
693
+ | 'withdrawal.created'
694
+ | 'withdrawal.completed'
695
+ | 'withdrawal.failed'
696
+ | 'withdrawal.returned'
697
+ | 'payment.created'
698
+ | 'payment.completed'
699
+ | 'payment.failed'
700
+ | 'payment_request.created'
701
+ | 'payment_request.completed'
702
+ | 'payment_request.failed'
703
+ | 'payment_request.returned'
704
+ | 'payment_request.incoming'
705
+ >;
706
+
707
+ /**
708
+ * Webhook status
709
+ */
710
+ status: 'ENABLED' | 'DISABLED';
711
+
712
+ /**
713
+ * Custom metadata tags
714
+ */
715
+ tags: { [key: string]: string };
716
+
717
+ /**
718
+ * Last update timestamp (ISO 8601)
719
+ */
720
+ updatedAt: string;
721
+
722
+ /**
723
+ * Webhook endpoint URL
724
+ */
725
+ url: string;
726
+ }
727
+
728
+ /**
729
+ * Resource relationships
730
+ */
731
+ export interface Relationships {
732
+ /**
733
+ * Party that owns the webhook
734
+ */
735
+ party: Relationships.Party;
736
+ }
737
+
738
+ export namespace Relationships {
739
+ /**
740
+ * Party that owns the webhook
741
+ */
742
+ export interface Party {
743
+ /**
744
+ * Related resource identifier
745
+ */
746
+ data: Party.Data;
747
+ }
748
+
749
+ export namespace Party {
750
+ /**
751
+ * Related resource identifier
752
+ */
753
+ export interface Data {
754
+ id: string;
755
+
756
+ /**
757
+ * Resource type
758
+ */
759
+ type: string;
760
+ }
761
+ }
762
+ }
763
+ }
764
+ }
765
+
766
+ export interface WebhookRemoveResponse {
767
+ data: WebhookRemoveResponse.Data;
768
+
769
+ meta: WebhookRemoveResponse.Meta;
770
+ }
771
+
772
+ export namespace WebhookRemoveResponse {
773
+ export interface Data {
774
+ /**
775
+ * Resource ID (whk_xxx)
776
+ */
777
+ id: string;
778
+
779
+ /**
780
+ * Resource attributes
781
+ */
782
+ attributes: Data.Attributes;
783
+
784
+ /**
785
+ * Resource relationships
786
+ */
787
+ relationships: Data.Relationships;
788
+
789
+ /**
790
+ * Resource type
791
+ */
792
+ type: string;
793
+ }
794
+
795
+ export namespace Data {
796
+ /**
797
+ * Resource attributes
798
+ */
799
+ export interface Attributes {
800
+ /**
801
+ * Creation timestamp (ISO 8601)
802
+ */
803
+ createdAt: string;
804
+
805
+ /**
806
+ * Human-readable description
807
+ */
808
+ description: string;
809
+
810
+ /**
811
+ * Event types this webhook listens to
812
+ */
813
+ enabledEvents: Array<
814
+ | '*'
815
+ | 'party.updated'
816
+ | 'party.delegation_granted'
817
+ | 'wallet.created'
818
+ | 'external_account.connected'
819
+ | 'agent_delegation_invitation.created'
820
+ | 'agent_delegation_invitation.accepted'
821
+ | 'agent_delegation_invitation.declined'
822
+ | 'agent_delegation_invitation.cancelled'
823
+ | 'agent_delegation.revoked'
824
+ | 'delegation.activated'
825
+ | 'delegation.revoked'
826
+ | 'deposit.created'
827
+ | 'deposit.completed'
828
+ | 'deposit.failed'
829
+ | 'deposit.returned'
830
+ | 'withdrawal.created'
831
+ | 'withdrawal.completed'
832
+ | 'withdrawal.failed'
833
+ | 'withdrawal.returned'
834
+ | 'payment.created'
835
+ | 'payment.completed'
836
+ | 'payment.failed'
837
+ | 'payment_request.created'
838
+ | 'payment_request.completed'
839
+ | 'payment_request.failed'
840
+ | 'payment_request.returned'
841
+ | 'payment_request.incoming'
842
+ >;
843
+
844
+ /**
845
+ * Webhook status
846
+ */
847
+ status: 'ENABLED' | 'DISABLED';
848
+
849
+ /**
850
+ * Custom metadata tags
851
+ */
852
+ tags: { [key: string]: string };
853
+
854
+ /**
855
+ * Last update timestamp (ISO 8601)
856
+ */
857
+ updatedAt: string;
858
+
859
+ /**
860
+ * Webhook endpoint URL
861
+ */
862
+ url: string;
863
+ }
864
+
865
+ /**
866
+ * Resource relationships
867
+ */
868
+ export interface Relationships {
869
+ /**
870
+ * Party that owns the webhook
871
+ */
872
+ party: Relationships.Party;
873
+ }
874
+
875
+ export namespace Relationships {
876
+ /**
877
+ * Party that owns the webhook
878
+ */
879
+ export interface Party {
880
+ /**
881
+ * Related resource identifier
882
+ */
883
+ data: Party.Data;
884
+ }
885
+
886
+ export namespace Party {
887
+ /**
888
+ * Related resource identifier
889
+ */
890
+ export interface Data {
891
+ id: string;
892
+
893
+ /**
894
+ * Resource type
895
+ */
896
+ type: string;
897
+ }
898
+ }
899
+ }
900
+ }
901
+
902
+ export interface Meta {
903
+ /**
904
+ * Indicates the resource was deleted
905
+ */
906
+ deleted: true;
907
+ }
908
+ }
909
+
910
+ export interface WebhookRotateSecretResponse {
911
+ data: WebhookRotateSecretResponse.Data;
912
+ }
913
+
914
+ export namespace WebhookRotateSecretResponse {
915
+ export interface Data {
916
+ /**
917
+ * Resource ID (whk_xxx)
918
+ */
919
+ id: string;
920
+
921
+ /**
922
+ * Resource attributes
923
+ */
924
+ attributes: Data.Attributes;
925
+
926
+ /**
927
+ * Resource relationships
928
+ */
929
+ relationships: Data.Relationships;
930
+
931
+ /**
932
+ * Resource type
933
+ */
934
+ type: string;
935
+ }
936
+
937
+ export namespace Data {
938
+ /**
939
+ * Resource attributes
940
+ */
941
+ export interface Attributes {
942
+ /**
943
+ * When the previous secret expires (null if immediate cutover)
944
+ */
945
+ previousSecretExpiresAt: string | null;
946
+
947
+ /**
948
+ * New webhook signing secret (shown only once — store securely!)
949
+ */
950
+ signingSecret: string;
951
+ }
952
+
953
+ /**
954
+ * Resource relationships
955
+ */
956
+ export interface Relationships {
957
+ /**
958
+ * Party that owns the webhook
959
+ */
960
+ party: Relationships.Party;
961
+ }
962
+
963
+ export namespace Relationships {
964
+ /**
965
+ * Party that owns the webhook
966
+ */
967
+ export interface Party {
968
+ /**
969
+ * Related resource identifier
970
+ */
971
+ data: Party.Data;
972
+ }
973
+
974
+ export namespace Party {
975
+ /**
976
+ * Related resource identifier
977
+ */
978
+ export interface Data {
979
+ id: string;
980
+
981
+ /**
982
+ * Resource type
983
+ */
984
+ type: string;
985
+ }
986
+ }
987
+ }
988
+ }
989
+ }
990
+
991
+ export interface WebhookCreateParams {
992
+ /**
993
+ * Body param: Event types to subscribe to
994
+ */
995
+ enabledEvents: Array<
996
+ | '*'
997
+ | 'party.updated'
998
+ | 'party.delegation_granted'
999
+ | 'wallet.created'
1000
+ | 'external_account.connected'
1001
+ | 'agent_delegation_invitation.created'
1002
+ | 'agent_delegation_invitation.accepted'
1003
+ | 'agent_delegation_invitation.declined'
1004
+ | 'agent_delegation_invitation.cancelled'
1005
+ | 'agent_delegation.revoked'
1006
+ | 'delegation.activated'
1007
+ | 'delegation.revoked'
1008
+ | 'deposit.created'
1009
+ | 'deposit.completed'
1010
+ | 'deposit.failed'
1011
+ | 'deposit.returned'
1012
+ | 'withdrawal.created'
1013
+ | 'withdrawal.completed'
1014
+ | 'withdrawal.failed'
1015
+ | 'withdrawal.returned'
1016
+ | 'payment.created'
1017
+ | 'payment.completed'
1018
+ | 'payment.failed'
1019
+ | 'payment_request.created'
1020
+ | 'payment_request.completed'
1021
+ | 'payment_request.failed'
1022
+ | 'payment_request.returned'
1023
+ | 'payment_request.incoming'
1024
+ >;
1025
+
1026
+ /**
1027
+ * Body param: Webhook endpoint URL
1028
+ */
1029
+ url: string;
1030
+
1031
+ /**
1032
+ * Header param: Unique key for idempotent request handling. If a request with the
1033
+ * same key was already processed, the original response is returned.
1034
+ */
1035
+ 'Idempotency-Key': string;
1036
+
1037
+ /**
1038
+ * Body param: Human-readable description
1039
+ */
1040
+ description?: string;
1041
+
1042
+ /**
1043
+ * Body param: Custom metadata tags
1044
+ */
1045
+ tags?: { [key: string]: string };
1046
+
1047
+ /**
1048
+ * Header param: Agent ID (agt_xxx) identifying which agent is making the request.
1049
+ */
1050
+ 'X-Agent-ID'?: string;
1051
+
1052
+ /**
1053
+ * Header param: Required when X-Agent-ID is present. Session or conversation ID
1054
+ * for agent observability.
1055
+ */
1056
+ 'X-Instance-ID'?: string;
1057
+ }
1058
+
1059
+ export interface WebhookUpdateParams {
1060
+ /**
1061
+ * Header param: Unique key for idempotent request handling. If a request with the
1062
+ * same key was already processed, the original response is returned.
1063
+ */
1064
+ 'Idempotency-Key': string;
1065
+
1066
+ /**
1067
+ * Body param: New description
1068
+ */
1069
+ description?: string;
1070
+
1071
+ /**
1072
+ * Body param: Event types to subscribe to
1073
+ */
1074
+ enabledEvents?: Array<
1075
+ | '*'
1076
+ | 'party.updated'
1077
+ | 'party.delegation_granted'
1078
+ | 'wallet.created'
1079
+ | 'external_account.connected'
1080
+ | 'agent_delegation_invitation.created'
1081
+ | 'agent_delegation_invitation.accepted'
1082
+ | 'agent_delegation_invitation.declined'
1083
+ | 'agent_delegation_invitation.cancelled'
1084
+ | 'agent_delegation.revoked'
1085
+ | 'delegation.activated'
1086
+ | 'delegation.revoked'
1087
+ | 'deposit.created'
1088
+ | 'deposit.completed'
1089
+ | 'deposit.failed'
1090
+ | 'deposit.returned'
1091
+ | 'withdrawal.created'
1092
+ | 'withdrawal.completed'
1093
+ | 'withdrawal.failed'
1094
+ | 'withdrawal.returned'
1095
+ | 'payment.created'
1096
+ | 'payment.completed'
1097
+ | 'payment.failed'
1098
+ | 'payment_request.created'
1099
+ | 'payment_request.completed'
1100
+ | 'payment_request.failed'
1101
+ | 'payment_request.returned'
1102
+ | 'payment_request.incoming'
1103
+ >;
1104
+
1105
+ /**
1106
+ * Body param: New status
1107
+ */
1108
+ status?: 'ENABLED' | 'DISABLED';
1109
+
1110
+ /**
1111
+ * Body param: Tag updates (set value to empty string to remove key)
1112
+ */
1113
+ tags?: { [key: string]: string };
1114
+
1115
+ /**
1116
+ * Body param: New webhook endpoint URL
1117
+ */
1118
+ url?: string;
1119
+
1120
+ /**
1121
+ * Header param: Agent ID (agt_xxx) identifying which agent is making the request.
1122
+ */
1123
+ 'X-Agent-ID'?: string;
1124
+
1125
+ /**
1126
+ * Header param: Required when X-Agent-ID is present. Session or conversation ID
1127
+ * for agent observability.
1128
+ */
1129
+ 'X-Instance-ID'?: string;
1130
+ }
1131
+
1132
+ export interface WebhookListParams {
1133
+ /**
1134
+ * Query param: Cursor for keyset pagination
1135
+ */
1136
+ cursor?: string;
1137
+
1138
+ /**
1139
+ * Query param: Max items per page (1-100)
1140
+ */
1141
+ limit?: number;
1142
+
1143
+ /**
1144
+ * Query param: Filter by status
1145
+ */
1146
+ status?: 'ENABLED' | 'DISABLED';
1147
+
1148
+ /**
1149
+ * Header param: Agent ID (agt_xxx) identifying which agent is making the request.
1150
+ */
1151
+ 'X-Agent-ID'?: string;
1152
+
1153
+ /**
1154
+ * Header param: Required when X-Agent-ID is present. Session or conversation ID
1155
+ * for agent observability.
1156
+ */
1157
+ 'X-Instance-ID'?: string;
1158
+ }
1159
+
1160
+ export interface WebhookGetParams {
1161
+ /**
1162
+ * Agent ID (agt_xxx) identifying which agent is making the request.
1163
+ */
1164
+ 'X-Agent-ID'?: string;
1165
+
1166
+ /**
1167
+ * Required when X-Agent-ID is present. Session or conversation ID for agent
1168
+ * observability.
1169
+ */
1170
+ 'X-Instance-ID'?: string;
1171
+ }
1172
+
1173
+ export interface WebhookRemoveParams {
1174
+ /**
1175
+ * Unique key for idempotent request handling. If a request with the same key was
1176
+ * already processed, the original response is returned.
1177
+ */
1178
+ 'Idempotency-Key': string;
1179
+
1180
+ /**
1181
+ * Agent ID (agt_xxx) identifying which agent is making the request.
1182
+ */
1183
+ 'X-Agent-ID'?: string;
1184
+
1185
+ /**
1186
+ * Required when X-Agent-ID is present. Session or conversation ID for agent
1187
+ * observability.
1188
+ */
1189
+ 'X-Instance-ID'?: string;
1190
+ }
1191
+
1192
+ export interface WebhookRotateSecretParams {
1193
+ /**
1194
+ * Body param: Grace period in seconds for the previous secret (0 = immediate
1195
+ * cutover, max 86400)
1196
+ */
1197
+ expiresInSeconds: number;
1198
+
1199
+ /**
1200
+ * Header param: Unique key for idempotent request handling. If a request with the
1201
+ * same key was already processed, the original response is returned.
1202
+ */
1203
+ 'Idempotency-Key': string;
1204
+
1205
+ /**
1206
+ * Header param: Agent ID (agt_xxx) identifying which agent is making the request.
1207
+ */
1208
+ 'X-Agent-ID'?: string;
1209
+
1210
+ /**
1211
+ * Header param: Required when X-Agent-ID is present. Session or conversation ID
1212
+ * for agent observability.
1213
+ */
1214
+ 'X-Instance-ID'?: string;
1215
+ }
1216
+
1217
+ export declare namespace Webhooks {
1218
+ export {
1219
+ type WebhookCreateResponse as WebhookCreateResponse,
1220
+ type WebhookUpdateResponse as WebhookUpdateResponse,
1221
+ type WebhookListResponse as WebhookListResponse,
1222
+ type WebhookGetResponse as WebhookGetResponse,
1223
+ type WebhookRemoveResponse as WebhookRemoveResponse,
1224
+ type WebhookRotateSecretResponse as WebhookRotateSecretResponse,
1225
+ type WebhookCreateParams as WebhookCreateParams,
1226
+ type WebhookUpdateParams as WebhookUpdateParams,
1227
+ type WebhookListParams as WebhookListParams,
1228
+ type WebhookGetParams as WebhookGetParams,
1229
+ type WebhookRemoveParams as WebhookRemoveParams,
1230
+ type WebhookRotateSecretParams as WebhookRotateSecretParams,
1231
+ };
1232
+ }