@openmeter/client 1.0.0-beta.236 → 1.0.0-beta.238
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 +31 -22
- package/dist/funcs/charges.d.ts +11 -1
- package/dist/funcs/charges.js +45 -1
- package/dist/funcs/customers.d.ts +29 -1
- package/dist/funcs/customers.js +96 -2
- package/dist/funcs/features.js +1 -1
- package/dist/funcs/notifications.d.ts +15 -15
- package/dist/funcs/notifications.js +73 -73
- package/dist/index.d.ts +1 -1
- package/dist/lib/paginate.d.ts +12 -6
- package/dist/lib/paginate.js +23 -9
- package/dist/lib/version.d.ts +1 -1
- package/dist/lib/version.js +1 -1
- package/dist/models/operations/charges.d.ts +16 -3
- package/dist/models/operations/customers.d.ts +26 -6
- package/dist/models/operations/entitlementAccess.d.ts +3 -2
- package/dist/models/operations/events.d.ts +3 -2
- package/dist/models/operations/features.d.ts +1 -1
- package/dist/models/operations/notifications.d.ts +33 -33
- package/dist/models/schemas.d.ts +93856 -42843
- package/dist/models/schemas.js +5228 -911
- package/dist/models/types.d.ts +2626 -378
- package/dist/sdk/charges.d.ts +11 -1
- package/dist/sdk/charges.js +13 -1
- package/dist/sdk/customers.d.ts +15 -1
- package/dist/sdk/customers.js +17 -1
- package/dist/sdk/internal.d.ts +39 -12
- package/dist/sdk/internal.js +60 -23
- package/dist/sdk/notifications.d.ts +7 -7
- package/dist/sdk/notifications.js +13 -13
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -41,6 +41,7 @@ TypeSpec definitions and ships fully-typed request and response models.
|
|
|
41
41
|
- [EntitlementAccess](#entitlementaccess)
|
|
42
42
|
- [Notifications](#notifications)
|
|
43
43
|
- [Internal Operations](#internal-operations)
|
|
44
|
+
- [Internal Customers](#internal-customers)
|
|
44
45
|
- [Internal Subscriptions](#internal-subscriptions)
|
|
45
46
|
- [Internal Apps](#internal-apps)
|
|
46
47
|
- [Internal Notifications](#internal-notifications)
|
|
@@ -292,7 +293,8 @@ The full call path, HTTP route, and a short description are listed below.
|
|
|
292
293
|
| `client.customers.upsert` | `PUT /openmeter/customers/{customerId}` | Upsert customer |
|
|
293
294
|
| `client.customers.delete` | `DELETE /openmeter/customers/{customerId}` | Delete customer |
|
|
294
295
|
| `client.customers.billing.get` | `GET /openmeter/customers/{customerId}/billing` | Get customer billing data |
|
|
295
|
-
| `client.customers.billing.update` | `PUT /openmeter/customers/{customerId}/billing` | Update
|
|
296
|
+
| `client.customers.billing.update` | `PUT /openmeter/customers/{customerId}/billing` | Update billing data while preserving the current profile selection when billing_profile is omitted or null. Use the dedicated billing profile endpoint to remove the selection. |
|
|
297
|
+
| `client.customers.billing.updateProfile` | `PUT /openmeter/customers/{customerId}/billing/profile` | Set the customer's explicit billing profile selection. Omitting billing_profile or setting it to null removes the selection and uses the current namespace default. |
|
|
296
298
|
| `client.customers.billing.updateAppData` | `PUT /openmeter/customers/{customerId}/billing/app-data` | Update customer billing app data |
|
|
297
299
|
| `client.customers.billing.createStripeCheckoutSession` | `POST /openmeter/customers/{customerId}/billing/stripe/checkout-sessions` | Create a [Stripe Checkout Session](https://docs.stripe.com/payments/checkout) for the customer. Creates a Checkout Session for collecting payment method information from customers. The session operates in "setup" mode, which collects payment details without charging the customer immediately. The collected payment method can be used for future subscription billing. For hosted checkout sessions, redirect customers to the returned URL. For embedded sessions, use the client_secret to initialize Stripe.js in your application. |
|
|
298
300
|
| `client.customers.billing.createStripePortalSession` | `POST /openmeter/customers/{customerId}/billing/stripe/portal-sessions` | Create Stripe Customer Portal Session. Useful to redirect the customer to the Stripe Customer Portal to manage their payment methods, change their billing address and access their invoice history. Only returns URL if the customer billing profile is linked to a stripe app and customer. |
|
|
@@ -388,9 +390,10 @@ The full call path, HTTP route, and a short description are listed below.
|
|
|
388
390
|
|
|
389
391
|
### Charges
|
|
390
392
|
|
|
391
|
-
| Method | HTTP
|
|
392
|
-
| --------------------- |
|
|
393
|
-
| `client.charges.
|
|
393
|
+
| Method | HTTP | Description |
|
|
394
|
+
| --------------------- | ----------------------------------- | ------------------------------------------------------------------------------------------------------------------- |
|
|
395
|
+
| `client.charges.get` | `GET /openmeter/charges/{chargeId}` | Get a flat fee or usage-based charge by ID. Deleted charges are returned with their status and realization history. |
|
|
396
|
+
| `client.charges.list` | `GET /openmeter/charges` | List charges. Returns the charges of every customer that are represented as either flat fee or usage-based charges. |
|
|
394
397
|
|
|
395
398
|
### Tax
|
|
396
399
|
|
|
@@ -482,13 +485,13 @@ The full call path, HTTP route, and a short description are listed below.
|
|
|
482
485
|
|
|
483
486
|
### Notifications
|
|
484
487
|
|
|
485
|
-
| Method
|
|
486
|
-
|
|
|
487
|
-
| `client.notifications.
|
|
488
|
-
| `client.notifications.
|
|
489
|
-
| `client.notifications.
|
|
490
|
-
| `client.notifications.
|
|
491
|
-
| `client.notifications.
|
|
488
|
+
| Method | HTTP | Description |
|
|
489
|
+
| ------------------------------------------- | ----------------------------------------------------------------- | ------------------------------------ |
|
|
490
|
+
| `client.notifications.listBillingChannels` | `GET /openmeter/notification/channels` | List all notification channels. |
|
|
491
|
+
| `client.notifications.createBillingChannel` | `POST /openmeter/notification/channels` | Create a notification channel. |
|
|
492
|
+
| `client.notifications.getBillingChannel` | `GET /openmeter/notification/channels/{notificationChannelId}` | Get a notification channel by id. |
|
|
493
|
+
| `client.notifications.updateBillingChannel` | `PUT /openmeter/notification/channels/{notificationChannelId}` | Update a notification channel by id. |
|
|
494
|
+
| `client.notifications.deleteBillingChannel` | `DELETE /openmeter/notification/channels/{notificationChannelId}` | Delete a notification channel by id. |
|
|
492
495
|
|
|
493
496
|
## Internal Operations
|
|
494
497
|
|
|
@@ -497,6 +500,12 @@ Operations marked internal in the API definition are exposed under
|
|
|
497
500
|
intended for customer use: they may require additional permissions, and
|
|
498
501
|
they can change or be removed without notice or semver consideration.
|
|
499
502
|
|
|
503
|
+
### Internal Customers
|
|
504
|
+
|
|
505
|
+
| Method | HTTP | Description |
|
|
506
|
+
| ------------------------------------------- | -------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
507
|
+
| `client.internal.customers.charges.invoice` | `POST /openmeter/customers/{customerId}/charges/invoice` | Invoice a customer's charges outside the normal billing cycle. Collection alignment is bypassed. The customer's progressive billing setting applies unless explicitly overridden. All eligible pending lines are considered. Returns the created standard invoices, one per collected currency. Lines blocked by their owning engine remain pending. If all eligible lines are blocked or no lines are eligible, returns a validation error. |
|
|
508
|
+
|
|
500
509
|
### Internal Subscriptions
|
|
501
510
|
|
|
502
511
|
| Method | HTTP | Description |
|
|
@@ -512,17 +521,17 @@ they can change or be removed without notice or semver consideration.
|
|
|
512
521
|
|
|
513
522
|
### Internal Notifications
|
|
514
523
|
|
|
515
|
-
| Method
|
|
516
|
-
|
|
|
517
|
-
| `client.internal.notifications.
|
|
518
|
-
| `client.internal.notifications.
|
|
519
|
-
| `client.internal.notifications.
|
|
520
|
-
| `client.internal.notifications.
|
|
521
|
-
| `client.internal.notifications.
|
|
522
|
-
| `client.internal.notifications.
|
|
523
|
-
| `client.internal.notifications.
|
|
524
|
-
| `client.internal.notifications.
|
|
525
|
-
| `client.internal.notifications.
|
|
524
|
+
| Method | HTTP | Description |
|
|
525
|
+
| -------------------------------------------------- | ------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
526
|
+
| `client.internal.notifications.listBillingRules` | `GET /openmeter/notification/rules` | List all notification rules. |
|
|
527
|
+
| `client.internal.notifications.createBillingRule` | `POST /openmeter/notification/rules` | Create a notification rule. |
|
|
528
|
+
| `client.internal.notifications.getBillingRule` | `GET /openmeter/notification/rules/{notificationRuleId}` | Get a notification rule by id. |
|
|
529
|
+
| `client.internal.notifications.updateBillingRule` | `PUT /openmeter/notification/rules/{notificationRuleId}` | Update a notification rule by id. |
|
|
530
|
+
| `client.internal.notifications.deleteBillingRule` | `DELETE /openmeter/notification/rules/{notificationRuleId}` | Delete a notification rule by id. |
|
|
531
|
+
| `client.internal.notifications.testBillingRule` | `POST /openmeter/notification/rules/{notificationRuleId}/test` | Test a notification rule by generating an event with sample data and delivering it to the rule's channels. The test event is persisted and listed like any other event. |
|
|
532
|
+
| `client.internal.notifications.listBillingEvents` | `GET /openmeter/notification/events` | List all notification events. |
|
|
533
|
+
| `client.internal.notifications.getBillingEvent` | `GET /openmeter/notification/events/{notificationEventId}` | Get a notification event by id. |
|
|
534
|
+
| `client.internal.notifications.resendBillingEvent` | `POST /openmeter/notification/events/{notificationEventId}/resend` | Resend a notification event to the channels of the rule that generated it. Delivery is asynchronous: the request marks the selected channels for redelivery and returns immediately. Channels whose delivery is still pending or already being resent are left untouched. |
|
|
526
535
|
|
|
527
536
|
## Runtime Validation (validate option)
|
|
528
537
|
|
package/dist/funcs/charges.d.ts
CHANGED
|
@@ -1,6 +1,16 @@
|
|
|
1
1
|
import { type Client } from '../core.js';
|
|
2
2
|
import { type Result, type RequestOptions } from '../lib/types.js';
|
|
3
|
-
import type { ListChargesRequest, ListChargesResponse } from '../models/operations/charges.js';
|
|
3
|
+
import type { GetChargeRequest, GetChargeResponse, ListChargesRequest, ListChargesResponse } from '../models/operations/charges.js';
|
|
4
|
+
/**
|
|
5
|
+
* Get charge
|
|
6
|
+
*
|
|
7
|
+
* Get a flat fee or usage-based charge by ID.
|
|
8
|
+
*
|
|
9
|
+
* Deleted charges are returned with their status and realization history.
|
|
10
|
+
*
|
|
11
|
+
* GET /openmeter/charges/{chargeId}
|
|
12
|
+
*/
|
|
13
|
+
export declare function getCharge(client: Client, req: GetChargeRequest, options?: RequestOptions): Promise<Result<GetChargeResponse>>;
|
|
4
14
|
/**
|
|
5
15
|
* List charges
|
|
6
16
|
*
|
package/dist/funcs/charges.js
CHANGED
|
@@ -2,8 +2,52 @@
|
|
|
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
|
+
/**
|
|
8
|
+
* Get charge
|
|
9
|
+
*
|
|
10
|
+
* Get a flat fee or usage-based charge by ID.
|
|
11
|
+
*
|
|
12
|
+
* Deleted charges are returned with their status and realization history.
|
|
13
|
+
*
|
|
14
|
+
* GET /openmeter/charges/{chargeId}
|
|
15
|
+
*/
|
|
16
|
+
export function getCharge(client, req, options) {
|
|
17
|
+
return request(() => {
|
|
18
|
+
const pathParamsInput = {
|
|
19
|
+
chargeId: req.chargeId,
|
|
20
|
+
};
|
|
21
|
+
const pathParams = client._options.validate
|
|
22
|
+
? toPathWire(pathParamsInput, schemas.getChargePathParams)
|
|
23
|
+
: pathParamsInput;
|
|
24
|
+
if (client._options.validate) {
|
|
25
|
+
assertValid(schemas.getChargePathParamsWire, pathParams);
|
|
26
|
+
}
|
|
27
|
+
const path = `openmeter/charges/${(() => {
|
|
28
|
+
if (pathParams.chargeId === undefined) {
|
|
29
|
+
throw new Error('missing path parameter: chargeId');
|
|
30
|
+
}
|
|
31
|
+
return encodeURIComponent(String(pathParams.chargeId));
|
|
32
|
+
})()}`;
|
|
33
|
+
const query = toWire({
|
|
34
|
+
expand: req.expand,
|
|
35
|
+
}, schemas.getChargeQueryParams);
|
|
36
|
+
if (client._options.validate) {
|
|
37
|
+
assertValid(schemas.getChargeQueryParamsWire, query);
|
|
38
|
+
}
|
|
39
|
+
const searchParams = toURLSearchParams(query);
|
|
40
|
+
return http(client)
|
|
41
|
+
.get(path, { ...options, searchParams })
|
|
42
|
+
.json()
|
|
43
|
+
.then((data) => {
|
|
44
|
+
if (client._options.validate) {
|
|
45
|
+
assertValid(schemas.getChargeResponseWire, data);
|
|
46
|
+
}
|
|
47
|
+
return fromWire(data, schemas.getChargeResponse);
|
|
48
|
+
});
|
|
49
|
+
});
|
|
50
|
+
}
|
|
7
51
|
/**
|
|
8
52
|
* List charges
|
|
9
53
|
*
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { type Client } from '../core.js';
|
|
2
2
|
import { type Result, type RequestOptions } from '../lib/types.js';
|
|
3
|
-
import type { CreateCustomerRequest, CreateCustomerResponse, GetCustomerRequest, GetCustomerResponse, ListCustomersRequest, ListCustomersResponse, UpsertCustomerRequest, UpsertCustomerResponse, DeleteCustomerRequest, DeleteCustomerResponse, GetCustomerBillingRequest, GetCustomerBillingResponse, UpdateCustomerBillingRequest, UpdateCustomerBillingResponse, UpdateCustomerBillingAppDataRequest, UpdateCustomerBillingAppDataResponse, CreateCustomerStripeCheckoutSessionRequest, CreateCustomerStripeCheckoutSessionResponse, CreateCustomerStripePortalSessionRequest, CreateCustomerStripePortalSessionResponse, CreateCustomerEntitlementRequest, CreateCustomerEntitlementResponse, OverrideCustomerEntitlementRequest, OverrideCustomerEntitlementResponse, GetCustomerEntitlementHistoryRequest, GetCustomerEntitlementHistoryResponse, GetCustomerEntitlementRequest, GetCustomerEntitlementResponse, ListCustomerEntitlementsRequest, ListCustomerEntitlementsResponse, ResetCustomerEntitlementUsageRequest, ResetCustomerEntitlementUsageResponse, DeleteCustomerEntitlementRequest, DeleteCustomerEntitlementResponse, CreateCustomerEntitlementGrantRequest, CreateCustomerEntitlementGrantResponse, ListCustomerEntitlementGrantsRequest, ListCustomerEntitlementGrantsResponse, CreateCreditGrantRequest, CreateCreditGrantResponse, GetCreditGrantRequest, GetCreditGrantResponse, ListCreditGrantsRequest, ListCreditGrantsResponse, GetCustomerCreditBalanceRequest, GetCustomerCreditBalanceResponse, CreateCreditAdjustmentRequest, CreateCreditAdjustmentResponse, VoidCreditGrantRequest, VoidCreditGrantResponse, UpdateCreditGrantExternalSettlementRequest, UpdateCreditGrantExternalSettlementResponse, ListCreditTransactionsRequest, ListCreditTransactionsResponse, ListCustomerChargesRequest, ListCustomerChargesResponse, CreateCustomerChargesRequest, CreateCustomerChargesResponse } from '../models/operations/customers.js';
|
|
3
|
+
import type { CreateCustomerRequest, CreateCustomerResponse, GetCustomerRequest, GetCustomerResponse, ListCustomersRequest, ListCustomersResponse, UpsertCustomerRequest, UpsertCustomerResponse, DeleteCustomerRequest, DeleteCustomerResponse, GetCustomerBillingRequest, GetCustomerBillingResponse, UpdateCustomerBillingRequest, UpdateCustomerBillingResponse, UpdateCustomerBillingProfileRequest, UpdateCustomerBillingProfileResponse, UpdateCustomerBillingAppDataRequest, UpdateCustomerBillingAppDataResponse, CreateCustomerStripeCheckoutSessionRequest, CreateCustomerStripeCheckoutSessionResponse, CreateCustomerStripePortalSessionRequest, CreateCustomerStripePortalSessionResponse, CreateCustomerEntitlementRequest, CreateCustomerEntitlementResponse, OverrideCustomerEntitlementRequest, OverrideCustomerEntitlementResponse, GetCustomerEntitlementHistoryRequest, GetCustomerEntitlementHistoryResponse, GetCustomerEntitlementRequest, GetCustomerEntitlementResponse, ListCustomerEntitlementsRequest, ListCustomerEntitlementsResponse, ResetCustomerEntitlementUsageRequest, ResetCustomerEntitlementUsageResponse, DeleteCustomerEntitlementRequest, DeleteCustomerEntitlementResponse, CreateCustomerEntitlementGrantRequest, CreateCustomerEntitlementGrantResponse, ListCustomerEntitlementGrantsRequest, ListCustomerEntitlementGrantsResponse, CreateCreditGrantRequest, CreateCreditGrantResponse, GetCreditGrantRequest, GetCreditGrantResponse, ListCreditGrantsRequest, ListCreditGrantsResponse, GetCustomerCreditBalanceRequest, GetCustomerCreditBalanceResponse, CreateCreditAdjustmentRequest, CreateCreditAdjustmentResponse, VoidCreditGrantRequest, VoidCreditGrantResponse, UpdateCreditGrantExternalSettlementRequest, UpdateCreditGrantExternalSettlementResponse, ListCreditTransactionsRequest, ListCreditTransactionsResponse, ListCustomerChargesRequest, ListCustomerChargesResponse, CreateCustomerChargesRequest, CreateCustomerChargesResponse, InvoiceCustomerChargesRequest, InvoiceCustomerChargesResponse } from '../models/operations/customers.js';
|
|
4
4
|
/**
|
|
5
5
|
* Create customer
|
|
6
6
|
*
|
|
@@ -40,9 +40,23 @@ export declare function getCustomerBilling(client: Client, req: GetCustomerBilli
|
|
|
40
40
|
/**
|
|
41
41
|
* Update customer billing data
|
|
42
42
|
*
|
|
43
|
+
* Update billing data while preserving the current profile selection when
|
|
44
|
+
* billing_profile is omitted or null. Use the dedicated billing profile endpoint
|
|
45
|
+
* to remove the selection.
|
|
46
|
+
*
|
|
43
47
|
* PUT /openmeter/customers/{customerId}/billing
|
|
44
48
|
*/
|
|
45
49
|
export declare function updateCustomerBilling(client: Client, req: UpdateCustomerBillingRequest, options?: RequestOptions): Promise<Result<UpdateCustomerBillingResponse>>;
|
|
50
|
+
/**
|
|
51
|
+
* Update customer billing profile
|
|
52
|
+
*
|
|
53
|
+
* Set the customer's explicit billing profile selection. Omitting billing_profile
|
|
54
|
+
* or setting it to null removes the selection and uses the current namespace
|
|
55
|
+
* default.
|
|
56
|
+
*
|
|
57
|
+
* PUT /openmeter/customers/{customerId}/billing/profile
|
|
58
|
+
*/
|
|
59
|
+
export declare function updateCustomerBillingProfile(client: Client, req: UpdateCustomerBillingProfileRequest, options?: RequestOptions): Promise<Result<UpdateCustomerBillingProfileResponse>>;
|
|
46
60
|
/**
|
|
47
61
|
* Update customer billing app data
|
|
48
62
|
*
|
|
@@ -295,3 +309,17 @@ export declare function listCustomerCharges(client: Client, req: ListCustomerCha
|
|
|
295
309
|
* POST /openmeter/customers/{customerId}/charges
|
|
296
310
|
*/
|
|
297
311
|
export declare function createCustomerCharges(client: Client, req: CreateCustomerChargesRequest, options?: RequestOptions): Promise<Result<CreateCustomerChargesResponse>>;
|
|
312
|
+
/**
|
|
313
|
+
* Invoice a customer's charges
|
|
314
|
+
*
|
|
315
|
+
* Invoice a customer's charges outside the normal billing cycle. Collection
|
|
316
|
+
* alignment is bypassed. The customer's progressive billing setting applies unless
|
|
317
|
+
* explicitly overridden. All eligible pending lines are considered.
|
|
318
|
+
*
|
|
319
|
+
* Returns the created standard invoices, one per collected currency. Lines blocked
|
|
320
|
+
* by their owning engine remain pending. If all eligible lines are blocked or no
|
|
321
|
+
* lines are eligible, returns a validation error.
|
|
322
|
+
*
|
|
323
|
+
* POST /openmeter/customers/{customerId}/charges/invoice
|
|
324
|
+
*/
|
|
325
|
+
export declare function invoiceCustomerCharges(client: Client, req: InvoiceCustomerChargesRequest, options?: RequestOptions): Promise<Result<InvoiceCustomerChargesResponse>>;
|
package/dist/funcs/customers.js
CHANGED
|
@@ -187,6 +187,10 @@ export function getCustomerBilling(client, req, options) {
|
|
|
187
187
|
/**
|
|
188
188
|
* Update customer billing data
|
|
189
189
|
*
|
|
190
|
+
* Update billing data while preserving the current profile selection when
|
|
191
|
+
* billing_profile is omitted or null. Use the dedicated billing profile endpoint
|
|
192
|
+
* to remove the selection.
|
|
193
|
+
*
|
|
190
194
|
* PUT /openmeter/customers/{customerId}/billing
|
|
191
195
|
*/
|
|
192
196
|
export function updateCustomerBilling(client, req, options) {
|
|
@@ -221,6 +225,47 @@ export function updateCustomerBilling(client, req, options) {
|
|
|
221
225
|
});
|
|
222
226
|
});
|
|
223
227
|
}
|
|
228
|
+
/**
|
|
229
|
+
* Update customer billing profile
|
|
230
|
+
*
|
|
231
|
+
* Set the customer's explicit billing profile selection. Omitting billing_profile
|
|
232
|
+
* or setting it to null removes the selection and uses the current namespace
|
|
233
|
+
* default.
|
|
234
|
+
*
|
|
235
|
+
* PUT /openmeter/customers/{customerId}/billing/profile
|
|
236
|
+
*/
|
|
237
|
+
export function updateCustomerBillingProfile(client, req, options) {
|
|
238
|
+
return request(() => {
|
|
239
|
+
const pathParamsInput = {
|
|
240
|
+
customerId: req.customerId,
|
|
241
|
+
};
|
|
242
|
+
const pathParams = client._options.validate
|
|
243
|
+
? toPathWire(pathParamsInput, schemas.updateCustomerBillingProfilePathParams)
|
|
244
|
+
: pathParamsInput;
|
|
245
|
+
if (client._options.validate) {
|
|
246
|
+
assertValid(schemas.updateCustomerBillingProfilePathParamsWire, pathParams);
|
|
247
|
+
}
|
|
248
|
+
const path = `openmeter/customers/${(() => {
|
|
249
|
+
if (pathParams.customerId === undefined) {
|
|
250
|
+
throw new Error('missing path parameter: customerId');
|
|
251
|
+
}
|
|
252
|
+
return encodeURIComponent(String(pathParams.customerId));
|
|
253
|
+
})()}/billing/profile`;
|
|
254
|
+
const body = toWire(req.body, schemas.updateCustomerBillingProfileBody);
|
|
255
|
+
if (client._options.validate) {
|
|
256
|
+
assertValid(schemas.updateCustomerBillingProfileBodyWire, body);
|
|
257
|
+
}
|
|
258
|
+
return http(client)
|
|
259
|
+
.put(path, { ...options, json: body })
|
|
260
|
+
.json()
|
|
261
|
+
.then((data) => {
|
|
262
|
+
if (client._options.validate) {
|
|
263
|
+
assertValid(schemas.updateCustomerBillingProfileResponseWire, data);
|
|
264
|
+
}
|
|
265
|
+
return fromWire(data, schemas.updateCustomerBillingProfileResponse);
|
|
266
|
+
});
|
|
267
|
+
});
|
|
268
|
+
}
|
|
224
269
|
/**
|
|
225
270
|
* Update customer billing app data
|
|
226
271
|
*
|
|
@@ -630,7 +675,7 @@ export function resetCustomerEntitlementUsage(client, req, options) {
|
|
|
630
675
|
return encodeURIComponent(String(pathParams.entitlementId));
|
|
631
676
|
})()}/reset`;
|
|
632
677
|
const body = toWire(req.body, schemas.resetCustomerEntitlementUsageBody);
|
|
633
|
-
if (client._options.validate) {
|
|
678
|
+
if (client._options.validate && body !== undefined) {
|
|
634
679
|
assertValid(schemas.resetCustomerEntitlementUsageBodyWire, body);
|
|
635
680
|
}
|
|
636
681
|
await http(client).post(path, { ...options, json: body });
|
|
@@ -886,8 +931,12 @@ export function listCreditGrants(client, req, options) {
|
|
|
886
931
|
}
|
|
887
932
|
return encodeURIComponent(String(pathParams.customerId));
|
|
888
933
|
})()}/credits/grants`;
|
|
934
|
+
if (client._options.validate && req.sort !== undefined) {
|
|
935
|
+
assertValid(schemas.listCreditGrantsQueryParams.shape.sort, req.sort);
|
|
936
|
+
}
|
|
889
937
|
const query = toWire({
|
|
890
938
|
page: req.page,
|
|
939
|
+
sort: encodeSort(req.sort, toSnakeCase),
|
|
891
940
|
filter: req.filter,
|
|
892
941
|
}, schemas.listCreditGrantsQueryParams);
|
|
893
942
|
if (client._options.validate) {
|
|
@@ -1031,7 +1080,7 @@ export function voidCreditGrant(client, req, options) {
|
|
|
1031
1080
|
return encodeURIComponent(String(pathParams.creditGrantId));
|
|
1032
1081
|
})()}/void`;
|
|
1033
1082
|
const body = toWire(req.body, schemas.voidCreditGrantBody);
|
|
1034
|
-
if (client._options.validate) {
|
|
1083
|
+
if (client._options.validate && body !== undefined) {
|
|
1035
1084
|
assertValid(schemas.voidCreditGrantBodyWire, body);
|
|
1036
1085
|
}
|
|
1037
1086
|
return http(client)
|
|
@@ -1230,3 +1279,48 @@ export function createCustomerCharges(client, req, options) {
|
|
|
1230
1279
|
});
|
|
1231
1280
|
});
|
|
1232
1281
|
}
|
|
1282
|
+
/**
|
|
1283
|
+
* Invoice a customer's charges
|
|
1284
|
+
*
|
|
1285
|
+
* Invoice a customer's charges outside the normal billing cycle. Collection
|
|
1286
|
+
* alignment is bypassed. The customer's progressive billing setting applies unless
|
|
1287
|
+
* explicitly overridden. All eligible pending lines are considered.
|
|
1288
|
+
*
|
|
1289
|
+
* Returns the created standard invoices, one per collected currency. Lines blocked
|
|
1290
|
+
* by their owning engine remain pending. If all eligible lines are blocked or no
|
|
1291
|
+
* lines are eligible, returns a validation error.
|
|
1292
|
+
*
|
|
1293
|
+
* POST /openmeter/customers/{customerId}/charges/invoice
|
|
1294
|
+
*/
|
|
1295
|
+
export function invoiceCustomerCharges(client, req, options) {
|
|
1296
|
+
return request(() => {
|
|
1297
|
+
const pathParamsInput = {
|
|
1298
|
+
customerId: req.customerId,
|
|
1299
|
+
};
|
|
1300
|
+
const pathParams = client._options.validate
|
|
1301
|
+
? toPathWire(pathParamsInput, schemas.invoiceCustomerChargesPathParams)
|
|
1302
|
+
: pathParamsInput;
|
|
1303
|
+
if (client._options.validate) {
|
|
1304
|
+
assertValid(schemas.invoiceCustomerChargesPathParamsWire, pathParams);
|
|
1305
|
+
}
|
|
1306
|
+
const path = `openmeter/customers/${(() => {
|
|
1307
|
+
if (pathParams.customerId === undefined) {
|
|
1308
|
+
throw new Error('missing path parameter: customerId');
|
|
1309
|
+
}
|
|
1310
|
+
return encodeURIComponent(String(pathParams.customerId));
|
|
1311
|
+
})()}/charges/invoice`;
|
|
1312
|
+
const body = toWire(req.body, schemas.invoiceCustomerChargesBody);
|
|
1313
|
+
if (client._options.validate && body !== undefined) {
|
|
1314
|
+
assertValid(schemas.invoiceCustomerChargesBodyWire, body);
|
|
1315
|
+
}
|
|
1316
|
+
return http(client)
|
|
1317
|
+
.post(path, { ...options, json: body })
|
|
1318
|
+
.json()
|
|
1319
|
+
.then((data) => {
|
|
1320
|
+
if (client._options.validate) {
|
|
1321
|
+
assertValid(schemas.invoiceCustomerChargesResponseWire, data);
|
|
1322
|
+
}
|
|
1323
|
+
return fromWire(data, schemas.invoiceCustomerChargesResponse);
|
|
1324
|
+
});
|
|
1325
|
+
});
|
|
1326
|
+
}
|
package/dist/funcs/features.js
CHANGED
|
@@ -186,7 +186,7 @@ export function queryFeatureCost(client, req, options) {
|
|
|
186
186
|
return encodeURIComponent(String(pathParams.featureId));
|
|
187
187
|
})()}/cost/query`;
|
|
188
188
|
const body = toWire(req.body, schemas.queryFeatureCostBody);
|
|
189
|
-
if (client._options.validate) {
|
|
189
|
+
if (client._options.validate && body !== undefined) {
|
|
190
190
|
assertValid(schemas.queryFeatureCostBodyWire, body);
|
|
191
191
|
}
|
|
192
192
|
return http(client)
|
|
@@ -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 {
|
|
3
|
+
import type { ListBillingNotificationChannelsRequest, ListBillingNotificationChannelsResponse, CreateBillingNotificationChannelRequest, CreateBillingNotificationChannelResponse, GetBillingNotificationChannelRequest, GetBillingNotificationChannelResponse, UpdateBillingNotificationChannelRequest, UpdateBillingNotificationChannelResponse, DeleteBillingNotificationChannelRequest, DeleteBillingNotificationChannelResponse, ListBillingNotificationRulesRequest, ListBillingNotificationRulesResponse, CreateBillingNotificationRuleRequest, CreateBillingNotificationRuleResponse, GetBillingNotificationRuleRequest, GetBillingNotificationRuleResponse, UpdateBillingNotificationRuleRequest, UpdateBillingNotificationRuleResponse, DeleteBillingNotificationRuleRequest, DeleteBillingNotificationRuleResponse, TestBillingNotificationRuleRequest, TestBillingNotificationRuleResponse, ListBillingNotificationEventsRequest, ListBillingNotificationEventsResponse, GetBillingNotificationEventRequest, GetBillingNotificationEventResponse, ResendBillingNotificationEventRequest, ResendBillingNotificationEventResponse } from '../models/operations/notifications.js';
|
|
4
4
|
/**
|
|
5
5
|
* List notification channels
|
|
6
6
|
*
|
|
@@ -8,7 +8,7 @@ import type { ListNotificationChannelsRequest, ListNotificationChannelsResponse,
|
|
|
8
8
|
*
|
|
9
9
|
* GET /openmeter/notification/channels
|
|
10
10
|
*/
|
|
11
|
-
export declare function
|
|
11
|
+
export declare function listBillingNotificationChannels(client: Client, req?: ListBillingNotificationChannelsRequest, options?: RequestOptions): Promise<Result<ListBillingNotificationChannelsResponse>>;
|
|
12
12
|
/**
|
|
13
13
|
* Create notification channel
|
|
14
14
|
*
|
|
@@ -16,7 +16,7 @@ export declare function listNotificationChannels(client: Client, req?: ListNotif
|
|
|
16
16
|
*
|
|
17
17
|
* POST /openmeter/notification/channels
|
|
18
18
|
*/
|
|
19
|
-
export declare function
|
|
19
|
+
export declare function createBillingNotificationChannel(client: Client, req: CreateBillingNotificationChannelRequest, options?: RequestOptions): Promise<Result<CreateBillingNotificationChannelResponse>>;
|
|
20
20
|
/**
|
|
21
21
|
* Get notification channel
|
|
22
22
|
*
|
|
@@ -24,7 +24,7 @@ export declare function createNotificationChannel(client: Client, req: CreateNot
|
|
|
24
24
|
*
|
|
25
25
|
* GET /openmeter/notification/channels/{notificationChannelId}
|
|
26
26
|
*/
|
|
27
|
-
export declare function
|
|
27
|
+
export declare function getBillingNotificationChannel(client: Client, req: GetBillingNotificationChannelRequest, options?: RequestOptions): Promise<Result<GetBillingNotificationChannelResponse>>;
|
|
28
28
|
/**
|
|
29
29
|
* Update notification channel
|
|
30
30
|
*
|
|
@@ -32,7 +32,7 @@ export declare function getNotificationChannel(client: Client, req: GetNotificat
|
|
|
32
32
|
*
|
|
33
33
|
* PUT /openmeter/notification/channels/{notificationChannelId}
|
|
34
34
|
*/
|
|
35
|
-
export declare function
|
|
35
|
+
export declare function updateBillingNotificationChannel(client: Client, req: UpdateBillingNotificationChannelRequest, options?: RequestOptions): Promise<Result<UpdateBillingNotificationChannelResponse>>;
|
|
36
36
|
/**
|
|
37
37
|
* Delete notification channel
|
|
38
38
|
*
|
|
@@ -40,7 +40,7 @@ export declare function updateNotificationChannel(client: Client, req: UpdateNot
|
|
|
40
40
|
*
|
|
41
41
|
* DELETE /openmeter/notification/channels/{notificationChannelId}
|
|
42
42
|
*/
|
|
43
|
-
export declare function
|
|
43
|
+
export declare function deleteBillingNotificationChannel(client: Client, req: DeleteBillingNotificationChannelRequest, options?: RequestOptions): Promise<Result<DeleteBillingNotificationChannelResponse>>;
|
|
44
44
|
/**
|
|
45
45
|
* List notification rules
|
|
46
46
|
*
|
|
@@ -48,7 +48,7 @@ export declare function deleteNotificationChannel(client: Client, req: DeleteNot
|
|
|
48
48
|
*
|
|
49
49
|
* GET /openmeter/notification/rules
|
|
50
50
|
*/
|
|
51
|
-
export declare function
|
|
51
|
+
export declare function listBillingNotificationRules(client: Client, req?: ListBillingNotificationRulesRequest, options?: RequestOptions): Promise<Result<ListBillingNotificationRulesResponse>>;
|
|
52
52
|
/**
|
|
53
53
|
* Create notification rule
|
|
54
54
|
*
|
|
@@ -56,7 +56,7 @@ export declare function listNotificationRules(client: Client, req?: ListNotifica
|
|
|
56
56
|
*
|
|
57
57
|
* POST /openmeter/notification/rules
|
|
58
58
|
*/
|
|
59
|
-
export declare function
|
|
59
|
+
export declare function createBillingNotificationRule(client: Client, req: CreateBillingNotificationRuleRequest, options?: RequestOptions): Promise<Result<CreateBillingNotificationRuleResponse>>;
|
|
60
60
|
/**
|
|
61
61
|
* Get notification rule
|
|
62
62
|
*
|
|
@@ -64,7 +64,7 @@ export declare function createNotificationRule(client: Client, req: CreateNotifi
|
|
|
64
64
|
*
|
|
65
65
|
* GET /openmeter/notification/rules/{notificationRuleId}
|
|
66
66
|
*/
|
|
67
|
-
export declare function
|
|
67
|
+
export declare function getBillingNotificationRule(client: Client, req: GetBillingNotificationRuleRequest, options?: RequestOptions): Promise<Result<GetBillingNotificationRuleResponse>>;
|
|
68
68
|
/**
|
|
69
69
|
* Update notification rule
|
|
70
70
|
*
|
|
@@ -72,7 +72,7 @@ export declare function getNotificationRule(client: Client, req: GetNotification
|
|
|
72
72
|
*
|
|
73
73
|
* PUT /openmeter/notification/rules/{notificationRuleId}
|
|
74
74
|
*/
|
|
75
|
-
export declare function
|
|
75
|
+
export declare function updateBillingNotificationRule(client: Client, req: UpdateBillingNotificationRuleRequest, options?: RequestOptions): Promise<Result<UpdateBillingNotificationRuleResponse>>;
|
|
76
76
|
/**
|
|
77
77
|
* Delete notification rule
|
|
78
78
|
*
|
|
@@ -80,7 +80,7 @@ export declare function updateNotificationRule(client: Client, req: UpdateNotifi
|
|
|
80
80
|
*
|
|
81
81
|
* DELETE /openmeter/notification/rules/{notificationRuleId}
|
|
82
82
|
*/
|
|
83
|
-
export declare function
|
|
83
|
+
export declare function deleteBillingNotificationRule(client: Client, req: DeleteBillingNotificationRuleRequest, options?: RequestOptions): Promise<Result<DeleteBillingNotificationRuleResponse>>;
|
|
84
84
|
/**
|
|
85
85
|
* Test notification rule
|
|
86
86
|
*
|
|
@@ -90,7 +90,7 @@ export declare function deleteNotificationRule(client: Client, req: DeleteNotifi
|
|
|
90
90
|
*
|
|
91
91
|
* POST /openmeter/notification/rules/{notificationRuleId}/test
|
|
92
92
|
*/
|
|
93
|
-
export declare function
|
|
93
|
+
export declare function testBillingNotificationRule(client: Client, req: TestBillingNotificationRuleRequest, options?: RequestOptions): Promise<Result<TestBillingNotificationRuleResponse>>;
|
|
94
94
|
/**
|
|
95
95
|
* List notification events
|
|
96
96
|
*
|
|
@@ -98,7 +98,7 @@ export declare function testNotificationRule(client: Client, req: TestNotificati
|
|
|
98
98
|
*
|
|
99
99
|
* GET /openmeter/notification/events
|
|
100
100
|
*/
|
|
101
|
-
export declare function
|
|
101
|
+
export declare function listBillingNotificationEvents(client: Client, req?: ListBillingNotificationEventsRequest, options?: RequestOptions): Promise<Result<ListBillingNotificationEventsResponse>>;
|
|
102
102
|
/**
|
|
103
103
|
* Get notification event
|
|
104
104
|
*
|
|
@@ -106,7 +106,7 @@ export declare function listNotificationEvents(client: Client, req?: ListNotific
|
|
|
106
106
|
*
|
|
107
107
|
* GET /openmeter/notification/events/{notificationEventId}
|
|
108
108
|
*/
|
|
109
|
-
export declare function
|
|
109
|
+
export declare function getBillingNotificationEvent(client: Client, req: GetBillingNotificationEventRequest, options?: RequestOptions): Promise<Result<GetBillingNotificationEventResponse>>;
|
|
110
110
|
/**
|
|
111
111
|
* Resend notification event
|
|
112
112
|
*
|
|
@@ -118,4 +118,4 @@ export declare function getNotificationEvent(client: Client, req: GetNotificatio
|
|
|
118
118
|
*
|
|
119
119
|
* POST /openmeter/notification/events/{notificationEventId}/resend
|
|
120
120
|
*/
|
|
121
|
-
export declare function
|
|
121
|
+
export declare function resendBillingNotificationEvent(client: Client, req: ResendBillingNotificationEventRequest, options?: RequestOptions): Promise<Result<ResendBillingNotificationEventResponse>>;
|