@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
|
@@ -0,0 +1,404 @@
|
|
|
1
|
+
// Code generated by @openmeter/typespec-typescript. DO NOT EDIT.
|
|
2
|
+
import { unwrap } from '../lib/types.js';
|
|
3
|
+
import { paginatePages } from '../lib/paginate.js';
|
|
4
|
+
import { createSubscriptionAddon } from '../funcs/subscriptions.js';
|
|
5
|
+
import { listApps, getApp, uninstallApp, updateApp, listAppCatalog, getAppCatalogItem, installApp, } from '../funcs/apps.js';
|
|
6
|
+
import { listInvoices, getInvoice, updateInvoice, deleteInvoice, advanceInvoice, approveInvoice, retryInvoice, snapshotQuantitiesInvoice, } from '../funcs/invoices.js';
|
|
7
|
+
import { listCurrencies, createCustomCurrency, getCustomCurrency, listCostBases, createCostBasis, } from '../funcs/currencies.js';
|
|
8
|
+
import { queryGovernanceAccess } from '../funcs/governance.js';
|
|
9
|
+
/**
|
|
10
|
+
* Operations marked internal in the API definition. They are not part of
|
|
11
|
+
* the customer surface: they may require additional permissions, and they
|
|
12
|
+
* can change or be removed without notice or semver consideration.
|
|
13
|
+
*/
|
|
14
|
+
export class Internal {
|
|
15
|
+
_client;
|
|
16
|
+
constructor(_client) {
|
|
17
|
+
this._client = _client;
|
|
18
|
+
}
|
|
19
|
+
_subscriptions;
|
|
20
|
+
get subscriptions() {
|
|
21
|
+
return (this._subscriptions ??= new InternalSubscriptions(this._client));
|
|
22
|
+
}
|
|
23
|
+
_apps;
|
|
24
|
+
get apps() {
|
|
25
|
+
return (this._apps ??= new InternalApps(this._client));
|
|
26
|
+
}
|
|
27
|
+
_invoices;
|
|
28
|
+
get invoices() {
|
|
29
|
+
return (this._invoices ??= new InternalInvoices(this._client));
|
|
30
|
+
}
|
|
31
|
+
_currencies;
|
|
32
|
+
get currencies() {
|
|
33
|
+
return (this._currencies ??= new InternalCurrencies(this._client));
|
|
34
|
+
}
|
|
35
|
+
_governance;
|
|
36
|
+
get governance() {
|
|
37
|
+
return (this._governance ??= new InternalGovernance(this._client));
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
export class InternalSubscriptions {
|
|
41
|
+
_client;
|
|
42
|
+
constructor(_client) {
|
|
43
|
+
this._client = _client;
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* Create a new subscription add-on
|
|
47
|
+
*
|
|
48
|
+
* Add add-on to a subscription.
|
|
49
|
+
*
|
|
50
|
+
* POST /openmeter/subscriptions/{subscriptionId}/addons
|
|
51
|
+
*/
|
|
52
|
+
async createAddon(request, options) {
|
|
53
|
+
return unwrap(await createSubscriptionAddon(this._client, request, options));
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
export class InternalApps {
|
|
57
|
+
_client;
|
|
58
|
+
constructor(_client) {
|
|
59
|
+
this._client = _client;
|
|
60
|
+
}
|
|
61
|
+
/**
|
|
62
|
+
* List apps
|
|
63
|
+
*
|
|
64
|
+
* List installed apps.
|
|
65
|
+
*
|
|
66
|
+
* GET /openmeter/apps
|
|
67
|
+
*/
|
|
68
|
+
async list(request, options) {
|
|
69
|
+
return unwrap(await listApps(this._client, request, options));
|
|
70
|
+
}
|
|
71
|
+
/**
|
|
72
|
+
* List apps
|
|
73
|
+
*
|
|
74
|
+
* List installed apps.
|
|
75
|
+
*
|
|
76
|
+
* Iterates every item across all pages, fetching more as the returned iterable is consumed.
|
|
77
|
+
*
|
|
78
|
+
* GET /openmeter/apps
|
|
79
|
+
*/
|
|
80
|
+
listAll(request, options) {
|
|
81
|
+
return paginatePages((req, opts) => listApps(this._client, req, opts), request ?? {}, options);
|
|
82
|
+
}
|
|
83
|
+
/**
|
|
84
|
+
* Get app
|
|
85
|
+
*
|
|
86
|
+
* Get an installed app.
|
|
87
|
+
*
|
|
88
|
+
* GET /openmeter/apps/{appId}
|
|
89
|
+
*/
|
|
90
|
+
async get(request, options) {
|
|
91
|
+
return unwrap(await getApp(this._client, request, options));
|
|
92
|
+
}
|
|
93
|
+
/**
|
|
94
|
+
* Uninstall app
|
|
95
|
+
*
|
|
96
|
+
* Uninstall an app by ID.
|
|
97
|
+
*
|
|
98
|
+
* DELETE /openmeter/apps/{appId}
|
|
99
|
+
*/
|
|
100
|
+
async uninstall(request, options) {
|
|
101
|
+
return unwrap(await uninstallApp(this._client, request, options));
|
|
102
|
+
}
|
|
103
|
+
/**
|
|
104
|
+
* Update app
|
|
105
|
+
*
|
|
106
|
+
* Update an installed app.
|
|
107
|
+
*
|
|
108
|
+
* PUT /openmeter/apps/{appId}
|
|
109
|
+
*/
|
|
110
|
+
async update(request, options) {
|
|
111
|
+
return unwrap(await updateApp(this._client, request, options));
|
|
112
|
+
}
|
|
113
|
+
/**
|
|
114
|
+
* List app catalog
|
|
115
|
+
*
|
|
116
|
+
* List available apps.
|
|
117
|
+
*
|
|
118
|
+
* GET /openmeter/app-catalog
|
|
119
|
+
*/
|
|
120
|
+
async listCatalog(request, options) {
|
|
121
|
+
return unwrap(await listAppCatalog(this._client, request, options));
|
|
122
|
+
}
|
|
123
|
+
/**
|
|
124
|
+
* List app catalog
|
|
125
|
+
*
|
|
126
|
+
* List available apps.
|
|
127
|
+
*
|
|
128
|
+
* Iterates every item across all pages, fetching more as the returned iterable is consumed.
|
|
129
|
+
*
|
|
130
|
+
* GET /openmeter/app-catalog
|
|
131
|
+
*/
|
|
132
|
+
listCatalogAll(request, options) {
|
|
133
|
+
return paginatePages((req, opts) => listAppCatalog(this._client, req, opts), request ?? {}, options);
|
|
134
|
+
}
|
|
135
|
+
/**
|
|
136
|
+
* Get app catalog item by type
|
|
137
|
+
*
|
|
138
|
+
* Get an app catalog item by type.
|
|
139
|
+
*
|
|
140
|
+
* GET /openmeter/app-catalog/{appType}
|
|
141
|
+
*/
|
|
142
|
+
async getCatalogItem(request, options) {
|
|
143
|
+
return unwrap(await getAppCatalogItem(this._client, request, options));
|
|
144
|
+
}
|
|
145
|
+
/**
|
|
146
|
+
* Install app from the catalog
|
|
147
|
+
*
|
|
148
|
+
* Install an app from the catalog.
|
|
149
|
+
*
|
|
150
|
+
* POST /openmeter/app-catalog/install
|
|
151
|
+
*/
|
|
152
|
+
async install(request, options) {
|
|
153
|
+
return unwrap(await installApp(this._client, request, options));
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
export class InternalInvoices {
|
|
157
|
+
_client;
|
|
158
|
+
constructor(_client) {
|
|
159
|
+
this._client = _client;
|
|
160
|
+
}
|
|
161
|
+
/**
|
|
162
|
+
* List billing invoices
|
|
163
|
+
*
|
|
164
|
+
* List billing invoices.
|
|
165
|
+
*
|
|
166
|
+
* Returns a page of invoices. Gathering invoices are never included. Use `filter`
|
|
167
|
+
* to narrow by status, customer, dates, or service period start. Use `sort` to
|
|
168
|
+
* control ordering.
|
|
169
|
+
*
|
|
170
|
+
* GET /openmeter/billing/invoices
|
|
171
|
+
*/
|
|
172
|
+
async list(request, options) {
|
|
173
|
+
return unwrap(await listInvoices(this._client, request, options));
|
|
174
|
+
}
|
|
175
|
+
/**
|
|
176
|
+
* List billing invoices
|
|
177
|
+
*
|
|
178
|
+
* List billing invoices.
|
|
179
|
+
*
|
|
180
|
+
* Returns a page of invoices. Gathering invoices are never included. Use `filter`
|
|
181
|
+
* to narrow by status, customer, dates, or service period start. Use `sort` to
|
|
182
|
+
* control ordering.
|
|
183
|
+
*
|
|
184
|
+
* Iterates every item across all pages, fetching more as the returned iterable is consumed.
|
|
185
|
+
*
|
|
186
|
+
* GET /openmeter/billing/invoices
|
|
187
|
+
*/
|
|
188
|
+
listAll(request, options) {
|
|
189
|
+
return paginatePages((req, opts) => listInvoices(this._client, req, opts), request ?? {}, options);
|
|
190
|
+
}
|
|
191
|
+
/**
|
|
192
|
+
* Get a billing invoice
|
|
193
|
+
*
|
|
194
|
+
* Get a billing invoice by ID.
|
|
195
|
+
*
|
|
196
|
+
* Returns the full invoice resource including line items, status details, totals,
|
|
197
|
+
* and workflow configuration snapshot.
|
|
198
|
+
*
|
|
199
|
+
* GET /openmeter/billing/invoices/{invoiceId}
|
|
200
|
+
*/
|
|
201
|
+
async get(request, options) {
|
|
202
|
+
return unwrap(await getInvoice(this._client, request, options));
|
|
203
|
+
}
|
|
204
|
+
/**
|
|
205
|
+
* Update a billing invoice
|
|
206
|
+
*
|
|
207
|
+
* Update a billing invoice.
|
|
208
|
+
*
|
|
209
|
+
* Only the mutable fields of the invoice can be edited: description, labels,
|
|
210
|
+
* supplier, customer, workflow settings, and top-level lines. Top-level lines are
|
|
211
|
+
* matched by `id`; lines without an `id` are created, and existing lines omitted
|
|
212
|
+
* from `lines` are deleted. Detailed (child) lines are always computed and cannot
|
|
213
|
+
* be edited directly. Only invoices in draft status can be updated.
|
|
214
|
+
*
|
|
215
|
+
* PUT /openmeter/billing/invoices/{invoiceId}
|
|
216
|
+
*/
|
|
217
|
+
async update(request, options) {
|
|
218
|
+
return unwrap(await updateInvoice(this._client, request, options));
|
|
219
|
+
}
|
|
220
|
+
/**
|
|
221
|
+
* Delete a billing invoice
|
|
222
|
+
*
|
|
223
|
+
* Delete a billing invoice.
|
|
224
|
+
*
|
|
225
|
+
* Only standard invoices in draft status can be deleted. Deleting an invoice will
|
|
226
|
+
* also delete all associated line items and workflow configuration.
|
|
227
|
+
*
|
|
228
|
+
* DELETE /openmeter/billing/invoices/{invoiceId}
|
|
229
|
+
*/
|
|
230
|
+
async delete(request, options) {
|
|
231
|
+
return unwrap(await deleteInvoice(this._client, request, options));
|
|
232
|
+
}
|
|
233
|
+
/**
|
|
234
|
+
* Advance billing invoice's next status
|
|
235
|
+
*
|
|
236
|
+
* Advance a billing invoice.
|
|
237
|
+
*
|
|
238
|
+
* Advances the invoice to the next workflow state. The next state is determined by
|
|
239
|
+
* the invoice's current status and workflow configuration. Only invoices in draft
|
|
240
|
+
* or issued status can be advanced.
|
|
241
|
+
*
|
|
242
|
+
* POST /openmeter/billing/invoices/{invoiceId}/advance
|
|
243
|
+
*/
|
|
244
|
+
async advance(request, options) {
|
|
245
|
+
return unwrap(await advanceInvoice(this._client, request, options));
|
|
246
|
+
}
|
|
247
|
+
/**
|
|
248
|
+
* Send the invoice to the customer
|
|
249
|
+
*
|
|
250
|
+
* Approve a billing invoice.
|
|
251
|
+
*
|
|
252
|
+
* This call instantly sends the invoice to the customer using the configured
|
|
253
|
+
* billing profile app.
|
|
254
|
+
*
|
|
255
|
+
* This call is valid in two invoice statuses:
|
|
256
|
+
*
|
|
257
|
+
* - draft: the invoice will be sent to the customer, the invoice state becomes
|
|
258
|
+
* issued
|
|
259
|
+
* - manual_approval_needed: the invoice will be sent to the customer, the invoice
|
|
260
|
+
* state becomes issued
|
|
261
|
+
*
|
|
262
|
+
* POST /openmeter/billing/invoices/{invoiceId}/approve
|
|
263
|
+
*/
|
|
264
|
+
async approve(request, options) {
|
|
265
|
+
return unwrap(await approveInvoice(this._client, request, options));
|
|
266
|
+
}
|
|
267
|
+
/**
|
|
268
|
+
* Retry advancing the invoice after a failed attempt
|
|
269
|
+
*
|
|
270
|
+
* Retry sending a billing invoice.
|
|
271
|
+
*
|
|
272
|
+
* Retry advancing the invoice after a failed attempt.
|
|
273
|
+
*
|
|
274
|
+
* The action can be called when the invoice's statusDetails' actions field contain
|
|
275
|
+
* the "retry" action.
|
|
276
|
+
*
|
|
277
|
+
* POST /openmeter/billing/invoices/{invoiceId}/retry
|
|
278
|
+
*/
|
|
279
|
+
async retry(request, options) {
|
|
280
|
+
return unwrap(await retryInvoice(this._client, request, options));
|
|
281
|
+
}
|
|
282
|
+
/**
|
|
283
|
+
* Snapshot quantities for usage based line items
|
|
284
|
+
*
|
|
285
|
+
* Snapshot quantities for usage-based line items.
|
|
286
|
+
*
|
|
287
|
+
* This call will snapshot the quantities for all usage based line items in the
|
|
288
|
+
* invoice.
|
|
289
|
+
*
|
|
290
|
+
* This call is only valid in draft.waiting_for_collection status, where the
|
|
291
|
+
* collection period can be skipped using this action.
|
|
292
|
+
*
|
|
293
|
+
* POST /openmeter/billing/invoices/{invoiceId}/snapshot-quantities
|
|
294
|
+
*/
|
|
295
|
+
async snapshotQuantities(request, options) {
|
|
296
|
+
return unwrap(await snapshotQuantitiesInvoice(this._client, request, options));
|
|
297
|
+
}
|
|
298
|
+
}
|
|
299
|
+
export class InternalCurrencies {
|
|
300
|
+
_client;
|
|
301
|
+
constructor(_client) {
|
|
302
|
+
this._client = _client;
|
|
303
|
+
}
|
|
304
|
+
/**
|
|
305
|
+
* List currencies
|
|
306
|
+
*
|
|
307
|
+
* List currencies supported by the billing system.
|
|
308
|
+
*
|
|
309
|
+
* GET /openmeter/currencies
|
|
310
|
+
*/
|
|
311
|
+
async list(request, options) {
|
|
312
|
+
return unwrap(await listCurrencies(this._client, request, options));
|
|
313
|
+
}
|
|
314
|
+
/**
|
|
315
|
+
* List currencies
|
|
316
|
+
*
|
|
317
|
+
* List currencies supported by the billing system.
|
|
318
|
+
*
|
|
319
|
+
* Iterates every item across all pages, fetching more as the returned iterable is consumed.
|
|
320
|
+
*
|
|
321
|
+
* GET /openmeter/currencies
|
|
322
|
+
*/
|
|
323
|
+
listAll(request, options) {
|
|
324
|
+
return paginatePages((req, opts) => listCurrencies(this._client, req, opts), request ?? {}, options);
|
|
325
|
+
}
|
|
326
|
+
/**
|
|
327
|
+
* Create custom currency
|
|
328
|
+
*
|
|
329
|
+
* Create a custom currency. This operation allows defining your own custom
|
|
330
|
+
* currency for billing purposes.
|
|
331
|
+
*
|
|
332
|
+
* POST /openmeter/currencies/custom
|
|
333
|
+
*/
|
|
334
|
+
async createCustomCurrency(request, options) {
|
|
335
|
+
return unwrap(await createCustomCurrency(this._client, request, options));
|
|
336
|
+
}
|
|
337
|
+
/**
|
|
338
|
+
* Get custom currency
|
|
339
|
+
*
|
|
340
|
+
* Get a custom currency.
|
|
341
|
+
*
|
|
342
|
+
* GET /openmeter/currencies/custom/{currencyId}
|
|
343
|
+
*/
|
|
344
|
+
async getCustomCurrency(request, options) {
|
|
345
|
+
return unwrap(await getCustomCurrency(this._client, request, options));
|
|
346
|
+
}
|
|
347
|
+
/**
|
|
348
|
+
* List cost bases
|
|
349
|
+
*
|
|
350
|
+
* List cost bases for a currency. For custom currencies, there can be multiple
|
|
351
|
+
* cost bases with different `effective_from` dates.
|
|
352
|
+
*
|
|
353
|
+
* GET /openmeter/currencies/custom/{currencyId}/cost-bases
|
|
354
|
+
*/
|
|
355
|
+
async listCostBases(request, options) {
|
|
356
|
+
return unwrap(await listCostBases(this._client, request, options));
|
|
357
|
+
}
|
|
358
|
+
/**
|
|
359
|
+
* List cost bases
|
|
360
|
+
*
|
|
361
|
+
* List cost bases for a currency. For custom currencies, there can be multiple
|
|
362
|
+
* cost bases with different `effective_from` dates.
|
|
363
|
+
*
|
|
364
|
+
* Iterates every item across all pages, fetching more as the returned iterable is consumed.
|
|
365
|
+
*
|
|
366
|
+
* GET /openmeter/currencies/custom/{currencyId}/cost-bases
|
|
367
|
+
*/
|
|
368
|
+
listCostBasesAll(request, options) {
|
|
369
|
+
return paginatePages((req, opts) => listCostBases(this._client, req, opts), request, options);
|
|
370
|
+
}
|
|
371
|
+
/**
|
|
372
|
+
* Create cost basis
|
|
373
|
+
*
|
|
374
|
+
* Create a cost basis for a currency.
|
|
375
|
+
*
|
|
376
|
+
* POST /openmeter/currencies/custom/{currencyId}/cost-bases
|
|
377
|
+
*/
|
|
378
|
+
async createCostBasis(request, options) {
|
|
379
|
+
return unwrap(await createCostBasis(this._client, request, options));
|
|
380
|
+
}
|
|
381
|
+
}
|
|
382
|
+
export class InternalGovernance {
|
|
383
|
+
_client;
|
|
384
|
+
constructor(_client) {
|
|
385
|
+
this._client = _client;
|
|
386
|
+
}
|
|
387
|
+
/**
|
|
388
|
+
* Query governance access
|
|
389
|
+
*
|
|
390
|
+
* Query feature access for a list of customers.
|
|
391
|
+
*
|
|
392
|
+
* The endpoint resolves each provided identifier to a customer and returns the
|
|
393
|
+
* access status for the requested features, plus optional credit balance
|
|
394
|
+
* availability.
|
|
395
|
+
*
|
|
396
|
+
* _Designed to be called on a fixed refresh interval and the query response is
|
|
397
|
+
* intended to be cached._
|
|
398
|
+
*
|
|
399
|
+
* POST /openmeter/governance/query
|
|
400
|
+
*/
|
|
401
|
+
async queryAccess(request, options) {
|
|
402
|
+
return unwrap(await queryGovernanceAccess(this._client, request, options));
|
|
403
|
+
}
|
|
404
|
+
}
|
package/dist/sdk/invoices.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { type Client } from '../core.js';
|
|
2
2
|
import { type RequestOptions } from '../lib/types.js';
|
|
3
|
-
import type { ListInvoicesRequest, ListInvoicesResponse, GetInvoiceRequest, GetInvoiceResponse, UpdateInvoiceRequest, UpdateInvoiceResponse, DeleteInvoiceRequest, DeleteInvoiceResponse } from '../models/operations/invoices.js';
|
|
3
|
+
import type { ListInvoicesRequest, ListInvoicesResponse, GetInvoiceRequest, GetInvoiceResponse, UpdateInvoiceRequest, UpdateInvoiceResponse, DeleteInvoiceRequest, DeleteInvoiceResponse, AdvanceInvoiceRequest, AdvanceInvoiceResponse, ApproveInvoiceRequest, ApproveInvoiceResponse, RetryInvoiceRequest, RetryInvoiceResponse, SnapshotQuantitiesInvoiceRequest, SnapshotQuantitiesInvoiceResponse } from '../models/operations/invoices.js';
|
|
4
4
|
export declare class Invoices {
|
|
5
5
|
private readonly _client;
|
|
6
6
|
constructor(_client: Client);
|
|
@@ -8,5 +8,8 @@ export declare class Invoices {
|
|
|
8
8
|
get(request: GetInvoiceRequest, options?: RequestOptions): Promise<GetInvoiceResponse>;
|
|
9
9
|
update(request: UpdateInvoiceRequest, options?: RequestOptions): Promise<UpdateInvoiceResponse>;
|
|
10
10
|
delete(request: DeleteInvoiceRequest, options?: RequestOptions): Promise<DeleteInvoiceResponse>;
|
|
11
|
+
advance(request: AdvanceInvoiceRequest, options?: RequestOptions): Promise<AdvanceInvoiceResponse>;
|
|
12
|
+
approve(request: ApproveInvoiceRequest, options?: RequestOptions): Promise<ApproveInvoiceResponse>;
|
|
13
|
+
retry(request: RetryInvoiceRequest, options?: RequestOptions): Promise<RetryInvoiceResponse>;
|
|
14
|
+
snapshotQuantities(request: SnapshotQuantitiesInvoiceRequest, options?: RequestOptions): Promise<SnapshotQuantitiesInvoiceResponse>;
|
|
11
15
|
}
|
|
12
|
-
//# sourceMappingURL=invoices.d.ts.map
|
package/dist/sdk/invoices.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { unwrap } from '../lib/types.js';
|
|
2
|
-
import { listInvoices, getInvoice, updateInvoice, deleteInvoice, } from '../funcs/invoices.js';
|
|
2
|
+
import { listInvoices, getInvoice, updateInvoice, deleteInvoice, advanceInvoice, approveInvoice, retryInvoice, snapshotQuantitiesInvoice, } from '../funcs/invoices.js';
|
|
3
3
|
export class Invoices {
|
|
4
4
|
_client;
|
|
5
5
|
constructor(_client) {
|
|
@@ -17,5 +17,16 @@ export class Invoices {
|
|
|
17
17
|
async delete(request, options) {
|
|
18
18
|
return unwrap(await deleteInvoice(this._client, request, options));
|
|
19
19
|
}
|
|
20
|
+
async advance(request, options) {
|
|
21
|
+
return unwrap(await advanceInvoice(this._client, request, options));
|
|
22
|
+
}
|
|
23
|
+
async approve(request, options) {
|
|
24
|
+
return unwrap(await approveInvoice(this._client, request, options));
|
|
25
|
+
}
|
|
26
|
+
async retry(request, options) {
|
|
27
|
+
return unwrap(await retryInvoice(this._client, request, options));
|
|
28
|
+
}
|
|
29
|
+
async snapshotQuantities(request, options) {
|
|
30
|
+
return unwrap(await snapshotQuantitiesInvoice(this._client, request, options));
|
|
31
|
+
}
|
|
20
32
|
}
|
|
21
|
-
//# sourceMappingURL=invoices.js.map
|
package/dist/sdk/llmCost.d.ts
CHANGED
|
@@ -1,13 +1,69 @@
|
|
|
1
1
|
import { type Client } from '../core.js';
|
|
2
2
|
import { 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
|
+
import type { LlmCostPrice } from '../models/types.js';
|
|
4
5
|
export declare class LLMCost {
|
|
5
6
|
private readonly _client;
|
|
6
7
|
constructor(_client: Client);
|
|
8
|
+
/**
|
|
9
|
+
* List LLM cost prices
|
|
10
|
+
*
|
|
11
|
+
* List global LLM cost prices. Returns prices with overrides applied if any.
|
|
12
|
+
*
|
|
13
|
+
* GET /openmeter/llm-cost/prices
|
|
14
|
+
*/
|
|
7
15
|
listPrices(request?: ListLlmCostPricesRequest, options?: RequestOptions): Promise<ListLlmCostPricesResponse>;
|
|
16
|
+
/**
|
|
17
|
+
* List LLM cost prices
|
|
18
|
+
*
|
|
19
|
+
* List global LLM cost prices. Returns prices with overrides applied if any.
|
|
20
|
+
*
|
|
21
|
+
* Iterates every item across all pages, fetching more as the returned iterable is consumed.
|
|
22
|
+
*
|
|
23
|
+
* GET /openmeter/llm-cost/prices
|
|
24
|
+
*/
|
|
25
|
+
listPricesAll(request?: ListLlmCostPricesRequest, options?: RequestOptions): AsyncIterable<LlmCostPrice>;
|
|
26
|
+
/**
|
|
27
|
+
* Get LLM cost price
|
|
28
|
+
*
|
|
29
|
+
* Get a specific LLM cost price by ID. Returns the price with overrides applied if
|
|
30
|
+
* any.
|
|
31
|
+
*
|
|
32
|
+
* GET /openmeter/llm-cost/prices/{priceId}
|
|
33
|
+
*/
|
|
8
34
|
getPrice(request: GetLlmCostPriceRequest, options?: RequestOptions): Promise<GetLlmCostPriceResponse>;
|
|
35
|
+
/**
|
|
36
|
+
* List LLM cost overrides
|
|
37
|
+
*
|
|
38
|
+
* List per-namespace price overrides.
|
|
39
|
+
*
|
|
40
|
+
* GET /openmeter/llm-cost/overrides
|
|
41
|
+
*/
|
|
9
42
|
listOverrides(request?: ListLlmCostOverridesRequest, options?: RequestOptions): Promise<ListLlmCostOverridesResponse>;
|
|
43
|
+
/**
|
|
44
|
+
* List LLM cost overrides
|
|
45
|
+
*
|
|
46
|
+
* List per-namespace price overrides.
|
|
47
|
+
*
|
|
48
|
+
* Iterates every item across all pages, fetching more as the returned iterable is consumed.
|
|
49
|
+
*
|
|
50
|
+
* GET /openmeter/llm-cost/overrides
|
|
51
|
+
*/
|
|
52
|
+
listOverridesAll(request?: ListLlmCostOverridesRequest, options?: RequestOptions): AsyncIterable<LlmCostPrice>;
|
|
53
|
+
/**
|
|
54
|
+
* Create LLM cost override
|
|
55
|
+
*
|
|
56
|
+
* Create a per-namespace price override.
|
|
57
|
+
*
|
|
58
|
+
* POST /openmeter/llm-cost/overrides
|
|
59
|
+
*/
|
|
10
60
|
createOverride(request: CreateLlmCostOverrideRequest, options?: RequestOptions): Promise<CreateLlmCostOverrideResponse>;
|
|
61
|
+
/**
|
|
62
|
+
* Delete LLM cost override
|
|
63
|
+
*
|
|
64
|
+
* Delete a per-namespace price override.
|
|
65
|
+
*
|
|
66
|
+
* DELETE /openmeter/llm-cost/overrides/{priceId}
|
|
67
|
+
*/
|
|
11
68
|
deleteOverride(request: DeleteLlmCostOverrideRequest, options?: RequestOptions): Promise<DeleteLlmCostOverrideResponse>;
|
|
12
69
|
}
|
|
13
|
-
//# sourceMappingURL=llmCost.d.ts.map
|
package/dist/sdk/llmCost.js
CHANGED
|
@@ -1,24 +1,85 @@
|
|
|
1
|
+
// Code generated by @openmeter/typespec-typescript. DO NOT EDIT.
|
|
1
2
|
import { unwrap } from '../lib/types.js';
|
|
3
|
+
import { paginatePages } from '../lib/paginate.js';
|
|
2
4
|
import { listLlmCostPrices, getLlmCostPrice, listLlmCostOverrides, createLlmCostOverride, deleteLlmCostOverride, } from '../funcs/llmCost.js';
|
|
3
5
|
export class LLMCost {
|
|
4
6
|
_client;
|
|
5
7
|
constructor(_client) {
|
|
6
8
|
this._client = _client;
|
|
7
9
|
}
|
|
10
|
+
/**
|
|
11
|
+
* List LLM cost prices
|
|
12
|
+
*
|
|
13
|
+
* List global LLM cost prices. Returns prices with overrides applied if any.
|
|
14
|
+
*
|
|
15
|
+
* GET /openmeter/llm-cost/prices
|
|
16
|
+
*/
|
|
8
17
|
async listPrices(request, options) {
|
|
9
18
|
return unwrap(await listLlmCostPrices(this._client, request, options));
|
|
10
19
|
}
|
|
20
|
+
/**
|
|
21
|
+
* List LLM cost prices
|
|
22
|
+
*
|
|
23
|
+
* List global LLM cost prices. Returns prices with overrides applied if any.
|
|
24
|
+
*
|
|
25
|
+
* Iterates every item across all pages, fetching more as the returned iterable is consumed.
|
|
26
|
+
*
|
|
27
|
+
* GET /openmeter/llm-cost/prices
|
|
28
|
+
*/
|
|
29
|
+
listPricesAll(request, options) {
|
|
30
|
+
return paginatePages((req, opts) => listLlmCostPrices(this._client, req, opts), request ?? {}, options);
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* Get LLM cost price
|
|
34
|
+
*
|
|
35
|
+
* Get a specific LLM cost price by ID. Returns the price with overrides applied if
|
|
36
|
+
* any.
|
|
37
|
+
*
|
|
38
|
+
* GET /openmeter/llm-cost/prices/{priceId}
|
|
39
|
+
*/
|
|
11
40
|
async getPrice(request, options) {
|
|
12
41
|
return unwrap(await getLlmCostPrice(this._client, request, options));
|
|
13
42
|
}
|
|
43
|
+
/**
|
|
44
|
+
* List LLM cost overrides
|
|
45
|
+
*
|
|
46
|
+
* List per-namespace price overrides.
|
|
47
|
+
*
|
|
48
|
+
* GET /openmeter/llm-cost/overrides
|
|
49
|
+
*/
|
|
14
50
|
async listOverrides(request, options) {
|
|
15
51
|
return unwrap(await listLlmCostOverrides(this._client, request, options));
|
|
16
52
|
}
|
|
53
|
+
/**
|
|
54
|
+
* List LLM cost overrides
|
|
55
|
+
*
|
|
56
|
+
* List per-namespace price overrides.
|
|
57
|
+
*
|
|
58
|
+
* Iterates every item across all pages, fetching more as the returned iterable is consumed.
|
|
59
|
+
*
|
|
60
|
+
* GET /openmeter/llm-cost/overrides
|
|
61
|
+
*/
|
|
62
|
+
listOverridesAll(request, options) {
|
|
63
|
+
return paginatePages((req, opts) => listLlmCostOverrides(this._client, req, opts), request ?? {}, options);
|
|
64
|
+
}
|
|
65
|
+
/**
|
|
66
|
+
* Create LLM cost override
|
|
67
|
+
*
|
|
68
|
+
* Create a per-namespace price override.
|
|
69
|
+
*
|
|
70
|
+
* POST /openmeter/llm-cost/overrides
|
|
71
|
+
*/
|
|
17
72
|
async createOverride(request, options) {
|
|
18
73
|
return unwrap(await createLlmCostOverride(this._client, request, options));
|
|
19
74
|
}
|
|
75
|
+
/**
|
|
76
|
+
* Delete LLM cost override
|
|
77
|
+
*
|
|
78
|
+
* Delete a per-namespace price override.
|
|
79
|
+
*
|
|
80
|
+
* DELETE /openmeter/llm-cost/overrides/{priceId}
|
|
81
|
+
*/
|
|
20
82
|
async deleteOverride(request, options) {
|
|
21
83
|
return unwrap(await deleteLlmCostOverride(this._client, request, options));
|
|
22
84
|
}
|
|
23
85
|
}
|
|
24
|
-
//# sourceMappingURL=llmCost.js.map
|
package/dist/sdk/meters.d.ts
CHANGED
|
@@ -1,15 +1,78 @@
|
|
|
1
1
|
import { type Client } from '../core.js';
|
|
2
2
|
import { 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
|
+
import type { Meter } from '../models/types.js';
|
|
4
5
|
export declare class Meters {
|
|
5
6
|
private readonly _client;
|
|
6
7
|
constructor(_client: Client);
|
|
8
|
+
/**
|
|
9
|
+
* Create meter
|
|
10
|
+
*
|
|
11
|
+
* Create a meter.
|
|
12
|
+
*
|
|
13
|
+
* POST /openmeter/meters
|
|
14
|
+
*/
|
|
7
15
|
create(request: CreateMeterRequest, options?: RequestOptions): Promise<CreateMeterResponse>;
|
|
16
|
+
/**
|
|
17
|
+
* Get meter
|
|
18
|
+
*
|
|
19
|
+
* Get a meter by ID.
|
|
20
|
+
*
|
|
21
|
+
* GET /openmeter/meters/{meterId}
|
|
22
|
+
*/
|
|
8
23
|
get(request: GetMeterRequest, options?: RequestOptions): Promise<GetMeterResponse>;
|
|
24
|
+
/**
|
|
25
|
+
* List meters
|
|
26
|
+
*
|
|
27
|
+
* List meters.
|
|
28
|
+
*
|
|
29
|
+
* GET /openmeter/meters
|
|
30
|
+
*/
|
|
9
31
|
list(request?: ListMetersRequest, options?: RequestOptions): Promise<ListMetersResponse>;
|
|
32
|
+
/**
|
|
33
|
+
* List meters
|
|
34
|
+
*
|
|
35
|
+
* List meters.
|
|
36
|
+
*
|
|
37
|
+
* Iterates every item across all pages, fetching more as the returned iterable is consumed.
|
|
38
|
+
*
|
|
39
|
+
* GET /openmeter/meters
|
|
40
|
+
*/
|
|
41
|
+
listAll(request?: ListMetersRequest, options?: RequestOptions): AsyncIterable<Meter>;
|
|
42
|
+
/**
|
|
43
|
+
* Update meter
|
|
44
|
+
*
|
|
45
|
+
* Update a meter.
|
|
46
|
+
*
|
|
47
|
+
* PUT /openmeter/meters/{meterId}
|
|
48
|
+
*/
|
|
10
49
|
update(request: UpdateMeterRequest, options?: RequestOptions): Promise<UpdateMeterResponse>;
|
|
50
|
+
/**
|
|
51
|
+
* Delete meter
|
|
52
|
+
*
|
|
53
|
+
* Delete a meter.
|
|
54
|
+
*
|
|
55
|
+
* DELETE /openmeter/meters/{meterId}
|
|
56
|
+
*/
|
|
11
57
|
delete(request: DeleteMeterRequest, options?: RequestOptions): Promise<DeleteMeterResponse>;
|
|
58
|
+
/**
|
|
59
|
+
* Query meter
|
|
60
|
+
*
|
|
61
|
+
* Query a meter for usage.
|
|
62
|
+
*
|
|
63
|
+
* Set `Accept: application/json` (the default) to get a structured JSON response.
|
|
64
|
+
* Set `Accept: text/csv` to download the same data as a CSV file suitable for
|
|
65
|
+
* spreadsheets. The CSV columns, in order, are:
|
|
66
|
+
*
|
|
67
|
+
* `from, to, [subject,] [customer_id, customer_key, customer_name,] <dimensions...>, value`
|
|
68
|
+
*
|
|
69
|
+
* The `subject` column is emitted only when `subject` is in the query's
|
|
70
|
+
* `group_by_dimensions`. The three `customer_*` columns are emitted together only
|
|
71
|
+
* when `customer_id` is in the query's `group_by_dimensions`.
|
|
72
|
+
*
|
|
73
|
+
* POST /openmeter/meters/{meterId}/query
|
|
74
|
+
*/
|
|
12
75
|
query(request: QueryMeterRequest, options?: RequestOptions): Promise<QueryMeterResponse>;
|
|
76
|
+
/** POST /openmeter/meters/{meterId}/query */
|
|
13
77
|
queryCsv(request: QueryMeterCsvRequest, options?: RequestOptions): Promise<QueryMeterCsvResponse>;
|
|
14
78
|
}
|
|
15
|
-
//# sourceMappingURL=meters.d.ts.map
|