@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
@@ -11,7 +11,7 @@ import { path } from '../internal/utils/path';
11
11
  */
12
12
  export class Agents extends APIResource {
13
13
  /**
14
- * Create a new agent for the authenticated party.
14
+ * Create a new agent for your party.
15
15
  *
16
16
  * @example
17
17
  * ```ts
@@ -43,7 +43,7 @@ export class Agents extends APIResource {
43
43
  }
44
44
 
45
45
  /**
46
- * Update an existing agent's mutable fields or revoke it.
46
+ * Update an existing agent's mutable fields.
47
47
  *
48
48
  * @example
49
49
  * ```ts
@@ -64,7 +64,7 @@ export class Agents extends APIResource {
64
64
  'X-Instance-ID': xInstanceID,
65
65
  ...body
66
66
  } = params;
67
- return this._client.put(path`/agents/${agentID}`, {
67
+ return this._client.patch(path`/agents/${agentID}`, {
68
68
  body,
69
69
  ...options,
70
70
  headers: buildHeaders([
@@ -79,7 +79,7 @@ export class Agents extends APIResource {
79
79
  }
80
80
 
81
81
  /**
82
- * List agents for the authenticated user's party.
82
+ * List agents in your party.
83
83
  *
84
84
  * @example
85
85
  * ```ts
@@ -202,7 +202,7 @@ export class Agents extends APIResource {
202
202
  }
203
203
 
204
204
  /**
205
- * Delete an agent and clean up its delegations and policies.
205
+ * Revoke an agent.
206
206
  *
207
207
  * @example
208
208
  * ```ts
@@ -294,25 +294,10 @@ export namespace AgentCreateResponse {
294
294
  */
295
295
  name: string;
296
296
 
297
- /**
298
- * Observability stats (null when unavailable)
299
- */
300
- observability: Attributes.Observability | null;
301
-
302
297
  /**
303
298
  * Agent status
304
299
  */
305
300
  status: 'ACTIVE' | 'REVOKED';
306
-
307
- /**
308
- * When this agent was last updated
309
- */
310
- updatedAt: string | null;
311
-
312
- /**
313
- * User who last updated this agent (usr\_\*)
314
- */
315
- updatedBy: string | null;
316
301
  }
317
302
 
318
303
  export namespace Attributes {
@@ -326,26 +311,6 @@ export namespace AgentCreateResponse {
326
311
  */
327
312
  perTransaction?: number | null;
328
313
  }
329
-
330
- /**
331
- * Observability stats (null when unavailable)
332
- */
333
- export interface Observability {
334
- /**
335
- * Errors in last 24h
336
- */
337
- errorCount: number;
338
-
339
- /**
340
- * Last activity timestamp
341
- */
342
- lastActiveAt: string | null;
343
-
344
- /**
345
- * Requests in last 24h
346
- */
347
- requestCount: number;
348
- }
349
314
  }
350
315
 
351
316
  /**
@@ -444,25 +409,10 @@ export namespace AgentUpdateResponse {
444
409
  */
445
410
  name: string;
446
411
 
447
- /**
448
- * Observability stats (null when unavailable)
449
- */
450
- observability: Attributes.Observability | null;
451
-
452
412
  /**
453
413
  * Agent status
454
414
  */
455
415
  status: 'ACTIVE' | 'REVOKED';
456
-
457
- /**
458
- * When this agent was last updated
459
- */
460
- updatedAt: string | null;
461
-
462
- /**
463
- * User who last updated this agent (usr\_\*)
464
- */
465
- updatedBy: string | null;
466
416
  }
467
417
 
468
418
  export namespace Attributes {
@@ -476,26 +426,6 @@ export namespace AgentUpdateResponse {
476
426
  */
477
427
  perTransaction?: number | null;
478
428
  }
479
-
480
- /**
481
- * Observability stats (null when unavailable)
482
- */
483
- export interface Observability {
484
- /**
485
- * Errors in last 24h
486
- */
487
- errorCount: number;
488
-
489
- /**
490
- * Last activity timestamp
491
- */
492
- lastActiveAt: string | null;
493
-
494
- /**
495
- * Requests in last 24h
496
- */
497
- requestCount: number;
498
- }
499
429
  }
