@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,180 @@
|
|
|
1
|
+
import { type Client } from '../core.js';
|
|
2
|
+
import { type RequestOptions } from '../lib/types.js';
|
|
3
|
+
import type { CreateSubscriptionAddonRequest, CreateSubscriptionAddonResponse } from '../models/operations/subscriptions.js';
|
|
4
|
+
import type { ListInvoicesRequest, ListInvoicesResponse, GetInvoiceRequest, GetInvoiceResponse, UpdateInvoiceRequest, UpdateInvoiceResponse, DeleteInvoiceRequest, DeleteInvoiceResponse } from '../models/operations/invoices.js';
|
|
5
|
+
import type { ListCurrenciesRequest, ListCurrenciesResponse, CreateCustomCurrencyRequest, CreateCustomCurrencyResponse, ListCostBasesRequest, ListCostBasesResponse, CreateCostBasisRequest, CreateCostBasisResponse } from '../models/operations/currencies.js';
|
|
6
|
+
import type { QueryGovernanceAccessRequest, QueryGovernanceAccessResponse } from '../models/operations/governance.js';
|
|
7
|
+
import type { CostBasis, Currency, Invoice } from '../models/types.js';
|
|
8
|
+
/**
|
|
9
|
+
* Operations marked internal in the API definition. They are not part of
|
|
10
|
+
* the customer surface: they may require additional permissions, and they
|
|
11
|
+
* can change or be removed without notice or semver consideration.
|
|
12
|
+
*/
|
|
13
|
+
export declare class Internal {
|
|
14
|
+
private readonly _client;
|
|
15
|
+
constructor(_client: Client);
|
|
16
|
+
private _subscriptions?;
|
|
17
|
+
get subscriptions(): InternalSubscriptions;
|
|
18
|
+
private _invoices?;
|
|
19
|
+
get invoices(): InternalInvoices;
|
|
20
|
+
private _currencies?;
|
|
21
|
+
get currencies(): InternalCurrencies;
|
|
22
|
+
private _governance?;
|
|
23
|
+
get governance(): InternalGovernance;
|
|
24
|
+
}
|
|
25
|
+
export declare class InternalSubscriptions {
|
|
26
|
+
private readonly _client;
|
|
27
|
+
constructor(_client: Client);
|
|
28
|
+
/**
|
|
29
|
+
* Create a new subscription add-on
|
|
30
|
+
*
|
|
31
|
+
* Add add-on to a subscription.
|
|
32
|
+
*
|
|
33
|
+
* POST /openmeter/subscriptions/{subscriptionId}/addons
|
|
34
|
+
*/
|
|
35
|
+
createAddon(request: CreateSubscriptionAddonRequest, options?: RequestOptions): Promise<CreateSubscriptionAddonResponse>;
|
|
36
|
+
}
|
|
37
|
+
export declare class InternalInvoices {
|
|
38
|
+
private readonly _client;
|
|
39
|
+
constructor(_client: Client);
|
|
40
|
+
/**
|
|
41
|
+
* List billing invoices
|
|
42
|
+
*
|
|
43
|
+
* List billing invoices.
|
|
44
|
+
*
|
|
45
|
+
* Returns a page of invoices. Gathering invoices are never included. Use `filter`
|
|
46
|
+
* to narrow by status, customer, dates, or service period start. Use `sort` to
|
|
47
|
+
* control ordering.
|
|
48
|
+
*
|
|
49
|
+
* GET /openmeter/billing/invoices
|
|
50
|
+
*/
|
|
51
|
+
list(request?: ListInvoicesRequest, options?: RequestOptions): Promise<ListInvoicesResponse>;
|
|
52
|
+
/**
|
|
53
|
+
* List billing invoices
|
|
54
|
+
*
|
|
55
|
+
* List billing invoices.
|
|
56
|
+
*
|
|
57
|
+
* Returns a page of invoices. Gathering invoices are never included. Use `filter`
|
|
58
|
+
* to narrow by status, customer, dates, or service period start. Use `sort` to
|
|
59
|
+
* control ordering.
|
|
60
|
+
*
|
|
61
|
+
* Iterates every item across all pages, fetching more as the returned iterable is consumed.
|
|
62
|
+
*
|
|
63
|
+
* GET /openmeter/billing/invoices
|
|
64
|
+
*/
|
|
65
|
+
listAll(request?: ListInvoicesRequest, options?: RequestOptions): AsyncIterable<Invoice>;
|
|
66
|
+
/**
|
|
67
|
+
* Get a billing invoice
|
|
68
|
+
*
|
|
69
|
+
* Get a billing invoice by ID.
|
|
70
|
+
*
|
|
71
|
+
* Returns the full invoice resource including line items, status details, totals,
|
|
72
|
+
* and workflow configuration snapshot.
|
|
73
|
+
*
|
|
74
|
+
* GET /openmeter/billing/invoices/{invoiceId}
|
|
75
|
+
*/
|
|
76
|
+
get(request: GetInvoiceRequest, options?: RequestOptions): Promise<GetInvoiceResponse>;
|
|
77
|
+
/**
|
|
78
|
+
* Update a billing invoice
|
|
79
|
+
*
|
|
80
|
+
* Update a billing invoice.
|
|
81
|
+
*
|
|
82
|
+
* Only the mutable fields of the invoice can be edited: description, labels,
|
|
83
|
+
* supplier, customer, workflow settings, and top-level lines. Top-level lines are
|
|
84
|
+
* matched by `id`; lines without an `id` are created, and existing lines omitted
|
|
85
|
+
* from `lines` are deleted. Detailed (child) lines are always computed and cannot
|
|
86
|
+
* be edited directly. Only invoices in draft status can be updated.
|
|
87
|
+
*
|
|
88
|
+
* PUT /openmeter/billing/invoices/{invoiceId}
|
|
89
|
+
*/
|
|
90
|
+
update(request: UpdateInvoiceRequest, options?: RequestOptions): Promise<UpdateInvoiceResponse>;
|
|
91
|
+
/**
|
|
92
|
+
* Delete a billing invoice
|
|
93
|
+
*
|
|
94
|
+
* Delete a billing invoice.
|
|
95
|
+
*
|
|
96
|
+
* Only standard invoices in draft status can be deleted. Deleting an invoice will
|
|
97
|
+
* also delete all associated line items and workflow configuration.
|
|
98
|
+
*
|
|
99
|
+
* DELETE /openmeter/billing/invoices/{invoiceId}
|
|
100
|
+
*/
|
|
101
|
+
delete(request: DeleteInvoiceRequest, options?: RequestOptions): Promise<DeleteInvoiceResponse>;
|
|
102
|
+
}
|
|
103
|
+
export declare class InternalCurrencies {
|
|
104
|
+
private readonly _client;
|
|
105
|
+
constructor(_client: Client);
|
|
106
|
+
/**
|
|
107
|
+
* List currencies
|
|
108
|
+
*
|
|
109
|
+
* List currencies supported by the billing system.
|
|
110
|
+
*
|
|
111
|
+
* GET /openmeter/currencies
|
|
112
|
+
*/
|
|
113
|
+
list(request?: ListCurrenciesRequest, options?: RequestOptions): Promise<ListCurrenciesResponse>;
|
|
114
|
+
/**
|
|
115
|
+
* List currencies
|
|
116
|
+
*
|
|
117
|
+
* List currencies supported by the billing system.
|
|
118
|
+
*
|
|
119
|
+
* Iterates every item across all pages, fetching more as the returned iterable is consumed.
|
|
120
|
+
*
|
|
121
|
+
* GET /openmeter/currencies
|
|
122
|
+
*/
|
|
123
|
+
listAll(request?: ListCurrenciesRequest, options?: RequestOptions): AsyncIterable<Currency>;
|
|
124
|
+
/**
|
|
125
|
+
* Create custom currency
|
|
126
|
+
*
|
|
127
|
+
* Create a custom currency. This operation allows defining your own custom
|
|
128
|
+
* currency for billing purposes.
|
|
129
|
+
*
|
|
130
|
+
* POST /openmeter/currencies/custom
|
|
131
|
+
*/
|
|
132
|
+
createCustomCurrency(request: CreateCustomCurrencyRequest, options?: RequestOptions): Promise<CreateCustomCurrencyResponse>;
|
|
133
|
+
/**
|
|
134
|
+
* List cost bases
|
|
135
|
+
*
|
|
136
|
+
* List cost bases for a currency. For custom currencies, there can be multiple
|
|
137
|
+
* cost bases with different `effective_from` dates.
|
|
138
|
+
*
|
|
139
|
+
* GET /openmeter/currencies/custom/{currencyId}/cost-bases
|
|
140
|
+
*/
|
|
141
|
+
listCostBases(request: ListCostBasesRequest, options?: RequestOptions): Promise<ListCostBasesResponse>;
|
|
142
|
+
/**
|
|
143
|
+
* List cost bases
|
|
144
|
+
*
|
|
145
|
+
* List cost bases for a currency. For custom currencies, there can be multiple
|
|
146
|
+
* cost bases with different `effective_from` dates.
|
|
147
|
+
*
|
|
148
|
+
* Iterates every item across all pages, fetching more as the returned iterable is consumed.
|
|
149
|
+
*
|
|
150
|
+
* GET /openmeter/currencies/custom/{currencyId}/cost-bases
|
|
151
|
+
*/
|
|
152
|
+
listCostBasesAll(request: ListCostBasesRequest, options?: RequestOptions): AsyncIterable<CostBasis>;
|
|
153
|
+
/**
|
|
154
|
+
* Create cost basis
|
|
155
|
+
*
|
|
156
|
+
* Create a cost basis for a currency.
|
|
157
|
+
*
|
|
158
|
+
* POST /openmeter/currencies/custom/{currencyId}/cost-bases
|
|
159
|
+
*/
|
|
160
|
+
createCostBasis(request: CreateCostBasisRequest, options?: RequestOptions): Promise<CreateCostBasisResponse>;
|
|
161
|
+
}
|
|
162
|
+
export declare class InternalGovernance {
|
|
163
|
+
private readonly _client;
|
|
164
|
+
constructor(_client: Client);
|
|
165
|
+
/**
|
|
166
|
+
* Query governance access
|
|
167
|
+
*
|
|
168
|
+
* Query feature access for a list of customers.
|
|
169
|
+
*
|
|
170
|
+
* The endpoint resolves each provided identifier to a customer and returns the
|
|
171
|
+
* access status for the requested features, plus optional credit balance
|
|
172
|
+
* availability.
|
|
173
|
+
*
|
|
174
|
+
* _Designed to be called on a fixed refresh interval and the query response is
|
|
175
|
+
* intended to be cached._
|
|
176
|
+
*
|
|
177
|
+
* POST /openmeter/governance/query
|
|
178
|
+
*/
|
|
179
|
+
queryAccess(request: QueryGovernanceAccessRequest, options?: RequestOptions): Promise<QueryGovernanceAccessResponse>;
|
|
180
|
+
}
|
|
@@ -0,0 +1,224 @@
|
|
|
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 { listInvoices, getInvoice, updateInvoice, deleteInvoice, } from '../funcs/invoices.js';
|
|
6
|
+
import { listCurrencies, createCustomCurrency, listCostBases, createCostBasis, } from '../funcs/currencies.js';
|
|
7
|
+
import { queryGovernanceAccess } from '../funcs/governance.js';
|
|
8
|
+
/**
|
|
9
|
+
* Operations marked internal in the API definition. They are not part of
|
|
10
|
+
* the customer surface: they may require additional permissions, and they
|
|
11
|
+
* can change or be removed without notice or semver consideration.
|
|
12
|
+
*/
|
|
13
|
+
export class Internal {
|
|
14
|
+
_client;
|
|
15
|
+
constructor(_client) {
|
|
16
|
+
this._client = _client;
|
|
17
|
+
}
|
|
18
|
+
_subscriptions;
|
|
19
|
+
get subscriptions() {
|
|
20
|
+
return (this._subscriptions ??= new InternalSubscriptions(this._client));
|
|
21
|
+
}
|
|
22
|
+
_invoices;
|
|
23
|
+
get invoices() {
|
|
24
|
+
return (this._invoices ??= new InternalInvoices(this._client));
|
|
25
|
+
}
|
|
26
|
+
_currencies;
|
|
27
|
+
get currencies() {
|
|
28
|
+
return (this._currencies ??= new InternalCurrencies(this._client));
|
|
29
|
+
}
|
|
30
|
+
_governance;
|
|
31
|
+
get governance() {
|
|
32
|
+
return (this._governance ??= new InternalGovernance(this._client));
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
export class InternalSubscriptions {
|
|
36
|
+
_client;
|
|
37
|
+
constructor(_client) {
|
|
38
|
+
this._client = _client;
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* Create a new subscription add-on
|
|
42
|
+
*
|
|
43
|
+
* Add add-on to a subscription.
|
|
44
|
+
*
|
|
45
|
+
* POST /openmeter/subscriptions/{subscriptionId}/addons
|
|
46
|
+
*/
|
|
47
|
+
async createAddon(request, options) {
|
|
48
|
+
return unwrap(await createSubscriptionAddon(this._client, request, options));
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
export class InternalInvoices {
|
|
52
|
+
_client;
|
|
53
|
+
constructor(_client) {
|
|
54
|
+
this._client = _client;
|
|
55
|
+
}
|
|
56
|
+
/**
|
|
57
|
+
* List billing invoices
|
|
58
|
+
*
|
|
59
|
+
* List billing invoices.
|
|
60
|
+
*
|
|
61
|
+
* Returns a page of invoices. Gathering invoices are never included. Use `filter`
|
|
62
|
+
* to narrow by status, customer, dates, or service period start. Use `sort` to
|
|
63
|
+
* control ordering.
|
|
64
|
+
*
|
|
65
|
+
* GET /openmeter/billing/invoices
|
|
66
|
+
*/
|
|
67
|
+
async list(request, options) {
|
|
68
|
+
return unwrap(await listInvoices(this._client, request, options));
|
|
69
|
+
}
|
|
70
|
+
/**
|
|
71
|
+
* List billing invoices
|
|
72
|
+
*
|
|
73
|
+
* List billing invoices.
|
|
74
|
+
*
|
|
75
|
+
* Returns a page of invoices. Gathering invoices are never included. Use `filter`
|
|
76
|
+
* to narrow by status, customer, dates, or service period start. Use `sort` to
|
|
77
|
+
* control ordering.
|
|
78
|
+
*
|
|
79
|
+
* Iterates every item across all pages, fetching more as the returned iterable is consumed.
|
|
80
|
+
*
|
|
81
|
+
* GET /openmeter/billing/invoices
|
|
82
|
+
*/
|
|
83
|
+
listAll(request, options) {
|
|
84
|
+
return paginatePages((req, opts) => listInvoices(this._client, req, opts), request ?? {}, options);
|
|
85
|
+
}
|
|
86
|
+
/**
|
|
87
|
+
* Get a billing invoice
|
|
88
|
+
*
|
|
89
|
+
* Get a billing invoice by ID.
|
|
90
|
+
*
|
|
91
|
+
* Returns the full invoice resource including line items, status details, totals,
|
|
92
|
+
* and workflow configuration snapshot.
|
|
93
|
+
*
|
|
94
|
+
* GET /openmeter/billing/invoices/{invoiceId}
|
|
95
|
+
*/
|
|
96
|
+
async get(request, options) {
|
|
97
|
+
return unwrap(await getInvoice(this._client, request, options));
|
|
98
|
+
}
|
|
99
|
+
/**
|
|
100
|
+
* Update a billing invoice
|
|
101
|
+
*
|
|
102
|
+
* Update a billing invoice.
|
|
103
|
+
*
|
|
104
|
+
* Only the mutable fields of the invoice can be edited: description, labels,
|
|
105
|
+
* supplier, customer, workflow settings, and top-level lines. Top-level lines are
|
|
106
|
+
* matched by `id`; lines without an `id` are created, and existing lines omitted
|
|
107
|
+
* from `lines` are deleted. Detailed (child) lines are always computed and cannot
|
|
108
|
+
* be edited directly. Only invoices in draft status can be updated.
|
|
109
|
+
*
|
|
110
|
+
* PUT /openmeter/billing/invoices/{invoiceId}
|
|
111
|
+
*/
|
|
112
|
+
async update(request, options) {
|
|
113
|
+
return unwrap(await updateInvoice(this._client, request, options));
|
|
114
|
+
}
|
|
115
|
+
/**
|
|
116
|
+
* Delete a billing invoice
|
|
117
|
+
*
|
|
118
|
+
* Delete a billing invoice.
|
|
119
|
+
*
|
|
120
|
+
* Only standard invoices in draft status can be deleted. Deleting an invoice will
|
|
121
|
+
* also delete all associated line items and workflow configuration.
|
|
122
|
+
*
|
|
123
|
+
* DELETE /openmeter/billing/invoices/{invoiceId}
|
|
124
|
+
*/
|
|
125
|
+
async delete(request, options) {
|
|
126
|
+
return unwrap(await deleteInvoice(this._client, request, options));
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
export class InternalCurrencies {
|
|
130
|
+
_client;
|
|
131
|
+
constructor(_client) {
|
|
132
|
+
this._client = _client;
|
|
133
|
+
}
|
|
134
|
+
/**
|
|
135
|
+
* List currencies
|
|
136
|
+
*
|
|
137
|
+
* List currencies supported by the billing system.
|
|
138
|
+
*
|
|
139
|
+
* GET /openmeter/currencies
|
|
140
|
+
*/
|
|
141
|
+
async list(request, options) {
|
|
142
|
+
return unwrap(await listCurrencies(this._client, request, options));
|
|
143
|
+
}
|
|
144
|
+
/**
|
|
145
|
+
* List currencies
|
|
146
|
+
*
|
|
147
|
+
* List currencies supported by the billing system.
|
|
148
|
+
*
|
|
149
|
+
* Iterates every item across all pages, fetching more as the returned iterable is consumed.
|
|
150
|
+
*
|
|
151
|
+
* GET /openmeter/currencies
|
|
152
|
+
*/
|
|
153
|
+
listAll(request, options) {
|
|
154
|
+
return paginatePages((req, opts) => listCurrencies(this._client, req, opts), request ?? {}, options);
|
|
155
|
+
}
|
|
156
|
+
/**
|
|
157
|
+
* Create custom currency
|
|
158
|
+
*
|
|
159
|
+
* Create a custom currency. This operation allows defining your own custom
|
|
160
|
+
* currency for billing purposes.
|
|
161
|
+
*
|
|
162
|
+
* POST /openmeter/currencies/custom
|
|
163
|
+
*/
|
|
164
|
+
async createCustomCurrency(request, options) {
|
|
165
|
+
return unwrap(await createCustomCurrency(this._client, request, options));
|
|
166
|
+
}
|
|
167
|
+
/**
|
|
168
|
+
* List cost bases
|
|
169
|
+
*
|
|
170
|
+
* List cost bases for a currency. For custom currencies, there can be multiple
|
|
171
|
+
* cost bases with different `effective_from` dates.
|
|
172
|
+
*
|
|
173
|
+
* GET /openmeter/currencies/custom/{currencyId}/cost-bases
|
|
174
|
+
*/
|
|
175
|
+
async listCostBases(request, options) {
|
|
176
|
+
return unwrap(await listCostBases(this._client, request, options));
|
|
177
|
+
}
|
|
178
|
+
/**
|
|
179
|
+
* List cost bases
|
|
180
|
+
*
|
|
181
|
+
* List cost bases for a currency. For custom currencies, there can be multiple
|
|
182
|
+
* cost bases with different `effective_from` dates.
|
|
183
|
+
*
|
|
184
|
+
* Iterates every item across all pages, fetching more as the returned iterable is consumed.
|
|
185
|
+
*
|
|
186
|
+
* GET /openmeter/currencies/custom/{currencyId}/cost-bases
|
|
187
|
+
*/
|
|
188
|
+
listCostBasesAll(request, options) {
|
|
189
|
+
return paginatePages((req, opts) => listCostBases(this._client, req, opts), request, options);
|
|
190
|
+
}
|
|
191
|
+
/**
|
|
192
|
+
* Create cost basis
|
|
193
|
+
*
|
|
194
|
+
* Create a cost basis for a currency.
|
|
195
|
+
*
|
|
196
|
+
* POST /openmeter/currencies/custom/{currencyId}/cost-bases
|
|
197
|
+
*/
|
|
198
|
+
async createCostBasis(request, options) {
|
|
199
|
+
return unwrap(await createCostBasis(this._client, request, options));
|
|
200
|
+
}
|
|
201
|
+
}
|
|
202
|
+
export class InternalGovernance {
|
|
203
|
+
_client;
|
|
204
|
+
constructor(_client) {
|
|
205
|
+
this._client = _client;
|
|
206
|
+
}
|
|
207
|
+
/**
|
|
208
|
+
* Query governance access
|
|
209
|
+
*
|
|
210
|
+
* Query feature access for a list of customers.
|
|
211
|
+
*
|
|
212
|
+
* The endpoint resolves each provided identifier to a customer and returns the
|
|
213
|
+
* access status for the requested features, plus optional credit balance
|
|
214
|
+
* availability.
|
|
215
|
+
*
|
|
216
|
+
* _Designed to be called on a fixed refresh interval and the query response is
|
|
217
|
+
* intended to be cached._
|
|
218
|
+
*
|
|
219
|
+
* POST /openmeter/governance/query
|
|
220
|
+
*/
|
|
221
|
+
async queryAccess(request, options) {
|
|
222
|
+
return unwrap(await queryGovernanceAccess(this._client, request, options));
|
|
223
|
+
}
|
|
224
|
+
}
|
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,14 +1,78 @@
|
|
|
1
1
|
import { type Client } from '../core.js';
|
|
2
2
|
import { 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
|
+
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 */
|
|
77
|
+
queryCsv(request: QueryMeterCsvRequest, options?: RequestOptions): Promise<QueryMeterCsvResponse>;
|
|
13
78
|
}
|
|
14
|
-
//# sourceMappingURL=meters.d.ts.map
|