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