@naturalpay/sdk 0.7.0 → 0.9.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 (51) hide show
  1. package/CHANGELOG.md +22 -0
  2. package/README.md +19 -0
  3. package/client.d.mts +6 -0
  4. package/client.d.mts.map +1 -1
  5. package/client.d.ts +6 -0
  6. package/client.d.ts.map +1 -1
  7. package/client.js +6 -0
  8. package/client.js.map +1 -1
  9. package/client.mjs +6 -0
  10. package/client.mjs.map +1 -1
  11. package/package.json +1 -1
  12. package/resources/agents.d.mts +7 -7
  13. package/resources/agents.d.ts +7 -7
  14. package/resources/approvals.d.mts +414 -0
  15. package/resources/approvals.d.mts.map +1 -0
  16. package/resources/approvals.d.ts +414 -0
  17. package/resources/approvals.d.ts.map +1 -0
  18. package/resources/approvals.js +79 -0
  19. package/resources/approvals.js.map +1 -0
  20. package/resources/approvals.mjs +75 -0
  21. package/resources/approvals.mjs.map +1 -0
  22. package/resources/customers.d.mts +2 -2
  23. package/resources/customers.d.ts +2 -2
  24. package/resources/index.d.mts +1 -0
  25. package/resources/index.d.mts.map +1 -1
  26. package/resources/index.d.ts +1 -0
  27. package/resources/index.d.ts.map +1 -1
  28. package/resources/index.js +3 -1
  29. package/resources/index.js.map +1 -1
  30. package/resources/index.mjs +1 -0
  31. package/resources/index.mjs.map +1 -1
  32. package/resources/payment-requests.d.mts +1 -1
  33. package/resources/payment-requests.d.ts +1 -1
  34. package/resources/payment-requests.js +1 -1
  35. package/resources/payment-requests.mjs +1 -1
  36. package/resources/transfers.d.mts +1 -1
  37. package/resources/transfers.d.ts +1 -1
  38. package/resources/transfers.js +1 -1
  39. package/resources/transfers.mjs +1 -1
  40. package/src/client.ts +28 -0
  41. package/src/resources/agents.ts +7 -7
  42. package/src/resources/approvals.ts +577 -0
  43. package/src/resources/customers.ts +2 -2
  44. package/src/resources/index.ts +11 -0
  45. package/src/resources/payment-requests.ts +1 -1
  46. package/src/resources/transfers.ts +1 -1
  47. package/src/version.ts +1 -1
  48. package/version.d.mts +1 -1
  49. package/version.d.ts +1 -1
  50. package/version.js +1 -1
  51. package/version.mjs +1 -1
