@openmeter/client 1.0.0-beta.233 → 1.0.0-beta.235
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 +125 -111
- package/dist/funcs/customers.d.ts +112 -1
- package/dist/funcs/customers.js +430 -0
- package/dist/funcs/entitlements.d.ts +38 -1
- package/dist/funcs/entitlements.js +169 -6
- package/dist/funcs/grants.d.ts +24 -0
- package/dist/funcs/grants.js +78 -0
- package/dist/funcs/index.d.ts +2 -0
- package/dist/funcs/index.js +2 -0
- package/dist/funcs/notifications.d.ts +43 -0
- package/dist/funcs/notifications.js +163 -0
- package/dist/index.d.ts +9 -1
- package/dist/index.js +6 -0
- package/dist/lib/version.d.ts +1 -1
- package/dist/lib/version.js +1 -1
- package/dist/models/operations/customers.d.ts +109 -1
- package/dist/models/operations/entitlements.d.ts +59 -4
- package/dist/models/operations/grants.d.ts +43 -0
- package/dist/models/operations/grants.js +2 -0
- package/dist/models/operations/notifications.d.ts +46 -0
- package/dist/models/operations/notifications.js +2 -0
- package/dist/models/schemas.d.ts +6556 -2713
- package/dist/models/schemas.js +1802 -365
- package/dist/models/types.d.ts +1177 -228
- package/dist/sdk/apps.d.ts +70 -1
- package/dist/sdk/apps.js +86 -1
- package/dist/sdk/charges.d.ts +32 -0
- package/dist/sdk/charges.js +38 -0
- package/dist/sdk/currencies.d.ts +71 -0
- package/dist/sdk/currencies.js +87 -0
- package/dist/sdk/customers.d.ts +205 -2
- package/dist/sdk/customers.js +246 -1
- package/dist/sdk/entitlementAccess.d.ts +22 -0
- package/dist/sdk/entitlementAccess.js +26 -0
- package/dist/sdk/entitlements.d.ts +51 -1
- package/dist/sdk/entitlements.js +61 -1
- package/dist/sdk/grants.d.ts +43 -0
- package/dist/sdk/grants.js +51 -0
- package/dist/sdk/internal.d.ts +5 -458
- package/dist/sdk/internal.js +6 -569
- package/dist/sdk/notifications.d.ts +58 -0
- package/dist/sdk/notifications.js +72 -0
- package/dist/sdk/planAddons.d.ts +20 -1
- package/dist/sdk/planAddons.js +24 -1
- package/dist/sdk/sdk.d.ts +18 -0
- package/dist/sdk/sdk.js +30 -0
- package/dist/sdk/subscriptions.d.ts +39 -9
- package/dist/sdk/subscriptions.js +45 -11
- package/package.json +1 -1
package/dist/sdk/internal.js
CHANGED
|
@@ -1,14 +1,6 @@
|
|
|
1
1
|
// Code generated by @openmeter/typespec-typescript. DO NOT EDIT.
|
|
2
2
|
import { unwrap } from '../lib/types.js';
|
|
3
|
-
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';
|
|
3
|
+
import { createSubscriptionAddon, updateSubscriptionAddon, } from '../funcs/subscriptions.js';
|
|
12
4
|
/**
|
|
13
5
|
* Operations marked internal in the API definition. They are not part of
|
|
14
6
|
* the customer surface: they may require additional permissions, and they
|
|
@@ -19,130 +11,10 @@ export class Internal {
|
|
|
19
11
|
constructor(_client) {
|
|
20
12
|
this._client = _client;
|
|
21
13
|
}
|
|
22
|
-
_customers;
|
|
23
|
-
get customers() {
|
|
24
|
-
return (this._customers ??= new InternalCustomers(this._client));
|
|
25
|
-
}
|
|
26
14
|
_subscriptions;
|
|
27
15
|
get subscriptions() {
|
|
28
16
|
return (this._subscriptions ??= new InternalSubscriptions(this._client));
|
|
29
17
|
}
|
|
30
|
-
_apps;
|
|
31
|
-
get apps() {
|
|
32
|
-
return (this._apps ??= new InternalApps(this._client));
|
|
33
|
-
}
|
|
34
|
-
_invoices;
|
|
35
|
-
get invoices() {
|
|
36
|
-
return (this._invoices ??= new InternalInvoices(this._client));
|
|
37
|
-
}
|
|
38
|
-
_charges;
|
|
39
|
-
get charges() {
|
|
40
|
-
return (this._charges ??= new InternalCharges(this._client));
|
|
41
|
-
}
|
|
42
|
-
_currencies;
|
|
43
|
-
get currencies() {
|
|
44
|
-
return (this._currencies ??= new InternalCurrencies(this._client));
|
|
45
|
-
}
|
|
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));
|
|
145
|
-
}
|
|
146
18
|
}
|
|
147
19
|
export class InternalSubscriptions {
|
|
148
20
|
_client;
|
|
@@ -150,48 +22,14 @@ export class InternalSubscriptions {
|
|
|
150
22
|
this._client = _client;
|
|
151
23
|
}
|
|
152
24
|
/**
|
|
153
|
-
*
|
|
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
|
|
25
|
+
* Create a new subscription add-on
|
|
181
26
|
*
|
|
182
|
-
*
|
|
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.
|
|
27
|
+
* Add add-on to a subscription.
|
|
190
28
|
*
|
|
191
|
-
* POST /openmeter/subscriptions/{subscriptionId}/
|
|
29
|
+
* POST /openmeter/subscriptions/{subscriptionId}/addons
|
|
192
30
|
*/
|
|
193
|
-
async
|
|
194
|
-
return unwrap(await
|
|
31
|
+
async createAddon(request, options) {
|
|
32
|
+
return unwrap(await createSubscriptionAddon(this._client, request, options));
|
|
195
33
|
}
|
|
196
34
|
/**
|
|
197
35
|
* Update subscription addon
|
|
@@ -206,404 +44,3 @@ export class InternalSubscriptions {
|
|
|
206
44
|
return unwrap(await updateSubscriptionAddon(this._client, request, options));
|
|
207
45
|
}
|
|
208
46
|
}
|
|
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
|
|
248
|
-
*
|
|
249
|
-
* Update an installed app.
|
|
250
|
-
*
|
|
251
|
-
* PUT /openmeter/apps/{appId}
|
|
252
|
-
*/
|
|
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));
|
|
297
|
-
}
|
|
298
|
-
}
|
|
299
|
-
export class InternalInvoices {
|
|
300
|
-
_client;
|
|
301
|
-
constructor(_client) {
|
|
302
|
-
this._client = _client;
|
|
303
|
-
}
|
|
304
|
-
/**
|
|
305
|
-
* List billing invoices
|
|
306
|
-
*
|
|
307
|
-
* List billing invoices.
|
|
308
|
-
*
|
|
309
|
-
* Returns a page of invoices. Gathering invoices are never included. Use `filter`
|
|
310
|
-
* to narrow by status, customer, dates, or service period start. Use `sort` to
|
|
311
|
-
* control ordering.
|
|
312
|
-
*
|
|
313
|
-
* GET /openmeter/billing/invoices
|
|
314
|
-
*/
|
|
315
|
-
async list(request, options) {
|
|
316
|
-
return unwrap(await listInvoices(this._client, request, options));
|
|
317
|
-
}
|
|
318
|
-
/**
|
|
319
|
-
* List billing invoices
|
|
320
|
-
*
|
|
321
|
-
* List billing invoices.
|
|
322
|
-
*
|
|
323
|
-
* Returns a page of invoices. Gathering invoices are never included. Use `filter`
|
|
324
|
-
* to narrow by status, customer, dates, or service period start. Use `sort` to
|
|
325
|
-
* control ordering.
|
|
326
|
-
*
|
|
327
|
-
* Iterates every item across all pages, fetching more as the returned iterable is consumed.
|
|
328
|
-
*
|
|
329
|
-
* GET /openmeter/billing/invoices
|
|
330
|
-
*/
|
|
331
|
-
listAll(request, options) {
|
|
332
|
-
return paginatePages((req, opts) => listInvoices(this._client, req, opts), request ?? {}, options);
|
|
333
|
-
}
|
|
334
|
-
/**
|
|
335
|
-
* Get a billing invoice
|
|
336
|
-
*
|
|
337
|
-
* Get a billing invoice by ID.
|
|
338
|
-
*
|
|
339
|
-
* Returns the full invoice resource including line items, status details, totals,
|
|
340
|
-
* and workflow configuration snapshot.
|
|
341
|
-
*
|
|
342
|
-
* GET /openmeter/billing/invoices/{invoiceId}
|
|
343
|
-
*/
|
|
344
|
-
async get(request, options) {
|
|
345
|
-
return unwrap(await getInvoice(this._client, request, options));
|
|
346
|
-
}
|
|
347
|
-
/**
|
|
348
|
-
* Update a billing invoice
|
|
349
|
-
*
|
|
350
|
-
* Update a billing invoice.
|
|
351
|
-
*
|
|
352
|
-
* Only the mutable fields of the invoice can be edited: description, labels,
|
|
353
|
-
* supplier, customer, workflow settings, and top-level lines. Top-level lines are
|
|
354
|
-
* matched by `id`; lines without an `id` are created, and existing lines omitted
|
|
355
|
-
* from `lines` are deleted. Detailed (child) lines are always computed and cannot
|
|
356
|
-
* be edited directly. Only invoices in draft status can be updated.
|
|
357
|
-
*
|
|
358
|
-
* PUT /openmeter/billing/invoices/{invoiceId}
|
|
359
|
-
*/
|
|
360
|
-
async update(request, options) {
|
|
361
|
-
return unwrap(await updateInvoice(this._client, request, options));
|
|
362
|
-
}
|
|
363
|
-
/**
|
|
364
|
-
* Delete a billing invoice
|
|
365
|
-
*
|
|
366
|
-
* Delete a billing invoice.
|
|
367
|
-
*
|
|
368
|
-
* Only standard invoices in draft status can be deleted. Deleting an invoice will
|
|
369
|
-
* also delete all associated line items and workflow configuration.
|
|
370
|
-
*
|
|
371
|
-
* DELETE /openmeter/billing/invoices/{invoiceId}
|
|
372
|
-
*/
|
|
373
|
-
async delete(request, options) {
|
|
374
|
-
return unwrap(await deleteInvoice(this._client, request, options));
|
|
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
|
-
}
|
|
475
|
-
}
|
|
476
|
-
export class InternalCurrencies {
|
|
477
|
-
_client;
|
|
478
|
-
constructor(_client) {
|
|
479
|
-
this._client = _client;
|
|
480
|
-
}
|
|
481
|
-
/**
|
|
482
|
-
* List currencies
|
|
483
|
-
*
|
|
484
|
-
* List currencies supported by the billing system.
|
|
485
|
-
*
|
|
486
|
-
* GET /openmeter/currencies
|
|
487
|
-
*/
|
|
488
|
-
async list(request, options) {
|
|
489
|
-
return unwrap(await listCurrencies(this._client, request, options));
|
|
490
|
-
}
|
|
491
|
-
/**
|
|
492
|
-
* List currencies
|
|
493
|
-
*
|
|
494
|
-
* List currencies supported by the billing system.
|
|
495
|
-
*
|
|
496
|
-
* Iterates every item across all pages, fetching more as the returned iterable is consumed.
|
|
497
|
-
*
|
|
498
|
-
* GET /openmeter/currencies
|
|
499
|
-
*/
|
|
500
|
-
listAll(request, options) {
|
|
501
|
-
return paginatePages((req, opts) => listCurrencies(this._client, req, opts), request ?? {}, options);
|
|
502
|
-
}
|
|
503
|
-
/**
|
|
504
|
-
* Create custom currency
|
|
505
|
-
*
|
|
506
|
-
* Create a custom currency. This operation allows defining your own custom
|
|
507
|
-
* currency for billing purposes.
|
|
508
|
-
*
|
|
509
|
-
* POST /openmeter/currencies/custom
|
|
510
|
-
*/
|
|
511
|
-
async createCustomCurrency(request, options) {
|
|
512
|
-
return unwrap(await createCustomCurrency(this._client, request, options));
|
|
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
|
-
}
|
|
524
|
-
/**
|
|
525
|
-
* List cost bases
|
|
526
|
-
*
|
|
527
|
-
* List cost bases for a currency. For custom currencies, there can be multiple
|
|
528
|
-
* cost bases with different `effective_from` dates.
|
|
529
|
-
*
|
|
530
|
-
* GET /openmeter/currencies/custom/{currencyId}/cost-bases
|
|
531
|
-
*/
|
|
532
|
-
async listCostBases(request, options) {
|
|
533
|
-
return unwrap(await listCostBases(this._client, request, options));
|
|
534
|
-
}
|
|
535
|
-
/**
|
|
536
|
-
* List cost bases
|
|
537
|
-
*
|
|
538
|
-
* List cost bases for a currency. For custom currencies, there can be multiple
|
|
539
|
-
* cost bases with different `effective_from` dates.
|
|
540
|
-
*
|
|
541
|
-
* Iterates every item across all pages, fetching more as the returned iterable is consumed.
|
|
542
|
-
*
|
|
543
|
-
* GET /openmeter/currencies/custom/{currencyId}/cost-bases
|
|
544
|
-
*/
|
|
545
|
-
listCostBasesAll(request, options) {
|
|
546
|
-
return paginatePages((req, opts) => listCostBases(this._client, req, opts), request, options);
|
|
547
|
-
}
|
|
548
|
-
/**
|
|
549
|
-
* Create cost basis
|
|
550
|
-
*
|
|
551
|
-
* Create a cost basis for a currency.
|
|
552
|
-
*
|
|
553
|
-
* POST /openmeter/currencies/custom/{currencyId}/cost-bases
|
|
554
|
-
*/
|
|
555
|
-
async createCostBasis(request, options) {
|
|
556
|
-
return unwrap(await createCostBasis(this._client, request, options));
|
|
557
|
-
}
|
|
558
|
-
}
|
|
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 {
|
|
588
|
-
_client;
|
|
589
|
-
constructor(_client) {
|
|
590
|
-
this._client = _client;
|
|
591
|
-
}
|
|
592
|
-
/**
|
|
593
|
-
* Query entitlement access
|
|
594
|
-
*
|
|
595
|
-
* Query feature access for a list of customers.
|
|
596
|
-
*
|
|
597
|
-
* The endpoint resolves each provided identifier to a customer and returns the
|
|
598
|
-
* access status for the requested features, plus optional credit balance
|
|
599
|
-
* availability.
|
|
600
|
-
*
|
|
601
|
-
* _Designed to be called on a fixed refresh interval and the query response is
|
|
602
|
-
* intended to be cached._
|
|
603
|
-
*
|
|
604
|
-
* POST /openmeter/entitlement-access/query
|
|
605
|
-
*/
|
|
606
|
-
async query(request, options) {
|
|
607
|
-
return unwrap(await queryEntitlementAccess(this._client, request, options));
|
|
608
|
-
}
|
|
609
|
-
}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import { type Client } from '../core.js';
|
|
2
|
+
import { type RequestOptions } from '../lib/types.js';
|
|
3
|
+
import type { ListNotificationChannelsRequest, ListNotificationChannelsResponse, CreateNotificationChannelRequest, CreateNotificationChannelResponse, GetNotificationChannelRequest, GetNotificationChannelResponse, UpdateNotificationChannelRequest, UpdateNotificationChannelResponse, DeleteNotificationChannelRequest, DeleteNotificationChannelResponse } from '../models/operations/notifications.js';
|
|
4
|
+
import type { NotificationChannel } from '../models/types.js';
|
|
5
|
+
export declare class Notifications {
|
|
6
|
+
private readonly _client;
|
|
7
|
+
constructor(_client: Client);
|
|
8
|
+
/**
|
|
9
|
+
* List notification channels
|
|
10
|
+
*
|
|
11
|
+
* List all notification channels.
|
|
12
|
+
*
|
|
13
|
+
* GET /openmeter/notification/channels
|
|
14
|
+
*/
|
|
15
|
+
listChannels(request?: ListNotificationChannelsRequest, options?: RequestOptions): Promise<ListNotificationChannelsResponse>;
|
|
16
|
+
/**
|
|
17
|
+
* List notification channels
|
|
18
|
+
*
|
|
19
|
+
* List all notification channels.
|
|
20
|
+
*
|
|
21
|
+
* Iterates every item across all pages, fetching more as the returned iterable is consumed.
|
|
22
|
+
*
|
|
23
|
+
* GET /openmeter/notification/channels
|
|
24
|
+
*/
|
|
25
|
+
listChannelsAll(request?: ListNotificationChannelsRequest, options?: RequestOptions): AsyncIterable<NotificationChannel>;
|
|
26
|
+
/**
|
|
27
|
+
* Create notification channel
|
|
28
|
+
*
|
|
29
|
+
* Create a notification channel.
|
|
30
|
+
*
|
|
31
|
+
* POST /openmeter/notification/channels
|
|
32
|
+
*/
|
|
33
|
+
createChannel(request: CreateNotificationChannelRequest, options?: RequestOptions): Promise<CreateNotificationChannelResponse>;
|
|
34
|
+
/**
|
|
35
|
+
* Get notification channel
|
|
36
|
+
*
|
|
37
|
+
* Get a notification channel by id.
|
|
38
|
+
*
|
|
39
|
+
* GET /openmeter/notification/channels/{notificationChannelId}
|
|
40
|
+
*/
|
|
41
|
+
getChannel(request: GetNotificationChannelRequest, options?: RequestOptions): Promise<GetNotificationChannelResponse>;
|
|
42
|
+
/**
|
|
43
|
+
* Update notification channel
|
|
44
|
+
*
|
|
45
|
+
* Update a notification channel by id.
|
|
46
|
+
*
|
|
47
|
+
* PUT /openmeter/notification/channels/{notificationChannelId}
|
|
48
|
+
*/
|
|
49
|
+
updateChannel(request: UpdateNotificationChannelRequest, options?: RequestOptions): Promise<UpdateNotificationChannelResponse>;
|
|
50
|
+
/**
|
|
51
|
+
* Delete notification channel
|
|
52
|
+
*
|
|
53
|
+
* Delete a notification channel by id.
|
|
54
|
+
*
|
|
55
|
+
* DELETE /openmeter/notification/channels/{notificationChannelId}
|
|
56
|
+
*/
|
|
57
|
+
deleteChannel(request: DeleteNotificationChannelRequest, options?: RequestOptions): Promise<DeleteNotificationChannelResponse>;
|
|
58
|
+
}
|