@paid-ai/paid-node 0.2.0 → 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/README.md +180 -39
- 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
|
@@ -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";
|
package/package.json
CHANGED
package/reference.md
CHANGED
|
@@ -250,6 +250,54 @@ await client.customers.delete("customerId");
|
|
|
250
250
|
</dl>
|
|
251
251
|
</details>
|
|
252
252
|
|
|
253
|
+
<details><summary><code>client.customers.<a href="/src/api/resources/customers/client/Client.ts">getEntitlements</a>(customerId) -> Paid.EntitlementUsage[]</code></summary>
|
|
254
|
+
<dl>
|
|
255
|
+
<dd>
|
|
256
|
+
|
|
257
|
+
#### 🔌 Usage
|
|
258
|
+
|
|
259
|
+
<dl>
|
|
260
|
+
<dd>
|
|
261
|
+
|
|
262
|
+
<dl>
|
|
263
|
+
<dd>
|
|
264
|
+
|
|
265
|
+
```typescript
|
|
266
|
+
await client.customers.getEntitlements("customerId");
|
|
267
|
+
```
|
|
268
|
+
|
|
269
|
+
</dd>
|
|
270
|
+
</dl>
|
|
271
|
+
</dd>
|
|
272
|
+
</dl>
|
|
273
|
+
|
|
274
|
+
#### ⚙️ Parameters
|
|
275
|
+
|
|
276
|
+
<dl>
|
|
277
|
+
<dd>
|
|
278
|
+
|
|
279
|
+
<dl>
|
|
280
|
+
<dd>
|
|
281
|
+
|
|
282
|
+
**customerId:** `string` — The customer ID
|
|
283
|
+
|
|
284
|
+
</dd>
|
|
285
|
+
</dl>
|
|
286
|
+
|
|
287
|
+
<dl>
|
|
288
|
+
<dd>
|
|
289
|
+
|
|
290
|
+
**requestOptions:** `Customers.RequestOptions`
|
|
291
|
+
|
|
292
|
+
</dd>
|
|
293
|
+
</dl>
|
|
294
|
+
</dd>
|
|
295
|
+
</dl>
|
|
296
|
+
|
|
297
|
+
</dd>
|
|
298
|
+
</dl>
|
|
299
|
+
</details>
|
|
300
|
+
|
|
253
301
|
<details><summary><code>client.customers.<a href="/src/api/resources/customers/client/Client.ts">getByExternalId</a>(externalId) -> Paid.Customer</code></summary>
|
|
254
302
|
<dl>
|
|
255
303
|
<dd>
|