@@ -0,0 +1,577 @@
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
+ * Approval review operations
11
+ */
12
+ export class Approvals extends APIResource {
13
+ /**
14
+ * List approvals for your party.
15
+ */
16
+ list(
17
+ params: ApprovalListParams | null | undefined = {},
18
+ options?: RequestOptions,
19
+ ): APIPromise<ApprovalListResponse> {
20
+ const { 'X-Agent-ID': xAgentID, 'X-Instance-ID': xInstanceID, ...query } = params ?? {};
21
+ return this._client.get('/approvals', {
22
+ query,
23
+ ...options,
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
+ ]),
31
+ });
32
+ }
33
+
34
+ /**
35
+ * Approve the product operation under review.
36
+ */
37
+ approve(
38
+ approvalID: string,
39
+ params: ApprovalApproveParams | null | undefined = {},
40
+ options?: RequestOptions,
41
+ ): APIPromise<ApprovalApproveResponse> {
42
+ const { 'X-Agent-ID': xAgentID, 'X-Instance-ID': xInstanceID } = params ?? {};
43
+ return this._client.post(path`/approvals/${approvalID}/approve`, {
44
+ ...options,
45
+ headers: buildHeaders([
46
+ {
47
+ ...(xAgentID != null ? { 'X-Agent-ID': xAgentID } : undefined),
48
+ ...(xInstanceID != null ? { 'X-Instance-ID': xInstanceID } : undefined),
49
+ },
50
+ options?.headers,
51
+ ]),
52
+ });
53
+ }
54
+
55
+ /**
56
+ * Deny the product operation under review.
57
+ */
58
+ deny(
59
+ approvalID: string,
60
+ params: ApprovalDenyParams | null | undefined = {},
61
+ options?: RequestOptions,
62
+ ): APIPromise<ApprovalDenyResponse> {
63
+ const { 'X-Agent-ID': xAgentID, 'X-Instance-ID': xInstanceID } = params ?? {};
64
+ return this._client.post(path`/approvals/${approvalID}/deny`, {
65
+ ...options,
66
+ headers: buildHeaders([
67
+ {
68
+ ...(xAgentID != null ? { 'X-Agent-ID': xAgentID } : undefined),
69
+ ...(xInstanceID != null ? { 'X-Instance-ID': xInstanceID } : undefined),
70
+ },
71
+ options?.headers,
72
+ ]),
73
+ });
74
+ }
75
+
76
+ /**
77
+ * Get details of a specific approval.
78
+ */
79
+ get(
80
+ approvalID: string,
81
+ params: ApprovalGetParams | null | undefined = {},
82
+ options?: RequestOptions,
83
+ ): APIPromise<ApprovalGetResponse> {
84
+ const { 'X-Agent-ID': xAgentID, 'X-Instance-ID': xInstanceID } = params ?? {};
85
+ return this._client.get(path`/approvals/${approvalID}`, {
86
+ ...options,
87
+ headers: buildHeaders([
88
+ {
89
+ ...(xAgentID != null ? { 'X-Agent-ID': xAgentID } : undefined),
90
+ ...(xInstanceID != null ? { 'X-Instance-ID': xInstanceID } : undefined),
91
+ },
92
+ options?.headers,
93
+ ]),
94
+ });
95
+ }
96
+ }
97
+
98
+ export interface ApprovalListResponse {
99
+ data: Array<ApprovalListResponse.Data>;
100
+
101
+ meta: ApprovalListResponse.Meta;
102
+ }
103
+
104
+ export namespace ApprovalListResponse {
105
+ export interface Data {
106
+ /**
107
+ * Approval ID
108
+ */
109
+ id: string;
110
+
111
+ /**
112
+ * Resource attributes
113
+ */
114
+ attributes: Data.Attributes;
115
+
116
+ /**
117
+ * Resource type
118
+ */
119
+ type: string;
120
+ }
121
+
122
+ export namespace Data {
123
+ /**
124
+ * Resource attributes
125
+ */
126
+ export interface Attributes {
127
+ /**
128
+ * When the approval was created
129
+ */
130
+ createdAt: string;
131
+
132
+ /**
133
+ * Reasons this approval is under review
134
+ */
135
+ reasons: Array<Attributes.Reason>;
136
+
137
+ /**
138
+ * When the approval was resolved
139
+ */
140
+ resolvedAt: string | null;
141
+
142
+ /**
143
+ * Approval status
144
+ */
145
+ status: 'pending' | 'approved' | 'denied' | 'canceled';
146
+
147
+ /**
148
+ * Product operation that needs approval
149
+ */
150
+ target: Attributes.Target;
151
+
152
+ /**
153
+ * When the approval was last updated
154
+ */
155
+ updatedAt: string;
156
+ }
157
+
158
+ export namespace Attributes {
159
+ export interface Reason {
160
+ /**
161
+ * Actual transaction amount in minor units
162
+ */
163
+ actualAmount: number;
164
+
165
+ /**
166
+ * Currency code
167
+ */
168
+ currency: string;
169
+
170
+ /**
171
+ * Configured limit amount in minor units
172
+ */
173
+ limitAmount: number;
174
+
175
+ limitType: string;
176
+
177
+ type: string;
178
+ }
179
+
180
+ /**
181
+ * Product operation that needs approval
182
+ */
183
+ export interface Target {
184
+ /**
185
+ * Product execution ID
186
+ */
187
+ id: string;
188
+
189
+ /**
190
+ * Product execution type under approval
191
+ */
192
+ type: 'payment' | 'paymentRequestFulfillment' | 'deposit' | 'withdrawal';
193
+ }
194
+ }
195
+ }
196
+
197
+ export interface Meta {
198
+ pagination: Meta.Pagination;
199
+ }
200
+
201
+ export namespace Meta {
202
+ export interface Pagination {
203
+ hasMore: boolean;
204
+
205
+ nextCursor: string | null;
206
+ }
207
+ }
208
+ }
209
+
210
+ export interface ApprovalApproveResponse {
211
+ data: ApprovalApproveResponse.Data;
212
+ }
213
+
214
+ export namespace ApprovalApproveResponse {
215
+ export interface Data {
216
+ /**
217
+ * Approval ID
218
+ */
219
+ id: string;
220
+
221
+ /**
222
+ * Resource attributes
223
+ */
224
+ attributes: Data.Attributes;
225
+
226
+ /**
227
+ * Resource type
228
+ */
229
+ type: string;
230
+ }
231
+
232
+ export namespace Data {
233
+ /**
234
+ * Resource attributes
235
+ */
236
+ export interface Attributes {
237
+ /**
238
+ * When the approval was created
239
+ */
240
+ createdAt: string;
241
+
242
+ /**
243
+ * Reasons this approval is under review
244
+ */
245
+ reasons: Array<Attributes.Reason>;
246
+
247
+ /**
248
+ * When the approval was resolved
249
+ */
250
+ resolvedAt: string | null;
251
+
252
+ /**
253
+ * Approval status
254
+ */
255
+ status: 'pending' | 'approved' | 'denied' | 'canceled';
256
+
257
+ /**
258
+ * Product operation that needs approval
259
+ */
260
+ target: Attributes.Target;
261
+
262
+ /**
263
+ * When the approval was last updated
264
+ */
265
+ updatedAt: string;
266
+ }
267
+
268
+ export namespace Attributes {
269
+ export interface Reason {
270
+ /**
271
+ * Actual transaction amount in minor units
272
+ */
273
+ actualAmount: number;
274
+
275
+ /**
276
+ * Currency code
277
+ */
278
+ currency: string;
279
+
280
+ /**
281
+ * Configured limit amount in minor units
282
+ */
283
+ limitAmount: number;
284
+
285
+ limitType: string;
286
+
287
+ type: string;
288
+ }
289
+
290
+ /**
291
+ * Product operation that needs approval
292
+ */
293
+ export interface Target {
294
+ /**
295
+ * Product execution ID
296
+ */
297
+ id: string;
298
+
299
+ /**
300
+ * Product execution type under approval
301
+ */
302
+ type: 'payment' | 'paymentRequestFulfillment' | 'deposit' | 'withdrawal';
303
+ }
304
+ }
305
+ }
306
+ }
307
+
308
+ export interface ApprovalDenyResponse {
309
+ data: ApprovalDenyResponse.Data;
310
+ }
311
+
312
+ export namespace ApprovalDenyResponse {
313
+ export interface Data {
314
+ /**
315
+ * Approval ID
316
+ */
317
+ id: string;
318
+
319
+ /**
320
+ * Resource attributes
321
+ */
322
+ attributes: Data.Attributes;
323
+
324
+ /**
325
+ * Resource type
326
+ */
327
+ type: string;
328
+ }
329
+
330
+ export namespace Data {
331
+ /**
332
+ * Resource attributes
333
+ */
334
+ export interface Attributes {
335
+ /**
336
+ * When the approval was created
337
+ */
338
+ createdAt: string;
339
+
340
+ /**
341
+ * Reasons this approval is under review
342
+ */
343
+ reasons: Array<Attributes.Reason>;
344
+
345
+ /**
346
+ * When the approval was resolved
347
+ */
348
+ resolvedAt: string | null;
349
+
350
+ /**
351
+ * Approval status
352
+ */
353
+ status: 'pending' | 'approved' | 'denied' | 'canceled';
354
+
355
+ /**
356
+ * Product operation that needs approval
357
+ */
358
+ target: Attributes.Target;
359
+
360
+ /**
361
+ * When the approval was last updated
362
+ */
363
+ updatedAt: string;
364
+ }
365
+
366
+ export namespace Attributes {
367
+ export interface Reason {
368
+ /**
369
+ * Actual transaction amount in minor units
370
+ */
371
+ actualAmount: number;
372
+
373
+ /**
374
+ * Currency code
375
+ */
376
+ currency: string;
377
+
378
+ /**
379
+ * Configured limit amount in minor units
380
+ */
381
+ limitAmount: number;
382
+
383
+ limitType: string;
384
+
385
+ type: string;
386
+ }
387
+
388
+ /**
389
+ * Product operation that needs approval
390
+ */
391
+ export interface Target {
392
+ /**
393
+ * Product execution ID
394
+ */
395
+ id: string;
396
+
397
+ /**
398
+ * Product execution type under approval
399
+ */
400
+ type: 'payment' | 'paymentRequestFulfillment' | 'deposit' | 'withdrawal';
401
+ }
402
+ }
403
+ }
404
+ }
405
+
406
+ export interface ApprovalGetResponse {
407
+ data: ApprovalGetResponse.Data;
408
+ }
409
+
410
+ export namespace ApprovalGetResponse {
411
+ export interface Data {
412
+ /**
413
+ * Approval ID
414
+ */
415
+ id: string;
416
+
417
+ /**
418
+ * Resource attributes
419
+ */
420
+ attributes: Data.Attributes;
421
+
422
+ /**
423
+ * Resource type
424
+ */
425
+ type: string;
426
+ }
427
+
428
+ export namespace Data {
429
+ /**
430
+ * Resource attributes
431
+ */
432
+ export interface Attributes {
433
+ /**
434
+ * When the approval was created
435
+ */
436
+ createdAt: string;
437
+
438
+ /**
439
+ * Reasons this approval is under review
440
+ */
441
+ reasons: Array<Attributes.Reason>;
442
+
443
+ /**
444
+ * When the approval was resolved
445
+ */
446
+ resolvedAt: string | null;
447
+
448
+ /**
449
+ * Approval status
450
+ */
451
+ status: 'pending' | 'approved' | 'denied' | 'canceled';
452
+
453
+ /**
454
+ * Product operation that needs approval
455
+ */
456
+ target: Attributes.Target;
457
+
458
+ /**
459
+ * When the approval was last updated
460
+ */
461
+ updatedAt: string;
462
+ }
463
+
464
+ export namespace Attributes {
465
+ export interface Reason {
466
+ /**
467
+ * Actual transaction amount in minor units
468
+ */
469
+ actualAmount: number;
470
+
471
+ /**
472
+ * Currency code
473
+ */
474
+ currency: string;
475
+
476
+ /**
477
+ * Configured limit amount in minor units
478
+ */
479
+ limitAmount: number;
480
+
481
+ limitType: string;
482
+
483
+ type: string;
484
+ }
485
+
486
+ /**
487
+ * Product operation that needs approval
488
+ */
489
+ export interface Target {
490
+ /**
491
+ * Product execution ID
492
+ */
493
+ id: string;
494
+
495
+ /**
496
+ * Product execution type under approval
497
+ */
498
+ type: 'payment' | 'paymentRequestFulfillment' | 'deposit' | 'withdrawal';
499
+ }
500
+ }
501
+ }
502
+ }
503
+
504
+ export interface ApprovalListParams {
505
+ /**
506
+ * Query param: Maximum number to return
507
+ */
508
+ limit?: number;
509
+
510
+ /**
511
+ * Query param: Approval status to list. Defaults to pending approvals.
512
+ */
513
+ status?: 'pending' | 'approved' | 'denied' | 'canceled';
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;
525
+ }
526
+
527
+ export interface ApprovalApproveParams {
528
+ /**
529
+ * Agent ID (agt_xxx) identifying which agent is making the request.
530
+ */
531
+ 'X-Agent-ID'?: string;
532
+
533
+ /**
534
+ * Required when X-Agent-ID is present. Session or conversation ID for agent
535
+ * observability.
536
+ */
537
+ 'X-Instance-ID'?: string;
538
+ }
539
+
540
+ export interface ApprovalDenyParams {
541
+ /**
542
+ * Agent ID (agt_xxx) identifying which agent is making the request.
543
+ */
544
+ 'X-Agent-ID'?: string;
545
+
546
+ /**
547
+ * Required when X-Agent-ID is present. Session or conversation ID for agent
548
+ * observability.
549
+ */
550
+ 'X-Instance-ID'?: string;
551
+ }
552
+
553
+ export interface ApprovalGetParams {
554
+ /**
555
+ * Agent ID (agt_xxx) identifying which agent is making the request.
556
+ */
557
+ 'X-Agent-ID'?: string;
558
+
559
+ /**
560
+ * Required when X-Agent-ID is present. Session or conversation ID for agent
561
+ * observability.
562
+ */
563
+ 'X-Instance-ID'?: string;
564
+ }
565
+
566
+ export declare namespace Approvals {
567
+ export {
568
+ type ApprovalListResponse as ApprovalListResponse,
569
+ type ApprovalApproveResponse as ApprovalApproveResponse,
570
+ type ApprovalDenyResponse as ApprovalDenyResponse,
571
+ type ApprovalGetResponse as ApprovalGetResponse,
572
+ type ApprovalListParams as ApprovalListParams,
573
+ type ApprovalApproveParams as ApprovalApproveParams,
574
+ type ApprovalDenyParams as ApprovalDenyParams,
575
+ type ApprovalGetParams as ApprovalGetParams,
576
+ };
577
+ }
@@ -185,7 +185,7 @@ export namespace CustomerListResponse {
185
185
  */
186
186
  export interface Limits {
187
187
  /**
188
- * Positive per-transaction limit in cents. null means no per-payment limit.
188
+ * Positive per-transaction limit in cents. null means no per-transaction limit.
189
189
  */
190
190
  perTransaction?: number | null;
191
191
  }
@@ -395,7 +395,7 @@ export namespace CustomerGetResponse {
395
395
  */
396
396
  export interface Limits {
397
397
  /**
398
- * Positive per-transaction limit in cents. null means no per-payment limit.
398
+ * Positive per-transaction limit in cents. null means no per-transaction limit.
399
399
  */
400
400
  perTransaction?: number | null;
401
401
  }
@@ -32,6 +32,17 @@ export {
32
32
  type AgentRemoveParams,
33
33
  type AgentRemoveCustomerParams,
34
34
  } from './agents';
35
+ export {
36
+ Approvals,
37
+ type ApprovalListResponse,
38
+ type ApprovalApproveResponse,
39
+ type ApprovalDenyResponse,
40
+ type ApprovalGetResponse,
41
+ type ApprovalListParams,
42
+ type ApprovalApproveParams,
43
+ type ApprovalDenyParams,
44
+ type ApprovalGetParams,
45
+ } from './approvals';
35
46
  export { Counterparties, type CounterpartyListResponse, type CounterpartyListParams } from './counterparties';
36
47
  export {
37
48
  Customers,
@@ -150,7 +150,7 @@ export class PaymentRequests extends APIResource {
150
150
  }
151
151
 
152
152
  /**
153
- * Get a single payment request visible to the authenticated requester party.
153
+ * Get a single payment request visible to the authenticated participant party.
154
154
  *
155
155
  * @example
156
156
  * ```ts
@@ -71,7 +71,7 @@ export class Transfers extends APIResource {
71
71
  * @example
72
72
  * ```ts
73
73
  * const response = await client.transfers.initiateDeposit({
74
- * amount: 1,
74
+ * amount: 100,
75
75
  * externalAccountId: 'eac_ecc2efdd09bd231a9ad9bd2aada37aa7',
76
76
  * 'Idempotency-Key': 'Idempotency-Key',
77
77
  * });
package/src/version.ts CHANGED
@@ -1 +1 @@
1
- export const VERSION = '0.7.0'; // x-release-please-version
1
+ export const VERSION = '0.9.0'; // x-release-please-version
package/version.d.mts CHANGED
@@ -1,2 +1,2 @@
1
- export declare const VERSION = "0.7.0";
1
+ export declare const VERSION = "0.9.0";
2
2
  //# sourceMappingURL=version.d.mts.map
package/version.d.ts CHANGED
@@ -1,2 +1,2 @@
1
- export declare const VERSION = "0.7.0";
1
+ export declare const VERSION = "0.9.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.7.0'; // x-release-please-version
4
+ exports.VERSION = '0.9.0'; // x-release-please-version
5
5
  //# sourceMappingURL=version.js.map
package/version.mjs CHANGED
@@ -1,2 +1,2 @@
1
- export const VERSION = '0.7.0'; // x-release-please-version
1
+ export const VERSION = '0.9.0'; // x-release-please-version
2
2
  //# sourceMappingURL=version.mjs.map