@getivy/node-sdk 0.1.0-alpha.2 → 0.1.0-alpha.3
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.
- package/CHANGELOG.md +8 -0
- package/LICENSE +1 -1
- package/README.md +17 -17
- package/core.js +9 -9
- package/core.js.map +1 -1
- package/core.mjs +10 -10
- package/core.mjs.map +1 -1
- package/error.d.ts +2 -2
- package/error.d.ts.map +1 -1
- package/error.js +4 -4
- package/error.js.map +1 -1
- package/error.mjs +2 -2
- package/error.mjs.map +1 -1
- package/index.d.mts +10 -10
- package/index.d.ts +10 -10
- package/index.d.ts.map +1 -1
- package/index.js +42 -42
- package/index.js.map +1 -1
- package/index.mjs +39 -39
- package/index.mjs.map +1 -1
- package/package.json +3 -3
- package/resource.d.ts +3 -3
- package/resource.d.ts.map +1 -1
- package/resource.js.map +1 -1
- package/resource.mjs.map +1 -1
- package/src/core.ts +10 -10
- package/src/error.ts +2 -2
- package/src/index.ts +27 -27
- package/src/resource.ts +3 -3
- package/src/version.ts +1 -1
- package/version.d.ts +1 -1
- package/version.js +1 -1
- package/version.mjs +1 -1
package/error.mjs
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
2
2
|
import { castToError } from "./core.mjs";
|
|
3
|
-
export class
|
|
3
|
+
export class IvyError extends Error {
|
|
4
4
|
}
|
|
5
|
-
export class APIError extends
|
|
5
|
+
export class APIError extends IvyError {
|
|
6
6
|
constructor(status, error, message, headers) {
|
|
7
7
|
super(`${APIError.makeMessage(status, error, message)}`);
|
|
8
8
|
this.status = status;
|
package/error.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"error.mjs","sourceRoot":"","sources":["src/error.ts"],"names":[],"mappings":"AAAA,sFAAsF;OAE/E,EAAE,WAAW,EAAW;AAE/B,MAAM,OAAO,
|
|
1
|
+
{"version":3,"file":"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AAC;IACvD,CAAC;CACF;AAED,MAAM,OAAO,iBAAkB,SAAQ,QAAyC;IAC9E,YAAY,EAAE,OAAO,KAA2B,EAAE;QAChD,KAAK,CAAC,SAAS,EAAE,SAAS,EAAE,OAAO,IAAI,sBAAsB,EAAE,SAAS,CAAC,CAAC;IAC5E,CAAC;CACF;AAED,MAAM,OAAO,kBAAmB,SAAQ,QAAyC;IAC/E,YAAY,EAAE,OAAO,EAAE,KAAK,EAA+D;QACzF,KAAK,CAAC,SAAS,EAAE,SAAS,EAAE,OAAO,IAAI,mBAAmB,EAAE,SAAS,CAAC,CAAC;QACvE,gEAAgE;QAChE,aAAa;QACb,IAAI,KAAK;YAAE,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;IAChC,CAAC;CACF;AAED,MAAM,OAAO,yBAA0B,SAAQ,kBAAkB;IAC/D,YAAY,EAAE,OAAO,KAA2B,EAAE;QAChD,KAAK,CAAC,EAAE,OAAO,EAAE,OAAO,IAAI,oBAAoB,EAAE,CAAC,CAAC;IACtD,CAAC;CACF;AAED,MAAM,OAAO,eAAgB,SAAQ,QAAsB;CAAG;AAE9D,MAAM,OAAO,mBAAoB,SAAQ,QAAsB;CAAG;AAElE,MAAM,OAAO,qBAAsB,SAAQ,QAAsB;CAAG;AAEpE,MAAM,OAAO,aAAc,SAAQ,QAAsB;CAAG;AAE5D,MAAM,OAAO,aAAc,SAAQ,QAAsB;CAAG;AAE5D,MAAM,OAAO,wBAAyB,SAAQ,QAAsB;CAAG;AAEvE,MAAM,OAAO,cAAe,SAAQ,QAAsB;CAAG;AAE7D,MAAM,OAAO,mBAAoB,SAAQ,QAAyB;CAAG"}
|
package/index.d.mts
CHANGED
|
@@ -36,7 +36,7 @@ export interface ClientOptions {
|
|
|
36
36
|
/**
|
|
37
37
|
* Override the default base URL for the API, e.g., "https://api.example.com/v2/"
|
|
38
38
|
*
|
|
39
|
-
* Defaults to process.env['
|
|
39
|
+
* Defaults to process.env['IVY_BASE_URL'].
|
|
40
40
|
*/
|
|
41
41
|
baseURL?: string | null | undefined;
|
|
42
42
|
/**
|
|
@@ -84,17 +84,17 @@ export interface ClientOptions {
|
|
|
84
84
|
defaultQuery?: Core.DefaultQuery | undefined;
|
|
85
85
|
}
|
|
86
86
|
/**
|
|
87
|
-
* API Client for interfacing with the
|
|
87
|
+
* API Client for interfacing with the Ivy API.
|
|
88
88
|
*/
|
|
89
|
-
export declare class
|
|
89
|
+
export declare class Ivy extends Core.APIClient {
|
|
90
90
|
apiKey: string;
|
|
91
91
|
private _options;
|
|
92
92
|
/**
|
|
93
|
-
* API Client for interfacing with the
|
|
93
|
+
* API Client for interfacing with the Ivy API.
|
|
94
94
|
*
|
|
95
95
|
* @param {string | undefined} [opts.apiKey=process.env['IVY_API_KEY'] ?? undefined]
|
|
96
96
|
* @param {Environment} [opts.environment=production] - Specifies the environment URL to use for the API.
|
|
97
|
-
* @param {string} [opts.baseURL=process.env['
|
|
97
|
+
* @param {string} [opts.baseURL=process.env['IVY_BASE_URL'] ?? https://api.getivy.de] - Override the default base URL for the API.
|
|
98
98
|
* @param {number} [opts.timeout=1 minute] - The maximum amount of time (in milliseconds) the client will wait for a response before timing out.
|
|
99
99
|
* @param {number} [opts.httpAgent] - An HTTP agent used to manage HTTP(s) connections.
|
|
100
100
|
* @param {Core.Fetch} [opts.fetch] - Specify a custom `fetch` function implementation.
|
|
@@ -118,9 +118,9 @@ export declare class Getivy extends Core.APIClient {
|
|
|
118
118
|
protected defaultQuery(): Core.DefaultQuery | undefined;
|
|
119
119
|
protected defaultHeaders(opts: Core.FinalRequestOptions): Core.Headers;
|
|
120
120
|
protected authHeaders(opts: Core.FinalRequestOptions): Core.Headers;
|
|
121
|
-
static
|
|
121
|
+
static Ivy: typeof Ivy;
|
|
122
122
|
static DEFAULT_TIMEOUT: number;
|
|
123
|
-
static
|
|
123
|
+
static IvyError: typeof Errors.IvyError;
|
|
124
124
|
static APIError: typeof Errors.APIError;
|
|
125
125
|
static APIConnectionError: typeof Errors.APIConnectionError;
|
|
126
126
|
static APIConnectionTimeoutError: typeof Errors.APIConnectionTimeoutError;
|
|
@@ -136,7 +136,7 @@ export declare class Getivy extends Core.APIClient {
|
|
|
136
136
|
static toFile: typeof Uploads.toFile;
|
|
137
137
|
static fileFromPath: typeof Uploads.fileFromPath;
|
|
138
138
|
}
|
|
139
|
-
export declare namespace
|
|
139
|
+
export declare namespace Ivy {
|
|
140
140
|
export type RequestOptions = Core.RequestOptions;
|
|
141
141
|
export { Banks as Banks, type BankRetrieveResponse as BankRetrieveResponse, type BankListResponse as BankListResponse, type BankSearchResponse as BankSearchResponse, type BankRetrieveParams as BankRetrieveParams, type BankListParams as BankListParams, type BankSearchParams as BankSearchParams, };
|
|
142
142
|
export { Checkoutsession as Checkoutsession, type CheckoutsessionCreateResponse as CheckoutsessionCreateResponse, type CheckoutsessionRetrieveResponse as CheckoutsessionRetrieveResponse, type CheckoutsessionExpireResponse as CheckoutsessionExpireResponse, type CheckoutsessionCreateParams as CheckoutsessionCreateParams, type CheckoutsessionRetrieveParams as CheckoutsessionRetrieveParams, type CheckoutsessionExpireParams as CheckoutsessionExpireParams, };
|
|
@@ -152,6 +152,6 @@ export declare namespace Getivy {
|
|
|
152
152
|
export { Balance as Balance, type BalanceRetrieveResponse as BalanceRetrieveResponse, type BalanceRetrieveParams as BalanceRetrieveParams, };
|
|
153
153
|
}
|
|
154
154
|
export { toFile, fileFromPath } from "./uploads.js";
|
|
155
|
-
export {
|
|
156
|
-
export default
|
|
155
|
+
export { IvyError, APIError, APIConnectionError, APIConnectionTimeoutError, APIUserAbortError, NotFoundError, ConflictError, RateLimitError, BadRequestError, AuthenticationError, InternalServerError, PermissionDeniedError, UnprocessableEntityError, } from "./error.js";
|
|
156
|
+
export default Ivy;
|
|
157
157
|
//# sourceMappingURL=index.d.ts.map
|
package/index.d.ts
CHANGED
|
@@ -36,7 +36,7 @@ export interface ClientOptions {
|
|
|
36
36
|
/**
|
|
37
37
|
* Override the default base URL for the API, e.g., "https://api.example.com/v2/"
|
|
38
38
|
*
|
|
39
|
-
* Defaults to process.env['
|
|
39
|
+
* Defaults to process.env['IVY_BASE_URL'].
|
|
40
40
|
*/
|
|
41
41
|
baseURL?: string | null | undefined;
|
|
42
42
|
/**
|
|
@@ -84,17 +84,17 @@ export interface ClientOptions {
|
|
|
84
84
|
defaultQuery?: Core.DefaultQuery | undefined;
|
|
85
85
|
}
|
|
86
86
|
/**
|
|
87
|
-
* API Client for interfacing with the
|
|
87
|
+
* API Client for interfacing with the Ivy API.
|
|
88
88
|
*/
|
|
89
|
-
export declare class
|
|
89
|
+
export declare class Ivy extends Core.APIClient {
|
|
90
90
|
apiKey: string;
|
|
91
91
|
private _options;
|
|
92
92
|
/**
|
|
93
|
-
* API Client for interfacing with the
|
|
93
|
+
* API Client for interfacing with the Ivy API.
|
|
94
94
|
*
|
|
95
95
|
* @param {string | undefined} [opts.apiKey=process.env['IVY_API_KEY'] ?? undefined]
|
|
96
96
|
* @param {Environment} [opts.environment=production] - Specifies the environment URL to use for the API.
|
|
97
|
-
* @param {string} [opts.baseURL=process.env['
|
|
97
|
+
* @param {string} [opts.baseURL=process.env['IVY_BASE_URL'] ?? https://api.getivy.de] - Override the default base URL for the API.
|
|
98
98
|
* @param {number} [opts.timeout=1 minute] - The maximum amount of time (in milliseconds) the client will wait for a response before timing out.
|
|
99
99
|
* @param {number} [opts.httpAgent] - An HTTP agent used to manage HTTP(s) connections.
|
|
100
100
|
* @param {Core.Fetch} [opts.fetch] - Specify a custom `fetch` function implementation.
|
|
@@ -118,9 +118,9 @@ export declare class Getivy extends Core.APIClient {
|
|
|
118
118
|
protected defaultQuery(): Core.DefaultQuery | undefined;
|
|
119
119
|
protected defaultHeaders(opts: Core.FinalRequestOptions): Core.Headers;
|
|
120
120
|
protected authHeaders(opts: Core.FinalRequestOptions): Core.Headers;
|
|
121
|
-
static
|
|
121
|
+
static Ivy: typeof Ivy;
|
|
122
122
|
static DEFAULT_TIMEOUT: number;
|
|
123
|
-
static
|
|
123
|
+
static IvyError: typeof Errors.IvyError;
|
|
124
124
|
static APIError: typeof Errors.APIError;
|
|
125
125
|
static APIConnectionError: typeof Errors.APIConnectionError;
|
|
126
126
|
static APIConnectionTimeoutError: typeof Errors.APIConnectionTimeoutError;
|
|
@@ -136,7 +136,7 @@ export declare class Getivy extends Core.APIClient {
|
|
|
136
136
|
static toFile: typeof Uploads.toFile;
|
|
137
137
|
static fileFromPath: typeof Uploads.fileFromPath;
|
|
138
138
|
}
|
|
139
|
-
export declare namespace
|
|
139
|
+
export declare namespace Ivy {
|
|
140
140
|
export type RequestOptions = Core.RequestOptions;
|
|
141
141
|
export { Banks as Banks, type BankRetrieveResponse as BankRetrieveResponse, type BankListResponse as BankListResponse, type BankSearchResponse as BankSearchResponse, type BankRetrieveParams as BankRetrieveParams, type BankListParams as BankListParams, type BankSearchParams as BankSearchParams, };
|
|
142
142
|
export { Checkoutsession as Checkoutsession, type CheckoutsessionCreateResponse as CheckoutsessionCreateResponse, type CheckoutsessionRetrieveResponse as CheckoutsessionRetrieveResponse, type CheckoutsessionExpireResponse as CheckoutsessionExpireResponse, type CheckoutsessionCreateParams as CheckoutsessionCreateParams, type CheckoutsessionRetrieveParams as CheckoutsessionRetrieveParams, type CheckoutsessionExpireParams as CheckoutsessionExpireParams, };
|
|
@@ -152,6 +152,6 @@ export declare namespace Getivy {
|
|
|
152
152
|
export { Balance as Balance, type BalanceRetrieveResponse as BalanceRetrieveResponse, type BalanceRetrieveParams as BalanceRetrieveParams, };
|
|
153
153
|
}
|
|
154
154
|
export { toFile, fileFromPath } from "./uploads.js";
|
|
155
|
-
export {
|
|
156
|
-
export default
|
|
155
|
+
export { IvyError, APIError, APIConnectionError, APIConnectionTimeoutError, APIUserAbortError, NotFoundError, ConflictError, RateLimitError, BadRequestError, AuthenticationError, InternalServerError, PermissionDeniedError, UnprocessableEntityError, } from "./error.js";
|
|
156
|
+
export default Ivy;
|
|
157
157
|
//# sourceMappingURL=index.d.ts.map
|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BAAqB,IAAI,qBAAqB,GACpD,CAAC;CACH;AAED,OAAO,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AACjD,OAAO,EACL,QAAQ,EACR,QAAQ,EACR,kBAAkB,EAClB,yBAAyB,EACzB,iBAAiB,EACjB,aAAa,EACb,aAAa,EACb,cAAc,EACd,eAAe,EACf,mBAAmB,EACnB,mBAAmB,EACnB,qBAAqB,EACrB,wBAAwB,GACzB,MAAM,SAAS,CAAC;AAEjB,eAAe,GAAG,CAAC"}
|
package/index.js
CHANGED
|
@@ -25,7 +25,7 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|
|
25
25
|
};
|
|
26
26
|
var _a;
|
|
27
27
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
28
|
-
exports.UnprocessableEntityError = exports.PermissionDeniedError = exports.InternalServerError = exports.AuthenticationError = exports.BadRequestError = exports.RateLimitError = exports.ConflictError = exports.NotFoundError = exports.APIUserAbortError = exports.APIConnectionTimeoutError = exports.APIConnectionError = exports.APIError = exports.
|
|
28
|
+
exports.UnprocessableEntityError = exports.PermissionDeniedError = exports.InternalServerError = exports.AuthenticationError = exports.BadRequestError = exports.RateLimitError = exports.ConflictError = exports.NotFoundError = exports.APIUserAbortError = exports.APIConnectionTimeoutError = exports.APIConnectionError = exports.APIError = exports.IvyError = exports.fileFromPath = exports.toFile = exports.Ivy = void 0;
|
|
29
29
|
const Core = __importStar(require("./core.js"));
|
|
30
30
|
const Errors = __importStar(require("./error.js"));
|
|
31
31
|
const Uploads = __importStar(require("./uploads.js"));
|
|
@@ -47,15 +47,15 @@ const environments = {
|
|
|
47
47
|
sandbox: 'https://api.sand.getivy.de',
|
|
48
48
|
};
|
|
49
49
|
/**
|
|
50
|
-
* API Client for interfacing with the
|
|
50
|
+
* API Client for interfacing with the Ivy API.
|
|
51
51
|
*/
|
|
52
|
-
class
|
|
52
|
+
class Ivy extends Core.APIClient {
|
|
53
53
|
/**
|
|
54
|
-
* API Client for interfacing with the
|
|
54
|
+
* API Client for interfacing with the Ivy API.
|
|
55
55
|
*
|
|
56
56
|
* @param {string | undefined} [opts.apiKey=process.env['IVY_API_KEY'] ?? undefined]
|
|
57
57
|
* @param {Environment} [opts.environment=production] - Specifies the environment URL to use for the API.
|
|
58
|
-
* @param {string} [opts.baseURL=process.env['
|
|
58
|
+
* @param {string} [opts.baseURL=process.env['IVY_BASE_URL'] ?? https://api.getivy.de] - Override the default base URL for the API.
|
|
59
59
|
* @param {number} [opts.timeout=1 minute] - The maximum amount of time (in milliseconds) the client will wait for a response before timing out.
|
|
60
60
|
* @param {number} [opts.httpAgent] - An HTTP agent used to manage HTTP(s) connections.
|
|
61
61
|
* @param {Core.Fetch} [opts.fetch] - Specify a custom `fetch` function implementation.
|
|
@@ -63,9 +63,9 @@ class Getivy extends Core.APIClient {
|
|
|
63
63
|
* @param {Core.Headers} opts.defaultHeaders - Default headers to include with every request to the API.
|
|
64
64
|
* @param {Core.DefaultQuery} opts.defaultQuery - Default query parameters to include with every request to the API.
|
|
65
65
|
*/
|
|
66
|
-
constructor({ baseURL = Core.readEnv('
|
|
66
|
+
constructor({ baseURL = Core.readEnv('IVY_BASE_URL'), apiKey = Core.readEnv('IVY_API_KEY'), ...opts } = {}) {
|
|
67
67
|
if (apiKey === undefined) {
|
|
68
|
-
throw new Errors.
|
|
68
|
+
throw new Errors.IvyError("The IVY_API_KEY environment variable is missing or empty; either provide it, or instantiate the Ivy client with an apiKey option, like new Ivy({ apiKey: 'My API Key' }).");
|
|
69
69
|
}
|
|
70
70
|
const options = {
|
|
71
71
|
apiKey,
|
|
@@ -74,7 +74,7 @@ class Getivy extends Core.APIClient {
|
|
|
74
74
|
environment: opts.environment ?? 'production',
|
|
75
75
|
};
|
|
76
76
|
if (baseURL && opts.environment) {
|
|
77
|
-
throw new Errors.
|
|
77
|
+
throw new Errors.IvyError('Ambiguous URL; The `baseURL` option (or IVY_BASE_URL env var) and the `environment` option are given. If you want to use the environment you must pass baseURL: null');
|
|
78
78
|
}
|
|
79
79
|
super({
|
|
80
80
|
baseURL: options.baseURL || environments[options.environment || 'production'],
|
|
@@ -111,42 +111,42 @@ class Getivy extends Core.APIClient {
|
|
|
111
111
|
return { 'X-Ivy-Api-Key': this.apiKey };
|
|
112
112
|
}
|
|
113
113
|
}
|
|
114
|
-
exports.
|
|
115
|
-
_a =
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
114
|
+
exports.Ivy = Ivy;
|
|
115
|
+
_a = Ivy;
|
|
116
|
+
Ivy.Ivy = _a;
|
|
117
|
+
Ivy.DEFAULT_TIMEOUT = 60000; // 1 minute
|
|
118
|
+
Ivy.IvyError = Errors.IvyError;
|
|
119
|
+
Ivy.APIError = Errors.APIError;
|
|
120
|
+
Ivy.APIConnectionError = Errors.APIConnectionError;
|
|
121
|
+
Ivy.APIConnectionTimeoutError = Errors.APIConnectionTimeoutError;
|
|
122
|
+
Ivy.APIUserAbortError = Errors.APIUserAbortError;
|
|
123
|
+
Ivy.NotFoundError = Errors.NotFoundError;
|
|
124
|
+
Ivy.ConflictError = Errors.ConflictError;
|
|
125
|
+
Ivy.RateLimitError = Errors.RateLimitError;
|
|
126
|
+
Ivy.BadRequestError = Errors.BadRequestError;
|
|
127
|
+
Ivy.AuthenticationError = Errors.AuthenticationError;
|
|
128
|
+
Ivy.InternalServerError = Errors.InternalServerError;
|
|
129
|
+
Ivy.PermissionDeniedError = Errors.PermissionDeniedError;
|
|
130
|
+
Ivy.UnprocessableEntityError = Errors.UnprocessableEntityError;
|
|
131
|
+
Ivy.toFile = Uploads.toFile;
|
|
132
|
+
Ivy.fileFromPath = Uploads.fileFromPath;
|
|
133
|
+
Ivy.Banks = banks_1.Banks;
|
|
134
|
+
Ivy.Checkoutsession = checkoutsession_1.Checkoutsession;
|
|
135
|
+
Ivy.Customers = customers_1.Customers;
|
|
136
|
+
Ivy.Orders = orders_1.Orders;
|
|
137
|
+
Ivy.Charges = charges_1.Charges;
|
|
138
|
+
Ivy.Mandates = mandates_1.Mandates;
|
|
139
|
+
Ivy.Capabilities = capabilities_1.Capabilities;
|
|
140
|
+
Ivy.Refunds = refunds_1.Refunds;
|
|
141
|
+
Ivy.Payouts = payouts_1.Payouts;
|
|
142
|
+
Ivy.Reports = reports_1.Reports;
|
|
143
|
+
Ivy.Subaccounts = subaccounts_1.Subaccounts;
|
|
144
|
+
Ivy.Balance = balance_1.Balance;
|
|
145
145
|
var uploads_1 = require("./uploads.js");
|
|
146
146
|
Object.defineProperty(exports, "toFile", { enumerable: true, get: function () { return uploads_1.toFile; } });
|
|
147
147
|
Object.defineProperty(exports, "fileFromPath", { enumerable: true, get: function () { return uploads_1.fileFromPath; } });
|
|
148
148
|
var error_1 = require("./error.js");
|
|
149
|
-
Object.defineProperty(exports, "
|
|
149
|
+
Object.defineProperty(exports, "IvyError", { enumerable: true, get: function () { return error_1.IvyError; } });
|
|
150
150
|
Object.defineProperty(exports, "APIError", { enumerable: true, get: function () { return error_1.APIError; } });
|
|
151
151
|
Object.defineProperty(exports, "APIConnectionError", { enumerable: true, get: function () { return error_1.APIConnectionError; } });
|
|
152
152
|
Object.defineProperty(exports, "APIConnectionTimeoutError", { enumerable: true, get: function () { return error_1.APIConnectionTimeoutError; } });
|
|
@@ -159,6 +159,6 @@ Object.defineProperty(exports, "AuthenticationError", { enumerable: true, get: f
|
|
|
159
159
|
Object.defineProperty(exports, "InternalServerError", { enumerable: true, get: function () { return error_1.InternalServerError; } });
|
|
160
160
|
Object.defineProperty(exports, "PermissionDeniedError", { enumerable: true, get: function () { return error_1.PermissionDeniedError; } });
|
|
161
161
|
Object.defineProperty(exports, "UnprocessableEntityError", { enumerable: true, get: function () { return error_1.UnprocessableEntityError; } });
|
|
162
|
-
exports = module.exports =
|
|
163
|
-
exports.default =
|
|
162
|
+
exports = module.exports = Ivy;
|
|
163
|
+
exports.default = Ivy;
|
|
164
164
|
//# sourceMappingURL=index.js.map
|
package/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["src/index.ts"],"names":[],"mappings":";AAAA,sFAAsF;;;;;;;;;;;;;;;;;;;;;;;;;;;AAGtF,gDAA+B;AAC/B,mDAAkC;AAClC,sDAAqC;AACrC,0DAAyC;AACzC,oDAA8F;AAC9F,gDAQ2B;AAC3B,8DAA8G;AAC9G,oDAA0E;AAC1E,oEAQqC;AACrC,wDAM+B;AAC/B,sDAO8B;AAC9B,kDAM4B;AAC5B,oDAO6B;AAC7B,oDAM6B;AAC7B,oDAQ6B;AAC7B,4DAKiC;AAEjC,MAAM,YAAY,GAAG;IACnB,UAAU,EAAE,uBAAuB;IACnC,OAAO,EAAE,4BAA4B;CACtC,CAAC;AA2EF;;GAEG;AACH,MAAa,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["src/index.ts"],"names":[],"mappings":";AAAA,sFAAsF;;;;;;;;;;;;;;;;;;;;;;;;;;;AAGtF,gDAA+B;AAC/B,mDAAkC;AAClC,sDAAqC;AACrC,0DAAyC;AACzC,oDAA8F;AAC9F,gDAQ2B;AAC3B,8DAA8G;AAC9G,oDAA0E;AAC1E,oEAQqC;AACrC,wDAM+B;AAC/B,sDAO8B;AAC9B,kDAM4B;AAC5B,oDAO6B;AAC7B,oDAM6B;AAC7B,oDAQ6B;AAC7B,4DAKiC;AAEjC,MAAM,YAAY,GAAG;IACnB,UAAU,EAAE,uBAAuB;IACnC,OAAO,EAAE,4BAA4B;CACtC,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A;AACb,uGAAA,cAAc,OAAA;AACd,wGAAA,eAAe,OAAA;AACf,4GAAA,mBAAmB,OAAA;AACnB,4GAAA,mBAAmB,OAAA;AACnB,8GAAA,qBAAqB,OAAA;AACrB,iHAAA,wBAAwB,OAAA;AAG1B,kBAAe,GAAG,CAAC"}
|
package/index.mjs
CHANGED
|
@@ -21,15 +21,15 @@ const environments = {
|
|
|
21
21
|
sandbox: 'https://api.sand.getivy.de',
|
|
22
22
|
};
|
|
23
23
|
/**
|
|
24
|
-
* API Client for interfacing with the
|
|
24
|
+
* API Client for interfacing with the Ivy API.
|
|
25
25
|
*/
|
|
26
|
-
export class
|
|
26
|
+
export class Ivy extends Core.APIClient {
|
|
27
27
|
/**
|
|
28
|
-
* API Client for interfacing with the
|
|
28
|
+
* API Client for interfacing with the Ivy API.
|
|
29
29
|
*
|
|
30
30
|
* @param {string | undefined} [opts.apiKey=process.env['IVY_API_KEY'] ?? undefined]
|
|
31
31
|
* @param {Environment} [opts.environment=production] - Specifies the environment URL to use for the API.
|
|
32
|
-
* @param {string} [opts.baseURL=process.env['
|
|
32
|
+
* @param {string} [opts.baseURL=process.env['IVY_BASE_URL'] ?? https://api.getivy.de] - Override the default base URL for the API.
|
|
33
33
|
* @param {number} [opts.timeout=1 minute] - The maximum amount of time (in milliseconds) the client will wait for a response before timing out.
|
|
34
34
|
* @param {number} [opts.httpAgent] - An HTTP agent used to manage HTTP(s) connections.
|
|
35
35
|
* @param {Core.Fetch} [opts.fetch] - Specify a custom `fetch` function implementation.
|
|
@@ -37,9 +37,9 @@ export class Getivy extends Core.APIClient {
|
|
|
37
37
|
* @param {Core.Headers} opts.defaultHeaders - Default headers to include with every request to the API.
|
|
38
38
|
* @param {Core.DefaultQuery} opts.defaultQuery - Default query parameters to include with every request to the API.
|
|
39
39
|
*/
|
|
40
|
-
constructor({ baseURL = Core.readEnv('
|
|
40
|
+
constructor({ baseURL = Core.readEnv('IVY_BASE_URL'), apiKey = Core.readEnv('IVY_API_KEY'), ...opts } = {}) {
|
|
41
41
|
if (apiKey === undefined) {
|
|
42
|
-
throw new Errors.
|
|
42
|
+
throw new Errors.IvyError("The IVY_API_KEY environment variable is missing or empty; either provide it, or instantiate the Ivy client with an apiKey option, like new Ivy({ apiKey: 'My API Key' }).");
|
|
43
43
|
}
|
|
44
44
|
const options = {
|
|
45
45
|
apiKey,
|
|
@@ -48,7 +48,7 @@ export class Getivy extends Core.APIClient {
|
|
|
48
48
|
environment: opts.environment ?? 'production',
|
|
49
49
|
};
|
|
50
50
|
if (baseURL && opts.environment) {
|
|
51
|
-
throw new Errors.
|
|
51
|
+
throw new Errors.IvyError('Ambiguous URL; The `baseURL` option (or IVY_BASE_URL env var) and the `environment` option are given. If you want to use the environment you must pass baseURL: null');
|
|
52
52
|
}
|
|
53
53
|
super({
|
|
54
54
|
baseURL: options.baseURL || environments[options.environment || 'production'],
|
|
@@ -85,37 +85,37 @@ export class Getivy extends Core.APIClient {
|
|
|
85
85
|
return { 'X-Ivy-Api-Key': this.apiKey };
|
|
86
86
|
}
|
|
87
87
|
}
|
|
88
|
-
_a =
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
88
|
+
_a = Ivy;
|
|
89
|
+
Ivy.Ivy = _a;
|
|
90
|
+
Ivy.DEFAULT_TIMEOUT = 60000; // 1 minute
|
|
91
|
+
Ivy.IvyError = Errors.IvyError;
|
|
92
|
+
Ivy.APIError = Errors.APIError;
|
|
93
|
+
Ivy.APIConnectionError = Errors.APIConnectionError;
|
|
94
|
+
Ivy.APIConnectionTimeoutError = Errors.APIConnectionTimeoutError;
|
|
95
|
+
Ivy.APIUserAbortError = Errors.APIUserAbortError;
|
|
96
|
+
Ivy.NotFoundError = Errors.NotFoundError;
|
|
97
|
+
Ivy.ConflictError = Errors.ConflictError;
|
|
98
|
+
Ivy.RateLimitError = Errors.RateLimitError;
|
|
99
|
+
Ivy.BadRequestError = Errors.BadRequestError;
|
|
100
|
+
Ivy.AuthenticationError = Errors.AuthenticationError;
|
|
101
|
+
Ivy.InternalServerError = Errors.InternalServerError;
|
|
102
|
+
Ivy.PermissionDeniedError = Errors.PermissionDeniedError;
|
|
103
|
+
Ivy.UnprocessableEntityError = Errors.UnprocessableEntityError;
|
|
104
|
+
Ivy.toFile = Uploads.toFile;
|
|
105
|
+
Ivy.fileFromPath = Uploads.fileFromPath;
|
|
106
|
+
Ivy.Banks = Banks;
|
|
107
|
+
Ivy.Checkoutsession = Checkoutsession;
|
|
108
|
+
Ivy.Customers = Customers;
|
|
109
|
+
Ivy.Orders = Orders;
|
|
110
|
+
Ivy.Charges = Charges;
|
|
111
|
+
Ivy.Mandates = Mandates;
|
|
112
|
+
Ivy.Capabilities = Capabilities;
|
|
113
|
+
Ivy.Refunds = Refunds;
|
|
114
|
+
Ivy.Payouts = Payouts;
|
|
115
|
+
Ivy.Reports = Reports;
|
|
116
|
+
Ivy.Subaccounts = Subaccounts;
|
|
117
|
+
Ivy.Balance = Balance;
|
|
118
118
|
export { toFile, fileFromPath } from "./uploads.mjs";
|
|
119
|
-
export {
|
|
120
|
-
export default
|
|
119
|
+
export { IvyError, APIError, APIConnectionError, APIConnectionTimeoutError, APIUserAbortError, NotFoundError, ConflictError, RateLimitError, BadRequestError, AuthenticationError, InternalServerError, PermissionDeniedError, UnprocessableEntityError, } from "./error.mjs";
|
|
120
|
+
export default Ivy;
|
|
121
121
|
//# sourceMappingURL=index.mjs.map
|
package/index.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.mjs","sourceRoot":"","sources":["src/index.ts"],"names":[],"mappings":"AAAA,sFAAsF;;OAG/E,KAAK,IAAI;OACT,KAAK,MAAM;OACX,KAAK,OAAO;OACZ,KAAK,GAAG;OACR,EAAE,OAAO,EAAkD;OAC3D,EAOL,KAAK,GACN;OACM,EAAE,YAAY,EAAwD;OACtE,EAA8B,OAAO,EAAE;OACvC,EACL,eAAe,GAOhB;OACM,EAKL,SAAS,GACV;OACM,EAML,QAAQ,GACT;OACM,EAKL,MAAM,GACP;OACM,EAKL,OAAO,GAER;OACM,EAKL,OAAO,GACR;OACM,EAOL,OAAO,GACR;OACM,EAIL,WAAW,GACZ;AAED,MAAM,YAAY,GAAG;IACnB,UAAU,EAAE,uBAAuB;IACnC,OAAO,EAAE,4BAA4B;CACtC,CAAC;AA2EF;;GAEG;AACH,MAAM,OAAO,
|
|
1
|
+
{"version":3,"file":"index.mjs","sourceRoot":"","sources":["src/index.ts"],"names":[],"mappings":"AAAA,sFAAsF;;OAG/E,KAAK,IAAI;OACT,KAAK,MAAM;OACX,KAAK,OAAO;OACZ,KAAK,GAAG;OACR,EAAE,OAAO,EAAkD;OAC3D,EAOL,KAAK,GACN;OACM,EAAE,YAAY,EAAwD;OACtE,EAA8B,OAAO,EAAE;OACvC,EACL,eAAe,GAOhB;OACM,EAKL,SAAS,GACV;OACM,EAML,QAAQ,GACT;OACM,EAKL,MAAM,GACP;OACM,EAKL,OAAO,GAER;OACM,EAKL,OAAO,GACR;OACM,EAOL,OAAO,GACR;OACM,EAIL,WAAW,GACZ;AAED,MAAM,YAAY,GAAG;IACnB,UAAU,EAAE,uBAAuB;IACnC,OAAO,EAAE,4BAA4B;CACtC,CAAC;AA2EF;;GAEG;AACH,MAAM,OAAO,GAAI,SAAQ,IAAI,CAAC,SAAS;IAKrC;;;;;;;;;;;;OAYG;IACH,YAAY,EACV,OAAO,GAAG,IAAI,CAAC,OAAO,CAAC,cAAc,CAAC,EACtC,MAAM,G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,GAAG,MAAM,CAAC,mBAAmB,CAAC;AACjD,uBAAmB,GAAG,MAAM,CAAC,mBAAmB,CAAC;AACjD,yBAAqB,GAAG,MAAM,CAAC,qBAAqB,CAAC;AACrD,4BAAwB,GAAG,MAAM,CAAC,wBAAwB,CAAC;AAE3D,UAAM,GAAG,OAAO,CAAC,MAAM,CAAC;AACxB,gBAAY,GAAG,OAAO,CAAC,YAAY,CAAC;AAG7C,GAAG,CAAC,KAAK,GAAG,KAAK,CAAC;AAClB,GAAG,CAAC,eAAe,GAAG,eAAe,CAAC;AACtC,GAAG,CAAC,SAAS,GAAG,SAAS,CAAC;AAC1B,GAAG,CAAC,MAAM,GAAG,MAAM,CAAC;AACpB,GAAG,CAAC,OAAO,GAAG,OAAO,CAAC;AACtB,GAAG,CAAC,QAAQ,GAAG,QAAQ,CAAC;AACxB,GAAG,CAAC,YAAY,GAAG,YAAY,CAAC;AAChC,GAAG,CAAC,OAAO,GAAG,OAAO,CAAC;AACtB,GAAG,CAAC,OAAO,GAAG,OAAO,CAAC;AACtB,GAAG,CAAC,OAAO,GAAG,OAAO,CAAC;AACtB,GAAG,CAAC,WAAW,GAAG,WAAW,CAAC;AAC9B,GAAG,CAAC,OAAO,GAAG,OAAO,CAAC;OAkGf,EAAE,MAAM,EAAE,YAAY,EAAE;OACxB,EACL,QAAQ,EACR,QAAQ,EACR,kBAAkB,EAClB,yBAAyB,EACzB,iBAAiB,EACjB,aAAa,EACb,aAAa,EACb,cAAc,EACd,eAAe,EACf,mBAAmB,EACnB,mBAAmB,EACnB,qBAAqB,EACrB,wBAAwB,GACzB;AAED,eAAe,GAAG,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@getivy/node-sdk",
|
|
3
|
-
"version": "0.1.0-alpha.
|
|
4
|
-
"description": "The official TypeScript library for the
|
|
5
|
-
"author": "
|
|
3
|
+
"version": "0.1.0-alpha.3",
|
|
4
|
+
"description": "The official TypeScript library for the Ivy API",
|
|
5
|
+
"author": "Ivy <developer@getivy.de>",
|
|
6
6
|
"types": "./index.d.ts",
|
|
7
7
|
"main": "./index.js",
|
|
8
8
|
"type": "commonjs",
|
package/resource.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { Ivy } from "./index.js";
|
|
2
2
|
export declare class APIResource {
|
|
3
|
-
protected _client:
|
|
4
|
-
constructor(client:
|
|
3
|
+
protected _client: Ivy;
|
|
4
|
+
constructor(client: Ivy);
|
|
5
5
|
}
|
|
6
6
|
//# sourceMappingURL=resource.d.ts.map
|
package/resource.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"resource.d.ts","sourceRoot":"","sources":["src/resource.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"resource.d.ts","sourceRoot":"","sources":["src/resource.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,SAAS,CAAC;AAEnC,qBAAa,WAAW;IACtB,SAAS,CAAC,OAAO,EAAE,GAAG,CAAC;gBAEX,MAAM,EAAE,GAAG;CAGxB"}
|
package/resource.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"resource.js","sourceRoot":"","sources":["src/resource.ts"],"names":[],"mappings":";AAAA,sFAAsF;;;AAItF,MAAa,WAAW;IAGtB,YAAY,
|
|
1
|
+
{"version":3,"file":"resource.js","sourceRoot":"","sources":["src/resource.ts"],"names":[],"mappings":";AAAA,sFAAsF;;;AAItF,MAAa,WAAW;IAGtB,YAAY,MAAW;QACrB,IAAI,CAAC,OAAO,GAAG,MAAM,CAAC;IACxB,CAAC;CACF;AAND,kCAMC"}
|
package/resource.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"resource.mjs","sourceRoot":"","sources":["src/resource.ts"],"names":[],"mappings":"AAAA,sFAAsF;AAItF,MAAM,OAAO,WAAW;IAGtB,YAAY,
|
|
1
|
+
{"version":3,"file":"resource.mjs","sourceRoot":"","sources":["src/resource.ts"],"names":[],"mappings":"AAAA,sFAAsF;AAItF,MAAM,OAAO,WAAW;IAGtB,YAAY,MAAW;QACrB,IAAI,CAAC,OAAO,GAAG,MAAM,CAAC;IACxB,CAAC;CACF"}
|
package/src/core.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { VERSION } from './version';
|
|
2
2
|
import {
|
|
3
|
-
|
|
3
|
+
IvyError,
|
|
4
4
|
APIError,
|
|
5
5
|
APIConnectionError,
|
|
6
6
|
APIConnectionTimeoutError,
|
|
@@ -504,7 +504,7 @@ export abstract class APIClient {
|
|
|
504
504
|
if (value === null) {
|
|
505
505
|
return `${encodeURIComponent(key)}=`;
|
|
506
506
|
}
|
|
507
|
-
throw new
|
|
507
|
+
throw new IvyError(
|
|
508
508
|
`Cannot stringify type ${typeof value}; Expected string, number, boolean, or null. If you need to pass nested query parameters, you can manually encode them, e.g. { query: { 'foo[key1]': value1, 'foo[key2]': value2 } }, and please open a GitHub issue requesting better support for your use case.`,
|
|
509
509
|
);
|
|
510
510
|
})
|
|
@@ -654,7 +654,7 @@ export abstract class AbstractPage<Item> implements AsyncIterable<Item> {
|
|
|
654
654
|
async getNextPage(): Promise<this> {
|
|
655
655
|
const nextInfo = this.nextPageInfo();
|
|
656
656
|
if (!nextInfo) {
|
|
657
|
-
throw new
|
|
657
|
+
throw new IvyError(
|
|
658
658
|
'No next page expected; please check `.hasNextPage()` before calling `.getNextPage()`.',
|
|
659
659
|
);
|
|
660
660
|
}
|
|
@@ -990,10 +990,10 @@ export const sleep = (ms: number) => new Promise((resolve) => setTimeout(resolve
|
|
|
990
990
|
|
|
991
991
|
const validatePositiveInteger = (name: string, n: unknown): number => {
|
|
992
992
|
if (typeof n !== 'number' || !Number.isInteger(n)) {
|
|
993
|
-
throw new
|
|
993
|
+
throw new IvyError(`${name} must be an integer`);
|
|
994
994
|
}
|
|
995
995
|
if (n < 0) {
|
|
996
|
-
throw new
|
|
996
|
+
throw new IvyError(`${name} must be a positive integer`);
|
|
997
997
|
}
|
|
998
998
|
return n;
|
|
999
999
|
};
|
|
@@ -1009,7 +1009,7 @@ export const castToError = (err: any): Error => {
|
|
|
1009
1009
|
};
|
|
1010
1010
|
|
|
1011
1011
|
export const ensurePresent = <T>(value: T | null | undefined): T => {
|
|
1012
|
-
if (value == null) throw new
|
|
1012
|
+
if (value == null) throw new IvyError(`Expected a value to be given but received ${value} instead.`);
|
|
1013
1013
|
return value;
|
|
1014
1014
|
};
|
|
1015
1015
|
|
|
@@ -1034,14 +1034,14 @@ export const coerceInteger = (value: unknown): number => {
|
|
|
1034
1034
|
if (typeof value === 'number') return Math.round(value);
|
|
1035
1035
|
if (typeof value === 'string') return parseInt(value, 10);
|
|
1036
1036
|
|
|
1037
|
-
throw new
|
|
1037
|
+
throw new IvyError(`Could not coerce ${value} (type: ${typeof value}) into a number`);
|
|
1038
1038
|
};
|
|
1039
1039
|
|
|
1040
1040
|
export const coerceFloat = (value: unknown): number => {
|
|
1041
1041
|
if (typeof value === 'number') return value;
|
|
1042
1042
|
if (typeof value === 'string') return parseFloat(value);
|
|
1043
1043
|
|
|
1044
|
-
throw new
|
|
1044
|
+
throw new IvyError(`Could not coerce ${value} (type: ${typeof value}) into a number`);
|
|
1045
1045
|
};
|
|
1046
1046
|
|
|
1047
1047
|
export const coerceBoolean = (value: unknown): boolean => {
|
|
@@ -1107,7 +1107,7 @@ function applyHeadersMut(targetHeaders: Headers, newHeaders: Headers): void {
|
|
|
1107
1107
|
|
|
1108
1108
|
export function debug(action: string, ...args: any[]) {
|
|
1109
1109
|
if (typeof process !== 'undefined' && process?.env?.['DEBUG'] === 'true') {
|
|
1110
|
-
console.log(`
|
|
1110
|
+
console.log(`Ivy:DEBUG:${action}`, ...args);
|
|
1111
1111
|
}
|
|
1112
1112
|
}
|
|
1113
1113
|
|
|
@@ -1192,7 +1192,7 @@ export const toBase64 = (str: string | null | undefined): string => {
|
|
|
1192
1192
|
return btoa(str);
|
|
1193
1193
|
}
|
|
1194
1194
|
|
|
1195
|
-
throw new
|
|
1195
|
+
throw new IvyError('Cannot generate b64 string; Expected `Buffer` or `btoa` to be defined');
|
|
1196
1196
|
};
|
|
1197
1197
|
|
|
1198
1198
|
export function isObj(obj: unknown): obj is Record<string, unknown> {
|
package/src/error.ts
CHANGED
|
@@ -2,13 +2,13 @@
|
|
|
2
2
|
|
|
3
3
|
import { castToError, Headers } from './core';
|
|
4
4
|
|
|
5
|
-
export class
|
|
5
|
+
export class IvyError extends Error {}
|
|
6
6
|
|
|
7
7
|
export class APIError<
|
|
8
8
|
TStatus extends number | undefined = number | undefined,
|
|
9
9
|
THeaders extends Headers | undefined = Headers | undefined,
|
|
10
10
|
TError extends Object | undefined = Object | undefined,
|
|
11
|
-
> extends
|
|
11
|
+
> extends IvyError {
|
|
12
12
|
/** HTTP status for the response that caused the error */
|
|
13
13
|
readonly status: TStatus;
|
|
14
14
|
/** HTTP headers for the response that caused the error */
|