@openmeter/client 1.0.0-beta.233 → 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 +52 -14
- 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 +3 -1
- 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 +6549 -2716
- package/dist/models/schemas.js +1795 -360
- package/dist/models/types.d.ts +1175 -228
- package/dist/sdk/apps.d.ts +20 -1
- package/dist/sdk/apps.js +24 -1
- package/dist/sdk/entitlements.d.ts +1 -9
- package/dist/sdk/entitlements.js +1 -11
- package/dist/sdk/internal.d.ts +324 -22
- package/dist/sdk/internal.js +397 -25
- package/dist/sdk/notifications.d.ts +58 -0
- package/dist/sdk/notifications.js +72 -0
- package/dist/sdk/subscriptions.d.ts +1 -9
- package/dist/sdk/subscriptions.js +1 -11
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -36,6 +36,8 @@ TypeSpec definitions and ships fully-typed request and response models.
|
|
|
36
36
|
- [Defaults](#defaults)
|
|
37
37
|
- [Internal Operations](#internal-operations)
|
|
38
38
|
- [Internal Customers](#internal-customers)
|
|
39
|
+
- [Internal Entitlements](#internal-entitlements)
|
|
40
|
+
- [Internal Grants](#internal-grants)
|
|
39
41
|
- [Internal Subscriptions](#internal-subscriptions)
|
|
40
42
|
- [Internal Apps](#internal-apps)
|
|
41
43
|
- [Internal Invoices](#internal-invoices)
|
|
@@ -43,6 +45,7 @@ TypeSpec definitions and ships fully-typed request and response models.
|
|
|
43
45
|
- [Internal Currencies](#internal-currencies)
|
|
44
46
|
- [Internal PlanAddons](#internal-planaddons)
|
|
45
47
|
- [Internal EntitlementAccess](#internal-entitlementaccess)
|
|
48
|
+
- [Internal Notifications](#internal-notifications)
|
|
46
49
|
- [Runtime Validation (validate option)](#runtime-validation-validate-option)
|
|
47
50
|
- [Zod Schemas (./zod export)](#zod-schemas-zod-export)
|
|
48
51
|
- [Error Handling](#error-handling)
|
|
@@ -305,10 +308,9 @@ The full call path, HTTP route, and a short description are listed below.
|
|
|
305
308
|
|
|
306
309
|
### Entitlements
|
|
307
310
|
|
|
308
|
-
| Method | HTTP
|
|
309
|
-
| ---------------------------------------- |
|
|
310
|
-
| `client.entitlements.listCustomerAccess` | `GET /openmeter/customers/{customerId}/entitlement-access`
|
|
311
|
-
| `client.entitlements.getCustomerAccess` | `GET /openmeter/customers/{customerId}/entitlement-access/features/{featureKey}` | Get the customer's access to a single feature. |
|
|
311
|
+
| Method | HTTP | Description |
|
|
312
|
+
| ---------------------------------------- | ---------------------------------------------------------- | -------------------------------- |
|
|
313
|
+
| `client.entitlements.listCustomerAccess` | `GET /openmeter/customers/{customerId}/entitlement-access` | List customer entitlement access |
|
|
312
314
|
|
|
313
315
|
### Subscriptions
|
|
314
316
|
|
|
@@ -321,15 +323,15 @@ The full call path, HTTP route, and a short description are listed below.
|
|
|
321
323
|
| `client.subscriptions.unscheduleCancelation` | `POST /openmeter/subscriptions/{subscriptionId}/unschedule-cancelation` | Unschedules the subscription cancelation. |
|
|
322
324
|
| `client.subscriptions.change` | `POST /openmeter/subscriptions/{subscriptionId}/change` | Closes a running subscription and starts a new one according to the specification. Can be used for upgrades, downgrades, and plan changes. |
|
|
323
325
|
| `client.subscriptions.edit` | `POST /openmeter/subscriptions/{subscriptionId}/edit` | Edits a running subscription by applying an ordered batch of customizations (adding or removing items, adding, removing, or stretching phases, or unscheduling a pending edit). The changes may take effect immediately or at the next billing cycle. Subscriptions that have add-ons cannot be edited. |
|
|
324
|
-
| `client.subscriptions.createAddon` | `POST /openmeter/subscriptions/{subscriptionId}/addons` | Add add-on to a subscription. |
|
|
325
326
|
| `client.subscriptions.listAddons` | `GET /openmeter/subscriptions/{subscriptionId}/addons` | List the add-ons of a subscription. |
|
|
326
327
|
| `client.subscriptions.getAddon` | `GET /openmeter/subscriptions/{subscriptionId}/addons/{subscriptionAddonId}` | Get an add-on association for a subscription. |
|
|
327
328
|
|
|
328
329
|
### Apps
|
|
329
330
|
|
|
330
|
-
| Method
|
|
331
|
-
|
|
|
332
|
-
| `client.apps.
|
|
331
|
+
| Method | HTTP | Description |
|
|
332
|
+
| ------------------ | ----------------------------- | --------------------- |
|
|
333
|
+
| `client.apps.list` | `GET /openmeter/apps` | List installed apps. |
|
|
334
|
+
| `client.apps.get` | `GET /openmeter/apps/{appId}` | Get an installed app. |
|
|
333
335
|
|
|
334
336
|
### Billing
|
|
335
337
|
|
|
@@ -421,11 +423,37 @@ they can change or be removed without notice or semver consideration.
|
|
|
421
423
|
|
|
422
424
|
### Internal Customers
|
|
423
425
|
|
|
424
|
-
| Method
|
|
425
|
-
|
|
|
426
|
-
| `client.internal.customers.
|
|
427
|
-
| `client.internal.customers.
|
|
428
|
-
| `client.internal.customers.
|
|
426
|
+
| Method | HTTP | Description |
|
|
427
|
+
| ------------------------------------------------------ | ----------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
428
|
+
| `client.internal.customers.entitlements.create` | `POST /openmeter/customers/{customerId}/entitlements` | Create an entitlement for the customer. A customer can have only one active entitlement per feature. The feature must be compatible with the entitlement type. Entitlements cannot be modified after creation, only deleted. |
|
|
429
|
+
| `client.internal.customers.entitlements.override` | `PUT /openmeter/customers/{customerId}/entitlements/{entitlementId}/override` | Override an entitlement of the customer with a new one. The referenced entitlement ends and the new one starts at the same instant, so access continues without a gap. Both must belong to the same feature. Use this for upgrades and downgrades. Fails if the referenced entitlement does not exist, is deleted, or is no longer active. |
|
|
430
|
+
| `client.internal.customers.entitlements.getHistory` | `GET /openmeter/customers/{customerId}/entitlements/{entitlementId}/history` | Get the balance and usage history of a metered entitlement. The queried range may span multiple usage periods. `windowed_history` groups usage into windows of the requested size and reports the balance at the start of each window. `burndown_history` lists the periods in which grants were consumed in a fixed order, together with the usage taken from each grant. |
|
|
431
|
+
| `client.internal.customers.entitlements.get` | `GET /openmeter/customers/{customerId}/entitlements/{entitlementId}` | Get an entitlement of the customer by ID. For checking entitlement access, use the entitlement access endpoints instead. |
|
|
432
|
+
| `client.internal.customers.entitlements.list` | `GET /openmeter/customers/{customerId}/entitlements` | List the entitlements of the customer that are active at the time of the request. For checking entitlement access, use the entitlement access endpoints instead. |
|
|
433
|
+
| `client.internal.customers.entitlements.resetUsage` | `POST /openmeter/customers/{customerId}/entitlements/{entitlementId}/reset` | Reset the usage of a metered entitlement. The reset starts a new usage period: usage is zeroed and grants roll over according to their rollover settings. Usage is reset automatically at the end of each usage period. Use this operation to reset it earlier, for example to align the entitlement with the customer's billing period. The usage period anchor can be moved at the same time. |
|
|
434
|
+
| `client.internal.customers.entitlements.delete` | `DELETE /openmeter/customers/{customerId}/entitlements/{entitlementId}` | Deletes the entitlement and revokes access to its feature. A customer can hold only one active entitlement per feature, so migrating a feature requires deleting the previous entitlement first. Deletion sets the `deleted_at` timestamp instead of removing history. Access and status queries for earlier points in time still treat the entitlement as active, so access changes are never retroactive. |
|
|
435
|
+
| `client.internal.customers.entitlements.grants.create` | `POST /openmeter/customers/{customerId}/entitlements/{entitlementId}/grants` | Issue a grant for a metered entitlement of the customer. Boolean and static entitlements cannot have grants, so the request is rejected for them. Grants are immutable. The amount is added to the balance from `effective_at`, which cannot be earlier than the start of the current usage period. |
|
|
436
|
+
| `client.internal.customers.entitlements.grants.list` | `GET /openmeter/customers/{customerId}/entitlements/{entitlementId}/grants` | List the grants issued for an entitlement of the customer. Grants only exist for metered entitlements, so the list is empty for boolean and static entitlements. Deleted grants are excluded unless `include_deleted` is set. Voided and expired grants are always included, as they are part of the balance history. |
|
|
437
|
+
| `client.internal.customers.credits.grants.void` | `POST /openmeter/customers/{customerId}/credits/grants/{creditGrantId}/void` | Void a credit grant, forfeiting the remaining unused balance. Voiding is a forward-looking, irreversible operation. Credits already consumed by usage remain unaffected — only the remaining balance is forfeited. The grant reads as `voided` status afterwards. Payment state is not adjusted when `payment_adjustment` is `none`, so invoice-backed or externally collected payments may still collect the original amount. Only `active` grants can be voided; voiding a pending, expired, or fully consumed grant returns a conflict. Retrying a successful void is an idempotent success. |
|
|
438
|
+
| `client.internal.customers.charges.list` | `GET /openmeter/customers/{customerId}/charges` | List customer charges. Returns the customer's charges that are represented as either flat fee or usage-based charges. |
|
|
439
|
+
| `client.internal.customers.charges.create` | `POST /openmeter/customers/{customerId}/charges` | Create customer charge. |
|
|
440
|
+
|
|
441
|
+
### Internal Entitlements
|
|
442
|
+
|
|
443
|
+
| Method | HTTP | Description |
|
|
444
|
+
| ----------------------------------------------------------- | -------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
|
|
445
|
+
| `client.internal.entitlements.getCustomerAccess` | `GET /openmeter/customers/{customerId}/entitlement-access/features/{featureKey}` | Get the customer's access to a single feature. |
|
|
446
|
+
| `client.internal.entitlements.getCustomerValueByFeatureKey` | `GET /openmeter/customers/{customerId}/entitlement-access/features/{featureKey}/value` | Get the customer's entitlement value for a feature at a point in time. Without an active entitlement, the result denies access and omits the type. |
|
|
447
|
+
| `client.internal.entitlements.list` | `GET /openmeter/entitlements` | List the active entitlements of all customers. Intended for administrative use. To list the entitlements of a single customer, use the customer entitlements endpoints; to check entitlement access, use the entitlement access endpoints. |
|
|
448
|
+
| `client.internal.entitlements.get` | `GET /openmeter/entitlements/{entitlementId}` | Get an entitlement by ID. To check entitlement access, use the entitlement access endpoints instead. |
|
|
449
|
+
| `client.internal.entitlements.getCustomerValue` | `GET /openmeter/customers/{customerId}/entitlements/{entitlementId}/value` | Get the customer's access through a single entitlement, optionally evaluated at a point in time. |
|
|
450
|
+
|
|
451
|
+
### Internal Grants
|
|
452
|
+
|
|
453
|
+
| Method | HTTP | Description |
|
|
454
|
+
| ----------------------------- | ------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
455
|
+
| `client.internal.grants.list` | `GET /openmeter/grants` | List the grants of all customers and entitlements. To list the grants of a single entitlement, use the customer entitlement grants endpoint. Deleted grants are excluded unless `include_deleted` is set. Voided and expired grants are always included, as they are part of the balance history. |
|
|
456
|
+
| `client.internal.grants.void` | `DELETE /openmeter/grants/{grantId}` | Void a grant so it no longer adds to the balance. Usage already deducted from the grant is kept. |
|
|
429
457
|
|
|
430
458
|
### Internal Subscriptions
|
|
431
459
|
|
|
@@ -434,13 +462,13 @@ they can change or be removed without notice or semver consideration.
|
|
|
434
462
|
| `client.internal.subscriptions.unschedule` | `POST /openmeter/subscriptions/{subscriptionId}/unschedule` | Deletes a scheduled subscription that has not yet become active, removing it and resolving any scheduling conflict it was holding. This is distinct from canceling: cancel ends a running subscription, whereas unscheduling removes a not-yet-active one. Only scheduled subscriptions can be unscheduled; unscheduling an active or already-started subscription is rejected. |
|
|
435
463
|
| `client.internal.subscriptions.restore` | `POST /openmeter/subscriptions/{subscriptionId}/restore` | Restores the subscription by deleting any later-scheduled successor subscriptions and continuing this one indefinitely. This is the inverse of a future-dated change, which schedules a successor. Restore is not available when multi-subscription is enabled. |
|
|
436
464
|
| `client.internal.subscriptions.migrate` | `POST /openmeter/subscriptions/{subscriptionId}/migrate` | Migrates to a later version of the current plan. With starting_phase omitted and billing_anchor omitted or unchanged, migration amends the subscription in place: unchanged items retain their service periods and both response entries have the same ID. Existing addons must remain compatible with the target plan. Incompatible phase timelines or billing settings return an error. Providing starting_phase or a different billing_anchor explicitly requests replacement, which resets the phase timeline, may produce billing adjustments, and does not transfer addons. Custom subscriptions cannot be migrated. |
|
|
465
|
+
| `client.internal.subscriptions.createAddon` | `POST /openmeter/subscriptions/{subscriptionId}/addons` | Add add-on to a subscription. |
|
|
437
466
|
| `client.internal.subscriptions.updateAddon` | `PATCH /openmeter/subscriptions/{subscriptionId}/addons/{subscriptionAddonId}` | Update a subscription add-on. Only the quantity is mutable; the timing controls when the new quantity takes effect. A new entry is appended to the add-on's timeline. |
|
|
438
467
|
|
|
439
468
|
### Internal Apps
|
|
440
469
|
|
|
441
470
|
| Method | HTTP | Description |
|
|
442
471
|
| ------------------------------------- | -------------------------------------- | -------------------------------- |
|
|
443
|
-
| `client.internal.apps.list` | `GET /openmeter/apps` | List installed apps. |
|
|
444
472
|
| `client.internal.apps.uninstall` | `DELETE /openmeter/apps/{appId}` | Uninstall an app by ID. |
|
|
445
473
|
| `client.internal.apps.update` | `PUT /openmeter/apps/{appId}` | Update an installed app. |
|
|
446
474
|
| `client.internal.apps.listCatalog` | `GET /openmeter/app-catalog` | List available apps. |
|
|
@@ -488,6 +516,16 @@ they can change or be removed without notice or semver consideration.
|
|
|
488
516
|
| ----------------------------------------- | ------------------------------------------ | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
489
517
|
| `client.internal.entitlementAccess.query` | `POST /openmeter/entitlement-access/query` | Query feature access for a list of customers. The endpoint resolves each provided identifier to a customer and returns the access status for the requested features, plus optional credit balance availability. _Designed to be called on a fixed refresh interval and the query response is intended to be cached._ |
|
|
490
518
|
|
|
519
|
+
### Internal Notifications
|
|
520
|
+
|
|
521
|
+
| Method | HTTP | Description |
|
|
522
|
+
| --------------------------------------------- | ----------------------------------------------------------------- | ------------------------------------ |
|
|
523
|
+
| `client.internal.notifications.listChannels` | `GET /openmeter/notification/channels` | List all notification channels. |
|
|
524
|
+
| `client.internal.notifications.createChannel` | `POST /openmeter/notification/channels` | Create a notification channel. |
|
|
525
|
+
| `client.internal.notifications.getChannel` | `GET /openmeter/notification/channels/{notificationChannelId}` | Get a notification channel by id. |
|
|
526
|
+
| `client.internal.notifications.updateChannel` | `PUT /openmeter/notification/channels/{notificationChannelId}` | Update a notification channel by id. |
|
|
527
|
+
| `client.internal.notifications.deleteChannel` | `DELETE /openmeter/notification/channels/{notificationChannelId}` | Delete a notification channel by id. |
|
|
528
|
+
|
|
491
529
|
## Runtime Validation (validate option)
|
|
492
530
|
|
|
493
531
|
`validate` is off by default. The SDK's normal request/response mapping
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { type Client } from '../core.js';
|
|
2
2
|
import { type Result, type RequestOptions } from '../lib/types.js';
|
|
3
|
-
import type { CreateCustomerRequest, CreateCustomerResponse, GetCustomerRequest, GetCustomerResponse, ListCustomersRequest, ListCustomersResponse, UpsertCustomerRequest, UpsertCustomerResponse, DeleteCustomerRequest, DeleteCustomerResponse, GetCustomerBillingRequest, GetCustomerBillingResponse, UpdateCustomerBillingRequest, UpdateCustomerBillingResponse, UpdateCustomerBillingAppDataRequest, UpdateCustomerBillingAppDataResponse, CreateCustomerStripeCheckoutSessionRequest, CreateCustomerStripeCheckoutSessionResponse, CreateCustomerStripePortalSessionRequest, CreateCustomerStripePortalSessionResponse, CreateCreditGrantRequest, CreateCreditGrantResponse, GetCreditGrantRequest, GetCreditGrantResponse, ListCreditGrantsRequest, ListCreditGrantsResponse, GetCustomerCreditBalanceRequest, GetCustomerCreditBalanceResponse, CreateCreditAdjustmentRequest, CreateCreditAdjustmentResponse, VoidCreditGrantRequest, VoidCreditGrantResponse, UpdateCreditGrantExternalSettlementRequest, UpdateCreditGrantExternalSettlementResponse, ListCreditTransactionsRequest, ListCreditTransactionsResponse, ListCustomerChargesRequest, ListCustomerChargesResponse, CreateCustomerChargesRequest, CreateCustomerChargesResponse } from '../models/operations/customers.js';
|
|
3
|
+
import type { CreateCustomerRequest, CreateCustomerResponse, GetCustomerRequest, GetCustomerResponse, ListCustomersRequest, ListCustomersResponse, UpsertCustomerRequest, UpsertCustomerResponse, DeleteCustomerRequest, DeleteCustomerResponse, GetCustomerBillingRequest, GetCustomerBillingResponse, UpdateCustomerBillingRequest, UpdateCustomerBillingResponse, UpdateCustomerBillingAppDataRequest, UpdateCustomerBillingAppDataResponse, CreateCustomerStripeCheckoutSessionRequest, CreateCustomerStripeCheckoutSessionResponse, CreateCustomerStripePortalSessionRequest, CreateCustomerStripePortalSessionResponse, CreateCustomerEntitlementRequest, CreateCustomerEntitlementResponse, OverrideCustomerEntitlementRequest, OverrideCustomerEntitlementResponse, GetCustomerEntitlementHistoryRequest, GetCustomerEntitlementHistoryResponse, GetCustomerEntitlementRequest, GetCustomerEntitlementResponse, ListCustomerEntitlementsRequest, ListCustomerEntitlementsResponse, ResetCustomerEntitlementUsageRequest, ResetCustomerEntitlementUsageResponse, DeleteCustomerEntitlementRequest, DeleteCustomerEntitlementResponse, CreateCustomerEntitlementGrantRequest, CreateCustomerEntitlementGrantResponse, ListCustomerEntitlementGrantsRequest, ListCustomerEntitlementGrantsResponse, CreateCreditGrantRequest, CreateCreditGrantResponse, GetCreditGrantRequest, GetCreditGrantResponse, ListCreditGrantsRequest, ListCreditGrantsResponse, GetCustomerCreditBalanceRequest, GetCustomerCreditBalanceResponse, CreateCreditAdjustmentRequest, CreateCreditAdjustmentResponse, VoidCreditGrantRequest, VoidCreditGrantResponse, UpdateCreditGrantExternalSettlementRequest, UpdateCreditGrantExternalSettlementResponse, ListCreditTransactionsRequest, ListCreditTransactionsResponse, ListCustomerChargesRequest, ListCustomerChargesResponse, CreateCustomerChargesRequest, CreateCustomerChargesResponse } from '../models/operations/customers.js';
|
|
4
4
|
/**
|
|
5
5
|
* Create customer
|
|
6
6
|
*
|
|
@@ -80,6 +80,117 @@ export declare function createCustomerStripeCheckoutSession(client: Client, req:
|
|
|
80
80
|
* POST /openmeter/customers/{customerId}/billing/stripe/portal-sessions
|
|
81
81
|
*/
|
|
82
82
|
export declare function createCustomerStripePortalSession(client: Client, req: CreateCustomerStripePortalSessionRequest, options?: RequestOptions): Promise<Result<CreateCustomerStripePortalSessionResponse>>;
|
|
83
|
+
/**
|
|
84
|
+
* Create customer entitlement
|
|
85
|
+
*
|
|
86
|
+
* Create an entitlement for the customer.
|
|
87
|
+
*
|
|
88
|
+
* A customer can have only one active entitlement per feature. The feature must be
|
|
89
|
+
* compatible with the entitlement type. Entitlements cannot be modified after
|
|
90
|
+
* creation, only deleted.
|
|
91
|
+
*
|
|
92
|
+
* POST /openmeter/customers/{customerId}/entitlements
|
|
93
|
+
*/
|
|
94
|
+
export declare function createCustomerEntitlement(client: Client, req: CreateCustomerEntitlementRequest, options?: RequestOptions): Promise<Result<CreateCustomerEntitlementResponse>>;
|
|
95
|
+
/**
|
|
96
|
+
* Override customer entitlement
|
|
97
|
+
*
|
|
98
|
+
* Override an entitlement of the customer with a new one.
|
|
99
|
+
*
|
|
100
|
+
* The referenced entitlement ends and the new one starts at the same instant, so
|
|
101
|
+
* access continues without a gap. Both must belong to the same feature. Use this
|
|
102
|
+
* for upgrades and downgrades.
|
|
103
|
+
*
|
|
104
|
+
* Fails if the referenced entitlement does not exist, is deleted, or is no longer
|
|
105
|
+
* active.
|
|
106
|
+
*
|
|
107
|
+
* PUT /openmeter/customers/{customerId}/entitlements/{entitlementId}/override
|
|
108
|
+
*/
|
|
109
|
+
export declare function overrideCustomerEntitlement(client: Client, req: OverrideCustomerEntitlementRequest, options?: RequestOptions): Promise<Result<OverrideCustomerEntitlementResponse>>;
|
|
110
|
+
/**
|
|
111
|
+
* Get customer entitlement history
|
|
112
|
+
*
|
|
113
|
+
* Get the balance and usage history of a metered entitlement. The queried range
|
|
114
|
+
* may span multiple usage periods.
|
|
115
|
+
*
|
|
116
|
+
* `windowed_history` groups usage into windows of the requested size and reports
|
|
117
|
+
* the balance at the start of each window. `burndown_history` lists the periods in
|
|
118
|
+
* which grants were consumed in a fixed order, together with the usage taken from
|
|
119
|
+
* each grant.
|
|
120
|
+
*
|
|
121
|
+
* GET /openmeter/customers/{customerId}/entitlements/{entitlementId}/history
|
|
122
|
+
*/
|
|
123
|
+
export declare function getCustomerEntitlementHistory(client: Client, req: GetCustomerEntitlementHistoryRequest, options?: RequestOptions): Promise<Result<GetCustomerEntitlementHistoryResponse>>;
|
|
124
|
+
/**
|
|
125
|
+
* Get customer entitlement
|
|
126
|
+
*
|
|
127
|
+
* Get an entitlement of the customer by ID. For checking entitlement access, use
|
|
128
|
+
* the entitlement access endpoints instead.
|
|
129
|
+
*
|
|
130
|
+
* GET /openmeter/customers/{customerId}/entitlements/{entitlementId}
|
|
131
|
+
*/
|
|
132
|
+
export declare function getCustomerEntitlement(client: Client, req: GetCustomerEntitlementRequest, options?: RequestOptions): Promise<Result<GetCustomerEntitlementResponse>>;
|
|
133
|
+
/**
|
|
134
|
+
* List customer entitlements
|
|
135
|
+
*
|
|
136
|
+
* List the entitlements of the customer that are active at the time of the
|
|
137
|
+
* request. For checking entitlement access, use the entitlement access endpoints
|
|
138
|
+
* instead.
|
|
139
|
+
*
|
|
140
|
+
* GET /openmeter/customers/{customerId}/entitlements
|
|
141
|
+
*/
|
|
142
|
+
export declare function listCustomerEntitlements(client: Client, req: ListCustomerEntitlementsRequest, options?: RequestOptions): Promise<Result<ListCustomerEntitlementsResponse>>;
|
|
143
|
+
/**
|
|
144
|
+
* Reset customer entitlement usage
|
|
145
|
+
*
|
|
146
|
+
* Reset the usage of a metered entitlement. The reset starts a new usage period:
|
|
147
|
+
* usage is zeroed and grants roll over according to their rollover settings.
|
|
148
|
+
*
|
|
149
|
+
* Usage is reset automatically at the end of each usage period. Use this operation
|
|
150
|
+
* to reset it earlier, for example to align the entitlement with the customer's
|
|
151
|
+
* billing period. The usage period anchor can be moved at the same time.
|
|
152
|
+
*
|
|
153
|
+
* POST /openmeter/customers/{customerId}/entitlements/{entitlementId}/reset
|
|
154
|
+
*/
|
|
155
|
+
export declare function resetCustomerEntitlementUsage(client: Client, req: ResetCustomerEntitlementUsageRequest, options?: RequestOptions): Promise<Result<ResetCustomerEntitlementUsageResponse>>;
|
|
156
|
+
/**
|
|
157
|
+
* Delete customer entitlement
|
|
158
|
+
*
|
|
159
|
+
* Deletes the entitlement and revokes access to its feature. A customer can hold
|
|
160
|
+
* only one active entitlement per feature, so migrating a feature requires
|
|
161
|
+
* deleting the previous entitlement first.
|
|
162
|
+
*
|
|
163
|
+
* Deletion sets the `deleted_at` timestamp instead of removing history. Access and
|
|
164
|
+
* status queries for earlier points in time still treat the entitlement as active,
|
|
165
|
+
* so access changes are never retroactive.
|
|
166
|
+
*
|
|
167
|
+
* DELETE /openmeter/customers/{customerId}/entitlements/{entitlementId}
|
|
168
|
+
*/
|
|
169
|
+
export declare function deleteCustomerEntitlement(client: Client, req: DeleteCustomerEntitlementRequest, options?: RequestOptions): Promise<Result<DeleteCustomerEntitlementResponse>>;
|
|
170
|
+
/**
|
|
171
|
+
* Create customer entitlement grant
|
|
172
|
+
*
|
|
173
|
+
* Issue a grant for a metered entitlement of the customer. Boolean and static
|
|
174
|
+
* entitlements cannot have grants, so the request is rejected for them.
|
|
175
|
+
*
|
|
176
|
+
* Grants are immutable. The amount is added to the balance from `effective_at`,
|
|
177
|
+
* which cannot be earlier than the start of the current usage period.
|
|
178
|
+
*
|
|
179
|
+
* POST /openmeter/customers/{customerId}/entitlements/{entitlementId}/grants
|
|
180
|
+
*/
|
|
181
|
+
export declare function createCustomerEntitlementGrant(client: Client, req: CreateCustomerEntitlementGrantRequest, options?: RequestOptions): Promise<Result<CreateCustomerEntitlementGrantResponse>>;
|
|
182
|
+
/**
|
|
183
|
+
* List customer entitlement grants
|
|
184
|
+
*
|
|
185
|
+
* List the grants issued for an entitlement of the customer. Grants only exist for
|
|
186
|
+
* metered entitlements, so the list is empty for boolean and static entitlements.
|
|
187
|
+
*
|
|
188
|
+
* Deleted grants are excluded unless `include_deleted` is set. Voided and expired
|
|
189
|
+
* grants are always included, as they are part of the balance history.
|
|
190
|
+
*
|
|
191
|
+
* GET /openmeter/customers/{customerId}/entitlements/{entitlementId}/grants
|
|
192
|
+
*/
|
|
193
|
+
export declare function listCustomerEntitlementGrants(client: Client, req: ListCustomerEntitlementGrantsRequest, options?: RequestOptions): Promise<Result<ListCustomerEntitlementGrantsResponse>>;
|
|
83
194
|
/**
|
|
84
195
|
* Create a new credit grant
|
|
85
196
|
*
|