@paid-ai/paid-node 1.5.0 → 1.7.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.d.ts +3 -3
- package/dist/cjs/Client.js +5 -5
- package/dist/cjs/api/resources/{cost → costs}/client/Client.d.ts +9 -9
- package/dist/cjs/api/resources/{cost → costs}/client/Client.js +11 -11
- package/dist/cjs/api/resources/index.d.ts +2 -2
- package/dist/cjs/api/resources/index.js +3 -3
- package/dist/cjs/version.d.ts +1 -1
- package/dist/cjs/version.js +1 -1
- package/dist/esm/Client.d.mts +3 -3
- package/dist/esm/Client.mjs +5 -5
- package/dist/esm/api/resources/{cost → costs}/client/Client.d.mts +9 -9
- package/dist/esm/api/resources/{cost → costs}/client/Client.mjs +9 -9
- package/dist/esm/api/resources/index.d.mts +2 -2
- package/dist/esm/api/resources/index.mjs +2 -2
- package/dist/esm/version.d.mts +1 -1
- package/dist/esm/version.mjs +1 -1
- package/package.json +1 -1
- package/reference.md +5 -5
- /package/dist/cjs/api/resources/{cost → costs}/client/index.d.ts +0 -0
- /package/dist/cjs/api/resources/{cost → costs}/client/index.js +0 -0
- /package/dist/cjs/api/resources/{cost → costs}/client/requests/CostIngestRequest.d.ts +0 -0
- /package/dist/cjs/api/resources/{cost → costs}/client/requests/CostIngestRequest.js +0 -0
- /package/dist/cjs/api/resources/{cost → costs}/client/requests/index.d.ts +0 -0
- /package/dist/cjs/api/resources/{cost → costs}/client/requests/index.js +0 -0
- /package/dist/cjs/api/resources/{cost → costs}/index.d.ts +0 -0
- /package/dist/cjs/api/resources/{cost → costs}/index.js +0 -0
- /package/dist/esm/api/resources/{cost → costs}/client/index.d.mts +0 -0
- /package/dist/esm/api/resources/{cost → costs}/client/index.mjs +0 -0
- /package/dist/esm/api/resources/{cost → costs}/client/requests/CostIngestRequest.d.mts +0 -0
- /package/dist/esm/api/resources/{cost → costs}/client/requests/CostIngestRequest.mjs +0 -0
- /package/dist/esm/api/resources/{cost → costs}/client/requests/index.d.mts +0 -0
- /package/dist/esm/api/resources/{cost → costs}/client/requests/index.mjs +0 -0
- /package/dist/esm/api/resources/{cost → costs}/index.d.mts +0 -0
- /package/dist/esm/api/resources/{cost → costs}/index.mjs +0 -0
package/dist/cjs/Client.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Checkouts } from "./api/resources/checkouts/client/Client.js";
|
|
2
2
|
import { Contacts } from "./api/resources/contacts/client/Client.js";
|
|
3
|
-
import {
|
|
3
|
+
import { Costs } from "./api/resources/costs/client/Client.js";
|
|
4
4
|
import { Credits } from "./api/resources/credits/client/Client.js";
|
|
5
5
|
import { CustomerPortals } from "./api/resources/customerPortals/client/Client.js";
|
|
6
6
|
import { Customers } from "./api/resources/customers/client/Client.js";
|
|
@@ -32,7 +32,7 @@ export declare class PaidClient {
|
|
|
32
32
|
protected _valueReceipts: ValueReceipts | undefined;
|
|
33
33
|
protected _webhooks: Webhooks | undefined;
|
|
34
34
|
protected _pricing: Pricing | undefined;
|
|
35
|
-
protected
|
|
35
|
+
protected _costs: Costs | undefined;
|
|
36
36
|
constructor(_options: PaidClient.Options);
|
|
37
37
|
get products(): Products;
|
|
38
38
|
get customers(): Customers;
|
|
@@ -46,5 +46,5 @@ export declare class PaidClient {
|
|
|
46
46
|
get valueReceipts(): ValueReceipts;
|
|
47
47
|
get webhooks(): Webhooks;
|
|
48
48
|
get pricing(): Pricing;
|
|
49
|
-
get
|
|
49
|
+
get costs(): Costs;
|
|
50
50
|
}
|
package/dist/cjs/Client.js
CHANGED
|
@@ -37,7 +37,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
37
37
|
exports.PaidClient = void 0;
|
|
38
38
|
const Client_js_1 = require("./api/resources/checkouts/client/Client.js");
|
|
39
39
|
const Client_js_2 = require("./api/resources/contacts/client/Client.js");
|
|
40
|
-
const Client_js_3 = require("./api/resources/
|
|
40
|
+
const Client_js_3 = require("./api/resources/costs/client/Client.js");
|
|
41
41
|
const Client_js_4 = require("./api/resources/credits/client/Client.js");
|
|
42
42
|
const Client_js_5 = require("./api/resources/customerPortals/client/Client.js");
|
|
43
43
|
const Client_js_6 = require("./api/resources/customers/client/Client.js");
|
|
@@ -55,8 +55,8 @@ class PaidClient {
|
|
|
55
55
|
this._options = Object.assign(Object.assign({}, _options), { headers: (0, headers_js_1.mergeHeaders)({
|
|
56
56
|
"X-Fern-Language": "JavaScript",
|
|
57
57
|
"X-Fern-SDK-Name": "@paid-ai/paid-node",
|
|
58
|
-
"X-Fern-SDK-Version": "1.
|
|
59
|
-
"User-Agent": "@paid-ai/paid-node/1.
|
|
58
|
+
"X-Fern-SDK-Version": "1.7.0",
|
|
59
|
+
"User-Agent": "@paid-ai/paid-node/1.7.0",
|
|
60
60
|
"X-Fern-Runtime": core.RUNTIME.type,
|
|
61
61
|
"X-Fern-Runtime-Version": core.RUNTIME.version,
|
|
62
62
|
}, _options === null || _options === void 0 ? void 0 : _options.headers) });
|
|
@@ -109,9 +109,9 @@ class PaidClient {
|
|
|
109
109
|
var _a;
|
|
110
110
|
return ((_a = this._pricing) !== null && _a !== void 0 ? _a : (this._pricing = new Client_js_9.Pricing(this._options)));
|
|
111
111
|
}
|
|
112
|
-
get
|
|
112
|
+
get costs() {
|
|
113
113
|
var _a;
|
|
114
|
-
return ((_a = this.
|
|
114
|
+
return ((_a = this._costs) !== null && _a !== void 0 ? _a : (this._costs = new Client_js_3.Costs(this._options)));
|
|
115
115
|
}
|
|
116
116
|
}
|
|
117
117
|
exports.PaidClient = PaidClient;
|
|
@@ -1,27 +1,27 @@
|
|
|
1
1
|
import type { BaseClientOptions, BaseRequestOptions } from "../../../../BaseClient.js";
|
|
2
2
|
import * as core from "../../../../core/index.js";
|
|
3
3
|
import * as Paid from "../../../index.js";
|
|
4
|
-
export declare namespace
|
|
4
|
+
export declare namespace Costs {
|
|
5
5
|
interface Options extends BaseClientOptions {
|
|
6
6
|
}
|
|
7
7
|
interface RequestOptions extends BaseRequestOptions {
|
|
8
8
|
}
|
|
9
9
|
}
|
|
10
|
-
export declare class
|
|
11
|
-
protected readonly _options:
|
|
12
|
-
constructor(_options:
|
|
10
|
+
export declare class Costs {
|
|
11
|
+
protected readonly _options: Costs.Options;
|
|
12
|
+
constructor(_options: Costs.Options);
|
|
13
13
|
/**
|
|
14
|
-
* Ingests a batch of cost records. Each record is either a pre-computed `cost` (caller supplies amount + currency) or a `usage` record (caller supplies vendor/model/token counts and Paid prices it server-side). The batch is all-or-nothing: if any record fails validation, the entire request is rejected with a 400 and nothing is persisted.
|
|
14
|
+
* Ingests a batch of cost records. Each record is either a pre-computed `cost` (caller supplies amount + currency) or a `usage` record (caller supplies vendor/model/token counts and Paid prices it server-side). The batch is all-or-nothing: if any record fails validation, the entire request is rejected with a 400 and nothing is persisted.
|
|
15
15
|
*
|
|
16
16
|
* @param {Paid.CostIngestRequest} request
|
|
17
|
-
* @param {
|
|
17
|
+
* @param {Costs.RequestOptions} requestOptions - Request-specific configuration.
|
|
18
18
|
*
|
|
19
19
|
* @throws {@link Paid.BadRequestError}
|
|
20
20
|
* @throws {@link Paid.ForbiddenError}
|
|
21
21
|
* @throws {@link Paid.InternalServerError}
|
|
22
22
|
*
|
|
23
23
|
* @example
|
|
24
|
-
* await client.
|
|
24
|
+
* await client.costs.createCosts({
|
|
25
25
|
* costs: [{
|
|
26
26
|
* type: "cost",
|
|
27
27
|
* customer: {
|
|
@@ -32,7 +32,7 @@ export declare class Cost {
|
|
|
32
32
|
* }]
|
|
33
33
|
* })
|
|
34
34
|
*/
|
|
35
|
-
|
|
36
|
-
private
|
|
35
|
+
createCosts(request: Paid.CostIngestRequest, requestOptions?: Costs.RequestOptions): core.HttpResponsePromise<Paid.CostIngestResponse>;
|
|
36
|
+
private __createCosts;
|
|
37
37
|
protected _getAuthorizationHeader(): Promise<string>;
|
|
38
38
|
}
|
|
@@ -43,28 +43,28 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
43
43
|
});
|
|
44
44
|
};
|
|
45
45
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
46
|
-
exports.
|
|
46
|
+
exports.Costs = void 0;
|
|
47
47
|
const headers_js_1 = require("../../../../core/headers.js");
|
|
48
48
|
const core = __importStar(require("../../../../core/index.js"));
|
|
49
49
|
const environments = __importStar(require("../../../../environments.js"));
|
|
50
50
|
const errors = __importStar(require("../../../../errors/index.js"));
|
|
51
51
|
const Paid = __importStar(require("../../../index.js"));
|
|
52
|
-
class
|
|
52
|
+
class Costs {
|
|
53
53
|
constructor(_options) {
|
|
54
54
|
this._options = _options;
|
|
55
55
|
}
|
|
56
56
|
/**
|
|
57
|
-
* Ingests a batch of cost records. Each record is either a pre-computed `cost` (caller supplies amount + currency) or a `usage` record (caller supplies vendor/model/token counts and Paid prices it server-side). The batch is all-or-nothing: if any record fails validation, the entire request is rejected with a 400 and nothing is persisted.
|
|
57
|
+
* Ingests a batch of cost records. Each record is either a pre-computed `cost` (caller supplies amount + currency) or a `usage` record (caller supplies vendor/model/token counts and Paid prices it server-side). The batch is all-or-nothing: if any record fails validation, the entire request is rejected with a 400 and nothing is persisted.
|
|
58
58
|
*
|
|
59
59
|
* @param {Paid.CostIngestRequest} request
|
|
60
|
-
* @param {
|
|
60
|
+
* @param {Costs.RequestOptions} requestOptions - Request-specific configuration.
|
|
61
61
|
*
|
|
62
62
|
* @throws {@link Paid.BadRequestError}
|
|
63
63
|
* @throws {@link Paid.ForbiddenError}
|
|
64
64
|
* @throws {@link Paid.InternalServerError}
|
|
65
65
|
*
|
|
66
66
|
* @example
|
|
67
|
-
* await client.
|
|
67
|
+
* await client.costs.createCosts({
|
|
68
68
|
* costs: [{
|
|
69
69
|
* type: "cost",
|
|
70
70
|
* customer: {
|
|
@@ -75,15 +75,15 @@ class Cost {
|
|
|
75
75
|
* }]
|
|
76
76
|
* })
|
|
77
77
|
*/
|
|
78
|
-
|
|
79
|
-
return core.HttpResponsePromise.fromPromise(this.
|
|
78
|
+
createCosts(request, requestOptions) {
|
|
79
|
+
return core.HttpResponsePromise.fromPromise(this.__createCosts(request, requestOptions));
|
|
80
80
|
}
|
|
81
|
-
|
|
81
|
+
__createCosts(request, requestOptions) {
|
|
82
82
|
return __awaiter(this, void 0, void 0, function* () {
|
|
83
83
|
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
84
84
|
const _headers = (0, headers_js_1.mergeHeaders)((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, (0, headers_js_1.mergeOnlyDefinedHeaders)({ Authorization: yield this._getAuthorizationHeader() }), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
|
|
85
85
|
const _response = yield core.fetcher({
|
|
86
|
-
url: core.url.join((_c = (_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : (yield core.Supplier.get(this._options.environment))) !== null && _c !== void 0 ? _c : environments.PaidEnvironment.Default, "
|
|
86
|
+
url: core.url.join((_c = (_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : (yield core.Supplier.get(this._options.environment))) !== null && _c !== void 0 ? _c : environments.PaidEnvironment.Default, "costs/bulk"),
|
|
87
87
|
method: "POST",
|
|
88
88
|
headers: _headers,
|
|
89
89
|
contentType: "application/json",
|
|
@@ -121,7 +121,7 @@ class Cost {
|
|
|
121
121
|
rawResponse: _response.rawResponse,
|
|
122
122
|
});
|
|
123
123
|
case "timeout":
|
|
124
|
-
throw new errors.PaidTimeoutError("Timeout exceeded when calling POST /
|
|
124
|
+
throw new errors.PaidTimeoutError("Timeout exceeded when calling POST /costs/bulk.");
|
|
125
125
|
case "unknown":
|
|
126
126
|
throw new errors.PaidError({
|
|
127
127
|
message: _response.error.errorMessage,
|
|
@@ -136,4 +136,4 @@ class Cost {
|
|
|
136
136
|
});
|
|
137
137
|
}
|
|
138
138
|
}
|
|
139
|
-
exports.
|
|
139
|
+
exports.Costs = Costs;
|
|
@@ -3,8 +3,8 @@ export * as checkouts from "./checkouts/index.js";
|
|
|
3
3
|
export * from "./checkouts/types/index.js";
|
|
4
4
|
export * from "./contacts/client/requests/index.js";
|
|
5
5
|
export * as contacts from "./contacts/index.js";
|
|
6
|
-
export * from "./
|
|
7
|
-
export * as
|
|
6
|
+
export * from "./costs/client/requests/index.js";
|
|
7
|
+
export * as costs from "./costs/index.js";
|
|
8
8
|
export * as credits from "./credits/index.js";
|
|
9
9
|
export * from "./customerPortals/client/requests/index.js";
|
|
10
10
|
export * as customerPortals from "./customerPortals/index.js";
|
|
@@ -36,14 +36,14 @@ var __importStar = (this && this.__importStar) || (function () {
|
|
|
36
36
|
};
|
|
37
37
|
})();
|
|
38
38
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
|
-
exports.webhooks = exports.valueReceipts = exports.signals = exports.products = exports.pricing = exports.orders = exports.invoices = exports.customers = exports.customerPortals = exports.credits = exports.
|
|
39
|
+
exports.webhooks = exports.valueReceipts = exports.signals = exports.products = exports.pricing = exports.orders = exports.invoices = exports.customers = exports.customerPortals = exports.credits = exports.costs = exports.contacts = exports.checkouts = void 0;
|
|
40
40
|
__exportStar(require("./checkouts/client/requests/index.js"), exports);
|
|
41
41
|
exports.checkouts = __importStar(require("./checkouts/index.js"));
|
|
42
42
|
__exportStar(require("./checkouts/types/index.js"), exports);
|
|
43
43
|
__exportStar(require("./contacts/client/requests/index.js"), exports);
|
|
44
44
|
exports.contacts = __importStar(require("./contacts/index.js"));
|
|
45
|
-
__exportStar(require("./
|
|
46
|
-
exports.
|
|
45
|
+
__exportStar(require("./costs/client/requests/index.js"), exports);
|
|
46
|
+
exports.costs = __importStar(require("./costs/index.js"));
|
|
47
47
|
exports.credits = __importStar(require("./credits/index.js"));
|
|
48
48
|
__exportStar(require("./customerPortals/client/requests/index.js"), exports);
|
|
49
49
|
exports.customerPortals = __importStar(require("./customerPortals/index.js"));
|
package/dist/cjs/version.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const SDK_VERSION = "1.
|
|
1
|
+
export declare const SDK_VERSION = "1.7.0";
|
package/dist/cjs/version.js
CHANGED
package/dist/esm/Client.d.mts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Checkouts } from "./api/resources/checkouts/client/Client.mjs";
|
|
2
2
|
import { Contacts } from "./api/resources/contacts/client/Client.mjs";
|
|
3
|
-
import {
|
|
3
|
+
import { Costs } from "./api/resources/costs/client/Client.mjs";
|
|
4
4
|
import { Credits } from "./api/resources/credits/client/Client.mjs";
|
|
5
5
|
import { CustomerPortals } from "./api/resources/customerPortals/client/Client.mjs";
|
|
6
6
|
import { Customers } from "./api/resources/customers/client/Client.mjs";
|
|
@@ -32,7 +32,7 @@ export declare class PaidClient {
|
|
|
32
32
|
protected _valueReceipts: ValueReceipts | undefined;
|
|
33
33
|
protected _webhooks: Webhooks | undefined;
|
|
34
34
|
protected _pricing: Pricing | undefined;
|
|
35
|
-
protected
|
|
35
|
+
protected _costs: Costs | undefined;
|
|
36
36
|
constructor(_options: PaidClient.Options);
|
|
37
37
|
get products(): Products;
|
|
38
38
|
get customers(): Customers;
|
|
@@ -46,5 +46,5 @@ export declare class PaidClient {
|
|
|
46
46
|
get valueReceipts(): ValueReceipts;
|
|
47
47
|
get webhooks(): Webhooks;
|
|
48
48
|
get pricing(): Pricing;
|
|
49
|
-
get
|
|
49
|
+
get costs(): Costs;
|
|
50
50
|
}
|
package/dist/esm/Client.mjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// This file was auto-generated by Fern from our API Definition.
|
|
2
2
|
import { Checkouts } from "./api/resources/checkouts/client/Client.mjs";
|
|
3
3
|
import { Contacts } from "./api/resources/contacts/client/Client.mjs";
|
|
4
|
-
import {
|
|
4
|
+
import { Costs } from "./api/resources/costs/client/Client.mjs";
|
|
5
5
|
import { Credits } from "./api/resources/credits/client/Client.mjs";
|
|
6
6
|
import { CustomerPortals } from "./api/resources/customerPortals/client/Client.mjs";
|
|
7
7
|
import { Customers } from "./api/resources/customers/client/Client.mjs";
|
|
@@ -19,8 +19,8 @@ export class PaidClient {
|
|
|
19
19
|
this._options = Object.assign(Object.assign({}, _options), { headers: mergeHeaders({
|
|
20
20
|
"X-Fern-Language": "JavaScript",
|
|
21
21
|
"X-Fern-SDK-Name": "@paid-ai/paid-node",
|
|
22
|
-
"X-Fern-SDK-Version": "1.
|
|
23
|
-
"User-Agent": "@paid-ai/paid-node/1.
|
|
22
|
+
"X-Fern-SDK-Version": "1.7.0",
|
|
23
|
+
"User-Agent": "@paid-ai/paid-node/1.7.0",
|
|
24
24
|
"X-Fern-Runtime": core.RUNTIME.type,
|
|
25
25
|
"X-Fern-Runtime-Version": core.RUNTIME.version,
|
|
26
26
|
}, _options === null || _options === void 0 ? void 0 : _options.headers) });
|
|
@@ -73,8 +73,8 @@ export class PaidClient {
|
|
|
73
73
|
var _a;
|
|
74
74
|
return ((_a = this._pricing) !== null && _a !== void 0 ? _a : (this._pricing = new Pricing(this._options)));
|
|
75
75
|
}
|
|
76
|
-
get
|
|
76
|
+
get costs() {
|
|
77
77
|
var _a;
|
|
78
|
-
return ((_a = this.
|
|
78
|
+
return ((_a = this._costs) !== null && _a !== void 0 ? _a : (this._costs = new Costs(this._options)));
|
|
79
79
|
}
|
|
80
80
|
}
|
|
@@ -1,27 +1,27 @@
|
|
|
1
1
|
import type { BaseClientOptions, BaseRequestOptions } from "../../../../BaseClient.mjs";
|
|
2
2
|
import * as core from "../../../../core/index.mjs";
|
|
3
3
|
import * as Paid from "../../../index.mjs";
|
|
4
|
-
export declare namespace
|
|
4
|
+
export declare namespace Costs {
|
|
5
5
|
interface Options extends BaseClientOptions {
|
|
6
6
|
}
|
|
7
7
|
interface RequestOptions extends BaseRequestOptions {
|
|
8
8
|
}
|
|
9
9
|
}
|
|
10
|
-
export declare class
|
|
11
|
-
protected readonly _options:
|
|
12
|
-
constructor(_options:
|
|
10
|
+
export declare class Costs {
|
|
11
|
+
protected readonly _options: Costs.Options;
|
|
12
|
+
constructor(_options: Costs.Options);
|
|
13
13
|
/**
|
|
14
|
-
* Ingests a batch of cost records. Each record is either a pre-computed `cost` (caller supplies amount + currency) or a `usage` record (caller supplies vendor/model/token counts and Paid prices it server-side). The batch is all-or-nothing: if any record fails validation, the entire request is rejected with a 400 and nothing is persisted.
|
|
14
|
+
* Ingests a batch of cost records. Each record is either a pre-computed `cost` (caller supplies amount + currency) or a `usage` record (caller supplies vendor/model/token counts and Paid prices it server-side). The batch is all-or-nothing: if any record fails validation, the entire request is rejected with a 400 and nothing is persisted.
|
|
15
15
|
*
|
|
16
16
|
* @param {Paid.CostIngestRequest} request
|
|
17
|
-
* @param {
|
|
17
|
+
* @param {Costs.RequestOptions} requestOptions - Request-specific configuration.
|
|
18
18
|
*
|
|
19
19
|
* @throws {@link Paid.BadRequestError}
|
|
20
20
|
* @throws {@link Paid.ForbiddenError}
|
|
21
21
|
* @throws {@link Paid.InternalServerError}
|
|
22
22
|
*
|
|
23
23
|
* @example
|
|
24
|
-
* await client.
|
|
24
|
+
* await client.costs.createCosts({
|
|
25
25
|
* costs: [{
|
|
26
26
|
* type: "cost",
|
|
27
27
|
* customer: {
|
|
@@ -32,7 +32,7 @@ export declare class Cost {
|
|
|
32
32
|
* }]
|
|
33
33
|
* })
|
|
34
34
|
*/
|
|
35
|
-
|
|
36
|
-
private
|
|
35
|
+
createCosts(request: Paid.CostIngestRequest, requestOptions?: Costs.RequestOptions): core.HttpResponsePromise<Paid.CostIngestResponse>;
|
|
36
|
+
private __createCosts;
|
|
37
37
|
protected _getAuthorizationHeader(): Promise<string>;
|
|
38
38
|
}
|
|
@@ -13,22 +13,22 @@ import * as core from "../../../../core/index.mjs";
|
|
|
13
13
|
import * as environments from "../../../../environments.mjs";
|
|
14
14
|
import * as errors from "../../../../errors/index.mjs";
|
|
15
15
|
import * as Paid from "../../../index.mjs";
|
|
16
|
-
export class
|
|
16
|
+
export class Costs {
|
|
17
17
|
constructor(_options) {
|
|
18
18
|
this._options = _options;
|
|
19
19
|
}
|
|
20
20
|
/**
|
|
21
|
-
* Ingests a batch of cost records. Each record is either a pre-computed `cost` (caller supplies amount + currency) or a `usage` record (caller supplies vendor/model/token counts and Paid prices it server-side). The batch is all-or-nothing: if any record fails validation, the entire request is rejected with a 400 and nothing is persisted.
|
|
21
|
+
* Ingests a batch of cost records. Each record is either a pre-computed `cost` (caller supplies amount + currency) or a `usage` record (caller supplies vendor/model/token counts and Paid prices it server-side). The batch is all-or-nothing: if any record fails validation, the entire request is rejected with a 400 and nothing is persisted.
|
|
22
22
|
*
|
|
23
23
|
* @param {Paid.CostIngestRequest} request
|
|
24
|
-
* @param {
|
|
24
|
+
* @param {Costs.RequestOptions} requestOptions - Request-specific configuration.
|
|
25
25
|
*
|
|
26
26
|
* @throws {@link Paid.BadRequestError}
|
|
27
27
|
* @throws {@link Paid.ForbiddenError}
|
|
28
28
|
* @throws {@link Paid.InternalServerError}
|
|
29
29
|
*
|
|
30
30
|
* @example
|
|
31
|
-
* await client.
|
|
31
|
+
* await client.costs.createCosts({
|
|
32
32
|
* costs: [{
|
|
33
33
|
* type: "cost",
|
|
34
34
|
* customer: {
|
|
@@ -39,15 +39,15 @@ export class Cost {
|
|
|
39
39
|
* }]
|
|
40
40
|
* })
|
|
41
41
|
*/
|
|
42
|
-
|
|
43
|
-
return core.HttpResponsePromise.fromPromise(this.
|
|
42
|
+
createCosts(request, requestOptions) {
|
|
43
|
+
return core.HttpResponsePromise.fromPromise(this.__createCosts(request, requestOptions));
|
|
44
44
|
}
|
|
45
|
-
|
|
45
|
+
__createCosts(request, requestOptions) {
|
|
46
46
|
return __awaiter(this, void 0, void 0, function* () {
|
|
47
47
|
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
48
48
|
const _headers = mergeHeaders((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, mergeOnlyDefinedHeaders({ Authorization: yield this._getAuthorizationHeader() }), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
|
|
49
49
|
const _response = yield core.fetcher({
|
|
50
|
-
url: core.url.join((_c = (_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : (yield core.Supplier.get(this._options.environment))) !== null && _c !== void 0 ? _c : environments.PaidEnvironment.Default, "
|
|
50
|
+
url: core.url.join((_c = (_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : (yield core.Supplier.get(this._options.environment))) !== null && _c !== void 0 ? _c : environments.PaidEnvironment.Default, "costs/bulk"),
|
|
51
51
|
method: "POST",
|
|
52
52
|
headers: _headers,
|
|
53
53
|
contentType: "application/json",
|
|
@@ -85,7 +85,7 @@ export class Cost {
|
|
|
85
85
|
rawResponse: _response.rawResponse,
|
|
86
86
|
});
|
|
87
87
|
case "timeout":
|
|
88
|
-
throw new errors.PaidTimeoutError("Timeout exceeded when calling POST /
|
|
88
|
+
throw new errors.PaidTimeoutError("Timeout exceeded when calling POST /costs/bulk.");
|
|
89
89
|
case "unknown":
|
|
90
90
|
throw new errors.PaidError({
|
|
91
91
|
message: _response.error.errorMessage,
|
|
@@ -3,8 +3,8 @@ export * as checkouts from "./checkouts/index.mjs";
|
|
|
3
3
|
export * from "./checkouts/types/index.mjs";
|
|
4
4
|
export * from "./contacts/client/requests/index.mjs";
|
|
5
5
|
export * as contacts from "./contacts/index.mjs";
|
|
6
|
-
export * from "./
|
|
7
|
-
export * as
|
|
6
|
+
export * from "./costs/client/requests/index.mjs";
|
|
7
|
+
export * as costs from "./costs/index.mjs";
|
|
8
8
|
export * as credits from "./credits/index.mjs";
|
|
9
9
|
export * from "./customerPortals/client/requests/index.mjs";
|
|
10
10
|
export * as customerPortals from "./customerPortals/index.mjs";
|
|
@@ -3,8 +3,8 @@ export * as checkouts from "./checkouts/index.mjs";
|
|
|
3
3
|
export * from "./checkouts/types/index.mjs";
|
|
4
4
|
export * from "./contacts/client/requests/index.mjs";
|
|
5
5
|
export * as contacts from "./contacts/index.mjs";
|
|
6
|
-
export * from "./
|
|
7
|
-
export * as
|
|
6
|
+
export * from "./costs/client/requests/index.mjs";
|
|
7
|
+
export * as costs from "./costs/index.mjs";
|
|
8
8
|
export * as credits from "./credits/index.mjs";
|
|
9
9
|
export * from "./customerPortals/client/requests/index.mjs";
|
|
10
10
|
export * as customerPortals from "./customerPortals/index.mjs";
|
package/dist/esm/version.d.mts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const SDK_VERSION = "1.
|
|
1
|
+
export declare const SDK_VERSION = "1.7.0";
|
package/dist/esm/version.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const SDK_VERSION = "1.
|
|
1
|
+
export const SDK_VERSION = "1.7.0";
|
package/package.json
CHANGED
package/reference.md
CHANGED
|
@@ -3904,8 +3904,8 @@ await client.pricing.updatePricing({
|
|
|
3904
3904
|
</dl>
|
|
3905
3905
|
</details>
|
|
3906
3906
|
|
|
3907
|
-
##
|
|
3908
|
-
<details><summary><code>client.
|
|
3907
|
+
## Costs
|
|
3908
|
+
<details><summary><code>client.costs.<a href="/src/api/resources/costs/client/Client.ts">createCosts</a>({ ...params }) -> Paid.CostIngestResponse</code></summary>
|
|
3909
3909
|
<dl>
|
|
3910
3910
|
<dd>
|
|
3911
3911
|
|
|
@@ -3917,7 +3917,7 @@ await client.pricing.updatePricing({
|
|
|
3917
3917
|
<dl>
|
|
3918
3918
|
<dd>
|
|
3919
3919
|
|
|
3920
|
-
Ingests a batch of cost records. Each record is either a pre-computed `cost` (caller supplies amount + currency) or a `usage` record (caller supplies vendor/model/token counts and Paid prices it server-side). The batch is all-or-nothing: if any record fails validation, the entire request is rejected with a 400 and nothing is persisted.
|
|
3920
|
+
Ingests a batch of cost records. Each record is either a pre-computed `cost` (caller supplies amount + currency) or a `usage` record (caller supplies vendor/model/token counts and Paid prices it server-side). The batch is all-or-nothing: if any record fails validation, the entire request is rejected with a 400 and nothing is persisted.
|
|
3921
3921
|
</dd>
|
|
3922
3922
|
</dl>
|
|
3923
3923
|
</dd>
|
|
@@ -3932,7 +3932,7 @@ Ingests a batch of cost records. Each record is either a pre-computed `cost` (ca
|
|
|
3932
3932
|
<dd>
|
|
3933
3933
|
|
|
3934
3934
|
```typescript
|
|
3935
|
-
await client.
|
|
3935
|
+
await client.costs.createCosts({
|
|
3936
3936
|
costs: [{
|
|
3937
3937
|
type: "cost",
|
|
3938
3938
|
customer: {
|
|
@@ -3965,7 +3965,7 @@ await client.cost.ingestCost({
|
|
|
3965
3965
|
<dl>
|
|
3966
3966
|
<dd>
|
|
3967
3967
|
|
|
3968
|
-
**requestOptions:** `
|
|
3968
|
+
**requestOptions:** `Costs.RequestOptions`
|
|
3969
3969
|
|
|
3970
3970
|
</dd>
|
|
3971
3971
|
</dl>
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|