@paid-ai/paid-node 0.0.5 → 0.0.7
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/README.md +8 -8
- package/dist/cjs/Client.d.ts +6 -6
- package/dist/cjs/Client.js +7 -7
- package/dist/cjs/api/resources/agents/client/Client.d.ts +11 -11
- package/dist/cjs/api/resources/agents/client/Client.js +43 -43
- package/dist/cjs/api/resources/contacts/client/Client.d.ts +7 -7
- package/dist/cjs/api/resources/contacts/client/Client.js +31 -31
- package/dist/cjs/api/resources/contacts/client/requests/ContactCreate.d.ts +2 -2
- package/dist/cjs/api/resources/customers/client/Client.d.ts +11 -11
- package/dist/cjs/api/resources/customers/client/Client.js +43 -43
- package/dist/cjs/api/resources/customers/client/requests/CustomerCreate.d.ts +4 -4
- package/dist/cjs/api/resources/orders/client/Client.d.ts +7 -7
- package/dist/cjs/api/resources/orders/client/Client.js +26 -26
- package/dist/cjs/api/resources/orders/client/requests/OrderCreate.d.ts +2 -2
- package/dist/cjs/api/resources/orders/resources/lines/client/Client.d.ts +4 -4
- package/dist/cjs/api/resources/orders/resources/lines/client/Client.js +6 -6
- package/dist/cjs/api/resources/orders/resources/lines/client/requests/LinesUpdateRequest.d.ts +2 -2
- package/dist/cjs/api/resources/usage/client/Client.d.ts +4 -4
- package/dist/cjs/api/resources/usage/client/Client.js +6 -6
- package/dist/cjs/api/resources/usage/client/requests/UsageRecordBulkRequest.d.ts +2 -2
- package/dist/cjs/api/types/Agent.d.ts +2 -2
- package/dist/cjs/api/types/AgentAttribute.d.ts +2 -2
- package/dist/cjs/api/types/AgentPricePoint.d.ts +2 -2
- package/dist/cjs/api/types/AgentUpdate.d.ts +2 -2
- package/dist/cjs/api/types/Contact.d.ts +2 -2
- package/dist/cjs/api/types/Customer.d.ts +5 -5
- package/dist/cjs/api/types/CustomerUpdate.d.ts +4 -4
- package/dist/cjs/api/types/Error_.d.ts +2 -2
- package/dist/cjs/api/types/Order.d.ts +4 -4
- package/dist/cjs/api/types/OrderLine.d.ts +4 -4
- package/dist/cjs/api/types/OrderLineAttribute.d.ts +2 -2
- package/dist/cjs/api/types/OrderLineAttributePricing.d.ts +5 -5
- package/dist/cjs/api/types/PricePoint.d.ts +2 -2
- package/dist/cjs/api/types/Pricing.d.ts +5 -5
- package/dist/cjs/environments.d.ts +2 -2
- package/dist/cjs/environments.js +2 -2
- package/dist/cjs/errors/{PaidApiError.d.ts → PaidError.d.ts} +1 -1
- package/dist/cjs/errors/{PaidApiError.js → PaidError.js} +4 -4
- package/dist/{esm/errors/PaidApiTimeoutError.d.mts → cjs/errors/PaidTimeoutError.d.ts} +1 -1
- package/dist/cjs/errors/{PaidApiTimeoutError.js → PaidTimeoutError.js} +4 -4
- package/dist/cjs/errors/index.d.ts +2 -2
- package/dist/cjs/errors/index.js +5 -5
- package/dist/cjs/index.d.ts +4 -4
- package/dist/cjs/index.js +6 -6
- package/dist/cjs/version.d.ts +1 -1
- package/dist/cjs/version.js +1 -1
- package/dist/cjs/wrapper/BatchUsage.d.ts +6 -0
- package/dist/cjs/wrapper/BatchUsage.js +24 -0
- package/dist/esm/Client.d.mts +6 -6
- package/dist/esm/Client.mjs +4 -4
- package/dist/esm/api/resources/agents/client/Client.d.mts +11 -11
- package/dist/esm/api/resources/agents/client/Client.mjs +43 -43
- package/dist/esm/api/resources/contacts/client/Client.d.mts +7 -7
- package/dist/esm/api/resources/contacts/client/Client.mjs +31 -31
- package/dist/esm/api/resources/contacts/client/requests/ContactCreate.d.mts +2 -2
- package/dist/esm/api/resources/customers/client/Client.d.mts +11 -11
- package/dist/esm/api/resources/customers/client/Client.mjs +43 -43
- package/dist/esm/api/resources/customers/client/requests/CustomerCreate.d.mts +4 -4
- package/dist/esm/api/resources/orders/client/Client.d.mts +7 -7
- package/dist/esm/api/resources/orders/client/Client.mjs +26 -26
- package/dist/esm/api/resources/orders/client/requests/OrderCreate.d.mts +2 -2
- package/dist/esm/api/resources/orders/resources/lines/client/Client.d.mts +4 -4
- package/dist/esm/api/resources/orders/resources/lines/client/Client.mjs +6 -6
- package/dist/esm/api/resources/orders/resources/lines/client/requests/LinesUpdateRequest.d.mts +2 -2
- package/dist/esm/api/resources/usage/client/Client.d.mts +4 -4
- package/dist/esm/api/resources/usage/client/Client.mjs +6 -6
- package/dist/esm/api/resources/usage/client/requests/UsageRecordBulkRequest.d.mts +2 -2
- package/dist/esm/api/types/Agent.d.mts +2 -2
- package/dist/esm/api/types/AgentAttribute.d.mts +2 -2
- package/dist/esm/api/types/AgentPricePoint.d.mts +2 -2
- package/dist/esm/api/types/AgentUpdate.d.mts +2 -2
- package/dist/esm/api/types/Contact.d.mts +2 -2
- package/dist/esm/api/types/Customer.d.mts +5 -5
- package/dist/esm/api/types/CustomerUpdate.d.mts +4 -4
- package/dist/esm/api/types/Error_.d.mts +2 -2
- package/dist/esm/api/types/Order.d.mts +4 -4
- package/dist/esm/api/types/OrderLine.d.mts +4 -4
- package/dist/esm/api/types/OrderLineAttribute.d.mts +2 -2
- package/dist/esm/api/types/OrderLineAttributePricing.d.mts +5 -5
- package/dist/esm/api/types/PricePoint.d.mts +2 -2
- package/dist/esm/api/types/Pricing.d.mts +5 -5
- package/dist/esm/environments.d.mts +2 -2
- package/dist/esm/environments.mjs +1 -1
- package/dist/esm/errors/{PaidApiError.d.mts → PaidError.d.mts} +1 -1
- package/dist/esm/errors/{PaidApiError.mjs → PaidError.mjs} +2 -2
- package/dist/{cjs/errors/PaidApiTimeoutError.d.ts → esm/errors/PaidTimeoutError.d.mts} +1 -1
- package/dist/esm/errors/{PaidApiTimeoutError.mjs → PaidTimeoutError.mjs} +2 -2
- package/dist/esm/errors/index.d.mts +2 -2
- package/dist/esm/errors/index.mjs +2 -2
- package/dist/esm/index.d.mts +4 -4
- package/dist/esm/index.mjs +4 -4
- package/dist/esm/version.d.mts +1 -1
- package/dist/esm/version.mjs +1 -1
- package/dist/esm/wrapper/BatchUsage.d.mts +6 -0
- package/dist/esm/wrapper/BatchUsage.mjs +20 -0
- package/package.json +1 -1
- package/reference.md +31 -31
|
@@ -71,7 +71,7 @@ class Contacts {
|
|
|
71
71
|
return __awaiter(this, void 0, void 0, function* () {
|
|
72
72
|
var _a, _b, _c;
|
|
73
73
|
const _response = yield core.fetcher({
|
|
74
|
-
url: (0, url_join_1.default)((_b = (_a = (yield core.Supplier.get(this._options.baseUrl))) !== null && _a !== void 0 ? _a : (yield core.Supplier.get(this._options.environment))) !== null && _b !== void 0 ? _b : environments.
|
|
74
|
+
url: (0, url_join_1.default)((_b = (_a = (yield core.Supplier.get(this._options.baseUrl))) !== null && _a !== void 0 ? _a : (yield core.Supplier.get(this._options.environment))) !== null && _b !== void 0 ? _b : environments.PaidEnvironment.Production, "contacts"),
|
|
75
75
|
method: "GET",
|
|
76
76
|
headers: (0, headers_js_1.mergeHeaders)((_c = this._options) === null || _c === void 0 ? void 0 : _c.headers, (0, headers_js_1.mergeOnlyDefinedHeaders)({ Authorization: yield this._getAuthorizationHeader() }), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers),
|
|
77
77
|
timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
|
|
@@ -82,7 +82,7 @@ class Contacts {
|
|
|
82
82
|
return { data: _response.body, rawResponse: _response.rawResponse };
|
|
83
83
|
}
|
|
84
84
|
if (_response.error.reason === "status-code") {
|
|
85
|
-
throw new errors.
|
|
85
|
+
throw new errors.PaidError({
|
|
86
86
|
statusCode: _response.error.statusCode,
|
|
87
87
|
body: _response.error.body,
|
|
88
88
|
rawResponse: _response.rawResponse,
|
|
@@ -90,15 +90,15 @@ class Contacts {
|
|
|
90
90
|
}
|
|
91
91
|
switch (_response.error.reason) {
|
|
92
92
|
case "non-json":
|
|
93
|
-
throw new errors.
|
|
93
|
+
throw new errors.PaidError({
|
|
94
94
|
statusCode: _response.error.statusCode,
|
|
95
95
|
body: _response.error.rawBody,
|
|
96
96
|
rawResponse: _response.rawResponse,
|
|
97
97
|
});
|
|
98
98
|
case "timeout":
|
|
99
|
-
throw new errors.
|
|
99
|
+
throw new errors.PaidTimeoutError("Timeout exceeded when calling GET /contacts.");
|
|
100
100
|
case "unknown":
|
|
101
|
-
throw new errors.
|
|
101
|
+
throw new errors.PaidError({
|
|
102
102
|
message: _response.error.errorMessage,
|
|
103
103
|
rawResponse: _response.rawResponse,
|
|
104
104
|
});
|
|
@@ -106,7 +106,7 @@ class Contacts {
|
|
|
106
106
|
});
|
|
107
107
|
}
|
|
108
108
|
/**
|
|
109
|
-
* @param {
|
|
109
|
+
* @param {Paid.ContactCreate} request
|
|
110
110
|
* @param {Contacts.RequestOptions} requestOptions - Request-specific configuration.
|
|
111
111
|
*
|
|
112
112
|
* @example
|
|
@@ -128,7 +128,7 @@ class Contacts {
|
|
|
128
128
|
return __awaiter(this, void 0, void 0, function* () {
|
|
129
129
|
var _a, _b, _c;
|
|
130
130
|
const _response = yield core.fetcher({
|
|
131
|
-
url: (0, url_join_1.default)((_b = (_a = (yield core.Supplier.get(this._options.baseUrl))) !== null && _a !== void 0 ? _a : (yield core.Supplier.get(this._options.environment))) !== null && _b !== void 0 ? _b : environments.
|
|
131
|
+
url: (0, url_join_1.default)((_b = (_a = (yield core.Supplier.get(this._options.baseUrl))) !== null && _a !== void 0 ? _a : (yield core.Supplier.get(this._options.environment))) !== null && _b !== void 0 ? _b : environments.PaidEnvironment.Production, "contacts"),
|
|
132
132
|
method: "POST",
|
|
133
133
|
headers: (0, headers_js_1.mergeHeaders)((_c = this._options) === null || _c === void 0 ? void 0 : _c.headers, (0, headers_js_1.mergeOnlyDefinedHeaders)({ Authorization: yield this._getAuthorizationHeader() }), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers),
|
|
134
134
|
contentType: "application/json",
|
|
@@ -142,7 +142,7 @@ class Contacts {
|
|
|
142
142
|
return { data: _response.body, rawResponse: _response.rawResponse };
|
|
143
143
|
}
|
|
144
144
|
if (_response.error.reason === "status-code") {
|
|
145
|
-
throw new errors.
|
|
145
|
+
throw new errors.PaidError({
|
|
146
146
|
statusCode: _response.error.statusCode,
|
|
147
147
|
body: _response.error.body,
|
|
148
148
|
rawResponse: _response.rawResponse,
|
|
@@ -150,15 +150,15 @@ class Contacts {
|
|
|
150
150
|
}
|
|
151
151
|
switch (_response.error.reason) {
|
|
152
152
|
case "non-json":
|
|
153
|
-
throw new errors.
|
|
153
|
+
throw new errors.PaidError({
|
|
154
154
|
statusCode: _response.error.statusCode,
|
|
155
155
|
body: _response.error.rawBody,
|
|
156
156
|
rawResponse: _response.rawResponse,
|
|
157
157
|
});
|
|
158
158
|
case "timeout":
|
|
159
|
-
throw new errors.
|
|
159
|
+
throw new errors.PaidTimeoutError("Timeout exceeded when calling POST /contacts.");
|
|
160
160
|
case "unknown":
|
|
161
|
-
throw new errors.
|
|
161
|
+
throw new errors.PaidError({
|
|
162
162
|
message: _response.error.errorMessage,
|
|
163
163
|
rawResponse: _response.rawResponse,
|
|
164
164
|
});
|
|
@@ -179,7 +179,7 @@ class Contacts {
|
|
|
179
179
|
return __awaiter(this, void 0, void 0, function* () {
|
|
180
180
|
var _a, _b, _c;
|
|
181
181
|
const _response = yield core.fetcher({
|
|
182
|
-
url: (0, url_join_1.default)((_b = (_a = (yield core.Supplier.get(this._options.baseUrl))) !== null && _a !== void 0 ? _a : (yield core.Supplier.get(this._options.environment))) !== null && _b !== void 0 ? _b : environments.
|
|
182
|
+
url: (0, url_join_1.default)((_b = (_a = (yield core.Supplier.get(this._options.baseUrl))) !== null && _a !== void 0 ? _a : (yield core.Supplier.get(this._options.environment))) !== null && _b !== void 0 ? _b : environments.PaidEnvironment.Production, `contacts/${encodeURIComponent(contactId)}`),
|
|
183
183
|
method: "GET",
|
|
184
184
|
headers: (0, headers_js_1.mergeHeaders)((_c = this._options) === null || _c === void 0 ? void 0 : _c.headers, (0, headers_js_1.mergeOnlyDefinedHeaders)({ Authorization: yield this._getAuthorizationHeader() }), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers),
|
|
185
185
|
timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
|
|
@@ -190,7 +190,7 @@ class Contacts {
|
|
|
190
190
|
return { data: _response.body, rawResponse: _response.rawResponse };
|
|
191
191
|
}
|
|
192
192
|
if (_response.error.reason === "status-code") {
|
|
193
|
-
throw new errors.
|
|
193
|
+
throw new errors.PaidError({
|
|
194
194
|
statusCode: _response.error.statusCode,
|
|
195
195
|
body: _response.error.body,
|
|
196
196
|
rawResponse: _response.rawResponse,
|
|
@@ -198,15 +198,15 @@ class Contacts {
|
|
|
198
198
|
}
|
|
199
199
|
switch (_response.error.reason) {
|
|
200
200
|
case "non-json":
|
|
201
|
-
throw new errors.
|
|
201
|
+
throw new errors.PaidError({
|
|
202
202
|
statusCode: _response.error.statusCode,
|
|
203
203
|
body: _response.error.rawBody,
|
|
204
204
|
rawResponse: _response.rawResponse,
|
|
205
205
|
});
|
|
206
206
|
case "timeout":
|
|
207
|
-
throw new errors.
|
|
207
|
+
throw new errors.PaidTimeoutError("Timeout exceeded when calling GET /contacts/{contactId}.");
|
|
208
208
|
case "unknown":
|
|
209
|
-
throw new errors.
|
|
209
|
+
throw new errors.PaidError({
|
|
210
210
|
message: _response.error.errorMessage,
|
|
211
211
|
rawResponse: _response.rawResponse,
|
|
212
212
|
});
|
|
@@ -227,7 +227,7 @@ class Contacts {
|
|
|
227
227
|
return __awaiter(this, void 0, void 0, function* () {
|
|
228
228
|
var _a, _b, _c;
|
|
229
229
|
const _response = yield core.fetcher({
|
|
230
|
-
url: (0, url_join_1.default)((_b = (_a = (yield core.Supplier.get(this._options.baseUrl))) !== null && _a !== void 0 ? _a : (yield core.Supplier.get(this._options.environment))) !== null && _b !== void 0 ? _b : environments.
|
|
230
|
+
url: (0, url_join_1.default)((_b = (_a = (yield core.Supplier.get(this._options.baseUrl))) !== null && _a !== void 0 ? _a : (yield core.Supplier.get(this._options.environment))) !== null && _b !== void 0 ? _b : environments.PaidEnvironment.Production, `contacts/${encodeURIComponent(contactId)}`),
|
|
231
231
|
method: "DELETE",
|
|
232
232
|
headers: (0, headers_js_1.mergeHeaders)((_c = this._options) === null || _c === void 0 ? void 0 : _c.headers, (0, headers_js_1.mergeOnlyDefinedHeaders)({ Authorization: yield this._getAuthorizationHeader() }), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers),
|
|
233
233
|
timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
|
|
@@ -238,7 +238,7 @@ class Contacts {
|
|
|
238
238
|
return { data: undefined, rawResponse: _response.rawResponse };
|
|
239
239
|
}
|
|
240
240
|
if (_response.error.reason === "status-code") {
|
|
241
|
-
throw new errors.
|
|
241
|
+
throw new errors.PaidError({
|
|
242
242
|
statusCode: _response.error.statusCode,
|
|
243
243
|
body: _response.error.body,
|
|
244
244
|
rawResponse: _response.rawResponse,
|
|
@@ -246,15 +246,15 @@ class Contacts {
|
|
|
246
246
|
}
|
|
247
247
|
switch (_response.error.reason) {
|
|
248
248
|
case "non-json":
|
|
249
|
-
throw new errors.
|
|
249
|
+
throw new errors.PaidError({
|
|
250
250
|
statusCode: _response.error.statusCode,
|
|
251
251
|
body: _response.error.rawBody,
|
|
252
252
|
rawResponse: _response.rawResponse,
|
|
253
253
|
});
|
|
254
254
|
case "timeout":
|
|
255
|
-
throw new errors.
|
|
255
|
+
throw new errors.PaidTimeoutError("Timeout exceeded when calling DELETE /contacts/{contactId}.");
|
|
256
256
|
case "unknown":
|
|
257
|
-
throw new errors.
|
|
257
|
+
throw new errors.PaidError({
|
|
258
258
|
message: _response.error.errorMessage,
|
|
259
259
|
rawResponse: _response.rawResponse,
|
|
260
260
|
});
|
|
@@ -275,7 +275,7 @@ class Contacts {
|
|
|
275
275
|
return __awaiter(this, void 0, void 0, function* () {
|
|
276
276
|
var _a, _b, _c;
|
|
277
277
|
const _response = yield core.fetcher({
|
|
278
|
-
url: (0, url_join_1.default)((_b = (_a = (yield core.Supplier.get(this._options.baseUrl))) !== null && _a !== void 0 ? _a : (yield core.Supplier.get(this._options.environment))) !== null && _b !== void 0 ? _b : environments.
|
|
278
|
+
url: (0, url_join_1.default)((_b = (_a = (yield core.Supplier.get(this._options.baseUrl))) !== null && _a !== void 0 ? _a : (yield core.Supplier.get(this._options.environment))) !== null && _b !== void 0 ? _b : environments.PaidEnvironment.Production, `contacts/external/${encodeURIComponent(externalId)}`),
|
|
279
279
|
method: "GET",
|
|
280
280
|
headers: (0, headers_js_1.mergeHeaders)((_c = this._options) === null || _c === void 0 ? void 0 : _c.headers, (0, headers_js_1.mergeOnlyDefinedHeaders)({ Authorization: yield this._getAuthorizationHeader() }), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers),
|
|
281
281
|
timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
|
|
@@ -286,7 +286,7 @@ class Contacts {
|
|
|
286
286
|
return { data: _response.body, rawResponse: _response.rawResponse };
|
|
287
287
|
}
|
|
288
288
|
if (_response.error.reason === "status-code") {
|
|
289
|
-
throw new errors.
|
|
289
|
+
throw new errors.PaidError({
|
|
290
290
|
statusCode: _response.error.statusCode,
|
|
291
291
|
body: _response.error.body,
|
|
292
292
|
rawResponse: _response.rawResponse,
|
|
@@ -294,15 +294,15 @@ class Contacts {
|
|
|
294
294
|
}
|
|
295
295
|
switch (_response.error.reason) {
|
|
296
296
|
case "non-json":
|
|
297
|
-
throw new errors.
|
|
297
|
+
throw new errors.PaidError({
|
|
298
298
|
statusCode: _response.error.statusCode,
|
|
299
299
|
body: _response.error.rawBody,
|
|
300
300
|
rawResponse: _response.rawResponse,
|
|
301
301
|
});
|
|
302
302
|
case "timeout":
|
|
303
|
-
throw new errors.
|
|
303
|
+
throw new errors.PaidTimeoutError("Timeout exceeded when calling GET /contacts/external/{externalId}.");
|
|
304
304
|
case "unknown":
|
|
305
|
-
throw new errors.
|
|
305
|
+
throw new errors.PaidError({
|
|
306
306
|
message: _response.error.errorMessage,
|
|
307
307
|
rawResponse: _response.rawResponse,
|
|
308
308
|
});
|
|
@@ -323,7 +323,7 @@ class Contacts {
|
|
|
323
323
|
return __awaiter(this, void 0, void 0, function* () {
|
|
324
324
|
var _a, _b, _c;
|
|
325
325
|
const _response = yield core.fetcher({
|
|
326
|
-
url: (0, url_join_1.default)((_b = (_a = (yield core.Supplier.get(this._options.baseUrl))) !== null && _a !== void 0 ? _a : (yield core.Supplier.get(this._options.environment))) !== null && _b !== void 0 ? _b : environments.
|
|
326
|
+
url: (0, url_join_1.default)((_b = (_a = (yield core.Supplier.get(this._options.baseUrl))) !== null && _a !== void 0 ? _a : (yield core.Supplier.get(this._options.environment))) !== null && _b !== void 0 ? _b : environments.PaidEnvironment.Production, `contacts/external/${encodeURIComponent(externalId)}`),
|
|
327
327
|
method: "DELETE",
|
|
328
328
|
headers: (0, headers_js_1.mergeHeaders)((_c = this._options) === null || _c === void 0 ? void 0 : _c.headers, (0, headers_js_1.mergeOnlyDefinedHeaders)({ Authorization: yield this._getAuthorizationHeader() }), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers),
|
|
329
329
|
timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
|
|
@@ -334,7 +334,7 @@ class Contacts {
|
|
|
334
334
|
return { data: undefined, rawResponse: _response.rawResponse };
|
|
335
335
|
}
|
|
336
336
|
if (_response.error.reason === "status-code") {
|
|
337
|
-
throw new errors.
|
|
337
|
+
throw new errors.PaidError({
|
|
338
338
|
statusCode: _response.error.statusCode,
|
|
339
339
|
body: _response.error.body,
|
|
340
340
|
rawResponse: _response.rawResponse,
|
|
@@ -342,15 +342,15 @@ class Contacts {
|
|
|
342
342
|
}
|
|
343
343
|
switch (_response.error.reason) {
|
|
344
344
|
case "non-json":
|
|
345
|
-
throw new errors.
|
|
345
|
+
throw new errors.PaidError({
|
|
346
346
|
statusCode: _response.error.statusCode,
|
|
347
347
|
body: _response.error.rawBody,
|
|
348
348
|
rawResponse: _response.rawResponse,
|
|
349
349
|
});
|
|
350
350
|
case "timeout":
|
|
351
|
-
throw new errors.
|
|
351
|
+
throw new errors.PaidTimeoutError("Timeout exceeded when calling DELETE /contacts/external/{externalId}.");
|
|
352
352
|
case "unknown":
|
|
353
|
-
throw new errors.
|
|
353
|
+
throw new errors.PaidError({
|
|
354
354
|
message: _response.error.errorMessage,
|
|
355
355
|
rawResponse: _response.rawResponse,
|
|
356
356
|
});
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* This file was auto-generated by Fern from our API Definition.
|
|
3
3
|
*/
|
|
4
|
-
import * as
|
|
4
|
+
import * as Paid from "../../../../index.js";
|
|
5
5
|
/**
|
|
6
6
|
* @example
|
|
7
7
|
* {
|
|
@@ -19,7 +19,7 @@ export interface ContactCreate {
|
|
|
19
19
|
externalId?: string;
|
|
20
20
|
customerId?: string;
|
|
21
21
|
customerExternalId?: string;
|
|
22
|
-
salutation:
|
|
22
|
+
salutation: Paid.Salutation;
|
|
23
23
|
firstName: string;
|
|
24
24
|
lastName: string;
|
|
25
25
|
email: string;
|
|
@@ -3,10 +3,10 @@
|
|
|
3
3
|
*/
|
|
4
4
|
import * as environments from "../../../../environments.js";
|
|
5
5
|
import * as core from "../../../../core/index.js";
|
|
6
|
-
import * as
|
|
6
|
+
import * as Paid from "../../../index.js";
|
|
7
7
|
export declare namespace Customers {
|
|
8
8
|
interface Options {
|
|
9
|
-
environment?: core.Supplier<environments.
|
|
9
|
+
environment?: core.Supplier<environments.PaidEnvironment | string>;
|
|
10
10
|
/** Specify a custom URL to connect the client to. */
|
|
11
11
|
baseUrl?: core.Supplier<string>;
|
|
12
12
|
token: core.Supplier<core.BearerToken>;
|
|
@@ -33,10 +33,10 @@ export declare class Customers {
|
|
|
33
33
|
* @example
|
|
34
34
|
* await client.customers.list()
|
|
35
35
|
*/
|
|
36
|
-
list(requestOptions?: Customers.RequestOptions): core.HttpResponsePromise<
|
|
36
|
+
list(requestOptions?: Customers.RequestOptions): core.HttpResponsePromise<Paid.Customer[]>;
|
|
37
37
|
private __list;
|
|
38
38
|
/**
|
|
39
|
-
* @param {
|
|
39
|
+
* @param {Paid.CustomerCreate} request
|
|
40
40
|
* @param {Customers.RequestOptions} requestOptions - Request-specific configuration.
|
|
41
41
|
*
|
|
42
42
|
* @example
|
|
@@ -44,7 +44,7 @@ export declare class Customers {
|
|
|
44
44
|
* name: "name"
|
|
45
45
|
* })
|
|
46
46
|
*/
|
|
47
|
-
create(request:
|
|
47
|
+
create(request: Paid.CustomerCreate, requestOptions?: Customers.RequestOptions): core.HttpResponsePromise<Paid.Customer>;
|
|
48
48
|
private __create;
|
|
49
49
|
/**
|
|
50
50
|
* @param {string} customerId
|
|
@@ -53,17 +53,17 @@ export declare class Customers {
|
|
|
53
53
|
* @example
|
|
54
54
|
* await client.customers.get("customerId")
|
|
55
55
|
*/
|
|
56
|
-
get(customerId: string, requestOptions?: Customers.RequestOptions): core.HttpResponsePromise<
|
|
56
|
+
get(customerId: string, requestOptions?: Customers.RequestOptions): core.HttpResponsePromise<Paid.Customer>;
|
|
57
57
|
private __get;
|
|
58
58
|
/**
|
|
59
59
|
* @param {string} customerId
|
|
60
|
-
* @param {
|
|
60
|
+
* @param {Paid.CustomerUpdate} request
|
|
61
61
|
* @param {Customers.RequestOptions} requestOptions - Request-specific configuration.
|
|
62
62
|
*
|
|
63
63
|
* @example
|
|
64
64
|
* await client.customers.update("customerId", {})
|
|
65
65
|
*/
|
|
66
|
-
update(customerId: string, request:
|
|
66
|
+
update(customerId: string, request: Paid.CustomerUpdate, requestOptions?: Customers.RequestOptions): core.HttpResponsePromise<Paid.Customer>;
|
|
67
67
|
private __update;
|
|
68
68
|
/**
|
|
69
69
|
* @param {string} customerId
|
|
@@ -81,17 +81,17 @@ export declare class Customers {
|
|
|
81
81
|
* @example
|
|
82
82
|
* await client.customers.getByExternalId("externalId")
|
|
83
83
|
*/
|
|
84
|
-
getByExternalId(externalId: string, requestOptions?: Customers.RequestOptions): core.HttpResponsePromise<
|
|
84
|
+
getByExternalId(externalId: string, requestOptions?: Customers.RequestOptions): core.HttpResponsePromise<Paid.Customer>;
|
|
85
85
|
private __getByExternalId;
|
|
86
86
|
/**
|
|
87
87
|
* @param {string} externalId
|
|
88
|
-
* @param {
|
|
88
|
+
* @param {Paid.CustomerUpdate} request
|
|
89
89
|
* @param {Customers.RequestOptions} requestOptions - Request-specific configuration.
|
|
90
90
|
*
|
|
91
91
|
* @example
|
|
92
92
|
* await client.customers.updateByExternalId("externalId", {})
|
|
93
93
|
*/
|
|
94
|
-
updateByExternalId(externalId: string, request:
|
|
94
|
+
updateByExternalId(externalId: string, request: Paid.CustomerUpdate, requestOptions?: Customers.RequestOptions): core.HttpResponsePromise<Paid.Customer>;
|
|
95
95
|
private __updateByExternalId;
|
|
96
96
|
/**
|
|
97
97
|
* @param {string} externalId
|
|
@@ -71,7 +71,7 @@ class Customers {
|
|
|
71
71
|
return __awaiter(this, void 0, void 0, function* () {
|
|
72
72
|
var _a, _b, _c;
|
|
73
73
|
const _response = yield core.fetcher({
|
|
74
|
-
url: (0, url_join_1.default)((_b = (_a = (yield core.Supplier.get(this._options.baseUrl))) !== null && _a !== void 0 ? _a : (yield core.Supplier.get(this._options.environment))) !== null && _b !== void 0 ? _b : environments.
|
|
74
|
+
url: (0, url_join_1.default)((_b = (_a = (yield core.Supplier.get(this._options.baseUrl))) !== null && _a !== void 0 ? _a : (yield core.Supplier.get(this._options.environment))) !== null && _b !== void 0 ? _b : environments.PaidEnvironment.Production, "customers"),
|
|
75
75
|
method: "GET",
|
|
76
76
|
headers: (0, headers_js_1.mergeHeaders)((_c = this._options) === null || _c === void 0 ? void 0 : _c.headers, (0, headers_js_1.mergeOnlyDefinedHeaders)({ Authorization: yield this._getAuthorizationHeader() }), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers),
|
|
77
77
|
timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
|
|
@@ -82,7 +82,7 @@ class Customers {
|
|
|
82
82
|
return { data: _response.body, rawResponse: _response.rawResponse };
|
|
83
83
|
}
|
|
84
84
|
if (_response.error.reason === "status-code") {
|
|
85
|
-
throw new errors.
|
|
85
|
+
throw new errors.PaidError({
|
|
86
86
|
statusCode: _response.error.statusCode,
|
|
87
87
|
body: _response.error.body,
|
|
88
88
|
rawResponse: _response.rawResponse,
|
|
@@ -90,15 +90,15 @@ class Customers {
|
|
|
90
90
|
}
|
|
91
91
|
switch (_response.error.reason) {
|
|
92
92
|
case "non-json":
|
|
93
|
-
throw new errors.
|
|
93
|
+
throw new errors.PaidError({
|
|
94
94
|
statusCode: _response.error.statusCode,
|
|
95
95
|
body: _response.error.rawBody,
|
|
96
96
|
rawResponse: _response.rawResponse,
|
|
97
97
|
});
|
|
98
98
|
case "timeout":
|
|
99
|
-
throw new errors.
|
|
99
|
+
throw new errors.PaidTimeoutError("Timeout exceeded when calling GET /customers.");
|
|
100
100
|
case "unknown":
|
|
101
|
-
throw new errors.
|
|
101
|
+
throw new errors.PaidError({
|
|
102
102
|
message: _response.error.errorMessage,
|
|
103
103
|
rawResponse: _response.rawResponse,
|
|
104
104
|
});
|
|
@@ -106,7 +106,7 @@ class Customers {
|
|
|
106
106
|
});
|
|
107
107
|
}
|
|
108
108
|
/**
|
|
109
|
-
* @param {
|
|
109
|
+
* @param {Paid.CustomerCreate} request
|
|
110
110
|
* @param {Customers.RequestOptions} requestOptions - Request-specific configuration.
|
|
111
111
|
*
|
|
112
112
|
* @example
|
|
@@ -121,7 +121,7 @@ class Customers {
|
|
|
121
121
|
return __awaiter(this, void 0, void 0, function* () {
|
|
122
122
|
var _a, _b, _c;
|
|
123
123
|
const _response = yield core.fetcher({
|
|
124
|
-
url: (0, url_join_1.default)((_b = (_a = (yield core.Supplier.get(this._options.baseUrl))) !== null && _a !== void 0 ? _a : (yield core.Supplier.get(this._options.environment))) !== null && _b !== void 0 ? _b : environments.
|
|
124
|
+
url: (0, url_join_1.default)((_b = (_a = (yield core.Supplier.get(this._options.baseUrl))) !== null && _a !== void 0 ? _a : (yield core.Supplier.get(this._options.environment))) !== null && _b !== void 0 ? _b : environments.PaidEnvironment.Production, "customers"),
|
|
125
125
|
method: "POST",
|
|
126
126
|
headers: (0, headers_js_1.mergeHeaders)((_c = this._options) === null || _c === void 0 ? void 0 : _c.headers, (0, headers_js_1.mergeOnlyDefinedHeaders)({ Authorization: yield this._getAuthorizationHeader() }), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers),
|
|
127
127
|
contentType: "application/json",
|
|
@@ -135,7 +135,7 @@ class Customers {
|
|
|
135
135
|
return { data: _response.body, rawResponse: _response.rawResponse };
|
|
136
136
|
}
|
|
137
137
|
if (_response.error.reason === "status-code") {
|
|
138
|
-
throw new errors.
|
|
138
|
+
throw new errors.PaidError({
|
|
139
139
|
statusCode: _response.error.statusCode,
|
|
140
140
|
body: _response.error.body,
|
|
141
141
|
rawResponse: _response.rawResponse,
|
|
@@ -143,15 +143,15 @@ class Customers {
|
|
|
143
143
|
}
|
|
144
144
|
switch (_response.error.reason) {
|
|
145
145
|
case "non-json":
|
|
146
|
-
throw new errors.
|
|
146
|
+
throw new errors.PaidError({
|
|
147
147
|
statusCode: _response.error.statusCode,
|
|
148
148
|
body: _response.error.rawBody,
|
|
149
149
|
rawResponse: _response.rawResponse,
|
|
150
150
|
});
|
|
151
151
|
case "timeout":
|
|
152
|
-
throw new errors.
|
|
152
|
+
throw new errors.PaidTimeoutError("Timeout exceeded when calling POST /customers.");
|
|
153
153
|
case "unknown":
|
|
154
|
-
throw new errors.
|
|
154
|
+
throw new errors.PaidError({
|
|
155
155
|
message: _response.error.errorMessage,
|
|
156
156
|
rawResponse: _response.rawResponse,
|
|
157
157
|
});
|
|
@@ -172,7 +172,7 @@ class Customers {
|
|
|
172
172
|
return __awaiter(this, void 0, void 0, function* () {
|
|
173
173
|
var _a, _b, _c;
|
|
174
174
|
const _response = yield core.fetcher({
|
|
175
|
-
url: (0, url_join_1.default)((_b = (_a = (yield core.Supplier.get(this._options.baseUrl))) !== null && _a !== void 0 ? _a : (yield core.Supplier.get(this._options.environment))) !== null && _b !== void 0 ? _b : environments.
|
|
175
|
+
url: (0, url_join_1.default)((_b = (_a = (yield core.Supplier.get(this._options.baseUrl))) !== null && _a !== void 0 ? _a : (yield core.Supplier.get(this._options.environment))) !== null && _b !== void 0 ? _b : environments.PaidEnvironment.Production, `customers/${encodeURIComponent(customerId)}`),
|
|
176
176
|
method: "GET",
|
|
177
177
|
headers: (0, headers_js_1.mergeHeaders)((_c = this._options) === null || _c === void 0 ? void 0 : _c.headers, (0, headers_js_1.mergeOnlyDefinedHeaders)({ Authorization: yield this._getAuthorizationHeader() }), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers),
|
|
178
178
|
timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
|
|
@@ -183,7 +183,7 @@ class Customers {
|
|
|
183
183
|
return { data: _response.body, rawResponse: _response.rawResponse };
|
|
184
184
|
}
|
|
185
185
|
if (_response.error.reason === "status-code") {
|
|
186
|
-
throw new errors.
|
|
186
|
+
throw new errors.PaidError({
|
|
187
187
|
statusCode: _response.error.statusCode,
|
|
188
188
|
body: _response.error.body,
|
|
189
189
|
rawResponse: _response.rawResponse,
|
|
@@ -191,15 +191,15 @@ class Customers {
|
|
|
191
191
|
}
|
|
192
192
|
switch (_response.error.reason) {
|
|
193
193
|
case "non-json":
|
|
194
|
-
throw new errors.
|
|
194
|
+
throw new errors.PaidError({
|
|
195
195
|
statusCode: _response.error.statusCode,
|
|
196
196
|
body: _response.error.rawBody,
|
|
197
197
|
rawResponse: _response.rawResponse,
|
|
198
198
|
});
|
|
199
199
|
case "timeout":
|
|
200
|
-
throw new errors.
|
|
200
|
+
throw new errors.PaidTimeoutError("Timeout exceeded when calling GET /customers/{customerId}.");
|
|
201
201
|
case "unknown":
|
|
202
|
-
throw new errors.
|
|
202
|
+
throw new errors.PaidError({
|
|
203
203
|
message: _response.error.errorMessage,
|
|
204
204
|
rawResponse: _response.rawResponse,
|
|
205
205
|
});
|
|
@@ -208,7 +208,7 @@ class Customers {
|
|
|
208
208
|
}
|
|
209
209
|
/**
|
|
210
210
|
* @param {string} customerId
|
|
211
|
-
* @param {
|
|
211
|
+
* @param {Paid.CustomerUpdate} request
|
|
212
212
|
* @param {Customers.RequestOptions} requestOptions - Request-specific configuration.
|
|
213
213
|
*
|
|
214
214
|
* @example
|
|
@@ -221,7 +221,7 @@ class Customers {
|
|
|
221
221
|
return __awaiter(this, void 0, void 0, function* () {
|
|
222
222
|
var _a, _b, _c;
|
|
223
223
|
const _response = yield core.fetcher({
|
|
224
|
-
url: (0, url_join_1.default)((_b = (_a = (yield core.Supplier.get(this._options.baseUrl))) !== null && _a !== void 0 ? _a : (yield core.Supplier.get(this._options.environment))) !== null && _b !== void 0 ? _b : environments.
|
|
224
|
+
url: (0, url_join_1.default)((_b = (_a = (yield core.Supplier.get(this._options.baseUrl))) !== null && _a !== void 0 ? _a : (yield core.Supplier.get(this._options.environment))) !== null && _b !== void 0 ? _b : environments.PaidEnvironment.Production, `customers/${encodeURIComponent(customerId)}`),
|
|
225
225
|
method: "PUT",
|
|
226
226
|
headers: (0, headers_js_1.mergeHeaders)((_c = this._options) === null || _c === void 0 ? void 0 : _c.headers, (0, headers_js_1.mergeOnlyDefinedHeaders)({ Authorization: yield this._getAuthorizationHeader() }), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers),
|
|
227
227
|
contentType: "application/json",
|
|
@@ -235,7 +235,7 @@ class Customers {
|
|
|
235
235
|
return { data: _response.body, rawResponse: _response.rawResponse };
|
|
236
236
|
}
|
|
237
237
|
if (_response.error.reason === "status-code") {
|
|
238
|
-
throw new errors.
|
|
238
|
+
throw new errors.PaidError({
|
|
239
239
|
statusCode: _response.error.statusCode,
|
|
240
240
|
body: _response.error.body,
|
|
241
241
|
rawResponse: _response.rawResponse,
|
|
@@ -243,15 +243,15 @@ class Customers {
|
|
|
243
243
|
}
|
|
244
244
|
switch (_response.error.reason) {
|
|
245
245
|
case "non-json":
|
|
246
|
-
throw new errors.
|
|
246
|
+
throw new errors.PaidError({
|
|
247
247
|
statusCode: _response.error.statusCode,
|
|
248
248
|
body: _response.error.rawBody,
|
|
249
249
|
rawResponse: _response.rawResponse,
|
|
250
250
|
});
|
|
251
251
|
case "timeout":
|
|
252
|
-
throw new errors.
|
|
252
|
+
throw new errors.PaidTimeoutError("Timeout exceeded when calling PUT /customers/{customerId}.");
|
|
253
253
|
case "unknown":
|
|
254
|
-
throw new errors.
|
|
254
|
+
throw new errors.PaidError({
|
|
255
255
|
message: _response.error.errorMessage,
|
|
256
256
|
rawResponse: _response.rawResponse,
|
|
257
257
|
});
|
|
@@ -272,7 +272,7 @@ class Customers {
|
|
|
272
272
|
return __awaiter(this, void 0, void 0, function* () {
|
|
273
273
|
var _a, _b, _c;
|
|
274
274
|
const _response = yield core.fetcher({
|
|
275
|
-
url: (0, url_join_1.default)((_b = (_a = (yield core.Supplier.get(this._options.baseUrl))) !== null && _a !== void 0 ? _a : (yield core.Supplier.get(this._options.environment))) !== null && _b !== void 0 ? _b : environments.
|
|
275
|
+
url: (0, url_join_1.default)((_b = (_a = (yield core.Supplier.get(this._options.baseUrl))) !== null && _a !== void 0 ? _a : (yield core.Supplier.get(this._options.environment))) !== null && _b !== void 0 ? _b : environments.PaidEnvironment.Production, `customers/${encodeURIComponent(customerId)}`),
|
|
276
276
|
method: "DELETE",
|
|
277
277
|
headers: (0, headers_js_1.mergeHeaders)((_c = this._options) === null || _c === void 0 ? void 0 : _c.headers, (0, headers_js_1.mergeOnlyDefinedHeaders)({ Authorization: yield this._getAuthorizationHeader() }), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers),
|
|
278
278
|
timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
|
|
@@ -283,7 +283,7 @@ class Customers {
|
|
|
283
283
|
return { data: undefined, rawResponse: _response.rawResponse };
|
|
284
284
|
}
|
|
285
285
|
if (_response.error.reason === "status-code") {
|
|
286
|
-
throw new errors.
|
|
286
|
+
throw new errors.PaidError({
|
|
287
287
|
statusCode: _response.error.statusCode,
|
|
288
288
|
body: _response.error.body,
|
|
289
289
|
rawResponse: _response.rawResponse,
|
|
@@ -291,15 +291,15 @@ class Customers {
|
|
|
291
291
|
}
|
|
292
292
|
switch (_response.error.reason) {
|
|
293
293
|
case "non-json":
|
|
294
|
-
throw new errors.
|
|
294
|
+
throw new errors.PaidError({
|
|
295
295
|
statusCode: _response.error.statusCode,
|
|
296
296
|
body: _response.error.rawBody,
|
|
297
297
|
rawResponse: _response.rawResponse,
|
|
298
298
|
});
|
|
299
299
|
case "timeout":
|
|
300
|
-
throw new errors.
|
|
300
|
+
throw new errors.PaidTimeoutError("Timeout exceeded when calling DELETE /customers/{customerId}.");
|
|
301
301
|
case "unknown":
|
|
302
|
-
throw new errors.
|
|
302
|
+
throw new errors.PaidError({
|
|
303
303
|
message: _response.error.errorMessage,
|
|
304
304
|
rawResponse: _response.rawResponse,
|
|
305
305
|
});
|
|
@@ -320,7 +320,7 @@ class Customers {
|
|
|
320
320
|
return __awaiter(this, void 0, void 0, function* () {
|
|
321
321
|
var _a, _b, _c;
|
|
322
322
|
const _response = yield core.fetcher({
|
|
323
|
-
url: (0, url_join_1.default)((_b = (_a = (yield core.Supplier.get(this._options.baseUrl))) !== null && _a !== void 0 ? _a : (yield core.Supplier.get(this._options.environment))) !== null && _b !== void 0 ? _b : environments.
|
|
323
|
+
url: (0, url_join_1.default)((_b = (_a = (yield core.Supplier.get(this._options.baseUrl))) !== null && _a !== void 0 ? _a : (yield core.Supplier.get(this._options.environment))) !== null && _b !== void 0 ? _b : environments.PaidEnvironment.Production, `customers/external/${encodeURIComponent(externalId)}`),
|
|
324
324
|
method: "GET",
|
|
325
325
|
headers: (0, headers_js_1.mergeHeaders)((_c = this._options) === null || _c === void 0 ? void 0 : _c.headers, (0, headers_js_1.mergeOnlyDefinedHeaders)({ Authorization: yield this._getAuthorizationHeader() }), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers),
|
|
326
326
|
timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
|
|
@@ -331,7 +331,7 @@ class Customers {
|
|
|
331
331
|
return { data: _response.body, rawResponse: _response.rawResponse };
|
|
332
332
|
}
|
|
333
333
|
if (_response.error.reason === "status-code") {
|
|
334
|
-
throw new errors.
|
|
334
|
+
throw new errors.PaidError({
|
|
335
335
|
statusCode: _response.error.statusCode,
|
|
336
336
|
body: _response.error.body,
|
|
337
337
|
rawResponse: _response.rawResponse,
|
|
@@ -339,15 +339,15 @@ class Customers {
|
|
|
339
339
|
}
|
|
340
340
|
switch (_response.error.reason) {
|
|
341
341
|
case "non-json":
|
|
342
|
-
throw new errors.
|
|
342
|
+
throw new errors.PaidError({
|
|
343
343
|
statusCode: _response.error.statusCode,
|
|
344
344
|
body: _response.error.rawBody,
|
|
345
345
|
rawResponse: _response.rawResponse,
|
|
346
346
|
});
|
|
347
347
|
case "timeout":
|
|
348
|
-
throw new errors.
|
|
348
|
+
throw new errors.PaidTimeoutError("Timeout exceeded when calling GET /customers/external/{externalId}.");
|
|
349
349
|
case "unknown":
|
|
350
|
-
throw new errors.
|
|
350
|
+
throw new errors.PaidError({
|
|
351
351
|
message: _response.error.errorMessage,
|
|
352
352
|
rawResponse: _response.rawResponse,
|
|
353
353
|
});
|
|
@@ -356,7 +356,7 @@ class Customers {
|
|
|
356
356
|
}
|
|
357
357
|
/**
|
|
358
358
|
* @param {string} externalId
|
|
359
|
-
* @param {
|
|
359
|
+
* @param {Paid.CustomerUpdate} request
|
|
360
360
|
* @param {Customers.RequestOptions} requestOptions - Request-specific configuration.
|
|
361
361
|
*
|
|
362
362
|
* @example
|
|
@@ -369,7 +369,7 @@ class Customers {
|
|
|
369
369
|
return __awaiter(this, void 0, void 0, function* () {
|
|
370
370
|
var _a, _b, _c;
|
|
371
371
|
const _response = yield core.fetcher({
|
|
372
|
-
url: (0, url_join_1.default)((_b = (_a = (yield core.Supplier.get(this._options.baseUrl))) !== null && _a !== void 0 ? _a : (yield core.Supplier.get(this._options.environment))) !== null && _b !== void 0 ? _b : environments.
|
|
372
|
+
url: (0, url_join_1.default)((_b = (_a = (yield core.Supplier.get(this._options.baseUrl))) !== null && _a !== void 0 ? _a : (yield core.Supplier.get(this._options.environment))) !== null && _b !== void 0 ? _b : environments.PaidEnvironment.Production, `customers/external/${encodeURIComponent(externalId)}`),
|
|
373
373
|
method: "PUT",
|
|
374
374
|
headers: (0, headers_js_1.mergeHeaders)((_c = this._options) === null || _c === void 0 ? void 0 : _c.headers, (0, headers_js_1.mergeOnlyDefinedHeaders)({ Authorization: yield this._getAuthorizationHeader() }), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers),
|
|
375
375
|
contentType: "application/json",
|
|
@@ -383,7 +383,7 @@ class Customers {
|
|
|
383
383
|
return { data: _response.body, rawResponse: _response.rawResponse };
|
|
384
384
|
}
|
|
385
385
|
if (_response.error.reason === "status-code") {
|
|
386
|
-
throw new errors.
|
|
386
|
+
throw new errors.PaidError({
|
|
387
387
|
statusCode: _response.error.statusCode,
|
|
388
388
|
body: _response.error.body,
|
|
389
389
|
rawResponse: _response.rawResponse,
|
|
@@ -391,15 +391,15 @@ class Customers {
|
|
|
391
391
|
}
|
|
392
392
|
switch (_response.error.reason) {
|
|
393
393
|
case "non-json":
|
|
394
|
-
throw new errors.
|
|
394
|
+
throw new errors.PaidError({
|
|
395
395
|
statusCode: _response.error.statusCode,
|
|
396
396
|
body: _response.error.rawBody,
|
|
397
397
|
rawResponse: _response.rawResponse,
|
|
398
398
|
});
|
|
399
399
|
case "timeout":
|
|
400
|
-
throw new errors.
|
|
400
|
+
throw new errors.PaidTimeoutError("Timeout exceeded when calling PUT /customers/external/{externalId}.");
|
|
401
401
|
case "unknown":
|
|
402
|
-
throw new errors.
|
|
402
|
+
throw new errors.PaidError({
|
|
403
403
|
message: _response.error.errorMessage,
|
|
404
404
|
rawResponse: _response.rawResponse,
|
|
405
405
|
});
|
|
@@ -420,7 +420,7 @@ class Customers {
|
|
|
420
420
|
return __awaiter(this, void 0, void 0, function* () {
|
|
421
421
|
var _a, _b, _c;
|
|
422
422
|
const _response = yield core.fetcher({
|
|
423
|
-
url: (0, url_join_1.default)((_b = (_a = (yield core.Supplier.get(this._options.baseUrl))) !== null && _a !== void 0 ? _a : (yield core.Supplier.get(this._options.environment))) !== null && _b !== void 0 ? _b : environments.
|
|
423
|
+
url: (0, url_join_1.default)((_b = (_a = (yield core.Supplier.get(this._options.baseUrl))) !== null && _a !== void 0 ? _a : (yield core.Supplier.get(this._options.environment))) !== null && _b !== void 0 ? _b : environments.PaidEnvironment.Production, `customers/external/${encodeURIComponent(externalId)}`),
|
|
424
424
|
method: "DELETE",
|
|
425
425
|
headers: (0, headers_js_1.mergeHeaders)((_c = this._options) === null || _c === void 0 ? void 0 : _c.headers, (0, headers_js_1.mergeOnlyDefinedHeaders)({ Authorization: yield this._getAuthorizationHeader() }), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers),
|
|
426
426
|
timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
|
|
@@ -431,7 +431,7 @@ class Customers {
|
|
|
431
431
|
return { data: undefined, rawResponse: _response.rawResponse };
|
|
432
432
|
}
|
|
433
433
|
if (_response.error.reason === "status-code") {
|
|
434
|
-
throw new errors.
|
|
434
|
+
throw new errors.PaidError({
|
|
435
435
|
statusCode: _response.error.statusCode,
|
|
436
436
|
body: _response.error.body,
|
|
437
437
|
rawResponse: _response.rawResponse,
|
|
@@ -439,15 +439,15 @@ class Customers {
|
|
|
439
439
|
}
|
|
440
440
|
switch (_response.error.reason) {
|
|
441
441
|
case "non-json":
|
|
442
|
-
throw new errors.
|
|
442
|
+
throw new errors.PaidError({
|
|
443
443
|
statusCode: _response.error.statusCode,
|
|
444
444
|
body: _response.error.rawBody,
|
|
445
445
|
rawResponse: _response.rawResponse,
|
|
446
446
|
});
|
|
447
447
|
case "timeout":
|
|
448
|
-
throw new errors.
|
|
448
|
+
throw new errors.PaidTimeoutError("Timeout exceeded when calling DELETE /customers/external/{externalId}.");
|
|
449
449
|
case "unknown":
|
|
450
|
-
throw new errors.
|
|
450
|
+
throw new errors.PaidError({
|
|
451
451
|
message: _response.error.errorMessage,
|
|
452
452
|
rawResponse: _response.rawResponse,
|
|
453
453
|
});
|