@getivy/node-sdk 0.1.0-alpha.9 → 1.1.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 (231) hide show
  1. package/CHANGELOG.md +334 -0
  2. package/README.md +16 -26
  3. package/_shims/index.d.ts +2 -0
  4. package/_shims/index.js +5 -1
  5. package/_shims/index.mjs +5 -1
  6. package/core.d.ts +19 -5
  7. package/core.d.ts.map +1 -1
  8. package/core.js +25 -15
  9. package/core.js.map +1 -1
  10. package/core.mjs +26 -16
  11. package/core.mjs.map +1 -1
  12. package/index.d.mts +36 -18
  13. package/index.d.ts +36 -18
  14. package/index.d.ts.map +1 -1
  15. package/index.js +27 -8
  16. package/index.js.map +1 -1
  17. package/index.mjs +27 -8
  18. package/index.mjs.map +1 -1
  19. package/package.json +11 -33
  20. package/resource.d.ts +1 -1
  21. package/resource.d.ts.map +1 -1
  22. package/resource.js.map +1 -1
  23. package/resource.mjs.map +1 -1
  24. package/resources/balance.d.ts +8 -5
  25. package/resources/balance.d.ts.map +1 -1
  26. package/resources/banks.d.ts +82 -67
  27. package/resources/banks.d.ts.map +1 -1
  28. package/resources/beneficiary-payouts.d.ts +61 -0
  29. package/resources/beneficiary-payouts.d.ts.map +1 -0
  30. package/resources/beneficiary-payouts.js +16 -0
  31. package/resources/beneficiary-payouts.js.map +1 -0
  32. package/resources/beneficiary-payouts.mjs +12 -0
  33. package/resources/beneficiary-payouts.mjs.map +1 -0
  34. package/resources/capabilities.d.ts +1 -10
  35. package/resources/capabilities.d.ts.map +1 -1
  36. package/resources/charges.d.ts +28 -19
  37. package/resources/charges.d.ts.map +1 -1
  38. package/resources/checkoutsession.d.ts +275 -1360
  39. package/resources/checkoutsession.d.ts.map +1 -1
  40. package/resources/customers.d.ts +140 -10
  41. package/resources/customers.d.ts.map +1 -1
  42. package/resources/customers.js +9 -2
  43. package/resources/customers.js.map +1 -1
  44. package/resources/customers.mjs +9 -2
  45. package/resources/customers.mjs.map +1 -1
  46. package/resources/data/accounts.d.ts +83 -0
  47. package/resources/data/accounts.d.ts.map +1 -0
  48. package/resources/data/accounts.js +15 -0
  49. package/resources/data/accounts.js.map +1 -0
  50. package/resources/data/accounts.mjs +11 -0
  51. package/resources/data/accounts.mjs.map +1 -0
  52. package/resources/data/balances.d.ts +48 -0
  53. package/resources/data/balances.d.ts.map +1 -0
  54. package/resources/data/balances.js +15 -0
  55. package/resources/data/balances.js.map +1 -0
  56. package/resources/data/balances.mjs +11 -0
  57. package/resources/data/balances.mjs.map +1 -0
  58. package/resources/data/consent.d.ts +80 -0
  59. package/resources/data/consent.d.ts.map +1 -0
  60. package/resources/data/consent.js +21 -0
  61. package/resources/data/consent.js.map +1 -0
  62. package/resources/data/consent.mjs +17 -0
  63. package/resources/data/consent.mjs.map +1 -0
  64. package/resources/data/data.d.ts +26 -0
  65. package/resources/data/data.d.ts.map +1 -0
  66. package/resources/data/data.js +55 -0
  67. package/resources/data/data.js.map +1 -0
  68. package/resources/data/data.mjs +28 -0
  69. package/resources/data/data.mjs.map +1 -0
  70. package/resources/data/index.d.ts +7 -0
  71. package/resources/data/index.d.ts.map +1 -0
  72. package/resources/data/index.js +17 -0
  73. package/resources/data/index.js.map +1 -0
  74. package/resources/data/index.mjs +8 -0
  75. package/resources/data/index.mjs.map +1 -0
  76. package/resources/data/session.d.ts +258 -0
  77. package/resources/data/session.d.ts.map +1 -0
  78. package/resources/data/session.js +21 -0
  79. package/resources/data/session.js.map +1 -0
  80. package/resources/data/session.mjs +17 -0
  81. package/resources/data/session.mjs.map +1 -0
  82. package/resources/data/transactions.d.ts +175 -0
  83. package/resources/data/transactions.d.ts.map +1 -0
  84. package/resources/data/transactions.js +16 -0
  85. package/resources/data/transactions.js.map +1 -0
  86. package/resources/data/transactions.mjs +12 -0
  87. package/resources/data/transactions.mjs.map +1 -0
  88. package/resources/data.d.ts +2 -0
  89. package/resources/data.d.ts.map +1 -0
  90. package/resources/data.js +19 -0
  91. package/resources/data.js.map +1 -0
  92. package/resources/data.mjs +3 -0
  93. package/resources/data.mjs.map +1 -0
  94. package/resources/deposits.d.ts +165 -0
  95. package/resources/deposits.d.ts.map +1 -0
  96. package/resources/deposits.js +15 -0
  97. package/resources/deposits.js.map +1 -0
  98. package/resources/deposits.mjs +11 -0
  99. package/resources/deposits.mjs.map +1 -0
  100. package/resources/fx.d.ts +90 -0
  101. package/resources/fx.d.ts.map +1 -0
  102. package/resources/fx.js +22 -0
  103. package/resources/fx.js.map +1 -0
  104. package/resources/fx.mjs +18 -0
  105. package/resources/fx.mjs.map +1 -0
  106. package/resources/index.d.ts +13 -8
  107. package/resources/index.d.ts.map +1 -1
  108. package/resources/index.js +15 -5
  109. package/resources/index.js.map +1 -1
  110. package/resources/index.mjs +7 -2
  111. package/resources/index.mjs.map +1 -1
  112. package/resources/mandates.d.ts +55 -17
  113. package/resources/mandates.d.ts.map +1 -1
  114. package/resources/orders.d.ts +720 -743
  115. package/resources/orders.d.ts.map +1 -1
  116. package/resources/orders.js +13 -3
  117. package/resources/orders.js.map +1 -1
  118. package/resources/orders.mjs +13 -3
  119. package/resources/orders.mjs.map +1 -1
  120. package/resources/payouts.d.ts +219 -103
  121. package/resources/payouts.d.ts.map +1 -1
  122. package/resources/payouts.js +3 -4
  123. package/resources/payouts.js.map +1 -1
  124. package/resources/payouts.mjs +3 -4
  125. package/resources/payouts.mjs.map +1 -1
  126. package/resources/refunds.d.ts +53 -97
  127. package/resources/refunds.d.ts.map +1 -1
  128. package/resources/refunds.js +8 -12
  129. package/resources/refunds.js.map +1 -1
  130. package/resources/refunds.mjs +8 -12
  131. package/resources/refunds.mjs.map +1 -1
  132. package/resources/returns.d.ts +104 -0
  133. package/resources/returns.d.ts.map +1 -0
  134. package/resources/returns.js +21 -0
  135. package/resources/returns.js.map +1 -0
  136. package/resources/returns.mjs +17 -0
  137. package/resources/returns.mjs.map +1 -0
  138. package/resources/subaccounts.d.ts +15 -5
  139. package/resources/subaccounts.d.ts.map +1 -1
  140. package/resources/subaccounts.js.map +1 -1
  141. package/resources/subaccounts.mjs.map +1 -1
  142. package/resources/transactions.d.ts +174 -0
  143. package/resources/transactions.d.ts.map +1 -0
  144. package/resources/transactions.js +15 -0
  145. package/resources/transactions.js.map +1 -0
  146. package/resources/transactions.mjs +11 -0
  147. package/resources/transactions.mjs.map +1 -0
  148. package/resources/webhook/index.d.ts +3 -0
  149. package/resources/webhook/index.d.ts.map +1 -0
  150. package/resources/webhook/index.js +9 -0
  151. package/resources/webhook/index.js.map +1 -0
  152. package/resources/webhook/index.mjs +4 -0
  153. package/resources/webhook/index.mjs.map +1 -0
  154. package/resources/webhook/subscription.d.ts +152 -0
  155. package/resources/webhook/subscription.d.ts.map +1 -0
  156. package/resources/{webhooksubscription.js → webhook/subscription.js} +6 -6
  157. package/resources/webhook/subscription.js.map +1 -0
  158. package/resources/{webhooksubscription.mjs → webhook/subscription.mjs} +4 -4
  159. package/resources/webhook/subscription.mjs.map +1 -0
  160. package/resources/webhook/webhook.d.ts +28 -0
  161. package/resources/webhook/webhook.d.ts.map +1 -0
  162. package/resources/webhook/webhook.js +45 -0
  163. package/resources/webhook/webhook.js.map +1 -0
  164. package/resources/webhook/webhook.mjs +18 -0
  165. package/resources/webhook/webhook.mjs.map +1 -0
  166. package/resources/webhook.d.ts +2 -0
  167. package/resources/webhook.d.ts.map +1 -0
  168. package/resources/webhook.js +19 -0
  169. package/resources/webhook.js.map +1 -0
  170. package/resources/webhook.mjs +3 -0
  171. package/resources/webhook.mjs.map +1 -0
  172. package/resources.d.ts +2 -0
  173. package/resources.d.ts.map +1 -0
  174. package/resources.js +18 -0
  175. package/resources.js.map +1 -0
  176. package/resources.mjs +2 -0
  177. package/resources.mjs.map +1 -0
  178. package/src/_shims/index.d.ts +2 -0
  179. package/src/_shims/index.js +5 -1
  180. package/src/_shims/index.mjs +5 -1
  181. package/src/core.ts +44 -16
  182. package/src/index.ts +111 -60
  183. package/src/resource.ts +1 -1
  184. package/src/resources/balance.ts +8 -5
  185. package/src/resources/banks.ts +130 -67
  186. package/src/resources/beneficiary-payouts.ts +78 -0
  187. package/src/resources/capabilities.ts +1 -10
  188. package/src/resources/charges.ts +30 -21
  189. package/src/resources/checkoutsession.ts +1224 -3096
  190. package/src/resources/customers.ts +164 -9
  191. package/src/resources/data/accounts.ts +113 -0
  192. package/src/resources/data/balances.ts +60 -0
  193. package/src/resources/data/consent.ts +110 -0
  194. package/src/resources/data/data.ts +75 -0
  195. package/src/resources/data/index.ts +20 -0
  196. package/src/resources/data/session.ts +1317 -0
  197. package/src/resources/data/transactions.ts +235 -0
  198. package/src/resources/data.ts +3 -0
  199. package/src/resources/deposits.ts +231 -0
  200. package/src/resources/fx.ts +119 -0
  201. package/src/resources/index.ts +33 -28
  202. package/src/resources/mandates.ts +79 -17
  203. package/src/resources/orders.ts +1449 -1075
  204. package/src/resources/payouts.ts +273 -103
  205. package/src/resources/refunds.ts +70 -111
  206. package/src/resources/returns.ts +140 -0
  207. package/src/resources/subaccounts.ts +26 -4
  208. package/src/resources/transactions.ts +234 -0
  209. package/src/resources/webhook/index.ts +16 -0
  210. package/src/resources/{webhooksubscription.ts → webhook/subscription.ts} +164 -112
  211. package/src/resources/webhook/webhook.ts +69 -0
  212. package/src/resources/webhook.ts +3 -0
  213. package/src/resources.ts +1 -0
  214. package/src/version.ts +1 -1
  215. package/version.d.ts +1 -1
  216. package/version.d.ts.map +1 -1
  217. package/version.js +1 -1
  218. package/version.js.map +1 -1
  219. package/version.mjs +1 -1
  220. package/version.mjs.map +1 -1
  221. package/resources/reports.d.ts +0 -120
  222. package/resources/reports.d.ts.map +0 -1
  223. package/resources/reports.js +0 -31
  224. package/resources/reports.js.map +0 -1
  225. package/resources/reports.mjs +0 -27
  226. package/resources/reports.mjs.map +0 -1
  227. package/resources/webhooksubscription.d.ts +0 -155
  228. package/resources/webhooksubscription.d.ts.map +0 -1
  229. package/resources/webhooksubscription.js.map +0 -1
  230. package/resources/webhooksubscription.mjs.map +0 -1
  231. package/src/resources/reports.ts +0 -172
