@openmeter/client 1.0.0-beta.230 → 1.0.0-beta.232
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 +365 -76
- package/dist/core.d.ts +0 -1
- package/dist/core.js +11 -1
- package/dist/funcs/addons.d.ts +49 -1
- package/dist/funcs/addons.js +109 -12
- package/dist/funcs/apps.d.ts +55 -2
- package/dist/funcs/apps.js +179 -4
- package/dist/funcs/billing.d.ts +46 -1
- package/dist/funcs/billing.js +81 -8
- package/dist/funcs/currencies.d.ts +39 -2
- package/dist/funcs/currencies.js +93 -6
- package/dist/funcs/customers.d.ts +165 -2
- package/dist/funcs/customers.js +402 -40
- package/dist/funcs/defaults.d.ts +10 -1
- package/dist/funcs/defaults.js +11 -1
- package/dist/funcs/entitlements.d.ts +5 -1
- package/dist/funcs/entitlements.js +18 -4
- package/dist/funcs/events.d.ts +14 -1
- package/dist/funcs/events.js +18 -1
- package/dist/funcs/features.d.ts +42 -1
- package/dist/funcs/features.js +91 -10
- package/dist/funcs/governance.d.ts +14 -1
- package/dist/funcs/governance.js +15 -1
- package/dist/funcs/index.d.ts +0 -1
- package/dist/funcs/index.js +1 -1
- package/dist/funcs/invoices.d.ts +102 -2
- package/dist/funcs/invoices.js +247 -8
- package/dist/funcs/llmCost.d.ts +36 -1
- package/dist/funcs/llmCost.js +63 -6
- package/dist/funcs/meters.d.ts +53 -1
- package/dist/funcs/meters.js +113 -12
- package/dist/funcs/planAddons.d.ts +35 -1
- package/dist/funcs/planAddons.js +101 -18
- package/dist/funcs/plans.d.ts +49 -1
- package/dist/funcs/plans.js +109 -12
- package/dist/funcs/subscriptions.d.ts +59 -1
- package/dist/funcs/subscriptions.js +147 -18
- package/dist/funcs/tax.d.ts +25 -1
- package/dist/funcs/tax.js +60 -8
- package/dist/index.d.ts +4 -7
- package/dist/index.js +4 -6
- package/dist/lib/config.d.ts +2 -3
- package/dist/lib/config.js +1 -1
- package/dist/lib/encodings.d.ts +0 -1
- package/dist/lib/encodings.js +1 -1
- 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 +4 -1
- package/dist/lib/wire.js +118 -7
- package/dist/models/errors.d.ts +13 -2
- package/dist/models/errors.js +31 -4
- package/dist/models/operations/addons.d.ts +0 -1
- package/dist/models/operations/addons.js +1 -1
- package/dist/models/operations/apps.d.ts +26 -5
- package/dist/models/operations/apps.js +1 -1
- package/dist/models/operations/billing.d.ts +0 -1
- package/dist/models/operations/billing.js +1 -1
- package/dist/models/operations/currencies.d.ts +10 -1
- package/dist/models/operations/currencies.js +1 -1
- package/dist/models/operations/customers.d.ts +11 -7
- package/dist/models/operations/customers.js +1 -1
- package/dist/models/operations/defaults.d.ts +0 -1
- 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 +0 -1
- package/dist/models/operations/events.js +1 -1
- package/dist/models/operations/features.d.ts +0 -1
- package/dist/models/operations/features.js +1 -1
- package/dist/models/operations/governance.d.ts +0 -1
- package/dist/models/operations/governance.js +1 -1
- package/dist/models/operations/invoices.d.ts +20 -7
- package/dist/models/operations/invoices.js +1 -1
- package/dist/models/operations/llmCost.d.ts +0 -1
- package/dist/models/operations/llmCost.js +1 -1
- package/dist/models/operations/meters.d.ts +0 -1
- package/dist/models/operations/meters.js +1 -1
- package/dist/models/operations/planAddons.d.ts +0 -1
- package/dist/models/operations/planAddons.js +1 -1
- package/dist/models/operations/plans.d.ts +0 -1
- package/dist/models/operations/plans.js +1 -1
- package/dist/models/operations/subscriptions.d.ts +0 -1
- package/dist/models/operations/subscriptions.js +1 -1
- package/dist/models/operations/tax.d.ts +0 -1
- package/dist/models/operations/tax.js +1 -1
- package/dist/models/schemas.d.ts +11651 -6090
- package/dist/models/schemas.js +991 -468
- package/dist/models/types.d.ts +941 -810
- 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 +68 -2
- package/dist/sdk/apps.js +81 -2
- package/dist/sdk/billing.d.ts +57 -1
- package/dist/sdk/billing.js +60 -1
- package/dist/sdk/customers.d.ts +211 -2
- package/dist/sdk/customers.js +222 -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 +328 -0
- package/dist/sdk/internal.js +404 -0
- package/dist/sdk/invoices.d.ts +5 -2
- package/dist/sdk/invoices.js +13 -2
- package/dist/sdk/llmCost.d.ts +57 -1
- package/dist/sdk/llmCost.js +62 -1
- package/dist/sdk/meters.d.ts +64 -1
- package/dist/sdk/meters.js +67 -1
- 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 -13
- package/dist/sdk/sdk.js +11 -20
- package/dist/sdk/subscriptions.d.ts +72 -3
- package/dist/sdk/subscriptions.js +77 -5
- package/dist/sdk/tax.d.ts +34 -1
- package/dist/sdk/tax.js +37 -1
- package/package.json +30 -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
package/dist/funcs/invoices.js
CHANGED
|
@@ -1,10 +1,25 @@
|
|
|
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
4
|
import { toURLSearchParams, encodeSort } from '../lib/encodings.js';
|
|
4
|
-
import { toWire, fromWire, assertValid, toSnakeCase } from '../lib/wire.js';
|
|
5
|
+
import { toWire, toPathWire, fromWire, assertValid, toSnakeCase, } from '../lib/wire.js';
|
|
5
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
|
+
*/
|
|
6
18
|
export function listInvoices(client, req = {}, options) {
|
|
7
19
|
return request(() => {
|
|
20
|
+
if (client._options.validate && req.sort !== undefined) {
|
|
21
|
+
assertValid(schemas.listInvoicesQueryParams.shape.sort, req.sort);
|
|
22
|
+
}
|
|
8
23
|
const query = toWire({
|
|
9
24
|
page: req.page,
|
|
10
25
|
sort: encodeSort(req.sort, toSnakeCase),
|
|
@@ -25,13 +40,32 @@ export function listInvoices(client, req = {}, options) {
|
|
|
25
40
|
});
|
|
26
41
|
});
|
|
27
42
|
}
|
|
43
|
+
/**
|
|
44
|
+
* Get a billing invoice
|
|
45
|
+
*
|
|
46
|
+
* Get a billing invoice by ID.
|
|
47
|
+
*
|
|
48
|
+
* Returns the full invoice resource including line items, status details, totals,
|
|
49
|
+
* and workflow configuration snapshot.
|
|
50
|
+
*
|
|
51
|
+
* GET /openmeter/billing/invoices/{invoiceId}
|
|
52
|
+
*/
|
|
28
53
|
export function getInvoice(client, req, options) {
|
|
29
54
|
return request(() => {
|
|
55
|
+
const pathParamsInput = {
|
|
56
|
+
invoiceId: req.invoiceId,
|
|
57
|
+
};
|
|
58
|
+
const pathParams = client._options.validate
|
|
59
|
+
? toPathWire(pathParamsInput, schemas.getInvoicePathParams)
|
|
60
|
+
: pathParamsInput;
|
|
61
|
+
if (client._options.validate) {
|
|
62
|
+
assertValid(schemas.getInvoicePathParamsWire, pathParams);
|
|
63
|
+
}
|
|
30
64
|
const path = `openmeter/billing/invoices/${(() => {
|
|
31
|
-
if (
|
|
65
|
+
if (pathParams.invoiceId === undefined) {
|
|
32
66
|
throw new Error('missing path parameter: invoiceId');
|
|
33
67
|
}
|
|
34
|
-
return encodeURIComponent(String(
|
|
68
|
+
return encodeURIComponent(String(pathParams.invoiceId));
|
|
35
69
|
})()}`;
|
|
36
70
|
return http(client)
|
|
37
71
|
.get(path, options)
|
|
@@ -44,13 +78,35 @@ export function getInvoice(client, req, options) {
|
|
|
44
78
|
});
|
|
45
79
|
});
|
|
46
80
|
}
|
|
81
|
+
/**
|
|
82
|
+
* Update a billing invoice
|
|
83
|
+
*
|
|
84
|
+
* Update a billing invoice.
|
|
85
|
+
*
|
|
86
|
+
* Only the mutable fields of the invoice can be edited: description, labels,
|
|
87
|
+
* supplier, customer, workflow settings, and top-level lines. Top-level lines are
|
|
88
|
+
* matched by `id`; lines without an `id` are created, and existing lines omitted
|
|
89
|
+
* from `lines` are deleted. Detailed (child) lines are always computed and cannot
|
|
90
|
+
* be edited directly. Only invoices in draft status can be updated.
|
|
91
|
+
*
|
|
92
|
+
* PUT /openmeter/billing/invoices/{invoiceId}
|
|
93
|
+
*/
|
|
47
94
|
export function updateInvoice(client, req, options) {
|
|
48
95
|
return request(() => {
|
|
96
|
+
const pathParamsInput = {
|
|
97
|
+
invoiceId: req.invoiceId,
|
|
98
|
+
};
|
|
99
|
+
const pathParams = client._options.validate
|
|
100
|
+
? toPathWire(pathParamsInput, schemas.updateInvoicePathParams)
|
|
101
|
+
: pathParamsInput;
|
|
102
|
+
if (client._options.validate) {
|
|
103
|
+
assertValid(schemas.updateInvoicePathParamsWire, pathParams);
|
|
104
|
+
}
|
|
49
105
|
const path = `openmeter/billing/invoices/${(() => {
|
|
50
|
-
if (
|
|
106
|
+
if (pathParams.invoiceId === undefined) {
|
|
51
107
|
throw new Error('missing path parameter: invoiceId');
|
|
52
108
|
}
|
|
53
|
-
return encodeURIComponent(String(
|
|
109
|
+
return encodeURIComponent(String(pathParams.invoiceId));
|
|
54
110
|
})()}`;
|
|
55
111
|
const body = toWire(req.body, schemas.updateInvoiceBody);
|
|
56
112
|
if (client._options.validate) {
|
|
@@ -67,15 +123,198 @@ export function updateInvoice(client, req, options) {
|
|
|
67
123
|
});
|
|
68
124
|
});
|
|
69
125
|
}
|
|
126
|
+
/**
|
|
127
|
+
* Delete a billing invoice
|
|
128
|
+
*
|
|
129
|
+
* Delete a billing invoice.
|
|
130
|
+
*
|
|
131
|
+
* Only standard invoices in draft status can be deleted. Deleting an invoice will
|
|
132
|
+
* also delete all associated line items and workflow configuration.
|
|
133
|
+
*
|
|
134
|
+
* DELETE /openmeter/billing/invoices/{invoiceId}
|
|
135
|
+
*/
|
|
70
136
|
export function deleteInvoice(client, req, options) {
|
|
71
137
|
return request(async () => {
|
|
138
|
+
const pathParamsInput = {
|
|
139
|
+
invoiceId: req.invoiceId,
|
|
140
|
+
};
|
|
141
|
+
const pathParams = client._options.validate
|
|
142
|
+
? toPathWire(pathParamsInput, schemas.deleteInvoicePathParams)
|
|
143
|
+
: pathParamsInput;
|
|
144
|
+
if (client._options.validate) {
|
|
145
|
+
assertValid(schemas.deleteInvoicePathParamsWire, pathParams);
|
|
146
|
+
}
|
|
72
147
|
const path = `openmeter/billing/invoices/${(() => {
|
|
73
|
-
if (
|
|
148
|
+
if (pathParams.invoiceId === undefined) {
|
|
74
149
|
throw new Error('missing path parameter: invoiceId');
|
|
75
150
|
}
|
|
76
|
-
return encodeURIComponent(String(
|
|
151
|
+
return encodeURIComponent(String(pathParams.invoiceId));
|
|
77
152
|
})()}`;
|
|
78
153
|
await http(client).delete(path, options);
|
|
79
154
|
});
|
|
80
155
|
}
|
|
81
|
-
|
|
156
|
+
/**
|
|
157
|
+
* Advance billing invoice's next status
|
|
158
|
+
*
|
|
159
|
+
* Advance a billing invoice.
|
|
160
|
+
*
|
|
161
|
+
* Advances the invoice to the next workflow state. The next state is determined by
|
|
162
|
+
* the invoice's current status and workflow configuration. Only invoices in draft
|
|
163
|
+
* or issued status can be advanced.
|
|
164
|
+
*
|
|
165
|
+
* POST /openmeter/billing/invoices/{invoiceId}/advance
|
|
166
|
+
*/
|
|
167
|
+
export function advanceInvoice(client, req, options) {
|
|
168
|
+
return request(() => {
|
|
169
|
+
const pathParamsInput = {
|
|
170
|
+
invoiceId: req.invoiceId,
|
|
171
|
+
};
|
|
172
|
+
const pathParams = client._options.validate
|
|
173
|
+
? toPathWire(pathParamsInput, schemas.advanceInvoicePathParams)
|
|
174
|
+
: pathParamsInput;
|
|
175
|
+
if (client._options.validate) {
|
|
176
|
+
assertValid(schemas.advanceInvoicePathParamsWire, pathParams);
|
|
177
|
+
}
|
|
178
|
+
const path = `openmeter/billing/invoices/${(() => {
|
|
179
|
+
if (pathParams.invoiceId === undefined) {
|
|
180
|
+
throw new Error('missing path parameter: invoiceId');
|
|
181
|
+
}
|
|
182
|
+
return encodeURIComponent(String(pathParams.invoiceId));
|
|
183
|
+
})()}/advance`;
|
|
184
|
+
return http(client)
|
|
185
|
+
.post(path, options)
|
|
186
|
+
.json()
|
|
187
|
+
.then((data) => {
|
|
188
|
+
if (client._options.validate) {
|
|
189
|
+
assertValid(schemas.advanceInvoiceResponseWire, data);
|
|
190
|
+
}
|
|
191
|
+
return fromWire(data, schemas.advanceInvoiceResponse);
|
|
192
|
+
});
|
|
193
|
+
});
|
|
194
|
+
}
|
|
195
|
+
/**
|
|
196
|
+
* Send the invoice to the customer
|
|
197
|
+
*
|
|
198
|
+
* Approve a billing invoice.
|
|
199
|
+
*
|
|
200
|
+
* This call instantly sends the invoice to the customer using the configured
|
|
201
|
+
* billing profile app.
|
|
202
|
+
*
|
|
203
|
+
* This call is valid in two invoice statuses:
|
|
204
|
+
*
|
|
205
|
+
* - draft: the invoice will be sent to the customer, the invoice state becomes
|
|
206
|
+
* issued
|
|
207
|
+
* - manual_approval_needed: the invoice will be sent to the customer, the invoice
|
|
208
|
+
* state becomes issued
|
|
209
|
+
*
|
|
210
|
+
* POST /openmeter/billing/invoices/{invoiceId}/approve
|
|
211
|
+
*/
|
|
212
|
+
export function approveInvoice(client, req, options) {
|
|
213
|
+
return request(() => {
|
|
214
|
+
const pathParamsInput = {
|
|
215
|
+
invoiceId: req.invoiceId,
|
|
216
|
+
};
|
|
217
|
+
const pathParams = client._options.validate
|
|
218
|
+
? toPathWire(pathParamsInput, schemas.approveInvoicePathParams)
|
|
219
|
+
: pathParamsInput;
|
|
220
|
+
if (client._options.validate) {
|
|
221
|
+
assertValid(schemas.approveInvoicePathParamsWire, pathParams);
|
|
222
|
+
}
|
|
223
|
+
const path = `openmeter/billing/invoices/${(() => {
|
|
224
|
+
if (pathParams.invoiceId === undefined) {
|
|
225
|
+
throw new Error('missing path parameter: invoiceId');
|
|
226
|
+
}
|
|
227
|
+
return encodeURIComponent(String(pathParams.invoiceId));
|
|
228
|
+
})()}/approve`;
|
|
229
|
+
return http(client)
|
|
230
|
+
.post(path, options)
|
|
231
|
+
.json()
|
|
232
|
+
.then((data) => {
|
|
233
|
+
if (client._options.validate) {
|
|
234
|
+
assertValid(schemas.approveInvoiceResponseWire, data);
|
|
235
|
+
}
|
|
236
|
+
return fromWire(data, schemas.approveInvoiceResponse);
|
|
237
|
+
});
|
|
238
|
+
});
|
|
239
|
+
}
|
|
240
|
+
/**
|
|
241
|
+
* Retry advancing the invoice after a failed attempt
|
|
242
|
+
*
|
|
243
|
+
* Retry sending a billing invoice.
|
|
244
|
+
*
|
|
245
|
+
* Retry advancing the invoice after a failed attempt.
|
|
246
|
+
*
|
|
247
|
+
* The action can be called when the invoice's statusDetails' actions field contain
|
|
248
|
+
* the "retry" action.
|
|
249
|
+
*
|
|
250
|
+
* POST /openmeter/billing/invoices/{invoiceId}/retry
|
|
251
|
+
*/
|
|
252
|
+
export function retryInvoice(client, req, options) {
|
|
253
|
+
return request(() => {
|
|
254
|
+
const pathParamsInput = {
|
|
255
|
+
invoiceId: req.invoiceId,
|
|
256
|
+
};
|
|
257
|
+
const pathParams = client._options.validate
|
|
258
|
+
? toPathWire(pathParamsInput, schemas.retryInvoicePathParams)
|
|
259
|
+
: pathParamsInput;
|
|
260
|
+
if (client._options.validate) {
|
|
261
|
+
assertValid(schemas.retryInvoicePathParamsWire, pathParams);
|
|
262
|
+
}
|
|
263
|
+
const path = `openmeter/billing/invoices/${(() => {
|
|
264
|
+
if (pathParams.invoiceId === undefined) {
|
|
265
|
+
throw new Error('missing path parameter: invoiceId');
|
|
266
|
+
}
|
|
267
|
+
return encodeURIComponent(String(pathParams.invoiceId));
|
|
268
|
+
})()}/retry`;
|
|
269
|
+
return http(client)
|
|
270
|
+
.post(path, options)
|
|
271
|
+
.json()
|
|
272
|
+
.then((data) => {
|
|
273
|
+
if (client._options.validate) {
|
|
274
|
+
assertValid(schemas.retryInvoiceResponseWire, data);
|
|
275
|
+
}
|
|
276
|
+
return fromWire(data, schemas.retryInvoiceResponse);
|
|
277
|
+
});
|
|
278
|
+
});
|
|
279
|
+
}
|
|
280
|
+
/**
|
|
281
|
+
* Snapshot quantities for usage based line items
|
|
282
|
+
*
|
|
283
|
+
* Snapshot quantities for usage-based line items.
|
|
284
|
+
*
|
|
285
|
+
* This call will snapshot the quantities for all usage based line items in the
|
|
286
|
+
* invoice.
|
|
287
|
+
*
|
|
288
|
+
* This call is only valid in draft.waiting_for_collection status, where the
|
|
289
|
+
* collection period can be skipped using this action.
|
|
290
|
+
*
|
|
291
|
+
* POST /openmeter/billing/invoices/{invoiceId}/snapshot-quantities
|
|
292
|
+
*/
|
|
293
|
+
export function snapshotQuantitiesInvoice(client, req, options) {
|
|
294
|
+
return request(() => {
|
|
295
|
+
const pathParamsInput = {
|
|
296
|
+
invoiceId: req.invoiceId,
|
|
297
|
+
};
|
|
298
|
+
const pathParams = client._options.validate
|
|
299
|
+
? toPathWire(pathParamsInput, schemas.snapshotQuantitiesInvoicePathParams)
|
|
300
|
+
: pathParamsInput;
|
|
301
|
+
if (client._options.validate) {
|
|
302
|
+
assertValid(schemas.snapshotQuantitiesInvoicePathParamsWire, pathParams);
|
|
303
|
+
}
|
|
304
|
+
const path = `openmeter/billing/invoices/${(() => {
|
|
305
|
+
if (pathParams.invoiceId === undefined) {
|
|
306
|
+
throw new Error('missing path parameter: invoiceId');
|
|
307
|
+
}
|
|
308
|
+
return encodeURIComponent(String(pathParams.invoiceId));
|
|
309
|
+
})()}/snapshot-quantities`;
|
|
310
|
+
return http(client)
|
|
311
|
+
.post(path, options)
|
|
312
|
+
.json()
|
|
313
|
+
.then((data) => {
|
|
314
|
+
if (client._options.validate) {
|
|
315
|
+
assertValid(schemas.snapshotQuantitiesInvoiceResponseWire, data);
|
|
316
|
+
}
|
|
317
|
+
return fromWire(data, schemas.snapshotQuantitiesInvoiceResponse);
|
|
318
|
+
});
|
|
319
|
+
});
|
|
320
|
+
}
|
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,10 +1,21 @@
|
|
|
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
4
|
import { toURLSearchParams, encodeSort } from '../lib/encodings.js';
|
|
4
|
-
import { toWire, fromWire, assertValid, toSnakeCase } from '../lib/wire.js';
|
|
5
|
+
import { toWire, toPathWire, fromWire, assertValid, toSnakeCase, } from '../lib/wire.js';
|
|
5
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
|
+
*/
|
|
6
14
|
export function listLlmCostPrices(client, req = {}, options) {
|
|
7
15
|
return request(() => {
|
|
16
|
+
if (client._options.validate && req.sort !== undefined) {
|
|
17
|
+
assertValid(schemas.listLlmCostPricesQueryParams.shape.sort, req.sort);
|
|
18
|
+
}
|
|
8
19
|
const query = toWire({
|
|
9
20
|
filter: req.filter,
|
|
10
21
|
sort: encodeSort(req.sort, toSnakeCase),
|
|
@@ -25,13 +36,30 @@ export function listLlmCostPrices(client, req = {}, options) {
|
|
|
25
36
|
});
|
|
26
37
|
});
|
|
27
38
|
}
|
|
39
|
+
/**
|
|
40
|
+
* Get LLM cost price
|
|
41
|
+
*
|
|
42
|
+
* Get a specific LLM cost price by ID. Returns the price with overrides applied if
|
|
43
|
+
* any.
|
|
44
|
+
*
|
|
45
|
+
* GET /openmeter/llm-cost/prices/{priceId}
|
|
46
|
+
*/
|
|
28
47
|
export function getLlmCostPrice(client, req, options) {
|
|
29
48
|
return request(() => {
|
|
49
|
+
const pathParamsInput = {
|
|
50
|
+
priceId: req.priceId,
|
|
51
|
+
};
|
|
52
|
+
const pathParams = client._options.validate
|
|
53
|
+
? toPathWire(pathParamsInput, schemas.getLlmCostPricePathParams)
|
|
54
|
+
: pathParamsInput;
|
|
55
|
+
if (client._options.validate) {
|
|
56
|
+
assertValid(schemas.getLlmCostPricePathParamsWire, pathParams);
|
|
57
|
+
}
|
|
30
58
|
const path = `openmeter/llm-cost/prices/${(() => {
|
|
31
|
-
if (
|
|
59
|
+
if (pathParams.priceId === undefined) {
|
|
32
60
|
throw new Error('missing path parameter: priceId');
|
|
33
61
|
}
|
|
34
|
-
return encodeURIComponent(String(
|
|
62
|
+
return encodeURIComponent(String(pathParams.priceId));
|
|
35
63
|
})()}`;
|
|
36
64
|
return http(client)
|
|
37
65
|
.get(path, options)
|
|
@@ -44,6 +72,13 @@ export function getLlmCostPrice(client, req, options) {
|
|
|
44
72
|
});
|
|
45
73
|
});
|
|
46
74
|
}
|
|
75
|
+
/**
|
|
76
|
+
* List LLM cost overrides
|
|
77
|
+
*
|
|
78
|
+
* List per-namespace price overrides.
|
|
79
|
+
*
|
|
80
|
+
* GET /openmeter/llm-cost/overrides
|
|
81
|
+
*/
|
|
47
82
|
export function listLlmCostOverrides(client, req = {}, options) {
|
|
48
83
|
return request(() => {
|
|
49
84
|
const query = toWire({
|
|
@@ -65,6 +100,13 @@ export function listLlmCostOverrides(client, req = {}, options) {
|
|
|
65
100
|
});
|
|
66
101
|
});
|
|
67
102
|
}
|
|
103
|
+
/**
|
|
104
|
+
* Create LLM cost override
|
|
105
|
+
*
|
|
106
|
+
* Create a per-namespace price override.
|
|
107
|
+
*
|
|
108
|
+
* POST /openmeter/llm-cost/overrides
|
|
109
|
+
*/
|
|
68
110
|
export function createLlmCostOverride(client, req, options) {
|
|
69
111
|
return request(() => {
|
|
70
112
|
const body = toWire(req, schemas.createLlmCostOverrideBody);
|
|
@@ -82,15 +124,30 @@ export function createLlmCostOverride(client, req, options) {
|
|
|
82
124
|
});
|
|
83
125
|
});
|
|
84
126
|
}
|
|
127
|
+
/**
|
|
128
|
+
* Delete LLM cost override
|
|
129
|
+
*
|
|
130
|
+
* Delete a per-namespace price override.
|
|
131
|
+
*
|
|
132
|
+
* DELETE /openmeter/llm-cost/overrides/{priceId}
|
|
133
|
+
*/
|
|
85
134
|
export function deleteLlmCostOverride(client, req, options) {
|
|
86
135
|
return request(async () => {
|
|
136
|
+
const pathParamsInput = {
|
|
137
|
+
priceId: req.priceId,
|
|
138
|
+
};
|
|
139
|
+
const pathParams = client._options.validate
|
|
140
|
+
? toPathWire(pathParamsInput, schemas.deleteLlmCostOverridePathParams)
|
|
141
|
+
: pathParamsInput;
|
|
142
|
+
if (client._options.validate) {
|
|
143
|
+
assertValid(schemas.deleteLlmCostOverridePathParamsWire, pathParams);
|
|
144
|
+
}
|
|
87
145
|
const path = `openmeter/llm-cost/overrides/${(() => {
|
|
88
|
-
if (
|
|
146
|
+
if (pathParams.priceId === undefined) {
|
|
89
147
|
throw new Error('missing path parameter: priceId');
|
|
90
148
|
}
|
|
91
|
-
return encodeURIComponent(String(
|
|
149
|
+
return encodeURIComponent(String(pathParams.priceId));
|
|
92
150
|
})()}`;
|
|
93
151
|
await http(client).delete(path, options);
|
|
94
152
|
});
|
|
95
153
|
}
|
|
96
|
-
//# sourceMappingURL=llmCost.js.map
|
package/dist/funcs/meters.d.ts
CHANGED
|
@@ -1,11 +1,63 @@
|
|
|
1
1
|
import { type Client } from '../core.js';
|
|
2
2
|
import { type Result, type RequestOptions } from '../lib/types.js';
|
|
3
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>>;
|
|
62
|
+
/** POST /openmeter/meters/{meterId}/query */
|
|
10
63
|
export declare function queryMeterCsv(client: Client, req: QueryMeterCsvRequest, options?: RequestOptions): Promise<Result<QueryMeterCsvResponse>>;
|
|
11
|
-
//# sourceMappingURL=meters.d.ts.map
|