@openmeter/client 1.0.0-beta.229 → 1.0.0-beta.230
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 +49 -30
- package/dist/funcs/addons.js +111 -28
- package/dist/funcs/apps.js +37 -8
- package/dist/funcs/billing.js +79 -16
- package/dist/funcs/currencies.js +82 -22
- package/dist/funcs/customers.d.ts +3 -1
- package/dist/funcs/customers.js +390 -91
- package/dist/funcs/defaults.js +24 -4
- package/dist/funcs/entitlements.js +19 -5
- package/dist/funcs/events.js +26 -8
- package/dist/funcs/features.js +99 -27
- package/dist/funcs/governance.js +27 -9
- package/dist/funcs/index.d.ts +1 -0
- package/dist/funcs/index.js +1 -0
- package/dist/funcs/invoices.d.ts +8 -0
- package/dist/funcs/invoices.js +81 -0
- package/dist/funcs/llmCost.js +77 -23
- package/dist/funcs/meters.d.ts +2 -1
- package/dist/funcs/meters.js +118 -27
- package/dist/funcs/planAddons.js +103 -28
- package/dist/funcs/plans.js +113 -24
- package/dist/funcs/subscriptions.d.ts +2 -1
- package/dist/funcs/subscriptions.js +178 -39
- package/dist/funcs/tax.js +78 -21
- package/dist/index.d.ts +5 -1
- package/dist/index.js +2 -0
- package/dist/lib/config.d.ts +9 -0
- package/dist/lib/encodings.d.ts +1 -1
- package/dist/lib/encodings.js +5 -4
- package/dist/lib/wire.d.ts +18 -0
- package/dist/lib/wire.js +312 -0
- package/dist/models/operations/addons.d.ts +17 -5
- package/dist/models/operations/apps.d.ts +2 -1
- package/dist/models/operations/billing.d.ts +5 -4
- package/dist/models/operations/currencies.d.ts +27 -9
- package/dist/models/operations/customers.d.ts +83 -32
- package/dist/models/operations/defaults.d.ts +2 -1
- package/dist/models/operations/events.d.ts +20 -4
- package/dist/models/operations/features.d.ts +24 -8
- package/dist/models/operations/governance.d.ts +3 -2
- package/dist/models/operations/invoices.d.ts +48 -0
- package/dist/models/operations/invoices.js +2 -0
- package/dist/models/operations/llmCost.d.ts +16 -4
- package/dist/models/operations/meters.d.ts +29 -8
- package/dist/models/operations/planAddons.d.ts +7 -6
- package/dist/models/operations/plans.d.ts +14 -5
- package/dist/models/operations/subscriptions.d.ts +36 -10
- package/dist/models/operations/tax.d.ts +6 -5
- package/dist/models/schemas.d.ts +27210 -3012
- package/dist/models/schemas.js +6212 -492
- package/dist/models/types.d.ts +4240 -977
- package/dist/sdk/customers.d.ts +3 -1
- package/dist/sdk/customers.js +7 -1
- package/dist/sdk/invoices.d.ts +12 -0
- package/dist/sdk/invoices.js +21 -0
- package/dist/sdk/meters.d.ts +2 -1
- package/dist/sdk/meters.js +4 -1
- package/dist/sdk/sdk.d.ts +3 -0
- package/dist/sdk/sdk.js +5 -0
- package/dist/sdk/subscriptions.d.ts +2 -1
- package/dist/sdk/subscriptions.js +4 -1
- package/package.json +4 -3
package/dist/funcs/defaults.js
CHANGED
|
@@ -1,13 +1,33 @@
|
|
|
1
1
|
import { http } from '../core.js';
|
|
2
2
|
import { request } from '../lib/request.js';
|
|
3
|
+
import { toWire, fromWire, assertValid } from '../lib/wire.js';
|
|
4
|
+
import * as schemas from '../models/schemas.js';
|
|
3
5
|
export function getOrganizationDefaultTaxCodes(client, req, options) {
|
|
4
6
|
return request(() => http(client)
|
|
5
7
|
.get('openmeter/defaults/tax-codes', options)
|
|
6
|
-
.json()
|
|
8
|
+
.json()
|
|
9
|
+
.then((data) => {
|
|
10
|
+
if (client._options.validate) {
|
|
11
|
+
assertValid(schemas.getOrganizationDefaultTaxCodesResponseWire, data);
|
|
12
|
+
}
|
|
13
|
+
return fromWire(data, schemas.getOrganizationDefaultTaxCodesResponse);
|
|
14
|
+
}));
|
|
7
15
|
}
|
|
8
16
|
export function updateOrganizationDefaultTaxCodes(client, req, options) {
|
|
9
|
-
return request(() =>
|
|
10
|
-
|
|
11
|
-
.
|
|
17
|
+
return request(() => {
|
|
18
|
+
const body = toWire(req, schemas.updateOrganizationDefaultTaxCodesBody);
|
|
19
|
+
if (client._options.validate) {
|
|
20
|
+
assertValid(schemas.updateOrganizationDefaultTaxCodesBodyWire, body);
|
|
21
|
+
}
|
|
22
|
+
return http(client)
|
|
23
|
+
.put('openmeter/defaults/tax-codes', { ...options, json: body })
|
|
24
|
+
.json()
|
|
25
|
+
.then((data) => {
|
|
26
|
+
if (client._options.validate) {
|
|
27
|
+
assertValid(schemas.updateOrganizationDefaultTaxCodesResponseWire, data);
|
|
28
|
+
}
|
|
29
|
+
return fromWire(data, schemas.updateOrganizationDefaultTaxCodesResponse);
|
|
30
|
+
});
|
|
31
|
+
});
|
|
12
32
|
}
|
|
13
33
|
//# sourceMappingURL=defaults.js.map
|
|
@@ -1,10 +1,24 @@
|
|
|
1
1
|
import { http } from '../core.js';
|
|
2
2
|
import { request } from '../lib/request.js';
|
|
3
|
-
import {
|
|
3
|
+
import { fromWire, assertValid } from '../lib/wire.js';
|
|
4
|
+
import * as schemas from '../models/schemas.js';
|
|
4
5
|
export function listCustomerEntitlementAccess(client, req, options) {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
6
|
+
return request(() => {
|
|
7
|
+
const path = `openmeter/customers/${(() => {
|
|
8
|
+
if (req.customerId === undefined) {
|
|
9
|
+
throw new Error('missing path parameter: customerId');
|
|
10
|
+
}
|
|
11
|
+
return encodeURIComponent(String(req.customerId));
|
|
12
|
+
})()}/entitlement-access`;
|
|
13
|
+
return http(client)
|
|
14
|
+
.get(path, options)
|
|
15
|
+
.json()
|
|
16
|
+
.then((data) => {
|
|
17
|
+
if (client._options.validate) {
|
|
18
|
+
assertValid(schemas.listCustomerEntitlementAccessResponseWire, data);
|
|
19
|
+
}
|
|
20
|
+
return fromWire(data, schemas.listCustomerEntitlementAccessResponse);
|
|
21
|
+
});
|
|
22
|
+
});
|
|
9
23
|
}
|
|
10
24
|
//# sourceMappingURL=entitlements.js.map
|
package/dist/funcs/events.js
CHANGED
|
@@ -1,19 +1,37 @@
|
|
|
1
1
|
import { http } from '../core.js';
|
|
2
2
|
import { request } from '../lib/request.js';
|
|
3
3
|
import { toURLSearchParams, encodeSort } from '../lib/encodings.js';
|
|
4
|
+
import { toWire, fromWire, assertValid, toSnakeCase } from '../lib/wire.js';
|
|
5
|
+
import * as schemas from '../models/schemas.js';
|
|
4
6
|
export function listMeteringEvents(client, req = {}, options) {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
7
|
+
return request(() => {
|
|
8
|
+
const query = toWire({
|
|
9
|
+
page: req.page,
|
|
10
|
+
filter: req.filter,
|
|
11
|
+
sort: encodeSort(req.sort, toSnakeCase),
|
|
12
|
+
}, schemas.listMeteringEventsQueryParams);
|
|
13
|
+
if (client._options.validate) {
|
|
14
|
+
assertValid(schemas.listMeteringEventsQueryParamsWire, query);
|
|
15
|
+
}
|
|
16
|
+
const searchParams = toURLSearchParams(query);
|
|
17
|
+
return http(client)
|
|
18
|
+
.get('openmeter/events', { ...options, searchParams })
|
|
19
|
+
.json()
|
|
20
|
+
.then((data) => {
|
|
21
|
+
if (client._options.validate) {
|
|
22
|
+
assertValid(schemas.listMeteringEventsResponseWire, data);
|
|
23
|
+
}
|
|
24
|
+
return fromWire(data, schemas.listMeteringEventsResponse);
|
|
25
|
+
});
|
|
9
26
|
});
|
|
10
|
-
return request(() => http(client)
|
|
11
|
-
.get('openmeter/events', { ...options, searchParams })
|
|
12
|
-
.json());
|
|
13
27
|
}
|
|
14
28
|
export function ingestMeteringEvents(client, req, options) {
|
|
15
29
|
return request(async () => {
|
|
16
|
-
|
|
30
|
+
const body = toWire(req, schemas.ingestMeteringEventsBody);
|
|
31
|
+
if (client._options.validate) {
|
|
32
|
+
assertValid(schemas.ingestMeteringEventsBodyWire, body);
|
|
33
|
+
}
|
|
34
|
+
await http(client).post('openmeter/events', { ...options, json: body });
|
|
17
35
|
});
|
|
18
36
|
}
|
|
19
37
|
//# sourceMappingURL=events.js.map
|
package/dist/funcs/features.js
CHANGED
|
@@ -1,49 +1,121 @@
|
|
|
1
1
|
import { http } from '../core.js';
|
|
2
2
|
import { request } from '../lib/request.js';
|
|
3
|
-
import {
|
|
3
|
+
import { toURLSearchParams, encodeSort } from '../lib/encodings.js';
|
|
4
|
+
import { toWire, fromWire, assertValid, toSnakeCase } from '../lib/wire.js';
|
|
5
|
+
import * as schemas from '../models/schemas.js';
|
|
4
6
|
export function listFeatures(client, req = {}, options) {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
7
|
+
return request(() => {
|
|
8
|
+
const query = toWire({
|
|
9
|
+
page: req.page,
|
|
10
|
+
sort: encodeSort(req.sort, toSnakeCase),
|
|
11
|
+
filter: req.filter,
|
|
12
|
+
}, schemas.listFeaturesQueryParams);
|
|
13
|
+
if (client._options.validate) {
|
|
14
|
+
assertValid(schemas.listFeaturesQueryParamsWire, query);
|
|
15
|
+
}
|
|
16
|
+
const searchParams = toURLSearchParams(query);
|
|
17
|
+
return http(client)
|
|
18
|
+
.get('openmeter/features', { ...options, searchParams })
|
|
19
|
+
.json()
|
|
20
|
+
.then((data) => {
|
|
21
|
+
if (client._options.validate) {
|
|
22
|
+
assertValid(schemas.listFeaturesResponseWire, data);
|
|
23
|
+
}
|
|
24
|
+
return fromWire(data, schemas.listFeaturesResponse);
|
|
25
|
+
});
|
|
9
26
|
});
|
|
10
|
-
return request(() => http(client)
|
|
11
|
-
.get('openmeter/features', { ...options, searchParams })
|
|
12
|
-
.json());
|
|
13
27
|
}
|
|
14
28
|
export function createFeature(client, req, options) {
|
|
15
|
-
return request(() =>
|
|
16
|
-
|
|
17
|
-
.
|
|
29
|
+
return request(() => {
|
|
30
|
+
const body = toWire(req, schemas.createFeatureBody);
|
|
31
|
+
if (client._options.validate) {
|
|
32
|
+
assertValid(schemas.createFeatureBodyWire, body);
|
|
33
|
+
}
|
|
34
|
+
return http(client)
|
|
35
|
+
.post('openmeter/features', { ...options, json: body })
|
|
36
|
+
.json()
|
|
37
|
+
.then((data) => {
|
|
38
|
+
if (client._options.validate) {
|
|
39
|
+
assertValid(schemas.createFeatureResponseWire, data);
|
|
40
|
+
}
|
|
41
|
+
return fromWire(data, schemas.createFeatureResponse);
|
|
42
|
+
});
|
|
43
|
+
});
|
|
18
44
|
}
|
|
19
45
|
export function getFeature(client, req, options) {
|
|
20
|
-
|
|
21
|
-
|
|
46
|
+
return request(() => {
|
|
47
|
+
const path = `openmeter/features/${(() => {
|
|
48
|
+
if (req.featureId === undefined) {
|
|
49
|
+
throw new Error('missing path parameter: featureId');
|
|
50
|
+
}
|
|
51
|
+
return encodeURIComponent(String(req.featureId));
|
|
52
|
+
})()}`;
|
|
53
|
+
return http(client)
|
|
54
|
+
.get(path, options)
|
|
55
|
+
.json()
|
|
56
|
+
.then((data) => {
|
|
57
|
+
if (client._options.validate) {
|
|
58
|
+
assertValid(schemas.getFeatureResponseWire, data);
|
|
59
|
+
}
|
|
60
|
+
return fromWire(data, schemas.getFeatureResponse);
|
|
61
|
+
});
|
|
22
62
|
});
|
|
23
|
-
return request(() => http(client).get(path, options).json());
|
|
24
63
|
}
|
|
25
64
|
export function updateFeature(client, req, options) {
|
|
26
|
-
|
|
27
|
-
|
|
65
|
+
return request(() => {
|
|
66
|
+
const path = `openmeter/features/${(() => {
|
|
67
|
+
if (req.featureId === undefined) {
|
|
68
|
+
throw new Error('missing path parameter: featureId');
|
|
69
|
+
}
|
|
70
|
+
return encodeURIComponent(String(req.featureId));
|
|
71
|
+
})()}`;
|
|
72
|
+
const body = toWire(req.body, schemas.updateFeatureBody);
|
|
73
|
+
if (client._options.validate) {
|
|
74
|
+
assertValid(schemas.updateFeatureBodyWire, body);
|
|
75
|
+
}
|
|
76
|
+
return http(client)
|
|
77
|
+
.patch(path, { ...options, json: body })
|
|
78
|
+
.json()
|
|
79
|
+
.then((data) => {
|
|
80
|
+
if (client._options.validate) {
|
|
81
|
+
assertValid(schemas.updateFeatureResponseWire, data);
|
|
82
|
+
}
|
|
83
|
+
return fromWire(data, schemas.updateFeatureResponse);
|
|
84
|
+
});
|
|
28
85
|
});
|
|
29
|
-
return request(() => http(client)
|
|
30
|
-
.patch(path, { ...options, json: req.body })
|
|
31
|
-
.json());
|
|
32
86
|
}
|
|
33
87
|
export function deleteFeature(client, req, options) {
|
|
34
|
-
const path = encodePath('openmeter/features/{featureId}', {
|
|
35
|
-
featureId: req.featureId,
|
|
36
|
-
});
|
|
37
88
|
return request(async () => {
|
|
89
|
+
const path = `openmeter/features/${(() => {
|
|
90
|
+
if (req.featureId === undefined) {
|
|
91
|
+
throw new Error('missing path parameter: featureId');
|
|
92
|
+
}
|
|
93
|
+
return encodeURIComponent(String(req.featureId));
|
|
94
|
+
})()}`;
|
|
38
95
|
await http(client).delete(path, options);
|
|
39
96
|
});
|
|
40
97
|
}
|
|
41
98
|
export function queryFeatureCost(client, req, options) {
|
|
42
|
-
|
|
43
|
-
|
|
99
|
+
return request(() => {
|
|
100
|
+
const path = `openmeter/features/${(() => {
|
|
101
|
+
if (req.featureId === undefined) {
|
|
102
|
+
throw new Error('missing path parameter: featureId');
|
|
103
|
+
}
|
|
104
|
+
return encodeURIComponent(String(req.featureId));
|
|
105
|
+
})()}/cost/query`;
|
|
106
|
+
const body = toWire(req.body, schemas.queryFeatureCostBody);
|
|
107
|
+
if (client._options.validate) {
|
|
108
|
+
assertValid(schemas.queryFeatureCostBodyWire, body);
|
|
109
|
+
}
|
|
110
|
+
return http(client)
|
|
111
|
+
.post(path, { ...options, json: body })
|
|
112
|
+
.json()
|
|
113
|
+
.then((data) => {
|
|
114
|
+
if (client._options.validate) {
|
|
115
|
+
assertValid(schemas.queryFeatureCostResponseWire, data);
|
|
116
|
+
}
|
|
117
|
+
return fromWire(data, schemas.queryFeatureCostResponse);
|
|
118
|
+
});
|
|
44
119
|
});
|
|
45
|
-
return request(() => http(client)
|
|
46
|
-
.post(path, { ...options, json: req.body })
|
|
47
|
-
.json());
|
|
48
120
|
}
|
|
49
121
|
//# sourceMappingURL=features.js.map
|
package/dist/funcs/governance.js
CHANGED
|
@@ -1,16 +1,34 @@
|
|
|
1
1
|
import { http } from '../core.js';
|
|
2
2
|
import { request } from '../lib/request.js';
|
|
3
3
|
import { toURLSearchParams } from '../lib/encodings.js';
|
|
4
|
+
import { toWire, fromWire, assertValid } from '../lib/wire.js';
|
|
5
|
+
import * as schemas from '../models/schemas.js';
|
|
4
6
|
export function queryGovernanceAccess(client, req, options) {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
+
return request(() => {
|
|
8
|
+
const body = toWire(req.body, schemas.queryGovernanceAccessBody);
|
|
9
|
+
if (client._options.validate) {
|
|
10
|
+
assertValid(schemas.queryGovernanceAccessBodyWire, body);
|
|
11
|
+
}
|
|
12
|
+
const query = toWire({
|
|
13
|
+
page: req.page,
|
|
14
|
+
}, schemas.queryGovernanceAccessQueryParams);
|
|
15
|
+
if (client._options.validate) {
|
|
16
|
+
assertValid(schemas.queryGovernanceAccessQueryParamsWire, query);
|
|
17
|
+
}
|
|
18
|
+
const searchParams = toURLSearchParams(query);
|
|
19
|
+
return http(client)
|
|
20
|
+
.post('openmeter/governance/query', {
|
|
21
|
+
...options,
|
|
22
|
+
searchParams,
|
|
23
|
+
json: body,
|
|
24
|
+
})
|
|
25
|
+
.json()
|
|
26
|
+
.then((data) => {
|
|
27
|
+
if (client._options.validate) {
|
|
28
|
+
assertValid(schemas.queryGovernanceAccessResponseWire, data);
|
|
29
|
+
}
|
|
30
|
+
return fromWire(data, schemas.queryGovernanceAccessResponse);
|
|
31
|
+
});
|
|
7
32
|
});
|
|
8
|
-
return request(() => http(client)
|
|
9
|
-
.post('openmeter/governance/query', {
|
|
10
|
-
...options,
|
|
11
|
-
searchParams,
|
|
12
|
-
json: req.body,
|
|
13
|
-
})
|
|
14
|
-
.json());
|
|
15
33
|
}
|
|
16
34
|
//# sourceMappingURL=governance.js.map
|
package/dist/funcs/index.d.ts
CHANGED
package/dist/funcs/index.js
CHANGED
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { type Client } from '../core.js';
|
|
2
|
+
import { type Result, type RequestOptions } from '../lib/types.js';
|
|
3
|
+
import type { ListInvoicesRequest, ListInvoicesResponse, GetInvoiceRequest, GetInvoiceResponse, UpdateInvoiceRequest, UpdateInvoiceResponse, DeleteInvoiceRequest, DeleteInvoiceResponse } from '../models/operations/invoices.js';
|
|
4
|
+
export declare function listInvoices(client: Client, req?: ListInvoicesRequest, options?: RequestOptions): Promise<Result<ListInvoicesResponse>>;
|
|
5
|
+
export declare function getInvoice(client: Client, req: GetInvoiceRequest, options?: RequestOptions): Promise<Result<GetInvoiceResponse>>;
|
|
6
|
+
export declare function updateInvoice(client: Client, req: UpdateInvoiceRequest, options?: RequestOptions): Promise<Result<UpdateInvoiceResponse>>;
|
|
7
|
+
export declare function deleteInvoice(client: Client, req: DeleteInvoiceRequest, options?: RequestOptions): Promise<Result<DeleteInvoiceResponse>>;
|
|
8
|
+
//# sourceMappingURL=invoices.d.ts.map
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
import { http } from '../core.js';
|
|
2
|
+
import { request } from '../lib/request.js';
|
|
3
|
+
import { toURLSearchParams, encodeSort } from '../lib/encodings.js';
|
|
4
|
+
import { toWire, fromWire, assertValid, toSnakeCase } from '../lib/wire.js';
|
|
5
|
+
import * as schemas from '../models/schemas.js';
|
|
6
|
+
export function listInvoices(client, req = {}, options) {
|
|
7
|
+
return request(() => {
|
|
8
|
+
const query = toWire({
|
|
9
|
+
page: req.page,
|
|
10
|
+
sort: encodeSort(req.sort, toSnakeCase),
|
|
11
|
+
filter: req.filter,
|
|
12
|
+
}, schemas.listInvoicesQueryParams);
|
|
13
|
+
if (client._options.validate) {
|
|
14
|
+
assertValid(schemas.listInvoicesQueryParamsWire, query);
|
|
15
|
+
}
|
|
16
|
+
const searchParams = toURLSearchParams(query);
|
|
17
|
+
return http(client)
|
|
18
|
+
.get('openmeter/billing/invoices', { ...options, searchParams })
|
|
19
|
+
.json()
|
|
20
|
+
.then((data) => {
|
|
21
|
+
if (client._options.validate) {
|
|
22
|
+
assertValid(schemas.listInvoicesResponseWire, data);
|
|
23
|
+
}
|
|
24
|
+
return fromWire(data, schemas.listInvoicesResponse);
|
|
25
|
+
});
|
|
26
|
+
});
|
|
27
|
+
}
|
|
28
|
+
export function getInvoice(client, req, options) {
|
|
29
|
+
return request(() => {
|
|
30
|
+
const path = `openmeter/billing/invoices/${(() => {
|
|
31
|
+
if (req.invoiceId === undefined) {
|
|
32
|
+
throw new Error('missing path parameter: invoiceId');
|
|
33
|
+
}
|
|
34
|
+
return encodeURIComponent(String(req.invoiceId));
|
|
35
|
+
})()}`;
|
|
36
|
+
return http(client)
|
|
37
|
+
.get(path, options)
|
|
38
|
+
.json()
|
|
39
|
+
.then((data) => {
|
|
40
|
+
if (client._options.validate) {
|
|
41
|
+
assertValid(schemas.getInvoiceResponseWire, data);
|
|
42
|
+
}
|
|
43
|
+
return fromWire(data, schemas.getInvoiceResponse);
|
|
44
|
+
});
|
|
45
|
+
});
|
|
46
|
+
}
|
|
47
|
+
export function updateInvoice(client, req, options) {
|
|
48
|
+
return request(() => {
|
|
49
|
+
const path = `openmeter/billing/invoices/${(() => {
|
|
50
|
+
if (req.invoiceId === undefined) {
|
|
51
|
+
throw new Error('missing path parameter: invoiceId');
|
|
52
|
+
}
|
|
53
|
+
return encodeURIComponent(String(req.invoiceId));
|
|
54
|
+
})()}`;
|
|
55
|
+
const body = toWire(req.body, schemas.updateInvoiceBody);
|
|
56
|
+
if (client._options.validate) {
|
|
57
|
+
assertValid(schemas.updateInvoiceBodyWire, body);
|
|
58
|
+
}
|
|
59
|
+
return http(client)
|
|
60
|
+
.put(path, { ...options, json: body })
|
|
61
|
+
.json()
|
|
62
|
+
.then((data) => {
|
|
63
|
+
if (client._options.validate) {
|
|
64
|
+
assertValid(schemas.updateInvoiceResponseWire, data);
|
|
65
|
+
}
|
|
66
|
+
return fromWire(data, schemas.updateInvoiceResponse);
|
|
67
|
+
});
|
|
68
|
+
});
|
|
69
|
+
}
|
|
70
|
+
export function deleteInvoice(client, req, options) {
|
|
71
|
+
return request(async () => {
|
|
72
|
+
const path = `openmeter/billing/invoices/${(() => {
|
|
73
|
+
if (req.invoiceId === undefined) {
|
|
74
|
+
throw new Error('missing path parameter: invoiceId');
|
|
75
|
+
}
|
|
76
|
+
return encodeURIComponent(String(req.invoiceId));
|
|
77
|
+
})()}`;
|
|
78
|
+
await http(client).delete(path, options);
|
|
79
|
+
});
|
|
80
|
+
}
|
|
81
|
+
//# sourceMappingURL=invoices.js.map
|
package/dist/funcs/llmCost.js
CHANGED
|
@@ -1,41 +1,95 @@
|
|
|
1
1
|
import { http } from '../core.js';
|
|
2
2
|
import { request } from '../lib/request.js';
|
|
3
|
-
import {
|
|
3
|
+
import { toURLSearchParams, encodeSort } from '../lib/encodings.js';
|
|
4
|
+
import { toWire, fromWire, assertValid, toSnakeCase } from '../lib/wire.js';
|
|
5
|
+
import * as schemas from '../models/schemas.js';
|
|
4
6
|
export function listLlmCostPrices(client, req = {}, options) {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
7
|
+
return request(() => {
|
|
8
|
+
const query = toWire({
|
|
9
|
+
filter: req.filter,
|
|
10
|
+
sort: encodeSort(req.sort, toSnakeCase),
|
|
11
|
+
page: req.page,
|
|
12
|
+
}, schemas.listLlmCostPricesQueryParams);
|
|
13
|
+
if (client._options.validate) {
|
|
14
|
+
assertValid(schemas.listLlmCostPricesQueryParamsWire, query);
|
|
15
|
+
}
|
|
16
|
+
const searchParams = toURLSearchParams(query);
|
|
17
|
+
return http(client)
|
|
18
|
+
.get('openmeter/llm-cost/prices', { ...options, searchParams })
|
|
19
|
+
.json()
|
|
20
|
+
.then((data) => {
|
|
21
|
+
if (client._options.validate) {
|
|
22
|
+
assertValid(schemas.listLlmCostPricesResponseWire, data);
|
|
23
|
+
}
|
|
24
|
+
return fromWire(data, schemas.listLlmCostPricesResponse);
|
|
25
|
+
});
|
|
9
26
|
});
|
|
10
|
-
return request(() => http(client)
|
|
11
|
-
.get('openmeter/llm-cost/prices', { ...options, searchParams })
|
|
12
|
-
.json());
|
|
13
27
|
}
|
|
14
28
|
export function getLlmCostPrice(client, req, options) {
|
|
15
|
-
|
|
16
|
-
|
|
29
|
+
return request(() => {
|
|
30
|
+
const path = `openmeter/llm-cost/prices/${(() => {
|
|
31
|
+
if (req.priceId === undefined) {
|
|
32
|
+
throw new Error('missing path parameter: priceId');
|
|
33
|
+
}
|
|
34
|
+
return encodeURIComponent(String(req.priceId));
|
|
35
|
+
})()}`;
|
|
36
|
+
return http(client)
|
|
37
|
+
.get(path, options)
|
|
38
|
+
.json()
|
|
39
|
+
.then((data) => {
|
|
40
|
+
if (client._options.validate) {
|
|
41
|
+
assertValid(schemas.getLlmCostPriceResponseWire, data);
|
|
42
|
+
}
|
|
43
|
+
return fromWire(data, schemas.getLlmCostPriceResponse);
|
|
44
|
+
});
|
|
17
45
|
});
|
|
18
|
-
return request(() => http(client).get(path, options).json());
|
|
19
46
|
}
|
|
20
47
|
export function listLlmCostOverrides(client, req = {}, options) {
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
48
|
+
return request(() => {
|
|
49
|
+
const query = toWire({
|
|
50
|
+
filter: req.filter,
|
|
51
|
+
page: req.page,
|
|
52
|
+
}, schemas.listLlmCostOverridesQueryParams);
|
|
53
|
+
if (client._options.validate) {
|
|
54
|
+
assertValid(schemas.listLlmCostOverridesQueryParamsWire, query);
|
|
55
|
+
}
|
|
56
|
+
const searchParams = toURLSearchParams(query);
|
|
57
|
+
return http(client)
|
|
58
|
+
.get('openmeter/llm-cost/overrides', { ...options, searchParams })
|
|
59
|
+
.json()
|
|
60
|
+
.then((data) => {
|
|
61
|
+
if (client._options.validate) {
|
|
62
|
+
assertValid(schemas.listLlmCostOverridesResponseWire, data);
|
|
63
|
+
}
|
|
64
|
+
return fromWire(data, schemas.listLlmCostOverridesResponse);
|
|
65
|
+
});
|
|
24
66
|
});
|
|
25
|
-
return request(() => http(client)
|
|
26
|
-
.get('openmeter/llm-cost/overrides', { ...options, searchParams })
|
|
27
|
-
.json());
|
|
28
67
|
}
|
|
29
68
|
export function createLlmCostOverride(client, req, options) {
|
|
30
|
-
return request(() =>
|
|
31
|
-
|
|
32
|
-
.
|
|
69
|
+
return request(() => {
|
|
70
|
+
const body = toWire(req, schemas.createLlmCostOverrideBody);
|
|
71
|
+
if (client._options.validate) {
|
|
72
|
+
assertValid(schemas.createLlmCostOverrideBodyWire, body);
|
|
73
|
+
}
|
|
74
|
+
return http(client)
|
|
75
|
+
.post('openmeter/llm-cost/overrides', { ...options, json: body })
|
|
76
|
+
.json()
|
|
77
|
+
.then((data) => {
|
|
78
|
+
if (client._options.validate) {
|
|
79
|
+
assertValid(schemas.createLlmCostOverrideResponseWire, data);
|
|
80
|
+
}
|
|
81
|
+
return fromWire(data, schemas.createLlmCostOverrideResponse);
|
|
82
|
+
});
|
|
83
|
+
});
|
|
33
84
|
}
|
|
34
85
|
export function deleteLlmCostOverride(client, req, options) {
|
|
35
|
-
const path = encodePath('openmeter/llm-cost/overrides/{priceId}', {
|
|
36
|
-
priceId: req.priceId,
|
|
37
|
-
});
|
|
38
86
|
return request(async () => {
|
|
87
|
+
const path = `openmeter/llm-cost/overrides/${(() => {
|
|
88
|
+
if (req.priceId === undefined) {
|
|
89
|
+
throw new Error('missing path parameter: priceId');
|
|
90
|
+
}
|
|
91
|
+
return encodeURIComponent(String(req.priceId));
|
|
92
|
+
})()}`;
|
|
39
93
|
await http(client).delete(path, options);
|
|
40
94
|
});
|
|
41
95
|
}
|
package/dist/funcs/meters.d.ts
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import { type Client } from '../core.js';
|
|
2
2
|
import { type Result, type RequestOptions } from '../lib/types.js';
|
|
3
|
-
import type { CreateMeterRequest, CreateMeterResponse, GetMeterRequest, GetMeterResponse, ListMetersRequest, ListMetersResponse, UpdateMeterRequest, UpdateMeterResponse, DeleteMeterRequest, DeleteMeterResponse, QueryMeterRequest, QueryMeterResponse } from '../models/operations/meters.js';
|
|
3
|
+
import type { CreateMeterRequest, CreateMeterResponse, GetMeterRequest, GetMeterResponse, ListMetersRequest, ListMetersResponse, UpdateMeterRequest, UpdateMeterResponse, DeleteMeterRequest, DeleteMeterResponse, QueryMeterRequest, QueryMeterResponse, QueryMeterCsvRequest, QueryMeterCsvResponse } from '../models/operations/meters.js';
|
|
4
4
|
export declare function createMeter(client: Client, req: CreateMeterRequest, options?: RequestOptions): Promise<Result<CreateMeterResponse>>;
|
|
5
5
|
export declare function getMeter(client: Client, req: GetMeterRequest, options?: RequestOptions): Promise<Result<GetMeterResponse>>;
|
|
6
6
|
export declare function listMeters(client: Client, req?: ListMetersRequest, options?: RequestOptions): Promise<Result<ListMetersResponse>>;
|
|
7
7
|
export declare function updateMeter(client: Client, req: UpdateMeterRequest, options?: RequestOptions): Promise<Result<UpdateMeterResponse>>;
|
|
8
8
|
export declare function deleteMeter(client: Client, req: DeleteMeterRequest, options?: RequestOptions): Promise<Result<DeleteMeterResponse>>;
|
|
9
9
|
export declare function queryMeter(client: Client, req: QueryMeterRequest, options?: RequestOptions): Promise<Result<QueryMeterResponse>>;
|
|
10
|
+
export declare function queryMeterCsv(client: Client, req: QueryMeterCsvRequest, options?: RequestOptions): Promise<Result<QueryMeterCsvResponse>>;
|
|
10
11
|
//# sourceMappingURL=meters.d.ts.map
|