@naturalpay/sdk 0.14.0 → 0.15.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 (43) hide show
  1. package/CHANGELOG.md +8 -0
  2. package/package.json +1 -1
  3. package/resources/payment-requests.d.mts +49 -60
  4. package/resources/payment-requests.d.mts.map +1 -1
  5. package/resources/payment-requests.d.ts +49 -60
  6. package/resources/payment-requests.d.ts.map +1 -1
  7. package/resources/payment-requests.js +46 -33
  8. package/resources/payment-requests.js.map +1 -1
  9. package/resources/payment-requests.mjs +46 -33
  10. package/resources/payment-requests.mjs.map +1 -1
  11. package/resources/payments.d.mts +34 -43
  12. package/resources/payments.d.mts.map +1 -1
  13. package/resources/payments.d.ts +34 -43
  14. package/resources/payments.d.ts.map +1 -1
  15. package/resources/payments.js +30 -23
  16. package/resources/payments.js.map +1 -1
  17. package/resources/payments.mjs +30 -23
  18. package/resources/payments.mjs.map +1 -1
  19. package/resources/transactions.d.mts +18 -16
  20. package/resources/transactions.d.mts.map +1 -1
  21. package/resources/transactions.d.ts +18 -16
  22. package/resources/transactions.d.ts.map +1 -1
  23. package/resources/transactions.js +18 -6
  24. package/resources/transactions.js.map +1 -1
  25. package/resources/transactions.mjs +18 -6
  26. package/resources/transactions.mjs.map +1 -1
  27. package/resources/transfers.d.mts +37 -44
  28. package/resources/transfers.d.mts.map +1 -1
  29. package/resources/transfers.d.ts +37 -44
  30. package/resources/transfers.d.ts.map +1 -1
  31. package/resources/transfers.js +29 -20
  32. package/resources/transfers.js.map +1 -1
  33. package/resources/transfers.mjs +29 -20
  34. package/resources/transfers.mjs.map +1 -1
  35. package/src/resources/payment-requests.ts +93 -71
  36. package/src/resources/payments.ts +71 -53
  37. package/src/resources/transactions.ts +39 -22
  38. package/src/resources/transfers.ts +68 -52
  39. package/src/version.ts +1 -1
  40. package/version.d.mts +1 -1
  41. package/version.d.ts +1 -1
  42. package/version.js +1 -1
  43. package/version.mjs +1 -1
