@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.
Files changed (60) hide show
  1. package/README.md +112 -43
  2. package/dist/funcs/apps.js +7 -2
  3. package/dist/funcs/billing.js +7 -2
  4. package/dist/funcs/charges.d.ts +14 -0
  5. package/dist/funcs/charges.js +42 -0
  6. package/dist/funcs/customers.d.ts +112 -1
  7. package/dist/funcs/customers.js +430 -0
  8. package/dist/funcs/{governance.d.ts → entitlementAccess.d.ts} +4 -4
  9. package/dist/funcs/{governance.js → entitlementAccess.js} +10 -10
  10. package/dist/funcs/entitlements.d.ts +46 -1
  11. package/dist/funcs/entitlements.js +213 -1
  12. package/dist/funcs/grants.d.ts +24 -0
  13. package/dist/funcs/grants.js +78 -0
  14. package/dist/funcs/index.d.ts +4 -1
  15. package/dist/funcs/index.js +4 -1
  16. package/dist/funcs/notifications.d.ts +43 -0
  17. package/dist/funcs/notifications.js +163 -0
  18. package/dist/funcs/planAddons.js +7 -2
  19. package/dist/funcs/subscriptions.d.ts +60 -1
  20. package/dist/funcs/subscriptions.js +204 -0
  21. package/dist/index.d.ts +6 -2
  22. package/dist/index.js +1 -0
  23. package/dist/lib/version.d.ts +1 -1
  24. package/dist/lib/version.js +1 -1
  25. package/dist/lib/wire.js +62 -6
  26. package/dist/models/operations/apps.d.ts +17 -1
  27. package/dist/models/operations/billing.d.ts +19 -1
  28. package/dist/models/operations/charges.d.ts +54 -0
  29. package/dist/models/operations/customers.d.ts +127 -5
  30. package/dist/models/operations/entitlementAccess.d.ts +9 -0
  31. package/dist/models/operations/entitlementAccess.js +2 -0
  32. package/dist/models/operations/entitlements.d.ts +73 -1
  33. package/dist/models/operations/grants.d.ts +43 -0
  34. package/dist/models/operations/grants.js +2 -0
  35. package/dist/models/operations/notifications.d.ts +46 -0
  36. package/dist/models/operations/notifications.js +2 -0
  37. package/dist/models/operations/planAddons.d.ts +14 -1
  38. package/dist/models/operations/subscriptions.d.ts +27 -3
  39. package/dist/models/schemas.d.ts +51330 -23237
  40. package/dist/models/schemas.js +4837 -1735
  41. package/dist/models/types.d.ts +4758 -1592
  42. package/dist/sdk/apps.d.ts +2 -44
  43. package/dist/sdk/apps.js +1 -53
  44. package/dist/sdk/customers.d.ts +2 -56
  45. package/dist/sdk/customers.js +1 -67
  46. package/dist/sdk/internal.d.ts +491 -28
  47. package/dist/sdk/internal.js +607 -30
  48. package/dist/sdk/invoices.d.ts +112 -0
  49. package/dist/sdk/invoices.js +115 -0
  50. package/dist/sdk/notifications.d.ts +58 -0
  51. package/dist/sdk/notifications.js +72 -0
  52. package/dist/sdk/planAddons.d.ts +1 -20
  53. package/dist/sdk/planAddons.js +1 -24
  54. package/dist/sdk/sdk.d.ts +3 -0
  55. package/dist/sdk/sdk.js +5 -0
  56. package/dist/sdk/subscriptions.d.ts +12 -1
  57. package/dist/sdk/subscriptions.js +14 -1
  58. package/package.json +1 -1
  59. package/dist/models/operations/governance.d.ts +0 -9
  60. /package/dist/models/operations/{governance.js → charges.js} +0 -0
