@naturalpay/sdk 0.12.0 → 0.13.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 (93) hide show
  1. package/CHANGELOG.md +8 -0
  2. package/package.json +1 -1
  3. package/resources/agents.d.mts +54 -27
  4. package/resources/agents.d.mts.map +1 -1
  5. package/resources/agents.d.ts +54 -27
  6. package/resources/agents.d.ts.map +1 -1
  7. package/resources/api-keys.d.mts +24 -12
  8. package/resources/api-keys.d.mts.map +1 -1
  9. package/resources/api-keys.d.ts +24 -12
  10. package/resources/api-keys.d.ts.map +1 -1
  11. package/resources/approvals.d.mts +24 -12
  12. package/resources/approvals.d.mts.map +1 -1
  13. package/resources/approvals.d.ts +24 -12
  14. package/resources/approvals.d.ts.map +1 -1
  15. package/resources/counterparties.d.mts +6 -3
  16. package/resources/counterparties.d.mts.map +1 -1
  17. package/resources/counterparties.d.ts +6 -3
  18. package/resources/counterparties.d.ts.map +1 -1
  19. package/resources/customers.d.mts +12 -6
  20. package/resources/customers.d.mts.map +1 -1
  21. package/resources/customers.d.ts +12 -6
  22. package/resources/customers.d.ts.map +1 -1
  23. package/resources/external-accounts.d.mts +12 -6
  24. package/resources/external-accounts.d.mts.map +1 -1
  25. package/resources/external-accounts.d.ts +12 -6
  26. package/resources/external-accounts.d.ts.map +1 -1
  27. package/resources/invitations.d.mts +18 -9
  28. package/resources/invitations.d.mts.map +1 -1
  29. package/resources/invitations.d.ts +18 -9
  30. package/resources/invitations.d.ts.map +1 -1
  31. package/resources/parties.d.mts +24 -12
  32. package/resources/parties.d.mts.map +1 -1
  33. package/resources/parties.d.ts +24 -12
  34. package/resources/parties.d.ts.map +1 -1
  35. package/resources/payment-requests.d.mts +66 -59
  36. package/resources/payment-requests.d.mts.map +1 -1
  37. package/resources/payment-requests.d.ts +66 -59
  38. package/resources/payment-requests.d.ts.map +1 -1
  39. package/resources/payment-requests.js +46 -33
  40. package/resources/payment-requests.js.map +1 -1
  41. package/resources/payment-requests.mjs +46 -33
  42. package/resources/payment-requests.mjs.map +1 -1
  43. package/resources/payments.d.mts +46 -43
  44. package/resources/payments.d.mts.map +1 -1
  45. package/resources/payments.d.ts +46 -43
  46. package/resources/payments.d.ts.map +1 -1
  47. package/resources/payments.js +30 -23
  48. package/resources/payments.js.map +1 -1
  49. package/resources/payments.mjs +30 -23
  50. package/resources/payments.mjs.map +1 -1
  51. package/resources/transactions.d.mts +23 -15
  52. package/resources/transactions.d.mts.map +1 -1
  53. package/resources/transactions.d.ts +23 -15
  54. package/resources/transactions.d.ts.map +1 -1
  55. package/resources/transactions.js +18 -6
  56. package/resources/transactions.js.map +1 -1
  57. package/resources/transactions.mjs +18 -6
  58. package/resources/transactions.mjs.map +1 -1
  59. package/resources/transfers.d.mts +48 -43
  60. package/resources/transfers.d.mts.map +1 -1
  61. package/resources/transfers.d.ts +48 -43
  62. package/resources/transfers.d.ts.map +1 -1
  63. package/resources/transfers.js +29 -20
  64. package/resources/transfers.js.map +1 -1
  65. package/resources/transfers.mjs +29 -20
  66. package/resources/transfers.mjs.map +1 -1
  67. package/resources/wallet.d.mts +12 -6
  68. package/resources/wallet.d.mts.map +1 -1
  69. package/resources/wallet.d.ts +12 -6
  70. package/resources/wallet.d.ts.map +1 -1
  71. package/resources/webhooks.d.mts +36 -18
  72. package/resources/webhooks.d.mts.map +1 -1
  73. package/resources/webhooks.d.ts +36 -18
  74. package/resources/webhooks.d.ts.map +1 -1
  75. package/src/resources/agents.ts +54 -27
  76. package/src/resources/api-keys.ts +24 -12
  77. package/src/resources/approvals.ts +24 -12
  78. package/src/resources/counterparties.ts +6 -3
  79. package/src/resources/customers.ts +12 -6
  80. package/src/resources/external-accounts.ts +12 -6
  81. package/src/resources/invitations.ts +18 -9
  82. package/src/resources/parties.ts +24 -12
  83. package/src/resources/payment-requests.ts +110 -70
  84. package/src/resources/payments.ts +83 -53
  85. package/src/resources/transactions.ts +44 -21
  86. package/src/resources/transfers.ts +79 -51
  87. package/src/resources/wallet.ts +12 -6
  88. package/src/resources/webhooks.ts +36 -18
  89. package/src/version.ts +1 -1
  90. package/version.d.mts +1 -1
  91. package/version.d.ts +1 -1
  92. package/version.js +1 -1
  93. package/version.mjs +1 -1