package/resources.js ADDED
@@ -0,0 +1,18 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./resources/index.js"), exports);
18
+ //# sourceMappingURL=resources.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"resources.js","sourceRoot":"","sources":["src/resources.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,uDAAkC"}
package/resources.mjs ADDED
@@ -0,0 +1,2 @@
1
+ export * from "./resources/index.mjs";
2
+ //# sourceMappingURL=resources.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"resources.mjs","sourceRoot":"","sources":["src/resources.ts"],"names":[],"mappings":""}
@@ -79,3 +79,5 @@ export function fileFromPath(path: string, options?: FileFromPathOptions): Promi
79
79
  export function fileFromPath(path: string, filename?: string, options?: FileFromPathOptions): Promise<File>;
80
80
 
81
81
  export function isFsReadStream(value: any): value is FsReadStream;
82
+
83
+ export const init: () => void;
@@ -3,7 +3,9 @@
3
3
  */
4
4
  const shims = require('./registry');
5
5
  const auto = require('@getivy/node-sdk/_shims/auto/runtime');
6
- if (!shims.kind) shims.setShims(auto.getRuntime(), { auto: true });
6
+ exports.init = () => {
7
+ if (!shims.kind) shims.setShims(auto.getRuntime(), { auto: true });
8
+ };
7
9
  for (const property of Object.keys(shims)) {
8
10
  Object.defineProperty(exports, property, {
9
11
  get() {
@@ -11,3 +13,5 @@ for (const property of Object.keys(shims)) {
11
13
  },
12
14
  });
13
15
  }
16
+
17
+ exports.init();
@@ -3,5 +3,9 @@
3
3
  */
4
4
  import * as shims from './registry.mjs';
5
5
  import * as auto from "./auto/runtime";
6
- if (!shims.kind) shims.setShims(auto.getRuntime(), { auto: true });
6
+ export const init = () => {
7
+ if (!shims.kind) shims.setShims(auto.getRuntime(), { auto: true });
8
+ };
7
9
  export * from './registry.mjs';
10
+
11
+ init();
package/src/core.ts CHANGED
@@ -16,7 +16,12 @@ import {
16
16
  type RequestInit,
17
17
  type Response,
18
18
  type HeadersInit,
19
+ init,
19
20
  } from './_shims/index';
21
+
22
+ // try running side effects outside of _shims/index to workaround https://github.com/vercel/next.js/issues/76881
23
+ init();
24
+
20
25
  export { type Response };
21
26
  import { BlobLike, isBlobLike, isMultipartBody } from './uploads';
22
27
  export {
@@ -28,6 +33,20 @@ export {
28
33
 
29
34
  export type Fetch = (url: RequestInfo, init?: RequestInit) => Promise<Response>;
30
35
 
36
+ /**
37
+ * An alias to the builtin `Array` type so we can
38
+ * easily alias it in import statements if there are name clashes.
39
+ */
40
+ type _Array<T> = Array<T>;
41
+
42
+ /**
43
+ * An alias to the builtin `Record` type so we can
44
+ * easily alias it in import statements if there are name clashes.
45
+ */
46
+ type _Record<K extends keyof any, T> = Record<K, T>;
47
+
48
+ export type { _Array as Array, _Record as Record };
49
+
31
50
  type PromiseOrValue<T> = T | Promise<T>;
32
51
 
33
52
  type APIResponseProps = {
@@ -48,8 +67,8 @@ async function defaultParseResponse<T>(props: APIResponseProps): Promise<T> {
48
67
  }
49
68
 
50
69
  const contentType = response.headers.get('content-type');
51
- const isJSON =
52
- contentType?.includes('application/json') || contentType?.includes('application/vnd.api+json');
70
+ const mediaType = contentType?.split(';')[0]?.trim();
71
+ const isJSON = mediaType?.includes('application/json') || mediaType?.endsWith('+json');
53
72
  if (isJSON) {
54
73
  const json = await response.json();
55
74
 
@@ -151,6 +170,7 @@ export class APIPromise<T> extends Promise<T> {
151
170
 
152
171
  export abstract class APIClient {
153
172
  baseURL: string;
173
+ #baseURLOverridden: boolean;
154
174
  maxRetries: number;
155
175
  timeout: number;
156
176
  httpAgent: Agent | undefined;
@@ -160,18 +180,21 @@ export abstract class APIClient {
160
180
 
161
181
  constructor({
162
182
  baseURL,
183
+ baseURLOverridden,
163
184
  maxRetries = 2,
164
185
  timeout = 60000, // 1 minute
165
186
  httpAgent,
166
187
  fetch: overriddenFetch,
167
188
  }: {
168
189
  baseURL: string;
190
+ baseURLOverridden: boolean;
169
191
  maxRetries?: number | undefined;
170
192
  timeout: number | undefined;
171
193
  httpAgent: Agent | undefined;
172
194
  fetch: Fetch | undefined;
173
195
  }) {
174
196
  this.baseURL = baseURL;
197
+ this.#baseURLOverridden = baseURLOverridden;
175
198
  this.maxRetries = validatePositiveInteger('maxRetries', maxRetries);
176
199
  this.timeout = validatePositiveInteger('timeout', timeout);
177
200
  this.httpAgent = httpAgent;
@@ -194,7 +217,7 @@ export abstract class APIClient {
194
217
  protected defaultHeaders(opts: FinalRequestOptions): Headers {
195
218
  return {
196
219
  Accept: 'application/json',
197
- 'Content-Type': 'application/json',
220
+ ...(['head', 'get'].includes(opts.method) ? {} : { 'Content-Type': 'application/json' }),
198
221
  'User-Agent': this.getUserAgent(),
199
222
  ...getPlatformHeaders(),
200
223
  ...this.authHeaders(opts),
@@ -276,12 +299,12 @@ export abstract class APIClient {
276
299
  return null;
277
300
  }
278
301
 
279
- buildRequest<Req>(
280
- options: FinalRequestOptions<Req>,
302
+ async buildRequest<Req>(
303
+ inputOptions: FinalRequestOptions<Req>,
281
304
  { retryCount = 0 }: { retryCount?: number } = {},
282
- ): { req: RequestInit; url: string; timeout: number } {
283
- options = { ...options };
284
- const { method, path, query, headers: headers = {} } = options;
305
+ ): Promise<{ req: RequestInit; url: string; timeout: number }> {
306
+ const options = { ...inputOptions };
307
+ const { method, path, query, defaultBaseURL, headers: headers = {} } = options;
285
308
 
286
309
  const body =
287
310
  ArrayBuffer.isView(options.body) || (options.__binaryRequest && typeof options.body === 'string') ?
@@ -291,7 +314,7 @@ export abstract class APIClient {
291
314
  : null;
292
315
  const contentLength = this.calculateContentLength(body);
293
316
 
294
- const url = this.buildURL(path!, query);
317
+ const url = this.buildURL(path!, query, defaultBaseURL);
295
318
  if ('timeout' in options) validatePositiveInteger('timeout', options.timeout);
296
319
  options.timeout = options.timeout ?? this.timeout;
297
320
  const httpAgent = options.httpAgent ?? this.httpAgent ?? getDefaultAgent(url);
@@ -308,8 +331,8 @@ export abstract class APIClient {
308
331
  }
309
332
 
310
333
  if (this.idempotencyHeader && method !== 'get') {
311
- if (!options.idempotencyKey) options.idempotencyKey = this.defaultIdempotencyKey();
312
- headers[this.idempotencyHeader] = options.idempotencyKey;
334
+ if (!inputOptions.idempotencyKey) inputOptions.idempotencyKey = this.defaultIdempotencyKey();
335
+ headers[this.idempotencyHeader] = inputOptions.idempotencyKey;
313
336
  }
314
337
 
315
338
  const reqHeaders = this.buildHeaders({ options, headers, contentLength, retryCount });
@@ -366,7 +389,7 @@ export abstract class APIClient {
366
389
  getHeader(headers, 'x-stainless-timeout') === undefined &&
367
390
  options.timeout
368
391
  ) {
369
- reqHeaders['x-stainless-timeout'] = String(options.timeout);
392
+ reqHeaders['x-stainless-timeout'] = String(Math.trunc(options.timeout / 1000));
370
393
  }
371
394
 
372
395
  this.validateHeaders(reqHeaders, headers);
@@ -395,7 +418,7 @@ export abstract class APIClient {
395
418
  !headers ? {}
396
419
  : Symbol.iterator in headers ?
397
420
  Object.fromEntries(Array.from(headers as Iterable<string[]>).map((header) => [...header]))
398
- : { ...headers }
421
+ : { ...(headers as any as Record<string, string>) }
399
422
  );
400
423
  }
401
424
 
@@ -427,7 +450,9 @@ export abstract class APIClient {
427
450
 
428
451
  await this.prepareOptions(options);
429
452
 
430
- const { req, url, timeout } = this.buildRequest(options, { retryCount: maxRetries - retriesRemaining });
453
+ const { req, url, timeout } = await this.buildRequest(options, {
454
+ retryCount: maxRetries - retriesRemaining,
455
+ });
431
456
 
432
457
  await this.prepareRequest(req, { url, options });
433
458
 
@@ -484,11 +509,12 @@ export abstract class APIClient {
484
509
  return new PagePromise<PageClass, Item>(this, request, Page);
485
510
  }
486
511
 
487
- buildURL<Req>(path: string, query: Req | null | undefined): string {
512
+ buildURL<Req>(path: string, query: Req | null | undefined, defaultBaseURL?: string | undefined): string {
513
+ const baseURL = (!this.#baseURLOverridden && defaultBaseURL) || this.baseURL;
488
514
  const url =
489
515
  isAbsoluteURL(path) ?
490
516
  new URL(path)
491
- : new URL(this.baseURL + (this.baseURL.endsWith('/') && path.startsWith('/') ? path.slice(1) : path));
517
+ : new URL(baseURL + (baseURL.endsWith('/') && path.startsWith('/') ? path.slice(1) : path));
492
518
 
493
519
  const defaultQuery = this.defaultQuery();
494
520
  if (!isEmptyObj(defaultQuery)) {
@@ -773,6 +799,7 @@ export type RequestOptions<
773
799
  query?: Req | undefined;
774
800
  body?: Req | null | undefined;
775
801
  headers?: Headers | undefined;
802
+ defaultBaseURL?: string | undefined;
776
803
 
777
804
  maxRetries?: number;
778
805
  stream?: boolean | undefined;
@@ -794,6 +821,7 @@ const requestOptionsKeys: KeysEnum<RequestOptions> = {
794
821
  query: true,
795
822
  body: true,
796
823
  headers: true,
824
+ defaultBaseURL: true,
797
825
 
798
826
  maxRetries: true,
799
827
  stream: true,
package/src/index.ts CHANGED
@@ -15,6 +15,7 @@ import {
15
15
  BankSearchResponse,
16
16
  Banks,
17
17
  } from './resources/banks';
18
+ import { BeneficiaryPayoutCreateResponse, BeneficiaryPayouts } from './resources/beneficiary-payouts';
18
19
  import { Capabilities, CapabilityRetrieveParams, CapabilityRetrieveResponse } from './resources/capabilities';
19
20
  import { Charge, ChargeCreateParams, Charges } from './resources/charges';
20
21
  import {
@@ -31,66 +32,70 @@ import {
31
32
  CustomerCreateResponse,
32
33
  CustomerRetrieveParams,
33
34
  CustomerRetrieveResponse,
35
+ CustomerSearchParams,
36
+ CustomerSearchResponse,
34
37
  Customers,
35
38
  } from './resources/customers';
39
+ import { DepositRetrieveParams, DepositRetrieveResponse, Deposits } from './resources/deposits';
36
40
  import {
41
+ Fx,
42
+ FxRetrieveParams,
43
+ FxRetrieveRateParams,
44
+ FxRetrieveRateResponse,
45
+ FxRetrieveResponse,
46
+ } from './resources/fx';
47
+ import {
48
+ Mandate,
37
49
  MandateLookupParams,
38
- MandateResponse,
50
+ MandateLookupResponse,
39
51
  MandateRetrieveParams,
40
52
  MandateRevokeParams,
41
53
  MandateRevokeResponse,
42
54
  Mandates,
43
55
  } from './resources/mandates';
44
56
  import {
57
+ OrderCreateParams,
58
+ OrderCreateResponse,
59
+ OrderExpireParams,
60
+ OrderExpireResponse,
45
61
  OrderRetrieveParams,
46
62
  OrderRetrieveResponse,
47
- OrderUpdateParams,
48
- OrderUpdateResponse,
49
63
  Orders,
50
64
  } from './resources/orders';
51
65
  import {
66
+ Payout,
52
67
  PayoutCreateParams,
53
68
  PayoutListParams,
54
69
  PayoutListResponse,
55
70
  PayoutRetrieveParams,
71
+ PayoutRetrieveResponse,
56
72
  Payouts,
57
- PublicUserPayout,
58
73
  } from './resources/payouts';
59
74
  import {
60
- RefundBatchParams,
61
- RefundBatchResponse,
75
+ Refund,
62
76
  RefundCreateParams,
63
- RefundResponse,
77
+ RefundCreateResponse,
78
+ RefundRetrieveParams,
79
+ RefundRetrieveResponse,
64
80
  Refunds,
65
81
  } from './resources/refunds';
66
82
  import {
67
- PayoutReport,
68
- ReportCreateParams,
69
- ReportCreateResponse,
70
- ReportDownloadParams,
71
- ReportRetrieveParams,
72
- ReportRetrieveResponse,
73
- Reports,
74
- } from './resources/reports';
83
+ ReturnCreateParams,
84
+ ReturnCreateResponse,
85
+ ReturnRetrieveParams,
86
+ ReturnRetrieveResponse,
87
+ Returns,
88
+ } from './resources/returns';
75
89
  import {
76
90
  Subaccount,
77
91
  SubaccountCreateParams,
92
+ SubaccountCreateResponse,
78
93
  SubaccountRetrieveParams,
79
94
  Subaccounts,
80
95
  } from './resources/subaccounts';
81
- import {
82
- Webhooksubscription,
83
- WebhooksubscriptionCreateParams,
84
- WebhooksubscriptionCreateResponse,
85
- WebhooksubscriptionDeleteParams,
86
- WebhooksubscriptionDeleteResponse,
87
- WebhooksubscriptionListParams,
88
- WebhooksubscriptionListResponse,
89
- WebhooksubscriptionPingParams,
90
- WebhooksubscriptionPingResponse,
91
- WebhooksubscriptionUpdateParams,
92
- WebhooksubscriptionUpdateResponse,
93
- } from './resources/webhooksubscription';
96
+ import { TransactionListParams, TransactionListResponse, Transactions } from './resources/transactions';
97
+ import { Data } from './resources/data/data';
98
+ import { Webhook, WebhookTriggerParams, WebhookTriggerResponse } from './resources/webhook/webhook';
94
99
 
95
100
  const environments = {
96
101
  production: 'https://api.getivy.de',
@@ -126,6 +131,8 @@ export interface ClientOptions {
126
131
  *
127
132
  * Note that request timeouts are retried by default, so in a worst-case scenario you may wait
128
133
  * much longer than this timeout before the promise succeeds or fails.
134
+ *
135
+ * @unit milliseconds
129
136
  */
130
137
  timeout?: number | undefined;
131
138
 
@@ -217,6 +224,7 @@ export class Ivy extends Core.APIClient {
217
224
 
218
225
  super({
219
226
  baseURL: options.baseURL || environments[options.environment || 'production'],
227
+ baseURLOverridden: baseURL ? baseURL !== environments[options.environment || 'production'] : false,
220
228
  timeout: options.timeout ?? 60000 /* 1 minute */,
221
229
  httpAgent: options.httpAgent,
222
230
  maxRetries: options.maxRetries,
@@ -230,17 +238,29 @@ export class Ivy extends Core.APIClient {
230
238
 
231
239
  banks: API.Banks = new API.Banks(this);
232
240
  checkoutsession: API.Checkoutsession = new API.Checkoutsession(this);
241
+ data: API.Data = new API.Data(this);
233
242
  customers: API.Customers = new API.Customers(this);
234
243
  orders: API.Orders = new API.Orders(this);
235
244
  charges: API.Charges = new API.Charges(this);
245
+ deposits: API.Deposits = new API.Deposits(this);
246
+ returns: API.Returns = new API.Returns(this);
247
+ fx: API.Fx = new API.Fx(this);
248
+ beneficiaryPayouts: API.BeneficiaryPayouts = new API.BeneficiaryPayouts(this);
249
+ transactions: API.Transactions = new API.Transactions(this);
236
250
  mandates: API.Mandates = new API.Mandates(this);
237
251
  capabilities: API.Capabilities = new API.Capabilities(this);
238
252
  refunds: API.Refunds = new API.Refunds(this);
239
253
  payouts: API.Payouts = new API.Payouts(this);
240
- reports: API.Reports = new API.Reports(this);
241
254
  subaccounts: API.Subaccounts = new API.Subaccounts(this);
242
255
  balance: API.Balance = new API.Balance(this);
243
- webhooksubscription: API.Webhooksubscription = new API.Webhooksubscription(this);
256
+ webhook: API.Webhook = new API.Webhook(this);
257
+
258
+ /**
259
+ * Check whether the base URL is set to its default.
260
+ */
261
+ #baseURLOverridden(): boolean {
262
+ return this.baseURL !== environments[this._options.environment || 'production'];
263
+ }
244
264
 
245
265
  protected override defaultQuery(): Core.DefaultQuery | undefined {
246
266
  return this._options.defaultQuery;
@@ -280,17 +300,23 @@ export class Ivy extends Core.APIClient {
280
300
 
281
301
  Ivy.Banks = Banks;
282
302
  Ivy.Checkoutsession = Checkoutsession;
303
+ Ivy.Data = Data;
283
304
  Ivy.Customers = Customers;
284
305
  Ivy.Orders = Orders;
285
306
  Ivy.Charges = Charges;
307
+ Ivy.Deposits = Deposits;
308
+ Ivy.Returns = Returns;
309
+ Ivy.Fx = Fx;
310
+ Ivy.BeneficiaryPayouts = BeneficiaryPayouts;
311
+ Ivy.Transactions = Transactions;
286
312
  Ivy.Mandates = Mandates;
287
313
  Ivy.Capabilities = Capabilities;
288
314
  Ivy.Refunds = Refunds;
289
315
  Ivy.Payouts = Payouts;
290
- Ivy.Reports = Reports;
291
316
  Ivy.Subaccounts = Subaccounts;
292
317
  Ivy.Balance = Balance;
293
- Ivy.Webhooksubscription = Webhooksubscription;
318
+ Ivy.Webhook = Webhook;
319
+
294
320
  export declare namespace Ivy {
295
321
  export type RequestOptions = Core.RequestOptions;
296
322
 
@@ -314,27 +340,67 @@ export declare namespace Ivy {
314
340
  type CheckoutsessionExpireParams as CheckoutsessionExpireParams,
315
341
  };
316
342
 
343
+ export { Data as Data };
344
+
317
345
  export {
318
346
  Customers as Customers,
319
347
  type CustomerCreateResponse as CustomerCreateResponse,
320
348
  type CustomerRetrieveResponse as CustomerRetrieveResponse,
349
+ type CustomerSearchResponse as CustomerSearchResponse,
321
350
  type CustomerCreateParams as CustomerCreateParams,
322
351
  type CustomerRetrieveParams as CustomerRetrieveParams,
352
+ type CustomerSearchParams as CustomerSearchParams,
323
353
  };
324
354
 
325
355
  export {
326
356
  Orders as Orders,
357
+ type OrderCreateResponse as OrderCreateResponse,
327
358
  type OrderRetrieveResponse as OrderRetrieveResponse,
328
- type OrderUpdateResponse as OrderUpdateResponse,
359
+ type OrderExpireResponse as OrderExpireResponse,
360
+ type OrderCreateParams as OrderCreateParams,
329
361
  type OrderRetrieveParams as OrderRetrieveParams,
330
- type OrderUpdateParams as OrderUpdateParams,
362
+ type OrderExpireParams as OrderExpireParams,
331
363
  };
332
364
 
333
365
  export { Charges as Charges, type Charge as Charge, type ChargeCreateParams as ChargeCreateParams };
334
366
 
367
+ export {
368
+ Deposits as Deposits,
369
+ type DepositRetrieveResponse as DepositRetrieveResponse,
370
+ type DepositRetrieveParams as DepositRetrieveParams,
371
+ };
372
+
373
+ export {
374
+ Returns as Returns,
375
+ type ReturnCreateResponse as ReturnCreateResponse,
376
+ type ReturnRetrieveResponse as ReturnRetrieveResponse,
377
+ type ReturnCreateParams as ReturnCreateParams,
378
+ type ReturnRetrieveParams as ReturnRetrieveParams,
379
+ };
380
+
381
+ export {
382
+ Fx as Fx,
383
+ type FxRetrieveResponse as FxRetrieveResponse,
384
+ type FxRetrieveRateResponse as FxRetrieveRateResponse,
385
+ type FxRetrieveParams as FxRetrieveParams,
386
+ type FxRetrieveRateParams as FxRetrieveRateParams,
387
+ };
388
+
389
+ export {
390
+ BeneficiaryPayouts as BeneficiaryPayouts,
391
+ type BeneficiaryPayoutCreateResponse as BeneficiaryPayoutCreateResponse,
392
+ };
393
+
394
+ export {
395
+ Transactions as Transactions,
396
+ type TransactionListResponse as TransactionListResponse,
397
+ type TransactionListParams as TransactionListParams,
398
+ };
399
+
335
400
  export {
336
401
  Mandates as Mandates,
337
- type MandateResponse as MandateResponse,
402
+ type Mandate as Mandate,
403
+ type MandateLookupResponse as MandateLookupResponse,
338
404
  type MandateRevokeResponse as MandateRevokeResponse,
339
405
  type MandateRetrieveParams as MandateRetrieveParams,
340
406
  type MandateLookupParams as MandateLookupParams,
@@ -349,34 +415,27 @@ export declare namespace Ivy {
349
415
 
350
416
  export {
351
417
  Refunds as Refunds,
352
- type RefundResponse as RefundResponse,
353
- type RefundBatchResponse as RefundBatchResponse,
418
+ type Refund as Refund,
419
+ type RefundCreateResponse as RefundCreateResponse,
420
+ type RefundRetrieveResponse as RefundRetrieveResponse,
354
421
  type RefundCreateParams as RefundCreateParams,
355
- type RefundBatchParams as RefundBatchParams,
422
+ type RefundRetrieveParams as RefundRetrieveParams,
356
423
  };
357
424
 
358
425
  export {
359
426
  Payouts as Payouts,
360
- type PublicUserPayout as PublicUserPayout,
427
+ type Payout as Payout,
428
+ type PayoutRetrieveResponse as PayoutRetrieveResponse,
361
429
  type PayoutListResponse as PayoutListResponse,
362
430
  type PayoutCreateParams as PayoutCreateParams,
363
431
  type PayoutRetrieveParams as PayoutRetrieveParams,
364
432
  type PayoutListParams as PayoutListParams,
365
433
  };
366
434
 
367
- export {
368
- Reports as Reports,
369
- type PayoutReport as PayoutReport,
370
- type ReportCreateResponse as ReportCreateResponse,
371
- type ReportRetrieveResponse as ReportRetrieveResponse,
372
- type ReportCreateParams as ReportCreateParams,
373
- type ReportRetrieveParams as ReportRetrieveParams,
374
- type ReportDownloadParams as ReportDownloadParams,
375
- };
376
-
377
435
  export {
378
436
  Subaccounts as Subaccounts,
379
437
  type Subaccount as Subaccount,
438
+ type SubaccountCreateResponse as SubaccountCreateResponse,
380
439
  type SubaccountCreateParams as SubaccountCreateParams,
381
440
  type SubaccountRetrieveParams as SubaccountRetrieveParams,
382
441
  };
@@ -388,17 +447,9 @@ export declare namespace Ivy {
388
447
  };
389
448
 
390
449
  export {
391
- Webhooksubscription as Webhooksubscription,
392
- type WebhooksubscriptionCreateResponse as WebhooksubscriptionCreateResponse,
393
- type WebhooksubscriptionUpdateResponse as WebhooksubscriptionUpdateResponse,
394
- type WebhooksubscriptionListResponse as WebhooksubscriptionListResponse,
395
- type WebhooksubscriptionDeleteResponse as WebhooksubscriptionDeleteResponse,
396
- type WebhooksubscriptionPingResponse as WebhooksubscriptionPingResponse,
397
- type WebhooksubscriptionCreateParams as WebhooksubscriptionCreateParams,
398
- type WebhooksubscriptionUpdateParams as WebhooksubscriptionUpdateParams,
399
- type WebhooksubscriptionListParams as WebhooksubscriptionListParams,
400
- type WebhooksubscriptionDeleteParams as WebhooksubscriptionDeleteParams,
401
- type WebhooksubscriptionPingParams as WebhooksubscriptionPingParams,
450
+ Webhook as Webhook,
451
+ type WebhookTriggerResponse as WebhookTriggerResponse,
452
+ type WebhookTriggerParams as WebhookTriggerParams,
402
453
  };
403
454
  }
404
455
 
package/src/resource.ts CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  import type { Ivy } from './index';
4
4
 
5
- export class APIResource {
5
+ export abstract class APIResource {
6
6
  protected _client: Ivy;
7
7
 
8
8
  constructor(client: Ivy) {
@@ -16,10 +16,10 @@ export class Balance extends APIResource {
16
16
  }
17
17
  }
18
18
 
19
- /**
20
- * Returns the Balance of your Ivy account
21
- */
22
19
  export interface BalanceRetrieveResponse {
20
+ /**
21
+ * Array of balance information for different currencies
22
+ */
23
23
  balances: Array<BalanceRetrieveResponse.Balance>;
24
24
  }
25
25
 
@@ -33,12 +33,15 @@ export namespace BalanceRetrieveResponse {
33
33
  /**
34
34
  * The currency of the balance
35
35
  */
36
- currency: 'EUR' | 'GBP' | 'PLN';
36
+ currency: 'EUR' | 'GBP' | 'PLN' | 'SEK' | 'DKK';
37
37
  }
38
38
  }
39
39
 
40
40
  export interface BalanceRetrieveParams {
41
- currency: 'EUR' | 'GBP' | 'PLN';
41
+ /**
42
+ * The currency to retrieve the balance for
43
+ */
44
+ currency: 'EUR' | 'GBP' | 'PLN' | 'SEK' | 'DKK';
42
45
  }
43
46
 
44
47
  export declare namespace Balance {