@openmeter/client 1.0.0-beta.232 → 1.0.0-beta.234
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 +112 -43
- package/dist/funcs/apps.js +7 -2
- package/dist/funcs/billing.js +7 -2
- package/dist/funcs/charges.d.ts +14 -0
- package/dist/funcs/charges.js +42 -0
- package/dist/funcs/customers.d.ts +112 -1
- package/dist/funcs/customers.js +430 -0
- 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 +46 -1
- package/dist/funcs/entitlements.js +213 -1
- package/dist/funcs/grants.d.ts +24 -0
- package/dist/funcs/grants.js +78 -0
- package/dist/funcs/index.d.ts +4 -1
- package/dist/funcs/index.js +4 -1
- package/dist/funcs/notifications.d.ts +43 -0
- package/dist/funcs/notifications.js +163 -0
- package/dist/funcs/planAddons.js +7 -2
- package/dist/funcs/subscriptions.d.ts +60 -1
- package/dist/funcs/subscriptions.js +204 -0
- package/dist/index.d.ts +6 -2
- package/dist/index.js +1 -0
- package/dist/lib/version.d.ts +1 -1
- package/dist/lib/version.js +1 -1
- package/dist/lib/wire.js +62 -6
- package/dist/models/operations/apps.d.ts +17 -1
- package/dist/models/operations/billing.d.ts +19 -1
- package/dist/models/operations/charges.d.ts +54 -0
- package/dist/models/operations/customers.d.ts +127 -5
- package/dist/models/operations/entitlementAccess.d.ts +9 -0
- package/dist/models/operations/entitlementAccess.js +2 -0
- package/dist/models/operations/entitlements.d.ts +73 -1
- 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/operations/planAddons.d.ts +14 -1
- package/dist/models/operations/subscriptions.d.ts +27 -3
- package/dist/models/schemas.d.ts +51330 -23237
- package/dist/models/schemas.js +4837 -1735
- package/dist/models/types.d.ts +4758 -1592
- package/dist/sdk/apps.d.ts +2 -44
- package/dist/sdk/apps.js +1 -53
- package/dist/sdk/customers.d.ts +2 -56
- package/dist/sdk/customers.js +1 -67
- package/dist/sdk/internal.d.ts +491 -28
- package/dist/sdk/internal.js +607 -30
- package/dist/sdk/invoices.d.ts +112 -0
- package/dist/sdk/invoices.js +115 -0
- package/dist/sdk/notifications.d.ts +58 -0
- package/dist/sdk/notifications.js +72 -0
- package/dist/sdk/planAddons.d.ts +1 -20
- package/dist/sdk/planAddons.js +1 -24
- package/dist/sdk/sdk.d.ts +3 -0
- package/dist/sdk/sdk.js +5 -0
- package/dist/sdk/subscriptions.d.ts +12 -1
- package/dist/sdk/subscriptions.js +14 -1
- package/package.json +1 -1
- 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,11 +1,17 @@
|
|
|
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 {
|
|
4
|
+
import { createCustomerEntitlement, overrideCustomerEntitlement, getCustomerEntitlementHistory, getCustomerEntitlement, listCustomerEntitlements, resetCustomerEntitlementUsage, deleteCustomerEntitlement, createCustomerEntitlementGrant, listCustomerEntitlementGrants, voidCreditGrant, listCustomerCharges, createCustomerCharges, } from '../funcs/customers.js';
|
|
5
|
+
import { getCustomerEntitlementAccess, getCustomerEntitlementValueByFeatureKey, listEntitlements, getEntitlement, getCustomerEntitlementValue, } from '../funcs/entitlements.js';
|
|
6
|
+
import { listGrants, voidGrant } from '../funcs/grants.js';
|
|
7
|
+
import { unscheduleSubscription, restoreSubscription, migrateSubscription, createSubscriptionAddon, updateSubscriptionAddon, } from '../funcs/subscriptions.js';
|
|
8
|
+
import { uninstallApp, updateApp, listAppCatalog, getAppCatalogItem, installApp, } from '../funcs/apps.js';
|
|
6
9
|
import { listInvoices, getInvoice, updateInvoice, deleteInvoice, advanceInvoice, approveInvoice, retryInvoice, snapshotQuantitiesInvoice, } from '../funcs/invoices.js';
|
|
10
|
+
import { listCharges } from '../funcs/charges.js';
|
|
7
11
|
import { listCurrencies, createCustomCurrency, getCustomCurrency, listCostBases, createCostBasis, } from '../funcs/currencies.js';
|
|
8
|
-
import {
|
|
12
|
+
import { listPlanAddons } from '../funcs/planAddons.js';
|
|
13
|
+
import { queryEntitlementAccess } from '../funcs/entitlementAccess.js';
|
|
14
|
+
import { listNotificationChannels, createNotificationChannel, getNotificationChannel, updateNotificationChannel, deleteNotificationChannel, } from '../funcs/notifications.js';
|
|
9
15
|
/**
|
|
10
16
|
* Operations marked internal in the API definition. They are not part of
|
|
11
17
|
* the customer surface: they may require additional permissions, and they
|
|
@@ -16,6 +22,18 @@ export class Internal {
|
|
|
16
22
|
constructor(_client) {
|
|
17
23
|
this._client = _client;
|
|
18
24
|
}
|
|
25
|
+
_customers;
|
|
26
|
+
get customers() {
|
|
27
|
+
return (this._customers ??= new InternalCustomers(this._client));
|
|
28
|
+
}
|
|
29
|
+
_entitlements;
|
|
30
|
+
get entitlements() {
|
|
31
|
+
return (this._entitlements ??= new InternalEntitlements(this._client));
|
|
32
|
+
}
|
|
33
|
+
_grants;
|
|
34
|
+
get grants() {
|
|
35
|
+
return (this._grants ??= new InternalGrants(this._client));
|
|
36
|
+
}
|
|
19
37
|
_subscriptions;
|
|
20
38
|
get subscriptions() {
|
|
21
39
|
return (this._subscriptions ??= new InternalSubscriptions(this._client));
|
|
@@ -28,67 +46,496 @@ export class Internal {
|
|
|
28
46
|
get invoices() {
|
|
29
47
|
return (this._invoices ??= new InternalInvoices(this._client));
|
|
30
48
|
}
|
|
49
|
+
_charges;
|
|
50
|
+
get charges() {
|
|
51
|
+
return (this._charges ??= new InternalCharges(this._client));
|
|
52
|
+
}
|
|
31
53
|
_currencies;
|
|
32
54
|
get currencies() {
|
|
33
55
|
return (this._currencies ??= new InternalCurrencies(this._client));
|
|
34
56
|
}
|
|
35
|
-
|
|
36
|
-
get
|
|
37
|
-
return (this.
|
|
57
|
+
_planAddons;
|
|
58
|
+
get planAddons() {
|
|
59
|
+
return (this._planAddons ??= new InternalPlanAddons(this._client));
|
|
60
|
+
}
|
|
61
|
+
_entitlementAccess;
|
|
62
|
+
get entitlementAccess() {
|
|
63
|
+
return (this._entitlementAccess ??= new InternalEntitlementAccess(this._client));
|
|
64
|
+
}
|
|
65
|
+
_notifications;
|
|
66
|
+
get notifications() {
|
|
67
|
+
return (this._notifications ??= new InternalNotifications(this._client));
|
|
38
68
|
}
|
|
39
69
|
}
|
|
40
|
-
export class
|
|
70
|
+
export class InternalCustomers {
|
|
71
|
+
_client;
|
|
72
|
+
constructor(_client) {
|
|
73
|
+
this._client = _client;
|
|
74
|
+
}
|
|
75
|
+
_entitlements;
|
|
76
|
+
get entitlements() {
|
|
77
|
+
return (this._entitlements ??= new InternalCustomersEntitlements(this._client));
|
|
78
|
+
}
|
|
79
|
+
_credits;
|
|
80
|
+
get credits() {
|
|
81
|
+
return (this._credits ??= new InternalCustomersCredits(this._client));
|
|
82
|
+
}
|
|
83
|
+
_charges;
|
|
84
|
+
get charges() {
|
|
85
|
+
return (this._charges ??= new InternalCustomersCharges(this._client));
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
export class InternalCustomersEntitlements {
|
|
41
89
|
_client;
|
|
42
90
|
constructor(_client) {
|
|
43
91
|
this._client = _client;
|
|
44
92
|
}
|
|
45
93
|
/**
|
|
46
|
-
* Create
|
|
94
|
+
* Create customer entitlement
|
|
47
95
|
*
|
|
48
|
-
*
|
|
96
|
+
* Create an entitlement for the customer.
|
|
49
97
|
*
|
|
50
|
-
*
|
|
98
|
+
* A customer can have only one active entitlement per feature. The feature must be
|
|
99
|
+
* compatible with the entitlement type. Entitlements cannot be modified after
|
|
100
|
+
* creation, only deleted.
|
|
101
|
+
*
|
|
102
|
+
* POST /openmeter/customers/{customerId}/entitlements
|
|
51
103
|
*/
|
|
52
|
-
async
|
|
53
|
-
return unwrap(await
|
|
104
|
+
async create(request, options) {
|
|
105
|
+
return unwrap(await createCustomerEntitlement(this._client, request, options));
|
|
106
|
+
}
|
|
107
|
+
/**
|
|
108
|
+
* Override customer entitlement
|
|
109
|
+
*
|
|
110
|
+
* Override an entitlement of the customer with a new one.
|
|
111
|
+
*
|
|
112
|
+
* The referenced entitlement ends and the new one starts at the same instant, so
|
|
113
|
+
* access continues without a gap. Both must belong to the same feature. Use this
|
|
114
|
+
* for upgrades and downgrades.
|
|
115
|
+
*
|
|
116
|
+
* Fails if the referenced entitlement does not exist, is deleted, or is no longer
|
|
117
|
+
* active.
|
|
118
|
+
*
|
|
119
|
+
* PUT /openmeter/customers/{customerId}/entitlements/{entitlementId}/override
|
|
120
|
+
*/
|
|
121
|
+
async override(request, options) {
|
|
122
|
+
return unwrap(await overrideCustomerEntitlement(this._client, request, options));
|
|
123
|
+
}
|
|
124
|
+
/**
|
|
125
|
+
* Get customer entitlement history
|
|
126
|
+
*
|
|
127
|
+
* Get the balance and usage history of a metered entitlement. The queried range
|
|
128
|
+
* may span multiple usage periods.
|
|
129
|
+
*
|
|
130
|
+
* `windowed_history` groups usage into windows of the requested size and reports
|
|
131
|
+
* the balance at the start of each window. `burndown_history` lists the periods in
|
|
132
|
+
* which grants were consumed in a fixed order, together with the usage taken from
|
|
133
|
+
* each grant.
|
|
134
|
+
*
|
|
135
|
+
* GET /openmeter/customers/{customerId}/entitlements/{entitlementId}/history
|
|
136
|
+
*/
|
|
137
|
+
async getHistory(request, options) {
|
|
138
|
+
return unwrap(await getCustomerEntitlementHistory(this._client, request, options));
|
|
139
|
+
}
|
|
140
|
+
/**
|
|
141
|
+
* Get customer entitlement
|
|
142
|
+
*
|
|
143
|
+
* Get an entitlement of the customer by ID. For checking entitlement access, use
|
|
144
|
+
* the entitlement access endpoints instead.
|
|
145
|
+
*
|
|
146
|
+
* GET /openmeter/customers/{customerId}/entitlements/{entitlementId}
|
|
147
|
+
*/
|
|
148
|
+
async get(request, options) {
|
|
149
|
+
return unwrap(await getCustomerEntitlement(this._client, request, options));
|
|
150
|
+
}
|
|
151
|
+
/**
|
|
152
|
+
* List customer entitlements
|
|
153
|
+
*
|
|
154
|
+
* List the entitlements of the customer that are active at the time of the
|
|
155
|
+
* request. For checking entitlement access, use the entitlement access endpoints
|
|
156
|
+
* instead.
|
|
157
|
+
*
|
|
158
|
+
* GET /openmeter/customers/{customerId}/entitlements
|
|
159
|
+
*/
|
|
160
|
+
async list(request, options) {
|
|
161
|
+
return unwrap(await listCustomerEntitlements(this._client, request, options));
|
|
162
|
+
}
|
|
163
|
+
/**
|
|
164
|
+
* List customer entitlements
|
|
165
|
+
*
|
|
166
|
+
* List the entitlements of the customer that are active at the time of the
|
|
167
|
+
* request. For checking entitlement access, use the entitlement access endpoints
|
|
168
|
+
* instead.
|
|
169
|
+
*
|
|
170
|
+
* Iterates every item across all pages, fetching more as the returned iterable is consumed.
|
|
171
|
+
*
|
|
172
|
+
* GET /openmeter/customers/{customerId}/entitlements
|
|
173
|
+
*/
|
|
174
|
+
listAll(request, options) {
|
|
175
|
+
return paginatePages((req, opts) => listCustomerEntitlements(this._client, req, opts), request, options);
|
|
176
|
+
}
|
|
177
|
+
/**
|
|
178
|
+
* Reset customer entitlement usage
|
|
179
|
+
*
|
|
180
|
+
* Reset the usage of a metered entitlement. The reset starts a new usage period:
|
|
181
|
+
* usage is zeroed and grants roll over according to their rollover settings.
|
|
182
|
+
*
|
|
183
|
+
* Usage is reset automatically at the end of each usage period. Use this operation
|
|
184
|
+
* to reset it earlier, for example to align the entitlement with the customer's
|
|
185
|
+
* billing period. The usage period anchor can be moved at the same time.
|
|
186
|
+
*
|
|
187
|
+
* POST /openmeter/customers/{customerId}/entitlements/{entitlementId}/reset
|
|
188
|
+
*/
|
|
189
|
+
async resetUsage(request, options) {
|
|
190
|
+
return unwrap(await resetCustomerEntitlementUsage(this._client, request, options));
|
|
191
|
+
}
|
|
192
|
+
/**
|
|
193
|
+
* Delete customer entitlement
|
|
194
|
+
*
|
|
195
|
+
* Deletes the entitlement and revokes access to its feature. A customer can hold
|
|
196
|
+
* only one active entitlement per feature, so migrating a feature requires
|
|
197
|
+
* deleting the previous entitlement first.
|
|
198
|
+
*
|
|
199
|
+
* Deletion sets the `deleted_at` timestamp instead of removing history. Access and
|
|
200
|
+
* status queries for earlier points in time still treat the entitlement as active,
|
|
201
|
+
* so access changes are never retroactive.
|
|
202
|
+
*
|
|
203
|
+
* DELETE /openmeter/customers/{customerId}/entitlements/{entitlementId}
|
|
204
|
+
*/
|
|
205
|
+
async delete(request, options) {
|
|
206
|
+
return unwrap(await deleteCustomerEntitlement(this._client, request, options));
|
|
207
|
+
}
|
|
208
|
+
_grants;
|
|
209
|
+
get grants() {
|
|
210
|
+
return (this._grants ??= new InternalCustomersEntitlementsGrants(this._client));
|
|
54
211
|
}
|
|
55
212
|
}
|
|
56
|
-
export class
|
|
213
|
+
export class InternalCustomersEntitlementsGrants {
|
|
57
214
|
_client;
|
|
58
215
|
constructor(_client) {
|
|
59
216
|
this._client = _client;
|
|
60
217
|
}
|
|
61
218
|
/**
|
|
62
|
-
*
|
|
219
|
+
* Create customer entitlement grant
|
|
220
|
+
*
|
|
221
|
+
* Issue a grant for a metered entitlement of the customer. Boolean and static
|
|
222
|
+
* entitlements cannot have grants, so the request is rejected for them.
|
|
223
|
+
*
|
|
224
|
+
* Grants are immutable. The amount is added to the balance from `effective_at`,
|
|
225
|
+
* which cannot be earlier than the start of the current usage period.
|
|
226
|
+
*
|
|
227
|
+
* POST /openmeter/customers/{customerId}/entitlements/{entitlementId}/grants
|
|
228
|
+
*/
|
|
229
|
+
async create(request, options) {
|
|
230
|
+
return unwrap(await createCustomerEntitlementGrant(this._client, request, options));
|
|
231
|
+
}
|
|
232
|
+
/**
|
|
233
|
+
* List customer entitlement grants
|
|
234
|
+
*
|
|
235
|
+
* List the grants issued for an entitlement of the customer. Grants only exist for
|
|
236
|
+
* metered entitlements, so the list is empty for boolean and static entitlements.
|
|
237
|
+
*
|
|
238
|
+
* Deleted grants are excluded unless `include_deleted` is set. Voided and expired
|
|
239
|
+
* grants are always included, as they are part of the balance history.
|
|
240
|
+
*
|
|
241
|
+
* GET /openmeter/customers/{customerId}/entitlements/{entitlementId}/grants
|
|
242
|
+
*/
|
|
243
|
+
async list(request, options) {
|
|
244
|
+
return unwrap(await listCustomerEntitlementGrants(this._client, request, options));
|
|
245
|
+
}
|
|
246
|
+
/**
|
|
247
|
+
* List customer entitlement grants
|
|
248
|
+
*
|
|
249
|
+
* List the grants issued for an entitlement of the customer. Grants only exist for
|
|
250
|
+
* metered entitlements, so the list is empty for boolean and static entitlements.
|
|
251
|
+
*
|
|
252
|
+
* Deleted grants are excluded unless `include_deleted` is set. Voided and expired
|
|
253
|
+
* grants are always included, as they are part of the balance history.
|
|
254
|
+
*
|
|
255
|
+
* Iterates every item across all pages, fetching more as the returned iterable is consumed.
|
|
256
|
+
*
|
|
257
|
+
* GET /openmeter/customers/{customerId}/entitlements/{entitlementId}/grants
|
|
258
|
+
*/
|
|
259
|
+
listAll(request, options) {
|
|
260
|
+
return paginatePages((req, opts) => listCustomerEntitlementGrants(this._client, req, opts), request, options);
|
|
261
|
+
}
|
|
262
|
+
}
|
|
263
|
+
export class InternalCustomersCredits {
|
|
264
|
+
_client;
|
|
265
|
+
constructor(_client) {
|
|
266
|
+
this._client = _client;
|
|
267
|
+
}
|
|
268
|
+
_grants;
|
|
269
|
+
get grants() {
|
|
270
|
+
return (this._grants ??= new InternalCustomersCreditsGrants(this._client));
|
|
271
|
+
}
|
|
272
|
+
}
|
|
273
|
+
export class InternalCustomersCreditsGrants {
|
|
274
|
+
_client;
|
|
275
|
+
constructor(_client) {
|
|
276
|
+
this._client = _client;
|
|
277
|
+
}
|
|
278
|
+
/**
|
|
279
|
+
* Void credit grant
|
|
280
|
+
*
|
|
281
|
+
* Void a credit grant, forfeiting the remaining unused balance.
|
|
282
|
+
*
|
|
283
|
+
* Voiding is a forward-looking, irreversible operation. Credits already consumed
|
|
284
|
+
* by usage remain unaffected — only the remaining balance is forfeited. The grant
|
|
285
|
+
* reads as `voided` status afterwards. Payment state is not adjusted when
|
|
286
|
+
* `payment_adjustment` is `none`, so invoice-backed or externally collected
|
|
287
|
+
* payments may still collect the original amount. Only `active` grants can be
|
|
288
|
+
* voided; voiding a pending, expired, or fully consumed grant returns a conflict.
|
|
289
|
+
* Retrying a successful void is an idempotent success.
|
|
290
|
+
*
|
|
291
|
+
* POST /openmeter/customers/{customerId}/credits/grants/{creditGrantId}/void
|
|
292
|
+
*/
|
|
293
|
+
async void(request, options) {
|
|
294
|
+
return unwrap(await voidCreditGrant(this._client, request, options));
|
|
295
|
+
}
|
|
296
|
+
}
|
|
297
|
+
export class InternalCustomersCharges {
|
|
298
|
+
_client;
|
|
299
|
+
constructor(_client) {
|
|
300
|
+
this._client = _client;
|
|
301
|
+
}
|
|
302
|
+
/**
|
|
303
|
+
* List customer charges
|
|
304
|
+
*
|
|
305
|
+
* List customer charges.
|
|
306
|
+
*
|
|
307
|
+
* Returns the customer's charges that are represented as either flat fee or
|
|
308
|
+
* usage-based charges.
|
|
309
|
+
*
|
|
310
|
+
* GET /openmeter/customers/{customerId}/charges
|
|
311
|
+
*/
|
|
312
|
+
async list(request, options) {
|
|
313
|
+
return unwrap(await listCustomerCharges(this._client, request, options));
|
|
314
|
+
}
|
|
315
|
+
/**
|
|
316
|
+
* List customer charges
|
|
317
|
+
*
|
|
318
|
+
* List customer charges.
|
|
319
|
+
*
|
|
320
|
+
* Returns the customer's charges that are represented as either flat fee or
|
|
321
|
+
* usage-based charges.
|
|
322
|
+
*
|
|
323
|
+
* Iterates every item across all pages, fetching more as the returned iterable is consumed.
|
|
324
|
+
*
|
|
325
|
+
* GET /openmeter/customers/{customerId}/charges
|
|
326
|
+
*/
|
|
327
|
+
listAll(request, options) {
|
|
328
|
+
return paginatePages((req, opts) => listCustomerCharges(this._client, req, opts), request, options);
|
|
329
|
+
}
|
|
330
|
+
/**
|
|
331
|
+
* Create customer charge
|
|
332
|
+
*
|
|
333
|
+
* Create customer charge.
|
|
334
|
+
*
|
|
335
|
+
* POST /openmeter/customers/{customerId}/charges
|
|
336
|
+
*/
|
|
337
|
+
async create(request, options) {
|
|
338
|
+
return unwrap(await createCustomerCharges(this._client, request, options));
|
|
339
|
+
}
|
|
340
|
+
}
|
|
341
|
+
export class InternalEntitlements {
|
|
342
|
+
_client;
|
|
343
|
+
constructor(_client) {
|
|
344
|
+
this._client = _client;
|
|
345
|
+
}
|
|
346
|
+
/**
|
|
347
|
+
* Get customer entitlement access
|
|
348
|
+
*
|
|
349
|
+
* Get the customer's access to a single feature.
|
|
350
|
+
*
|
|
351
|
+
* GET /openmeter/customers/{customerId}/entitlement-access/features/{featureKey}
|
|
352
|
+
*/
|
|
353
|
+
async getCustomerAccess(request, options) {
|
|
354
|
+
return unwrap(await getCustomerEntitlementAccess(this._client, request, options));
|
|
355
|
+
}
|
|
356
|
+
/**
|
|
357
|
+
* Get customer entitlement value by feature key
|
|
358
|
+
*
|
|
359
|
+
* Get the customer's entitlement value for a feature at a point in time. Without
|
|
360
|
+
* an active entitlement, the result denies access and omits the type.
|
|
361
|
+
*
|
|
362
|
+
* GET /openmeter/customers/{customerId}/entitlement-access/features/{featureKey}/value
|
|
363
|
+
*/
|
|
364
|
+
async getCustomerValueByFeatureKey(request, options) {
|
|
365
|
+
return unwrap(await getCustomerEntitlementValueByFeatureKey(this._client, request, options));
|
|
366
|
+
}
|
|
367
|
+
/**
|
|
368
|
+
* List entitlements
|
|
63
369
|
*
|
|
64
|
-
* List
|
|
370
|
+
* List the active entitlements of all customers. Intended for administrative use.
|
|
371
|
+
* To list the entitlements of a single customer, use the customer entitlements
|
|
372
|
+
* endpoints; to check entitlement access, use the entitlement access endpoints.
|
|
65
373
|
*
|
|
66
|
-
* GET /openmeter/
|
|
374
|
+
* GET /openmeter/entitlements
|
|
67
375
|
*/
|
|
68
376
|
async list(request, options) {
|
|
69
|
-
return unwrap(await
|
|
377
|
+
return unwrap(await listEntitlements(this._client, request, options));
|
|
70
378
|
}
|
|
71
379
|
/**
|
|
72
|
-
* List
|
|
380
|
+
* List entitlements
|
|
73
381
|
*
|
|
74
|
-
* List
|
|
382
|
+
* List the active entitlements of all customers. Intended for administrative use.
|
|
383
|
+
* To list the entitlements of a single customer, use the customer entitlements
|
|
384
|
+
* endpoints; to check entitlement access, use the entitlement access endpoints.
|
|
75
385
|
*
|
|
76
386
|
* Iterates every item across all pages, fetching more as the returned iterable is consumed.
|
|
77
387
|
*
|
|
78
|
-
* GET /openmeter/
|
|
388
|
+
* GET /openmeter/entitlements
|
|
79
389
|
*/
|
|
80
390
|
listAll(request, options) {
|
|
81
|
-
return paginatePages((req, opts) =>
|
|
391
|
+
return paginatePages((req, opts) => listEntitlements(this._client, req, opts), request ?? {}, options);
|
|
82
392
|
}
|
|
83
393
|
/**
|
|
84
|
-
* Get
|
|
394
|
+
* Get entitlement
|
|
85
395
|
*
|
|
86
|
-
* Get an
|
|
396
|
+
* Get an entitlement by ID. To check entitlement access, use the entitlement
|
|
397
|
+
* access endpoints instead.
|
|
87
398
|
*
|
|
88
|
-
* GET /openmeter/
|
|
399
|
+
* GET /openmeter/entitlements/{entitlementId}
|
|
89
400
|
*/
|
|
90
401
|
async get(request, options) {
|
|
91
|
-
return unwrap(await
|
|
402
|
+
return unwrap(await getEntitlement(this._client, request, options));
|
|
403
|
+
}
|
|
404
|
+
/**
|
|
405
|
+
* Get customer entitlement value
|
|
406
|
+
*
|
|
407
|
+
* Get the customer's access through a single entitlement, optionally evaluated at
|
|
408
|
+
* a point in time.
|
|
409
|
+
*
|
|
410
|
+
* GET /openmeter/customers/{customerId}/entitlements/{entitlementId}/value
|
|
411
|
+
*/
|
|
412
|
+
async getCustomerValue(request, options) {
|
|
413
|
+
return unwrap(await getCustomerEntitlementValue(this._client, request, options));
|
|
414
|
+
}
|
|
415
|
+
}
|
|
416
|
+
export class InternalGrants {
|
|
417
|
+
_client;
|
|
418
|
+
constructor(_client) {
|
|
419
|
+
this._client = _client;
|
|
420
|
+
}
|
|
421
|
+
/**
|
|
422
|
+
* List grants
|
|
423
|
+
*
|
|
424
|
+
* List the grants of all customers and entitlements. To list the grants of a
|
|
425
|
+
* single entitlement, use the customer entitlement grants endpoint.
|
|
426
|
+
*
|
|
427
|
+
* Deleted grants are excluded unless `include_deleted` is set. Voided and expired
|
|
428
|
+
* grants are always included, as they are part of the balance history.
|
|
429
|
+
*
|
|
430
|
+
* GET /openmeter/grants
|
|
431
|
+
*/
|
|
432
|
+
async list(request, options) {
|
|
433
|
+
return unwrap(await listGrants(this._client, request, options));
|
|
434
|
+
}
|
|
435
|
+
/**
|
|
436
|
+
* List grants
|
|
437
|
+
*
|
|
438
|
+
* List the grants of all customers and entitlements. To list the grants of a
|
|
439
|
+
* single entitlement, use the customer entitlement grants endpoint.
|
|
440
|
+
*
|
|
441
|
+
* Deleted grants are excluded unless `include_deleted` is set. Voided and expired
|
|
442
|
+
* grants are always included, as they are part of the balance history.
|
|
443
|
+
*
|
|
444
|
+
* Iterates every item across all pages, fetching more as the returned iterable is consumed.
|
|
445
|
+
*
|
|
446
|
+
* GET /openmeter/grants
|
|
447
|
+
*/
|
|
448
|
+
listAll(request, options) {
|
|
449
|
+
return paginatePages((req, opts) => listGrants(this._client, req, opts), request ?? {}, options);
|
|
450
|
+
}
|
|
451
|
+
/**
|
|
452
|
+
* Void grant
|
|
453
|
+
*
|
|
454
|
+
* Void a grant so it no longer adds to the balance. Usage already deducted from
|
|
455
|
+
* the grant is kept.
|
|
456
|
+
*
|
|
457
|
+
* DELETE /openmeter/grants/{grantId}
|
|
458
|
+
*/
|
|
459
|
+
async void(request, options) {
|
|
460
|
+
return unwrap(await voidGrant(this._client, request, options));
|
|
461
|
+
}
|
|
462
|
+
}
|
|
463
|
+
export class InternalSubscriptions {
|
|
464
|
+
_client;
|
|
465
|
+
constructor(_client) {
|
|
466
|
+
this._client = _client;
|
|
467
|
+
}
|
|
468
|
+
/**
|
|
469
|
+
* Unschedule subscription
|
|
470
|
+
*
|
|
471
|
+
* Deletes a scheduled subscription that has not yet become active, removing it and
|
|
472
|
+
* resolving any scheduling conflict it was holding. This is distinct from
|
|
473
|
+
* canceling: cancel ends a running subscription, whereas unscheduling removes a
|
|
474
|
+
* not-yet-active one. Only scheduled subscriptions can be unscheduled;
|
|
475
|
+
* unscheduling an active or already-started subscription is rejected.
|
|
476
|
+
*
|
|
477
|
+
* POST /openmeter/subscriptions/{subscriptionId}/unschedule
|
|
478
|
+
*/
|
|
479
|
+
async unschedule(request, options) {
|
|
480
|
+
return unwrap(await unscheduleSubscription(this._client, request, options));
|
|
481
|
+
}
|
|
482
|
+
/**
|
|
483
|
+
* Restore subscription
|
|
484
|
+
*
|
|
485
|
+
* Restores the subscription by deleting any later-scheduled successor
|
|
486
|
+
* subscriptions and continuing this one indefinitely. This is the inverse of a
|
|
487
|
+
* future-dated change, which schedules a successor. Restore is not available when
|
|
488
|
+
* multi-subscription is enabled.
|
|
489
|
+
*
|
|
490
|
+
* POST /openmeter/subscriptions/{subscriptionId}/restore
|
|
491
|
+
*/
|
|
492
|
+
async restore(request, options) {
|
|
493
|
+
return unwrap(await restoreSubscription(this._client, request, options));
|
|
494
|
+
}
|
|
495
|
+
/**
|
|
496
|
+
* Migrate subscription
|
|
497
|
+
*
|
|
498
|
+
* Migrates to a later version of the current plan. With starting_phase omitted and
|
|
499
|
+
* billing_anchor omitted or unchanged, migration amends the subscription in place:
|
|
500
|
+
* unchanged items retain their service periods and both response entries have the
|
|
501
|
+
* same ID. Existing addons must remain compatible with the target plan.
|
|
502
|
+
* Incompatible phase timelines or billing settings return an error. Providing
|
|
503
|
+
* starting_phase or a different billing_anchor explicitly requests replacement,
|
|
504
|
+
* which resets the phase timeline, may produce billing adjustments, and does not
|
|
505
|
+
* transfer addons. Custom subscriptions cannot be migrated.
|
|
506
|
+
*
|
|
507
|
+
* POST /openmeter/subscriptions/{subscriptionId}/migrate
|
|
508
|
+
*/
|
|
509
|
+
async migrate(request, options) {
|
|
510
|
+
return unwrap(await migrateSubscription(this._client, request, options));
|
|
511
|
+
}
|
|
512
|
+
/**
|
|
513
|
+
* Create a new subscription add-on
|
|
514
|
+
*
|
|
515
|
+
* Add add-on to a subscription.
|
|
516
|
+
*
|
|
517
|
+
* POST /openmeter/subscriptions/{subscriptionId}/addons
|
|
518
|
+
*/
|
|
519
|
+
async createAddon(request, options) {
|
|
520
|
+
return unwrap(await createSubscriptionAddon(this._client, request, options));
|
|
521
|
+
}
|
|
522
|
+
/**
|
|
523
|
+
* Update subscription addon
|
|
524
|
+
*
|
|
525
|
+
* Update a subscription add-on. Only the quantity is mutable; the timing controls
|
|
526
|
+
* when the new quantity takes effect. A new entry is appended to the add-on's
|
|
527
|
+
* timeline.
|
|
528
|
+
*
|
|
529
|
+
* PATCH /openmeter/subscriptions/{subscriptionId}/addons/{subscriptionAddonId}
|
|
530
|
+
*/
|
|
531
|
+
async updateAddon(request, options) {
|
|
532
|
+
return unwrap(await updateSubscriptionAddon(this._client, request, options));
|
|
533
|
+
}
|
|
534
|
+
}
|
|
535
|
+
export class InternalApps {
|
|
536
|
+
_client;
|
|
537
|
+
constructor(_client) {
|
|
538
|
+
this._client = _client;
|
|
92
539
|
}
|
|
93
540
|
/**
|
|
94
541
|
* Uninstall app
|
|
@@ -296,6 +743,40 @@ export class InternalInvoices {
|
|
|
296
743
|
return unwrap(await snapshotQuantitiesInvoice(this._client, request, options));
|
|
297
744
|
}
|
|
298
745
|
}
|
|
746
|
+
export class InternalCharges {
|
|
747
|
+
_client;
|
|
748
|
+
constructor(_client) {
|
|
749
|
+
this._client = _client;
|
|
750
|
+
}
|
|
751
|
+
/**
|
|
752
|
+
* List charges
|
|
753
|
+
*
|
|
754
|
+
* List charges.
|
|
755
|
+
*
|
|
756
|
+
* Returns the charges of every customer that are represented as either flat fee or
|
|
757
|
+
* usage-based charges.
|
|
758
|
+
*
|
|
759
|
+
* GET /openmeter/charges
|
|
760
|
+
*/
|
|
761
|
+
async list(request, options) {
|
|
762
|
+
return unwrap(await listCharges(this._client, request, options));
|
|
763
|
+
}
|
|
764
|
+
/**
|
|
765
|
+
* List charges
|
|
766
|
+
*
|
|
767
|
+
* List charges.
|
|
768
|
+
*
|
|
769
|
+
* Returns the charges of every customer that are represented as either flat fee or
|
|
770
|
+
* usage-based charges.
|
|
771
|
+
*
|
|
772
|
+
* Iterates every item across all pages, fetching more as the returned iterable is consumed.
|
|
773
|
+
*
|
|
774
|
+
* GET /openmeter/charges
|
|
775
|
+
*/
|
|
776
|
+
listAll(request, options) {
|
|
777
|
+
return paginatePages((req, opts) => listCharges(this._client, req, opts), request ?? {}, options);
|
|
778
|
+
}
|
|
779
|
+
}
|
|
299
780
|
export class InternalCurrencies {
|
|
300
781
|
_client;
|
|
301
782
|
constructor(_client) {
|
|
@@ -379,13 +860,41 @@ export class InternalCurrencies {
|
|
|
379
860
|
return unwrap(await createCostBasis(this._client, request, options));
|
|
380
861
|
}
|
|
381
862
|
}
|
|
382
|
-
export class
|
|
863
|
+
export class InternalPlanAddons {
|
|
864
|
+
_client;
|
|
865
|
+
constructor(_client) {
|
|
866
|
+
this._client = _client;
|
|
867
|
+
}
|
|
868
|
+
/**
|
|
869
|
+
* List add-ons for plan
|
|
870
|
+
*
|
|
871
|
+
* List add-ons associated with a plan.
|
|
872
|
+
*
|
|
873
|
+
* GET /openmeter/plans/{planId}/addons
|
|
874
|
+
*/
|
|
875
|
+
async list(request, options) {
|
|
876
|
+
return unwrap(await listPlanAddons(this._client, request, options));
|
|
877
|
+
}
|
|
878
|
+
/**
|
|
879
|
+
* List add-ons for plan
|
|
880
|
+
*
|
|
881
|
+
* List add-ons associated with a plan.
|
|
882
|
+
*
|
|
883
|
+
* Iterates every item across all pages, fetching more as the returned iterable is consumed.
|
|
884
|
+
*
|
|
885
|
+
* GET /openmeter/plans/{planId}/addons
|
|
886
|
+
*/
|
|
887
|
+
listAll(request, options) {
|
|
888
|
+
return paginatePages((req, opts) => listPlanAddons(this._client, req, opts), request, options);
|
|
889
|
+
}
|
|
890
|
+
}
|
|
891
|
+
export class InternalEntitlementAccess {
|
|
383
892
|
_client;
|
|
384
893
|
constructor(_client) {
|
|
385
894
|
this._client = _client;
|
|
386
895
|
}
|
|
387
896
|
/**
|
|
388
|
-
* Query
|
|
897
|
+
* Query entitlement access
|
|
389
898
|
*
|
|
390
899
|
* Query feature access for a list of customers.
|
|
391
900
|
*
|
|
@@ -396,9 +905,77 @@ export class InternalGovernance {
|
|
|
396
905
|
* _Designed to be called on a fixed refresh interval and the query response is
|
|
397
906
|
* intended to be cached._
|
|
398
907
|
*
|
|
399
|
-
* POST /openmeter/
|
|
908
|
+
* POST /openmeter/entitlement-access/query
|
|
909
|
+
*/
|
|
910
|
+
async query(request, options) {
|
|
911
|
+
return unwrap(await queryEntitlementAccess(this._client, request, options));
|
|
912
|
+
}
|
|
913
|
+
}
|
|
914
|
+
export class InternalNotifications {
|
|
915
|
+
_client;
|
|
916
|
+
constructor(_client) {
|
|
917
|
+
this._client = _client;
|
|
918
|
+
}
|
|
919
|
+
/**
|
|
920
|
+
* List notification channels
|
|
921
|
+
*
|
|
922
|
+
* List all notification channels.
|
|
923
|
+
*
|
|
924
|
+
* GET /openmeter/notification/channels
|
|
925
|
+
*/
|
|
926
|
+
async listChannels(request, options) {
|
|
927
|
+
return unwrap(await listNotificationChannels(this._client, request, options));
|
|
928
|
+
}
|
|
929
|
+
/**
|
|
930
|
+
* List notification channels
|
|
931
|
+
*
|
|
932
|
+
* List all notification channels.
|
|
933
|
+
*
|
|
934
|
+
* Iterates every item across all pages, fetching more as the returned iterable is consumed.
|
|
935
|
+
*
|
|
936
|
+
* GET /openmeter/notification/channels
|
|
937
|
+
*/
|
|
938
|
+
listChannelsAll(request, options) {
|
|
939
|
+
return paginatePages((req, opts) => listNotificationChannels(this._client, req, opts), request ?? {}, options);
|
|
940
|
+
}
|
|
941
|
+
/**
|
|
942
|
+
* Create notification channel
|
|
943
|
+
*
|
|
944
|
+
* Create a notification channel.
|
|
945
|
+
*
|
|
946
|
+
* POST /openmeter/notification/channels
|
|
947
|
+
*/
|
|
948
|
+
async createChannel(request, options) {
|
|
949
|
+
return unwrap(await createNotificationChannel(this._client, request, options));
|
|
950
|
+
}
|
|
951
|
+
/**
|
|
952
|
+
* Get notification channel
|
|
953
|
+
*
|
|
954
|
+
* Get a notification channel by id.
|
|
955
|
+
*
|
|
956
|
+
* GET /openmeter/notification/channels/{notificationChannelId}
|
|
957
|
+
*/
|
|
958
|
+
async getChannel(request, options) {
|
|
959
|
+
return unwrap(await getNotificationChannel(this._client, request, options));
|
|
960
|
+
}
|
|
961
|
+
/**
|
|
962
|
+
* Update notification channel
|
|
963
|
+
*
|
|
964
|
+
* Update a notification channel by id.
|
|
965
|
+
*
|
|
966
|
+
* PUT /openmeter/notification/channels/{notificationChannelId}
|
|
967
|
+
*/
|
|
968
|
+
async updateChannel(request, options) {
|
|
969
|
+
return unwrap(await updateNotificationChannel(this._client, request, options));
|
|
970
|
+
}
|
|
971
|
+
/**
|
|
972
|
+
* Delete notification channel
|
|
973
|
+
*
|
|
974
|
+
* Delete a notification channel by id.
|
|
975
|
+
*
|
|
976
|
+
* DELETE /openmeter/notification/channels/{notificationChannelId}
|
|
400
977
|
*/
|
|
401
|
-
async
|
|
402
|
-
return unwrap(await
|
|
978
|
+
async deleteChannel(request, options) {
|
|
979
|
+
return unwrap(await deleteNotificationChannel(this._client, request, options));
|
|
403
980
|
}
|
|
404
981
|
}
|