@openmeter/client 1.0.0-beta-bd9f8e1a6771 → 1.0.0-beta-caeeb30ac1a7
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 +28 -22
- package/dist/lib/version.d.ts +1 -1
- package/dist/lib/version.js +1 -1
- package/dist/sdk/customers.d.ts +1 -17
- package/dist/sdk/customers.js +1 -19
- package/dist/sdk/internal.d.ts +35 -0
- package/dist/sdk/internal.js +49 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -34,6 +34,7 @@ TypeSpec definitions and ships fully-typed request and response models.
|
|
|
34
34
|
- [PlanAddons](#planaddons)
|
|
35
35
|
- [Defaults](#defaults)
|
|
36
36
|
- [Internal Operations](#internal-operations)
|
|
37
|
+
- [Internal Customers](#internal-customers)
|
|
37
38
|
- [Internal Subscriptions](#internal-subscriptions)
|
|
38
39
|
- [Internal Apps](#internal-apps)
|
|
39
40
|
- [Internal Invoices](#internal-invoices)
|
|
@@ -279,28 +280,27 @@ The full call path, HTTP route, and a short description are listed below.
|
|
|
279
280
|
|
|
280
281
|
### Customers
|
|
281
282
|
|
|
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.
|
|
302
|
-
| `client.customers.charges.
|
|
303
|
-
| `client.customers.charges.create` | `POST /openmeter/customers/{customerId}/charges` | Create customer charge. |
|
|
283
|
+
| Method | HTTP | Description |
|
|
284
|
+
| ---------------------------------------------------------- | ------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
285
|
+
| `client.customers.create` | `POST /openmeter/customers` | Create customer |
|
|
286
|
+
| `client.customers.get` | `GET /openmeter/customers/{customerId}` | Get customer |
|
|
287
|
+
| `client.customers.list` | `GET /openmeter/customers` | List customers |
|
|
288
|
+
| `client.customers.upsert` | `PUT /openmeter/customers/{customerId}` | Upsert customer |
|
|
289
|
+
| `client.customers.delete` | `DELETE /openmeter/customers/{customerId}` | Delete customer |
|
|
290
|
+
| `client.customers.billing.get` | `GET /openmeter/customers/{customerId}/billing` | Get customer billing data |
|
|
291
|
+
| `client.customers.billing.update` | `PUT /openmeter/customers/{customerId}/billing` | Update customer billing data |
|
|
292
|
+
| `client.customers.billing.updateAppData` | `PUT /openmeter/customers/{customerId}/billing/app-data` | Update customer billing app data |
|
|
293
|
+
| `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. |
|
|
294
|
+
| `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. |
|
|
295
|
+
| `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. |
|
|
296
|
+
| `client.customers.credits.grants.get` | `GET /openmeter/customers/{customerId}/credits/grants/{creditGrantId}` | Get a credit grant. |
|
|
297
|
+
| `client.customers.credits.grants.list` | `GET /openmeter/customers/{customerId}/credits/grants` | List credit grants. |
|
|
298
|
+
| `client.customers.credits.balance.get` | `GET /openmeter/customers/{customerId}/credits/balance` | Get a credit balance. |
|
|
299
|
+
| `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 |
|
|
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. |
|
|
304
304
|
|
|
305
305
|
### Entitlements
|
|
306
306
|
|
|
@@ -410,6 +410,12 @@ Operations marked internal in the API definition are exposed under
|
|
|
410
410
|
intended for customer use: they may require additional permissions, and
|
|
411
411
|
they can change or be removed without notice or semver consideration.
|
|
412
412
|
|
|
413
|
+
### Internal Customers
|
|
414
|
+
|
|
415
|
+
| Method | HTTP | Description |
|
|
416
|
+
| ----------------------------------------------- | ---------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
417
|
+
| `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. |
|
|
418
|
+
|
|
413
419
|
### Internal Subscriptions
|
|
414
420
|
|
|
415
421
|
| Method | HTTP | Description |
|
package/dist/lib/version.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const SDK_VERSION = "1.0.0-beta-
|
|
1
|
+
export declare const SDK_VERSION = "1.0.0-beta-caeeb30ac1a7";
|
package/dist/lib/version.js
CHANGED
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
// The committed value is a dev placeholder. The publish flow
|
|
3
3
|
// (`make -C api/spec publish-aip-sdk`) stamps the real release version here
|
|
4
4
|
// before `pnpm publish`, after `pnpm version` updates package.json.
|
|
5
|
-
export const SDK_VERSION = '1.0.0-beta-
|
|
5
|
+
export const SDK_VERSION = '1.0.0-beta-caeeb30ac1a7';
|
package/dist/sdk/customers.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { type Client } from '../core.js';
|
|
2
2
|
import { 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,
|
|
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, UpdateCreditGrantExternalSettlementRequest, UpdateCreditGrantExternalSettlementResponse, ListCreditTransactionsRequest, ListCreditTransactionsResponse, ListCustomerChargesRequest, ListCustomerChargesResponse, CreateCustomerChargesRequest, CreateCustomerChargesResponse } from '../models/operations/customers.js';
|
|
4
4
|
import type { Charge, CreditGrant, CreditTransaction, Customer } from '../models/types.js';
|
|
5
5
|
export declare class Customers {
|
|
6
6
|
private readonly _client;
|
|
@@ -153,22 +153,6 @@ export declare class CustomersCreditsGrants {
|
|
|
153
153
|
* GET /openmeter/customers/{customerId}/credits/grants
|
|
154
154
|
*/
|
|
155
155
|
listAll(request: ListCreditGrantsRequest, options?: RequestOptions): AsyncIterable<CreditGrant>;
|
|
156
|
-
/**
|
|
157
|
-
* Void credit grant
|
|
158
|
-
*
|
|
159
|
-
* Void a credit grant, forfeiting the remaining unused balance.
|
|
160
|
-
*
|
|
161
|
-
* Voiding is a forward-looking, irreversible operation. Credits already consumed
|
|
162
|
-
* by usage remain unaffected — only the remaining balance is forfeited. The grant
|
|
163
|
-
* reads as `voided` status afterwards. Payment state is not adjusted when
|
|
164
|
-
* `payment_adjustment` is `none`, so invoice-backed or externally collected
|
|
165
|
-
* payments may still collect the original amount. Only `active` grants can be
|
|
166
|
-
* voided; voiding a pending, expired, or fully consumed grant returns a conflict.
|
|
167
|
-
* Retrying a successful void is an idempotent success.
|
|
168
|
-
*
|
|
169
|
-
* POST /openmeter/customers/{customerId}/credits/grants/{creditGrantId}/void
|
|
170
|
-
*/
|
|
171
|
-
void(request: VoidCreditGrantRequest, options?: RequestOptions): Promise<VoidCreditGrantResponse>;
|
|
172
156
|
/**
|
|
173
157
|
* Update credit grant external settlement status
|
|
174
158
|
*
|
package/dist/sdk/customers.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// Code generated by @openmeter/typespec-typescript. DO NOT EDIT.
|
|
2
2
|
import { unwrap } from '../lib/types.js';
|
|
3
3
|
import { paginateCursor, paginatePages } from '../lib/paginate.js';
|
|
4
|
-
import { createCustomer, getCustomer, listCustomers, upsertCustomer, deleteCustomer, getCustomerBilling, updateCustomerBilling, updateCustomerBillingAppData, createCustomerStripeCheckoutSession, createCustomerStripePortalSession, createCreditGrant, getCreditGrant, listCreditGrants, getCustomerCreditBalance, createCreditAdjustment,
|
|
4
|
+
import { createCustomer, getCustomer, listCustomers, upsertCustomer, deleteCustomer, getCustomerBilling, updateCustomerBilling, updateCustomerBillingAppData, createCustomerStripeCheckoutSession, createCustomerStripePortalSession, createCreditGrant, getCreditGrant, listCreditGrants, getCustomerCreditBalance, createCreditAdjustment, updateCreditGrantExternalSettlement, listCreditTransactions, listCustomerCharges, createCustomerCharges, } from '../funcs/customers.js';
|
|
5
5
|
export class Customers {
|
|
6
6
|
_client;
|
|
7
7
|
constructor(_client) {
|
|
@@ -205,24 +205,6 @@ export class CustomersCreditsGrants {
|
|
|
205
205
|
listAll(request, options) {
|
|
206
206
|
return paginatePages((req, opts) => listCreditGrants(this._client, req, opts), request, options);
|
|
207
207
|
}
|
|
208
|
-
/**
|
|
209
|
-
* Void credit grant
|
|
210
|
-
*
|
|
211
|
-
* Void a credit grant, forfeiting the remaining unused balance.
|
|
212
|
-
*
|
|
213
|
-
* Voiding is a forward-looking, irreversible operation. Credits already consumed
|
|
214
|
-
* by usage remain unaffected — only the remaining balance is forfeited. The grant
|
|
215
|
-
* reads as `voided` status afterwards. Payment state is not adjusted when
|
|
216
|
-
* `payment_adjustment` is `none`, so invoice-backed or externally collected
|
|
217
|
-
* payments may still collect the original amount. Only `active` grants can be
|
|
218
|
-
* voided; voiding a pending, expired, or fully consumed grant returns a conflict.
|
|
219
|
-
* Retrying a successful void is an idempotent success.
|
|
220
|
-
*
|
|
221
|
-
* POST /openmeter/customers/{customerId}/credits/grants/{creditGrantId}/void
|
|
222
|
-
*/
|
|
223
|
-
async void(request, options) {
|
|
224
|
-
return unwrap(await voidCreditGrant(this._client, request, options));
|
|
225
|
-
}
|
|
226
208
|
/**
|
|
227
209
|
* Update credit grant external settlement status
|
|
228
210
|
*
|
package/dist/sdk/internal.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { type Client } from '../core.js';
|
|
2
2
|
import { type RequestOptions } from '../lib/types.js';
|
|
3
|
+
import type { VoidCreditGrantRequest, VoidCreditGrantResponse } from '../models/operations/customers.js';
|
|
3
4
|
import type { CreateSubscriptionAddonRequest, CreateSubscriptionAddonResponse } from '../models/operations/subscriptions.js';
|
|
4
5
|
import type { ListAppsRequest, ListAppsResponse, GetAppRequest, GetAppResponse, UninstallAppRequest, UninstallAppResponse, UpdateAppRequest, UpdateAppResponse, ListAppCatalogRequest, ListAppCatalogResponse, GetAppCatalogItemRequest, GetAppCatalogItemResponse, InstallAppRequest, InstallAppResponse } from '../models/operations/apps.js';
|
|
5
6
|
import type { ListInvoicesRequest, ListInvoicesResponse, GetInvoiceRequest, GetInvoiceResponse, UpdateInvoiceRequest, UpdateInvoiceResponse, DeleteInvoiceRequest, DeleteInvoiceResponse, AdvanceInvoiceRequest, AdvanceInvoiceResponse, ApproveInvoiceRequest, ApproveInvoiceResponse, RetryInvoiceRequest, RetryInvoiceResponse, SnapshotQuantitiesInvoiceRequest, SnapshotQuantitiesInvoiceResponse } from '../models/operations/invoices.js';
|
|
@@ -14,6 +15,8 @@ import type { App, AppCatalogItem, CostBasis, Currency, Invoice } from '../model
|
|
|
14
15
|
export declare class Internal {
|
|
15
16
|
private readonly _client;
|
|
16
17
|
constructor(_client: Client);
|
|
18
|
+
private _customers?;
|
|
19
|
+
get customers(): InternalCustomers;
|
|
17
20
|
private _subscriptions?;
|
|
18
21
|
get subscriptions(): InternalSubscriptions;
|
|
19
22
|
private _apps?;
|
|
@@ -25,6 +28,38 @@ export declare class Internal {
|
|
|
25
28
|
private _governance?;
|
|
26
29
|
get governance(): InternalGovernance;
|
|
27
30
|
}
|
|
31
|
+
export declare class InternalCustomers {
|
|
32
|
+
private readonly _client;
|
|
33
|
+
constructor(_client: Client);
|
|
34
|
+
private _credits?;
|
|
35
|
+
get credits(): InternalCustomersCredits;
|
|
36
|
+
}
|
|
37
|
+
export declare class InternalCustomersCredits {
|
|
38
|
+
private readonly _client;
|
|
39
|
+
constructor(_client: Client);
|
|
40
|
+
private _grants?;
|
|
41
|
+
get grants(): InternalCustomersCreditsGrants;
|
|
42
|
+
}
|
|
43
|
+
export declare class InternalCustomersCreditsGrants {
|
|
44
|
+
private readonly _client;
|
|
45
|
+
constructor(_client: Client);
|
|
46
|
+
/**
|
|
47
|
+
* Void credit grant
|
|
48
|
+
*
|
|
49
|
+
* Void a credit grant, forfeiting the remaining unused balance.
|
|
50
|
+
*
|
|
51
|
+
* Voiding is a forward-looking, irreversible operation. Credits already consumed
|
|
52
|
+
* by usage remain unaffected — only the remaining balance is forfeited. The grant
|
|
53
|
+
* reads as `voided` status afterwards. Payment state is not adjusted when
|
|
54
|
+
* `payment_adjustment` is `none`, so invoice-backed or externally collected
|
|
55
|
+
* payments may still collect the original amount. Only `active` grants can be
|
|
56
|
+
* voided; voiding a pending, expired, or fully consumed grant returns a conflict.
|
|
57
|
+
* Retrying a successful void is an idempotent success.
|
|
58
|
+
*
|
|
59
|
+
* POST /openmeter/customers/{customerId}/credits/grants/{creditGrantId}/void
|
|
60
|
+
*/
|
|
61
|
+
void(request: VoidCreditGrantRequest, options?: RequestOptions): Promise<VoidCreditGrantResponse>;
|
|
62
|
+
}
|
|
28
63
|
export declare class InternalSubscriptions {
|
|
29
64
|
private readonly _client;
|
|
30
65
|
constructor(_client: Client);
|
package/dist/sdk/internal.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
// Code generated by @openmeter/typespec-typescript. DO NOT EDIT.
|
|
2
2
|
import { unwrap } from '../lib/types.js';
|
|
3
3
|
import { paginatePages } from '../lib/paginate.js';
|
|
4
|
+
import { voidCreditGrant } from '../funcs/customers.js';
|
|
4
5
|
import { createSubscriptionAddon } from '../funcs/subscriptions.js';
|
|
5
6
|
import { listApps, getApp, uninstallApp, updateApp, listAppCatalog, getAppCatalogItem, installApp, } from '../funcs/apps.js';
|
|
6
7
|
import { listInvoices, getInvoice, updateInvoice, deleteInvoice, advanceInvoice, approveInvoice, retryInvoice, snapshotQuantitiesInvoice, } from '../funcs/invoices.js';
|
|
@@ -16,6 +17,10 @@ export class Internal {
|
|
|
16
17
|
constructor(_client) {
|
|
17
18
|
this._client = _client;
|
|
18
19
|
}
|
|
20
|
+
_customers;
|
|
21
|
+
get customers() {
|
|
22
|
+
return (this._customers ??= new InternalCustomers(this._client));
|
|
23
|
+
}
|
|
19
24
|
_subscriptions;
|
|
20
25
|
get subscriptions() {
|
|
21
26
|
return (this._subscriptions ??= new InternalSubscriptions(this._client));
|
|
@@ -37,6 +42,50 @@ export class Internal {
|
|
|
37
42
|
return (this._governance ??= new InternalGovernance(this._client));
|
|
38
43
|
}
|
|
39
44
|
}
|
|
45
|
+
export class InternalCustomers {
|
|
46
|
+
_client;
|
|
47
|
+
constructor(_client) {
|
|
48
|
+
this._client = _client;
|
|
49
|
+
}
|
|
50
|
+
_credits;
|
|
51
|
+
get credits() {
|
|
52
|
+
return (this._credits ??= new InternalCustomersCredits(this._client));
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
export class InternalCustomersCredits {
|
|
56
|
+
_client;
|
|
57
|
+
constructor(_client) {
|
|
58
|
+
this._client = _client;
|
|
59
|
+
}
|
|
60
|
+
_grants;
|
|
61
|
+
get grants() {
|
|
62
|
+
return (this._grants ??= new InternalCustomersCreditsGrants(this._client));
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
export class InternalCustomersCreditsGrants {
|
|
66
|
+
_client;
|
|
67
|
+
constructor(_client) {
|
|
68
|
+
this._client = _client;
|
|
69
|
+
}
|
|
70
|
+
/**
|
|
71
|
+
* Void credit grant
|
|
72
|
+
*
|
|
73
|
+
* Void a credit grant, forfeiting the remaining unused balance.
|
|
74
|
+
*
|
|
75
|
+
* Voiding is a forward-looking, irreversible operation. Credits already consumed
|
|
76
|
+
* by usage remain unaffected — only the remaining balance is forfeited. The grant
|
|
77
|
+
* reads as `voided` status afterwards. Payment state is not adjusted when
|
|
78
|
+
* `payment_adjustment` is `none`, so invoice-backed or externally collected
|
|
79
|
+
* payments may still collect the original amount. Only `active` grants can be
|
|
80
|
+
* voided; voiding a pending, expired, or fully consumed grant returns a conflict.
|
|
81
|
+
* Retrying a successful void is an idempotent success.
|
|
82
|
+
*
|
|
83
|
+
* POST /openmeter/customers/{customerId}/credits/grants/{creditGrantId}/void
|
|
84
|
+
*/
|
|
85
|
+
async void(request, options) {
|
|
86
|
+
return unwrap(await voidCreditGrant(this._client, request, options));
|
|
87
|
+
}
|
|
88
|
+
}
|
|
40
89
|
export class InternalSubscriptions {
|
|
41
90
|
_client;
|
|
42
91
|
constructor(_client) {
|