@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
|
@@ -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
|
* {
|
|
@@ -14,8 +14,8 @@ export interface CustomerCreate {
|
|
|
14
14
|
phone?: string;
|
|
15
15
|
employeeCount?: number;
|
|
16
16
|
annualRevenue?: number;
|
|
17
|
-
taxExemptStatus?:
|
|
18
|
-
creationSource?:
|
|
17
|
+
taxExemptStatus?: Paid.TaxExemptStatus;
|
|
18
|
+
creationSource?: Paid.CreationSource;
|
|
19
19
|
website?: string;
|
|
20
|
-
billingAddress?:
|
|
20
|
+
billingAddress?: Paid.Address;
|
|
21
21
|
}
|
|
@@ -3,11 +3,11 @@
|
|
|
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
|
import { Lines } from "../resources/lines/client/Client.js";
|
|
8
8
|
export declare namespace Orders {
|
|
9
9
|
interface Options {
|
|
10
|
-
environment?: core.Supplier<environments.
|
|
10
|
+
environment?: core.Supplier<environments.PaidEnvironment | string>;
|
|
11
11
|
/** Specify a custom URL to connect the client to. */
|
|
12
12
|
baseUrl?: core.Supplier<string>;
|
|
13
13
|
token: core.Supplier<core.BearerToken>;
|
|
@@ -36,10 +36,10 @@ export declare class Orders {
|
|
|
36
36
|
* @example
|
|
37
37
|
* await client.orders.list()
|
|
38
38
|
*/
|
|
39
|
-
list(requestOptions?: Orders.RequestOptions): core.HttpResponsePromise<
|
|
39
|
+
list(requestOptions?: Orders.RequestOptions): core.HttpResponsePromise<Paid.Order[]>;
|
|
40
40
|
private __list;
|
|
41
41
|
/**
|
|
42
|
-
* @param {
|
|
42
|
+
* @param {Paid.OrderCreate} request
|
|
43
43
|
* @param {Orders.RequestOptions} requestOptions - Request-specific configuration.
|
|
44
44
|
*
|
|
45
45
|
* @example
|
|
@@ -51,7 +51,7 @@ export declare class Orders {
|
|
|
51
51
|
* currency: "currency"
|
|
52
52
|
* })
|
|
53
53
|
*/
|
|
54
|
-
create(request:
|
|
54
|
+
create(request: Paid.OrderCreate, requestOptions?: Orders.RequestOptions): core.HttpResponsePromise<Paid.Order>;
|
|
55
55
|
private __create;
|
|
56
56
|
/**
|
|
57
57
|
* @param {string} orderId
|
|
@@ -60,7 +60,7 @@ export declare class Orders {
|
|
|
60
60
|
* @example
|
|
61
61
|
* await client.orders.get("orderId")
|
|
62
62
|
*/
|
|
63
|
-
get(orderId: string, requestOptions?: Orders.RequestOptions): core.HttpResponsePromise<
|
|
63
|
+
get(orderId: string, requestOptions?: Orders.RequestOptions): core.HttpResponsePromise<Paid.Order>;
|
|
64
64
|
private __get;
|
|
65
65
|
/**
|
|
66
66
|
* @param {string} orderId
|
|
@@ -78,7 +78,7 @@ export declare class Orders {
|
|
|
78
78
|
* @example
|
|
79
79
|
* await client.orders.activate("orderId")
|
|
80
80
|
*/
|
|
81
|
-
activate(orderId: string, requestOptions?: Orders.RequestOptions): core.HttpResponsePromise<
|
|
81
|
+
activate(orderId: string, requestOptions?: Orders.RequestOptions): core.HttpResponsePromise<Paid.Order>;
|
|
82
82
|
private __activate;
|
|
83
83
|
protected _getAuthorizationHeader(): Promise<string>;
|
|
84
84
|
}
|
|
@@ -76,7 +76,7 @@ class Orders {
|
|
|
76
76
|
return __awaiter(this, void 0, void 0, function* () {
|
|
77
77
|
var _a, _b, _c;
|
|
78
78
|
const _response = yield core.fetcher({
|
|
79
|
-
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.
|
|
79
|
+
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, "orders"),
|
|
80
80
|
method: "GET",
|
|
81
81
|
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),
|
|
82
82
|
timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
|
|
@@ -87,7 +87,7 @@ class Orders {
|
|
|
87
87
|
return { data: _response.body, rawResponse: _response.rawResponse };
|
|
88
88
|
}
|
|
89
89
|
if (_response.error.reason === "status-code") {
|
|
90
|
-
throw new errors.
|
|
90
|
+
throw new errors.PaidError({
|
|
91
91
|
statusCode: _response.error.statusCode,
|
|
92
92
|
body: _response.error.body,
|
|
93
93
|
rawResponse: _response.rawResponse,
|
|
@@ -95,15 +95,15 @@ class Orders {
|
|
|
95
95
|
}
|
|
96
96
|
switch (_response.error.reason) {
|
|
97
97
|
case "non-json":
|
|
98
|
-
throw new errors.
|
|
98
|
+
throw new errors.PaidError({
|
|
99
99
|
statusCode: _response.error.statusCode,
|
|
100
100
|
body: _response.error.rawBody,
|
|
101
101
|
rawResponse: _response.rawResponse,
|
|
102
102
|
});
|
|
103
103
|
case "timeout":
|
|
104
|
-
throw new errors.
|
|
104
|
+
throw new errors.PaidTimeoutError("Timeout exceeded when calling GET /orders.");
|
|
105
105
|
case "unknown":
|
|
106
|
-
throw new errors.
|
|
106
|
+
throw new errors.PaidError({
|
|
107
107
|
message: _response.error.errorMessage,
|
|
108
108
|
rawResponse: _response.rawResponse,
|
|
109
109
|
});
|
|
@@ -111,7 +111,7 @@ class Orders {
|
|
|
111
111
|
});
|
|
112
112
|
}
|
|
113
113
|
/**
|
|
114
|
-
* @param {
|
|
114
|
+
* @param {Paid.OrderCreate} request
|
|
115
115
|
* @param {Orders.RequestOptions} requestOptions - Request-specific configuration.
|
|
116
116
|
*
|
|
117
117
|
* @example
|
|
@@ -130,7 +130,7 @@ class Orders {
|
|
|
130
130
|
return __awaiter(this, void 0, void 0, function* () {
|
|
131
131
|
var _a, _b, _c;
|
|
132
132
|
const _response = yield core.fetcher({
|
|
133
|
-
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.
|
|
133
|
+
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, "orders"),
|
|
134
134
|
method: "POST",
|
|
135
135
|
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),
|
|
136
136
|
contentType: "application/json",
|
|
@@ -144,7 +144,7 @@ class Orders {
|
|
|
144
144
|
return { data: _response.body, rawResponse: _response.rawResponse };
|
|
145
145
|
}
|
|
146
146
|
if (_response.error.reason === "status-code") {
|
|
147
|
-
throw new errors.
|
|
147
|
+
throw new errors.PaidError({
|
|
148
148
|
statusCode: _response.error.statusCode,
|
|
149
149
|
body: _response.error.body,
|
|
150
150
|
rawResponse: _response.rawResponse,
|
|
@@ -152,15 +152,15 @@ class Orders {
|
|
|
152
152
|
}
|
|
153
153
|
switch (_response.error.reason) {
|
|
154
154
|
case "non-json":
|
|
155
|
-
throw new errors.
|
|
155
|
+
throw new errors.PaidError({
|
|
156
156
|
statusCode: _response.error.statusCode,
|
|
157
157
|
body: _response.error.rawBody,
|
|
158
158
|
rawResponse: _response.rawResponse,
|
|
159
159
|
});
|
|
160
160
|
case "timeout":
|
|
161
|
-
throw new errors.
|
|
161
|
+
throw new errors.PaidTimeoutError("Timeout exceeded when calling POST /orders.");
|
|
162
162
|
case "unknown":
|
|
163
|
-
throw new errors.
|
|
163
|
+
throw new errors.PaidError({
|
|
164
164
|
message: _response.error.errorMessage,
|
|
165
165
|
rawResponse: _response.rawResponse,
|
|
166
166
|
});
|
|
@@ -181,7 +181,7 @@ class Orders {
|
|
|
181
181
|
return __awaiter(this, void 0, void 0, function* () {
|
|
182
182
|
var _a, _b, _c;
|
|
183
183
|
const _response = yield core.fetcher({
|
|
184
|
-
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.
|
|
184
|
+
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, `orders/${encodeURIComponent(orderId)}`),
|
|
185
185
|
method: "GET",
|
|
186
186
|
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),
|
|
187
187
|
timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
|
|
@@ -192,7 +192,7 @@ class Orders {
|
|
|
192
192
|
return { data: _response.body, rawResponse: _response.rawResponse };
|
|
193
193
|
}
|
|
194
194
|
if (_response.error.reason === "status-code") {
|
|
195
|
-
throw new errors.
|
|
195
|
+
throw new errors.PaidError({
|
|
196
196
|
statusCode: _response.error.statusCode,
|
|
197
197
|
body: _response.error.body,
|
|
198
198
|
rawResponse: _response.rawResponse,
|
|
@@ -200,15 +200,15 @@ class Orders {
|
|
|
200
200
|
}
|
|
201
201
|
switch (_response.error.reason) {
|
|
202
202
|
case "non-json":
|
|
203
|
-
throw new errors.
|
|
203
|
+
throw new errors.PaidError({
|
|
204
204
|
statusCode: _response.error.statusCode,
|
|
205
205
|
body: _response.error.rawBody,
|
|
206
206
|
rawResponse: _response.rawResponse,
|
|
207
207
|
});
|
|
208
208
|
case "timeout":
|
|
209
|
-
throw new errors.
|
|
209
|
+
throw new errors.PaidTimeoutError("Timeout exceeded when calling GET /orders/{orderId}.");
|
|
210
210
|
case "unknown":
|
|
211
|
-
throw new errors.
|
|
211
|
+
throw new errors.PaidError({
|
|
212
212
|
message: _response.error.errorMessage,
|
|
213
213
|
rawResponse: _response.rawResponse,
|
|
214
214
|
});
|
|
@@ -229,7 +229,7 @@ class Orders {
|
|
|
229
229
|
return __awaiter(this, void 0, void 0, function* () {
|
|
230
230
|
var _a, _b, _c;
|
|
231
231
|
const _response = yield core.fetcher({
|
|
232
|
-
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.
|
|
232
|
+
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, `orders/${encodeURIComponent(orderId)}`),
|
|
233
233
|
method: "DELETE",
|
|
234
234
|
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),
|
|
235
235
|
timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
|
|
@@ -240,7 +240,7 @@ class Orders {
|
|
|
240
240
|
return { data: undefined, rawResponse: _response.rawResponse };
|
|
241
241
|
}
|
|
242
242
|
if (_response.error.reason === "status-code") {
|
|
243
|
-
throw new errors.
|
|
243
|
+
throw new errors.PaidError({
|
|
244
244
|
statusCode: _response.error.statusCode,
|
|
245
245
|
body: _response.error.body,
|
|
246
246
|
rawResponse: _response.rawResponse,
|
|
@@ -248,15 +248,15 @@ class Orders {
|
|
|
248
248
|
}
|
|
249
249
|
switch (_response.error.reason) {
|
|
250
250
|
case "non-json":
|
|
251
|
-
throw new errors.
|
|
251
|
+
throw new errors.PaidError({
|
|
252
252
|
statusCode: _response.error.statusCode,
|
|
253
253
|
body: _response.error.rawBody,
|
|
254
254
|
rawResponse: _response.rawResponse,
|
|
255
255
|
});
|
|
256
256
|
case "timeout":
|
|
257
|
-
throw new errors.
|
|
257
|
+
throw new errors.PaidTimeoutError("Timeout exceeded when calling DELETE /orders/{orderId}.");
|
|
258
258
|
case "unknown":
|
|
259
|
-
throw new errors.
|
|
259
|
+
throw new errors.PaidError({
|
|
260
260
|
message: _response.error.errorMessage,
|
|
261
261
|
rawResponse: _response.rawResponse,
|
|
262
262
|
});
|
|
@@ -277,7 +277,7 @@ class Orders {
|
|
|
277
277
|
return __awaiter(this, void 0, void 0, function* () {
|
|
278
278
|
var _a, _b, _c;
|
|
279
279
|
const _response = yield core.fetcher({
|
|
280
|
-
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.
|
|
280
|
+
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, `orders/${encodeURIComponent(orderId)}/activate`),
|
|
281
281
|
method: "POST",
|
|
282
282
|
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),
|
|
283
283
|
timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
|
|
@@ -288,7 +288,7 @@ class Orders {
|
|
|
288
288
|
return { data: _response.body, rawResponse: _response.rawResponse };
|
|
289
289
|
}
|
|
290
290
|
if (_response.error.reason === "status-code") {
|
|
291
|
-
throw new errors.
|
|
291
|
+
throw new errors.PaidError({
|
|
292
292
|
statusCode: _response.error.statusCode,
|
|
293
293
|
body: _response.error.body,
|
|
294
294
|
rawResponse: _response.rawResponse,
|
|
@@ -296,15 +296,15 @@ class Orders {
|
|
|
296
296
|
}
|
|
297
297
|
switch (_response.error.reason) {
|
|
298
298
|
case "non-json":
|
|
299
|
-
throw new errors.
|
|
299
|
+
throw new errors.PaidError({
|
|
300
300
|
statusCode: _response.error.statusCode,
|
|
301
301
|
body: _response.error.rawBody,
|
|
302
302
|
rawResponse: _response.rawResponse,
|
|
303
303
|
});
|
|
304
304
|
case "timeout":
|
|
305
|
-
throw new errors.
|
|
305
|
+
throw new errors.PaidTimeoutError("Timeout exceeded when calling POST /orders/{orderId}/activate.");
|
|
306
306
|
case "unknown":
|
|
307
|
-
throw new errors.
|
|
307
|
+
throw new errors.PaidError({
|
|
308
308
|
message: _response.error.errorMessage,
|
|
309
309
|
rawResponse: _response.rawResponse,
|
|
310
310
|
});
|
|
@@ -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
|
* {
|
|
@@ -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.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 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
|
}
|
|
@@ -60,7 +60,7 @@ class Lines {
|
|
|
60
60
|
}
|
|
61
61
|
/**
|
|
62
62
|
* @param {string} orderId
|
|
63
|
-
* @param {
|
|
63
|
+
* @param {Paid.orders.LinesUpdateRequest} request
|
|
64
64
|
* @param {Lines.RequestOptions} requestOptions - Request-specific configuration.
|
|
65
65
|
*
|
|
66
66
|
* @example
|
|
@@ -73,7 +73,7 @@ class Lines {
|
|
|
73
73
|
return __awaiter(this, arguments, void 0, function* (orderId, request = {}, requestOptions) {
|
|
74
74
|
var _a, _b, _c;
|
|
75
75
|
const _response = yield core.fetcher({
|
|
76
|
-
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.
|
|
76
|
+
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, `orders/${encodeURIComponent(orderId)}/lines`),
|
|
77
77
|
method: "PUT",
|
|
78
78
|
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),
|
|
79
79
|
contentType: "application/json",
|
|
@@ -87,7 +87,7 @@ class Lines {
|
|
|
87
87
|
return { data: _response.body, rawResponse: _response.rawResponse };
|
|
88
88
|
}
|
|
89
89
|
if (_response.error.reason === "status-code") {
|
|
90
|
-
throw new errors.
|
|
90
|
+
throw new errors.PaidError({
|
|
91
91
|
statusCode: _response.error.statusCode,
|
|
92
92
|
body: _response.error.body,
|
|
93
93
|
rawResponse: _response.rawResponse,
|
|
@@ -95,15 +95,15 @@ class Lines {
|
|
|
95
95
|
}
|
|
96
96
|
switch (_response.error.reason) {
|
|
97
97
|
case "non-json":
|
|
98
|
-
throw new errors.
|
|
98
|
+
throw new errors.PaidError({
|
|
99
99
|
statusCode: _response.error.statusCode,
|
|
100
100
|
body: _response.error.rawBody,
|
|
101
101
|
rawResponse: _response.rawResponse,
|
|
102
102
|
});
|
|
103
103
|
case "timeout":
|
|
104
|
-
throw new errors.
|
|
104
|
+
throw new errors.PaidTimeoutError("Timeout exceeded when calling PUT /orders/{orderId}/lines.");
|
|
105
105
|
case "unknown":
|
|
106
|
-
throw new errors.
|
|
106
|
+
throw new errors.PaidError({
|
|
107
107
|
message: _response.error.errorMessage,
|
|
108
108
|
rawResponse: _response.rawResponse,
|
|
109
109
|
});
|
package/dist/cjs/api/resources/orders/resources/lines/client/requests/LinesUpdateRequest.d.ts
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.js";
|
|
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.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 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
|
}
|
|
@@ -59,7 +59,7 @@ class Usage {
|
|
|
59
59
|
this._options = _options;
|
|
60
60
|
}
|
|
61
61
|
/**
|
|
62
|
-
* @param {
|
|
62
|
+
* @param {Paid.UsageRecordBulkRequest} request
|
|
63
63
|
* @param {Usage.RequestOptions} requestOptions - Request-specific configuration.
|
|
64
64
|
*
|
|
65
65
|
* @example
|
|
@@ -72,7 +72,7 @@ class Usage {
|
|
|
72
72
|
return __awaiter(this, arguments, void 0, function* (request = {}, requestOptions) {
|
|
73
73
|
var _a, _b, _c;
|
|
74
74
|
const _response = yield core.fetcher({
|
|
75
|
-
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.
|
|
75
|
+
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, "usage/signals/bulk"),
|
|
76
76
|
method: "POST",
|
|
77
77
|
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),
|
|
78
78
|
contentType: "application/json",
|
|
@@ -86,7 +86,7 @@ class Usage {
|
|
|
86
86
|
return { data: _response.body, rawResponse: _response.rawResponse };
|
|
87
87
|
}
|
|
88
88
|
if (_response.error.reason === "status-code") {
|
|
89
|
-
throw new errors.
|
|
89
|
+
throw new errors.PaidError({
|
|
90
90
|
statusCode: _response.error.statusCode,
|
|
91
91
|
body: _response.error.body,
|
|
92
92
|
rawResponse: _response.rawResponse,
|
|
@@ -94,15 +94,15 @@ class Usage {
|
|
|
94
94
|
}
|
|
95
95
|
switch (_response.error.reason) {
|
|
96
96
|
case "non-json":
|
|
97
|
-
throw new errors.
|
|
97
|
+
throw new errors.PaidError({
|
|
98
98
|
statusCode: _response.error.statusCode,
|
|
99
99
|
body: _response.error.rawBody,
|
|
100
100
|
rawResponse: _response.rawResponse,
|
|
101
101
|
});
|
|
102
102
|
case "timeout":
|
|
103
|
-
throw new errors.
|
|
103
|
+
throw new errors.PaidTimeoutError("Timeout exceeded when calling POST /usage/signals/bulk.");
|
|
104
104
|
case "unknown":
|
|
105
|
-
throw new errors.
|
|
105
|
+
throw new errors.PaidError({
|
|
106
106
|
message: _response.error.errorMessage,
|
|
107
107
|
rawResponse: _response.rawResponse,
|
|
108
108
|
});
|
|
@@ -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.js";
|
|
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.js";
|
|
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.js";
|
|
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.js";
|
|
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.js";
|
|
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.js";
|
|
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.js";
|
|
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.js";
|
|
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.js";
|
|
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.js";
|
|
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.js";
|
|
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
|
}
|