@openmeter/client 1.0.0-beta.231 → 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/README.md +24 -14
- package/dist/core.js +7 -4
- package/dist/funcs/addons.js +59 -11
- package/dist/funcs/apps.d.ts +41 -1
- package/dist/funcs/apps.js +164 -3
- package/dist/funcs/billing.js +34 -7
- package/dist/funcs/currencies.d.ts +9 -1
- package/dist/funcs/currencies.js +62 -5
- package/dist/funcs/customers.js +214 -43
- package/dist/funcs/entitlements.js +12 -3
- package/dist/funcs/events.js +3 -0
- package/dist/funcs/features.js +48 -9
- package/dist/funcs/invoices.d.ts +58 -1
- package/dist/funcs/invoices.js +202 -7
- package/dist/funcs/llmCost.js +26 -5
- package/dist/funcs/meters.js +59 -11
- package/dist/funcs/planAddons.js +65 -17
- package/dist/funcs/plans.js +59 -11
- package/dist/funcs/subscriptions.js +87 -17
- package/dist/funcs/tax.js +34 -7
- package/dist/index.d.ts +1 -2
- package/dist/index.js +0 -1
- package/dist/lib/config.d.ts +2 -2
- package/dist/lib/paginate.d.ts +1 -1
- package/dist/lib/version.d.ts +1 -1
- package/dist/lib/version.js +1 -1
- package/dist/lib/wire.d.ts +1 -0
- package/dist/lib/wire.js +26 -4
- package/dist/models/operations/apps.d.ts +25 -1
- package/dist/models/operations/currencies.d.ts +10 -0
- package/dist/models/operations/customers.d.ts +2 -1
- package/dist/models/operations/invoices.d.ts +16 -0
- package/dist/models/schemas.d.ts +15256 -9856
- package/dist/models/schemas.js +938 -447
- package/dist/models/types.d.ts +503 -259
- package/dist/sdk/apps.d.ts +44 -2
- package/dist/sdk/apps.js +53 -1
- package/dist/sdk/internal.d.ts +151 -3
- package/dist/sdk/internal.js +182 -2
- package/dist/sdk/invoices.d.ts +15 -0
- package/dist/sdk/invoices.js +32 -0
- package/dist/sdk/sdk.d.ts +0 -3
- package/dist/sdk/sdk.js +0 -5
- package/package.json +3 -3
package/dist/sdk/apps.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { type Client } from '../core.js';
|
|
2
2
|
import { type RequestOptions } from '../lib/types.js';
|
|
3
|
-
import type { ListAppsRequest, ListAppsResponse, GetAppRequest, GetAppResponse } from '../models/operations/apps.js';
|
|
4
|
-
import type { App } from '../models/types.js';
|
|
3
|
+
import type { ListAppsRequest, ListAppsResponse, GetAppRequest, GetAppResponse, UninstallAppRequest, UninstallAppResponse, ListAppCatalogRequest, ListAppCatalogResponse, GetAppCatalogItemRequest, GetAppCatalogItemResponse, InstallAppRequest, InstallAppResponse } from '../models/operations/apps.js';
|
|
4
|
+
import type { App, AppCatalogItem } from '../models/types.js';
|
|
5
5
|
export declare class Apps {
|
|
6
6
|
private readonly _client;
|
|
7
7
|
constructor(_client: Client);
|
|
@@ -31,4 +31,46 @@ export declare class Apps {
|
|
|
31
31
|
* GET /openmeter/apps/{appId}
|
|
32
32
|
*/
|
|
33
33
|
get(request: GetAppRequest, options?: RequestOptions): Promise<GetAppResponse>;
|
|
34
|
+
/**
|
|
35
|
+
* Uninstall app
|
|
36
|
+
*
|
|
37
|
+
* Uninstall an app by ID.
|
|
38
|
+
*
|
|
39
|
+
* DELETE /openmeter/apps/{appId}
|
|
40
|
+
*/
|
|
41
|
+
uninstall(request: UninstallAppRequest, options?: RequestOptions): Promise<UninstallAppResponse>;
|
|
42
|
+
/**
|
|
43
|
+
* List app catalog
|
|
44
|
+
*
|
|
45
|
+
* List available apps.
|
|
46
|
+
*
|
|
47
|
+
* GET /openmeter/app-catalog
|
|
48
|
+
*/
|
|
49
|
+
listCatalog(request?: ListAppCatalogRequest, options?: RequestOptions): Promise<ListAppCatalogResponse>;
|
|
50
|
+
/**
|
|
51
|
+
* List app catalog
|
|
52
|
+
*
|
|
53
|
+
* List available apps.
|
|
54
|
+
*
|
|
55
|
+
* Iterates every item across all pages, fetching more as the returned iterable is consumed.
|
|
56
|
+
*
|
|
57
|
+
* GET /openmeter/app-catalog
|
|
58
|
+
*/
|
|
59
|
+
listCatalogAll(request?: ListAppCatalogRequest, options?: RequestOptions): AsyncIterable<AppCatalogItem>;
|
|
60
|
+
/**
|
|
61
|
+
* Get app catalog item by type
|
|
62
|
+
*
|
|
63
|
+
* Get an app catalog item by type.
|
|
64
|
+
*
|
|
65
|
+
* GET /openmeter/app-catalog/{appType}
|
|
66
|
+
*/
|
|
67
|
+
getCatalogItem(request: GetAppCatalogItemRequest, options?: RequestOptions): Promise<GetAppCatalogItemResponse>;
|
|
68
|
+
/**
|
|
69
|
+
* Install app from the catalog
|
|
70
|
+
*
|
|
71
|
+
* Install an app from the catalog.
|
|
72
|
+
*
|
|
73
|
+
* POST /openmeter/app-catalog/install
|
|
74
|
+
*/
|
|
75
|
+
install(request: InstallAppRequest, options?: RequestOptions): Promise<InstallAppResponse>;
|
|
34
76
|
}
|
package/dist/sdk/apps.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// Code generated by @openmeter/typespec-typescript. DO NOT EDIT.
|
|
2
2
|
import { unwrap } from '../lib/types.js';
|
|
3
3
|
import { paginatePages } from '../lib/paginate.js';
|
|
4
|
-
import { listApps, getApp } from '../funcs/apps.js';
|
|
4
|
+
import { listApps, getApp, uninstallApp, listAppCatalog, getAppCatalogItem, installApp, } from '../funcs/apps.js';
|
|
5
5
|
export class Apps {
|
|
6
6
|
_client;
|
|
7
7
|
constructor(_client) {
|
|
@@ -39,4 +39,56 @@ export class Apps {
|
|
|
39
39
|
async get(request, options) {
|
|
40
40
|
return unwrap(await getApp(this._client, request, options));
|
|
41
41
|
}
|
|
42
|
+
/**
|
|
43
|
+
* Uninstall app
|
|
44
|
+
*
|
|
45
|
+
* Uninstall an app by ID.
|
|
46
|
+
*
|
|
47
|
+
* DELETE /openmeter/apps/{appId}
|
|
48
|
+
*/
|
|
49
|
+
async uninstall(request, options) {
|
|
50
|
+
return unwrap(await uninstallApp(this._client, request, options));
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* List app catalog
|
|
54
|
+
*
|
|
55
|
+
* List available apps.
|
|
56
|
+
*
|
|
57
|
+
* GET /openmeter/app-catalog
|
|
58
|
+
*/
|
|
59
|
+
async listCatalog(request, options) {
|
|
60
|
+
return unwrap(await listAppCatalog(this._client, request, options));
|
|
61
|
+
}
|
|
62
|
+
/**
|
|
63
|
+
* List app catalog
|
|
64
|
+
*
|
|
65
|
+
* List available apps.
|
|
66
|
+
*
|
|
67
|
+
* Iterates every item across all pages, fetching more as the returned iterable is consumed.
|
|
68
|
+
*
|
|
69
|
+
* GET /openmeter/app-catalog
|
|
70
|
+
*/
|
|
71
|
+
listCatalogAll(request, options) {
|
|
72
|
+
return paginatePages((req, opts) => listAppCatalog(this._client, req, opts), request ?? {}, options);
|
|
73
|
+
}
|
|
74
|
+
/**
|
|
75
|
+
* Get app catalog item by type
|
|
76
|
+
*
|
|
77
|
+
* Get an app catalog item by type.
|
|
78
|
+
*
|
|
79
|
+
* GET /openmeter/app-catalog/{appType}
|
|
80
|
+
*/
|
|
81
|
+
async getCatalogItem(request, options) {
|
|
82
|
+
return unwrap(await getAppCatalogItem(this._client, request, options));
|
|
83
|
+
}
|
|
84
|
+
/**
|
|
85
|
+
* Install app from the catalog
|
|
86
|
+
*
|
|
87
|
+
* Install an app from the catalog.
|
|
88
|
+
*
|
|
89
|
+
* POST /openmeter/app-catalog/install
|
|
90
|
+
*/
|
|
91
|
+
async install(request, options) {
|
|
92
|
+
return unwrap(await installApp(this._client, request, options));
|
|
93
|
+
}
|
|
42
94
|
}
|
package/dist/sdk/internal.d.ts
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import { type Client } from '../core.js';
|
|
2
2
|
import { type RequestOptions } from '../lib/types.js';
|
|
3
3
|
import type { CreateSubscriptionAddonRequest, CreateSubscriptionAddonResponse } from '../models/operations/subscriptions.js';
|
|
4
|
-
import type {
|
|
5
|
-
import type {
|
|
4
|
+
import type { ListAppsRequest, ListAppsResponse, GetAppRequest, GetAppResponse, UninstallAppRequest, UninstallAppResponse, UpdateAppRequest, UpdateAppResponse, ListAppCatalogRequest, ListAppCatalogResponse, GetAppCatalogItemRequest, GetAppCatalogItemResponse, InstallAppRequest, InstallAppResponse } from '../models/operations/apps.js';
|
|
5
|
+
import type { ListInvoicesRequest, ListInvoicesResponse, GetInvoiceRequest, GetInvoiceResponse, UpdateInvoiceRequest, UpdateInvoiceResponse, DeleteInvoiceRequest, DeleteInvoiceResponse, AdvanceInvoiceRequest, AdvanceInvoiceResponse, ApproveInvoiceRequest, ApproveInvoiceResponse, RetryInvoiceRequest, RetryInvoiceResponse, SnapshotQuantitiesInvoiceRequest, SnapshotQuantitiesInvoiceResponse } from '../models/operations/invoices.js';
|
|
6
|
+
import type { ListCurrenciesRequest, ListCurrenciesResponse, CreateCustomCurrencyRequest, CreateCustomCurrencyResponse, GetCustomCurrencyRequest, GetCustomCurrencyResponse, ListCostBasesRequest, ListCostBasesResponse, CreateCostBasisRequest, CreateCostBasisResponse } from '../models/operations/currencies.js';
|
|
6
7
|
import type { QueryGovernanceAccessRequest, QueryGovernanceAccessResponse } from '../models/operations/governance.js';
|
|
7
|
-
import type { CostBasis, Currency, Invoice } from '../models/types.js';
|
|
8
|
+
import type { App, AppCatalogItem, CostBasis, Currency, Invoice } from '../models/types.js';
|
|
8
9
|
/**
|
|
9
10
|
* Operations marked internal in the API definition. They are not part of
|
|
10
11
|
* the customer surface: they may require additional permissions, and they
|
|
@@ -15,6 +16,8 @@ export declare class Internal {
|
|
|
15
16
|
constructor(_client: Client);
|
|
16
17
|
private _subscriptions?;
|
|
17
18
|
get subscriptions(): InternalSubscriptions;
|
|
19
|
+
private _apps?;
|
|
20
|
+
get apps(): InternalApps;
|
|
18
21
|
private _invoices?;
|
|
19
22
|
get invoices(): InternalInvoices;
|
|
20
23
|
private _currencies?;
|
|
@@ -34,6 +37,86 @@ export declare class InternalSubscriptions {
|
|
|
34
37
|
*/
|
|
35
38
|
createAddon(request: CreateSubscriptionAddonRequest, options?: RequestOptions): Promise<CreateSubscriptionAddonResponse>;
|
|
36
39
|
}
|
|
40
|
+
export declare class InternalApps {
|
|
41
|
+
private readonly _client;
|
|
42
|
+
constructor(_client: Client);
|
|
43
|
+
/**
|
|
44
|
+
* List apps
|
|
45
|
+
*
|
|
46
|
+
* List installed apps.
|
|
47
|
+
*
|
|
48
|
+
* GET /openmeter/apps
|
|
49
|
+
*/
|
|
50
|
+
list(request?: ListAppsRequest, options?: RequestOptions): Promise<ListAppsResponse>;
|
|
51
|
+
/**
|
|
52
|
+
* List apps
|
|
53
|
+
*
|
|
54
|
+
* List installed apps.
|
|
55
|
+
*
|
|
56
|
+
* Iterates every item across all pages, fetching more as the returned iterable is consumed.
|
|
57
|
+
*
|
|
58
|
+
* GET /openmeter/apps
|
|
59
|
+
*/
|
|
60
|
+
listAll(request?: ListAppsRequest, options?: RequestOptions): AsyncIterable<App>;
|
|
61
|
+
/**
|
|
62
|
+
* Get app
|
|
63
|
+
*
|
|
64
|
+
* Get an installed app.
|
|
65
|
+
*
|
|
66
|
+
* GET /openmeter/apps/{appId}
|
|
67
|
+
*/
|
|
68
|
+
get(request: GetAppRequest, options?: RequestOptions): Promise<GetAppResponse>;
|
|
69
|
+
/**
|
|
70
|
+
* Uninstall app
|
|
71
|
+
*
|
|
72
|
+
* Uninstall an app by ID.
|
|
73
|
+
*
|
|
74
|
+
* DELETE /openmeter/apps/{appId}
|
|
75
|
+
*/
|
|
76
|
+
uninstall(request: UninstallAppRequest, options?: RequestOptions): Promise<UninstallAppResponse>;
|
|
77
|
+
/**
|
|
78
|
+
* Update app
|
|
79
|
+
*
|
|
80
|
+
* Update an installed app.
|
|
81
|
+
*
|
|
82
|
+
* PUT /openmeter/apps/{appId}
|
|
83
|
+
*/
|
|
84
|
+
update(request: UpdateAppRequest, options?: RequestOptions): Promise<UpdateAppResponse>;
|
|
85
|
+
/**
|
|
86
|
+
* List app catalog
|
|
87
|
+
*
|
|
88
|
+
* List available apps.
|
|
89
|
+
*
|
|
90
|
+
* GET /openmeter/app-catalog
|
|
91
|
+
*/
|
|
92
|
+
listCatalog(request?: ListAppCatalogRequest, options?: RequestOptions): Promise<ListAppCatalogResponse>;
|
|
93
|
+
/**
|
|
94
|
+
* List app catalog
|
|
95
|
+
*
|
|
96
|
+
* List available apps.
|
|
97
|
+
*
|
|
98
|
+
* Iterates every item across all pages, fetching more as the returned iterable is consumed.
|
|
99
|
+
*
|
|
100
|
+
* GET /openmeter/app-catalog
|
|
101
|
+
*/
|
|
102
|
+
listCatalogAll(request?: ListAppCatalogRequest, options?: RequestOptions): AsyncIterable<AppCatalogItem>;
|
|
103
|
+
/**
|
|
104
|
+
* Get app catalog item by type
|
|
105
|
+
*
|
|
106
|
+
* Get an app catalog item by type.
|
|
107
|
+
*
|
|
108
|
+
* GET /openmeter/app-catalog/{appType}
|
|
109
|
+
*/
|
|
110
|
+
getCatalogItem(request: GetAppCatalogItemRequest, options?: RequestOptions): Promise<GetAppCatalogItemResponse>;
|
|
111
|
+
/**
|
|
112
|
+
* Install app from the catalog
|
|
113
|
+
*
|
|
114
|
+
* Install an app from the catalog.
|
|
115
|
+
*
|
|
116
|
+
* POST /openmeter/app-catalog/install
|
|
117
|
+
*/
|
|
118
|
+
install(request: InstallAppRequest, options?: RequestOptions): Promise<InstallAppResponse>;
|
|
119
|
+
}
|
|
37
120
|
export declare class InternalInvoices {
|
|
38
121
|
private readonly _client;
|
|
39
122
|
constructor(_client: Client);
|
|
@@ -99,6 +182,63 @@ export declare class InternalInvoices {
|
|
|
99
182
|
* DELETE /openmeter/billing/invoices/{invoiceId}
|
|
100
183
|
*/
|
|
101
184
|
delete(request: DeleteInvoiceRequest, options?: RequestOptions): Promise<DeleteInvoiceResponse>;
|
|
185
|
+
/**
|
|
186
|
+
* Advance billing invoice's next status
|
|
187
|
+
*
|
|
188
|
+
* Advance a billing invoice.
|
|
189
|
+
*
|
|
190
|
+
* Advances the invoice to the next workflow state. The next state is determined by
|
|
191
|
+
* the invoice's current status and workflow configuration. Only invoices in draft
|
|
192
|
+
* or issued status can be advanced.
|
|
193
|
+
*
|
|
194
|
+
* POST /openmeter/billing/invoices/{invoiceId}/advance
|
|
195
|
+
*/
|
|
196
|
+
advance(request: AdvanceInvoiceRequest, options?: RequestOptions): Promise<AdvanceInvoiceResponse>;
|
|
197
|
+
/**
|
|
198
|
+
* Send the invoice to the customer
|
|
199
|
+
*
|
|
200
|
+
* Approve a billing invoice.
|
|
201
|
+
*
|
|
202
|
+
* This call instantly sends the invoice to the customer using the configured
|
|
203
|
+
* billing profile app.
|
|
204
|
+
*
|
|
205
|
+
* This call is valid in two invoice statuses:
|
|
206
|
+
*
|
|
207
|
+
* - draft: the invoice will be sent to the customer, the invoice state becomes
|
|
208
|
+
* issued
|
|
209
|
+
* - manual_approval_needed: the invoice will be sent to the customer, the invoice
|
|
210
|
+
* state becomes issued
|
|
211
|
+
*
|
|
212
|
+
* POST /openmeter/billing/invoices/{invoiceId}/approve
|
|
213
|
+
*/
|
|
214
|
+
approve(request: ApproveInvoiceRequest, options?: RequestOptions): Promise<ApproveInvoiceResponse>;
|
|
215
|
+
/**
|
|
216
|
+
* Retry advancing the invoice after a failed attempt
|
|
217
|
+
*
|
|
218
|
+
* Retry sending a billing invoice.
|
|
219
|
+
*
|
|
220
|
+
* Retry advancing the invoice after a failed attempt.
|
|
221
|
+
*
|
|
222
|
+
* The action can be called when the invoice's statusDetails' actions field contain
|
|
223
|
+
* the "retry" action.
|
|
224
|
+
*
|
|
225
|
+
* POST /openmeter/billing/invoices/{invoiceId}/retry
|
|
226
|
+
*/
|
|
227
|
+
retry(request: RetryInvoiceRequest, options?: RequestOptions): Promise<RetryInvoiceResponse>;
|
|
228
|
+
/**
|
|
229
|
+
* Snapshot quantities for usage based line items
|
|
230
|
+
*
|
|
231
|
+
* Snapshot quantities for usage-based line items.
|
|
232
|
+
*
|
|
233
|
+
* This call will snapshot the quantities for all usage based line items in the
|
|
234
|
+
* invoice.
|
|
235
|
+
*
|
|
236
|
+
* This call is only valid in draft.waiting_for_collection status, where the
|
|
237
|
+
* collection period can be skipped using this action.
|
|
238
|
+
*
|
|
239
|
+
* POST /openmeter/billing/invoices/{invoiceId}/snapshot-quantities
|
|
240
|
+
*/
|
|
241
|
+
snapshotQuantities(request: SnapshotQuantitiesInvoiceRequest, options?: RequestOptions): Promise<SnapshotQuantitiesInvoiceResponse>;
|
|
102
242
|
}
|
|
103
243
|
export declare class InternalCurrencies {
|
|
104
244
|
private readonly _client;
|
|
@@ -130,6 +270,14 @@ export declare class InternalCurrencies {
|
|
|
130
270
|
* POST /openmeter/currencies/custom
|
|
131
271
|
*/
|
|
132
272
|
createCustomCurrency(request: CreateCustomCurrencyRequest, options?: RequestOptions): Promise<CreateCustomCurrencyResponse>;
|
|
273
|
+
/**
|
|
274
|
+
* Get custom currency
|
|
275
|
+
*
|
|
276
|
+
* Get a custom currency.
|
|
277
|
+
*
|
|
278
|
+
* GET /openmeter/currencies/custom/{currencyId}
|
|
279
|
+
*/
|
|
280
|
+
getCustomCurrency(request: GetCustomCurrencyRequest, options?: RequestOptions): Promise<GetCustomCurrencyResponse>;
|
|
133
281
|
/**
|
|
134
282
|
* List cost bases
|
|
135
283
|
*
|
package/dist/sdk/internal.js
CHANGED
|
@@ -2,8 +2,9 @@
|
|
|
2
2
|
import { unwrap } from '../lib/types.js';
|
|
3
3
|
import { paginatePages } from '../lib/paginate.js';
|
|
4
4
|
import { createSubscriptionAddon } from '../funcs/subscriptions.js';
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
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';
|
|
7
8
|
import { queryGovernanceAccess } from '../funcs/governance.js';
|
|
8
9
|
/**
|
|
9
10
|
* Operations marked internal in the API definition. They are not part of
|
|
@@ -19,6 +20,10 @@ export class Internal {
|
|
|
19
20
|
get subscriptions() {
|
|
20
21
|
return (this._subscriptions ??= new InternalSubscriptions(this._client));
|
|
21
22
|
}
|
|
23
|
+
_apps;
|
|
24
|
+
get apps() {
|
|
25
|
+
return (this._apps ??= new InternalApps(this._client));
|
|
26
|
+
}
|
|
22
27
|
_invoices;
|
|
23
28
|
get invoices() {
|
|
24
29
|
return (this._invoices ??= new InternalInvoices(this._client));
|
|
@@ -48,6 +53,106 @@ export class InternalSubscriptions {
|
|
|
48
53
|
return unwrap(await createSubscriptionAddon(this._client, request, options));
|
|
49
54
|
}
|
|
50
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
|
+
}
|
|
51
156
|
export class InternalInvoices {
|
|
52
157
|
_client;
|
|
53
158
|
constructor(_client) {
|
|
@@ -125,6 +230,71 @@ export class InternalInvoices {
|
|
|
125
230
|
async delete(request, options) {
|
|
126
231
|
return unwrap(await deleteInvoice(this._client, request, options));
|
|
127
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
|
+
}
|
|
128
298
|
}
|
|
129
299
|
export class InternalCurrencies {
|
|
130
300
|
_client;
|
|
@@ -164,6 +334,16 @@ export class InternalCurrencies {
|
|
|
164
334
|
async createCustomCurrency(request, options) {
|
|
165
335
|
return unwrap(await createCustomCurrency(this._client, request, options));
|
|
166
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
|
+
}
|
|
167
347
|
/**
|
|
168
348
|
* List cost bases
|
|
169
349
|
*
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { type Client } from '../core.js';
|
|
2
|
+
import { type RequestOptions } from '../lib/types.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
|
+
export declare class Invoices {
|
|
5
|
+
private readonly _client;
|
|
6
|
+
constructor(_client: Client);
|
|
7
|
+
list(request?: ListInvoicesRequest, options?: RequestOptions): Promise<ListInvoicesResponse>;
|
|
8
|
+
get(request: GetInvoiceRequest, options?: RequestOptions): Promise<GetInvoiceResponse>;
|
|
9
|
+
update(request: UpdateInvoiceRequest, options?: RequestOptions): Promise<UpdateInvoiceResponse>;
|
|
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>;
|
|
15
|
+
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { unwrap } from '../lib/types.js';
|
|
2
|
+
import { listInvoices, getInvoice, updateInvoice, deleteInvoice, advanceInvoice, approveInvoice, retryInvoice, snapshotQuantitiesInvoice, } from '../funcs/invoices.js';
|
|
3
|
+
export class Invoices {
|
|
4
|
+
_client;
|
|
5
|
+
constructor(_client) {
|
|
6
|
+
this._client = _client;
|
|
7
|
+
}
|
|
8
|
+
async list(request, options) {
|
|
9
|
+
return unwrap(await listInvoices(this._client, request, options));
|
|
10
|
+
}
|
|
11
|
+
async get(request, options) {
|
|
12
|
+
return unwrap(await getInvoice(this._client, request, options));
|
|
13
|
+
}
|
|
14
|
+
async update(request, options) {
|
|
15
|
+
return unwrap(await updateInvoice(this._client, request, options));
|
|
16
|
+
}
|
|
17
|
+
async delete(request, options) {
|
|
18
|
+
return unwrap(await deleteInvoice(this._client, request, options));
|
|
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
|
+
}
|
|
32
|
+
}
|
package/dist/sdk/sdk.d.ts
CHANGED
|
@@ -4,7 +4,6 @@ import { Meters } from './meters.js';
|
|
|
4
4
|
import { Customers } from './customers.js';
|
|
5
5
|
import { Entitlements } from './entitlements.js';
|
|
6
6
|
import { Subscriptions } from './subscriptions.js';
|
|
7
|
-
import { Apps } from './apps.js';
|
|
8
7
|
import { Billing } from './billing.js';
|
|
9
8
|
import { Tax } from './tax.js';
|
|
10
9
|
import { Features } from './features.js';
|
|
@@ -25,8 +24,6 @@ export declare class OpenMeter extends Client {
|
|
|
25
24
|
get entitlements(): Entitlements;
|
|
26
25
|
private _subscriptions?;
|
|
27
26
|
get subscriptions(): Subscriptions;
|
|
28
|
-
private _apps?;
|
|
29
|
-
get apps(): Apps;
|
|
30
27
|
private _billing?;
|
|
31
28
|
get billing(): Billing;
|
|
32
29
|
private _tax?;
|
package/dist/sdk/sdk.js
CHANGED
|
@@ -5,7 +5,6 @@ import { Meters } from './meters.js';
|
|
|
5
5
|
import { Customers } from './customers.js';
|
|
6
6
|
import { Entitlements } from './entitlements.js';
|
|
7
7
|
import { Subscriptions } from './subscriptions.js';
|
|
8
|
-
import { Apps } from './apps.js';
|
|
9
8
|
import { Billing } from './billing.js';
|
|
10
9
|
import { Tax } from './tax.js';
|
|
11
10
|
import { Features } from './features.js';
|
|
@@ -36,10 +35,6 @@ export class OpenMeter extends Client {
|
|
|
36
35
|
get subscriptions() {
|
|
37
36
|
return (this._subscriptions ??= new Subscriptions(this));
|
|
38
37
|
}
|
|
39
|
-
_apps;
|
|
40
|
-
get apps() {
|
|
41
|
-
return (this._apps ??= new Apps(this));
|
|
42
|
-
}
|
|
43
38
|
_billing;
|
|
44
39
|
get billing() {
|
|
45
40
|
return (this._billing ??= new Billing(this));
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@openmeter/client",
|
|
3
|
-
"version": "1.0.0-beta.
|
|
3
|
+
"version": "1.0.0-beta.232",
|
|
4
4
|
"description": "Official TypeScript SDK for the OpenMeter API — usage metering and billing",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"openmeter",
|
|
@@ -29,8 +29,8 @@
|
|
|
29
29
|
"zod": "^4.4.3"
|
|
30
30
|
},
|
|
31
31
|
"devDependencies": {
|
|
32
|
-
"@types/node": "
|
|
33
|
-
"typescript": "
|
|
32
|
+
"@types/node": "26.1.1",
|
|
33
|
+
"typescript": "7.0.2"
|
|
34
34
|
},
|
|
35
35
|
"files": [
|
|
36
36
|
"dist",
|