500
430
 
501
431
  /**
@@ -596,25 +526,10 @@ export namespace AgentListResponse {
596
526
  */
597
527
  name: string;
598
528
 
599
- /**
600
- * Observability stats (null when unavailable)
601
- */
602
- observability: Attributes.Observability | null;
603
-
604
529
  /**
605
530
  * Agent status
606
531
  */
607
532
  status: 'ACTIVE' | 'REVOKED';
608
-
609
- /**
610
- * When this agent was last updated
611
- */
612
- updatedAt: string | null;
613
-
614
- /**
615
- * User who last updated this agent (usr\_\*)
616
- */
617
- updatedBy: string | null;
618
533
  }
619
534
 
620
535
  export namespace Attributes {
@@ -628,26 +543,6 @@ export namespace AgentListResponse {
628
543
  */
629
544
  perTransaction?: number | null;
630
545
  }
631
-
632
- /**
633
- * Observability stats (null when unavailable)
634
- */
635
- export interface Observability {
636
- /**
637
- * Errors in last 24h
638
- */
639
- errorCount: number;
640
-
641
- /**
642
- * Last activity timestamp
643
- */
644
- lastActiveAt: string | null;
645
-
646
- /**
647
- * Requests in last 24h
648
- */
649
- requestCount: number;
650
- }
651
546
  }
652
547
 
653
548
  /**
@@ -1014,25 +909,10 @@ export namespace AgentGetResponse {
1014
909
  */
1015
910
  name: string;
1016
911
 
1017
- /**
1018
- * Observability stats (null when unavailable)
1019
- */
1020
- observability: Attributes.Observability | null;
1021
-
1022
912
  /**
1023
913
  * Agent status
1024
914
  */
1025
915
  status: 'ACTIVE' | 'REVOKED';
1026
-
1027
- /**
1028
- * When this agent was last updated
1029
- */
1030
- updatedAt: string | null;
1031
-
1032
- /**
1033
- * User who last updated this agent (usr\_\*)
1034
- */
1035
- updatedBy: string | null;
1036
916
  }
1037
917
 
1038
918
  export namespace Attributes {
@@ -1046,26 +926,6 @@ export namespace AgentGetResponse {
1046
926
  */
1047
927
  perTransaction?: number | null;
1048
928
  }
1049
-
1050
- /**
1051
- * Observability stats (null when unavailable)
1052
- */
1053
- export interface Observability {
1054
- /**
1055
- * Errors in last 24h
1056
- */
1057
- errorCount: number;
1058
-
1059
- /**
1060
- * Last activity timestamp
1061
- */
1062
- lastActiveAt: string | null;
1063
-
1064
- /**
1065
- * Requests in last 24h
1066
- */
1067
- requestCount: number;
1068
- }
1069
929
  }
1070
930
 
1071
931
  /**
@@ -1417,25 +1277,10 @@ export namespace AgentRemoveResponse {
1417
1277
  */
1418
1278
  name: string;
1419
1279
 
1420
- /**
1421
- * Observability stats (null when unavailable)
1422
- */
1423
- observability: Attributes.Observability | null;
1424
-
1425
1280
  /**
1426
1281
  * Agent status
1427
1282
  */
1428
1283
  status: 'ACTIVE' | 'REVOKED';
1429
-
1430
- /**
1431
- * When this agent was last updated
1432
- */
1433
- updatedAt: string | null;
1434
-
1435
- /**
1436
- * User who last updated this agent (usr\_\*)
1437
- */
1438
- updatedBy: string | null;
1439
1284
  }
1440
1285
 
1441
1286
  export namespace Attributes {
@@ -1449,26 +1294,6 @@ export namespace AgentRemoveResponse {
1449
1294
  */
1450
1295
  perTransaction?: number | null;
1451
1296
  }
1452
-
1453
- /**
1454
- * Observability stats (null when unavailable)
1455
- */
1456
- export interface Observability {
1457
- /**
1458
- * Errors in last 24h
1459
- */
1460
- errorCount: number;
1461
-
1462
- /**
1463
- * Last activity timestamp
1464
- */
1465
- lastActiveAt: string | null;
1466
-
1467
- /**
1468
- * Requests in last 24h
1469
- */
1470
- requestCount: number;
1471
- }
1472
1297
  }
