@paid-ai/paid-node 0.2.1 → 0.3.0
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/dist/cjs/Client.js +2 -2
- package/dist/cjs/api/errors/ForbiddenError.d.ts +9 -0
- package/dist/cjs/api/errors/ForbiddenError.js +52 -0
- package/dist/cjs/api/errors/index.d.ts +1 -0
- package/dist/cjs/api/errors/index.js +17 -0
- package/dist/cjs/api/index.d.ts +1 -0
- package/dist/cjs/api/index.js +1 -0
- package/dist/cjs/api/resources/agents/client/Client.d.ts +3 -3
- package/dist/cjs/api/resources/agents/client/Client.js +6 -2
- package/dist/cjs/api/resources/contacts/client/Client.d.ts +3 -3
- package/dist/cjs/api/resources/contacts/client/Client.js +6 -2
- package/dist/cjs/api/resources/customers/client/Client.d.ts +14 -3
- package/dist/cjs/api/resources/customers/client/Client.js +62 -2
- package/dist/cjs/api/resources/orders/client/Client.d.ts +13 -3
- package/dist/cjs/api/resources/orders/client/Client.js +16 -2
- package/dist/cjs/api/resources/orders/client/requests/OrderCreate.d.ts +10 -0
- package/dist/cjs/api/resources/orders/resources/lines/client/Client.d.ts +3 -3
- package/dist/cjs/api/resources/orders/resources/lines/client/Client.js +6 -2
- package/dist/cjs/api/resources/usage/client/Client.d.ts +3 -3
- package/dist/cjs/api/resources/usage/client/Client.js +6 -2
- package/dist/cjs/api/types/EntitlementUsage.d.ts +23 -0
- package/dist/cjs/api/types/EntitlementUsage.js +5 -0
- package/dist/cjs/api/types/OrderLineAttributeCreate.d.ts +12 -0
- package/dist/cjs/api/types/OrderLineAttributeCreate.js +5 -0
- package/dist/cjs/api/types/OrderLineCreate.d.ts +7 -0
- package/dist/cjs/api/types/index.d.ts +2 -0
- package/dist/cjs/api/types/index.js +2 -0
- package/dist/cjs/index.d.ts +1 -1
- package/dist/cjs/index.js +3 -3
- package/dist/cjs/version.d.ts +1 -1
- package/dist/cjs/version.js +1 -1
- package/dist/esm/Client.mjs +2 -2
- package/dist/esm/api/errors/ForbiddenError.d.mts +9 -0
- package/dist/esm/api/errors/ForbiddenError.mjs +15 -0
- package/dist/esm/api/errors/index.d.mts +1 -0
- package/dist/esm/api/errors/index.mjs +1 -0
- package/dist/esm/api/index.d.mts +1 -0
- package/dist/esm/api/index.mjs +1 -0
- package/dist/esm/api/resources/agents/client/Client.d.mts +3 -3
- package/dist/esm/api/resources/agents/client/Client.mjs +6 -2
- package/dist/esm/api/resources/contacts/client/Client.d.mts +3 -3
- package/dist/esm/api/resources/contacts/client/Client.mjs +6 -2
- package/dist/esm/api/resources/customers/client/Client.d.mts +14 -3
- package/dist/esm/api/resources/customers/client/Client.mjs +62 -2
- package/dist/esm/api/resources/orders/client/Client.d.mts +13 -3
- package/dist/esm/api/resources/orders/client/Client.mjs +16 -2
- package/dist/esm/api/resources/orders/client/requests/OrderCreate.d.mts +10 -0
- package/dist/esm/api/resources/orders/resources/lines/client/Client.d.mts +3 -3
- package/dist/esm/api/resources/orders/resources/lines/client/Client.mjs +6 -2
- package/dist/esm/api/resources/usage/client/Client.d.mts +3 -3
- package/dist/esm/api/resources/usage/client/Client.mjs +6 -2
- package/dist/esm/api/types/EntitlementUsage.d.mts +23 -0
- package/dist/esm/api/types/EntitlementUsage.mjs +4 -0
- package/dist/esm/api/types/OrderLineAttributeCreate.d.mts +12 -0
- package/dist/esm/api/types/OrderLineAttributeCreate.mjs +4 -0
- package/dist/esm/api/types/OrderLineCreate.d.mts +7 -0
- package/dist/esm/api/types/index.d.mts +2 -0
- package/dist/esm/api/types/index.mjs +2 -0
- package/dist/esm/index.d.mts +1 -1
- package/dist/esm/index.mjs +1 -1
- package/dist/esm/version.d.mts +1 -1
- package/dist/esm/version.mjs +1 -1
- package/package.json +1 -1
- package/reference.md +48 -0
package/dist/cjs/version.js
CHANGED
package/dist/esm/Client.mjs
CHANGED
|
@@ -24,8 +24,8 @@ export class PaidClient {
|
|
|
24
24
|
this._options = Object.assign(Object.assign({}, _options), { headers: mergeHeaders({
|
|
25
25
|
"X-Fern-Language": "JavaScript",
|
|
26
26
|
"X-Fern-SDK-Name": "@paid-ai/paid-node",
|
|
27
|
-
"X-Fern-SDK-Version": "0.
|
|
28
|
-
"User-Agent": "@paid-ai/paid-node/0.
|
|
27
|
+
"X-Fern-SDK-Version": "0.3.0",
|
|
28
|
+
"User-Agent": "@paid-ai/paid-node/0.3.0",
|
|
29
29
|
"X-Fern-Runtime": core.RUNTIME.type,
|
|
30
30
|
"X-Fern-Runtime-Version": core.RUNTIME.version,
|
|
31
31
|
}, _options === null || _options === void 0 ? void 0 : _options.headers) });
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This file was auto-generated by Fern from our API Definition.
|
|
3
|
+
*/
|
|
4
|
+
import * as errors from "../../errors/index.mjs";
|
|
5
|
+
import * as Paid from "../index.mjs";
|
|
6
|
+
import * as core from "../../core/index.mjs";
|
|
7
|
+
export declare class ForbiddenError extends errors.PaidError {
|
|
8
|
+
constructor(body: Paid.Error_, rawResponse?: core.RawResponse);
|
|
9
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This file was auto-generated by Fern from our API Definition.
|
|
3
|
+
*/
|
|
4
|
+
import * as errors from "../../errors/index.mjs";
|
|
5
|
+
export class ForbiddenError extends errors.PaidError {
|
|
6
|
+
constructor(body, rawResponse) {
|
|
7
|
+
super({
|
|
8
|
+
message: "ForbiddenError",
|
|
9
|
+
statusCode: 403,
|
|
10
|
+
body: body,
|
|
11
|
+
rawResponse: rawResponse,
|
|
12
|
+
});
|
|
13
|
+
Object.setPrototypeOf(this, ForbiddenError.prototype);
|
|
14
|
+
}
|
|
15
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./ForbiddenError.mjs";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./ForbiddenError.mjs";
|
package/dist/esm/api/index.d.mts
CHANGED
package/dist/esm/api/index.mjs
CHANGED
|
@@ -9,7 +9,7 @@ export declare namespace Agents {
|
|
|
9
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
|
-
token
|
|
12
|
+
token?: core.Supplier<core.BearerToken | undefined>;
|
|
13
13
|
/** Additional headers to include in requests. */
|
|
14
14
|
headers?: Record<string, string | core.Supplier<string | undefined> | undefined>;
|
|
15
15
|
}
|
|
@@ -26,7 +26,7 @@ export declare namespace Agents {
|
|
|
26
26
|
}
|
|
27
27
|
export declare class Agents {
|
|
28
28
|
protected readonly _options: Agents.Options;
|
|
29
|
-
constructor(_options
|
|
29
|
+
constructor(_options?: Agents.Options);
|
|
30
30
|
/**
|
|
31
31
|
* @param {Agents.RequestOptions} requestOptions - Request-specific configuration.
|
|
32
32
|
*
|
|
@@ -151,5 +151,5 @@ export declare class Agents {
|
|
|
151
151
|
*/
|
|
152
152
|
deleteByExternalId(externalId: string, requestOptions?: Agents.RequestOptions): core.HttpResponsePromise<void>;
|
|
153
153
|
private __deleteByExternalId;
|
|
154
|
-
protected _getAuthorizationHeader(): Promise<string>;
|
|
154
|
+
protected _getAuthorizationHeader(): Promise<string | undefined>;
|
|
155
155
|
}
|
|
@@ -16,7 +16,7 @@ import { mergeHeaders, mergeOnlyDefinedHeaders } from "../../../../core/headers.
|
|
|
16
16
|
import urlJoin from "url-join";
|
|
17
17
|
import * as errors from "../../../../errors/index.mjs";
|
|
18
18
|
export class Agents {
|
|
19
|
-
constructor(_options) {
|
|
19
|
+
constructor(_options = {}) {
|
|
20
20
|
this._options = _options;
|
|
21
21
|
}
|
|
22
22
|
/**
|
|
@@ -466,7 +466,11 @@ export class Agents {
|
|
|
466
466
|
}
|
|
467
467
|
_getAuthorizationHeader() {
|
|
468
468
|
return __awaiter(this, void 0, void 0, function* () {
|
|
469
|
-
|
|
469
|
+
const bearer = yield core.Supplier.get(this._options.token);
|
|
470
|
+
if (bearer != null) {
|
|
471
|
+
return `Bearer ${bearer}`;
|
|
472
|
+
}
|
|
473
|
+
return undefined;
|
|
470
474
|
});
|
|
471
475
|
}
|
|
472
476
|
}
|
|
@@ -9,7 +9,7 @@ export declare namespace Contacts {
|
|
|
9
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
|
-
token
|
|
12
|
+
token?: core.Supplier<core.BearerToken | undefined>;
|
|
13
13
|
/** Additional headers to include in requests. */
|
|
14
14
|
headers?: Record<string, string | core.Supplier<string | undefined> | undefined>;
|
|
15
15
|
}
|
|
@@ -26,7 +26,7 @@ export declare namespace Contacts {
|
|
|
26
26
|
}
|
|
27
27
|
export declare class Contacts {
|
|
28
28
|
protected readonly _options: Contacts.Options;
|
|
29
|
-
constructor(_options
|
|
29
|
+
constructor(_options?: Contacts.Options);
|
|
30
30
|
/**
|
|
31
31
|
* @param {Contacts.RequestOptions} requestOptions - Request-specific configuration.
|
|
32
32
|
*
|
|
@@ -86,5 +86,5 @@ export declare class Contacts {
|
|
|
86
86
|
*/
|
|
87
87
|
deleteByExternalId(externalId: string, requestOptions?: Contacts.RequestOptions): core.HttpResponsePromise<void>;
|
|
88
88
|
private __deleteByExternalId;
|
|
89
|
-
protected _getAuthorizationHeader(): Promise<string>;
|
|
89
|
+
protected _getAuthorizationHeader(): Promise<string | undefined>;
|
|
90
90
|
}
|
|
@@ -16,7 +16,7 @@ import { mergeHeaders, mergeOnlyDefinedHeaders } from "../../../../core/headers.
|
|
|
16
16
|
import urlJoin from "url-join";
|
|
17
17
|
import * as errors from "../../../../errors/index.mjs";
|
|
18
18
|
export class Contacts {
|
|
19
|
-
constructor(_options) {
|
|
19
|
+
constructor(_options = {}) {
|
|
20
20
|
this._options = _options;
|
|
21
21
|
}
|
|
22
22
|
/**
|
|
@@ -317,7 +317,11 @@ export class Contacts {
|
|
|
317
317
|
}
|
|
318
318
|
_getAuthorizationHeader() {
|
|
319
319
|
return __awaiter(this, void 0, void 0, function* () {
|
|
320
|
-
|
|
320
|
+
const bearer = yield core.Supplier.get(this._options.token);
|
|
321
|
+
if (bearer != null) {
|
|
322
|
+
return `Bearer ${bearer}`;
|
|
323
|
+
}
|
|
324
|
+
return undefined;
|
|
321
325
|
});
|
|
322
326
|
}
|
|
323
327
|
}
|
|
@@ -9,7 +9,7 @@ export declare namespace Customers {
|
|
|
9
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
|
-
token
|
|
12
|
+
token?: core.Supplier<core.BearerToken | undefined>;
|
|
13
13
|
/** Additional headers to include in requests. */
|
|
14
14
|
headers?: Record<string, string | core.Supplier<string | undefined> | undefined>;
|
|
15
15
|
}
|
|
@@ -26,7 +26,7 @@ export declare namespace Customers {
|
|
|
26
26
|
}
|
|
27
27
|
export declare class Customers {
|
|
28
28
|
protected readonly _options: Customers.Options;
|
|
29
|
-
constructor(_options
|
|
29
|
+
constructor(_options?: Customers.Options);
|
|
30
30
|
/**
|
|
31
31
|
* @param {Customers.RequestOptions} requestOptions - Request-specific configuration.
|
|
32
32
|
*
|
|
@@ -80,6 +80,17 @@ export declare class Customers {
|
|
|
80
80
|
*/
|
|
81
81
|
delete(customerId: string, requestOptions?: Customers.RequestOptions): core.HttpResponsePromise<void>;
|
|
82
82
|
private __delete;
|
|
83
|
+
/**
|
|
84
|
+
* @param {string} customerId - The customer ID
|
|
85
|
+
* @param {Customers.RequestOptions} requestOptions - Request-specific configuration.
|
|
86
|
+
*
|
|
87
|
+
* @throws {@link Paid.ForbiddenError}
|
|
88
|
+
*
|
|
89
|
+
* @example
|
|
90
|
+
* await client.customers.getEntitlements("customerId")
|
|
91
|
+
*/
|
|
92
|
+
getEntitlements(customerId: string, requestOptions?: Customers.RequestOptions): core.HttpResponsePromise<Paid.EntitlementUsage[]>;
|
|
93
|
+
private __getEntitlements;
|
|
83
94
|
/**
|
|
84
95
|
* @param {string} externalId
|
|
85
96
|
* @param {Customers.RequestOptions} requestOptions - Request-specific configuration.
|
|
@@ -108,5 +119,5 @@ export declare class Customers {
|
|
|
108
119
|
*/
|
|
109
120
|
deleteByExternalId(externalId: string, requestOptions?: Customers.RequestOptions): core.HttpResponsePromise<void>;
|
|
110
121
|
private __deleteByExternalId;
|
|
111
|
-
protected _getAuthorizationHeader(): Promise<string>;
|
|
122
|
+
protected _getAuthorizationHeader(): Promise<string | undefined>;
|
|
112
123
|
}
|
|
@@ -12,11 +12,12 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
12
12
|
};
|
|
13
13
|
import * as environments from "../../../../environments.mjs";
|
|
14
14
|
import * as core from "../../../../core/index.mjs";
|
|
15
|
+
import * as Paid from "../../../index.mjs";
|
|
15
16
|
import { mergeHeaders, mergeOnlyDefinedHeaders } from "../../../../core/headers.mjs";
|
|
16
17
|
import urlJoin from "url-join";
|
|
17
18
|
import * as errors from "../../../../errors/index.mjs";
|
|
18
19
|
export class Customers {
|
|
19
|
-
constructor(_options) {
|
|
20
|
+
constructor(_options = {}) {
|
|
20
21
|
this._options = _options;
|
|
21
22
|
}
|
|
22
23
|
/**
|
|
@@ -273,6 +274,61 @@ export class Customers {
|
|
|
273
274
|
}
|
|
274
275
|
});
|
|
275
276
|
}
|
|
277
|
+
/**
|
|
278
|
+
* @param {string} customerId - The customer ID
|
|
279
|
+
* @param {Customers.RequestOptions} requestOptions - Request-specific configuration.
|
|
280
|
+
*
|
|
281
|
+
* @throws {@link Paid.ForbiddenError}
|
|
282
|
+
*
|
|
283
|
+
* @example
|
|
284
|
+
* await client.customers.getEntitlements("customerId")
|
|
285
|
+
*/
|
|
286
|
+
getEntitlements(customerId, requestOptions) {
|
|
287
|
+
return core.HttpResponsePromise.fromPromise(this.__getEntitlements(customerId, requestOptions));
|
|
288
|
+
}
|
|
289
|
+
__getEntitlements(customerId, requestOptions) {
|
|
290
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
291
|
+
var _a, _b, _c;
|
|
292
|
+
const _response = yield core.fetcher({
|
|
293
|
+
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)}/credit-bundles`),
|
|
294
|
+
method: "GET",
|
|
295
|
+
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),
|
|
296
|
+
timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
|
|
297
|
+
maxRetries: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries,
|
|
298
|
+
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
299
|
+
});
|
|
300
|
+
if (_response.ok) {
|
|
301
|
+
return { data: _response.body, rawResponse: _response.rawResponse };
|
|
302
|
+
}
|
|
303
|
+
if (_response.error.reason === "status-code") {
|
|
304
|
+
switch (_response.error.statusCode) {
|
|
305
|
+
case 403:
|
|
306
|
+
throw new Paid.ForbiddenError(_response.error.body, _response.rawResponse);
|
|
307
|
+
default:
|
|
308
|
+
throw new errors.PaidError({
|
|
309
|
+
statusCode: _response.error.statusCode,
|
|
310
|
+
body: _response.error.body,
|
|
311
|
+
rawResponse: _response.rawResponse,
|
|
312
|
+
});
|
|
313
|
+
}
|
|
314
|
+
}
|
|
315
|
+
switch (_response.error.reason) {
|
|
316
|
+
case "non-json":
|
|
317
|
+
throw new errors.PaidError({
|
|
318
|
+
statusCode: _response.error.statusCode,
|
|
319
|
+
body: _response.error.rawBody,
|
|
320
|
+
rawResponse: _response.rawResponse,
|
|
321
|
+
});
|
|
322
|
+
case "timeout":
|
|
323
|
+
throw new errors.PaidTimeoutError("Timeout exceeded when calling GET /customers/{customerId}/credit-bundles.");
|
|
324
|
+
case "unknown":
|
|
325
|
+
throw new errors.PaidError({
|
|
326
|
+
message: _response.error.errorMessage,
|
|
327
|
+
rawResponse: _response.rawResponse,
|
|
328
|
+
});
|
|
329
|
+
}
|
|
330
|
+
});
|
|
331
|
+
}
|
|
276
332
|
/**
|
|
277
333
|
* @param {string} externalId
|
|
278
334
|
* @param {Customers.RequestOptions} requestOptions - Request-specific configuration.
|
|
@@ -423,7 +479,11 @@ export class Customers {
|
|
|
423
479
|
}
|
|
424
480
|
_getAuthorizationHeader() {
|
|
425
481
|
return __awaiter(this, void 0, void 0, function* () {
|
|
426
|
-
|
|
482
|
+
const bearer = yield core.Supplier.get(this._options.token);
|
|
483
|
+
if (bearer != null) {
|
|
484
|
+
return `Bearer ${bearer}`;
|
|
485
|
+
}
|
|
486
|
+
return undefined;
|
|
427
487
|
});
|
|
428
488
|
}
|
|
429
489
|
}
|
|
@@ -10,7 +10,7 @@ export declare namespace Orders {
|
|
|
10
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
|
-
token
|
|
13
|
+
token?: core.Supplier<core.BearerToken | undefined>;
|
|
14
14
|
/** Additional headers to include in requests. */
|
|
15
15
|
headers?: Record<string, string | core.Supplier<string | undefined> | undefined>;
|
|
16
16
|
}
|
|
@@ -28,7 +28,7 @@ export declare namespace Orders {
|
|
|
28
28
|
export declare class Orders {
|
|
29
29
|
protected readonly _options: Orders.Options;
|
|
30
30
|
protected _lines: Lines | undefined;
|
|
31
|
-
constructor(_options
|
|
31
|
+
constructor(_options?: Orders.Options);
|
|
32
32
|
get lines(): Lines;
|
|
33
33
|
/**
|
|
34
34
|
* @param {Orders.RequestOptions} requestOptions - Request-specific configuration.
|
|
@@ -51,6 +51,16 @@ export declare class Orders {
|
|
|
51
51
|
* endDate: "2026-01-01",
|
|
52
52
|
* currency: "USD"
|
|
53
53
|
* })
|
|
54
|
+
*
|
|
55
|
+
* @example
|
|
56
|
+
* await client.orders.create({
|
|
57
|
+
* customerExternalId: "acme-inc",
|
|
58
|
+
* name: "Acme Order with Custom Pricing",
|
|
59
|
+
* description: "Order with customized attribute pricing",
|
|
60
|
+
* startDate: "2025-01-01",
|
|
61
|
+
* endDate: "2026-01-01",
|
|
62
|
+
* currency: "USD"
|
|
63
|
+
* })
|
|
54
64
|
*/
|
|
55
65
|
create(request: Paid.OrderCreate, requestOptions?: Orders.RequestOptions): core.HttpResponsePromise<Paid.Order>;
|
|
56
66
|
private __create;
|
|
@@ -81,5 +91,5 @@ export declare class Orders {
|
|
|
81
91
|
*/
|
|
82
92
|
activate(orderId: string, requestOptions?: Orders.RequestOptions): core.HttpResponsePromise<Paid.Order>;
|
|
83
93
|
private __activate;
|
|
84
|
-
protected _getAuthorizationHeader(): Promise<string>;
|
|
94
|
+
protected _getAuthorizationHeader(): Promise<string | undefined>;
|
|
85
95
|
}
|
|
@@ -17,7 +17,7 @@ import urlJoin from "url-join";
|
|
|
17
17
|
import * as errors from "../../../../errors/index.mjs";
|
|
18
18
|
import { Lines } from "../resources/lines/client/Client.mjs";
|
|
19
19
|
export class Orders {
|
|
20
|
-
constructor(_options) {
|
|
20
|
+
constructor(_options = {}) {
|
|
21
21
|
this._options = _options;
|
|
22
22
|
}
|
|
23
23
|
get lines() {
|
|
@@ -84,6 +84,16 @@ export class Orders {
|
|
|
84
84
|
* endDate: "2026-01-01",
|
|
85
85
|
* currency: "USD"
|
|
86
86
|
* })
|
|
87
|
+
*
|
|
88
|
+
* @example
|
|
89
|
+
* await client.orders.create({
|
|
90
|
+
* customerExternalId: "acme-inc",
|
|
91
|
+
* name: "Acme Order with Custom Pricing",
|
|
92
|
+
* description: "Order with customized attribute pricing",
|
|
93
|
+
* startDate: "2025-01-01",
|
|
94
|
+
* endDate: "2026-01-01",
|
|
95
|
+
* currency: "USD"
|
|
96
|
+
* })
|
|
87
97
|
*/
|
|
88
98
|
create(request, requestOptions) {
|
|
89
99
|
return core.HttpResponsePromise.fromPromise(this.__create(request, requestOptions));
|
|
@@ -275,7 +285,11 @@ export class Orders {
|
|
|
275
285
|
}
|
|
276
286
|
_getAuthorizationHeader() {
|
|
277
287
|
return __awaiter(this, void 0, void 0, function* () {
|
|
278
|
-
|
|
288
|
+
const bearer = yield core.Supplier.get(this._options.token);
|
|
289
|
+
if (bearer != null) {
|
|
290
|
+
return `Bearer ${bearer}`;
|
|
291
|
+
}
|
|
292
|
+
return undefined;
|
|
279
293
|
});
|
|
280
294
|
}
|
|
281
295
|
}
|
|
@@ -12,6 +12,16 @@ import * as Paid from "../../../../index.mjs";
|
|
|
12
12
|
* endDate: "2026-01-01",
|
|
13
13
|
* currency: "USD"
|
|
14
14
|
* }
|
|
15
|
+
*
|
|
16
|
+
* @example
|
|
17
|
+
* {
|
|
18
|
+
* customerExternalId: "acme-inc",
|
|
19
|
+
* name: "Acme Order with Custom Pricing",
|
|
20
|
+
* description: "Order with customized attribute pricing",
|
|
21
|
+
* startDate: "2025-01-01",
|
|
22
|
+
* endDate: "2026-01-01",
|
|
23
|
+
* currency: "USD"
|
|
24
|
+
* }
|
|
15
25
|
*/
|
|
16
26
|
export interface OrderCreate {
|
|
17
27
|
customerId?: string;
|
|
@@ -9,7 +9,7 @@ export declare namespace Lines {
|
|
|
9
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
|
-
token
|
|
12
|
+
token?: core.Supplier<core.BearerToken | undefined>;
|
|
13
13
|
/** Additional headers to include in requests. */
|
|
14
14
|
headers?: Record<string, string | core.Supplier<string | undefined> | undefined>;
|
|
15
15
|
}
|
|
@@ -26,7 +26,7 @@ export declare namespace Lines {
|
|
|
26
26
|
}
|
|
27
27
|
export declare class Lines {
|
|
28
28
|
protected readonly _options: Lines.Options;
|
|
29
|
-
constructor(_options
|
|
29
|
+
constructor(_options?: Lines.Options);
|
|
30
30
|
/**
|
|
31
31
|
* @param {string} orderId
|
|
32
32
|
* @param {Paid.orders.LinesUpdateRequest} request
|
|
@@ -47,5 +47,5 @@ export declare class Lines {
|
|
|
47
47
|
*/
|
|
48
48
|
update(orderId: string, request?: Paid.orders.LinesUpdateRequest, requestOptions?: Lines.RequestOptions): core.HttpResponsePromise<Paid.Order>;
|
|
49
49
|
private __update;
|
|
50
|
-
protected _getAuthorizationHeader(): Promise<string>;
|
|
50
|
+
protected _getAuthorizationHeader(): Promise<string | undefined>;
|
|
51
51
|
}
|
|
@@ -16,7 +16,7 @@ import { mergeHeaders, mergeOnlyDefinedHeaders } from "../../../../../../core/he
|
|
|
16
16
|
import urlJoin from "url-join";
|
|
17
17
|
import * as errors from "../../../../../../errors/index.mjs";
|
|
18
18
|
export class Lines {
|
|
19
|
-
constructor(_options) {
|
|
19
|
+
constructor(_options = {}) {
|
|
20
20
|
this._options = _options;
|
|
21
21
|
}
|
|
22
22
|
/**
|
|
@@ -83,7 +83,11 @@ export class Lines {
|
|
|
83
83
|
}
|
|
84
84
|
_getAuthorizationHeader() {
|
|
85
85
|
return __awaiter(this, void 0, void 0, function* () {
|
|
86
|
-
|
|
86
|
+
const bearer = yield core.Supplier.get(this._options.token);
|
|
87
|
+
if (bearer != null) {
|
|
88
|
+
return `Bearer ${bearer}`;
|
|
89
|
+
}
|
|
90
|
+
return undefined;
|
|
87
91
|
});
|
|
88
92
|
}
|
|
89
93
|
}
|
|
@@ -9,7 +9,7 @@ export declare namespace Usage {
|
|
|
9
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
|
-
token
|
|
12
|
+
token?: core.Supplier<core.BearerToken | undefined>;
|
|
13
13
|
/** Additional headers to include in requests. */
|
|
14
14
|
headers?: Record<string, string | core.Supplier<string | undefined> | undefined>;
|
|
15
15
|
}
|
|
@@ -26,7 +26,7 @@ export declare namespace Usage {
|
|
|
26
26
|
}
|
|
27
27
|
export declare class Usage {
|
|
28
28
|
protected readonly _options: Usage.Options;
|
|
29
|
-
constructor(_options
|
|
29
|
+
constructor(_options?: Usage.Options);
|
|
30
30
|
/**
|
|
31
31
|
* @param {Paid.UsageRecordBulkRequest} request
|
|
32
32
|
* @param {Usage.RequestOptions} requestOptions - Request-specific configuration.
|
|
@@ -38,5 +38,5 @@ export declare class Usage {
|
|
|
38
38
|
*/
|
|
39
39
|
recordBulk(request?: Paid.UsageRecordBulkRequest, requestOptions?: Usage.RequestOptions): core.HttpResponsePromise<void>;
|
|
40
40
|
private __recordBulk;
|
|
41
|
-
protected _getAuthorizationHeader(): Promise<string>;
|
|
41
|
+
protected _getAuthorizationHeader(): Promise<string | undefined>;
|
|
42
42
|
}
|
|
@@ -16,7 +16,7 @@ import { mergeHeaders, mergeOnlyDefinedHeaders } from "../../../../core/headers.
|
|
|
16
16
|
import urlJoin from "url-join";
|
|
17
17
|
import * as errors from "../../../../errors/index.mjs";
|
|
18
18
|
export class Usage {
|
|
19
|
-
constructor(_options) {
|
|
19
|
+
constructor(_options = {}) {
|
|
20
20
|
this._options = _options;
|
|
21
21
|
}
|
|
22
22
|
/**
|
|
@@ -74,7 +74,11 @@ export class Usage {
|
|
|
74
74
|
}
|
|
75
75
|
_getAuthorizationHeader() {
|
|
76
76
|
return __awaiter(this, void 0, void 0, function* () {
|
|
77
|
-
|
|
77
|
+
const bearer = yield core.Supplier.get(this._options.token);
|
|
78
|
+
if (bearer != null) {
|
|
79
|
+
return `Bearer ${bearer}`;
|
|
80
|
+
}
|
|
81
|
+
return undefined;
|
|
78
82
|
});
|
|
79
83
|
}
|
|
80
84
|
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This file was auto-generated by Fern from our API Definition.
|
|
3
|
+
*/
|
|
4
|
+
/**
|
|
5
|
+
* Tracks the usage of an entitlement for a customer
|
|
6
|
+
*/
|
|
7
|
+
export interface EntitlementUsage {
|
|
8
|
+
id: string;
|
|
9
|
+
createdAt?: string;
|
|
10
|
+
updatedAt?: string;
|
|
11
|
+
organizationId: string;
|
|
12
|
+
productId: string;
|
|
13
|
+
entitlementId: string;
|
|
14
|
+
customerId: string;
|
|
15
|
+
startDate: string;
|
|
16
|
+
endDate?: string;
|
|
17
|
+
/** Total entitlement amount */
|
|
18
|
+
total: number;
|
|
19
|
+
/** Available entitlement amount */
|
|
20
|
+
available: number;
|
|
21
|
+
/** Used entitlement amount */
|
|
22
|
+
used: number;
|
|
23
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This file was auto-generated by Fern from our API Definition.
|
|
3
|
+
*/
|
|
4
|
+
import * as Paid from "../index.mjs";
|
|
5
|
+
export interface OrderLineAttributeCreate {
|
|
6
|
+
/** The name of the agent attribute to override (e.g., "api_call", "call_placed") */
|
|
7
|
+
agentAttributeName: string;
|
|
8
|
+
/** Quantity for this attribute (defaults to 0) */
|
|
9
|
+
quantity?: number;
|
|
10
|
+
/** Custom pricing configuration for this attribute */
|
|
11
|
+
pricing: Paid.OrderLineAttributePricing;
|
|
12
|
+
}
|
|
@@ -1,9 +1,16 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* This file was auto-generated by Fern from our API Definition.
|
|
3
3
|
*/
|
|
4
|
+
import * as Paid from "../index.mjs";
|
|
4
5
|
export interface OrderLineCreate {
|
|
6
|
+
/** Paid's internal ID for the agent/product */
|
|
5
7
|
agentId?: string;
|
|
8
|
+
/** The external ID of the agent/product i.e. the id within your system */
|
|
6
9
|
agentExternalId?: string;
|
|
10
|
+
/** Name of the order line */
|
|
7
11
|
name?: string;
|
|
12
|
+
/** Description of the order line */
|
|
8
13
|
description?: string;
|
|
14
|
+
/** Optional array of custom agent attributes to override default pricing, allowing per customer pricing. If not provided, attributes will be auto-generated from the product definition. */
|
|
15
|
+
agentAttributes?: Paid.OrderLineAttributeCreate[];
|
|
9
16
|
}
|
|
@@ -22,6 +22,8 @@ export * from "./OrderLineAttributePricing.mjs";
|
|
|
22
22
|
export * from "./PricePoint.mjs";
|
|
23
23
|
export * from "./Tier.mjs";
|
|
24
24
|
export * from "./OrderLineCreate.mjs";
|
|
25
|
+
export * from "./OrderLineAttributeCreate.mjs";
|
|
25
26
|
export * from "./Signal.mjs";
|
|
26
27
|
export * from "./Error_.mjs";
|
|
27
28
|
export * from "./ApiError.mjs";
|
|
29
|
+
export * from "./EntitlementUsage.mjs";
|
|
@@ -22,6 +22,8 @@ export * from "./OrderLineAttributePricing.mjs";
|
|
|
22
22
|
export * from "./PricePoint.mjs";
|
|
23
23
|
export * from "./Tier.mjs";
|
|
24
24
|
export * from "./OrderLineCreate.mjs";
|
|
25
|
+
export * from "./OrderLineAttributeCreate.mjs";
|
|
25
26
|
export * from "./Signal.mjs";
|
|
26
27
|
export * from "./Error_.mjs";
|
|
27
28
|
export * from "./ApiError.mjs";
|
|
29
|
+
export * from "./EntitlementUsage.mjs";
|
package/dist/esm/index.d.mts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
export * as Paid from "./api/index.mjs";
|
|
2
2
|
export { PaidClient } from "./Client.mjs";
|
|
3
|
-
export { PaidError, PaidTimeoutError } from "./errors/index.mjs";
|
|
4
3
|
export { PaidEnvironment } from "./environments.mjs";
|
|
4
|
+
export { PaidError, PaidTimeoutError } from "./errors/index.mjs";
|
package/dist/esm/index.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
export * as Paid from "./api/index.mjs";
|
|
2
2
|
export { PaidClient } from "./Client.mjs";
|
|
3
|
-
export { PaidError, PaidTimeoutError } from "./errors/index.mjs";
|
|
4
3
|
export { PaidEnvironment } from "./environments.mjs";
|
|
4
|
+
export { PaidError, PaidTimeoutError } from "./errors/index.mjs";
|
package/dist/esm/version.d.mts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const SDK_VERSION = "0.
|
|
1
|
+
export declare const SDK_VERSION = "0.3.0";
|
package/dist/esm/version.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const SDK_VERSION = "0.
|
|
1
|
+
export const SDK_VERSION = "0.3.0";
|