@@ -15,18 +15,24 @@ export class Transfers extends APIResource {
15
15
  *
16
16
  * @example
17
17
  * ```ts
18
- * const transfers = await client.transfers.list({
19
- * 'X-Agent-ID': 'X-Agent-ID',
20
- * 'X-Instance-ID': 'X-Instance-ID',
21
- * });
18
+ * const transfers = await client.transfers.list();
22
19
  * ```
23
20
  */
24
- list(params: TransferListParams, options?: RequestOptions): APIPromise<TransferListResponse> {
25
- const { 'X-Agent-ID': xAgentID, 'X-Instance-ID': xInstanceID, ...query } = params;
21
+ list(
22
+ params: TransferListParams | null | undefined = {},
23
+ options?: RequestOptions,
24
+ ): APIPromise<TransferListResponse> {
25
+ const { 'X-Agent-ID': xAgentID, 'X-Instance-ID': xInstanceID, ...query } = params ?? {};
26
26
  return this._client.get('/transfers', {
27
27
  query,
28
28
  ...options,
29
- headers: buildHeaders([{ 'X-Agent-ID': xAgentID, 'X-Instance-ID': xInstanceID }, options?.headers]),
29
+ headers: buildHeaders([
30
+ {
31
+ ...(xAgentID != null ? { 'X-Agent-ID': xAgentID } : undefined),
32
+ ...(xInstanceID != null ? { 'X-Instance-ID': xInstanceID } : undefined),
33
+ },
34
+ options?.headers,
35
+ ]),
30
36
  });
31
37
  }
32
38
 
@@ -37,23 +43,25 @@ export class Transfers extends APIResource {
37
43
  * ```ts
38
44
  * const transfer = await client.transfers.get(
39
45
  * 'trf_ecc2efdd09bd231a9ad9bd2aada37aa7',
40
- * {
41
- * 'X-Agent-ID': 'X-Agent-ID',
42
- * 'X-Instance-ID': 'X-Instance-ID',
43
- * },
44
46
  * );
45
47
  * ```
46
48
  */
47
49
  get(
48
50
  transferID: string,
49
- params: TransferGetParams,
51
+ params: TransferGetParams | null | undefined = {},
50
52
  options?: RequestOptions,
51
53
  ): APIPromise<TransferGetResponse> {
52
- const { 'X-Agent-ID': xAgentID, 'X-Instance-ID': xInstanceID, ...query } = params;
54
+ const { 'X-Agent-ID': xAgentID, 'X-Instance-ID': xInstanceID, ...query } = params ?? {};
53
55
  return this._client.get(path`/transfers/${transferID}`, {
54
56
  query,
55
57
  ...options,
56
- headers: buildHeaders([{ 'X-Agent-ID': xAgentID, 'X-Instance-ID': xInstanceID }, options?.headers]),
58
+ headers: buildHeaders([
59
+ {
60
+ ...(xAgentID != null ? { 'X-Agent-ID': xAgentID } : undefined),
61
+ ...(xInstanceID != null ? { 'X-Instance-ID': xInstanceID } : undefined),
62
+ },
63
+ options?.headers,
64
+ ]),
57
65
  });
58
66
  }
59
67
 
@@ -66,8 +74,6 @@ export class Transfers extends APIResource {
66
74
  * amount: 100,
67
75
  * externalAccountId: 'eac_ecc2efdd09bd231a9ad9bd2aada37aa7',
68
76
  * 'Idempotency-Key': 'Idempotency-Key',
69
- * 'X-Agent-ID': 'X-Agent-ID',
70
- * 'X-Instance-ID': 'X-Instance-ID',
71
77
  * });
72
78
  * ```
73
79
  */
@@ -85,7 +91,11 @@ export class Transfers extends APIResource {
85
91
  body,
86
92
  ...options,
87
93
  headers: buildHeaders([
88
- { 'Idempotency-Key': idempotencyKey, 'X-Agent-ID': xAgentID, 'X-Instance-ID': xInstanceID },
94
+ {
95
+ 'Idempotency-Key': idempotencyKey,
96
+ ...(xAgentID != null ? { 'X-Agent-ID': xAgentID } : undefined),
97
+ ...(xInstanceID != null ? { 'X-Instance-ID': xInstanceID } : undefined),
98
+ },
89
99
  options?.headers,
90
100
  ]),
91
101
  });
@@ -100,8 +110,6 @@ export class Transfers extends APIResource {
100
110
  * amount: 1,
101
111
  * externalAccountId: 'eac_ecc2efdd09bd231a9ad9bd2aada37aa7',
102
112
  * 'Idempotency-Key': 'Idempotency-Key',
103
- * 'X-Agent-ID': 'X-Agent-ID',
104
- * 'X-Instance-ID': 'X-Instance-ID',
105
113
  * });
106
114
  * ```
107
115
  */
@@ -119,7 +127,11 @@ export class Transfers extends APIResource {
119
127
  body,
120
128
  ...options,
121
129
  headers: buildHeaders([
122
- { 'Idempotency-Key': idempotencyKey, 'X-Agent-ID': xAgentID, 'X-Instance-ID': xInstanceID },
130
+ {
131
+ 'Idempotency-Key': idempotencyKey,
132
+ ...(xAgentID != null ? { 'X-Agent-ID': xAgentID } : undefined),
133
+ ...(xInstanceID != null ? { 'X-Instance-ID': xInstanceID } : undefined),
134
+ },
123
135
  options?.headers,
124
136
  ]),
125
137
  });
@@ -1189,16 +1201,6 @@ export namespace TransferInitiateWithdrawalResponse {
1189
1201
  }
1190
1202
 
1191
1203
  export interface TransferListParams {
1192
- /**
1193
- * Header param: Agent ID (agt_xxx) used for attribution and audit.
1194
- */
1195
- 'X-Agent-ID': string;
1196
-
1197
- /**
1198
- * Header param: Stable run, session, or conversation ID for agent observability.
1199
- */
1200
- 'X-Instance-ID': string;
1201
-
1202
1204
  /**
1203
1205
  * Query param: Pagination cursor from previous response
1204
1206
  */
@@ -1213,23 +1215,41 @@ export interface TransferListParams {
1213
1215
  * Query param: Party ID for delegated transfer lookup
1214
1216
  */
1215
1217
  partyId?: string;
1216
- }
1217
1218
 
1218
- export interface TransferGetParams {
1219
1219
  /**
1220
- * Header param: Agent ID (agt_xxx) used for attribution and audit.
1220
+ * Header param: Conditionally required for payment-related API requests. Pass an
1221
+ * agent ID (agt_xxx) for attribution, or omit it only when your party has exactly
1222
+ * one active agent, which Natural defaults automatically.
1221
1223
  */
1222
- 'X-Agent-ID': string;
1224
+ 'X-Agent-ID'?: string;
1223
1225
 
1224
1226
  /**
1225
1227
  * Header param: Stable run, session, or conversation ID for agent observability.
1228
+ * If omitted on a payment-related API request, Natural generates one after
1229
+ * resolving the attribution agent.
1226
1230
  */
1227
- 'X-Instance-ID': string;
1231
+ 'X-Instance-ID'?: string;
1232
+ }
1228
1233
 
1234
+ export interface TransferGetParams {
1229
1235
  /**
1230
1236
  * Query param: Party ID for delegated transfer lookup
1231
1237
  */
1232
1238
  partyId?: string;
1239
+
1240
+ /**
1241
+ * Header param: Conditionally required for payment-related API requests. Pass an
1242
+ * agent ID (agt_xxx) for attribution, or omit it only when your party has exactly
1243
+ * one active agent, which Natural defaults automatically.
1244
+ */
1245
+ 'X-Agent-ID'?: string;
1246
+
1247
+ /**
1248
+ * Header param: Stable run, session, or conversation ID for agent observability.
1249
+ * If omitted on a payment-related API request, Natural generates one after
1250
+ * resolving the attribution agent.
1251
+ */
1252
+ 'X-Instance-ID'?: string;
1233
1253
  }
1234
1254
 
1235
1255
  export interface TransferInitiateDepositParams {
@@ -1250,24 +1270,28 @@ export interface TransferInitiateDepositParams {
1250
1270
  'Idempotency-Key': string;
1251
1271
 
1252
1272
  /**
1253
- * Header param: Agent ID (agt_xxx) used for attribution and audit.
1273
+ * Body param: Currency code
1254
1274
  */
1255
- 'X-Agent-ID': string;
1275
+ currency?: string;
1256
1276
 
1257
1277
  /**
1258
- * Header param: Stable run, session, or conversation ID for agent observability.
1278
+ * Body param: Deposit description
1259
1279
  */
1260
- 'X-Instance-ID': string;
1280
+ description?: string;
1261
1281
 
1262
1282
  /**
1263
- * Body param: Currency code
1283
+ * Header param: Conditionally required for payment-related API requests. Pass an
1284
+ * agent ID (agt_xxx) for attribution, or omit it only when your party has exactly
1285
+ * one active agent, which Natural defaults automatically.
1264
1286
  */
1265
- currency?: string;
1287
+ 'X-Agent-ID'?: string;
1266
1288
 
1267
1289
  /**
1268
- * Body param: Deposit description
1290
+ * Header param: Stable run, session, or conversation ID for agent observability.
1291
+ * If omitted on a payment-related API request, Natural generates one after
1292
+ * resolving the attribution agent.
1269
1293
  */
1270
- description?: string;
1294
+ 'X-Instance-ID'?: string;
1271
1295
  }
1272
1296
 
1273
1297
  export interface TransferInitiateWithdrawalParams {
@@ -1288,24 +1312,28 @@ export interface TransferInitiateWithdrawalParams {
1288
1312
  'Idempotency-Key': string;
1289
1313
 
1290
1314
  /**
1291
- * Header param: Agent ID (agt_xxx) used for attribution and audit.
1315
+ * Body param: Currency code
1292
1316
  */
1293
- 'X-Agent-ID': string;
1317
+ currency?: string;
1294
1318
 
1295
1319
  /**
1296
- * Header param: Stable run, session, or conversation ID for agent observability.
1320
+ * Body param: Withdrawal description
1297
1321
  */
1298
- 'X-Instance-ID': string;
1322
+ description?: string;
1299
1323
 
1300
1324
  /**
1301
- * Body param: Currency code
1325
+ * Header param: Conditionally required for payment-related API requests. Pass an
1326
+ * agent ID (agt_xxx) for attribution, or omit it only when your party has exactly
1327
+ * one active agent, which Natural defaults automatically.
1302
1328
  */
1303
- currency?: string;
1329
+ 'X-Agent-ID'?: string;
1304
1330
 
1305
1331
  /**
1306
- * Body param: Withdrawal description
1332
+ * Header param: Stable run, session, or conversation ID for agent observability.
1333
+ * If omitted on a payment-related API request, Natural generates one after
1334
+ * resolving the attribution agent.
1307
1335
  */
1308
- description?: string;
1336
+ 'X-Instance-ID'?: string;
1309
1337
  }
1310
1338
 
1311
1339
  export declare namespace Transfers {
@@ -346,26 +346,32 @@ export namespace WalletGetResponse {
346
346
 
347
347
  export interface WalletListParams {
348
348
  /**
349
- * Agent ID (agt_xxx) identifying which agent is making the request.
349
+ * Agent ID (agt_xxx) used for attribution. Required for payment-related API
350
+ * requests unless your party has exactly one active agent, which Natural defaults
351
+ * automatically.
350
352
  */
351
353
  'X-Agent-ID'?: string;
352
354
 
353
355
  /**
354
- * Required when X-Agent-ID is present. Session or conversation ID for agent
355
- * observability.
356
+ * Stable run, session, or conversation ID for agent observability. If omitted on a
357
+ * payment-related API request, Natural generates one after resolving the
358
+ * attribution agent.
356
359
  */
357
360
  'X-Instance-ID'?: string;
358
361
  }
359
362
 
360
363
  export interface WalletGetParams {
361
364
  /**
362
- * Agent ID (agt_xxx) identifying which agent is making the request.
365
+ * Agent ID (agt_xxx) used for attribution. Required for payment-related API
366
+ * requests unless your party has exactly one active agent, which Natural defaults
367
+ * automatically.
363
368
  */
364
369
  'X-Agent-ID'?: string;
365
370
 
366
371
  /**
367
- * Required when X-Agent-ID is present. Session or conversation ID for agent
368
- * observability.
372
+ * Stable run, session, or conversation ID for agent observability. If omitted on a
373
+ * payment-related API request, Natural generates one after resolving the
374
+ * attribution agent.
369
375
  */
370
376
  'X-Instance-ID'?: string;
371
377
  }
@@ -1045,13 +1045,16 @@ export interface WebhookCreateParams {
1045
1045
  tags?: { [key: string]: string };
1046
1046
 
1047
1047
  /**
1048
- * Header param: Agent ID (agt_xxx) identifying which agent is making the request.
1048
+ * Header param: Agent ID (agt_xxx) used for attribution. Required for
1049
+ * payment-related API requests unless your party has exactly one active agent,
1050
+ * which Natural defaults automatically.
1049
1051
  */
1050
1052
  'X-Agent-ID'?: string;
1051
1053
 
1052
1054
  /**
1053
- * Header param: Required when X-Agent-ID is present. Session or conversation ID
1054
- * for agent observability.
1055
+ * Header param: Stable run, session, or conversation ID for agent observability.
1056
+ * If omitted on a payment-related API request, Natural generates one after
1057
+ * resolving the attribution agent.
1055
1058
  */
1056
1059
  'X-Instance-ID'?: string;
1057
1060
  }
@@ -1118,13 +1121,16 @@ export interface WebhookUpdateParams {
1118
1121
  url?: string;
1119
1122
 
1120
1123
  /**
1121
- * Header param: Agent ID (agt_xxx) identifying which agent is making the request.
1124
+ * Header param: Agent ID (agt_xxx) used for attribution. Required for
1125
+ * payment-related API requests unless your party has exactly one active agent,
1126
+ * which Natural defaults automatically.
1122
1127
  */
1123
1128
  'X-Agent-ID'?: string;
1124
1129
 
1125
1130
  /**
1126
- * Header param: Required when X-Agent-ID is present. Session or conversation ID
1127
- * for agent observability.
1131
+ * Header param: Stable run, session, or conversation ID for agent observability.
1132
+ * If omitted on a payment-related API request, Natural generates one after
1133
+ * resolving the attribution agent.
1128
1134
  */
1129
1135
  'X-Instance-ID'?: string;
1130
1136
  }
@@ -1146,26 +1152,32 @@ export interface WebhookListParams {
1146
1152
  status?: 'ENABLED' | 'DISABLED';
1147
1153
 
1148
1154
  /**
1149
- * Header param: Agent ID (agt_xxx) identifying which agent is making the request.
1155
+ * Header param: Agent ID (agt_xxx) used for attribution. Required for
1156
+ * payment-related API requests unless your party has exactly one active agent,
1157
+ * which Natural defaults automatically.
1150
1158
  */
1151
1159
  'X-Agent-ID'?: string;
1152
1160
 
1153
1161
  /**
1154
- * Header param: Required when X-Agent-ID is present. Session or conversation ID
1155
- * for agent observability.
1162
+ * Header param: Stable run, session, or conversation ID for agent observability.
1163
+ * If omitted on a payment-related API request, Natural generates one after
1164
+ * resolving the attribution agent.
1156
1165
  */
1157
1166
  'X-Instance-ID'?: string;
1158
1167
  }
1159
1168
 
1160
1169
  export interface WebhookGetParams {
1161
1170
  /**
1162
- * Agent ID (agt_xxx) identifying which agent is making the request.
1171
+ * Agent ID (agt_xxx) used for attribution. Required for payment-related API
1172
+ * requests unless your party has exactly one active agent, which Natural defaults
1173
+ * automatically.
1163
1174
  */
1164
1175
  'X-Agent-ID'?: string;
1165
1176
 
1166
1177
  /**
1167
- * Required when X-Agent-ID is present. Session or conversation ID for agent
1168
- * observability.
1178
+ * Stable run, session, or conversation ID for agent observability. If omitted on a
1179
+ * payment-related API request, Natural generates one after resolving the
1180
+ * attribution agent.
1169
1181
  */
1170
1182
  'X-Instance-ID'?: string;
1171
1183
  }
@@ -1178,13 +1190,16 @@ export interface WebhookRemoveParams {
1178
1190
  'Idempotency-Key': string;
1179
1191
 
1180
1192
  /**
1181
- * Agent ID (agt_xxx) identifying which agent is making the request.
1193
+ * Agent ID (agt_xxx) used for attribution. Required for payment-related API
1194
+ * requests unless your party has exactly one active agent, which Natural defaults
1195
+ * automatically.
1182
1196
  */
1183
1197
  'X-Agent-ID'?: string;
1184
1198
 
1185
1199
  /**
1186
- * Required when X-Agent-ID is present. Session or conversation ID for agent
1187
- * observability.
1200
+ * Stable run, session, or conversation ID for agent observability. If omitted on a
1201
+ * payment-related API request, Natural generates one after resolving the
1202
+ * attribution agent.
1188
1203
  */
1189
1204
  'X-Instance-ID'?: string;
1190
1205
  }
@@ -1203,13 +1218,16 @@ export interface WebhookRotateSecretParams {
1203
1218
  'Idempotency-Key': string;
1204
1219
 
1205
1220
  /**
1206
- * Header param: Agent ID (agt_xxx) identifying which agent is making the request.
1221
+ * Header param: Agent ID (agt_xxx) used for attribution. Required for
1222
+ * payment-related API requests unless your party has exactly one active agent,
1223
+ * which Natural defaults automatically.
1207
1224
  */
1208
1225
  'X-Agent-ID'?: string;
1209
1226
 
1210
1227
  /**
1211
- * Header param: Required when X-Agent-ID is present. Session or conversation ID
1212
- * for agent observability.
1228
+ * Header param: Stable run, session, or conversation ID for agent observability.
1229
+ * If omitted on a payment-related API request, Natural generates one after
1230
+ * resolving the attribution agent.
1213
1231
  */
1214
1232
  'X-Instance-ID'?: string;
1215
1233
  }
package/src/version.ts CHANGED
@@ -1 +1 @@
1
- export const VERSION = '0.12.0'; // x-release-please-version
1
+ export const VERSION = '0.13.0'; // x-release-please-version
package/version.d.mts CHANGED
@@ -1,2 +1,2 @@
1
- export declare const VERSION = "0.12.0";
1
+ export declare const VERSION = "0.13.0";
2
2
  //# sourceMappingURL=version.d.mts.map
package/version.d.ts CHANGED
@@ -1,2 +1,2 @@
1
- export declare const VERSION = "0.12.0";
1
+ export declare const VERSION = "0.13.0";
2
2
  //# sourceMappingURL=version.d.ts.map
package/version.js CHANGED
@@ -1,5 +1,5 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.VERSION = void 0;
4
- exports.VERSION = '0.12.0'; // x-release-please-version
4
+ exports.VERSION = '0.13.0'; // x-release-please-version
5
5
  //# sourceMappingURL=version.js.map
package/version.mjs CHANGED
@@ -1,2 +1,2 @@
1
- export const VERSION = '0.12.0'; // x-release-please-version
1
+ export const VERSION = '0.13.0'; // x-release-please-version
2
2
  //# sourceMappingURL=version.mjs.map