@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
|
@@ -37,7 +37,7 @@ export class Orders {
|
|
|
37
37
|
return __awaiter(this, void 0, void 0, function* () {
|
|
38
38
|
var _a, _b, _c;
|
|
39
39
|
const _response = yield core.fetcher({
|
|
40
|
-
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.
|
|
40
|
+
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, "orders"),
|
|
41
41
|
method: "GET",
|
|
42
42
|
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),
|
|
43
43
|
timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
|
|
@@ -48,7 +48,7 @@ export class Orders {
|
|
|
48
48
|
return { data: _response.body, rawResponse: _response.rawResponse };
|
|
49
49
|
}
|
|
50
50
|
if (_response.error.reason === "status-code") {
|
|
51
|
-
throw new errors.
|
|
51
|
+
throw new errors.PaidError({
|
|
52
52
|
statusCode: _response.error.statusCode,
|
|
53
53
|
body: _response.error.body,
|
|
54
54
|
rawResponse: _response.rawResponse,
|
|
@@ -56,15 +56,15 @@ export class Orders {
|
|
|
56
56
|
}
|
|
57
57
|
switch (_response.error.reason) {
|
|
58
58
|
case "non-json":
|
|
59
|
-
throw new errors.
|
|
59
|
+
throw new errors.PaidError({
|
|
60
60
|
statusCode: _response.error.statusCode,
|
|
61
61
|
body: _response.error.rawBody,
|
|
62
62
|
rawResponse: _response.rawResponse,
|
|
63
63
|
});
|
|
64
64
|
case "timeout":
|
|
65
|
-
throw new errors.
|
|
65
|
+
throw new errors.PaidTimeoutError("Timeout exceeded when calling GET /orders.");
|
|
66
66
|
case "unknown":
|
|
67
|
-
throw new errors.
|
|
67
|
+
throw new errors.PaidError({
|
|
68
68
|
message: _response.error.errorMessage,
|
|
69
69
|
rawResponse: _response.rawResponse,
|
|
70
70
|
});
|
|
@@ -72,7 +72,7 @@ export class Orders {
|
|
|
72
72
|
});
|
|
73
73
|
}
|
|
74
74
|
/**
|
|
75
|
-
* @param {
|
|
75
|
+
* @param {Paid.OrderCreate} request
|
|
76
76
|
* @param {Orders.RequestOptions} requestOptions - Request-specific configuration.
|
|
77
77
|
*
|
|
78
78
|
* @example
|
|
@@ -91,7 +91,7 @@ export class Orders {
|
|
|
91
91
|
return __awaiter(this, void 0, void 0, function* () {
|
|
92
92
|
var _a, _b, _c;
|
|
93
93
|
const _response = yield core.fetcher({
|
|
94
|
-
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.
|
|
94
|
+
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, "orders"),
|
|
95
95
|
method: "POST",
|
|
96
96
|
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),
|
|
97
97
|
contentType: "application/json",
|
|
@@ -105,7 +105,7 @@ export class Orders {
|
|
|
105
105
|
return { data: _response.body, rawResponse: _response.rawResponse };
|
|
106
106
|
}
|
|
107
107
|
if (_response.error.reason === "status-code") {
|
|
108
|
-
throw new errors.
|
|
108
|
+
throw new errors.PaidError({
|
|
109
109
|
statusCode: _response.error.statusCode,
|
|
110
110
|
body: _response.error.body,
|
|
111
111
|
rawResponse: _response.rawResponse,
|
|
@@ -113,15 +113,15 @@ export class Orders {
|
|
|
113
113
|
}
|
|
114
114
|
switch (_response.error.reason) {
|
|
115
115
|
case "non-json":
|
|
116
|
-
throw new errors.
|
|
116
|
+
throw new errors.PaidError({
|
|
117
117
|
statusCode: _response.error.statusCode,
|
|
118
118
|
body: _response.error.rawBody,
|
|
119
119
|
rawResponse: _response.rawResponse,
|
|
120
120
|
});
|
|
121
121
|
case "timeout":
|
|
122
|
-
throw new errors.
|
|
122
|
+
throw new errors.PaidTimeoutError("Timeout exceeded when calling POST /orders.");
|
|
123
123
|
case "unknown":
|
|
124
|
-
throw new errors.
|
|
124
|
+
throw new errors.PaidError({
|
|
125
125
|
message: _response.error.errorMessage,
|
|
126
126
|
rawResponse: _response.rawResponse,
|
|
127
127
|
});
|
|
@@ -142,7 +142,7 @@ export class Orders {
|
|
|
142
142
|
return __awaiter(this, void 0, void 0, function* () {
|
|
143
143
|
var _a, _b, _c;
|
|
144
144
|
const _response = yield core.fetcher({
|
|
145
|
-
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.
|
|
145
|
+
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, `orders/${encodeURIComponent(orderId)}`),
|
|
146
146
|
method: "GET",
|
|
147
147
|
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),
|
|
148
148
|
timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
|
|
@@ -153,7 +153,7 @@ export class Orders {
|
|
|
153
153
|
return { data: _response.body, rawResponse: _response.rawResponse };
|
|
154
154
|
}
|
|
155
155
|
if (_response.error.reason === "status-code") {
|
|
156
|
-
throw new errors.
|
|
156
|
+
throw new errors.PaidError({
|
|
157
157
|
statusCode: _response.error.statusCode,
|
|
158
158
|
body: _response.error.body,
|
|
159
159
|
rawResponse: _response.rawResponse,
|
|
@@ -161,15 +161,15 @@ export class Orders {
|
|
|
161
161
|
}
|
|
162
162
|
switch (_response.error.reason) {
|
|
163
163
|
case "non-json":
|
|
164
|
-
throw new errors.
|
|
164
|
+
throw new errors.PaidError({
|
|
165
165
|
statusCode: _response.error.statusCode,
|
|
166
166
|
body: _response.error.rawBody,
|
|
167
167
|
rawResponse: _response.rawResponse,
|
|
168
168
|
});
|
|
169
169
|
case "timeout":
|
|
170
|
-
throw new errors.
|
|
170
|
+
throw new errors.PaidTimeoutError("Timeout exceeded when calling GET /orders/{orderId}.");
|
|
171
171
|
case "unknown":
|
|
172
|
-
throw new errors.
|
|
172
|
+
throw new errors.PaidError({
|
|
173
173
|
message: _response.error.errorMessage,
|
|
174
174
|
rawResponse: _response.rawResponse,
|
|
175
175
|
});
|
|
@@ -190,7 +190,7 @@ export class Orders {
|
|
|
190
190
|
return __awaiter(this, void 0, void 0, function* () {
|
|
191
191
|
var _a, _b, _c;
|
|
192
192
|
const _response = yield core.fetcher({
|
|
193
|
-
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.
|
|
193
|
+
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, `orders/${encodeURIComponent(orderId)}`),
|
|
194
194
|
method: "DELETE",
|
|
195
195
|
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),
|
|
196
196
|
timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
|
|
@@ -201,7 +201,7 @@ export class Orders {
|
|
|
201
201
|
return { data: undefined, rawResponse: _response.rawResponse };
|
|
202
202
|
}
|
|
203
203
|
if (_response.error.reason === "status-code") {
|
|
204
|
-
throw new errors.
|
|
204
|
+
throw new errors.PaidError({
|
|
205
205
|
statusCode: _response.error.statusCode,
|
|
206
206
|
body: _response.error.body,
|
|
207
207
|
rawResponse: _response.rawResponse,
|
|
@@ -209,15 +209,15 @@ export class Orders {
|
|
|
209
209
|
}
|
|
210
210
|
switch (_response.error.reason) {
|
|
211
211
|
case "non-json":
|
|
212
|
-
throw new errors.
|
|
212
|
+
throw new errors.PaidError({
|
|
213
213
|
statusCode: _response.error.statusCode,
|
|
214
214
|
body: _response.error.rawBody,
|
|
215
215
|
rawResponse: _response.rawResponse,
|
|
216
216
|
});
|
|
217
217
|
case "timeout":
|
|
218
|
-
throw new errors.
|
|
218
|
+
throw new errors.PaidTimeoutError("Timeout exceeded when calling DELETE /orders/{orderId}.");
|
|
219
219
|
case "unknown":
|
|
220
|
-
throw new errors.
|
|
220
|
+
throw new errors.PaidError({
|
|
221
221
|
message: _response.error.errorMessage,
|
|
222
222
|
rawResponse: _response.rawResponse,
|
|
223
223
|
});
|
|
@@ -238,7 +238,7 @@ export class Orders {
|
|
|
238
238
|
return __awaiter(this, void 0, void 0, function* () {
|
|
239
239
|
var _a, _b, _c;
|
|
240
240
|
const _response = yield core.fetcher({
|
|
241
|
-
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.
|
|
241
|
+
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, `orders/${encodeURIComponent(orderId)}/activate`),
|
|
242
242
|
method: "POST",
|
|
243
243
|
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),
|
|
244
244
|
timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
|
|
@@ -249,7 +249,7 @@ export class Orders {
|
|
|
249
249
|
return { data: _response.body, rawResponse: _response.rawResponse };
|
|
250
250
|
}
|
|
251
251
|
if (_response.error.reason === "status-code") {
|
|
252
|
-
throw new errors.
|
|
252
|
+
throw new errors.PaidError({
|
|
253
253
|
statusCode: _response.error.statusCode,
|
|
254
254
|
body: _response.error.body,
|
|
255
255
|
rawResponse: _response.rawResponse,
|
|
@@ -257,15 +257,15 @@ export class Orders {
|
|
|
257
257
|
}
|
|
258
258
|
switch (_response.error.reason) {
|
|
259
259
|
case "non-json":
|
|
260
|
-
throw new errors.
|
|
260
|
+
throw new errors.PaidError({
|
|
261
261
|
statusCode: _response.error.statusCode,
|
|
262
262
|
body: _response.error.rawBody,
|
|
263
263
|
rawResponse: _response.rawResponse,
|
|
264
264
|
});
|
|
265
265
|
case "timeout":
|
|
266
|
-
throw new errors.
|
|
266
|
+
throw new errors.PaidTimeoutError("Timeout exceeded when calling POST /orders/{orderId}/activate.");
|
|
267
267
|
case "unknown":
|
|
268
|
-
throw new errors.
|
|
268
|
+
throw new errors.PaidError({
|
|
269
269
|
message: _response.error.errorMessage,
|
|
270
270
|
rawResponse: _response.rawResponse,
|
|
271
271
|
});
|
|
@@ -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
|
* {
|
|
@@ -21,5 +21,5 @@ export interface OrderCreate {
|
|
|
21
21
|
startDate: string;
|
|
22
22
|
endDate?: string;
|
|
23
23
|
currency: string;
|
|
24
|
-
orderLines?:
|
|
24
|
+
orderLines?: Paid.OrderLineCreate[];
|
|
25
25
|
}
|
|
@@ -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 Lines {
|
|
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>;
|
|
@@ -29,13 +29,13 @@ export declare class Lines {
|
|
|
29
29
|
constructor(_options: Lines.Options);
|
|
30
30
|
/**
|
|
31
31
|
* @param {string} orderId
|
|
32
|
-
* @param {
|
|
32
|
+
* @param {Paid.orders.LinesUpdateRequest} request
|
|
33
33
|
* @param {Lines.RequestOptions} requestOptions - Request-specific configuration.
|
|
34
34
|
*
|
|
35
35
|
* @example
|
|
36
36
|
* await client.orders.lines.update("orderId")
|
|
37
37
|
*/
|
|
38
|
-
update(orderId: string, request?:
|
|
38
|
+
update(orderId: string, request?: Paid.orders.LinesUpdateRequest, requestOptions?: Lines.RequestOptions): core.HttpResponsePromise<Paid.Order>;
|
|
39
39
|
private __update;
|
|
40
40
|
protected _getAuthorizationHeader(): Promise<string>;
|
|
41
41
|
}
|
|
@@ -21,7 +21,7 @@ export class Lines {
|
|
|
21
21
|
}
|
|
22
22
|
/**
|
|
23
23
|
* @param {string} orderId
|
|
24
|
-
* @param {
|
|
24
|
+
* @param {Paid.orders.LinesUpdateRequest} request
|
|
25
25
|
* @param {Lines.RequestOptions} requestOptions - Request-specific configuration.
|
|
26
26
|
*
|
|
27
27
|
* @example
|
|
@@ -34,7 +34,7 @@ export class Lines {
|
|
|
34
34
|
return __awaiter(this, arguments, void 0, function* (orderId, request = {}, requestOptions) {
|
|
35
35
|
var _a, _b, _c;
|
|
36
36
|
const _response = yield core.fetcher({
|
|
37
|
-
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.
|
|
37
|
+
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, `orders/${encodeURIComponent(orderId)}/lines`),
|
|
38
38
|
method: "PUT",
|
|
39
39
|
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),
|
|
40
40
|
contentType: "application/json",
|
|
@@ -48,7 +48,7 @@ export class Lines {
|
|
|
48
48
|
return { data: _response.body, rawResponse: _response.rawResponse };
|
|
49
49
|
}
|
|
50
50
|
if (_response.error.reason === "status-code") {
|
|
51
|
-
throw new errors.
|
|
51
|
+
throw new errors.PaidError({
|
|
52
52
|
statusCode: _response.error.statusCode,
|
|
53
53
|
body: _response.error.body,
|
|
54
54
|
rawResponse: _response.rawResponse,
|
|
@@ -56,15 +56,15 @@ export class Lines {
|
|
|
56
56
|
}
|
|
57
57
|
switch (_response.error.reason) {
|
|
58
58
|
case "non-json":
|
|
59
|
-
throw new errors.
|
|
59
|
+
throw new errors.PaidError({
|
|
60
60
|
statusCode: _response.error.statusCode,
|
|
61
61
|
body: _response.error.rawBody,
|
|
62
62
|
rawResponse: _response.rawResponse,
|
|
63
63
|
});
|
|
64
64
|
case "timeout":
|
|
65
|
-
throw new errors.
|
|
65
|
+
throw new errors.PaidTimeoutError("Timeout exceeded when calling PUT /orders/{orderId}/lines.");
|
|
66
66
|
case "unknown":
|
|
67
|
-
throw new errors.
|
|
67
|
+
throw new errors.PaidError({
|
|
68
68
|
message: _response.error.errorMessage,
|
|
69
69
|
rawResponse: _response.rawResponse,
|
|
70
70
|
});
|
package/dist/esm/api/resources/orders/resources/lines/client/requests/LinesUpdateRequest.d.mts
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
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
|
* {}
|
|
8
8
|
*/
|
|
9
9
|
export interface LinesUpdateRequest {
|
|
10
|
-
lines?:
|
|
10
|
+
lines?: Paid.OrderLineCreate[];
|
|
11
11
|
}
|
|
@@ -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 Usage {
|
|
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>;
|
|
@@ -28,13 +28,13 @@ export declare class Usage {
|
|
|
28
28
|
protected readonly _options: Usage.Options;
|
|
29
29
|
constructor(_options: Usage.Options);
|
|
30
30
|
/**
|
|
31
|
-
* @param {
|
|
31
|
+
* @param {Paid.UsageRecordBulkRequest} request
|
|
32
32
|
* @param {Usage.RequestOptions} requestOptions - Request-specific configuration.
|
|
33
33
|
*
|
|
34
34
|
* @example
|
|
35
35
|
* await client.usage.recordBulk()
|
|
36
36
|
*/
|
|
37
|
-
recordBulk(request?:
|
|
37
|
+
recordBulk(request?: Paid.UsageRecordBulkRequest, requestOptions?: Usage.RequestOptions): core.HttpResponsePromise<unknown[]>;
|
|
38
38
|
private __recordBulk;
|
|
39
39
|
protected _getAuthorizationHeader(): Promise<string>;
|
|
40
40
|
}
|
|
@@ -20,7 +20,7 @@ export class Usage {
|
|
|
20
20
|
this._options = _options;
|
|
21
21
|
}
|
|
22
22
|
/**
|
|
23
|
-
* @param {
|
|
23
|
+
* @param {Paid.UsageRecordBulkRequest} request
|
|
24
24
|
* @param {Usage.RequestOptions} requestOptions - Request-specific configuration.
|
|
25
25
|
*
|
|
26
26
|
* @example
|
|
@@ -33,7 +33,7 @@ export class Usage {
|
|
|
33
33
|
return __awaiter(this, arguments, void 0, function* (request = {}, requestOptions) {
|
|
34
34
|
var _a, _b, _c;
|
|
35
35
|
const _response = yield core.fetcher({
|
|
36
|
-
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.
|
|
36
|
+
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, "usage/signals/bulk"),
|
|
37
37
|
method: "POST",
|
|
38
38
|
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),
|
|
39
39
|
contentType: "application/json",
|
|
@@ -47,7 +47,7 @@ export class Usage {
|
|
|
47
47
|
return { data: _response.body, rawResponse: _response.rawResponse };
|
|
48
48
|
}
|
|
49
49
|
if (_response.error.reason === "status-code") {
|
|
50
|
-
throw new errors.
|
|
50
|
+
throw new errors.PaidError({
|
|
51
51
|
statusCode: _response.error.statusCode,
|
|
52
52
|
body: _response.error.body,
|
|
53
53
|
rawResponse: _response.rawResponse,
|
|
@@ -55,15 +55,15 @@ export class Usage {
|
|
|
55
55
|
}
|
|
56
56
|
switch (_response.error.reason) {
|
|
57
57
|
case "non-json":
|
|
58
|
-
throw new errors.
|
|
58
|
+
throw new errors.PaidError({
|
|
59
59
|
statusCode: _response.error.statusCode,
|
|
60
60
|
body: _response.error.rawBody,
|
|
61
61
|
rawResponse: _response.rawResponse,
|
|
62
62
|
});
|
|
63
63
|
case "timeout":
|
|
64
|
-
throw new errors.
|
|
64
|
+
throw new errors.PaidTimeoutError("Timeout exceeded when calling POST /usage/signals/bulk.");
|
|
65
65
|
case "unknown":
|
|
66
|
-
throw new errors.
|
|
66
|
+
throw new errors.PaidError({
|
|
67
67
|
message: _response.error.errorMessage,
|
|
68
68
|
rawResponse: _response.rawResponse,
|
|
69
69
|
});
|
|
@@ -1,11 +1,11 @@
|
|
|
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
|
* {}
|
|
8
8
|
*/
|
|
9
9
|
export interface UsageRecordBulkRequest {
|
|
10
|
-
signals?:
|
|
10
|
+
signals?: Paid.Signal[];
|
|
11
11
|
}
|
|
@@ -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
|
export interface Agent {
|
|
6
6
|
id: string;
|
|
7
7
|
externalId?: string;
|
|
@@ -10,5 +10,5 @@ export interface Agent {
|
|
|
10
10
|
description?: string;
|
|
11
11
|
active: boolean;
|
|
12
12
|
agentCode?: string;
|
|
13
|
-
agentAttributes?:
|
|
13
|
+
agentAttributes?: Paid.AgentAttribute[];
|
|
14
14
|
}
|
|
@@ -1,9 +1,9 @@
|
|
|
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
|
export interface AgentAttribute {
|
|
6
6
|
name: string;
|
|
7
7
|
active: boolean;
|
|
8
|
-
pricing:
|
|
8
|
+
pricing: Paid.Pricing;
|
|
9
9
|
}
|
|
@@ -1,10 +1,10 @@
|
|
|
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
|
export interface AgentPricePoint {
|
|
6
6
|
unitPrice?: number;
|
|
7
7
|
minQuantity?: number;
|
|
8
8
|
includedQuantity?: number;
|
|
9
|
-
tiers?:
|
|
9
|
+
tiers?: Paid.AgentPricePointTiers[];
|
|
10
10
|
}
|
|
@@ -1,12 +1,12 @@
|
|
|
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
|
export interface AgentUpdate {
|
|
6
6
|
name?: string;
|
|
7
7
|
description?: string;
|
|
8
8
|
externalId?: string;
|
|
9
9
|
active?: boolean;
|
|
10
10
|
agentCode?: string;
|
|
11
|
-
agentAttributes?:
|
|
11
|
+
agentAttributes?: Paid.AgentAttribute[];
|
|
12
12
|
}
|
|
@@ -1,14 +1,14 @@
|
|
|
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
|
export interface Contact {
|
|
6
6
|
id?: string;
|
|
7
7
|
externalId?: string;
|
|
8
8
|
organizationId?: string;
|
|
9
9
|
customerId?: string;
|
|
10
10
|
customerExternalId?: string;
|
|
11
|
-
salutation?:
|
|
11
|
+
salutation?: Paid.Salutation;
|
|
12
12
|
firstName?: string;
|
|
13
13
|
lastName?: string;
|
|
14
14
|
email?: string;
|
|
@@ -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
|
export interface Customer {
|
|
6
6
|
id: string;
|
|
7
7
|
organizationId: string;
|
|
@@ -10,9 +10,9 @@ export interface Customer {
|
|
|
10
10
|
phone?: string;
|
|
11
11
|
employeeCount?: number;
|
|
12
12
|
annualRevenue?: number;
|
|
13
|
-
taxExemptStatus?:
|
|
14
|
-
creationSource?:
|
|
15
|
-
creationState?:
|
|
13
|
+
taxExemptStatus?: Paid.TaxExemptStatus;
|
|
14
|
+
creationSource?: Paid.CreationSource;
|
|
15
|
+
creationState?: Paid.CreationState;
|
|
16
16
|
website?: string;
|
|
17
|
-
billingAddress?:
|
|
17
|
+
billingAddress?: Paid.Address;
|
|
18
18
|
}
|
|
@@ -1,15 +1,15 @@
|
|
|
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
|
export interface CustomerUpdate {
|
|
6
6
|
name?: string;
|
|
7
7
|
externalId?: string;
|
|
8
8
|
phone?: string;
|
|
9
9
|
employeeCount?: number;
|
|
10
10
|
annualRevenue?: number;
|
|
11
|
-
taxExemptStatus?:
|
|
12
|
-
creationSource?:
|
|
11
|
+
taxExemptStatus?: Paid.TaxExemptStatus;
|
|
12
|
+
creationSource?: Paid.CreationSource;
|
|
13
13
|
website?: string;
|
|
14
|
-
billingAddress?:
|
|
14
|
+
billingAddress?: Paid.Address;
|
|
15
15
|
}
|
|
@@ -1,10 +1,10 @@
|
|
|
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
|
* An error response from the Paid API
|
|
7
7
|
*/
|
|
8
8
|
export interface Error_ {
|
|
9
|
-
error:
|
|
9
|
+
error: Paid.ApiError;
|
|
10
10
|
}
|
|
@@ -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
|
export interface Order {
|
|
6
6
|
id?: string;
|
|
7
7
|
name?: string;
|
|
@@ -16,7 +16,7 @@ export interface Order {
|
|
|
16
16
|
billedTax?: number;
|
|
17
17
|
totalBilledAmount?: number;
|
|
18
18
|
pendingBillingAmount?: number;
|
|
19
|
-
creationState?:
|
|
20
|
-
orderLines?:
|
|
21
|
-
customer?:
|
|
19
|
+
creationState?: Paid.CreationState;
|
|
20
|
+
orderLines?: Paid.OrderLine[];
|
|
21
|
+
customer?: Paid.Customer;
|
|
22
22
|
}
|
|
@@ -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
|
export interface OrderLine {
|
|
6
6
|
id?: string;
|
|
7
7
|
orderId?: string;
|
|
@@ -14,7 +14,7 @@ export interface OrderLine {
|
|
|
14
14
|
billedAmountWithoutTax?: number;
|
|
15
15
|
billedTax?: number;
|
|
16
16
|
totalBilledAmount?: number;
|
|
17
|
-
creationState?:
|
|
18
|
-
agent?:
|
|
19
|
-
orderLineAttributes?:
|
|
17
|
+
creationState?: Paid.CreationState;
|
|
18
|
+
agent?: Paid.Agent;
|
|
19
|
+
orderLineAttributes?: Paid.OrderLineAttribute[];
|
|
20
20
|
}
|
|
@@ -1,10 +1,10 @@
|
|
|
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
|
export interface OrderLineAttribute {
|
|
6
6
|
agentAttributeId?: string;
|
|
7
7
|
quantity?: number;
|
|
8
8
|
currency?: string;
|
|
9
|
-
pricing?:
|
|
9
|
+
pricing?: Paid.OrderLineAttributePricing;
|
|
10
10
|
}
|
|
@@ -1,11 +1,11 @@
|
|
|
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
|
export interface OrderLineAttributePricing {
|
|
6
6
|
eventName?: string;
|
|
7
|
-
chargeType?:
|
|
8
|
-
pricePoint?:
|
|
9
|
-
pricingModel?:
|
|
10
|
-
billingFrequency?:
|
|
7
|
+
chargeType?: Paid.ChargeType;
|
|
8
|
+
pricePoint?: Paid.PricePoint;
|
|
9
|
+
pricingModel?: Paid.PricingModelType;
|
|
10
|
+
billingFrequency?: Paid.BillingFrequency;
|
|
11
11
|
}
|
|
@@ -1,10 +1,10 @@
|
|
|
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
|
export interface PricePoint {
|
|
6
6
|
currency?: string;
|
|
7
7
|
unitPrice?: number;
|
|
8
8
|
minQuantity?: number;
|
|
9
|
-
tiers?:
|
|
9
|
+
tiers?: Paid.Tier[];
|
|
10
10
|
}
|
|
@@ -1,12 +1,12 @@
|
|
|
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
|
export interface Pricing {
|
|
6
6
|
eventName?: string;
|
|
7
7
|
taxable: boolean;
|
|
8
|
-
chargeType:
|
|
9
|
-
pricingModel:
|
|
10
|
-
billingFrequency:
|
|
11
|
-
pricePoints: Record<string,
|
|
8
|
+
chargeType: Paid.ChargeType;
|
|
9
|
+
pricingModel: Paid.PricingModelType;
|
|
10
|
+
billingFrequency: Paid.BillingFrequency;
|
|
11
|
+
pricePoints: Record<string, Paid.AgentPricePoint>;
|
|
12
12
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* This file was auto-generated by Fern from our API Definition.
|
|
3
3
|
*/
|
|
4
|
-
export declare const
|
|
4
|
+
export declare const PaidEnvironment: {
|
|
5
5
|
readonly Production: "https://api.agentpaid.io/api/v1";
|
|
6
6
|
};
|
|
7
|
-
export type
|
|
7
|
+
export type PaidEnvironment = typeof PaidEnvironment.Production;
|