@openmeter/client 1.0.0-beta.229 → 1.0.0-beta.231
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/LICENSE +202 -0
- package/README.md +364 -66
- package/dist/core.d.ts +0 -1
- package/dist/core.js +8 -1
- package/dist/funcs/addons.d.ts +49 -1
- package/dist/funcs/addons.js +161 -29
- package/dist/funcs/apps.d.ts +14 -1
- package/dist/funcs/apps.js +52 -9
- package/dist/funcs/billing.d.ts +46 -1
- package/dist/funcs/billing.js +126 -17
- package/dist/funcs/currencies.d.ts +30 -1
- package/dist/funcs/currencies.js +113 -23
- package/dist/funcs/customers.d.ts +167 -2
- package/dist/funcs/customers.js +580 -90
- package/dist/funcs/defaults.d.ts +10 -1
- package/dist/funcs/defaults.js +35 -5
- package/dist/funcs/entitlements.d.ts +5 -1
- package/dist/funcs/entitlements.js +25 -6
- package/dist/funcs/events.d.ts +14 -1
- package/dist/funcs/events.js +41 -9
- package/dist/funcs/features.d.ts +42 -1
- package/dist/funcs/features.js +142 -28
- package/dist/funcs/governance.d.ts +14 -1
- package/dist/funcs/governance.js +42 -10
- package/dist/funcs/index.d.ts +1 -1
- package/dist/funcs/index.js +2 -1
- package/dist/funcs/invoices.d.ts +51 -0
- package/dist/funcs/invoices.js +125 -0
- package/dist/funcs/llmCost.d.ts +36 -1
- package/dist/funcs/llmCost.js +114 -24
- package/dist/funcs/meters.d.ts +55 -2
- package/dist/funcs/meters.js +172 -28
- package/dist/funcs/planAddons.d.ts +35 -1
- package/dist/funcs/planAddons.js +139 -29
- package/dist/funcs/plans.d.ts +49 -1
- package/dist/funcs/plans.js +163 -25
- package/dist/funcs/subscriptions.d.ts +61 -2
- package/dist/funcs/subscriptions.js +238 -40
- package/dist/funcs/tax.d.ts +25 -1
- package/dist/funcs/tax.js +104 -22
- package/dist/index.d.ts +6 -4
- package/dist/index.js +4 -3
- package/dist/lib/config.d.ts +9 -1
- package/dist/lib/config.js +1 -1
- package/dist/lib/encodings.d.ts +1 -2
- package/dist/lib/encodings.js +6 -5
- package/dist/lib/paginate.d.ts +56 -0
- package/dist/lib/paginate.js +60 -0
- package/dist/lib/request.d.ts +0 -1
- package/dist/lib/request.js +1 -1
- package/dist/lib/to-error.d.ts +0 -1
- package/dist/lib/to-error.js +1 -1
- package/dist/lib/types.d.ts +0 -1
- package/dist/lib/types.js +1 -1
- package/dist/lib/version.d.ts +1 -0
- package/dist/lib/version.js +5 -0
- package/dist/lib/wire.d.ts +20 -0
- package/dist/lib/wire.js +401 -0
- package/dist/models/errors.d.ts +13 -2
- package/dist/models/errors.js +31 -4
- package/dist/models/operations/addons.d.ts +17 -6
- package/dist/models/operations/addons.js +1 -1
- package/dist/models/operations/apps.d.ts +4 -6
- package/dist/models/operations/apps.js +1 -1
- package/dist/models/operations/billing.d.ts +5 -5
- package/dist/models/operations/billing.js +1 -1
- package/dist/models/operations/currencies.d.ts +27 -10
- package/dist/models/operations/currencies.js +1 -1
- package/dist/models/operations/customers.d.ts +87 -33
- package/dist/models/operations/customers.js +1 -1
- package/dist/models/operations/defaults.d.ts +2 -2
- package/dist/models/operations/defaults.js +1 -1
- package/dist/models/operations/entitlements.d.ts +0 -1
- package/dist/models/operations/entitlements.js +1 -1
- package/dist/models/operations/events.d.ts +20 -5
- package/dist/models/operations/events.js +1 -1
- package/dist/models/operations/features.d.ts +24 -9
- package/dist/models/operations/features.js +1 -1
- package/dist/models/operations/governance.d.ts +3 -3
- package/dist/models/operations/governance.js +1 -1
- package/dist/models/operations/invoices.d.ts +45 -0
- package/dist/models/operations/invoices.js +2 -0
- package/dist/models/operations/llmCost.d.ts +16 -5
- package/dist/models/operations/llmCost.js +1 -1
- package/dist/models/operations/meters.d.ts +29 -9
- package/dist/models/operations/meters.js +1 -1
- package/dist/models/operations/planAddons.d.ts +7 -7
- package/dist/models/operations/planAddons.js +1 -1
- package/dist/models/operations/plans.d.ts +14 -6
- package/dist/models/operations/plans.js +1 -1
- package/dist/models/operations/subscriptions.d.ts +36 -11
- package/dist/models/operations/subscriptions.js +1 -1
- package/dist/models/operations/tax.d.ts +6 -6
- package/dist/models/operations/tax.js +1 -1
- package/dist/models/schemas.d.ts +27484 -3125
- package/dist/models/schemas.js +6247 -495
- package/dist/models/types.d.ts +4548 -1398
- package/dist/models/types.js +1 -1
- package/dist/sdk/addons.d.ts +60 -1
- package/dist/sdk/addons.js +63 -1
- package/dist/sdk/apps.d.ts +25 -1
- package/dist/sdk/apps.js +28 -1
- package/dist/sdk/billing.d.ts +57 -1
- package/dist/sdk/billing.js +60 -1
- package/dist/sdk/customers.d.ts +213 -2
- package/dist/sdk/customers.js +228 -2
- package/dist/sdk/defaults.d.ts +10 -1
- package/dist/sdk/defaults.js +11 -1
- package/dist/sdk/entitlements.d.ts +5 -1
- package/dist/sdk/entitlements.js +6 -1
- package/dist/sdk/events.d.ts +25 -1
- package/dist/sdk/events.js +28 -1
- package/dist/sdk/features.d.ts +53 -1
- package/dist/sdk/features.js +56 -1
- package/dist/sdk/internal.d.ts +180 -0
- package/dist/sdk/internal.js +224 -0
- package/dist/sdk/llmCost.d.ts +57 -1
- package/dist/sdk/llmCost.js +62 -1
- package/dist/sdk/meters.d.ts +66 -2
- package/dist/sdk/meters.js +71 -2
- package/dist/sdk/planAddons.d.ts +46 -1
- package/dist/sdk/planAddons.js +49 -1
- package/dist/sdk/plans.d.ts +60 -1
- package/dist/sdk/plans.js +63 -1
- package/dist/sdk/sdk.d.ts +9 -7
- package/dist/sdk/sdk.js +11 -10
- package/dist/sdk/subscriptions.d.ts +71 -1
- package/dist/sdk/subscriptions.js +76 -1
- package/dist/sdk/tax.d.ts +34 -1
- package/dist/sdk/tax.js +37 -1
- package/package.json +31 -6
- package/dist/sdk/currencies.d.ts +0 -12
- package/dist/sdk/currencies.js +0 -21
- package/dist/sdk/governance.d.ts +0 -9
- package/dist/sdk/governance.js +0 -12
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
// Code generated by @openmeter/typespec-typescript. DO NOT EDIT.
|
|
2
|
+
import { http } from '../core.js';
|
|
3
|
+
import { request } from '../lib/request.js';
|
|
4
|
+
import { toURLSearchParams, encodeSort } from '../lib/encodings.js';
|
|
5
|
+
import { toWire, fromWire, assertValid, toSnakeCase } from '../lib/wire.js';
|
|
6
|
+
import * as schemas from '../models/schemas.js';
|
|
7
|
+
/**
|
|
8
|
+
* List billing invoices
|
|
9
|
+
*
|
|
10
|
+
* List billing invoices.
|
|
11
|
+
*
|
|
12
|
+
* Returns a page of invoices. Gathering invoices are never included. Use `filter`
|
|
13
|
+
* to narrow by status, customer, dates, or service period start. Use `sort` to
|
|
14
|
+
* control ordering.
|
|
15
|
+
*
|
|
16
|
+
* GET /openmeter/billing/invoices
|
|
17
|
+
*/
|
|
18
|
+
export function listInvoices(client, req = {}, options) {
|
|
19
|
+
return request(() => {
|
|
20
|
+
const query = toWire({
|
|
21
|
+
page: req.page,
|
|
22
|
+
sort: encodeSort(req.sort, toSnakeCase),
|
|
23
|
+
filter: req.filter,
|
|
24
|
+
}, schemas.listInvoicesQueryParams);
|
|
25
|
+
if (client._options.validate) {
|
|
26
|
+
assertValid(schemas.listInvoicesQueryParamsWire, query);
|
|
27
|
+
}
|
|
28
|
+
const searchParams = toURLSearchParams(query);
|
|
29
|
+
return http(client)
|
|
30
|
+
.get('openmeter/billing/invoices', { ...options, searchParams })
|
|
31
|
+
.json()
|
|
32
|
+
.then((data) => {
|
|
33
|
+
if (client._options.validate) {
|
|
34
|
+
assertValid(schemas.listInvoicesResponseWire, data);
|
|
35
|
+
}
|
|
36
|
+
return fromWire(data, schemas.listInvoicesResponse);
|
|
37
|
+
});
|
|
38
|
+
});
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* Get a billing invoice
|
|
42
|
+
*
|
|
43
|
+
* Get a billing invoice by ID.
|
|
44
|
+
*
|
|
45
|
+
* Returns the full invoice resource including line items, status details, totals,
|
|
46
|
+
* and workflow configuration snapshot.
|
|
47
|
+
*
|
|
48
|
+
* GET /openmeter/billing/invoices/{invoiceId}
|
|
49
|
+
*/
|
|
50
|
+
export function getInvoice(client, req, options) {
|
|
51
|
+
return request(() => {
|
|
52
|
+
const path = `openmeter/billing/invoices/${(() => {
|
|
53
|
+
if (req.invoiceId === undefined) {
|
|
54
|
+
throw new Error('missing path parameter: invoiceId');
|
|
55
|
+
}
|
|
56
|
+
return encodeURIComponent(String(req.invoiceId));
|
|
57
|
+
})()}`;
|
|
58
|
+
return http(client)
|
|
59
|
+
.get(path, options)
|
|
60
|
+
.json()
|
|
61
|
+
.then((data) => {
|
|
62
|
+
if (client._options.validate) {
|
|
63
|
+
assertValid(schemas.getInvoiceResponseWire, data);
|
|
64
|
+
}
|
|
65
|
+
return fromWire(data, schemas.getInvoiceResponse);
|
|
66
|
+
});
|
|
67
|
+
});
|
|
68
|
+
}
|
|
69
|
+
/**
|
|
70
|
+
* Update a billing invoice
|
|
71
|
+
*
|
|
72
|
+
* Update a billing invoice.
|
|
73
|
+
*
|
|
74
|
+
* Only the mutable fields of the invoice can be edited: description, labels,
|
|
75
|
+
* supplier, customer, workflow settings, and top-level lines. Top-level lines are
|
|
76
|
+
* matched by `id`; lines without an `id` are created, and existing lines omitted
|
|
77
|
+
* from `lines` are deleted. Detailed (child) lines are always computed and cannot
|
|
78
|
+
* be edited directly. Only invoices in draft status can be updated.
|
|
79
|
+
*
|
|
80
|
+
* PUT /openmeter/billing/invoices/{invoiceId}
|
|
81
|
+
*/
|
|
82
|
+
export function updateInvoice(client, req, options) {
|
|
83
|
+
return request(() => {
|
|
84
|
+
const path = `openmeter/billing/invoices/${(() => {
|
|
85
|
+
if (req.invoiceId === undefined) {
|
|
86
|
+
throw new Error('missing path parameter: invoiceId');
|
|
87
|
+
}
|
|
88
|
+
return encodeURIComponent(String(req.invoiceId));
|
|
89
|
+
})()}`;
|
|
90
|
+
const body = toWire(req.body, schemas.updateInvoiceBody);
|
|
91
|
+
if (client._options.validate) {
|
|
92
|
+
assertValid(schemas.updateInvoiceBodyWire, body);
|
|
93
|
+
}
|
|
94
|
+
return http(client)
|
|
95
|
+
.put(path, { ...options, json: body })
|
|
96
|
+
.json()
|
|
97
|
+
.then((data) => {
|
|
98
|
+
if (client._options.validate) {
|
|
99
|
+
assertValid(schemas.updateInvoiceResponseWire, data);
|
|
100
|
+
}
|
|
101
|
+
return fromWire(data, schemas.updateInvoiceResponse);
|
|
102
|
+
});
|
|
103
|
+
});
|
|
104
|
+
}
|
|
105
|
+
/**
|
|
106
|
+
* Delete a billing invoice
|
|
107
|
+
*
|
|
108
|
+
* Delete a billing invoice.
|
|
109
|
+
*
|
|
110
|
+
* Only standard invoices in draft status can be deleted. Deleting an invoice will
|
|
111
|
+
* also delete all associated line items and workflow configuration.
|
|
112
|
+
*
|
|
113
|
+
* DELETE /openmeter/billing/invoices/{invoiceId}
|
|
114
|
+
*/
|
|
115
|
+
export function deleteInvoice(client, req, options) {
|
|
116
|
+
return request(async () => {
|
|
117
|
+
const path = `openmeter/billing/invoices/${(() => {
|
|
118
|
+
if (req.invoiceId === undefined) {
|
|
119
|
+
throw new Error('missing path parameter: invoiceId');
|
|
120
|
+
}
|
|
121
|
+
return encodeURIComponent(String(req.invoiceId));
|
|
122
|
+
})()}`;
|
|
123
|
+
await http(client).delete(path, options);
|
|
124
|
+
});
|
|
125
|
+
}
|
package/dist/funcs/llmCost.d.ts
CHANGED
|
@@ -1,9 +1,44 @@
|
|
|
1
1
|
import { type Client } from '../core.js';
|
|
2
2
|
import { type Result, type RequestOptions } from '../lib/types.js';
|
|
3
3
|
import type { ListLlmCostPricesRequest, ListLlmCostPricesResponse, GetLlmCostPriceRequest, GetLlmCostPriceResponse, ListLlmCostOverridesRequest, ListLlmCostOverridesResponse, CreateLlmCostOverrideRequest, CreateLlmCostOverrideResponse, DeleteLlmCostOverrideRequest, DeleteLlmCostOverrideResponse } from '../models/operations/llmCost.js';
|
|
4
|
+
/**
|
|
5
|
+
* List LLM cost prices
|
|
6
|
+
*
|
|
7
|
+
* List global LLM cost prices. Returns prices with overrides applied if any.
|
|
8
|
+
*
|
|
9
|
+
* GET /openmeter/llm-cost/prices
|
|
10
|
+
*/
|
|
4
11
|
export declare function listLlmCostPrices(client: Client, req?: ListLlmCostPricesRequest, options?: RequestOptions): Promise<Result<ListLlmCostPricesResponse>>;
|
|
12
|
+
/**
|
|
13
|
+
* Get LLM cost price
|
|
14
|
+
*
|
|
15
|
+
* Get a specific LLM cost price by ID. Returns the price with overrides applied if
|
|
16
|
+
* any.
|
|
17
|
+
*
|
|
18
|
+
* GET /openmeter/llm-cost/prices/{priceId}
|
|
19
|
+
*/
|
|
5
20
|
export declare function getLlmCostPrice(client: Client, req: GetLlmCostPriceRequest, options?: RequestOptions): Promise<Result<GetLlmCostPriceResponse>>;
|
|
21
|
+
/**
|
|
22
|
+
* List LLM cost overrides
|
|
23
|
+
*
|
|
24
|
+
* List per-namespace price overrides.
|
|
25
|
+
*
|
|
26
|
+
* GET /openmeter/llm-cost/overrides
|
|
27
|
+
*/
|
|
6
28
|
export declare function listLlmCostOverrides(client: Client, req?: ListLlmCostOverridesRequest, options?: RequestOptions): Promise<Result<ListLlmCostOverridesResponse>>;
|
|
29
|
+
/**
|
|
30
|
+
* Create LLM cost override
|
|
31
|
+
*
|
|
32
|
+
* Create a per-namespace price override.
|
|
33
|
+
*
|
|
34
|
+
* POST /openmeter/llm-cost/overrides
|
|
35
|
+
*/
|
|
7
36
|
export declare function createLlmCostOverride(client: Client, req: CreateLlmCostOverrideRequest, options?: RequestOptions): Promise<Result<CreateLlmCostOverrideResponse>>;
|
|
37
|
+
/**
|
|
38
|
+
* Delete LLM cost override
|
|
39
|
+
*
|
|
40
|
+
* Delete a per-namespace price override.
|
|
41
|
+
*
|
|
42
|
+
* DELETE /openmeter/llm-cost/overrides/{priceId}
|
|
43
|
+
*/
|
|
8
44
|
export declare function deleteLlmCostOverride(client: Client, req: DeleteLlmCostOverrideRequest, options?: RequestOptions): Promise<Result<DeleteLlmCostOverrideResponse>>;
|
|
9
|
-
//# sourceMappingURL=llmCost.d.ts.map
|
package/dist/funcs/llmCost.js
CHANGED
|
@@ -1,42 +1,132 @@
|
|
|
1
|
+
// Code generated by @openmeter/typespec-typescript. DO NOT EDIT.
|
|
1
2
|
import { http } from '../core.js';
|
|
2
3
|
import { request } from '../lib/request.js';
|
|
3
|
-
import {
|
|
4
|
+
import { toURLSearchParams, encodeSort } from '../lib/encodings.js';
|
|
5
|
+
import { toWire, fromWire, assertValid, toSnakeCase } from '../lib/wire.js';
|
|
6
|
+
import * as schemas from '../models/schemas.js';
|
|
7
|
+
/**
|
|
8
|
+
* List LLM cost prices
|
|
9
|
+
*
|
|
10
|
+
* List global LLM cost prices. Returns prices with overrides applied if any.
|
|
11
|
+
*
|
|
12
|
+
* GET /openmeter/llm-cost/prices
|
|
13
|
+
*/
|
|
4
14
|
export function listLlmCostPrices(client, req = {}, options) {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
15
|
+
return request(() => {
|
|
16
|
+
const query = toWire({
|
|
17
|
+
filter: req.filter,
|
|
18
|
+
sort: encodeSort(req.sort, toSnakeCase),
|
|
19
|
+
page: req.page,
|
|
20
|
+
}, schemas.listLlmCostPricesQueryParams);
|
|
21
|
+
if (client._options.validate) {
|
|
22
|
+
assertValid(schemas.listLlmCostPricesQueryParamsWire, query);
|
|
23
|
+
}
|
|
24
|
+
const searchParams = toURLSearchParams(query);
|
|
25
|
+
return http(client)
|
|
26
|
+
.get('openmeter/llm-cost/prices', { ...options, searchParams })
|
|
27
|
+
.json()
|
|
28
|
+
.then((data) => {
|
|
29
|
+
if (client._options.validate) {
|
|
30
|
+
assertValid(schemas.listLlmCostPricesResponseWire, data);
|
|
31
|
+
}
|
|
32
|
+
return fromWire(data, schemas.listLlmCostPricesResponse);
|
|
33
|
+
});
|
|
9
34
|
});
|
|
10
|
-
return request(() => http(client)
|
|
11
|
-
.get('openmeter/llm-cost/prices', { ...options, searchParams })
|
|
12
|
-
.json());
|
|
13
35
|
}
|
|
36
|
+
/**
|
|
37
|
+
* Get LLM cost price
|
|
38
|
+
*
|
|
39
|
+
* Get a specific LLM cost price by ID. Returns the price with overrides applied if
|
|
40
|
+
* any.
|
|
41
|
+
*
|
|
42
|
+
* GET /openmeter/llm-cost/prices/{priceId}
|
|
43
|
+
*/
|
|
14
44
|
export function getLlmCostPrice(client, req, options) {
|
|
15
|
-
|
|
16
|
-
|
|
45
|
+
return request(() => {
|
|
46
|
+
const path = `openmeter/llm-cost/prices/${(() => {
|
|
47
|
+
if (req.priceId === undefined) {
|
|
48
|
+
throw new Error('missing path parameter: priceId');
|
|
49
|
+
}
|
|
50
|
+
return encodeURIComponent(String(req.priceId));
|
|
51
|
+
})()}`;
|
|
52
|
+
return http(client)
|
|
53
|
+
.get(path, options)
|
|
54
|
+
.json()
|
|
55
|
+
.then((data) => {
|
|
56
|
+
if (client._options.validate) {
|
|
57
|
+
assertValid(schemas.getLlmCostPriceResponseWire, data);
|
|
58
|
+
}
|
|
59
|
+
return fromWire(data, schemas.getLlmCostPriceResponse);
|
|
60
|
+
});
|
|
17
61
|
});
|
|
18
|
-
return request(() => http(client).get(path, options).json());
|
|
19
62
|
}
|
|
63
|
+
/**
|
|
64
|
+
* List LLM cost overrides
|
|
65
|
+
*
|
|
66
|
+
* List per-namespace price overrides.
|
|
67
|
+
*
|
|
68
|
+
* GET /openmeter/llm-cost/overrides
|
|
69
|
+
*/
|
|
20
70
|
export function listLlmCostOverrides(client, req = {}, options) {
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
71
|
+
return request(() => {
|
|
72
|
+
const query = toWire({
|
|
73
|
+
filter: req.filter,
|
|
74
|
+
page: req.page,
|
|
75
|
+
}, schemas.listLlmCostOverridesQueryParams);
|
|
76
|
+
if (client._options.validate) {
|
|
77
|
+
assertValid(schemas.listLlmCostOverridesQueryParamsWire, query);
|
|
78
|
+
}
|
|
79
|
+
const searchParams = toURLSearchParams(query);
|
|
80
|
+
return http(client)
|
|
81
|
+
.get('openmeter/llm-cost/overrides', { ...options, searchParams })
|
|
82
|
+
.json()
|
|
83
|
+
.then((data) => {
|
|
84
|
+
if (client._options.validate) {
|
|
85
|
+
assertValid(schemas.listLlmCostOverridesResponseWire, data);
|
|
86
|
+
}
|
|
87
|
+
return fromWire(data, schemas.listLlmCostOverridesResponse);
|
|
88
|
+
});
|
|
24
89
|
});
|
|
25
|
-
return request(() => http(client)
|
|
26
|
-
.get('openmeter/llm-cost/overrides', { ...options, searchParams })
|
|
27
|
-
.json());
|
|
28
90
|
}
|
|
91
|
+
/**
|
|
92
|
+
* Create LLM cost override
|
|
93
|
+
*
|
|
94
|
+
* Create a per-namespace price override.
|
|
95
|
+
*
|
|
96
|
+
* POST /openmeter/llm-cost/overrides
|
|
97
|
+
*/
|
|
29
98
|
export function createLlmCostOverride(client, req, options) {
|
|
30
|
-
return request(() =>
|
|
31
|
-
|
|
32
|
-
.
|
|
99
|
+
return request(() => {
|
|
100
|
+
const body = toWire(req, schemas.createLlmCostOverrideBody);
|
|
101
|
+
if (client._options.validate) {
|
|
102
|
+
assertValid(schemas.createLlmCostOverrideBodyWire, body);
|
|
103
|
+
}
|
|
104
|
+
return http(client)
|
|
105
|
+
.post('openmeter/llm-cost/overrides', { ...options, json: body })
|
|
106
|
+
.json()
|
|
107
|
+
.then((data) => {
|
|
108
|
+
if (client._options.validate) {
|
|
109
|
+
assertValid(schemas.createLlmCostOverrideResponseWire, data);
|
|
110
|
+
}
|
|
111
|
+
return fromWire(data, schemas.createLlmCostOverrideResponse);
|
|
112
|
+
});
|
|
113
|
+
});
|
|
33
114
|
}
|
|
115
|
+
/**
|
|
116
|
+
* Delete LLM cost override
|
|
117
|
+
*
|
|
118
|
+
* Delete a per-namespace price override.
|
|
119
|
+
*
|
|
120
|
+
* DELETE /openmeter/llm-cost/overrides/{priceId}
|
|
121
|
+
*/
|
|
34
122
|
export function deleteLlmCostOverride(client, req, options) {
|
|
35
|
-
const path = encodePath('openmeter/llm-cost/overrides/{priceId}', {
|
|
36
|
-
priceId: req.priceId,
|
|
37
|
-
});
|
|
38
123
|
return request(async () => {
|
|
124
|
+
const path = `openmeter/llm-cost/overrides/${(() => {
|
|
125
|
+
if (req.priceId === undefined) {
|
|
126
|
+
throw new Error('missing path parameter: priceId');
|
|
127
|
+
}
|
|
128
|
+
return encodeURIComponent(String(req.priceId));
|
|
129
|
+
})()}`;
|
|
39
130
|
await http(client).delete(path, options);
|
|
40
131
|
});
|
|
41
132
|
}
|
|
42
|
-
//# sourceMappingURL=llmCost.js.map
|
package/dist/funcs/meters.d.ts
CHANGED
|
@@ -1,10 +1,63 @@
|
|
|
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
|
+
/**
|
|
5
|
+
* Create meter
|
|
6
|
+
*
|
|
7
|
+
* Create a meter.
|
|
8
|
+
*
|
|
9
|
+
* POST /openmeter/meters
|
|
10
|
+
*/
|
|
4
11
|
export declare function createMeter(client: Client, req: CreateMeterRequest, options?: RequestOptions): Promise<Result<CreateMeterResponse>>;
|
|
12
|
+
/**
|
|
13
|
+
* Get meter
|
|
14
|
+
*
|
|
15
|
+
* Get a meter by ID.
|
|
16
|
+
*
|
|
17
|
+
* GET /openmeter/meters/{meterId}
|
|
18
|
+
*/
|
|
5
19
|
export declare function getMeter(client: Client, req: GetMeterRequest, options?: RequestOptions): Promise<Result<GetMeterResponse>>;
|
|
20
|
+
/**
|
|
21
|
+
* List meters
|
|
22
|
+
*
|
|
23
|
+
* List meters.
|
|
24
|
+
*
|
|
25
|
+
* GET /openmeter/meters
|
|
26
|
+
*/
|
|
6
27
|
export declare function listMeters(client: Client, req?: ListMetersRequest, options?: RequestOptions): Promise<Result<ListMetersResponse>>;
|
|
28
|
+
/**
|
|
29
|
+
* Update meter
|
|
30
|
+
*
|
|
31
|
+
* Update a meter.
|
|
32
|
+
*
|
|
33
|
+
* PUT /openmeter/meters/{meterId}
|
|
34
|
+
*/
|
|
7
35
|
export declare function updateMeter(client: Client, req: UpdateMeterRequest, options?: RequestOptions): Promise<Result<UpdateMeterResponse>>;
|
|
36
|
+
/**
|
|
37
|
+
* Delete meter
|
|
38
|
+
*
|
|
39
|
+
* Delete a meter.
|
|
40
|
+
*
|
|
41
|
+
* DELETE /openmeter/meters/{meterId}
|
|
42
|
+
*/
|
|
8
43
|
export declare function deleteMeter(client: Client, req: DeleteMeterRequest, options?: RequestOptions): Promise<Result<DeleteMeterResponse>>;
|
|
44
|
+
/**
|
|
45
|
+
* Query meter
|
|
46
|
+
*
|
|
47
|
+
* Query a meter for usage.
|
|
48
|
+
*
|
|
49
|
+
* Set `Accept: application/json` (the default) to get a structured JSON response.
|
|
50
|
+
* Set `Accept: text/csv` to download the same data as a CSV file suitable for
|
|
51
|
+
* spreadsheets. The CSV columns, in order, are:
|
|
52
|
+
*
|
|
53
|
+
* `from, to, [subject,] [customer_id, customer_key, customer_name,] <dimensions...>, value`
|
|
54
|
+
*
|
|
55
|
+
* The `subject` column is emitted only when `subject` is in the query's
|
|
56
|
+
* `group_by_dimensions`. The three `customer_*` columns are emitted together only
|
|
57
|
+
* when `customer_id` is in the query's `group_by_dimensions`.
|
|
58
|
+
*
|
|
59
|
+
* POST /openmeter/meters/{meterId}/query
|
|
60
|
+
*/
|
|
9
61
|
export declare function queryMeter(client: Client, req: QueryMeterRequest, options?: RequestOptions): Promise<Result<QueryMeterResponse>>;
|
|
10
|
-
|
|
62
|
+
/** POST /openmeter/meters/{meterId}/query */
|
|
63
|
+
export declare function queryMeterCsv(client: Client, req: QueryMeterCsvRequest, options?: RequestOptions): Promise<Result<QueryMeterCsvResponse>>;
|
package/dist/funcs/meters.js
CHANGED
|
@@ -1,49 +1,193 @@
|
|
|
1
|
+
// Code generated by @openmeter/typespec-typescript. DO NOT EDIT.
|
|
1
2
|
import { http } from '../core.js';
|
|
2
3
|
import { request } from '../lib/request.js';
|
|
3
|
-
import {
|
|
4
|
+
import { toURLSearchParams, encodeSort } from '../lib/encodings.js';
|
|
5
|
+
import { toWire, fromWire, assertValid, toSnakeCase } from '../lib/wire.js';
|
|
6
|
+
import * as schemas from '../models/schemas.js';
|
|
7
|
+
/**
|
|
8
|
+
* Create meter
|
|
9
|
+
*
|
|
10
|
+
* Create a meter.
|
|
11
|
+
*
|
|
12
|
+
* POST /openmeter/meters
|
|
13
|
+
*/
|
|
4
14
|
export function createMeter(client, req, options) {
|
|
5
|
-
return request(() =>
|
|
6
|
-
|
|
7
|
-
.
|
|
15
|
+
return request(() => {
|
|
16
|
+
const body = toWire(req, schemas.createMeterBody);
|
|
17
|
+
if (client._options.validate) {
|
|
18
|
+
assertValid(schemas.createMeterBodyWire, body);
|
|
19
|
+
}
|
|
20
|
+
return http(client)
|
|
21
|
+
.post('openmeter/meters', { ...options, json: body })
|
|
22
|
+
.json()
|
|
23
|
+
.then((data) => {
|
|
24
|
+
if (client._options.validate) {
|
|
25
|
+
assertValid(schemas.createMeterResponseWire, data);
|
|
26
|
+
}
|
|
27
|
+
return fromWire(data, schemas.createMeterResponse);
|
|
28
|
+
});
|
|
29
|
+
});
|
|
8
30
|
}
|
|
31
|
+
/**
|
|
32
|
+
* Get meter
|
|
33
|
+
*
|
|
34
|
+
* Get a meter by ID.
|
|
35
|
+
*
|
|
36
|
+
* GET /openmeter/meters/{meterId}
|
|
37
|
+
*/
|
|
9
38
|
export function getMeter(client, req, options) {
|
|
10
|
-
|
|
11
|
-
|
|
39
|
+
return request(() => {
|
|
40
|
+
const path = `openmeter/meters/${(() => {
|
|
41
|
+
if (req.meterId === undefined) {
|
|
42
|
+
throw new Error('missing path parameter: meterId');
|
|
43
|
+
}
|
|
44
|
+
return encodeURIComponent(String(req.meterId));
|
|
45
|
+
})()}`;
|
|
46
|
+
return http(client)
|
|
47
|
+
.get(path, options)
|
|
48
|
+
.json()
|
|
49
|
+
.then((data) => {
|
|
50
|
+
if (client._options.validate) {
|
|
51
|
+
assertValid(schemas.getMeterResponseWire, data);
|
|
52
|
+
}
|
|
53
|
+
return fromWire(data, schemas.getMeterResponse);
|
|
54
|
+
});
|
|
12
55
|
});
|
|
13
|
-
return request(() => http(client).get(path, options).json());
|
|
14
56
|
}
|
|
57
|
+
/**
|
|
58
|
+
* List meters
|
|
59
|
+
*
|
|
60
|
+
* List meters.
|
|
61
|
+
*
|
|
62
|
+
* GET /openmeter/meters
|
|
63
|
+
*/
|
|
15
64
|
export function listMeters(client, req = {}, options) {
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
65
|
+
return request(() => {
|
|
66
|
+
const query = toWire({
|
|
67
|
+
page: req.page,
|
|
68
|
+
sort: encodeSort(req.sort, toSnakeCase),
|
|
69
|
+
filter: req.filter,
|
|
70
|
+
}, schemas.listMetersQueryParams);
|
|
71
|
+
if (client._options.validate) {
|
|
72
|
+
assertValid(schemas.listMetersQueryParamsWire, query);
|
|
73
|
+
}
|
|
74
|
+
const searchParams = toURLSearchParams(query);
|
|
75
|
+
return http(client)
|
|
76
|
+
.get('openmeter/meters', { ...options, searchParams })
|
|
77
|
+
.json()
|
|
78
|
+
.then((data) => {
|
|
79
|
+
if (client._options.validate) {
|
|
80
|
+
assertValid(schemas.listMetersResponseWire, data);
|
|
81
|
+
}
|
|
82
|
+
return fromWire(data, schemas.listMetersResponse);
|
|
83
|
+
});
|
|
20
84
|
});
|
|
21
|
-
return request(() => http(client)
|
|
22
|
-
.get('openmeter/meters', { ...options, searchParams })
|
|
23
|
-
.json());
|
|
24
85
|
}
|
|
86
|
+
/**
|
|
87
|
+
* Update meter
|
|
88
|
+
*
|
|
89
|
+
* Update a meter.
|
|
90
|
+
*
|
|
91
|
+
* PUT /openmeter/meters/{meterId}
|
|
92
|
+
*/
|
|
25
93
|
export function updateMeter(client, req, options) {
|
|
26
|
-
|
|
27
|
-
|
|
94
|
+
return request(() => {
|
|
95
|
+
const path = `openmeter/meters/${(() => {
|
|
96
|
+
if (req.meterId === undefined) {
|
|
97
|
+
throw new Error('missing path parameter: meterId');
|
|
98
|
+
}
|
|
99
|
+
return encodeURIComponent(String(req.meterId));
|
|
100
|
+
})()}`;
|
|
101
|
+
const body = toWire(req.body, schemas.updateMeterBody);
|
|
102
|
+
if (client._options.validate) {
|
|
103
|
+
assertValid(schemas.updateMeterBodyWire, body);
|
|
104
|
+
}
|
|
105
|
+
return http(client)
|
|
106
|
+
.put(path, { ...options, json: body })
|
|
107
|
+
.json()
|
|
108
|
+
.then((data) => {
|
|
109
|
+
if (client._options.validate) {
|
|
110
|
+
assertValid(schemas.updateMeterResponseWire, data);
|
|
111
|
+
}
|
|
112
|
+
return fromWire(data, schemas.updateMeterResponse);
|
|
113
|
+
});
|
|
28
114
|
});
|
|
29
|
-
return request(() => http(client)
|
|
30
|
-
.put(path, { ...options, json: req.body })
|
|
31
|
-
.json());
|
|
32
115
|
}
|
|
116
|
+
/**
|
|
117
|
+
* Delete meter
|
|
118
|
+
*
|
|
119
|
+
* Delete a meter.
|
|
120
|
+
*
|
|
121
|
+
* DELETE /openmeter/meters/{meterId}
|
|
122
|
+
*/
|
|
33
123
|
export function deleteMeter(client, req, options) {
|
|
34
|
-
const path = encodePath('openmeter/meters/{meterId}', {
|
|
35
|
-
meterId: req.meterId,
|
|
36
|
-
});
|
|
37
124
|
return request(async () => {
|
|
125
|
+
const path = `openmeter/meters/${(() => {
|
|
126
|
+
if (req.meterId === undefined) {
|
|
127
|
+
throw new Error('missing path parameter: meterId');
|
|
128
|
+
}
|
|
129
|
+
return encodeURIComponent(String(req.meterId));
|
|
130
|
+
})()}`;
|
|
38
131
|
await http(client).delete(path, options);
|
|
39
132
|
});
|
|
40
133
|
}
|
|
134
|
+
/**
|
|
135
|
+
* Query meter
|
|
136
|
+
*
|
|
137
|
+
* Query a meter for usage.
|
|
138
|
+
*
|
|
139
|
+
* Set `Accept: application/json` (the default) to get a structured JSON response.
|
|
140
|
+
* Set `Accept: text/csv` to download the same data as a CSV file suitable for
|
|
141
|
+
* spreadsheets. The CSV columns, in order, are:
|
|
142
|
+
*
|
|
143
|
+
* `from, to, [subject,] [customer_id, customer_key, customer_name,] <dimensions...>, value`
|
|
144
|
+
*
|
|
145
|
+
* The `subject` column is emitted only when `subject` is in the query's
|
|
146
|
+
* `group_by_dimensions`. The three `customer_*` columns are emitted together only
|
|
147
|
+
* when `customer_id` is in the query's `group_by_dimensions`.
|
|
148
|
+
*
|
|
149
|
+
* POST /openmeter/meters/{meterId}/query
|
|
150
|
+
*/
|
|
41
151
|
export function queryMeter(client, req, options) {
|
|
42
|
-
|
|
43
|
-
|
|
152
|
+
return request(() => {
|
|
153
|
+
const path = `openmeter/meters/${(() => {
|
|
154
|
+
if (req.meterId === undefined) {
|
|
155
|
+
throw new Error('missing path parameter: meterId');
|
|
156
|
+
}
|
|
157
|
+
return encodeURIComponent(String(req.meterId));
|
|
158
|
+
})()}/query`;
|
|
159
|
+
const body = toWire(req.body, schemas.queryMeterBody);
|
|
160
|
+
if (client._options.validate) {
|
|
161
|
+
assertValid(schemas.queryMeterBodyWire, body);
|
|
162
|
+
}
|
|
163
|
+
return http(client)
|
|
164
|
+
.post(path, { ...options, json: body })
|
|
165
|
+
.json()
|
|
166
|
+
.then((data) => {
|
|
167
|
+
if (client._options.validate) {
|
|
168
|
+
assertValid(schemas.queryMeterResponseWire, data);
|
|
169
|
+
}
|
|
170
|
+
return fromWire(data, schemas.queryMeterResponse);
|
|
171
|
+
});
|
|
172
|
+
});
|
|
173
|
+
}
|
|
174
|
+
/** POST /openmeter/meters/{meterId}/query */
|
|
175
|
+
export function queryMeterCsv(client, req, options) {
|
|
176
|
+
const headers = new Headers(options?.headers);
|
|
177
|
+
headers.set('accept', 'text/csv');
|
|
178
|
+
return request(() => {
|
|
179
|
+
const path = `openmeter/meters/${(() => {
|
|
180
|
+
if (req.meterId === undefined) {
|
|
181
|
+
throw new Error('missing path parameter: meterId');
|
|
182
|
+
}
|
|
183
|
+
return encodeURIComponent(String(req.meterId));
|
|
184
|
+
})()}/query`;
|
|
185
|
+
const body = toWire(req.body, schemas.queryMeterCsvBody);
|
|
186
|
+
if (client._options.validate) {
|
|
187
|
+
assertValid(schemas.queryMeterCsvBodyWire, body);
|
|
188
|
+
}
|
|
189
|
+
return http(client)
|
|
190
|
+
.post(path, { ...options, json: body, headers })
|
|
191
|
+
.text();
|
|
44
192
|
});
|
|
45
|
-
return request(() => http(client)
|
|
46
|
-
.post(path, { ...options, json: req.body })
|
|
47
|
-
.json());
|
|
48
193
|
}
|
|
49
|
-
//# sourceMappingURL=meters.js.map
|
|
@@ -1,9 +1,43 @@
|
|
|
1
1
|
import { type Client } from '../core.js';
|
|
2
2
|
import { type Result, type RequestOptions } from '../lib/types.js';
|
|
3
3
|
import type { ListPlanAddonsRequest, ListPlanAddonsResponse, CreatePlanAddonRequest, CreatePlanAddonResponse, GetPlanAddonRequest, GetPlanAddonResponse, UpdatePlanAddonRequest, UpdatePlanAddonResponse, DeletePlanAddonRequest, DeletePlanAddonResponse } from '../models/operations/planAddons.js';
|
|
4
|
+
/**
|
|
5
|
+
* List add-ons for plan
|
|
6
|
+
*
|
|
7
|
+
* List add-ons associated with a plan.
|
|
8
|
+
*
|
|
9
|
+
* GET /openmeter/plans/{planId}/addons
|
|
10
|
+
*/
|
|
4
11
|
export declare function listPlanAddons(client: Client, req: ListPlanAddonsRequest, options?: RequestOptions): Promise<Result<ListPlanAddonsResponse>>;
|
|
12
|
+
/**
|
|
13
|
+
* Add add-on to plan
|
|
14
|
+
*
|
|
15
|
+
* Add an add-on to a plan.
|
|
16
|
+
*
|
|
17
|
+
* POST /openmeter/plans/{planId}/addons
|
|
18
|
+
*/
|
|
5
19
|
export declare function createPlanAddon(client: Client, req: CreatePlanAddonRequest, options?: RequestOptions): Promise<Result<CreatePlanAddonResponse>>;
|
|
20
|
+
/**
|
|
21
|
+
* Get add-on association for plan
|
|
22
|
+
*
|
|
23
|
+
* Get an add-on association for a plan.
|
|
24
|
+
*
|
|
25
|
+
* GET /openmeter/plans/{planId}/addons/{planAddonId}
|
|
26
|
+
*/
|
|
6
27
|
export declare function getPlanAddon(client: Client, req: GetPlanAddonRequest, options?: RequestOptions): Promise<Result<GetPlanAddonResponse>>;
|
|
28
|
+
/**
|
|
29
|
+
* Update add-on association for plan
|
|
30
|
+
*
|
|
31
|
+
* Update an add-on association for a plan.
|
|
32
|
+
*
|
|
33
|
+
* PUT /openmeter/plans/{planId}/addons/{planAddonId}
|
|
34
|
+
*/
|
|
7
35
|
export declare function updatePlanAddon(client: Client, req: UpdatePlanAddonRequest, options?: RequestOptions): Promise<Result<UpdatePlanAddonResponse>>;
|
|
36
|
+
/**
|
|
37
|
+
* Remove add-on from plan
|
|
38
|
+
*
|
|
39
|
+
* Remove an add-on from a plan.
|
|
40
|
+
*
|
|
41
|
+
* DELETE /openmeter/plans/{planId}/addons/{planAddonId}
|
|
42
|
+
*/
|
|
8
43
|
export declare function deletePlanAddon(client: Client, req: DeletePlanAddonRequest, options?: RequestOptions): Promise<Result<DeletePlanAddonResponse>>;
|
|
9
|
-
//# sourceMappingURL=planAddons.d.ts.map
|