@@ -13,12 +13,21 @@ export class Transactions extends APIResource {
13
13
  /**
14
14
  * List transactions visible to your party.
15
15
  */
16
- list(params: TransactionListParams, options?: RequestOptions): APIPromise<TransactionListResponse> {
17
- const { 'X-Agent-ID': xAgentID, 'X-Instance-ID': xInstanceID, ...query } = params;
16
+ list(
17
+ params: TransactionListParams | null | undefined = {},
18
+ options?: RequestOptions,
19
+ ): APIPromise<TransactionListResponse> {
20
+ const { 'X-Agent-ID': xAgentID, 'X-Instance-ID': xInstanceID, ...query } = params ?? {};
18
21
  return this._client.get('/transactions', {
19
22
  query,
20
23
  ...options,
21
- headers: buildHeaders([{ 'X-Agent-ID': xAgentID, 'X-Instance-ID': xInstanceID }, options?.headers]),
24
+ headers: buildHeaders([
25
+ {
26
+ ...(xAgentID != null ? { 'X-Agent-ID': xAgentID } : undefined),
27
+ ...(xInstanceID != null ? { 'X-Instance-ID': xInstanceID } : undefined),
28
+ },
29
+ options?.headers,
30
+ ]),
22
31
  });
23
32
  }
24
33
 
@@ -27,14 +36,20 @@ export class Transactions extends APIResource {
27
36
  */
28
37
  get(
29
38
  transactionID: string,
30
- params: TransactionGetParams,
39
+ params: TransactionGetParams | null | undefined = {},
31
40
  options?: RequestOptions,
32
41
  ): APIPromise<TransactionGetResponse> {
33
- const { 'X-Agent-ID': xAgentID, 'X-Instance-ID': xInstanceID, ...query } = params;
42
+ const { 'X-Agent-ID': xAgentID, 'X-Instance-ID': xInstanceID, ...query } = params ?? {};
34
43
  return this._client.get(path`/transactions/${transactionID}`, {
35
44
  query,
36
45
  ...options,
37
- headers: buildHeaders([{ 'X-Agent-ID': xAgentID, 'X-Instance-ID': xInstanceID }, options?.headers]),
46
+ headers: buildHeaders([
47
+ {
48
+ ...(xAgentID != null ? { 'X-Agent-ID': xAgentID } : undefined),
49
+ ...(xInstanceID != null ? { 'X-Instance-ID': xInstanceID } : undefined),
50
+ },
51
+ options?.headers,
52
+ ]),
38
53
  });
39
54
  }
40
55
  }
@@ -464,16 +479,6 @@ export namespace TransactionGetResponse {
464
479
  }
465
480
 
466
481
  export interface TransactionListParams {
467
- /**
468
- * Header param: Agent ID (agt_xxx) used for attribution and audit.
469
- */
470
- 'X-Agent-ID': string;
471
-
472
- /**
473
- * Header param: Stable run, session, or conversation ID for agent observability.
474
- */
475
- 'X-Instance-ID': string;
476
-
477
482
  /**
478
483
  * Query param: Pagination cursor from previous response
479
484
  */
@@ -488,23 +493,35 @@ export interface TransactionListParams {
488
493
  * Query param
489
494
  */
490
495
  type?: 'payment' | 'transfer' | 'all';
491
- }
492
496
 
493
- export interface TransactionGetParams {
494
497
  /**
495
- * Header param: Agent ID (agt_xxx) used for attribution and audit.
498
+ * Header param: Agent ID (agt_xxx) identifying which agent is making the request.
496
499
  */
497
- 'X-Agent-ID': string;
500
+ 'X-Agent-ID'?: string;
498
501
 
499
502
  /**
500
- * Header param: Stable run, session, or conversation ID for agent observability.
503
+ * Header param: Required when X-Agent-ID is present. Session or conversation ID
504
+ * for agent observability.
501
505
  */
502
- 'X-Instance-ID': string;
506
+ 'X-Instance-ID'?: string;
507
+ }
503
508
 
509
+ export interface TransactionGetParams {
504
510
  /**
505
511
  * Query param: Party ID for delegated transaction lookup
506
512
  */
507
513
  partyId?: string;
514
+
515
+ /**
516
+ * Header param: Agent ID (agt_xxx) identifying which agent is making the request.
517
+ */
518
+ 'X-Agent-ID'?: string;
519
+
520
+ /**
521
+ * Header param: Required when X-Agent-ID is present. Session or conversation ID
522
+ * for agent observability.
523
+ */
524
+ 'X-Instance-ID'?: string;
508
525
  }
509
526
 
510
527
  export declare namespace Transactions {
@@ -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,35 @@ 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: Agent ID (agt_xxx) identifying which agent is making the request.
1221
1221
  */
1222
- 'X-Agent-ID': string;
1222
+ 'X-Agent-ID'?: string;
1223
1223
 
1224
1224
  /**
1225
- * Header param: Stable run, session, or conversation ID for agent observability.
1225
+ * Header param: Required when X-Agent-ID is present. Session or conversation ID
1226
+ * for agent observability.
1226
1227
  */
1227
- 'X-Instance-ID': string;
1228
+ 'X-Instance-ID'?: string;
1229
+ }
1228
1230
 
1231
+ export interface TransferGetParams {
1229
1232
  /**
1230
1233
  * Query param: Party ID for delegated transfer lookup
1231
1234
  */
1232
1235
  partyId?: string;
1236
+
1237
+ /**
1238
+ * Header param: Agent ID (agt_xxx) identifying which agent is making the request.
1239
+ */
1240
+ 'X-Agent-ID'?: string;
1241
+
1242
+ /**
1243
+ * Header param: Required when X-Agent-ID is present. Session or conversation ID
1244
+ * for agent observability.
1245
+ */
1246
+ 'X-Instance-ID'?: string;
1233
1247
  }
1234
1248
 
1235
1249
  export interface TransferInitiateDepositParams {
@@ -1250,24 +1264,25 @@ export interface TransferInitiateDepositParams {
1250
1264
  'Idempotency-Key': string;
1251
1265
 
1252
1266
  /**
1253
- * Header param: Agent ID (agt_xxx) used for attribution and audit.
1267
+ * Body param: Currency code
1254
1268
  */
1255
- 'X-Agent-ID': string;
1269
+ currency?: string;
1256
1270
 
1257
1271
  /**
1258
- * Header param: Stable run, session, or conversation ID for agent observability.
1272
+ * Body param: Deposit description
1259
1273
  */
1260
- 'X-Instance-ID': string;
1274
+ description?: string;
1261
1275
 
1262
1276
  /**
1263
- * Body param: Currency code
1277
+ * Header param: Agent ID (agt_xxx) identifying which agent is making the request.
1264
1278
  */
1265
- currency?: string;
1279
+ 'X-Agent-ID'?: string;
1266
1280
 
1267
1281
  /**
1268
- * Body param: Deposit description
1282
+ * Header param: Required when X-Agent-ID is present. Session or conversation ID
1283
+ * for agent observability.
1269
1284
  */
1270
- description?: string;
1285
+ 'X-Instance-ID'?: string;
1271
1286
  }
1272
1287
 
1273
1288
  export interface TransferInitiateWithdrawalParams {
@@ -1288,24 +1303,25 @@ export interface TransferInitiateWithdrawalParams {
1288
1303
  'Idempotency-Key': string;
1289
1304
 
1290
1305
  /**
1291
- * Header param: Agent ID (agt_xxx) used for attribution and audit.
1306
+ * Body param: Currency code
1292
1307
  */
1293
- 'X-Agent-ID': string;
1308
+ currency?: string;
1294
1309
 
1295
1310
  /**
1296
- * Header param: Stable run, session, or conversation ID for agent observability.
1311
+ * Body param: Withdrawal description
1297
1312
  */
1298
- 'X-Instance-ID': string;
1313
+ description?: string;
1299
1314
 
1300
1315
  /**
1301
- * Body param: Currency code
1316
+ * Header param: Agent ID (agt_xxx) identifying which agent is making the request.
1302
1317
  */
1303
- currency?: string;
1318
+ 'X-Agent-ID'?: string;
1304
1319
 
1305
1320
  /**
1306
- * Body param: Withdrawal description
1321
+ * Header param: Required when X-Agent-ID is present. Session or conversation ID
1322
+ * for agent observability.
1307
1323
  */
1308
- description?: string;
1324
+ 'X-Instance-ID'?: string;
1309
1325
  }
1310
1326
 
1311
1327
  export declare namespace Transfers {
package/src/version.ts CHANGED
@@ -1 +1 @@
1
- export const VERSION = '0.14.0'; // x-release-please-version
1
+ export const VERSION = '0.15.0'; // x-release-please-version
package/version.d.mts CHANGED
@@ -1,2 +1,2 @@
1
- export declare const VERSION = "0.14.0";
1
+ export declare const VERSION = "0.15.0";
2
2
  //# sourceMappingURL=version.d.mts.map
package/version.d.ts CHANGED
@@ -1,2 +1,2 @@
1
- export declare const VERSION = "0.14.0";
1
+ export declare const VERSION = "0.15.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.14.0'; // x-release-please-version
4
+ exports.VERSION = '0.15.0'; // x-release-please-version
5
5
  //# sourceMappingURL=version.js.map
package/version.mjs CHANGED
@@ -1,2 +1,2 @@
1
- export const VERSION = '0.14.0'; // x-release-please-version
1
+ export const VERSION = '0.15.0'; // x-release-please-version
2
2
  //# sourceMappingURL=version.mjs.map