@openmeter/client 1.0.0-beta.232 → 1.0.0-beta.233
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +76 -45
- 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/{governance.d.ts → entitlementAccess.d.ts} +4 -4
- package/dist/funcs/{governance.js → entitlementAccess.js} +10 -10
- package/dist/funcs/entitlements.d.ts +9 -1
- package/dist/funcs/entitlements.js +50 -1
- package/dist/funcs/index.d.ts +2 -1
- package/dist/funcs/index.js +2 -1
- 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 +4 -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 +19 -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 +18 -1
- package/dist/models/operations/planAddons.d.ts +14 -1
- package/dist/models/operations/subscriptions.d.ts +27 -3
- package/dist/models/schemas.d.ts +46830 -22570
- package/dist/models/schemas.js +3175 -1508
- package/dist/models/types.d.ts +4115 -1896
- package/dist/sdk/apps.d.ts +1 -62
- package/dist/sdk/apps.js +1 -76
- package/dist/sdk/customers.d.ts +2 -56
- package/dist/sdk/customers.js +1 -67
- package/dist/sdk/entitlements.d.ts +9 -1
- package/dist/sdk/entitlements.js +11 -1
- package/dist/sdk/internal.d.ts +183 -22
- package/dist/sdk/internal.js +231 -26
- package/dist/sdk/invoices.d.ts +112 -0
- package/dist/sdk/invoices.js +115 -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 +20 -1
- package/dist/sdk/subscriptions.js +24 -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/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,14 @@ 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)
|
|
37
39
|
- [Internal Subscriptions](#internal-subscriptions)
|
|
38
40
|
- [Internal Apps](#internal-apps)
|
|
39
41
|
- [Internal Invoices](#internal-invoices)
|
|
42
|
+
- [Internal Charges](#internal-charges)
|
|
40
43
|
- [Internal Currencies](#internal-currencies)
|
|
41
|
-
- [Internal
|
|
44
|
+
- [Internal PlanAddons](#internal-planaddons)
|
|
45
|
+
- [Internal EntitlementAccess](#internal-entitlementaccess)
|
|
42
46
|
- [Runtime Validation (validate option)](#runtime-validation-validate-option)
|
|
43
47
|
- [Zod Schemas (./zod export)](#zod-schemas-zod-export)
|
|
44
48
|
- [Error Handling](#error-handling)
|
|
@@ -279,47 +283,53 @@ The full call path, HTTP route, and a short description are listed below.
|
|
|
279
283
|
|
|
280
284
|
### Customers
|
|
281
285
|
|
|
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.
|
|
300
|
-
| `client.customers.credits.
|
|
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. |
|
|
286
|
+
| Method | HTTP | Description |
|
|
287
|
+
| ---------------------------------------------------------- | ------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
288
|
+
| `client.customers.create` | `POST /openmeter/customers` | Create customer |
|
|
289
|
+
| `client.customers.get` | `GET /openmeter/customers/{customerId}` | Get customer |
|
|
290
|
+
| `client.customers.list` | `GET /openmeter/customers` | List customers |
|
|
291
|
+
| `client.customers.upsert` | `PUT /openmeter/customers/{customerId}` | Upsert customer |
|
|
292
|
+
| `client.customers.delete` | `DELETE /openmeter/customers/{customerId}` | Delete customer |
|
|
293
|
+
| `client.customers.billing.get` | `GET /openmeter/customers/{customerId}/billing` | Get customer billing data |
|
|
294
|
+
| `client.customers.billing.update` | `PUT /openmeter/customers/{customerId}/billing` | Update customer billing data |
|
|
295
|
+
| `client.customers.billing.updateAppData` | `PUT /openmeter/customers/{customerId}/billing/app-data` | Update customer billing app data |
|
|
296
|
+
| `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. |
|
|
297
|
+
| `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. |
|
|
298
|
+
| `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. |
|
|
299
|
+
| `client.customers.credits.grants.get` | `GET /openmeter/customers/{customerId}/credits/grants/{creditGrantId}` | Get a credit grant. |
|
|
300
|
+
| `client.customers.credits.grants.list` | `GET /openmeter/customers/{customerId}/credits/grants` | List credit grants. |
|
|
301
|
+
| `client.customers.credits.balance.get` | `GET /openmeter/customers/{customerId}/credits/balance` | Get a credit balance. |
|
|
302
|
+
| `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 |
|
|
303
|
+
| `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. |
|
|
304
|
+
| `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
305
|
|
|
305
306
|
### Entitlements
|
|
306
307
|
|
|
307
|
-
| Method | HTTP
|
|
308
|
-
| ---------------------------------------- |
|
|
309
|
-
| `client.entitlements.listCustomerAccess` | `GET /openmeter/customers/{customerId}/entitlement-access`
|
|
308
|
+
| Method | HTTP | Description |
|
|
309
|
+
| ---------------------------------------- | -------------------------------------------------------------------------------- | ---------------------------------------------- |
|
|
310
|
+
| `client.entitlements.listCustomerAccess` | `GET /openmeter/customers/{customerId}/entitlement-access` | List customer entitlement access |
|
|
311
|
+
| `client.entitlements.getCustomerAccess` | `GET /openmeter/customers/{customerId}/entitlement-access/features/{featureKey}` | Get the customer's access to a single feature. |
|
|
310
312
|
|
|
311
313
|
### Subscriptions
|
|
312
314
|
|
|
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.
|
|
322
|
-
| `client.subscriptions.
|
|
315
|
+
| Method | HTTP | Description |
|
|
316
|
+
| -------------------------------------------- | ---------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
317
|
+
| `client.subscriptions.create` | `POST /openmeter/subscriptions` | Create subscription |
|
|
318
|
+
| `client.subscriptions.list` | `GET /openmeter/subscriptions` | List subscriptions |
|
|
319
|
+
| `client.subscriptions.get` | `GET /openmeter/subscriptions/{subscriptionId}` | Get subscription |
|
|
320
|
+
| `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. |
|
|
321
|
+
| `client.subscriptions.unscheduleCancelation` | `POST /openmeter/subscriptions/{subscriptionId}/unschedule-cancelation` | Unschedules the subscription cancelation. |
|
|
322
|
+
| `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
|
+
| `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
|
+
| `client.subscriptions.listAddons` | `GET /openmeter/subscriptions/{subscriptionId}/addons` | List the add-ons of a subscription. |
|
|
326
|
+
| `client.subscriptions.getAddon` | `GET /openmeter/subscriptions/{subscriptionId}/addons/{subscriptionAddonId}` | Get an add-on association for a subscription. |
|
|
327
|
+
|
|
328
|
+
### Apps
|
|
329
|
+
|
|
330
|
+
| Method | HTTP | Description |
|
|
331
|
+
| ----------------- | ----------------------------- | --------------------- |
|
|
332
|
+
| `client.apps.get` | `GET /openmeter/apps/{appId}` | Get an installed app. |
|
|
323
333
|
|
|
324
334
|
### Billing
|
|
325
335
|
|
|
@@ -390,7 +400,6 @@ The full call path, HTTP route, and a short description are listed below.
|
|
|
390
400
|
|
|
391
401
|
| Method | HTTP | Description |
|
|
392
402
|
| -------------------------- | ------------------------------------------------------- | ---------------------------------------- |
|
|
393
|
-
| `client.planAddons.list` | `GET /openmeter/plans/{planId}/addons` | List add-ons associated with a plan. |
|
|
394
403
|
| `client.planAddons.create` | `POST /openmeter/plans/{planId}/addons` | Add an add-on to a plan. |
|
|
395
404
|
| `client.planAddons.get` | `GET /openmeter/plans/{planId}/addons/{planAddonId}` | Get an add-on association for a plan. |
|
|
396
405
|
| `client.planAddons.update` | `PUT /openmeter/plans/{planId}/addons/{planAddonId}` | Update an add-on association for a plan. |
|
|
@@ -410,18 +419,28 @@ Operations marked internal in the API definition are exposed under
|
|
|
410
419
|
intended for customer use: they may require additional permissions, and
|
|
411
420
|
they can change or be removed without notice or semver consideration.
|
|
412
421
|
|
|
422
|
+
### Internal Customers
|
|
423
|
+
|
|
424
|
+
| Method | HTTP | Description |
|
|
425
|
+
| ----------------------------------------------- | ---------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
426
|
+
| `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. |
|
|
427
|
+
| `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. |
|
|
428
|
+
| `client.internal.customers.charges.create` | `POST /openmeter/customers/{customerId}/charges` | Create customer charge. |
|
|
429
|
+
|
|
413
430
|
### Internal Subscriptions
|
|
414
431
|
|
|
415
|
-
| Method | HTTP
|
|
416
|
-
| ------------------------------------------- |
|
|
417
|
-
| `client.internal.subscriptions.
|
|
432
|
+
| Method | HTTP | Description |
|
|
433
|
+
| ------------------------------------------- | ------------------------------------------------------------------------------ | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
434
|
+
| `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
|
+
| `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
|
+
| `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. |
|
|
437
|
+
| `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
438
|
|
|
419
439
|
### Internal Apps
|
|
420
440
|
|
|
421
441
|
| Method | HTTP | Description |
|
|
422
442
|
| ------------------------------------- | -------------------------------------- | -------------------------------- |
|
|
423
443
|
| `client.internal.apps.list` | `GET /openmeter/apps` | List installed apps. |
|
|
424
|
-
| `client.internal.apps.get` | `GET /openmeter/apps/{appId}` | Get an installed app. |
|
|
425
444
|
| `client.internal.apps.uninstall` | `DELETE /openmeter/apps/{appId}` | Uninstall an app by ID. |
|
|
426
445
|
| `client.internal.apps.update` | `PUT /openmeter/apps/{appId}` | Update an installed app. |
|
|
427
446
|
| `client.internal.apps.listCatalog` | `GET /openmeter/app-catalog` | List available apps. |
|
|
@@ -441,6 +460,12 @@ they can change or be removed without notice or semver consideration.
|
|
|
441
460
|
| `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
461
|
| `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
462
|
|
|
463
|
+
### Internal Charges
|
|
464
|
+
|
|
465
|
+
| Method | HTTP | Description |
|
|
466
|
+
| ------------------------------ | ------------------------ | ------------------------------------------------------------------------------------------------------------------- |
|
|
467
|
+
| `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. |
|
|
468
|
+
|
|
444
469
|
### Internal Currencies
|
|
445
470
|
|
|
446
471
|
| Method | HTTP | Description |
|
|
@@ -451,11 +476,17 @@ they can change or be removed without notice or semver consideration.
|
|
|
451
476
|
| `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
477
|
| `client.internal.currencies.createCostBasis` | `POST /openmeter/currencies/custom/{currencyId}/cost-bases` | Create a cost basis for a currency. |
|
|
453
478
|
|
|
454
|
-
### Internal
|
|
479
|
+
### Internal PlanAddons
|
|
480
|
+
|
|
481
|
+
| Method | HTTP | Description |
|
|
482
|
+
| --------------------------------- | -------------------------------------- | ------------------------------------ |
|
|
483
|
+
| `client.internal.planAddons.list` | `GET /openmeter/plans/{planId}/addons` | List add-ons associated with a plan. |
|
|
484
|
+
|
|
485
|
+
### Internal EntitlementAccess
|
|
455
486
|
|
|
456
|
-
| Method
|
|
457
|
-
|
|
|
458
|
-
| `client.internal.
|
|
487
|
+
| Method | HTTP | Description |
|
|
488
|
+
| ----------------------------------------- | ------------------------------------------ | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
489
|
+
| `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._ |
|
|
459
490
|
|
|
460
491
|
## Runtime Validation (validate option)
|
|
461
492
|
|
package/dist/funcs/apps.js
CHANGED
|
@@ -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);
|
package/dist/funcs/billing.js
CHANGED
|
@@ -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,8 +1,8 @@
|
|
|
1
1
|
import { type Client } from '../core.js';
|
|
2
2
|
import { type Result, type RequestOptions } from '../lib/types.js';
|
|
3
|
-
import type {
|
|
3
|
+
import type { QueryEntitlementAccessRequest, QueryEntitlementAccessResponse } from '../models/operations/entitlementAccess.js';
|
|
4
4
|
/**
|
|
5
|
-
* Query
|
|
5
|
+
* Query entitlement access
|
|
6
6
|
*
|
|
7
7
|
* Query feature access for a list of customers.
|
|
8
8
|
*
|
|
@@ -13,6 +13,6 @@ import type { QueryGovernanceAccessRequest, QueryGovernanceAccessResponse } from
|
|
|
13
13
|
* _Designed to be called on a fixed refresh interval and the query response is
|
|
14
14
|
* intended to be cached._
|
|
15
15
|
*
|
|
16
|
-
* POST /openmeter/
|
|
16
|
+
* POST /openmeter/entitlement-access/query
|
|
17
17
|
*/
|
|
18
|
-
export declare function
|
|
18
|
+
export declare function queryEntitlementAccess(client: Client, req: QueryEntitlementAccessRequest, options?: RequestOptions): Promise<Result<QueryEntitlementAccessResponse>>;
|
|
@@ -5,7 +5,7 @@ import { toURLSearchParams } from '../lib/encodings.js';
|
|
|
5
5
|
import { toWire, fromWire, assertValid } from '../lib/wire.js';
|
|
6
6
|
import * as schemas from '../models/schemas.js';
|
|
7
7
|
/**
|
|
8
|
-
* Query
|
|
8
|
+
* Query entitlement access
|
|
9
9
|
*
|
|
10
10
|
* Query feature access for a list of customers.
|
|
11
11
|
*
|
|
@@ -16,23 +16,23 @@ import * as schemas from '../models/schemas.js';
|
|
|
16
16
|
* _Designed to be called on a fixed refresh interval and the query response is
|
|
17
17
|
* intended to be cached._
|
|
18
18
|
*
|
|
19
|
-
* POST /openmeter/
|
|
19
|
+
* POST /openmeter/entitlement-access/query
|
|
20
20
|
*/
|
|
21
|
-
export function
|
|
21
|
+
export function queryEntitlementAccess(client, req, options) {
|
|
22
22
|
return request(() => {
|
|
23
|
-
const body = toWire(req.body, schemas.
|
|
23
|
+
const body = toWire(req.body, schemas.queryEntitlementAccessBody);
|
|
24
24
|
if (client._options.validate) {
|
|
25
|
-
assertValid(schemas.
|
|
25
|
+
assertValid(schemas.queryEntitlementAccessBodyWire, body);
|
|
26
26
|
}
|
|
27
27
|
const query = toWire({
|
|
28
28
|
page: req.page,
|
|
29
|
-
}, schemas.
|
|
29
|
+
}, schemas.queryEntitlementAccessQueryParams);
|
|
30
30
|
if (client._options.validate) {
|
|
31
|
-
assertValid(schemas.
|
|
31
|
+
assertValid(schemas.queryEntitlementAccessQueryParamsWire, query);
|
|
32
32
|
}
|
|
33
33
|
const searchParams = toURLSearchParams(query);
|
|
34
34
|
return http(client)
|
|
35
|
-
.post('openmeter/
|
|
35
|
+
.post('openmeter/entitlement-access/query', {
|
|
36
36
|
...options,
|
|
37
37
|
searchParams,
|
|
38
38
|
json: body,
|
|
@@ -40,9 +40,9 @@ export function queryGovernanceAccess(client, req, options) {
|
|
|
40
40
|
.json()
|
|
41
41
|
.then((data) => {
|
|
42
42
|
if (client._options.validate) {
|
|
43
|
-
assertValid(schemas.
|
|
43
|
+
assertValid(schemas.queryEntitlementAccessResponseWire, data);
|
|
44
44
|
}
|
|
45
|
-
return fromWire(data, schemas.
|
|
45
|
+
return fromWire(data, schemas.queryEntitlementAccessResponse);
|
|
46
46
|
});
|
|
47
47
|
});
|
|
48
48
|
}
|
|
@@ -1,9 +1,17 @@
|
|
|
1
1
|
import { type Client } from '../core.js';
|
|
2
2
|
import { type Result, type RequestOptions } from '../lib/types.js';
|
|
3
|
-
import type { ListCustomerEntitlementAccessRequest, ListCustomerEntitlementAccessResponse } from '../models/operations/entitlements.js';
|
|
3
|
+
import type { ListCustomerEntitlementAccessRequest, ListCustomerEntitlementAccessResponse, GetCustomerEntitlementAccessRequest, GetCustomerEntitlementAccessResponse } from '../models/operations/entitlements.js';
|
|
4
4
|
/**
|
|
5
5
|
* List customer entitlement access
|
|
6
6
|
*
|
|
7
7
|
* GET /openmeter/customers/{customerId}/entitlement-access
|
|
8
8
|
*/
|
|
9
9
|
export declare function listCustomerEntitlementAccess(client: Client, req: ListCustomerEntitlementAccessRequest, options?: RequestOptions): Promise<Result<ListCustomerEntitlementAccessResponse>>;
|
|
10
|
+
/**
|
|
11
|
+
* Get customer entitlement access
|
|
12
|
+
*
|
|
13
|
+
* Get the customer's access to a single feature.
|
|
14
|
+
*
|
|
15
|
+
* GET /openmeter/customers/{customerId}/entitlement-access/features/{featureKey}
|
|
16
|
+
*/
|
|
17
|
+
export declare function getCustomerEntitlementAccess(client: Client, req: GetCustomerEntitlementAccessRequest, options?: RequestOptions): Promise<Result<GetCustomerEntitlementAccessResponse>>;
|
|
@@ -1,7 +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 {
|
|
4
|
+
import { toURLSearchParams } from '../lib/encodings.js';
|
|
5
|
+
import { toWire, toPathWire, fromWire, assertValid } from '../lib/wire.js';
|
|
5
6
|
import * as schemas from '../models/schemas.js';
|
|
6
7
|
/**
|
|
7
8
|
* List customer entitlement access
|
|
@@ -36,3 +37,51 @@ export function listCustomerEntitlementAccess(client, req, options) {
|
|
|
36
37
|
});
|
|
37
38
|
});
|
|
38
39
|
}
|
|
40
|
+
/**
|
|
41
|
+
* Get customer entitlement access
|
|
42
|
+
*
|
|
43
|
+
* Get the customer's access to a single feature.
|
|
44
|
+
*
|
|
45
|
+
* GET /openmeter/customers/{customerId}/entitlement-access/features/{featureKey}
|
|
46
|
+
*/
|
|
47
|
+
export function getCustomerEntitlementAccess(client, req, options) {
|
|
48
|
+
return request(() => {
|
|
49
|
+
const pathParamsInput = {
|
|
50
|
+
customerId: req.customerId,
|
|
51
|
+
featureKey: req.featureKey,
|
|
52
|
+
};
|
|
53
|
+
const pathParams = client._options.validate
|
|
54
|
+
? toPathWire(pathParamsInput, schemas.getCustomerEntitlementAccessPathParams)
|
|
55
|
+
: pathParamsInput;
|
|
56
|
+
if (client._options.validate) {
|
|
57
|
+
assertValid(schemas.getCustomerEntitlementAccessPathParamsWire, pathParams);
|
|
58
|
+
}
|
|
59
|
+
const path = `openmeter/customers/${(() => {
|
|
60
|
+
if (pathParams.customerId === undefined) {
|
|
61
|
+
throw new Error('missing path parameter: customerId');
|
|
62
|
+
}
|
|
63
|
+
return encodeURIComponent(String(pathParams.customerId));
|
|
64
|
+
})()}/entitlement-access/features/${(() => {
|
|
65
|
+
if (pathParams.featureKey === undefined) {
|
|
66
|
+
throw new Error('missing path parameter: featureKey');
|
|
67
|
+
}
|
|
68
|
+
return encodeURIComponent(String(pathParams.featureKey));
|
|
69
|
+
})()}`;
|
|
70
|
+
const query = toWire({
|
|
71
|
+
expand: req.expand,
|
|
72
|
+
}, schemas.getCustomerEntitlementAccessQueryParams);
|
|
73
|
+
if (client._options.validate) {
|
|
74
|
+
assertValid(schemas.getCustomerEntitlementAccessQueryParamsWire, query);
|
|
75
|
+
}
|
|
76
|
+
const searchParams = toURLSearchParams(query);
|
|
77
|
+
return http(client)
|
|
78
|
+
.get(path, { ...options, searchParams })
|
|
79
|
+
.json()
|
|
80
|
+
.then((data) => {
|
|
81
|
+
if (client._options.validate) {
|
|
82
|
+
assertValid(schemas.getCustomerEntitlementAccessResponseWire, data);
|
|
83
|
+
}
|
|
84
|
+
return fromWire(data, schemas.getCustomerEntitlementAccessResponse);
|
|
85
|
+
});
|
|
86
|
+
});
|
|
87
|
+
}
|
package/dist/funcs/index.d.ts
CHANGED
|
@@ -6,6 +6,7 @@ export * from './subscriptions.js';
|
|
|
6
6
|
export * from './apps.js';
|
|
7
7
|
export * from './billing.js';
|
|
8
8
|
export * from './invoices.js';
|
|
9
|
+
export * from './charges.js';
|
|
9
10
|
export * from './tax.js';
|
|
10
11
|
export * from './currencies.js';
|
|
11
12
|
export * from './features.js';
|
|
@@ -14,4 +15,4 @@ export * from './plans.js';
|
|
|
14
15
|
export * from './addons.js';
|
|
15
16
|
export * from './planAddons.js';
|
|
16
17
|
export * from './defaults.js';
|
|
17
|
-
export * from './
|
|
18
|
+
export * from './entitlementAccess.js';
|
package/dist/funcs/index.js
CHANGED
|
@@ -7,6 +7,7 @@ export * from './subscriptions.js';
|
|
|
7
7
|
export * from './apps.js';
|
|
8
8
|
export * from './billing.js';
|
|
9
9
|
export * from './invoices.js';
|
|
10
|
+
export * from './charges.js';
|
|
10
11
|
export * from './tax.js';
|
|
11
12
|
export * from './currencies.js';
|
|
12
13
|
export * from './features.js';
|
|
@@ -15,4 +16,4 @@ export * from './plans.js';
|
|
|
15
16
|
export * from './addons.js';
|
|
16
17
|
export * from './planAddons.js';
|
|
17
18
|
export * from './defaults.js';
|
|
18
|
-
export * from './
|
|
19
|
+
export * from './entitlementAccess.js';
|
package/dist/funcs/planAddons.js
CHANGED
|
@@ -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 add-ons for plan
|
|
@@ -28,8 +28,13 @@ export function listPlanAddons(client, req, options) {
|
|
|
28
28
|
}
|
|
29
29
|
return encodeURIComponent(String(pathParams.planId));
|
|
30
30
|
})()}/addons`;
|
|
31
|
+
if (client._options.validate && req.sort !== undefined) {
|
|
32
|
+
assertValid(schemas.listPlanAddonsQueryParams.shape.sort, req.sort);
|
|
33
|
+
}
|
|
31
34
|
const query = toWire({
|
|
32
35
|
page: req.page,
|
|
36
|
+
sort: encodeSort(req.sort, toSnakeCase),
|
|
37
|
+
filter: req.filter,
|
|
33
38
|
}, schemas.listPlanAddonsQueryParams);
|
|
34
39
|
if (client._options.validate) {
|
|
35
40
|
assertValid(schemas.listPlanAddonsQueryParamsWire, query);
|