@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
|
@@ -32,7 +32,7 @@ export class Agents {
|
|
|
32
32
|
return __awaiter(this, void 0, void 0, function* () {
|
|
33
33
|
var _a, _b, _c;
|
|
34
34
|
const _response = yield core.fetcher({
|
|
35
|
-
url: urlJoin((_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.
|
|
35
|
+
url: urlJoin((_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, "agents"),
|
|
36
36
|
method: "GET",
|
|
37
37
|
headers: mergeHeaders((_c = this._options) === null || _c === void 0 ? void 0 : _c.headers, mergeOnlyDefinedHeaders({ Authorization: yield this._getAuthorizationHeader() }), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers),
|
|
38
38
|
timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
|
|
@@ -43,7 +43,7 @@ export class Agents {
|
|
|
43
43
|
return { data: _response.body, rawResponse: _response.rawResponse };
|
|
44
44
|
}
|
|
45
45
|
if (_response.error.reason === "status-code") {
|
|
46
|
-
throw new errors.
|
|
46
|
+
throw new errors.PaidError({
|
|
47
47
|
statusCode: _response.error.statusCode,
|
|
48
48
|
body: _response.error.body,
|
|
49
49
|
rawResponse: _response.rawResponse,
|
|
@@ -51,15 +51,15 @@ export class Agents {
|
|
|
51
51
|
}
|
|
52
52
|
switch (_response.error.reason) {
|
|
53
53
|
case "non-json":
|
|
54
|
-
throw new errors.
|
|
54
|
+
throw new errors.PaidError({
|
|
55
55
|
statusCode: _response.error.statusCode,
|
|
56
56
|
body: _response.error.rawBody,
|
|
57
57
|
rawResponse: _response.rawResponse,
|
|
58
58
|
});
|
|
59
59
|
case "timeout":
|
|
60
|
-
throw new errors.
|
|
60
|
+
throw new errors.PaidTimeoutError("Timeout exceeded when calling GET /agents.");
|
|
61
61
|
case "unknown":
|
|
62
|
-
throw new errors.
|
|
62
|
+
throw new errors.PaidError({
|
|
63
63
|
message: _response.error.errorMessage,
|
|
64
64
|
rawResponse: _response.rawResponse,
|
|
65
65
|
});
|
|
@@ -67,7 +67,7 @@ export class Agents {
|
|
|
67
67
|
});
|
|
68
68
|
}
|
|
69
69
|
/**
|
|
70
|
-
* @param {
|
|
70
|
+
* @param {Paid.AgentCreate} request
|
|
71
71
|
* @param {Agents.RequestOptions} requestOptions - Request-specific configuration.
|
|
72
72
|
*
|
|
73
73
|
* @example
|
|
@@ -83,7 +83,7 @@ export class Agents {
|
|
|
83
83
|
return __awaiter(this, void 0, void 0, function* () {
|
|
84
84
|
var _a, _b, _c;
|
|
85
85
|
const _response = yield core.fetcher({
|
|
86
|
-
url: urlJoin((_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.
|
|
86
|
+
url: urlJoin((_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, "agents"),
|
|
87
87
|
method: "POST",
|
|
88
88
|
headers: mergeHeaders((_c = this._options) === null || _c === void 0 ? void 0 : _c.headers, mergeOnlyDefinedHeaders({ Authorization: yield this._getAuthorizationHeader() }), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers),
|
|
89
89
|
contentType: "application/json",
|
|
@@ -97,7 +97,7 @@ export class Agents {
|
|
|
97
97
|
return { data: _response.body, rawResponse: _response.rawResponse };
|
|
98
98
|
}
|
|
99
99
|
if (_response.error.reason === "status-code") {
|
|
100
|
-
throw new errors.
|
|
100
|
+
throw new errors.PaidError({
|
|
101
101
|
statusCode: _response.error.statusCode,
|
|
102
102
|
body: _response.error.body,
|
|
103
103
|
rawResponse: _response.rawResponse,
|
|
@@ -105,15 +105,15 @@ export class Agents {
|
|
|
105
105
|
}
|
|
106
106
|
switch (_response.error.reason) {
|
|
107
107
|
case "non-json":
|
|
108
|
-
throw new errors.
|
|
108
|
+
throw new errors.PaidError({
|
|
109
109
|
statusCode: _response.error.statusCode,
|
|
110
110
|
body: _response.error.rawBody,
|
|
111
111
|
rawResponse: _response.rawResponse,
|
|
112
112
|
});
|
|
113
113
|
case "timeout":
|
|
114
|
-
throw new errors.
|
|
114
|
+
throw new errors.PaidTimeoutError("Timeout exceeded when calling POST /agents.");
|
|
115
115
|
case "unknown":
|
|
116
|
-
throw new errors.
|
|
116
|
+
throw new errors.PaidError({
|
|
117
117
|
message: _response.error.errorMessage,
|
|
118
118
|
rawResponse: _response.rawResponse,
|
|
119
119
|
});
|
|
@@ -134,7 +134,7 @@ export class Agents {
|
|
|
134
134
|
return __awaiter(this, void 0, void 0, function* () {
|
|
135
135
|
var _a, _b, _c;
|
|
136
136
|
const _response = yield core.fetcher({
|
|
137
|
-
url: urlJoin((_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.
|
|
137
|
+
url: urlJoin((_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, `agents/${encodeURIComponent(agentId)}`),
|
|
138
138
|
method: "GET",
|
|
139
139
|
headers: mergeHeaders((_c = this._options) === null || _c === void 0 ? void 0 : _c.headers, mergeOnlyDefinedHeaders({ Authorization: yield this._getAuthorizationHeader() }), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers),
|
|
140
140
|
timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
|
|
@@ -145,7 +145,7 @@ export class Agents {
|
|
|
145
145
|
return { data: _response.body, rawResponse: _response.rawResponse };
|
|
146
146
|
}
|
|
147
147
|
if (_response.error.reason === "status-code") {
|
|
148
|
-
throw new errors.
|
|
148
|
+
throw new errors.PaidError({
|
|
149
149
|
statusCode: _response.error.statusCode,
|
|
150
150
|
body: _response.error.body,
|
|
151
151
|
rawResponse: _response.rawResponse,
|
|
@@ -153,15 +153,15 @@ export class Agents {
|
|
|
153
153
|
}
|
|
154
154
|
switch (_response.error.reason) {
|
|
155
155
|
case "non-json":
|
|
156
|
-
throw new errors.
|
|
156
|
+
throw new errors.PaidError({
|
|
157
157
|
statusCode: _response.error.statusCode,
|
|
158
158
|
body: _response.error.rawBody,
|
|
159
159
|
rawResponse: _response.rawResponse,
|
|
160
160
|
});
|
|
161
161
|
case "timeout":
|
|
162
|
-
throw new errors.
|
|
162
|
+
throw new errors.PaidTimeoutError("Timeout exceeded when calling GET /agents/{agentId}.");
|
|
163
163
|
case "unknown":
|
|
164
|
-
throw new errors.
|
|
164
|
+
throw new errors.PaidError({
|
|
165
165
|
message: _response.error.errorMessage,
|
|
166
166
|
rawResponse: _response.rawResponse,
|
|
167
167
|
});
|
|
@@ -170,7 +170,7 @@ export class Agents {
|
|
|
170
170
|
}
|
|
171
171
|
/**
|
|
172
172
|
* @param {string} agentId
|
|
173
|
-
* @param {
|
|
173
|
+
* @param {Paid.AgentUpdate} request
|
|
174
174
|
* @param {Agents.RequestOptions} requestOptions - Request-specific configuration.
|
|
175
175
|
*
|
|
176
176
|
* @example
|
|
@@ -183,7 +183,7 @@ export class Agents {
|
|
|
183
183
|
return __awaiter(this, void 0, void 0, function* () {
|
|
184
184
|
var _a, _b, _c;
|
|
185
185
|
const _response = yield core.fetcher({
|
|
186
|
-
url: urlJoin((_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.
|
|
186
|
+
url: urlJoin((_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, `agents/${encodeURIComponent(agentId)}`),
|
|
187
187
|
method: "PUT",
|
|
188
188
|
headers: mergeHeaders((_c = this._options) === null || _c === void 0 ? void 0 : _c.headers, mergeOnlyDefinedHeaders({ Authorization: yield this._getAuthorizationHeader() }), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers),
|
|
189
189
|
contentType: "application/json",
|
|
@@ -197,7 +197,7 @@ export class Agents {
|
|
|
197
197
|
return { data: _response.body, rawResponse: _response.rawResponse };
|
|
198
198
|
}
|
|
199
199
|
if (_response.error.reason === "status-code") {
|
|
200
|
-
throw new errors.
|
|
200
|
+
throw new errors.PaidError({
|
|
201
201
|
statusCode: _response.error.statusCode,
|
|
202
202
|
body: _response.error.body,
|
|
203
203
|
rawResponse: _response.rawResponse,
|
|
@@ -205,15 +205,15 @@ export class Agents {
|
|
|
205
205
|
}
|
|
206
206
|
switch (_response.error.reason) {
|
|
207
207
|
case "non-json":
|
|
208
|
-
throw new errors.
|
|
208
|
+
throw new errors.PaidError({
|
|
209
209
|
statusCode: _response.error.statusCode,
|
|
210
210
|
body: _response.error.rawBody,
|
|
211
211
|
rawResponse: _response.rawResponse,
|
|
212
212
|
});
|
|
213
213
|
case "timeout":
|
|
214
|
-
throw new errors.
|
|
214
|
+
throw new errors.PaidTimeoutError("Timeout exceeded when calling PUT /agents/{agentId}.");
|
|
215
215
|
case "unknown":
|
|
216
|
-
throw new errors.
|
|
216
|
+
throw new errors.PaidError({
|
|
217
217
|
message: _response.error.errorMessage,
|
|
218
218
|
rawResponse: _response.rawResponse,
|
|
219
219
|
});
|
|
@@ -234,7 +234,7 @@ export class Agents {
|
|
|
234
234
|
return __awaiter(this, void 0, void 0, function* () {
|
|
235
235
|
var _a, _b, _c;
|
|
236
236
|
const _response = yield core.fetcher({
|
|
237
|
-
url: urlJoin((_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.
|
|
237
|
+
url: urlJoin((_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, `agents/${encodeURIComponent(agentId)}`),
|
|
238
238
|
method: "DELETE",
|
|
239
239
|
headers: mergeHeaders((_c = this._options) === null || _c === void 0 ? void 0 : _c.headers, mergeOnlyDefinedHeaders({ Authorization: yield this._getAuthorizationHeader() }), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers),
|
|
240
240
|
timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
|
|
@@ -245,7 +245,7 @@ export class Agents {
|
|
|
245
245
|
return { data: undefined, rawResponse: _response.rawResponse };
|
|
246
246
|
}
|
|
247
247
|
if (_response.error.reason === "status-code") {
|
|
248
|
-
throw new errors.
|
|
248
|
+
throw new errors.PaidError({
|
|
249
249
|
statusCode: _response.error.statusCode,
|
|
250
250
|
body: _response.error.body,
|
|
251
251
|
rawResponse: _response.rawResponse,
|
|
@@ -253,15 +253,15 @@ export class Agents {
|
|
|
253
253
|
}
|
|
254
254
|
switch (_response.error.reason) {
|
|
255
255
|
case "non-json":
|
|
256
|
-
throw new errors.
|
|
256
|
+
throw new errors.PaidError({
|
|
257
257
|
statusCode: _response.error.statusCode,
|
|
258
258
|
body: _response.error.rawBody,
|
|
259
259
|
rawResponse: _response.rawResponse,
|
|
260
260
|
});
|
|
261
261
|
case "timeout":
|
|
262
|
-
throw new errors.
|
|
262
|
+
throw new errors.PaidTimeoutError("Timeout exceeded when calling DELETE /agents/{agentId}.");
|
|
263
263
|
case "unknown":
|
|
264
|
-
throw new errors.
|
|
264
|
+
throw new errors.PaidError({
|
|
265
265
|
message: _response.error.errorMessage,
|
|
266
266
|
rawResponse: _response.rawResponse,
|
|
267
267
|
});
|
|
@@ -282,7 +282,7 @@ export class Agents {
|
|
|
282
282
|
return __awaiter(this, void 0, void 0, function* () {
|
|
283
283
|
var _a, _b, _c;
|
|
284
284
|
const _response = yield core.fetcher({
|
|
285
|
-
url: urlJoin((_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.
|
|
285
|
+
url: urlJoin((_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, `agents/external/${encodeURIComponent(externalId)}`),
|
|
286
286
|
method: "GET",
|
|
287
287
|
headers: mergeHeaders((_c = this._options) === null || _c === void 0 ? void 0 : _c.headers, mergeOnlyDefinedHeaders({ Authorization: yield this._getAuthorizationHeader() }), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers),
|
|
288
288
|
timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
|
|
@@ -293,7 +293,7 @@ export class Agents {
|
|
|
293
293
|
return { data: _response.body, rawResponse: _response.rawResponse };
|
|
294
294
|
}
|
|
295
295
|
if (_response.error.reason === "status-code") {
|
|
296
|
-
throw new errors.
|
|
296
|
+
throw new errors.PaidError({
|
|
297
297
|
statusCode: _response.error.statusCode,
|
|
298
298
|
body: _response.error.body,
|
|
299
299
|
rawResponse: _response.rawResponse,
|
|
@@ -301,15 +301,15 @@ export class Agents {
|
|
|
301
301
|
}
|
|
302
302
|
switch (_response.error.reason) {
|
|
303
303
|
case "non-json":
|
|
304
|
-
throw new errors.
|
|
304
|
+
throw new errors.PaidError({
|
|
305
305
|
statusCode: _response.error.statusCode,
|
|
306
306
|
body: _response.error.rawBody,
|
|
307
307
|
rawResponse: _response.rawResponse,
|
|
308
308
|
});
|
|
309
309
|
case "timeout":
|
|
310
|
-
throw new errors.
|
|
310
|
+
throw new errors.PaidTimeoutError("Timeout exceeded when calling GET /agents/external/{externalId}.");
|
|
311
311
|
case "unknown":
|
|
312
|
-
throw new errors.
|
|
312
|
+
throw new errors.PaidError({
|
|
313
313
|
message: _response.error.errorMessage,
|
|
314
314
|
rawResponse: _response.rawResponse,
|
|
315
315
|
});
|
|
@@ -318,7 +318,7 @@ export class Agents {
|
|
|
318
318
|
}
|
|
319
319
|
/**
|
|
320
320
|
* @param {string} externalId
|
|
321
|
-
* @param {
|
|
321
|
+
* @param {Paid.AgentUpdate} request
|
|
322
322
|
* @param {Agents.RequestOptions} requestOptions - Request-specific configuration.
|
|
323
323
|
*
|
|
324
324
|
* @example
|
|
@@ -331,7 +331,7 @@ export class Agents {
|
|
|
331
331
|
return __awaiter(this, void 0, void 0, function* () {
|
|
332
332
|
var _a, _b, _c;
|
|
333
333
|
const _response = yield core.fetcher({
|
|
334
|
-
url: urlJoin((_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.
|
|
334
|
+
url: urlJoin((_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, `agents/external/${encodeURIComponent(externalId)}`),
|
|
335
335
|
method: "PUT",
|
|
336
336
|
headers: mergeHeaders((_c = this._options) === null || _c === void 0 ? void 0 : _c.headers, mergeOnlyDefinedHeaders({ Authorization: yield this._getAuthorizationHeader() }), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers),
|
|
337
337
|
contentType: "application/json",
|
|
@@ -345,7 +345,7 @@ export class Agents {
|
|
|
345
345
|
return { data: _response.body, rawResponse: _response.rawResponse };
|
|
346
346
|
}
|
|
347
347
|
if (_response.error.reason === "status-code") {
|
|
348
|
-
throw new errors.
|
|
348
|
+
throw new errors.PaidError({
|
|
349
349
|
statusCode: _response.error.statusCode,
|
|
350
350
|
body: _response.error.body,
|
|
351
351
|
rawResponse: _response.rawResponse,
|
|
@@ -353,15 +353,15 @@ export class Agents {
|
|
|
353
353
|
}
|
|
354
354
|
switch (_response.error.reason) {
|
|
355
355
|
case "non-json":
|
|
356
|
-
throw new errors.
|
|
356
|
+
throw new errors.PaidError({
|
|
357
357
|
statusCode: _response.error.statusCode,
|
|
358
358
|
body: _response.error.rawBody,
|
|
359
359
|
rawResponse: _response.rawResponse,
|
|
360
360
|
});
|
|
361
361
|
case "timeout":
|
|
362
|
-
throw new errors.
|
|
362
|
+
throw new errors.PaidTimeoutError("Timeout exceeded when calling PUT /agents/external/{externalId}.");
|
|
363
363
|
case "unknown":
|
|
364
|
-
throw new errors.
|
|
364
|
+
throw new errors.PaidError({
|
|
365
365
|
message: _response.error.errorMessage,
|
|
366
366
|
rawResponse: _response.rawResponse,
|
|
367
367
|
});
|
|
@@ -382,7 +382,7 @@ export class Agents {
|
|
|
382
382
|
return __awaiter(this, void 0, void 0, function* () {
|
|
383
383
|
var _a, _b, _c;
|
|
384
384
|
const _response = yield core.fetcher({
|
|
385
|
-
url: urlJoin((_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.
|
|
385
|
+
url: urlJoin((_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, `agents/external/${encodeURIComponent(externalId)}`),
|
|
386
386
|
method: "DELETE",
|
|
387
387
|
headers: mergeHeaders((_c = this._options) === null || _c === void 0 ? void 0 : _c.headers, mergeOnlyDefinedHeaders({ Authorization: yield this._getAuthorizationHeader() }), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers),
|
|
388
388
|
timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
|
|
@@ -393,7 +393,7 @@ export class Agents {
|
|
|
393
393
|
return { data: undefined, rawResponse: _response.rawResponse };
|
|
394
394
|
}
|
|
395
395
|
if (_response.error.reason === "status-code") {
|
|
396
|
-
throw new errors.
|
|
396
|
+
throw new errors.PaidError({
|
|
397
397
|
statusCode: _response.error.statusCode,
|
|
398
398
|
body: _response.error.body,
|
|
399
399
|
rawResponse: _response.rawResponse,
|
|
@@ -401,15 +401,15 @@ export class Agents {
|
|
|
401
401
|
}
|
|
402
402
|
switch (_response.error.reason) {
|
|
403
403
|
case "non-json":
|
|
404
|
-
throw new errors.
|
|
404
|
+
throw new errors.PaidError({
|
|
405
405
|
statusCode: _response.error.statusCode,
|
|
406
406
|
body: _response.error.rawBody,
|
|
407
407
|
rawResponse: _response.rawResponse,
|
|
408
408
|
});
|
|
409
409
|
case "timeout":
|
|
410
|
-
throw new errors.
|
|
410
|
+
throw new errors.PaidTimeoutError("Timeout exceeded when calling DELETE /agents/external/{externalId}.");
|
|
411
411
|
case "unknown":
|
|
412
|
-
throw new errors.
|
|
412
|
+
throw new errors.PaidError({
|
|
413
413
|
message: _response.error.errorMessage,
|
|
414
414
|
rawResponse: _response.rawResponse,
|
|
415
415
|
});
|
|
@@ -3,10 +3,10 @@
|
|
|
3
3
|
*/
|
|
4
4
|
import * as environments from "../../../../environments.mjs";
|
|
5
5
|
import * as core from "../../../../core/index.mjs";
|
|
6
|
-
import * as
|
|
6
|
+
import * as Paid from "../../../index.mjs";
|
|
7
7
|
export declare namespace Contacts {
|
|
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 Contacts {
|
|
|
33
33
|
* @example
|
|
34
34
|
* await client.contacts.list()
|
|
35
35
|
*/
|
|
36
|
-
list(requestOptions?: Contacts.RequestOptions): core.HttpResponsePromise<
|
|
36
|
+
list(requestOptions?: Contacts.RequestOptions): core.HttpResponsePromise<Paid.Contact[]>;
|
|
37
37
|
private __list;
|
|
38
38
|
/**
|
|
39
|
-
* @param {
|
|
39
|
+
* @param {Paid.ContactCreate} request
|
|
40
40
|
* @param {Contacts.RequestOptions} requestOptions - Request-specific configuration.
|
|
41
41
|
*
|
|
42
42
|
* @example
|
|
@@ -51,7 +51,7 @@ export declare class Contacts {
|
|
|
51
51
|
* billingPostalCode: "billingPostalCode"
|
|
52
52
|
* })
|
|
53
53
|
*/
|
|
54
|
-
create(request:
|
|
54
|
+
create(request: Paid.ContactCreate, requestOptions?: Contacts.RequestOptions): core.HttpResponsePromise<Paid.Contact>;
|
|
55
55
|
private __create;
|
|
56
56
|
/**
|
|
57
57
|
* @param {string} contactId
|
|
@@ -60,7 +60,7 @@ export declare class Contacts {
|
|
|
60
60
|
* @example
|
|
61
61
|
* await client.contacts.get("contactId")
|
|
62
62
|
*/
|
|
63
|
-
get(contactId: string, requestOptions?: Contacts.RequestOptions): core.HttpResponsePromise<
|
|
63
|
+
get(contactId: string, requestOptions?: Contacts.RequestOptions): core.HttpResponsePromise<Paid.Contact>;
|
|
64
64
|
private __get;
|
|
65
65
|
/**
|
|
66
66
|
* @param {string} contactId
|
|
@@ -78,7 +78,7 @@ export declare class Contacts {
|
|
|
78
78
|
* @example
|
|
79
79
|
* await client.contacts.getByExternalId("externalId")
|
|
80
80
|
*/
|
|
81
|
-
getByExternalId(externalId: string, requestOptions?: Contacts.RequestOptions): core.HttpResponsePromise<
|
|
81
|
+
getByExternalId(externalId: string, requestOptions?: Contacts.RequestOptions): core.HttpResponsePromise<Paid.Contact>;
|
|
82
82
|
private __getByExternalId;
|
|
83
83
|
/**
|
|
84
84
|
* @param {string} externalId
|
|
@@ -32,7 +32,7 @@ export class Contacts {
|
|
|
32
32
|
return __awaiter(this, void 0, void 0, function* () {
|
|
33
33
|
var _a, _b, _c;
|
|
34
34
|
const _response = yield core.fetcher({
|
|
35
|
-
url: urlJoin((_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.
|
|
35
|
+
url: urlJoin((_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"),
|
|
36
36
|
method: "GET",
|
|
37
37
|
headers: mergeHeaders((_c = this._options) === null || _c === void 0 ? void 0 : _c.headers, mergeOnlyDefinedHeaders({ Authorization: yield this._getAuthorizationHeader() }), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers),
|
|
38
38
|
timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
|
|
@@ -43,7 +43,7 @@ export class Contacts {
|
|
|
43
43
|
return { data: _response.body, rawResponse: _response.rawResponse };
|
|
44
44
|
}
|
|
45
45
|
if (_response.error.reason === "status-code") {
|
|
46
|
-
throw new errors.
|
|
46
|
+
throw new errors.PaidError({
|
|
47
47
|
statusCode: _response.error.statusCode,
|
|
48
48
|
body: _response.error.body,
|
|
49
49
|
rawResponse: _response.rawResponse,
|
|
@@ -51,15 +51,15 @@ export class Contacts {
|
|
|
51
51
|
}
|
|
52
52
|
switch (_response.error.reason) {
|
|
53
53
|
case "non-json":
|
|
54
|
-
throw new errors.
|
|
54
|
+
throw new errors.PaidError({
|
|
55
55
|
statusCode: _response.error.statusCode,
|
|
56
56
|
body: _response.error.rawBody,
|
|
57
57
|
rawResponse: _response.rawResponse,
|
|
58
58
|
});
|
|
59
59
|
case "timeout":
|
|
60
|
-
throw new errors.
|
|
60
|
+
throw new errors.PaidTimeoutError("Timeout exceeded when calling GET /contacts.");
|
|
61
61
|
case "unknown":
|
|
62
|
-
throw new errors.
|
|
62
|
+
throw new errors.PaidError({
|
|
63
63
|
message: _response.error.errorMessage,
|
|
64
64
|
rawResponse: _response.rawResponse,
|
|
65
65
|
});
|
|
@@ -67,7 +67,7 @@ export class Contacts {
|
|
|
67
67
|
});
|
|
68
68
|
}
|
|
69
69
|
/**
|
|
70
|
-
* @param {
|
|
70
|
+
* @param {Paid.ContactCreate} request
|
|
71
71
|
* @param {Contacts.RequestOptions} requestOptions - Request-specific configuration.
|
|
72
72
|
*
|
|
73
73
|
* @example
|
|
@@ -89,7 +89,7 @@ export class Contacts {
|
|
|
89
89
|
return __awaiter(this, void 0, void 0, function* () {
|
|
90
90
|
var _a, _b, _c;
|
|
91
91
|
const _response = yield core.fetcher({
|
|
92
|
-
url: urlJoin((_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.
|
|
92
|
+
url: urlJoin((_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"),
|
|
93
93
|
method: "POST",
|
|
94
94
|
headers: mergeHeaders((_c = this._options) === null || _c === void 0 ? void 0 : _c.headers, mergeOnlyDefinedHeaders({ Authorization: yield this._getAuthorizationHeader() }), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers),
|
|
95
95
|
contentType: "application/json",
|
|
@@ -103,7 +103,7 @@ export class Contacts {
|
|
|
103
103
|
return { data: _response.body, rawResponse: _response.rawResponse };
|
|
104
104
|
}
|
|
105
105
|
if (_response.error.reason === "status-code") {
|
|
106
|
-
throw new errors.
|
|
106
|
+
throw new errors.PaidError({
|
|
107
107
|
statusCode: _response.error.statusCode,
|
|
108
108
|
body: _response.error.body,
|
|
109
109
|
rawResponse: _response.rawResponse,
|
|
@@ -111,15 +111,15 @@ export class Contacts {
|
|
|
111
111
|
}
|
|
112
112
|
switch (_response.error.reason) {
|
|
113
113
|
case "non-json":
|
|
114
|
-
throw new errors.
|
|
114
|
+
throw new errors.PaidError({
|
|
115
115
|
statusCode: _response.error.statusCode,
|
|
116
116
|
body: _response.error.rawBody,
|
|
117
117
|
rawResponse: _response.rawResponse,
|
|
118
118
|
});
|
|
119
119
|
case "timeout":
|
|
120
|
-
throw new errors.
|
|
120
|
+
throw new errors.PaidTimeoutError("Timeout exceeded when calling POST /contacts.");
|
|
121
121
|
case "unknown":
|
|
122
|
-
throw new errors.
|
|
122
|
+
throw new errors.PaidError({
|
|
123
123
|
message: _response.error.errorMessage,
|
|
124
124
|
rawResponse: _response.rawResponse,
|
|
125
125
|
});
|
|
@@ -140,7 +140,7 @@ export class Contacts {
|
|
|
140
140
|
return __awaiter(this, void 0, void 0, function* () {
|
|
141
141
|
var _a, _b, _c;
|
|
142
142
|
const _response = yield core.fetcher({
|
|
143
|
-
url: urlJoin((_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.
|
|
143
|
+
url: urlJoin((_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)}`),
|
|
144
144
|
method: "GET",
|
|
145
145
|
headers: mergeHeaders((_c = this._options) === null || _c === void 0 ? void 0 : _c.headers, mergeOnlyDefinedHeaders({ Authorization: yield this._getAuthorizationHeader() }), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers),
|
|
146
146
|
timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
|
|
@@ -151,7 +151,7 @@ export class Contacts {
|
|
|
151
151
|
return { data: _response.body, rawResponse: _response.rawResponse };
|
|
152
152
|
}
|
|
153
153
|
if (_response.error.reason === "status-code") {
|
|
154
|
-
throw new errors.
|
|
154
|
+
throw new errors.PaidError({
|
|
155
155
|
statusCode: _response.error.statusCode,
|
|
156
156
|
body: _response.error.body,
|
|
157
157
|
rawResponse: _response.rawResponse,
|
|
@@ -159,15 +159,15 @@ export class Contacts {
|
|
|
159
159
|
}
|
|
160
160
|
switch (_response.error.reason) {
|
|
161
161
|
case "non-json":
|
|
162
|
-
throw new errors.
|
|
162
|
+
throw new errors.PaidError({
|
|
163
163
|
statusCode: _response.error.statusCode,
|
|
164
164
|
body: _response.error.rawBody,
|
|
165
165
|
rawResponse: _response.rawResponse,
|
|
166
166
|
});
|
|
167
167
|
case "timeout":
|
|
168
|
-
throw new errors.
|
|
168
|
+
throw new errors.PaidTimeoutError("Timeout exceeded when calling GET /contacts/{contactId}.");
|
|
169
169
|
case "unknown":
|
|
170
|
-
throw new errors.
|
|
170
|
+
throw new errors.PaidError({
|
|
171
171
|
message: _response.error.errorMessage,
|
|
172
172
|
rawResponse: _response.rawResponse,
|
|
173
173
|
});
|
|
@@ -188,7 +188,7 @@ export class Contacts {
|
|
|
188
188
|
return __awaiter(this, void 0, void 0, function* () {
|
|
189
189
|
var _a, _b, _c;
|
|
190
190
|
const _response = yield core.fetcher({
|
|
191
|
-
url: urlJoin((_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.
|
|
191
|
+
url: urlJoin((_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)}`),
|
|
192
192
|
method: "DELETE",
|
|
193
193
|
headers: mergeHeaders((_c = this._options) === null || _c === void 0 ? void 0 : _c.headers, mergeOnlyDefinedHeaders({ Authorization: yield this._getAuthorizationHeader() }), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers),
|
|
194
194
|
timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
|
|
@@ -199,7 +199,7 @@ export class Contacts {
|
|
|
199
199
|
return { data: undefined, rawResponse: _response.rawResponse };
|
|
200
200
|
}
|
|
201
201
|
if (_response.error.reason === "status-code") {
|
|
202
|
-
throw new errors.
|
|
202
|
+
throw new errors.PaidError({
|
|
203
203
|
statusCode: _response.error.statusCode,
|
|
204
204
|
body: _response.error.body,
|
|
205
205
|
rawResponse: _response.rawResponse,
|
|
@@ -207,15 +207,15 @@ export class Contacts {
|
|
|
207
207
|
}
|
|
208
208
|
switch (_response.error.reason) {
|
|
209
209
|
case "non-json":
|
|
210
|
-
throw new errors.
|
|
210
|
+
throw new errors.PaidError({
|
|
211
211
|
statusCode: _response.error.statusCode,
|
|
212
212
|
body: _response.error.rawBody,
|
|
213
213
|
rawResponse: _response.rawResponse,
|
|
214
214
|
});
|
|
215
215
|
case "timeout":
|
|
216
|
-
throw new errors.
|
|
216
|
+
throw new errors.PaidTimeoutError("Timeout exceeded when calling DELETE /contacts/{contactId}.");
|
|
217
217
|
case "unknown":
|
|
218
|
-
throw new errors.
|
|
218
|
+
throw new errors.PaidError({
|
|
219
219
|
message: _response.error.errorMessage,
|
|
220
220
|
rawResponse: _response.rawResponse,
|
|
221
221
|
});
|
|
@@ -236,7 +236,7 @@ export class Contacts {
|
|
|
236
236
|
return __awaiter(this, void 0, void 0, function* () {
|
|
237
237
|
var _a, _b, _c;
|
|
238
238
|
const _response = yield core.fetcher({
|
|
239
|
-
url: urlJoin((_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.
|
|
239
|
+
url: urlJoin((_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)}`),
|
|
240
240
|
method: "GET",
|
|
241
241
|
headers: mergeHeaders((_c = this._options) === null || _c === void 0 ? void 0 : _c.headers, mergeOnlyDefinedHeaders({ Authorization: yield this._getAuthorizationHeader() }), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers),
|
|
242
242
|
timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
|
|
@@ -247,7 +247,7 @@ export class Contacts {
|
|
|
247
247
|
return { data: _response.body, rawResponse: _response.rawResponse };
|
|
248
248
|
}
|
|
249
249
|
if (_response.error.reason === "status-code") {
|
|
250
|
-
throw new errors.
|
|
250
|
+
throw new errors.PaidError({
|
|
251
251
|
statusCode: _response.error.statusCode,
|
|
252
252
|
body: _response.error.body,
|
|
253
253
|
rawResponse: _response.rawResponse,
|
|
@@ -255,15 +255,15 @@ export class Contacts {
|
|
|
255
255
|
}
|
|
256
256
|
switch (_response.error.reason) {
|
|
257
257
|
case "non-json":
|
|
258
|
-
throw new errors.
|
|
258
|
+
throw new errors.PaidError({
|
|
259
259
|
statusCode: _response.error.statusCode,
|
|
260
260
|
body: _response.error.rawBody,
|
|
261
261
|
rawResponse: _response.rawResponse,
|
|
262
262
|
});
|
|
263
263
|
case "timeout":
|
|
264
|
-
throw new errors.
|
|
264
|
+
throw new errors.PaidTimeoutError("Timeout exceeded when calling GET /contacts/external/{externalId}.");
|
|
265
265
|
case "unknown":
|
|
266
|
-
throw new errors.
|
|
266
|
+
throw new errors.PaidError({
|
|
267
267
|
message: _response.error.errorMessage,
|
|
268
268
|
rawResponse: _response.rawResponse,
|
|
269
269
|
});
|
|
@@ -284,7 +284,7 @@ export class Contacts {
|
|
|
284
284
|
return __awaiter(this, void 0, void 0, function* () {
|
|
285
285
|
var _a, _b, _c;
|
|
286
286
|
const _response = yield core.fetcher({
|
|
287
|
-
url: urlJoin((_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.
|
|
287
|
+
url: urlJoin((_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)}`),
|
|
288
288
|
method: "DELETE",
|
|
289
289
|
headers: mergeHeaders((_c = this._options) === null || _c === void 0 ? void 0 : _c.headers, mergeOnlyDefinedHeaders({ Authorization: yield this._getAuthorizationHeader() }), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers),
|
|
290
290
|
timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
|
|
@@ -295,7 +295,7 @@ export class Contacts {
|
|
|
295
295
|
return { data: undefined, rawResponse: _response.rawResponse };
|
|
296
296
|
}
|
|
297
297
|
if (_response.error.reason === "status-code") {
|
|
298
|
-
throw new errors.
|
|
298
|
+
throw new errors.PaidError({
|
|
299
299
|
statusCode: _response.error.statusCode,
|
|
300
300
|
body: _response.error.body,
|
|
301
301
|
rawResponse: _response.rawResponse,
|
|
@@ -303,15 +303,15 @@ export class Contacts {
|
|
|
303
303
|
}
|
|
304
304
|
switch (_response.error.reason) {
|
|
305
305
|
case "non-json":
|
|
306
|
-
throw new errors.
|
|
306
|
+
throw new errors.PaidError({
|
|
307
307
|
statusCode: _response.error.statusCode,
|
|
308
308
|
body: _response.error.rawBody,
|
|
309
309
|
rawResponse: _response.rawResponse,
|
|
310
310
|
});
|
|
311
311
|
case "timeout":
|
|
312
|
-
throw new errors.
|
|
312
|
+
throw new errors.PaidTimeoutError("Timeout exceeded when calling DELETE /contacts/external/{externalId}.");
|
|
313
313
|
case "unknown":
|
|
314
|
-
throw new errors.
|
|
314
|
+
throw new errors.PaidError({
|
|
315
315
|
message: _response.error.errorMessage,
|
|
316
316
|
rawResponse: _response.rawResponse,
|
|
317
317
|
});
|
|
@@ -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.mjs";
|
|
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;
|