@openmeter/client 1.0.0-beta.231 → 1.0.0-beta.233
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 +95 -54
- 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 +170 -4
- package/dist/funcs/billing.js +40 -8
- package/dist/funcs/charges.d.ts +14 -0
- package/dist/funcs/charges.js +42 -0
- 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/{governance.d.ts → entitlementAccess.d.ts} +4 -4
- package/dist/funcs/{governance.js → entitlementAccess.js} +10 -10
- package/dist/funcs/entitlements.d.ts +9 -1
- package/dist/funcs/entitlements.js +61 -3
- package/dist/funcs/events.js +3 -0
- package/dist/funcs/features.js +48 -9
- package/dist/funcs/index.d.ts +2 -1
- package/dist/funcs/index.js +2 -1
- 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 +71 -18
- package/dist/funcs/plans.js +59 -11
- package/dist/funcs/subscriptions.d.ts +60 -1
- package/dist/funcs/subscriptions.js +291 -17
- package/dist/funcs/tax.js +34 -7
- package/dist/index.d.ts +3 -2
- 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 +88 -10
- package/dist/models/operations/apps.d.ts +41 -1
- package/dist/models/operations/billing.d.ts +19 -1
- package/dist/models/operations/charges.d.ts +54 -0
- package/dist/models/operations/currencies.d.ts +10 -0
- package/dist/models/operations/customers.d.ts +21 -6
- package/dist/models/operations/entitlementAccess.d.ts +9 -0
- package/dist/models/operations/entitlementAccess.js +2 -0
- package/dist/models/operations/entitlements.d.ts +18 -1
- package/dist/models/operations/invoices.d.ts +16 -0
- package/dist/models/operations/planAddons.d.ts +14 -1
- package/dist/models/operations/subscriptions.d.ts +27 -3
- package/dist/models/schemas.d.ts +52291 -22631
- package/dist/models/schemas.js +3981 -1823
- package/dist/models/types.d.ts +4481 -2018
- package/dist/sdk/apps.d.ts +1 -20
- package/dist/sdk/apps.js +1 -24
- package/dist/sdk/customers.d.ts +2 -56
- package/dist/sdk/customers.js +1 -67
- package/dist/sdk/entitlements.d.ts +9 -1
- package/dist/sdk/entitlements.js +11 -1
- package/dist/sdk/internal.d.ts +324 -15
- package/dist/sdk/internal.js +402 -17
- package/dist/sdk/invoices.d.ts +127 -0
- package/dist/sdk/invoices.js +147 -0
- package/dist/sdk/planAddons.d.ts +1 -20
- package/dist/sdk/planAddons.js +1 -24
- package/dist/sdk/subscriptions.d.ts +20 -1
- package/dist/sdk/subscriptions.js +24 -1
- package/package.json +3 -3
- package/dist/models/operations/governance.d.ts +0 -9
- /package/dist/models/operations/{governance.js → charges.js} +0 -0
package/dist/sdk/internal.js
CHANGED
|
@@ -1,10 +1,14 @@
|
|
|
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 {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
4
|
+
import { voidCreditGrant, listCustomerCharges, createCustomerCharges, } from '../funcs/customers.js';
|
|
5
|
+
import { unscheduleSubscription, restoreSubscription, migrateSubscription, updateSubscriptionAddon, } from '../funcs/subscriptions.js';
|
|
6
|
+
import { listApps, uninstallApp, updateApp, listAppCatalog, getAppCatalogItem, installApp, } from '../funcs/apps.js';
|
|
7
|
+
import { listInvoices, getInvoice, updateInvoice, deleteInvoice, advanceInvoice, approveInvoice, retryInvoice, snapshotQuantitiesInvoice, } from '../funcs/invoices.js';
|
|
8
|
+
import { listCharges } from '../funcs/charges.js';
|
|
9
|
+
import { listCurrencies, createCustomCurrency, getCustomCurrency, listCostBases, createCostBasis, } from '../funcs/currencies.js';
|
|
10
|
+
import { listPlanAddons } from '../funcs/planAddons.js';
|
|
11
|
+
import { queryEntitlementAccess } from '../funcs/entitlementAccess.js';
|
|
8
12
|
/**
|
|
9
13
|
* Operations marked internal in the API definition. They are not part of
|
|
10
14
|
* the customer surface: they may require additional permissions, and they
|
|
@@ -15,21 +19,129 @@ export class Internal {
|
|
|
15
19
|
constructor(_client) {
|
|
16
20
|
this._client = _client;
|
|
17
21
|
}
|
|
22
|
+
_customers;
|
|
23
|
+
get customers() {
|
|
24
|
+
return (this._customers ??= new InternalCustomers(this._client));
|
|
25
|
+
}
|
|
18
26
|
_subscriptions;
|
|
19
27
|
get subscriptions() {
|
|
20
28
|
return (this._subscriptions ??= new InternalSubscriptions(this._client));
|
|
21
29
|
}
|
|
30
|
+
_apps;
|
|
31
|
+
get apps() {
|
|
32
|
+
return (this._apps ??= new InternalApps(this._client));
|
|
33
|
+
}
|
|
22
34
|
_invoices;
|
|
23
35
|
get invoices() {
|
|
24
36
|
return (this._invoices ??= new InternalInvoices(this._client));
|
|
25
37
|
}
|
|
38
|
+
_charges;
|
|
39
|
+
get charges() {
|
|
40
|
+
return (this._charges ??= new InternalCharges(this._client));
|
|
41
|
+
}
|
|
26
42
|
_currencies;
|
|
27
43
|
get currencies() {
|
|
28
44
|
return (this._currencies ??= new InternalCurrencies(this._client));
|
|
29
45
|
}
|
|
30
|
-
|
|
31
|
-
get
|
|
32
|
-
return (this.
|
|
46
|
+
_planAddons;
|
|
47
|
+
get planAddons() {
|
|
48
|
+
return (this._planAddons ??= new InternalPlanAddons(this._client));
|
|
49
|
+
}
|
|
50
|
+
_entitlementAccess;
|
|
51
|
+
get entitlementAccess() {
|
|
52
|
+
return (this._entitlementAccess ??= new InternalEntitlementAccess(this._client));
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
export class InternalCustomers {
|
|
56
|
+
_client;
|
|
57
|
+
constructor(_client) {
|
|
58
|
+
this._client = _client;
|
|
59
|
+
}
|
|
60
|
+
_credits;
|
|
61
|
+
get credits() {
|
|
62
|
+
return (this._credits ??= new InternalCustomersCredits(this._client));
|
|
63
|
+
}
|
|
64
|
+
_charges;
|
|
65
|
+
get charges() {
|
|
66
|
+
return (this._charges ??= new InternalCustomersCharges(this._client));
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
export class InternalCustomersCredits {
|
|
70
|
+
_client;
|
|
71
|
+
constructor(_client) {
|
|
72
|
+
this._client = _client;
|
|
73
|
+
}
|
|
74
|
+
_grants;
|
|
75
|
+
get grants() {
|
|
76
|
+
return (this._grants ??= new InternalCustomersCreditsGrants(this._client));
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
export class InternalCustomersCreditsGrants {
|
|
80
|
+
_client;
|
|
81
|
+
constructor(_client) {
|
|
82
|
+
this._client = _client;
|
|
83
|
+
}
|
|
84
|
+
/**
|
|
85
|
+
* Void credit grant
|
|
86
|
+
*
|
|
87
|
+
* Void a credit grant, forfeiting the remaining unused balance.
|
|
88
|
+
*
|
|
89
|
+
* Voiding is a forward-looking, irreversible operation. Credits already consumed
|
|
90
|
+
* by usage remain unaffected — only the remaining balance is forfeited. The grant
|
|
91
|
+
* reads as `voided` status afterwards. Payment state is not adjusted when
|
|
92
|
+
* `payment_adjustment` is `none`, so invoice-backed or externally collected
|
|
93
|
+
* payments may still collect the original amount. Only `active` grants can be
|
|
94
|
+
* voided; voiding a pending, expired, or fully consumed grant returns a conflict.
|
|
95
|
+
* Retrying a successful void is an idempotent success.
|
|
96
|
+
*
|
|
97
|
+
* POST /openmeter/customers/{customerId}/credits/grants/{creditGrantId}/void
|
|
98
|
+
*/
|
|
99
|
+
async void(request, options) {
|
|
100
|
+
return unwrap(await voidCreditGrant(this._client, request, options));
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
export class InternalCustomersCharges {
|
|
104
|
+
_client;
|
|
105
|
+
constructor(_client) {
|
|
106
|
+
this._client = _client;
|
|
107
|
+
}
|
|
108
|
+
/**
|
|
109
|
+
* List customer charges
|
|
110
|
+
*
|
|
111
|
+
* List customer charges.
|
|
112
|
+
*
|
|
113
|
+
* Returns the customer's charges that are represented as either flat fee or
|
|
114
|
+
* usage-based charges.
|
|
115
|
+
*
|
|
116
|
+
* GET /openmeter/customers/{customerId}/charges
|
|
117
|
+
*/
|
|
118
|
+
async list(request, options) {
|
|
119
|
+
return unwrap(await listCustomerCharges(this._client, request, options));
|
|
120
|
+
}
|
|
121
|
+
/**
|
|
122
|
+
* List customer charges
|
|
123
|
+
*
|
|
124
|
+
* List customer charges.
|
|
125
|
+
*
|
|
126
|
+
* Returns the customer's charges that are represented as either flat fee or
|
|
127
|
+
* usage-based charges.
|
|
128
|
+
*
|
|
129
|
+
* Iterates every item across all pages, fetching more as the returned iterable is consumed.
|
|
130
|
+
*
|
|
131
|
+
* GET /openmeter/customers/{customerId}/charges
|
|
132
|
+
*/
|
|
133
|
+
listAll(request, options) {
|
|
134
|
+
return paginatePages((req, opts) => listCustomerCharges(this._client, req, opts), request, options);
|
|
135
|
+
}
|
|
136
|
+
/**
|
|
137
|
+
* Create customer charge
|
|
138
|
+
*
|
|
139
|
+
* Create customer charge.
|
|
140
|
+
*
|
|
141
|
+
* POST /openmeter/customers/{customerId}/charges
|
|
142
|
+
*/
|
|
143
|
+
async create(request, options) {
|
|
144
|
+
return unwrap(await createCustomerCharges(this._client, request, options));
|
|
33
145
|
}
|
|
34
146
|
}
|
|
35
147
|
export class InternalSubscriptions {
|
|
@@ -38,14 +150,150 @@ export class InternalSubscriptions {
|
|
|
38
150
|
this._client = _client;
|
|
39
151
|
}
|
|
40
152
|
/**
|
|
41
|
-
*
|
|
153
|
+
* Unschedule subscription
|
|
154
|
+
*
|
|
155
|
+
* Deletes a scheduled subscription that has not yet become active, removing it and
|
|
156
|
+
* resolving any scheduling conflict it was holding. This is distinct from
|
|
157
|
+
* canceling: cancel ends a running subscription, whereas unscheduling removes a
|
|
158
|
+
* not-yet-active one. Only scheduled subscriptions can be unscheduled;
|
|
159
|
+
* unscheduling an active or already-started subscription is rejected.
|
|
160
|
+
*
|
|
161
|
+
* POST /openmeter/subscriptions/{subscriptionId}/unschedule
|
|
162
|
+
*/
|
|
163
|
+
async unschedule(request, options) {
|
|
164
|
+
return unwrap(await unscheduleSubscription(this._client, request, options));
|
|
165
|
+
}
|
|
166
|
+
/**
|
|
167
|
+
* Restore subscription
|
|
168
|
+
*
|
|
169
|
+
* Restores the subscription by deleting any later-scheduled successor
|
|
170
|
+
* subscriptions and continuing this one indefinitely. This is the inverse of a
|
|
171
|
+
* future-dated change, which schedules a successor. Restore is not available when
|
|
172
|
+
* multi-subscription is enabled.
|
|
173
|
+
*
|
|
174
|
+
* POST /openmeter/subscriptions/{subscriptionId}/restore
|
|
175
|
+
*/
|
|
176
|
+
async restore(request, options) {
|
|
177
|
+
return unwrap(await restoreSubscription(this._client, request, options));
|
|
178
|
+
}
|
|
179
|
+
/**
|
|
180
|
+
* Migrate subscription
|
|
181
|
+
*
|
|
182
|
+
* Migrates to a later version of the current plan. With starting_phase omitted and
|
|
183
|
+
* billing_anchor omitted or unchanged, migration amends the subscription in place:
|
|
184
|
+
* unchanged items retain their service periods and both response entries have the
|
|
185
|
+
* same ID. Existing addons must remain compatible with the target plan.
|
|
186
|
+
* Incompatible phase timelines or billing settings return an error. Providing
|
|
187
|
+
* starting_phase or a different billing_anchor explicitly requests replacement,
|
|
188
|
+
* which resets the phase timeline, may produce billing adjustments, and does not
|
|
189
|
+
* transfer addons. Custom subscriptions cannot be migrated.
|
|
190
|
+
*
|
|
191
|
+
* POST /openmeter/subscriptions/{subscriptionId}/migrate
|
|
192
|
+
*/
|
|
193
|
+
async migrate(request, options) {
|
|
194
|
+
return unwrap(await migrateSubscription(this._client, request, options));
|
|
195
|
+
}
|
|
196
|
+
/**
|
|
197
|
+
* Update subscription addon
|
|
198
|
+
*
|
|
199
|
+
* Update a subscription add-on. Only the quantity is mutable; the timing controls
|
|
200
|
+
* when the new quantity takes effect. A new entry is appended to the add-on's
|
|
201
|
+
* timeline.
|
|
202
|
+
*
|
|
203
|
+
* PATCH /openmeter/subscriptions/{subscriptionId}/addons/{subscriptionAddonId}
|
|
204
|
+
*/
|
|
205
|
+
async updateAddon(request, options) {
|
|
206
|
+
return unwrap(await updateSubscriptionAddon(this._client, request, options));
|
|
207
|
+
}
|
|
208
|
+
}
|
|
209
|
+
export class InternalApps {
|
|
210
|
+
_client;
|
|
211
|
+
constructor(_client) {
|
|
212
|
+
this._client = _client;
|
|
213
|
+
}
|
|
214
|
+
/**
|
|
215
|
+
* List apps
|
|
216
|
+
*
|
|
217
|
+
* List installed apps.
|
|
218
|
+
*
|
|
219
|
+
* GET /openmeter/apps
|
|
220
|
+
*/
|
|
221
|
+
async list(request, options) {
|
|
222
|
+
return unwrap(await listApps(this._client, request, options));
|
|
223
|
+
}
|
|
224
|
+
/**
|
|
225
|
+
* List apps
|
|
226
|
+
*
|
|
227
|
+
* List installed apps.
|
|
228
|
+
*
|
|
229
|
+
* Iterates every item across all pages, fetching more as the returned iterable is consumed.
|
|
230
|
+
*
|
|
231
|
+
* GET /openmeter/apps
|
|
232
|
+
*/
|
|
233
|
+
listAll(request, options) {
|
|
234
|
+
return paginatePages((req, opts) => listApps(this._client, req, opts), request ?? {}, options);
|
|
235
|
+
}
|
|
236
|
+
/**
|
|
237
|
+
* Uninstall app
|
|
238
|
+
*
|
|
239
|
+
* Uninstall an app by ID.
|
|
240
|
+
*
|
|
241
|
+
* DELETE /openmeter/apps/{appId}
|
|
242
|
+
*/
|
|
243
|
+
async uninstall(request, options) {
|
|
244
|
+
return unwrap(await uninstallApp(this._client, request, options));
|
|
245
|
+
}
|
|
246
|
+
/**
|
|
247
|
+
* Update app
|
|
42
248
|
*
|
|
43
|
-
*
|
|
249
|
+
* Update an installed app.
|
|
44
250
|
*
|
|
45
|
-
*
|
|
251
|
+
* PUT /openmeter/apps/{appId}
|
|
46
252
|
*/
|
|
47
|
-
async
|
|
48
|
-
return unwrap(await
|
|
253
|
+
async update(request, options) {
|
|
254
|
+
return unwrap(await updateApp(this._client, request, options));
|
|
255
|
+
}
|
|
256
|
+
/**
|
|
257
|
+
* List app catalog
|
|
258
|
+
*
|
|
259
|
+
* List available apps.
|
|
260
|
+
*
|
|
261
|
+
* GET /openmeter/app-catalog
|
|
262
|
+
*/
|
|
263
|
+
async listCatalog(request, options) {
|
|
264
|
+
return unwrap(await listAppCatalog(this._client, request, options));
|
|
265
|
+
}
|
|
266
|
+
/**
|
|
267
|
+
* List app catalog
|
|
268
|
+
*
|
|
269
|
+
* List available apps.
|
|
270
|
+
*
|
|
271
|
+
* Iterates every item across all pages, fetching more as the returned iterable is consumed.
|
|
272
|
+
*
|
|
273
|
+
* GET /openmeter/app-catalog
|
|
274
|
+
*/
|
|
275
|
+
listCatalogAll(request, options) {
|
|
276
|
+
return paginatePages((req, opts) => listAppCatalog(this._client, req, opts), request ?? {}, options);
|
|
277
|
+
}
|
|
278
|
+
/**
|
|
279
|
+
* Get app catalog item by type
|
|
280
|
+
*
|
|
281
|
+
* Get an app catalog item by type.
|
|
282
|
+
*
|
|
283
|
+
* GET /openmeter/app-catalog/{appType}
|
|
284
|
+
*/
|
|
285
|
+
async getCatalogItem(request, options) {
|
|
286
|
+
return unwrap(await getAppCatalogItem(this._client, request, options));
|
|
287
|
+
}
|
|
288
|
+
/**
|
|
289
|
+
* Install app from the catalog
|
|
290
|
+
*
|
|
291
|
+
* Install an app from the catalog.
|
|
292
|
+
*
|
|
293
|
+
* POST /openmeter/app-catalog/install
|
|
294
|
+
*/
|
|
295
|
+
async install(request, options) {
|
|
296
|
+
return unwrap(await installApp(this._client, request, options));
|
|
49
297
|
}
|
|
50
298
|
}
|
|
51
299
|
export class InternalInvoices {
|
|
@@ -125,6 +373,105 @@ export class InternalInvoices {
|
|
|
125
373
|
async delete(request, options) {
|
|
126
374
|
return unwrap(await deleteInvoice(this._client, request, options));
|
|
127
375
|
}
|
|
376
|
+
/**
|
|
377
|
+
* Advance billing invoice's next status
|
|
378
|
+
*
|
|
379
|
+
* Advance a billing invoice.
|
|
380
|
+
*
|
|
381
|
+
* Advances the invoice to the next workflow state. The next state is determined by
|
|
382
|
+
* the invoice's current status and workflow configuration. Only invoices in draft
|
|
383
|
+
* or issued status can be advanced.
|
|
384
|
+
*
|
|
385
|
+
* POST /openmeter/billing/invoices/{invoiceId}/advance
|
|
386
|
+
*/
|
|
387
|
+
async advance(request, options) {
|
|
388
|
+
return unwrap(await advanceInvoice(this._client, request, options));
|
|
389
|
+
}
|
|
390
|
+
/**
|
|
391
|
+
* Send the invoice to the customer
|
|
392
|
+
*
|
|
393
|
+
* Approve a billing invoice.
|
|
394
|
+
*
|
|
395
|
+
* This call instantly sends the invoice to the customer using the configured
|
|
396
|
+
* billing profile app.
|
|
397
|
+
*
|
|
398
|
+
* This call is valid in two invoice statuses:
|
|
399
|
+
*
|
|
400
|
+
* - draft: the invoice will be sent to the customer, the invoice state becomes
|
|
401
|
+
* issued
|
|
402
|
+
* - manual_approval_needed: the invoice will be sent to the customer, the invoice
|
|
403
|
+
* state becomes issued
|
|
404
|
+
*
|
|
405
|
+
* POST /openmeter/billing/invoices/{invoiceId}/approve
|
|
406
|
+
*/
|
|
407
|
+
async approve(request, options) {
|
|
408
|
+
return unwrap(await approveInvoice(this._client, request, options));
|
|
409
|
+
}
|
|
410
|
+
/**
|
|
411
|
+
* Retry advancing the invoice after a failed attempt
|
|
412
|
+
*
|
|
413
|
+
* Retry sending a billing invoice.
|
|
414
|
+
*
|
|
415
|
+
* Retry advancing the invoice after a failed attempt.
|
|
416
|
+
*
|
|
417
|
+
* The action can be called when the invoice's statusDetails' actions field contain
|
|
418
|
+
* the "retry" action.
|
|
419
|
+
*
|
|
420
|
+
* POST /openmeter/billing/invoices/{invoiceId}/retry
|
|
421
|
+
*/
|
|
422
|
+
async retry(request, options) {
|
|
423
|
+
return unwrap(await retryInvoice(this._client, request, options));
|
|
424
|
+
}
|
|
425
|
+
/**
|
|
426
|
+
* Snapshot quantities for usage based line items
|
|
427
|
+
*
|
|
428
|
+
* Snapshot quantities for usage-based line items.
|
|
429
|
+
*
|
|
430
|
+
* This call will snapshot the quantities for all usage based line items in the
|
|
431
|
+
* invoice.
|
|
432
|
+
*
|
|
433
|
+
* This call is only valid in draft.waiting_for_collection status, where the
|
|
434
|
+
* collection period can be skipped using this action.
|
|
435
|
+
*
|
|
436
|
+
* POST /openmeter/billing/invoices/{invoiceId}/snapshot-quantities
|
|
437
|
+
*/
|
|
438
|
+
async snapshotQuantities(request, options) {
|
|
439
|
+
return unwrap(await snapshotQuantitiesInvoice(this._client, request, options));
|
|
440
|
+
}
|
|
441
|
+
}
|
|
442
|
+
export class InternalCharges {
|
|
443
|
+
_client;
|
|
444
|
+
constructor(_client) {
|
|
445
|
+
this._client = _client;
|
|
446
|
+
}
|
|
447
|
+
/**
|
|
448
|
+
* List charges
|
|
449
|
+
*
|
|
450
|
+
* List charges.
|
|
451
|
+
*
|
|
452
|
+
* Returns the charges of every customer that are represented as either flat fee or
|
|
453
|
+
* usage-based charges.
|
|
454
|
+
*
|
|
455
|
+
* GET /openmeter/charges
|
|
456
|
+
*/
|
|
457
|
+
async list(request, options) {
|
|
458
|
+
return unwrap(await listCharges(this._client, request, options));
|
|
459
|
+
}
|
|
460
|
+
/**
|
|
461
|
+
* List charges
|
|
462
|
+
*
|
|
463
|
+
* List charges.
|
|
464
|
+
*
|
|
465
|
+
* Returns the charges of every customer that are represented as either flat fee or
|
|
466
|
+
* usage-based charges.
|
|
467
|
+
*
|
|
468
|
+
* Iterates every item across all pages, fetching more as the returned iterable is consumed.
|
|
469
|
+
*
|
|
470
|
+
* GET /openmeter/charges
|
|
471
|
+
*/
|
|
472
|
+
listAll(request, options) {
|
|
473
|
+
return paginatePages((req, opts) => listCharges(this._client, req, opts), request ?? {}, options);
|
|
474
|
+
}
|
|
128
475
|
}
|
|
129
476
|
export class InternalCurrencies {
|
|
130
477
|
_client;
|
|
@@ -164,6 +511,16 @@ export class InternalCurrencies {
|
|
|
164
511
|
async createCustomCurrency(request, options) {
|
|
165
512
|
return unwrap(await createCustomCurrency(this._client, request, options));
|
|
166
513
|
}
|
|
514
|
+
/**
|
|
515
|
+
* Get custom currency
|
|
516
|
+
*
|
|
517
|
+
* Get a custom currency.
|
|
518
|
+
*
|
|
519
|
+
* GET /openmeter/currencies/custom/{currencyId}
|
|
520
|
+
*/
|
|
521
|
+
async getCustomCurrency(request, options) {
|
|
522
|
+
return unwrap(await getCustomCurrency(this._client, request, options));
|
|
523
|
+
}
|
|
167
524
|
/**
|
|
168
525
|
* List cost bases
|
|
169
526
|
*
|
|
@@ -199,13 +556,41 @@ export class InternalCurrencies {
|
|
|
199
556
|
return unwrap(await createCostBasis(this._client, request, options));
|
|
200
557
|
}
|
|
201
558
|
}
|
|
202
|
-
export class
|
|
559
|
+
export class InternalPlanAddons {
|
|
560
|
+
_client;
|
|
561
|
+
constructor(_client) {
|
|
562
|
+
this._client = _client;
|
|
563
|
+
}
|
|
564
|
+
/**
|
|
565
|
+
* List add-ons for plan
|
|
566
|
+
*
|
|
567
|
+
* List add-ons associated with a plan.
|
|
568
|
+
*
|
|
569
|
+
* GET /openmeter/plans/{planId}/addons
|
|
570
|
+
*/
|
|
571
|
+
async list(request, options) {
|
|
572
|
+
return unwrap(await listPlanAddons(this._client, request, options));
|
|
573
|
+
}
|
|
574
|
+
/**
|
|
575
|
+
* List add-ons for plan
|
|
576
|
+
*
|
|
577
|
+
* List add-ons associated with a plan.
|
|
578
|
+
*
|
|
579
|
+
* Iterates every item across all pages, fetching more as the returned iterable is consumed.
|
|
580
|
+
*
|
|
581
|
+
* GET /openmeter/plans/{planId}/addons
|
|
582
|
+
*/
|
|
583
|
+
listAll(request, options) {
|
|
584
|
+
return paginatePages((req, opts) => listPlanAddons(this._client, req, opts), request, options);
|
|
585
|
+
}
|
|
586
|
+
}
|
|
587
|
+
export class InternalEntitlementAccess {
|
|
203
588
|
_client;
|
|
204
589
|
constructor(_client) {
|
|
205
590
|
this._client = _client;
|
|
206
591
|
}
|
|
207
592
|
/**
|
|
208
|
-
* Query
|
|
593
|
+
* Query entitlement access
|
|
209
594
|
*
|
|
210
595
|
* Query feature access for a list of customers.
|
|
211
596
|
*
|
|
@@ -216,9 +601,9 @@ export class InternalGovernance {
|
|
|
216
601
|
* _Designed to be called on a fixed refresh interval and the query response is
|
|
217
602
|
* intended to be cached._
|
|
218
603
|
*
|
|
219
|
-
* POST /openmeter/
|
|
604
|
+
* POST /openmeter/entitlement-access/query
|
|
220
605
|
*/
|
|
221
|
-
async
|
|
222
|
-
return unwrap(await
|
|
606
|
+
async query(request, options) {
|
|
607
|
+
return unwrap(await queryEntitlementAccess(this._client, request, options));
|
|
223
608
|
}
|
|
224
609
|
}
|
|
@@ -0,0 +1,127 @@
|
|
|
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
|
+
import type { Invoice } from '../models/types.js';
|
|
5
|
+
export declare class Invoices {
|
|
6
|
+
private readonly _client;
|
|
7
|
+
constructor(_client: Client);
|
|
8
|
+
/**
|
|
9
|
+
* List billing invoices
|
|
10
|
+
*
|
|
11
|
+
* List billing invoices.
|
|
12
|
+
*
|
|
13
|
+
* Returns a page of invoices. Gathering invoices are never included. Use `filter`
|
|
14
|
+
* to narrow by status, customer, dates, or service period start. Use `sort` to
|
|
15
|
+
* control ordering.
|
|
16
|
+
*
|
|
17
|
+
* GET /openmeter/billing/invoices
|
|
18
|
+
*/
|
|
19
|
+
list(request?: ListInvoicesRequest, options?: RequestOptions): Promise<ListInvoicesResponse>;
|
|
20
|
+
/**
|
|
21
|
+
* List billing invoices
|
|
22
|
+
*
|
|
23
|
+
* List billing invoices.
|
|
24
|
+
*
|
|
25
|
+
* Returns a page of invoices. Gathering invoices are never included. Use `filter`
|
|
26
|
+
* to narrow by status, customer, dates, or service period start. Use `sort` to
|
|
27
|
+
* control ordering.
|
|
28
|
+
*
|
|
29
|
+
* Iterates every item across all pages, fetching more as the returned iterable is consumed.
|
|
30
|
+
*
|
|
31
|
+
* GET /openmeter/billing/invoices
|
|
32
|
+
*/
|
|
33
|
+
listAll(request?: ListInvoicesRequest, options?: RequestOptions): AsyncIterable<Invoice>;
|
|
34
|
+
/**
|
|
35
|
+
* Get a billing invoice
|
|
36
|
+
*
|
|
37
|
+
* Get a billing invoice by ID.
|
|
38
|
+
*
|
|
39
|
+
* Returns the full invoice resource including line items, status details, totals,
|
|
40
|
+
* and workflow configuration snapshot.
|
|
41
|
+
*
|
|
42
|
+
* GET /openmeter/billing/invoices/{invoiceId}
|
|
43
|
+
*/
|
|
44
|
+
get(request: GetInvoiceRequest, options?: RequestOptions): Promise<GetInvoiceResponse>;
|
|
45
|
+
/**
|
|
46
|
+
* Update a billing invoice
|
|
47
|
+
*
|
|
48
|
+
* Update a billing invoice.
|
|
49
|
+
*
|
|
50
|
+
* Only the mutable fields of the invoice can be edited: description, labels,
|
|
51
|
+
* supplier, customer, workflow settings, and top-level lines. Top-level lines are
|
|
52
|
+
* matched by `id`; lines without an `id` are created, and existing lines omitted
|
|
53
|
+
* from `lines` are deleted. Detailed (child) lines are always computed and cannot
|
|
54
|
+
* be edited directly. Only invoices in draft status can be updated.
|
|
55
|
+
*
|
|
56
|
+
* PUT /openmeter/billing/invoices/{invoiceId}
|
|
57
|
+
*/
|
|
58
|
+
update(request: UpdateInvoiceRequest, options?: RequestOptions): Promise<UpdateInvoiceResponse>;
|
|
59
|
+
/**
|
|
60
|
+
* Delete a billing invoice
|
|
61
|
+
*
|
|
62
|
+
* Delete a billing invoice.
|
|
63
|
+
*
|
|
64
|
+
* Only standard invoices in draft status can be deleted. Deleting an invoice will
|
|
65
|
+
* also delete all associated line items and workflow configuration.
|
|
66
|
+
*
|
|
67
|
+
* DELETE /openmeter/billing/invoices/{invoiceId}
|
|
68
|
+
*/
|
|
69
|
+
delete(request: DeleteInvoiceRequest, options?: RequestOptions): Promise<DeleteInvoiceResponse>;
|
|
70
|
+
/**
|
|
71
|
+
* Advance billing invoice's next status
|
|
72
|
+
*
|
|
73
|
+
* Advance a billing invoice.
|
|
74
|
+
*
|
|
75
|
+
* Advances the invoice to the next workflow state. The next state is determined by
|
|
76
|
+
* the invoice's current status and workflow configuration. Only invoices in draft
|
|
77
|
+
* or issued status can be advanced.
|
|
78
|
+
*
|
|
79
|
+
* POST /openmeter/billing/invoices/{invoiceId}/advance
|
|
80
|
+
*/
|
|
81
|
+
advance(request: AdvanceInvoiceRequest, options?: RequestOptions): Promise<AdvanceInvoiceResponse>;
|
|
82
|
+
/**
|
|
83
|
+
* Send the invoice to the customer
|
|
84
|
+
*
|
|
85
|
+
* Approve a billing invoice.
|
|
86
|
+
*
|
|
87
|
+
* This call instantly sends the invoice to the customer using the configured
|
|
88
|
+
* billing profile app.
|
|
89
|
+
*
|
|
90
|
+
* This call is valid in two invoice statuses:
|
|
91
|
+
*
|
|
92
|
+
* - draft: the invoice will be sent to the customer, the invoice state becomes
|
|
93
|
+
* issued
|
|
94
|
+
* - manual_approval_needed: the invoice will be sent to the customer, the invoice
|
|
95
|
+
* state becomes issued
|
|
96
|
+
*
|
|
97
|
+
* POST /openmeter/billing/invoices/{invoiceId}/approve
|
|
98
|
+
*/
|
|
99
|
+
approve(request: ApproveInvoiceRequest, options?: RequestOptions): Promise<ApproveInvoiceResponse>;
|
|
100
|
+
/**
|
|
101
|
+
* Retry advancing the invoice after a failed attempt
|
|
102
|
+
*
|
|
103
|
+
* Retry sending a billing invoice.
|
|
104
|
+
*
|
|
105
|
+
* Retry advancing the invoice after a failed attempt.
|
|
106
|
+
*
|
|
107
|
+
* The action can be called when the invoice's statusDetails' actions field contain
|
|
108
|
+
* the "retry" action.
|
|
109
|
+
*
|
|
110
|
+
* POST /openmeter/billing/invoices/{invoiceId}/retry
|
|
111
|
+
*/
|
|
112
|
+
retry(request: RetryInvoiceRequest, options?: RequestOptions): Promise<RetryInvoiceResponse>;
|
|
113
|
+
/**
|
|
114
|
+
* Snapshot quantities for usage based line items
|
|
115
|
+
*
|
|
116
|
+
* Snapshot quantities for usage-based line items.
|
|
117
|
+
*
|
|
118
|
+
* This call will snapshot the quantities for all usage based line items in the
|
|
119
|
+
* invoice.
|
|
120
|
+
*
|
|
121
|
+
* This call is only valid in draft.waiting_for_collection status, where the
|
|
122
|
+
* collection period can be skipped using this action.
|
|
123
|
+
*
|
|
124
|
+
* POST /openmeter/billing/invoices/{invoiceId}/snapshot-quantities
|
|
125
|
+
*/
|
|
126
|
+
snapshotQuantities(request: SnapshotQuantitiesInvoiceRequest, options?: RequestOptions): Promise<SnapshotQuantitiesInvoiceResponse>;
|
|
127
|
+
}
|