1473
1298
 
1474
1299
  /**
@@ -1585,11 +1410,6 @@ export interface AgentUpdateParams {
1585
1410
  */
1586
1411
  name?: string | null;
1587
1412
 
1588
- /**
1589
- * Body param: Updated status
1590
- */
1591
- status?: 'ACTIVE' | 'REVOKED' | null;
1592
-
1593
1413
  /**
1594
1414
  * Header param: Agent ID (agt_xxx) identifying which agent is making the request.
1595
1415
  */
@@ -99,7 +99,7 @@ export class APIKeys extends APIResource {
99
99
  options?: RequestOptions,
100
100
  ): APIPromise<APIKeyRevokeResponse> {
101
101
  const { 'X-Agent-ID': xAgentID, 'X-Instance-ID': xInstanceID } = params ?? {};
102
- return this._client.put(path`/api-keys/${keyID}/revoke`, {
102
+ return this._client.post(path`/api-keys/${keyID}/revoke`, {
103
103
  ...options,
104
104
  headers: buildHeaders([
105
105
  {
@@ -10,9 +10,7 @@ import { RequestOptions } from '../internal/request-options';
10
10
  */
11
11
  export class Counterparties extends APIResource {
12
12
  /**
13
- * Returns one row per counterparty with sent and received aggregates. Either side
14
- * may be null when there are no payments in that direction. Pass direction=sent or
15
- * direction=received to scope the list (and its pagination) to one side.
13
+ * List counterparties.
16
14
  */
17
15
  list(
18
16
  params: CounterpartyListParams | null | undefined = {},
@@ -65,74 +63,17 @@ export namespace CounterpartyListResponse {
65
63
  /**
66
64
  * Counterparty primary email
67
65
  */
68
- partyEmail: string | null;
69
-
70
- /**
71
- * Party ID (pty_xxx) - null for unclaimed payments
72
- */
73
- partyId: string | null;
66
+ email: string | null;
74
67
 
75
68
  /**
76
69
  * Counterparty display name
77
70
  */
78
- partyName: string | null;
79
-
80
- /**
81
- * Counterparty party status
82
- */
83
- partyStatus: 'PROVISIONAL' | 'ACTIVE' | 'SUSPENDED' | 'INACTIVE' | null;
84
-
85
- /**
86
- * Aggregates for payments you received from this counterparty. Null if none.
87
- */
88
- received: Attributes.Received | null;
89
-
90
- /**
91
- * Aggregates for payments you sent to this counterparty. Null if none.
92
- */
93
- sent: Attributes.Sent | null;
94
- }
95
-
96
- export namespace Attributes {
97
- /**
98
- * Aggregates for payments you received from this counterparty. Null if none.
99
- */
100
- export interface Received {
101
- /**
102
- * Timestamp of first payment in this direction
103
- */
104
- firstAt: string;
105
-
106
- /**
107
- * Total amount in this direction, minor units (cents)
108
- */
109
- totalAmountMinor: number;
110
-
111
- /**
112
- * Number of payments in this direction
113
- */
114
- transactionCount: number;
115
- }
71
+ name: string | null;
116
72
 
117
73
  /**
118
- * Aggregates for payments you sent to this counterparty. Null if none.
74
+ * Counterparty status
119
75
  */
120
- export interface Sent {
121
- /**
122
- * Timestamp of first payment in this direction
123
- */
124
- firstAt: string;
125
-
126
- /**
127
- * Total amount in this direction, minor units (cents)
128
- */
129
- totalAmountMinor: number;
130
-
131
- /**
132
- * Number of payments in this direction
133
- */
134
- transactionCount: number;
135
- }
76
+ status: 'PROVISIONAL' | 'ACTIVE' | 'SUSPENDED' | 'INACTIVE' | null;
136
77
  }
137
78
  }
138
79