@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
|
@@ -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 Customers {
|
|
8
8
|
interface Options {
|
|
9
|
-
environment?: core.Supplier<environments.
|
|
9
|
+
environment?: core.Supplier<environments.PaidEnvironment | string>;
|
|
10
10
|
/** Specify a custom URL to connect the client to. */
|
|
11
11
|
baseUrl?: core.Supplier<string>;
|
|
12
12
|
token: core.Supplier<core.BearerToken>;
|
|
@@ -33,10 +33,10 @@ export declare class Customers {
|
|
|
33
33
|
* @example
|
|
34
34
|
* await client.customers.list()
|
|
35
35
|
*/
|
|
36
|
-
list(requestOptions?: Customers.RequestOptions): core.HttpResponsePromise<
|
|
36
|
+
list(requestOptions?: Customers.RequestOptions): core.HttpResponsePromise<Paid.Customer[]>;
|
|
37
37
|
private __list;
|
|
38
38
|
/**
|
|
39
|
-
* @param {
|
|
39
|
+
* @param {Paid.CustomerCreate} request
|
|
40
40
|
* @param {Customers.RequestOptions} requestOptions - Request-specific configuration.
|
|
41
41
|
*
|
|
42
42
|
* @example
|
|
@@ -44,7 +44,7 @@ export declare class Customers {
|
|
|
44
44
|
* name: "name"
|
|
45
45
|
* })
|
|
46
46
|
*/
|
|
47
|
-
create(request:
|
|
47
|
+
create(request: Paid.CustomerCreate, requestOptions?: Customers.RequestOptions): core.HttpResponsePromise<Paid.Customer>;
|
|
48
48
|
private __create;
|
|
49
49
|
/**
|
|
50
50
|
* @param {string} customerId
|
|
@@ -53,17 +53,17 @@ export declare class Customers {
|
|
|
53
53
|
* @example
|
|
54
54
|
* await client.customers.get("customerId")
|
|
55
55
|
*/
|
|
56
|
-
get(customerId: string, requestOptions?: Customers.RequestOptions): core.HttpResponsePromise<
|
|
56
|
+
get(customerId: string, requestOptions?: Customers.RequestOptions): core.HttpResponsePromise<Paid.Customer>;
|
|
57
57
|
private __get;
|
|
58
58
|
/**
|
|
59
59
|
* @param {string} customerId
|
|
60
|
-
* @param {
|
|
60
|
+
* @param {Paid.CustomerUpdate} request
|
|
61
61
|
* @param {Customers.RequestOptions} requestOptions - Request-specific configuration.
|
|
62
62
|
*
|
|
63
63
|
* @example
|
|
64
64
|
* await client.customers.update("customerId", {})
|
|
65
65
|
*/
|
|
66
|
-
update(customerId: string, request:
|
|
66
|
+
update(customerId: string, request: Paid.CustomerUpdate, requestOptions?: Customers.RequestOptions): core.HttpResponsePromise<Paid.Customer>;
|
|
67
67
|
private __update;
|
|
68
68
|
/**
|
|
69
69
|
* @param {string} customerId
|
|
@@ -81,17 +81,17 @@ export declare class Customers {
|
|
|
81
81
|
* @example
|
|
82
82
|
* await client.customers.getByExternalId("externalId")
|
|
83
83
|
*/
|
|
84
|
-
getByExternalId(externalId: string, requestOptions?: Customers.RequestOptions): core.HttpResponsePromise<
|
|
84
|
+
getByExternalId(externalId: string, requestOptions?: Customers.RequestOptions): core.HttpResponsePromise<Paid.Customer>;
|
|
85
85
|
private __getByExternalId;
|
|
86
86
|
/**
|
|
87
87
|
* @param {string} externalId
|
|
88
|
-
* @param {
|
|
88
|
+
* @param {Paid.CustomerUpdate} request
|
|
89
89
|
* @param {Customers.RequestOptions} requestOptions - Request-specific configuration.
|
|
90
90
|
*
|
|
91
91
|
* @example
|
|
92
92
|
* await client.customers.updateByExternalId("externalId", {})
|
|
93
93
|
*/
|
|
94
|
-
updateByExternalId(externalId: string, request:
|
|
94
|
+
updateByExternalId(externalId: string, request: Paid.CustomerUpdate, requestOptions?: Customers.RequestOptions): core.HttpResponsePromise<Paid.Customer>;
|
|
95
95
|
private __updateByExternalId;
|
|
96
96
|
/**
|
|
97
97
|
* @param {string} externalId
|
|
@@ -32,7 +32,7 @@ export class Customers {
|
|
|
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, "customers"),
|
|
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 Customers {
|
|
|
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 Customers {
|
|
|
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 /customers.");
|
|
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 Customers {
|
|
|
67
67
|
});
|
|
68
68
|
}
|
|
69
69
|
/**
|
|
70
|
-
* @param {
|
|
70
|
+
* @param {Paid.CustomerCreate} request
|
|
71
71
|
* @param {Customers.RequestOptions} requestOptions - Request-specific configuration.
|
|
72
72
|
*
|
|
73
73
|
* @example
|
|
@@ -82,7 +82,7 @@ export class Customers {
|
|
|
82
82
|
return __awaiter(this, void 0, void 0, function* () {
|
|
83
83
|
var _a, _b, _c;
|
|
84
84
|
const _response = yield core.fetcher({
|
|
85
|
-
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.
|
|
85
|
+
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, "customers"),
|
|
86
86
|
method: "POST",
|
|
87
87
|
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),
|
|
88
88
|
contentType: "application/json",
|
|
@@ -96,7 +96,7 @@ export class Customers {
|
|
|
96
96
|
return { data: _response.body, rawResponse: _response.rawResponse };
|
|
97
97
|
}
|
|
98
98
|
if (_response.error.reason === "status-code") {
|
|
99
|
-
throw new errors.
|
|
99
|
+
throw new errors.PaidError({
|
|
100
100
|
statusCode: _response.error.statusCode,
|
|
101
101
|
body: _response.error.body,
|
|
102
102
|
rawResponse: _response.rawResponse,
|
|
@@ -104,15 +104,15 @@ export class Customers {
|
|
|
104
104
|
}
|
|
105
105
|
switch (_response.error.reason) {
|
|
106
106
|
case "non-json":
|
|
107
|
-
throw new errors.
|
|
107
|
+
throw new errors.PaidError({
|
|
108
108
|
statusCode: _response.error.statusCode,
|
|
109
109
|
body: _response.error.rawBody,
|
|
110
110
|
rawResponse: _response.rawResponse,
|
|
111
111
|
});
|
|
112
112
|
case "timeout":
|
|
113
|
-
throw new errors.
|
|
113
|
+
throw new errors.PaidTimeoutError("Timeout exceeded when calling POST /customers.");
|
|
114
114
|
case "unknown":
|
|
115
|
-
throw new errors.
|
|
115
|
+
throw new errors.PaidError({
|
|
116
116
|
message: _response.error.errorMessage,
|
|
117
117
|
rawResponse: _response.rawResponse,
|
|
118
118
|
});
|
|
@@ -133,7 +133,7 @@ export class Customers {
|
|
|
133
133
|
return __awaiter(this, void 0, void 0, function* () {
|
|
134
134
|
var _a, _b, _c;
|
|
135
135
|
const _response = yield core.fetcher({
|
|
136
|
-
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.
|
|
136
|
+
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, `customers/${encodeURIComponent(customerId)}`),
|
|
137
137
|
method: "GET",
|
|
138
138
|
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),
|
|
139
139
|
timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
|
|
@@ -144,7 +144,7 @@ export class Customers {
|
|
|
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 @@ export class Customers {
|
|
|
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 GET /customers/{customerId}.");
|
|
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
|
});
|
|
@@ -169,7 +169,7 @@ export class Customers {
|
|
|
169
169
|
}
|
|
170
170
|
/**
|
|
171
171
|
* @param {string} customerId
|
|
172
|
-
* @param {
|
|
172
|
+
* @param {Paid.CustomerUpdate} request
|
|
173
173
|
* @param {Customers.RequestOptions} requestOptions - Request-specific configuration.
|
|
174
174
|
*
|
|
175
175
|
* @example
|
|
@@ -182,7 +182,7 @@ export class Customers {
|
|
|
182
182
|
return __awaiter(this, void 0, void 0, function* () {
|
|
183
183
|
var _a, _b, _c;
|
|
184
184
|
const _response = yield core.fetcher({
|
|
185
|
-
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.
|
|
185
|
+
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, `customers/${encodeURIComponent(customerId)}`),
|
|
186
186
|
method: "PUT",
|
|
187
187
|
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),
|
|
188
188
|
contentType: "application/json",
|
|
@@ -196,7 +196,7 @@ export class Customers {
|
|
|
196
196
|
return { data: _response.body, rawResponse: _response.rawResponse };
|
|
197
197
|
}
|
|
198
198
|
if (_response.error.reason === "status-code") {
|
|
199
|
-
throw new errors.
|
|
199
|
+
throw new errors.PaidError({
|
|
200
200
|
statusCode: _response.error.statusCode,
|
|
201
201
|
body: _response.error.body,
|
|
202
202
|
rawResponse: _response.rawResponse,
|
|
@@ -204,15 +204,15 @@ export class Customers {
|
|
|
204
204
|
}
|
|
205
205
|
switch (_response.error.reason) {
|
|
206
206
|
case "non-json":
|
|
207
|
-
throw new errors.
|
|
207
|
+
throw new errors.PaidError({
|
|
208
208
|
statusCode: _response.error.statusCode,
|
|
209
209
|
body: _response.error.rawBody,
|
|
210
210
|
rawResponse: _response.rawResponse,
|
|
211
211
|
});
|
|
212
212
|
case "timeout":
|
|
213
|
-
throw new errors.
|
|
213
|
+
throw new errors.PaidTimeoutError("Timeout exceeded when calling PUT /customers/{customerId}.");
|
|
214
214
|
case "unknown":
|
|
215
|
-
throw new errors.
|
|
215
|
+
throw new errors.PaidError({
|
|
216
216
|
message: _response.error.errorMessage,
|
|
217
217
|
rawResponse: _response.rawResponse,
|
|
218
218
|
});
|
|
@@ -233,7 +233,7 @@ export class Customers {
|
|
|
233
233
|
return __awaiter(this, void 0, void 0, function* () {
|
|
234
234
|
var _a, _b, _c;
|
|
235
235
|
const _response = yield core.fetcher({
|
|
236
|
-
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.
|
|
236
|
+
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, `customers/${encodeURIComponent(customerId)}`),
|
|
237
237
|
method: "DELETE",
|
|
238
238
|
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),
|
|
239
239
|
timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
|
|
@@ -244,7 +244,7 @@ export class Customers {
|
|
|
244
244
|
return { data: undefined, rawResponse: _response.rawResponse };
|
|
245
245
|
}
|
|
246
246
|
if (_response.error.reason === "status-code") {
|
|
247
|
-
throw new errors.
|
|
247
|
+
throw new errors.PaidError({
|
|
248
248
|
statusCode: _response.error.statusCode,
|
|
249
249
|
body: _response.error.body,
|
|
250
250
|
rawResponse: _response.rawResponse,
|
|
@@ -252,15 +252,15 @@ export class Customers {
|
|
|
252
252
|
}
|
|
253
253
|
switch (_response.error.reason) {
|
|
254
254
|
case "non-json":
|
|
255
|
-
throw new errors.
|
|
255
|
+
throw new errors.PaidError({
|
|
256
256
|
statusCode: _response.error.statusCode,
|
|
257
257
|
body: _response.error.rawBody,
|
|
258
258
|
rawResponse: _response.rawResponse,
|
|
259
259
|
});
|
|
260
260
|
case "timeout":
|
|
261
|
-
throw new errors.
|
|
261
|
+
throw new errors.PaidTimeoutError("Timeout exceeded when calling DELETE /customers/{customerId}.");
|
|
262
262
|
case "unknown":
|
|
263
|
-
throw new errors.
|
|
263
|
+
throw new errors.PaidError({
|
|
264
264
|
message: _response.error.errorMessage,
|
|
265
265
|
rawResponse: _response.rawResponse,
|
|
266
266
|
});
|
|
@@ -281,7 +281,7 @@ export class Customers {
|
|
|
281
281
|
return __awaiter(this, void 0, void 0, function* () {
|
|
282
282
|
var _a, _b, _c;
|
|
283
283
|
const _response = yield core.fetcher({
|
|
284
|
-
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.
|
|
284
|
+
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, `customers/external/${encodeURIComponent(externalId)}`),
|
|
285
285
|
method: "GET",
|
|
286
286
|
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),
|
|
287
287
|
timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
|
|
@@ -292,7 +292,7 @@ export class Customers {
|
|
|
292
292
|
return { data: _response.body, rawResponse: _response.rawResponse };
|
|
293
293
|
}
|
|
294
294
|
if (_response.error.reason === "status-code") {
|
|
295
|
-
throw new errors.
|
|
295
|
+
throw new errors.PaidError({
|
|
296
296
|
statusCode: _response.error.statusCode,
|
|
297
297
|
body: _response.error.body,
|
|
298
298
|
rawResponse: _response.rawResponse,
|
|
@@ -300,15 +300,15 @@ export class Customers {
|
|
|
300
300
|
}
|
|
301
301
|
switch (_response.error.reason) {
|
|
302
302
|
case "non-json":
|
|
303
|
-
throw new errors.
|
|
303
|
+
throw new errors.PaidError({
|
|
304
304
|
statusCode: _response.error.statusCode,
|
|
305
305
|
body: _response.error.rawBody,
|
|
306
306
|
rawResponse: _response.rawResponse,
|
|
307
307
|
});
|
|
308
308
|
case "timeout":
|
|
309
|
-
throw new errors.
|
|
309
|
+
throw new errors.PaidTimeoutError("Timeout exceeded when calling GET /customers/external/{externalId}.");
|
|
310
310
|
case "unknown":
|
|
311
|
-
throw new errors.
|
|
311
|
+
throw new errors.PaidError({
|
|
312
312
|
message: _response.error.errorMessage,
|
|
313
313
|
rawResponse: _response.rawResponse,
|
|
314
314
|
});
|
|
@@ -317,7 +317,7 @@ export class Customers {
|
|
|
317
317
|
}
|
|
318
318
|
/**
|
|
319
319
|
* @param {string} externalId
|
|
320
|
-
* @param {
|
|
320
|
+
* @param {Paid.CustomerUpdate} request
|
|
321
321
|
* @param {Customers.RequestOptions} requestOptions - Request-specific configuration.
|
|
322
322
|
*
|
|
323
323
|
* @example
|
|
@@ -330,7 +330,7 @@ export class Customers {
|
|
|
330
330
|
return __awaiter(this, void 0, void 0, function* () {
|
|
331
331
|
var _a, _b, _c;
|
|
332
332
|
const _response = yield core.fetcher({
|
|
333
|
-
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.
|
|
333
|
+
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, `customers/external/${encodeURIComponent(externalId)}`),
|
|
334
334
|
method: "PUT",
|
|
335
335
|
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),
|
|
336
336
|
contentType: "application/json",
|
|
@@ -344,7 +344,7 @@ export class Customers {
|
|
|
344
344
|
return { data: _response.body, rawResponse: _response.rawResponse };
|
|
345
345
|
}
|
|
346
346
|
if (_response.error.reason === "status-code") {
|
|
347
|
-
throw new errors.
|
|
347
|
+
throw new errors.PaidError({
|
|
348
348
|
statusCode: _response.error.statusCode,
|
|
349
349
|
body: _response.error.body,
|
|
350
350
|
rawResponse: _response.rawResponse,
|
|
@@ -352,15 +352,15 @@ export class Customers {
|
|
|
352
352
|
}
|
|
353
353
|
switch (_response.error.reason) {
|
|
354
354
|
case "non-json":
|
|
355
|
-
throw new errors.
|
|
355
|
+
throw new errors.PaidError({
|
|
356
356
|
statusCode: _response.error.statusCode,
|
|
357
357
|
body: _response.error.rawBody,
|
|
358
358
|
rawResponse: _response.rawResponse,
|
|
359
359
|
});
|
|
360
360
|
case "timeout":
|
|
361
|
-
throw new errors.
|
|
361
|
+
throw new errors.PaidTimeoutError("Timeout exceeded when calling PUT /customers/external/{externalId}.");
|
|
362
362
|
case "unknown":
|
|
363
|
-
throw new errors.
|
|
363
|
+
throw new errors.PaidError({
|
|
364
364
|
message: _response.error.errorMessage,
|
|
365
365
|
rawResponse: _response.rawResponse,
|
|
366
366
|
});
|
|
@@ -381,7 +381,7 @@ export class Customers {
|
|
|
381
381
|
return __awaiter(this, void 0, void 0, function* () {
|
|
382
382
|
var _a, _b, _c;
|
|
383
383
|
const _response = yield core.fetcher({
|
|
384
|
-
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.
|
|
384
|
+
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, `customers/external/${encodeURIComponent(externalId)}`),
|
|
385
385
|
method: "DELETE",
|
|
386
386
|
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),
|
|
387
387
|
timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
|
|
@@ -392,7 +392,7 @@ export class Customers {
|
|
|
392
392
|
return { data: undefined, rawResponse: _response.rawResponse };
|
|
393
393
|
}
|
|
394
394
|
if (_response.error.reason === "status-code") {
|
|
395
|
-
throw new errors.
|
|
395
|
+
throw new errors.PaidError({
|
|
396
396
|
statusCode: _response.error.statusCode,
|
|
397
397
|
body: _response.error.body,
|
|
398
398
|
rawResponse: _response.rawResponse,
|
|
@@ -400,15 +400,15 @@ export class Customers {
|
|
|
400
400
|
}
|
|
401
401
|
switch (_response.error.reason) {
|
|
402
402
|
case "non-json":
|
|
403
|
-
throw new errors.
|
|
403
|
+
throw new errors.PaidError({
|
|
404
404
|
statusCode: _response.error.statusCode,
|
|
405
405
|
body: _response.error.rawBody,
|
|
406
406
|
rawResponse: _response.rawResponse,
|
|
407
407
|
});
|
|
408
408
|
case "timeout":
|
|
409
|
-
throw new errors.
|
|
409
|
+
throw new errors.PaidTimeoutError("Timeout exceeded when calling DELETE /customers/external/{externalId}.");
|
|
410
410
|
case "unknown":
|
|
411
|
-
throw new errors.
|
|
411
|
+
throw new errors.PaidError({
|
|
412
412
|
message: _response.error.errorMessage,
|
|
413
413
|
rawResponse: _response.rawResponse,
|
|
414
414
|
});
|
|
@@ -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
|
* {
|
|
@@ -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.mjs";
|
|
5
5
|
import * as core from "../../../../core/index.mjs";
|
|
6
|
-
import * as
|
|
6
|
+
import * as Paid from "../../../index.mjs";
|
|
7
7
|
import { Lines } from "../resources/lines/client/Client.mjs";
|
|
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
|
}
|