package/README.md CHANGED
@@ -25,6 +25,7 @@ TypeSpec definitions and ships fully-typed request and response models.
25
25
  - [Customers](#customers)
26
26
  - [Entitlements](#entitlements)
27
27
  - [Subscriptions](#subscriptions)
28
+ - [Apps](#apps)
28
29
  - [Billing](#billing)
29
30
  - [Tax](#tax)
30
31
  - [Features](#features)
@@ -34,11 +35,17 @@ TypeSpec definitions and ships fully-typed request and response models.
34
35
  - [PlanAddons](#planaddons)
35
36
  - [Defaults](#defaults)
36
37
  - [Internal Operations](#internal-operations)
38
+ - [Internal Customers](#internal-customers)
39
+ - [Internal Entitlements](#internal-entitlements)
40
+ - [Internal Grants](#internal-grants)
37
41
  - [Internal Subscriptions](#internal-subscriptions)
38
42
  - [Internal Apps](#internal-apps)
39
43
  - [Internal Invoices](#internal-invoices)
44
+ - [Internal Charges](#internal-charges)
40
45
  - [Internal Currencies](#internal-currencies)
41
- - [Internal Governance](#internal-governance)
46
+ - [Internal PlanAddons](#internal-planaddons)
47
+ - [Internal EntitlementAccess](#internal-entitlementaccess)
48
+ - [Internal Notifications](#internal-notifications)
42
49
  - [Runtime Validation (validate option)](#runtime-validation-validate-option)
43
50
  - [Zod Schemas (./zod export)](#zod-schemas-zod-export)
44
51
  - [Error Handling](#error-handling)
@@ -279,28 +286,25 @@ The full call path, HTTP route, and a short description are listed below.
279
286
 
280
287
  ### Customers
281
288
 
282
- | Method | HTTP | Description |
283
- | ---------------------------------------------------------- | ------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
284
- | `client.customers.create` | `POST /openmeter/customers` | Create customer |
285
- | `client.customers.get` | `GET /openmeter/customers/{customerId}` | Get customer |
286
- | `client.customers.list` | `GET /openmeter/customers` | List customers |
287
- | `client.customers.upsert` | `PUT /openmeter/customers/{customerId}` | Upsert customer |
288
- | `client.customers.delete` | `DELETE /openmeter/customers/{customerId}` | Delete customer |
289
- | `client.customers.billing.get` | `GET /openmeter/customers/{customerId}/billing` | Get customer billing data |
290
- | `client.customers.billing.update` | `PUT /openmeter/customers/{customerId}/billing` | Update customer billing data |
291
- | `client.customers.billing.updateAppData` | `PUT /openmeter/customers/{customerId}/billing/app-data` | Update customer billing app data |
292
- | `client.customers.billing.createStripeCheckoutSession` | `POST /openmeter/customers/{customerId}/billing/stripe/checkout-sessions` | Create a [Stripe Checkout Session](https://docs.stripe.com/payments/checkout) for the customer. Creates a Checkout Session for collecting payment method information from customers. The session operates in "setup" mode, which collects payment details without charging the customer immediately. The collected payment method can be used for future subscription billing. For hosted checkout sessions, redirect customers to the returned URL. For embedded sessions, use the client_secret to initialize Stripe.js in your application. |
293
- | `client.customers.billing.createStripePortalSession` | `POST /openmeter/customers/{customerId}/billing/stripe/portal-sessions` | Create Stripe Customer Portal Session. Useful to redirect the customer to the Stripe Customer Portal to manage their payment methods, change their billing address and access their invoice history. Only returns URL if the customer billing profile is linked to a stripe app and customer. |
294
- | `client.customers.credits.grants.create` | `POST /openmeter/customers/{customerId}/credits/grants` | Create a new credit grant. A credit grant represents an allocation of prepaid credits to a customer. |
295
- | `client.customers.credits.grants.get` | `GET /openmeter/customers/{customerId}/credits/grants/{creditGrantId}` | Get a credit grant. |
296
- | `client.customers.credits.grants.list` | `GET /openmeter/customers/{customerId}/credits/grants` | List credit grants. |
297
- | `client.customers.credits.balance.get` | `GET /openmeter/customers/{customerId}/credits/balance` | Get a credit balance. |
298
- | `client.customers.credits.adjustments.create` | `POST /openmeter/customers/{customerId}/credits/adjustments` | A credit adjustment can be used to make manual adjustments to a customer's credit balance. Supported use-cases: - Usage correction |
299
- | `client.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. |
300
- | `client.customers.credits.grants.updateExternalSettlement` | `POST /openmeter/customers/{customerId}/credits/grants/{creditGrantId}/settlement/external` | Update the payment settlement status of an externally funded credit grant. Use this endpoint to synchronize the payment state of an external payment with the system so that revenue recognition and credit availability work as expected. |
301
- | `client.customers.credits.transactions.list` | `GET /openmeter/customers/{customerId}/credits/transactions` | List credit transactions for a customer. Returns an immutable, chronological record of credit movements: funded credits and consumed credits. Transactions are returned in reverse chronological order by default. |
302
- | `client.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. |
303
- | `client.customers.charges.create` | `POST /openmeter/customers/{customerId}/charges` | Create customer charge. |
289
+ | Method | HTTP | Description |
290
+ | ---------------------------------------------------------- | ------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
291
+ | `client.customers.create` | `POST /openmeter/customers` | Create customer |
292
+ | `client.customers.get` | `GET /openmeter/customers/{customerId}` | Get customer |
293
+ | `client.customers.list` | `GET /openmeter/customers` | List customers |
294
+ | `client.customers.upsert` | `PUT /openmeter/customers/{customerId}` | Upsert customer |
295
+ | `client.customers.delete` | `DELETE /openmeter/customers/{customerId}` | Delete customer |
296
+ | `client.customers.billing.get` | `GET /openmeter/customers/{customerId}/billing` | Get customer billing data |
297
+ | `client.customers.billing.update` | `PUT /openmeter/customers/{customerId}/billing` | Update customer billing data |
298
+ | `client.customers.billing.updateAppData` | `PUT /openmeter/customers/{customerId}/billing/app-data` | Update customer billing app data |
299
+ | `client.customers.billing.createStripeCheckoutSession` | `POST /openmeter/customers/{customerId}/billing/stripe/checkout-sessions` | Create a [Stripe Checkout Session](https://docs.stripe.com/payments/checkout) for the customer. Creates a Checkout Session for collecting payment method information from customers. The session operates in "setup" mode, which collects payment details without charging the customer immediately. The collected payment method can be used for future subscription billing. For hosted checkout sessions, redirect customers to the returned URL. For embedded sessions, use the client_secret to initialize Stripe.js in your application. |
300
+ | `client.customers.billing.createStripePortalSession` | `POST /openmeter/customers/{customerId}/billing/stripe/portal-sessions` | Create Stripe Customer Portal Session. Useful to redirect the customer to the Stripe Customer Portal to manage their payment methods, change their billing address and access their invoice history. Only returns URL if the customer billing profile is linked to a stripe app and customer. |
301
+ | `client.customers.credits.grants.create` | `POST /openmeter/customers/{customerId}/credits/grants` | Create a new credit grant. A credit grant represents an allocation of prepaid credits to a customer. |
302
+ | `client.customers.credits.grants.get` | `GET /openmeter/customers/{customerId}/credits/grants/{creditGrantId}` | Get a credit grant. |
303
+ | `client.customers.credits.grants.list` | `GET /openmeter/customers/{customerId}/credits/grants` | List credit grants. |
304
+ | `client.customers.credits.balance.get` | `GET /openmeter/customers/{customerId}/credits/balance` | Get a credit balance. |
305
+ | `client.customers.credits.adjustments.create` | `POST /openmeter/customers/{customerId}/credits/adjustments` | A credit adjustment can be used to make manual adjustments to a customer's credit balance. Supported use-cases: - Usage correction |
306
+ | `client.customers.credits.grants.updateExternalSettlement` | `POST /openmeter/customers/{customerId}/credits/grants/{creditGrantId}/settlement/external` | Update the payment settlement status of an externally funded credit grant. Use this endpoint to synchronize the payment state of an external payment with the system so that revenue recognition and credit availability work as expected. |
307
+ | `client.customers.credits.transactions.list` | `GET /openmeter/customers/{customerId}/credits/transactions` | List credit transactions for a customer. Returns an immutable, chronological record of credit movements: funded credits and consumed credits. Transactions are returned in reverse chronological order by default. |
304
308
 
305
309
  ### Entitlements
306
310
 
@@ -310,16 +314,24 @@ The full call path, HTTP route, and a short description are listed below.
310
314
 
311
315
  ### Subscriptions
312
316
 
313
- | Method | HTTP | Description |
314
- | -------------------------------------------- | ---------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------- |
315
- | `client.subscriptions.create` | `POST /openmeter/subscriptions` | Create subscription |
316
- | `client.subscriptions.list` | `GET /openmeter/subscriptions` | List subscriptions |
317
- | `client.subscriptions.get` | `GET /openmeter/subscriptions/{subscriptionId}` | Get subscription |
318
- | `client.subscriptions.cancel` | `POST /openmeter/subscriptions/{subscriptionId}/cancel` | Cancels the subscription. Will result in a scheduling conflict if there are other subscriptions scheduled to start after the cancelation time. |
319
- | `client.subscriptions.unscheduleCancelation` | `POST /openmeter/subscriptions/{subscriptionId}/unschedule-cancelation` | Unschedules the subscription cancelation. |
320
- | `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. |
321
- | `client.subscriptions.listAddons` | `GET /openmeter/subscriptions/{subscriptionId}/addons` | List the add-ons of a subscription. |
322
- | `client.subscriptions.getAddon` | `GET /openmeter/subscriptions/{subscriptionId}/addons/{subscriptionAddonId}` | Get an add-on association for a subscription. |
317
+ | Method | HTTP | Description |
318
+ | -------------------------------------------- | ---------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
319
+ | `client.subscriptions.create` | `POST /openmeter/subscriptions` | Create subscription |
320
+ | `client.subscriptions.list` | `GET /openmeter/subscriptions` | List subscriptions |
321
+ | `client.subscriptions.get` | `GET /openmeter/subscriptions/{subscriptionId}` | Get subscription |
322
+ | `client.subscriptions.cancel` | `POST /openmeter/subscriptions/{subscriptionId}/cancel` | Cancels the subscription. Will result in a scheduling conflict if there are other subscriptions scheduled to start after the cancelation time. |
323
+ | `client.subscriptions.unscheduleCancelation` | `POST /openmeter/subscriptions/{subscriptionId}/unschedule-cancelation` | Unschedules the subscription cancelation. |
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. |
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. |
326
+ | `client.subscriptions.listAddons` | `GET /openmeter/subscriptions/{subscriptionId}/addons` | List the add-ons of a subscription. |
327
+ | `client.subscriptions.getAddon` | `GET /openmeter/subscriptions/{subscriptionId}/addons/{subscriptionAddonId}` | Get an add-on association for a subscription. |
328
+
329
+ ### Apps
330
+
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. |
323
335
 
324
336
  ### Billing
325
337
 
@@ -390,7 +402,6 @@ The full call path, HTTP route, and a short description are listed below.
390
402
 
391
403
  | Method | HTTP | Description |
392
404
  | -------------------------- | ------------------------------------------------------- | ---------------------------------------- |
393
- | `client.planAddons.list` | `GET /openmeter/plans/{planId}/addons` | List add-ons associated with a plan. |
394
405
  | `client.planAddons.create` | `POST /openmeter/plans/{planId}/addons` | Add an add-on to a plan. |
395
406
  | `client.planAddons.get` | `GET /openmeter/plans/{planId}/addons/{planAddonId}` | Get an add-on association for a plan. |
396
407
  | `client.planAddons.update` | `PUT /openmeter/plans/{planId}/addons/{planAddonId}` | Update an add-on association for a plan. |
@@ -410,18 +421,54 @@ Operations marked internal in the API definition are exposed under
410
421
  intended for customer use: they may require additional permissions, and
411
422
  they can change or be removed without notice or semver consideration.
412
423
 
424
+ ### Internal Customers
425
+
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. |
457
+
413
458
  ### Internal Subscriptions
414
459
 
415
- | Method | HTTP | Description |
416
- | ------------------------------------------- | ------------------------------------------------------- | ----------------------------- |
417
- | `client.internal.subscriptions.createAddon` | `POST /openmeter/subscriptions/{subscriptionId}/addons` | Add add-on to a subscription. |
460
+ | Method | HTTP | Description |
461
+ | ------------------------------------------- | ------------------------------------------------------------------------------ | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
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. |
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. |
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. |
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. |
418
467
 
419
468
  ### Internal Apps
420
469
 
421
470
  | Method | HTTP | Description |
422
471
  | ------------------------------------- | -------------------------------------- | -------------------------------- |
423
- | `client.internal.apps.list` | `GET /openmeter/apps` | List installed apps. |
424
- | `client.internal.apps.get` | `GET /openmeter/apps/{appId}` | Get an installed app. |
425
472
  | `client.internal.apps.uninstall` | `DELETE /openmeter/apps/{appId}` | Uninstall an app by ID. |
426
473
  | `client.internal.apps.update` | `PUT /openmeter/apps/{appId}` | Update an installed app. |
427
474
  | `client.internal.apps.listCatalog` | `GET /openmeter/app-catalog` | List available apps. |
@@ -441,6 +488,12 @@ they can change or be removed without notice or semver consideration.
441
488
  | `client.internal.invoices.retry` | `POST /openmeter/billing/invoices/{invoiceId}/retry` | Retry sending a billing invoice. Retry advancing the invoice after a failed attempt. The action can be called when the invoice's statusDetails' actions field contain the "retry" action. |
442
489
  | `client.internal.invoices.snapshotQuantities` | `POST /openmeter/billing/invoices/{invoiceId}/snapshot-quantities` | Snapshot quantities for usage-based line items. This call will snapshot the quantities for all usage based line items in the invoice. This call is only valid in draft.waiting_for_collection status, where the collection period can be skipped using this action. |
443
490
 
491
+ ### Internal Charges
492
+
493
+ | Method | HTTP | Description |
494
+ | ------------------------------ | ------------------------ | ------------------------------------------------------------------------------------------------------------------- |
495
+ | `client.internal.charges.list` | `GET /openmeter/charges` | List charges. Returns the charges of every customer that are represented as either flat fee or usage-based charges. |
496
+
444
497
  ### Internal Currencies
445
498
 
446
499
  | Method | HTTP | Description |
@@ -451,11 +504,27 @@ they can change or be removed without notice or semver consideration.
451
504
  | `client.internal.currencies.listCostBases` | `GET /openmeter/currencies/custom/{currencyId}/cost-bases` | List cost bases for a currency. For custom currencies, there can be multiple cost bases with different `effective_from` dates. |
452
505
  | `client.internal.currencies.createCostBasis` | `POST /openmeter/currencies/custom/{currencyId}/cost-bases` | Create a cost basis for a currency. |
453
506
 
454
- ### Internal Governance
507
+ ### Internal PlanAddons
508
+
509
+ | Method | HTTP | Description |
510
+ | --------------------------------- | -------------------------------------- | ------------------------------------ |
511
+ | `client.internal.planAddons.list` | `GET /openmeter/plans/{planId}/addons` | List add-ons associated with a plan. |
512
+
513
+ ### Internal EntitlementAccess
514
+
515
+ | Method | HTTP | Description |
516
+ | ----------------------------------------- | ------------------------------------------ | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
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._ |
518
+
519
+ ### Internal Notifications
455
520
 
456
- | Method | HTTP | Description |
457
- | ---------------------------------------- | ---------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
458
- | `client.internal.governance.queryAccess` | `POST /openmeter/governance/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._ |
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. |
459
528
 
460
529
  ## Runtime Validation (validate option)
461
530
 
@@ -1,8 +1,8 @@
1
1
  // Code generated by @openmeter/typespec-typescript. DO NOT EDIT.
2
2
  import { http } from '../core.js';
3
3
  import { request } from '../lib/request.js';
4
- import { toURLSearchParams } from '../lib/encodings.js';
5
- import { toWire, toPathWire, fromWire, assertValid } from '../lib/wire.js';
4
+ import { toURLSearchParams, encodeSort } from '../lib/encodings.js';
5
+ import { toWire, toPathWire, fromWire, assertValid, toSnakeCase, } from '../lib/wire.js';
6
6
  import * as schemas from '../models/schemas.js';
7
7
  /**
8
8
  * List apps
@@ -13,8 +13,13 @@ import * as schemas from '../models/schemas.js';
13
13
  */
14
14
  export function listApps(client, req = {}, options) {
15
15
  return request(() => {
16
+ if (client._options.validate && req.sort !== undefined) {
17
+ assertValid(schemas.listAppsQueryParams.shape.sort, req.sort);
18
+ }
16
19
  const query = toWire({
17
20
  page: req.page,
21
+ sort: encodeSort(req.sort, toSnakeCase),
22
+ filter: req.filter,
18
23
  }, schemas.listAppsQueryParams);
19
24
  if (client._options.validate) {
20
25
  assertValid(schemas.listAppsQueryParamsWire, query);
@@ -1,8 +1,8 @@
1
1
  // Code generated by @openmeter/typespec-typescript. DO NOT EDIT.
2
2
  import { http } from '../core.js';
3
3
  import { request } from '../lib/request.js';
4
- import { toURLSearchParams } from '../lib/encodings.js';
5
- import { toWire, toPathWire, fromWire, assertValid } from '../lib/wire.js';
4
+ import { toURLSearchParams, encodeSort } from '../lib/encodings.js';
5
+ import { toWire, toPathWire, fromWire, assertValid, toSnakeCase, } from '../lib/wire.js';
6
6
  import * as schemas from '../models/schemas.js';
7
7
  /**
8
8
  * List billing profiles
@@ -13,8 +13,13 @@ import * as schemas from '../models/schemas.js';
13
13
  */
14
14
  export function listBillingProfiles(client, req = {}, options) {
15
15
  return request(() => {
16
+ if (client._options.validate && req.sort !== undefined) {
17
+ assertValid(schemas.listBillingProfilesQueryParams.shape.sort, req.sort);
18
+ }
16
19
  const query = toWire({
17
20
  page: req.page,
21
+ sort: encodeSort(req.sort, toSnakeCase),
22
+ filter: req.filter,
18
23
  }, schemas.listBillingProfilesQueryParams);
19
24
  if (client._options.validate) {
20
25
  assertValid(schemas.listBillingProfilesQueryParamsWire, query);
@@ -0,0 +1,14 @@
1
+ import { type Client } from '../core.js';
2
+ import { type Result, type RequestOptions } from '../lib/types.js';
3
+ import type { ListChargesRequest, ListChargesResponse } from '../models/operations/charges.js';
4
+ /**
5
+ * List charges
6
+ *
7
+ * List charges.
8
+ *
9
+ * Returns the charges of every customer that are represented as either flat fee or
10
+ * usage-based charges.
11
+ *
12
+ * GET /openmeter/charges
13
+ */
14
+ export declare function listCharges(client: Client, req?: ListChargesRequest, options?: RequestOptions): Promise<Result<ListChargesResponse>>;
@@ -0,0 +1,42 @@
1
+ // Code generated by @openmeter/typespec-typescript. DO NOT EDIT.
2
+ import { http } from '../core.js';
3
+ import { request } from '../lib/request.js';
4
+ import { toURLSearchParams, encodeSort } from '../lib/encodings.js';
5
+ import { toWire, fromWire, assertValid, toSnakeCase } from '../lib/wire.js';
6
+ import * as schemas from '../models/schemas.js';
7
+ /**
8
+ * List charges
9
+ *
10
+ * List charges.
11
+ *
12
+ * Returns the charges of every customer that are represented as either flat fee or
13
+ * usage-based charges.
14
+ *
15
+ * GET /openmeter/charges
16
+ */
17
+ export function listCharges(client, req = {}, options) {
18
+ return request(() => {
19
+ if (client._options.validate && req.sort !== undefined) {
20
+ assertValid(schemas.listChargesQueryParams.shape.sort, req.sort);
21
+ }
22
+ const query = toWire({
23
+ page: req.page,
24
+ sort: encodeSort(req.sort, toSnakeCase),
25
+ filter: req.filter,
26
+ expand: req.expand,
27
+ }, schemas.listChargesQueryParams);
28
+ if (client._options.validate) {
29
+ assertValid(schemas.listChargesQueryParamsWire, query);
30
+ }
31
+ const searchParams = toURLSearchParams(query);
32
+ return http(client)
33
+ .get('openmeter/charges', { ...options, searchParams })
34
+ .json()
35
+ .then((data) => {
36
+ if (client._options.validate) {
37
+ assertValid(schemas.listChargesResponseWire, data);
38
+ }
39
+ return fromWire(data, schemas.listChargesResponse);
40
+ });
41
+ });
42
+ }
@@ -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
  *