@openmeter/client 1.0.0-beta.231 → 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 +95 -54
- package/dist/core.js +7 -4
- package/dist/funcs/addons.js +59 -11
- package/dist/funcs/apps.d.ts +41 -1
- package/dist/funcs/apps.js +170 -4
- package/dist/funcs/billing.js +40 -8
- package/dist/funcs/charges.d.ts +14 -0
- package/dist/funcs/charges.js +42 -0
- package/dist/funcs/currencies.d.ts +9 -1
- package/dist/funcs/currencies.js +62 -5
- package/dist/funcs/customers.js +214 -43
- 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 +61 -3
- package/dist/funcs/events.js +3 -0
- package/dist/funcs/features.js +48 -9
- package/dist/funcs/index.d.ts +2 -1
- package/dist/funcs/index.js +2 -1
- package/dist/funcs/invoices.d.ts +58 -1
- package/dist/funcs/invoices.js +202 -7
- package/dist/funcs/llmCost.js +26 -5
- package/dist/funcs/meters.js +59 -11
- package/dist/funcs/planAddons.js +71 -18
- package/dist/funcs/plans.js +59 -11
- package/dist/funcs/subscriptions.d.ts +60 -1
- package/dist/funcs/subscriptions.js +291 -17
- package/dist/funcs/tax.js +34 -7
- package/dist/index.d.ts +3 -2
- package/dist/lib/config.d.ts +2 -2
- package/dist/lib/paginate.d.ts +1 -1
- package/dist/lib/version.d.ts +1 -1
- package/dist/lib/version.js +1 -1
- package/dist/lib/wire.d.ts +1 -0
- package/dist/lib/wire.js +88 -10
- package/dist/models/operations/apps.d.ts +41 -1
- package/dist/models/operations/billing.d.ts +19 -1
- package/dist/models/operations/charges.d.ts +54 -0
- package/dist/models/operations/currencies.d.ts +10 -0
- package/dist/models/operations/customers.d.ts +21 -6
- 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/invoices.d.ts +16 -0
- package/dist/models/operations/planAddons.d.ts +14 -1
- package/dist/models/operations/subscriptions.d.ts +27 -3
- package/dist/models/schemas.d.ts +52291 -22631
- package/dist/models/schemas.js +3981 -1823
- package/dist/models/types.d.ts +4481 -2018
- package/dist/sdk/apps.d.ts +1 -20
- package/dist/sdk/apps.js +1 -24
- 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 +324 -15
- package/dist/sdk/internal.js +402 -17
- package/dist/sdk/invoices.d.ts +127 -0
- package/dist/sdk/invoices.js +147 -0
- package/dist/sdk/planAddons.d.ts +1 -20
- package/dist/sdk/planAddons.js +1 -24
- package/dist/sdk/subscriptions.d.ts +20 -1
- package/dist/sdk/subscriptions.js +24 -1
- package/package.json +3 -3
- package/dist/models/operations/governance.d.ts +0 -9
- /package/dist/models/operations/{governance.js → charges.js} +0 -0
package/README.md
CHANGED
|
@@ -35,10 +35,14 @@ TypeSpec definitions and ships fully-typed request and response models.
|
|
|
35
35
|
- [PlanAddons](#planaddons)
|
|
36
36
|
- [Defaults](#defaults)
|
|
37
37
|
- [Internal Operations](#internal-operations)
|
|
38
|
+
- [Internal Customers](#internal-customers)
|
|
38
39
|
- [Internal Subscriptions](#internal-subscriptions)
|
|
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,54 +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. |
|
|
323
327
|
|
|
324
328
|
### Apps
|
|
325
329
|
|
|
326
|
-
| Method
|
|
327
|
-
|
|
|
328
|
-
| `client.apps.
|
|
329
|
-
| `client.apps.get` | `GET /openmeter/apps/{appId}` | Get an installed app. |
|
|
330
|
+
| Method | HTTP | Description |
|
|
331
|
+
| ----------------- | ----------------------------- | --------------------- |
|
|
332
|
+
| `client.apps.get` | `GET /openmeter/apps/{appId}` | Get an installed app. |
|
|
330
333
|
|
|
331
334
|
### Billing
|
|
332
335
|
|
|
@@ -397,7 +400,6 @@ The full call path, HTTP route, and a short description are listed below.
|
|
|
397
400
|
|
|
398
401
|
| Method | HTTP | Description |
|
|
399
402
|
| -------------------------- | ------------------------------------------------------- | ---------------------------------------- |
|
|
400
|
-
| `client.planAddons.list` | `GET /openmeter/plans/{planId}/addons` | List add-ons associated with a plan. |
|
|
401
403
|
| `client.planAddons.create` | `POST /openmeter/plans/{planId}/addons` | Add an add-on to a plan. |
|
|
402
404
|
| `client.planAddons.get` | `GET /openmeter/plans/{planId}/addons/{planAddonId}` | Get an add-on association for a plan. |
|
|
403
405
|
| `client.planAddons.update` | `PUT /openmeter/plans/{planId}/addons/{planAddonId}` | Update an add-on association for a plan. |
|
|
@@ -417,20 +419,52 @@ Operations marked internal in the API definition are exposed under
|
|
|
417
419
|
intended for customer use: they may require additional permissions, and
|
|
418
420
|
they can change or be removed without notice or semver consideration.
|
|
419
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
|
+
|
|
420
430
|
### Internal Subscriptions
|
|
421
431
|
|
|
422
|
-
| Method | HTTP
|
|
423
|
-
| ------------------------------------------- |
|
|
424
|
-
| `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. |
|
|
438
|
+
|
|
439
|
+
### Internal Apps
|
|
440
|
+
|
|
441
|
+
| Method | HTTP | Description |
|
|
442
|
+
| ------------------------------------- | -------------------------------------- | -------------------------------- |
|
|
443
|
+
| `client.internal.apps.list` | `GET /openmeter/apps` | List installed apps. |
|
|
444
|
+
| `client.internal.apps.uninstall` | `DELETE /openmeter/apps/{appId}` | Uninstall an app by ID. |
|
|
445
|
+
| `client.internal.apps.update` | `PUT /openmeter/apps/{appId}` | Update an installed app. |
|
|
446
|
+
| `client.internal.apps.listCatalog` | `GET /openmeter/app-catalog` | List available apps. |
|
|
447
|
+
| `client.internal.apps.getCatalogItem` | `GET /openmeter/app-catalog/{appType}` | Get an app catalog item by type. |
|
|
448
|
+
| `client.internal.apps.install` | `POST /openmeter/app-catalog/install` | Install an app from the catalog. |
|
|
425
449
|
|
|
426
450
|
### Internal Invoices
|
|
427
451
|
|
|
428
|
-
| Method
|
|
429
|
-
|
|
|
430
|
-
| `client.internal.invoices.list`
|
|
431
|
-
| `client.internal.invoices.get`
|
|
432
|
-
| `client.internal.invoices.update`
|
|
433
|
-
| `client.internal.invoices.delete`
|
|
452
|
+
| Method | HTTP | Description |
|
|
453
|
+
| --------------------------------------------- | ------------------------------------------------------------------ | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
454
|
+
| `client.internal.invoices.list` | `GET /openmeter/billing/invoices` | List billing invoices. Returns a page of invoices. Gathering invoices are never included. Use `filter` to narrow by status, customer, dates, or service period start. Use `sort` to control ordering. |
|
|
455
|
+
| `client.internal.invoices.get` | `GET /openmeter/billing/invoices/{invoiceId}` | Get a billing invoice by ID. Returns the full invoice resource including line items, status details, totals, and workflow configuration snapshot. |
|
|
456
|
+
| `client.internal.invoices.update` | `PUT /openmeter/billing/invoices/{invoiceId}` | Update a billing invoice. Only the mutable fields of the invoice can be edited: description, labels, supplier, customer, workflow settings, and top-level lines. Top-level lines are matched by `id`; lines without an `id` are created, and existing lines omitted from `lines` are deleted. Detailed (child) lines are always computed and cannot be edited directly. Only invoices in draft status can be updated. |
|
|
457
|
+
| `client.internal.invoices.delete` | `DELETE /openmeter/billing/invoices/{invoiceId}` | Delete a billing invoice. Only standard invoices in draft status can be deleted. Deleting an invoice will also delete all associated line items and workflow configuration. |
|
|
458
|
+
| `client.internal.invoices.advance` | `POST /openmeter/billing/invoices/{invoiceId}/advance` | Advance a billing invoice. Advances the invoice to the next workflow state. The next state is determined by the invoice's current status and workflow configuration. Only invoices in draft or issued status can be advanced. |
|
|
459
|
+
| `client.internal.invoices.approve` | `POST /openmeter/billing/invoices/{invoiceId}/approve` | Approve a billing invoice. This call instantly sends the invoice to the customer using the configured billing profile app. This call is valid in two invoice statuses: - draft: the invoice will be sent to the customer, the invoice state becomes issued - manual_approval_needed: the invoice will be sent to the customer, the invoice state becomes issued |
|
|
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. |
|
|
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. |
|
|
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. |
|
|
434
468
|
|
|
435
469
|
### Internal Currencies
|
|
436
470
|
|
|
@@ -438,14 +472,21 @@ they can change or be removed without notice or semver consideration.
|
|
|
438
472
|
| ------------------------------------------------- | ----------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------ |
|
|
439
473
|
| `client.internal.currencies.list` | `GET /openmeter/currencies` | List currencies supported by the billing system. |
|
|
440
474
|
| `client.internal.currencies.createCustomCurrency` | `POST /openmeter/currencies/custom` | Create a custom currency. This operation allows defining your own custom currency for billing purposes. |
|
|
475
|
+
| `client.internal.currencies.getCustomCurrency` | `GET /openmeter/currencies/custom/{currencyId}` | Get a custom currency. |
|
|
441
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. |
|
|
442
477
|
| `client.internal.currencies.createCostBasis` | `POST /openmeter/currencies/custom/{currencyId}/cost-bases` | Create a cost basis for a currency. |
|
|
443
478
|
|
|
444
|
-
### 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
|
|
445
486
|
|
|
446
|
-
| Method
|
|
447
|
-
|
|
|
448
|
-
| `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._ |
|
|
449
490
|
|
|
450
491
|
## Runtime Validation (validate option)
|
|
451
492
|
|
package/dist/core.js
CHANGED
|
@@ -22,10 +22,13 @@ export class Client {
|
|
|
22
22
|
beforeRequest: [
|
|
23
23
|
...(options.hooks?.beforeRequest ?? []),
|
|
24
24
|
async ({ request }) => {
|
|
25
|
-
//
|
|
26
|
-
// it
|
|
27
|
-
//
|
|
28
|
-
|
|
25
|
+
// User-Agent is settable on the web but is not CORS-safelisted, so
|
|
26
|
+
// setting it would preflight otherwise-simple cross-origin requests.
|
|
27
|
+
// Gate on a positive Node check, not `window`: workers are also
|
|
28
|
+
// CORS-bound yet have no `window`.
|
|
29
|
+
if (typeof process !== 'undefined' &&
|
|
30
|
+
process.versions?.node != null &&
|
|
31
|
+
!request.headers.has('User-Agent')) {
|
|
29
32
|
request.headers.set('User-Agent', `openmeter-node/${SDK_VERSION}`);
|
|
30
33
|
}
|
|
31
34
|
const token = typeof options.apiKey === 'function'
|
package/dist/funcs/addons.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import { http } from '../core.js';
|
|
3
3
|
import { request } from '../lib/request.js';
|
|
4
4
|
import { toURLSearchParams, encodeSort } from '../lib/encodings.js';
|
|
5
|
-
import { toWire, fromWire, assertValid, toSnakeCase } from '../lib/wire.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
|
|
@@ -13,6 +13,9 @@ import * as schemas from '../models/schemas.js';
|
|
|
13
13
|
*/
|
|
14
14
|
export function listAddons(client, req = {}, options) {
|
|
15
15
|
return request(() => {
|
|
16
|
+
if (client._options.validate && req.sort !== undefined) {
|
|
17
|
+
assertValid(schemas.listAddonsQueryParams.shape.sort, req.sort);
|
|
18
|
+
}
|
|
16
19
|
const query = toWire({
|
|
17
20
|
page: req.page,
|
|
18
21
|
sort: encodeSort(req.sort, toSnakeCase),
|
|
@@ -66,11 +69,20 @@ export function createAddon(client, req, options) {
|
|
|
66
69
|
*/
|
|
67
70
|
export function updateAddon(client, req, options) {
|
|
68
71
|
return request(() => {
|
|
72
|
+
const pathParamsInput = {
|
|
73
|
+
addonId: req.addonId,
|
|
74
|
+
};
|
|
75
|
+
const pathParams = client._options.validate
|
|
76
|
+
? toPathWire(pathParamsInput, schemas.updateAddonPathParams)
|
|
77
|
+
: pathParamsInput;
|
|
78
|
+
if (client._options.validate) {
|
|
79
|
+
assertValid(schemas.updateAddonPathParamsWire, pathParams);
|
|
80
|
+
}
|
|
69
81
|
const path = `openmeter/addons/${(() => {
|
|
70
|
-
if (
|
|
82
|
+
if (pathParams.addonId === undefined) {
|
|
71
83
|
throw new Error('missing path parameter: addonId');
|
|
72
84
|
}
|
|
73
|
-
return encodeURIComponent(String(
|
|
85
|
+
return encodeURIComponent(String(pathParams.addonId));
|
|
74
86
|
})()}`;
|
|
75
87
|
const body = toWire(req.body, schemas.updateAddonBody);
|
|
76
88
|
if (client._options.validate) {
|
|
@@ -96,11 +108,20 @@ export function updateAddon(client, req, options) {
|
|
|
96
108
|
*/
|
|
97
109
|
export function getAddon(client, req, options) {
|
|
98
110
|
return request(() => {
|
|
111
|
+
const pathParamsInput = {
|
|
112
|
+
addonId: req.addonId,
|
|
113
|
+
};
|
|
114
|
+
const pathParams = client._options.validate
|
|
115
|
+
? toPathWire(pathParamsInput, schemas.getAddonPathParams)
|
|
116
|
+
: pathParamsInput;
|
|
117
|
+
if (client._options.validate) {
|
|
118
|
+
assertValid(schemas.getAddonPathParamsWire, pathParams);
|
|
119
|
+
}
|
|
99
120
|
const path = `openmeter/addons/${(() => {
|
|
100
|
-
if (
|
|
121
|
+
if (pathParams.addonId === undefined) {
|
|
101
122
|
throw new Error('missing path parameter: addonId');
|
|
102
123
|
}
|
|
103
|
-
return encodeURIComponent(String(
|
|
124
|
+
return encodeURIComponent(String(pathParams.addonId));
|
|
104
125
|
})()}`;
|
|
105
126
|
return http(client)
|
|
106
127
|
.get(path, options)
|
|
@@ -122,11 +143,20 @@ export function getAddon(client, req, options) {
|
|
|
122
143
|
*/
|
|
123
144
|
export function deleteAddon(client, req, options) {
|
|
124
145
|
return request(async () => {
|
|
146
|
+
const pathParamsInput = {
|
|
147
|
+
addonId: req.addonId,
|
|
148
|
+
};
|
|
149
|
+
const pathParams = client._options.validate
|
|
150
|
+
? toPathWire(pathParamsInput, schemas.deleteAddonPathParams)
|
|
151
|
+
: pathParamsInput;
|
|
152
|
+
if (client._options.validate) {
|
|
153
|
+
assertValid(schemas.deleteAddonPathParamsWire, pathParams);
|
|
154
|
+
}
|
|
125
155
|
const path = `openmeter/addons/${(() => {
|
|
126
|
-
if (
|
|
156
|
+
if (pathParams.addonId === undefined) {
|
|
127
157
|
throw new Error('missing path parameter: addonId');
|
|
128
158
|
}
|
|
129
|
-
return encodeURIComponent(String(
|
|
159
|
+
return encodeURIComponent(String(pathParams.addonId));
|
|
130
160
|
})()}`;
|
|
131
161
|
await http(client).delete(path, options);
|
|
132
162
|
});
|
|
@@ -140,11 +170,20 @@ export function deleteAddon(client, req, options) {
|
|
|
140
170
|
*/
|
|
141
171
|
export function archiveAddon(client, req, options) {
|
|
142
172
|
return request(() => {
|
|
173
|
+
const pathParamsInput = {
|
|
174
|
+
addonId: req.addonId,
|
|
175
|
+
};
|
|
176
|
+
const pathParams = client._options.validate
|
|
177
|
+
? toPathWire(pathParamsInput, schemas.archiveAddonPathParams)
|
|
178
|
+
: pathParamsInput;
|
|
179
|
+
if (client._options.validate) {
|
|
180
|
+
assertValid(schemas.archiveAddonPathParamsWire, pathParams);
|
|
181
|
+
}
|
|
143
182
|
const path = `openmeter/addons/${(() => {
|
|
144
|
-
if (
|
|
183
|
+
if (pathParams.addonId === undefined) {
|
|
145
184
|
throw new Error('missing path parameter: addonId');
|
|
146
185
|
}
|
|
147
|
-
return encodeURIComponent(String(
|
|
186
|
+
return encodeURIComponent(String(pathParams.addonId));
|
|
148
187
|
})()}/archive`;
|
|
149
188
|
return http(client)
|
|
150
189
|
.post(path, options)
|
|
@@ -166,11 +205,20 @@ export function archiveAddon(client, req, options) {
|
|
|
166
205
|
*/
|
|
167
206
|
export function publishAddon(client, req, options) {
|
|
168
207
|
return request(() => {
|
|
208
|
+
const pathParamsInput = {
|
|
209
|
+
addonId: req.addonId,
|
|
210
|
+
};
|
|
211
|
+
const pathParams = client._options.validate
|
|
212
|
+
? toPathWire(pathParamsInput, schemas.publishAddonPathParams)
|
|
213
|
+
: pathParamsInput;
|
|
214
|
+
if (client._options.validate) {
|
|
215
|
+
assertValid(schemas.publishAddonPathParamsWire, pathParams);
|
|
216
|
+
}
|
|
169
217
|
const path = `openmeter/addons/${(() => {
|
|
170
|
-
if (
|
|
218
|
+
if (pathParams.addonId === undefined) {
|
|
171
219
|
throw new Error('missing path parameter: addonId');
|
|
172
220
|
}
|
|
173
|
-
return encodeURIComponent(String(
|
|
221
|
+
return encodeURIComponent(String(pathParams.addonId));
|
|
174
222
|
})()}/publish`;
|
|
175
223
|
return http(client)
|
|
176
224
|
.post(path, options)
|
package/dist/funcs/apps.d.ts
CHANGED
|
@@ -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 { ListAppsRequest, ListAppsResponse, GetAppRequest, GetAppResponse } from '../models/operations/apps.js';
|
|
3
|
+
import type { ListAppsRequest, ListAppsResponse, GetAppRequest, GetAppResponse, UninstallAppRequest, UninstallAppResponse, UpdateAppRequest, UpdateAppResponse, ListAppCatalogRequest, ListAppCatalogResponse, GetAppCatalogItemRequest, GetAppCatalogItemResponse, InstallAppRequest, InstallAppResponse } from '../models/operations/apps.js';
|
|
4
4
|
/**
|
|
5
5
|
* List apps
|
|
6
6
|
*
|
|
@@ -17,3 +17,43 @@ export declare function listApps(client: Client, req?: ListAppsRequest, options?
|
|
|
17
17
|
* GET /openmeter/apps/{appId}
|
|
18
18
|
*/
|
|
19
19
|
export declare function getApp(client: Client, req: GetAppRequest, options?: RequestOptions): Promise<Result<GetAppResponse>>;
|
|
20
|
+
/**
|
|
21
|
+
* Uninstall app
|
|
22
|
+
*
|
|
23
|
+
* Uninstall an app by ID.
|
|
24
|
+
*
|
|
25
|
+
* DELETE /openmeter/apps/{appId}
|
|
26
|
+
*/
|
|
27
|
+
export declare function uninstallApp(client: Client, req: UninstallAppRequest, options?: RequestOptions): Promise<Result<UninstallAppResponse>>;
|
|
28
|
+
/**
|
|
29
|
+
* Update app
|
|
30
|
+
*
|
|
31
|
+
* Update an installed app.
|
|
32
|
+
*
|
|
33
|
+
* PUT /openmeter/apps/{appId}
|
|
34
|
+
*/
|
|
35
|
+
export declare function updateApp(client: Client, req: UpdateAppRequest, options?: RequestOptions): Promise<Result<UpdateAppResponse>>;
|
|
36
|
+
/**
|
|
37
|
+
* List app catalog
|
|
38
|
+
*
|
|
39
|
+
* List available apps.
|
|
40
|
+
*
|
|
41
|
+
* GET /openmeter/app-catalog
|
|
42
|
+
*/
|
|
43
|
+
export declare function listAppCatalog(client: Client, req?: ListAppCatalogRequest, options?: RequestOptions): Promise<Result<ListAppCatalogResponse>>;
|
|
44
|
+
/**
|
|
45
|
+
* Get app catalog item by type
|
|
46
|
+
*
|
|
47
|
+
* Get an app catalog item by type.
|
|
48
|
+
*
|
|
49
|
+
* GET /openmeter/app-catalog/{appType}
|
|
50
|
+
*/
|
|
51
|
+
export declare function getAppCatalogItem(client: Client, req: GetAppCatalogItemRequest, options?: RequestOptions): Promise<Result<GetAppCatalogItemResponse>>;
|
|
52
|
+
/**
|
|
53
|
+
* Install app from the catalog
|
|
54
|
+
*
|
|
55
|
+
* Install an app from the catalog.
|
|
56
|
+
*
|
|
57
|
+
* POST /openmeter/app-catalog/install
|
|
58
|
+
*/
|
|
59
|
+
export declare function installApp(client: Client, req: InstallAppRequest, options?: RequestOptions): Promise<Result<InstallAppResponse>>;
|