@openmeter/client 1.0.0-beta-9b0450f0db89 → 1.0.0-beta-081c456ce358
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 +12 -11
- package/dist/funcs/customers.d.ts +16 -1
- package/dist/funcs/customers.js +52 -0
- package/dist/lib/version.d.ts +1 -1
- package/dist/lib/version.js +1 -1
- package/dist/models/operations/customers.d.ts +6 -0
- package/dist/models/schemas.d.ts +284 -0
- package/dist/models/schemas.js +12 -0
- package/dist/sdk/internal.d.ts +16 -1
- package/dist/sdk/internal.js +18 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -422,17 +422,18 @@ they can change or be removed without notice or semver consideration.
|
|
|
422
422
|
|
|
423
423
|
### Internal Customers
|
|
424
424
|
|
|
425
|
-
| Method | HTTP
|
|
426
|
-
| --------------------------------------------------- |
|
|
427
|
-
| `client.internal.customers.entitlements.create` | `POST /openmeter/customers/{customerId}/entitlements`
|
|
428
|
-
| `client.internal.customers.entitlements.
|
|
429
|
-
| `client.internal.customers.entitlements.
|
|
430
|
-
| `client.internal.customers.entitlements.
|
|
431
|
-
| `client.internal.customers.entitlements.
|
|
432
|
-
| `client.internal.customers.entitlements.
|
|
433
|
-
| `client.internal.customers.
|
|
434
|
-
| `client.internal.customers.
|
|
435
|
-
| `client.internal.customers.charges.
|
|
425
|
+
| Method | HTTP | Description |
|
|
426
|
+
| --------------------------------------------------- | ----------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
427
|
+
| `client.internal.customers.entitlements.create` | `POST /openmeter/customers/{customerId}/entitlements` | Create an entitlement for the customer. A customer can have only one active entitlement per feature. The feature must be compatible with the entitlement type. Entitlements cannot be modified after creation, only deleted. |
|
|
428
|
+
| `client.internal.customers.entitlements.override` | `PUT /openmeter/customers/{customerId}/entitlements/{entitlementId}/override` | Override an entitlement of the customer with a new one. The referenced entitlement ends and the new one starts at the same instant, so access continues without a gap. Both must belong to the same feature. Use this for upgrades and downgrades. Fails if the referenced entitlement does not exist, is deleted, or is no longer active. |
|
|
429
|
+
| `client.internal.customers.entitlements.getHistory` | `GET /openmeter/customers/{customerId}/entitlements/{entitlementId}/history` | Get the balance and usage history of a metered entitlement. The queried range may span multiple usage periods. `windowed_history` groups usage into windows of the requested size and reports the balance at the start of each window. `burndown_history` lists the periods in which grants were consumed in a fixed order, together with the usage taken from each grant. |
|
|
430
|
+
| `client.internal.customers.entitlements.get` | `GET /openmeter/customers/{customerId}/entitlements/{entitlementId}` | Get an entitlement of the customer by ID. For checking entitlement access, use the entitlement access endpoints instead. |
|
|
431
|
+
| `client.internal.customers.entitlements.list` | `GET /openmeter/customers/{customerId}/entitlements` | List the entitlements of the customer that are active at the time of the request. For checking entitlement access, use the entitlement access endpoints instead. |
|
|
432
|
+
| `client.internal.customers.entitlements.resetUsage` | `POST /openmeter/customers/{customerId}/entitlements/{entitlementId}/reset` | Reset the usage of a metered entitlement. The reset starts a new usage period: usage is zeroed and grants roll over according to their rollover settings. Usage is reset automatically at the end of each usage period. Use this operation to reset it earlier, for example to align the entitlement with the customer's billing period. The usage period anchor can be moved at the same time. |
|
|
433
|
+
| `client.internal.customers.entitlements.delete` | `DELETE /openmeter/customers/{customerId}/entitlements/{entitlementId}` | Deletes the entitlement and revokes access to its feature. A customer can hold only one active entitlement per feature, so migrating a feature requires deleting the previous entitlement first. Deletion sets the `deleted_at` timestamp instead of removing history. Access and status queries for earlier points in time still treat the entitlement as active, so access changes are never retroactive. |
|
|
434
|
+
| `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. |
|
|
435
|
+
| `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. |
|
|
436
|
+
| `client.internal.customers.charges.create` | `POST /openmeter/customers/{customerId}/charges` | Create customer charge. |
|
|
436
437
|
|
|
437
438
|
### Internal Entitlements
|
|
438
439
|
|
|
@@ -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, GetCustomerEntitlementHistoryRequest, GetCustomerEntitlementHistoryResponse, GetCustomerEntitlementRequest, GetCustomerEntitlementResponse, ListCustomerEntitlementsRequest, ListCustomerEntitlementsResponse, ResetCustomerEntitlementUsageRequest, ResetCustomerEntitlementUsageResponse, DeleteCustomerEntitlementRequest, DeleteCustomerEntitlementResponse, CreateCreditGrantRequest, CreateCreditGrantResponse, GetCreditGrantRequest, GetCreditGrantResponse, ListCreditGrantsRequest, ListCreditGrantsResponse, GetCustomerCreditBalanceRequest, GetCustomerCreditBalanceResponse, CreateCreditAdjustmentRequest, CreateCreditAdjustmentResponse, VoidCreditGrantRequest, VoidCreditGrantResponse, UpdateCreditGrantExternalSettlementRequest, UpdateCreditGrantExternalSettlementResponse, ListCreditTransactionsRequest, ListCreditTransactionsResponse, ListCustomerChargesRequest, ListCustomerChargesResponse, CreateCustomerChargesRequest, CreateCustomerChargesResponse } from '../models/operations/customers.js';
|
|
3
|
+
import type { CreateCustomerRequest, CreateCustomerResponse, GetCustomerRequest, GetCustomerResponse, ListCustomersRequest, ListCustomersResponse, UpsertCustomerRequest, UpsertCustomerResponse, DeleteCustomerRequest, DeleteCustomerResponse, GetCustomerBillingRequest, GetCustomerBillingResponse, UpdateCustomerBillingRequest, UpdateCustomerBillingResponse, UpdateCustomerBillingAppDataRequest, UpdateCustomerBillingAppDataResponse, CreateCustomerStripeCheckoutSessionRequest, CreateCustomerStripeCheckoutSessionResponse, CreateCustomerStripePortalSessionRequest, CreateCustomerStripePortalSessionResponse, CreateCustomerEntitlementRequest, CreateCustomerEntitlementResponse, OverrideCustomerEntitlementRequest, OverrideCustomerEntitlementResponse, GetCustomerEntitlementHistoryRequest, GetCustomerEntitlementHistoryResponse, GetCustomerEntitlementRequest, GetCustomerEntitlementResponse, ListCustomerEntitlementsRequest, ListCustomerEntitlementsResponse, ResetCustomerEntitlementUsageRequest, ResetCustomerEntitlementUsageResponse, DeleteCustomerEntitlementRequest, DeleteCustomerEntitlementResponse, CreateCreditGrantRequest, CreateCreditGrantResponse, GetCreditGrantRequest, GetCreditGrantResponse, ListCreditGrantsRequest, ListCreditGrantsResponse, GetCustomerCreditBalanceRequest, GetCustomerCreditBalanceResponse, CreateCreditAdjustmentRequest, CreateCreditAdjustmentResponse, VoidCreditGrantRequest, VoidCreditGrantResponse, UpdateCreditGrantExternalSettlementRequest, UpdateCreditGrantExternalSettlementResponse, ListCreditTransactionsRequest, ListCreditTransactionsResponse, ListCustomerChargesRequest, ListCustomerChargesResponse, CreateCustomerChargesRequest, CreateCustomerChargesResponse } from '../models/operations/customers.js';
|
|
4
4
|
/**
|
|
5
5
|
* Create customer
|
|
6
6
|
*
|
|
@@ -92,6 +92,21 @@ export declare function createCustomerStripePortalSession(client: Client, req: C
|
|
|
92
92
|
* POST /openmeter/customers/{customerId}/entitlements
|
|
93
93
|
*/
|
|
94
94
|
export declare function createCustomerEntitlement(client: Client, req: CreateCustomerEntitlementRequest, options?: RequestOptions): Promise<Result<CreateCustomerEntitlementResponse>>;
|
|
95
|
+
/**
|
|
96
|
+
* Override customer entitlement
|
|
97
|
+
*
|
|
98
|
+
* Override an entitlement of the customer with a new one.
|
|
99
|
+
*
|
|
100
|
+
* The referenced entitlement ends and the new one starts at the same instant, so
|
|
101
|
+
* access continues without a gap. Both must belong to the same feature. Use this
|
|
102
|
+
* for upgrades and downgrades.
|
|
103
|
+
*
|
|
104
|
+
* Fails if the referenced entitlement does not exist, is deleted, or is no longer
|
|
105
|
+
* active.
|
|
106
|
+
*
|
|
107
|
+
* PUT /openmeter/customers/{customerId}/entitlements/{entitlementId}/override
|
|
108
|
+
*/
|
|
109
|
+
export declare function overrideCustomerEntitlement(client: Client, req: OverrideCustomerEntitlementRequest, options?: RequestOptions): Promise<Result<OverrideCustomerEntitlementResponse>>;
|
|
95
110
|
/**
|
|
96
111
|
* Get customer entitlement history
|
|
97
112
|
*
|
package/dist/funcs/customers.js
CHANGED
|
@@ -394,6 +394,58 @@ export function createCustomerEntitlement(client, req, options) {
|
|
|
394
394
|
});
|
|
395
395
|
});
|
|
396
396
|
}
|
|
397
|
+
/**
|
|
398
|
+
* Override customer entitlement
|
|
399
|
+
*
|
|
400
|
+
* Override an entitlement of the customer with a new one.
|
|
401
|
+
*
|
|
402
|
+
* The referenced entitlement ends and the new one starts at the same instant, so
|
|
403
|
+
* access continues without a gap. Both must belong to the same feature. Use this
|
|
404
|
+
* for upgrades and downgrades.
|
|
405
|
+
*
|
|
406
|
+
* Fails if the referenced entitlement does not exist, is deleted, or is no longer
|
|
407
|
+
* active.
|
|
408
|
+
*
|
|
409
|
+
* PUT /openmeter/customers/{customerId}/entitlements/{entitlementId}/override
|
|
410
|
+
*/
|
|
411
|
+
export function overrideCustomerEntitlement(client, req, options) {
|
|
412
|
+
return request(() => {
|
|
413
|
+
const pathParamsInput = {
|
|
414
|
+
customerId: req.customerId,
|
|
415
|
+
entitlementId: req.entitlementId,
|
|
416
|
+
};
|
|
417
|
+
const pathParams = client._options.validate
|
|
418
|
+
? toPathWire(pathParamsInput, schemas.overrideCustomerEntitlementPathParams)
|
|
419
|
+
: pathParamsInput;
|
|
420
|
+
if (client._options.validate) {
|
|
421
|
+
assertValid(schemas.overrideCustomerEntitlementPathParamsWire, pathParams);
|
|
422
|
+
}
|
|
423
|
+
const path = `openmeter/customers/${(() => {
|
|
424
|
+
if (pathParams.customerId === undefined) {
|
|
425
|
+
throw new Error('missing path parameter: customerId');
|
|
426
|
+
}
|
|
427
|
+
return encodeURIComponent(String(pathParams.customerId));
|
|
428
|
+
})()}/entitlements/${(() => {
|
|
429
|
+
if (pathParams.entitlementId === undefined) {
|
|
430
|
+
throw new Error('missing path parameter: entitlementId');
|
|
431
|
+
}
|
|
432
|
+
return encodeURIComponent(String(pathParams.entitlementId));
|
|
433
|
+
})()}/override`;
|
|
434
|
+
const body = toWire(req.body, schemas.overrideCustomerEntitlementBody);
|
|
435
|
+
if (client._options.validate) {
|
|
436
|
+
assertValid(schemas.overrideCustomerEntitlementBodyWire, body);
|
|
437
|
+
}
|
|
438
|
+
return http(client)
|
|
439
|
+
.put(path, { ...options, json: body })
|
|
440
|
+
.json()
|
|
441
|
+
.then((data) => {
|
|
442
|
+
if (client._options.validate) {
|
|
443
|
+
assertValid(schemas.overrideCustomerEntitlementResponseWire, data);
|
|
444
|
+
}
|
|
445
|
+
return fromWire(data, schemas.overrideCustomerEntitlementResponse);
|
|
446
|
+
});
|
|
447
|
+
});
|
|
448
|
+
}
|
|
397
449
|
/**
|
|
398
450
|
* Get customer entitlement history
|
|
399
451
|
*
|
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-081c456ce358";
|
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-081c456ce358';
|
|
@@ -70,6 +70,12 @@ export type CreateCustomerEntitlementRequest = AcceptDateStrings<{
|
|
|
70
70
|
body: CreateEntitlementRequestInput;
|
|
71
71
|
}>;
|
|
72
72
|
export type CreateCustomerEntitlementResponse = Entitlement;
|
|
73
|
+
export type OverrideCustomerEntitlementRequest = AcceptDateStrings<{
|
|
74
|
+
customerId: string;
|
|
75
|
+
entitlementId: string;
|
|
76
|
+
body: CreateEntitlementRequestInput;
|
|
77
|
+
}>;
|
|
78
|
+
export type OverrideCustomerEntitlementResponse = Entitlement;
|
|
73
79
|
export interface GetCustomerEntitlementHistoryQuery {
|
|
74
80
|
/**
|
|
75
81
|
* The start of the queried range. Defaults to the last reset. Truncated to the
|
package/dist/models/schemas.d.ts
CHANGED
|
@@ -18706,6 +18706,148 @@ export declare const createCustomerEntitlementResponse: z.ZodDiscriminatedUnion<
|
|
|
18706
18706
|
updatedAt: z.ZodDate;
|
|
18707
18707
|
deletedAt: z.ZodOptional<z.ZodDate>;
|
|
18708
18708
|
}, z.core.$strip>], "type">;
|
|
18709
|
+
export declare const overrideCustomerEntitlementPathParams: z.ZodObject<{
|
|
18710
|
+
customerId: z.ZodString;
|
|
18711
|
+
entitlementId: z.ZodString;
|
|
18712
|
+
}, z.core.$strip>;
|
|
18713
|
+
export declare const overrideCustomerEntitlementBody: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
18714
|
+
type: z.ZodLiteral<"metered">;
|
|
18715
|
+
feature: z.ZodObject<{
|
|
18716
|
+
id: z.ZodString;
|
|
18717
|
+
}, z.core.$strip>;
|
|
18718
|
+
labels: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
18719
|
+
isSoftLimit: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
|
|
18720
|
+
issue: z.ZodOptional<z.ZodObject<{
|
|
18721
|
+
amount: z.ZodString;
|
|
18722
|
+
priority: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
|
|
18723
|
+
}, z.core.$strip>>;
|
|
18724
|
+
issueAfterReset: z.ZodOptional<z.ZodString>;
|
|
18725
|
+
issueAfterResetPriority: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
|
|
18726
|
+
preserveOverageAtReset: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
|
|
18727
|
+
usagePeriod: z.ZodObject<{
|
|
18728
|
+
interval: z.ZodString;
|
|
18729
|
+
anchor: z.ZodOptional<z.ZodDate>;
|
|
18730
|
+
}, z.core.$strip>;
|
|
18731
|
+
measureUsageFrom: z.ZodOptional<z.ZodUnion<readonly [z.ZodEnum<{
|
|
18732
|
+
current_period_start: "current_period_start";
|
|
18733
|
+
now: "now";
|
|
18734
|
+
}>, z.ZodDate]>>;
|
|
18735
|
+
grants: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
18736
|
+
amount: z.ZodString;
|
|
18737
|
+
priority: z.ZodOptional<z.ZodNumber>;
|
|
18738
|
+
effectiveAt: z.ZodDate;
|
|
18739
|
+
expiresAfter: z.ZodOptional<z.ZodString>;
|
|
18740
|
+
maxRolloverAmount: z.ZodOptional<z.ZodString>;
|
|
18741
|
+
minRolloverAmount: z.ZodOptional<z.ZodString>;
|
|
18742
|
+
labels: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
18743
|
+
recurrence: z.ZodOptional<z.ZodObject<{
|
|
18744
|
+
interval: z.ZodString;
|
|
18745
|
+
anchor: z.ZodOptional<z.ZodDate>;
|
|
18746
|
+
}, z.core.$strip>>;
|
|
18747
|
+
}, z.core.$strip>>>;
|
|
18748
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
18749
|
+
type: z.ZodLiteral<"static">;
|
|
18750
|
+
feature: z.ZodObject<{
|
|
18751
|
+
id: z.ZodString;
|
|
18752
|
+
}, z.core.$strip>;
|
|
18753
|
+
labels: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
18754
|
+
config: z.ZodUnknown;
|
|
18755
|
+
usagePeriod: z.ZodOptional<z.ZodObject<{
|
|
18756
|
+
interval: z.ZodString;
|
|
18757
|
+
anchor: z.ZodOptional<z.ZodDate>;
|
|
18758
|
+
}, z.core.$strip>>;
|
|
18759
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
18760
|
+
type: z.ZodLiteral<"boolean">;
|
|
18761
|
+
feature: z.ZodObject<{
|
|
18762
|
+
id: z.ZodString;
|
|
18763
|
+
}, z.core.$strip>;
|
|
18764
|
+
labels: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
18765
|
+
usagePeriod: z.ZodOptional<z.ZodObject<{
|
|
18766
|
+
interval: z.ZodString;
|
|
18767
|
+
anchor: z.ZodOptional<z.ZodDate>;
|
|
18768
|
+
}, z.core.$strip>>;
|
|
18769
|
+
}, z.core.$strip>], "type">;
|
|
18770
|
+
export declare const overrideCustomerEntitlementResponse: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
18771
|
+
id: z.ZodString;
|
|
18772
|
+
type: z.ZodLiteral<"metered">;
|
|
18773
|
+
feature: z.ZodObject<{
|
|
18774
|
+
id: z.ZodString;
|
|
18775
|
+
}, z.core.$strip>;
|
|
18776
|
+
customer: z.ZodObject<{
|
|
18777
|
+
id: z.ZodString;
|
|
18778
|
+
}, z.core.$strip>;
|
|
18779
|
+
labels: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
18780
|
+
activeFrom: z.ZodDate;
|
|
18781
|
+
activeTo: z.ZodOptional<z.ZodDate>;
|
|
18782
|
+
createdAt: z.ZodDate;
|
|
18783
|
+
updatedAt: z.ZodDate;
|
|
18784
|
+
deletedAt: z.ZodOptional<z.ZodDate>;
|
|
18785
|
+
usagePeriod: z.ZodObject<{
|
|
18786
|
+
anchor: z.ZodDate;
|
|
18787
|
+
interval: z.ZodString;
|
|
18788
|
+
}, z.core.$strip>;
|
|
18789
|
+
currentUsagePeriod: z.ZodObject<{
|
|
18790
|
+
from: z.ZodDate;
|
|
18791
|
+
to: z.ZodDate;
|
|
18792
|
+
}, z.core.$strip>;
|
|
18793
|
+
isSoftLimit: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
|
|
18794
|
+
issue: z.ZodOptional<z.ZodObject<{
|
|
18795
|
+
amount: z.ZodString;
|
|
18796
|
+
priority: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
|
|
18797
|
+
}, z.core.$strip>>;
|
|
18798
|
+
issueAfterReset: z.ZodOptional<z.ZodString>;
|
|
18799
|
+
issueAfterResetPriority: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
|
|
18800
|
+
preserveOverageAtReset: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
|
|
18801
|
+
measureUsageFrom: z.ZodDate;
|
|
18802
|
+
lastReset: z.ZodDate;
|
|
18803
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
18804
|
+
id: z.ZodString;
|
|
18805
|
+
type: z.ZodLiteral<"static">;
|
|
18806
|
+
feature: z.ZodObject<{
|
|
18807
|
+
id: z.ZodString;
|
|
18808
|
+
}, z.core.$strip>;
|
|
18809
|
+
customer: z.ZodObject<{
|
|
18810
|
+
id: z.ZodString;
|
|
18811
|
+
}, z.core.$strip>;
|
|
18812
|
+
labels: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
18813
|
+
usagePeriod: z.ZodOptional<z.ZodObject<{
|
|
18814
|
+
anchor: z.ZodDate;
|
|
18815
|
+
interval: z.ZodString;
|
|
18816
|
+
}, z.core.$strip>>;
|
|
18817
|
+
currentUsagePeriod: z.ZodOptional<z.ZodObject<{
|
|
18818
|
+
from: z.ZodDate;
|
|
18819
|
+
to: z.ZodDate;
|
|
18820
|
+
}, z.core.$strip>>;
|
|
18821
|
+
activeFrom: z.ZodDate;
|
|
18822
|
+
activeTo: z.ZodOptional<z.ZodDate>;
|
|
18823
|
+
createdAt: z.ZodDate;
|
|
18824
|
+
updatedAt: z.ZodDate;
|
|
18825
|
+
deletedAt: z.ZodOptional<z.ZodDate>;
|
|
18826
|
+
config: z.ZodUnknown;
|
|
18827
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
18828
|
+
id: z.ZodString;
|
|
18829
|
+
type: z.ZodLiteral<"boolean">;
|
|
18830
|
+
feature: z.ZodObject<{
|
|
18831
|
+
id: z.ZodString;
|
|
18832
|
+
}, z.core.$strip>;
|
|
18833
|
+
customer: z.ZodObject<{
|
|
18834
|
+
id: z.ZodString;
|
|
18835
|
+
}, z.core.$strip>;
|
|
18836
|
+
labels: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
18837
|
+
usagePeriod: z.ZodOptional<z.ZodObject<{
|
|
18838
|
+
anchor: z.ZodDate;
|
|
18839
|
+
interval: z.ZodString;
|
|
18840
|
+
}, z.core.$strip>>;
|
|
18841
|
+
currentUsagePeriod: z.ZodOptional<z.ZodObject<{
|
|
18842
|
+
from: z.ZodDate;
|
|
18843
|
+
to: z.ZodDate;
|
|
18844
|
+
}, z.core.$strip>>;
|
|
18845
|
+
activeFrom: z.ZodDate;
|
|
18846
|
+
activeTo: z.ZodOptional<z.ZodDate>;
|
|
18847
|
+
createdAt: z.ZodDate;
|
|
18848
|
+
updatedAt: z.ZodDate;
|
|
18849
|
+
deletedAt: z.ZodOptional<z.ZodDate>;
|
|
18850
|
+
}, z.core.$strip>], "type">;
|
|
18709
18851
|
export declare const getCustomerEntitlementHistoryPathParams: z.ZodObject<{
|
|
18710
18852
|
customerId: z.ZodString;
|
|
18711
18853
|
entitlementId: z.ZodString;
|
|
@@ -52926,6 +53068,148 @@ export declare const createCustomerEntitlementResponseWire: z.ZodDiscriminatedUn
|
|
|
52926
53068
|
updated_at: z.ZodString;
|
|
52927
53069
|
deleted_at: z.ZodOptional<z.ZodString>;
|
|
52928
53070
|
}, z.core.$strict>], "type">;
|
|
53071
|
+
export declare const overrideCustomerEntitlementPathParamsWire: z.ZodObject<{
|
|
53072
|
+
customerId: z.ZodString;
|
|
53073
|
+
entitlementId: z.ZodString;
|
|
53074
|
+
}, z.core.$strip>;
|
|
53075
|
+
export declare const overrideCustomerEntitlementBodyWire: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
53076
|
+
type: z.ZodLiteral<"metered">;
|
|
53077
|
+
feature: z.ZodObject<{
|
|
53078
|
+
id: z.ZodString;
|
|
53079
|
+
}, z.core.$strict>;
|
|
53080
|
+
labels: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
53081
|
+
is_soft_limit: z.ZodOptional<z.ZodBoolean>;
|
|
53082
|
+
issue: z.ZodOptional<z.ZodObject<{
|
|
53083
|
+
amount: z.ZodString;
|
|
53084
|
+
priority: z.ZodOptional<z.ZodNumber>;
|
|
53085
|
+
}, z.core.$strict>>;
|
|
53086
|
+
issue_after_reset: z.ZodOptional<z.ZodString>;
|
|
53087
|
+
issue_after_reset_priority: z.ZodOptional<z.ZodNumber>;
|
|
53088
|
+
preserve_overage_at_reset: z.ZodOptional<z.ZodBoolean>;
|
|
53089
|
+
usage_period: z.ZodObject<{
|
|
53090
|
+
interval: z.ZodString;
|
|
53091
|
+
anchor: z.ZodOptional<z.ZodString>;
|
|
53092
|
+
}, z.core.$strict>;
|
|
53093
|
+
measure_usage_from: z.ZodOptional<z.ZodUnion<readonly [z.ZodEnum<{
|
|
53094
|
+
current_period_start: "current_period_start";
|
|
53095
|
+
now: "now";
|
|
53096
|
+
}>, z.ZodString]>>;
|
|
53097
|
+
grants: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
53098
|
+
amount: z.ZodString;
|
|
53099
|
+
priority: z.ZodOptional<z.ZodNumber>;
|
|
53100
|
+
effective_at: z.ZodString;
|
|
53101
|
+
expires_after: z.ZodOptional<z.ZodString>;
|
|
53102
|
+
max_rollover_amount: z.ZodOptional<z.ZodString>;
|
|
53103
|
+
min_rollover_amount: z.ZodOptional<z.ZodString>;
|
|
53104
|
+
labels: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
53105
|
+
recurrence: z.ZodOptional<z.ZodObject<{
|
|
53106
|
+
interval: z.ZodString;
|
|
53107
|
+
anchor: z.ZodOptional<z.ZodString>;
|
|
53108
|
+
}, z.core.$strict>>;
|
|
53109
|
+
}, z.core.$strict>>>;
|
|
53110
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
53111
|
+
type: z.ZodLiteral<"static">;
|
|
53112
|
+
feature: z.ZodObject<{
|
|
53113
|
+
id: z.ZodString;
|
|
53114
|
+
}, z.core.$strict>;
|
|
53115
|
+
labels: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
53116
|
+
config: z.ZodUnknown;
|
|
53117
|
+
usage_period: z.ZodOptional<z.ZodObject<{
|
|
53118
|
+
interval: z.ZodString;
|
|
53119
|
+
anchor: z.ZodOptional<z.ZodString>;
|
|
53120
|
+
}, z.core.$strict>>;
|
|
53121
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
53122
|
+
type: z.ZodLiteral<"boolean">;
|
|
53123
|
+
feature: z.ZodObject<{
|
|
53124
|
+
id: z.ZodString;
|
|
53125
|
+
}, z.core.$strict>;
|
|
53126
|
+
labels: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
53127
|
+
usage_period: z.ZodOptional<z.ZodObject<{
|
|
53128
|
+
interval: z.ZodString;
|
|
53129
|
+
anchor: z.ZodOptional<z.ZodString>;
|
|
53130
|
+
}, z.core.$strict>>;
|
|
53131
|
+
}, z.core.$strict>], "type">;
|
|
53132
|
+
export declare const overrideCustomerEntitlementResponseWire: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
53133
|
+
id: z.ZodString;
|
|
53134
|
+
type: z.ZodLiteral<"metered">;
|
|
53135
|
+
feature: z.ZodObject<{
|
|
53136
|
+
id: z.ZodString;
|
|
53137
|
+
}, z.core.$strict>;
|
|
53138
|
+
customer: z.ZodObject<{
|
|
53139
|
+
id: z.ZodString;
|
|
53140
|
+
}, z.core.$strict>;
|
|
53141
|
+
labels: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
53142
|
+
active_from: z.ZodString;
|
|
53143
|
+
active_to: z.ZodOptional<z.ZodString>;
|
|
53144
|
+
created_at: z.ZodString;
|
|
53145
|
+
updated_at: z.ZodString;
|
|
53146
|
+
deleted_at: z.ZodOptional<z.ZodString>;
|
|
53147
|
+
usage_period: z.ZodObject<{
|
|
53148
|
+
anchor: z.ZodString;
|
|
53149
|
+
interval: z.ZodString;
|
|
53150
|
+
}, z.core.$strict>;
|
|
53151
|
+
current_usage_period: z.ZodObject<{
|
|
53152
|
+
from: z.ZodString;
|
|
53153
|
+
to: z.ZodString;
|
|
53154
|
+
}, z.core.$strict>;
|
|
53155
|
+
is_soft_limit: z.ZodOptional<z.ZodBoolean>;
|
|
53156
|
+
issue: z.ZodOptional<z.ZodObject<{
|
|
53157
|
+
amount: z.ZodString;
|
|
53158
|
+
priority: z.ZodOptional<z.ZodNumber>;
|
|
53159
|
+
}, z.core.$strict>>;
|
|
53160
|
+
issue_after_reset: z.ZodOptional<z.ZodString>;
|
|
53161
|
+
issue_after_reset_priority: z.ZodOptional<z.ZodNumber>;
|
|
53162
|
+
preserve_overage_at_reset: z.ZodOptional<z.ZodBoolean>;
|
|
53163
|
+
measure_usage_from: z.ZodString;
|
|
53164
|
+
last_reset: z.ZodString;
|
|
53165
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
53166
|
+
id: z.ZodString;
|
|
53167
|
+
type: z.ZodLiteral<"static">;
|
|
53168
|
+
feature: z.ZodObject<{
|
|
53169
|
+
id: z.ZodString;
|
|
53170
|
+
}, z.core.$strict>;
|
|
53171
|
+
customer: z.ZodObject<{
|
|
53172
|
+
id: z.ZodString;
|
|
53173
|
+
}, z.core.$strict>;
|
|
53174
|
+
labels: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
53175
|
+
usage_period: z.ZodOptional<z.ZodObject<{
|
|
53176
|
+
anchor: z.ZodString;
|
|
53177
|
+
interval: z.ZodString;
|
|
53178
|
+
}, z.core.$strict>>;
|
|
53179
|
+
current_usage_period: z.ZodOptional<z.ZodObject<{
|
|
53180
|
+
from: z.ZodString;
|
|
53181
|
+
to: z.ZodString;
|
|
53182
|
+
}, z.core.$strict>>;
|
|
53183
|
+
active_from: z.ZodString;
|
|
53184
|
+
active_to: z.ZodOptional<z.ZodString>;
|
|
53185
|
+
created_at: z.ZodString;
|
|
53186
|
+
updated_at: z.ZodString;
|
|
53187
|
+
deleted_at: z.ZodOptional<z.ZodString>;
|
|
53188
|
+
config: z.ZodUnknown;
|
|
53189
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
53190
|
+
id: z.ZodString;
|
|
53191
|
+
type: z.ZodLiteral<"boolean">;
|
|
53192
|
+
feature: z.ZodObject<{
|
|
53193
|
+
id: z.ZodString;
|
|
53194
|
+
}, z.core.$strict>;
|
|
53195
|
+
customer: z.ZodObject<{
|
|
53196
|
+
id: z.ZodString;
|
|
53197
|
+
}, z.core.$strict>;
|
|
53198
|
+
labels: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
53199
|
+
usage_period: z.ZodOptional<z.ZodObject<{
|
|
53200
|
+
anchor: z.ZodString;
|
|
53201
|
+
interval: z.ZodString;
|
|
53202
|
+
}, z.core.$strict>>;
|
|
53203
|
+
current_usage_period: z.ZodOptional<z.ZodObject<{
|
|
53204
|
+
from: z.ZodString;
|
|
53205
|
+
to: z.ZodString;
|
|
53206
|
+
}, z.core.$strict>>;
|
|
53207
|
+
active_from: z.ZodString;
|
|
53208
|
+
active_to: z.ZodOptional<z.ZodString>;
|
|
53209
|
+
created_at: z.ZodString;
|
|
53210
|
+
updated_at: z.ZodString;
|
|
53211
|
+
deleted_at: z.ZodOptional<z.ZodString>;
|
|
53212
|
+
}, z.core.$strict>], "type">;
|
|
52929
53213
|
export declare const getCustomerEntitlementHistoryPathParamsWire: z.ZodObject<{
|
|
52930
53214
|
customerId: z.ZodString;
|
|
52931
53215
|
entitlementId: z.ZodString;
|
package/dist/models/schemas.js
CHANGED
|
@@ -5763,6 +5763,12 @@ export const createCustomerEntitlementPathParams = z.object({
|
|
|
5763
5763
|
});
|
|
5764
5764
|
export const createCustomerEntitlementBody = createEntitlementRequest;
|
|
5765
5765
|
export const createCustomerEntitlementResponse = entitlement;
|
|
5766
|
+
export const overrideCustomerEntitlementPathParams = z.object({
|
|
5767
|
+
customerId: ulid,
|
|
5768
|
+
entitlementId: ulid,
|
|
5769
|
+
});
|
|
5770
|
+
export const overrideCustomerEntitlementBody = createEntitlementRequest;
|
|
5771
|
+
export const overrideCustomerEntitlementResponse = entitlement;
|
|
5766
5772
|
export const getCustomerEntitlementHistoryPathParams = z.object({
|
|
5767
5773
|
customerId: ulid,
|
|
5768
5774
|
entitlementId: ulid,
|
|
@@ -12256,6 +12262,12 @@ export const createCustomerEntitlementPathParamsWire = z.object({
|
|
|
12256
12262
|
});
|
|
12257
12263
|
export const createCustomerEntitlementBodyWire = createEntitlementRequestWire;
|
|
12258
12264
|
export const createCustomerEntitlementResponseWire = entitlementWire;
|
|
12265
|
+
export const overrideCustomerEntitlementPathParamsWire = z.object({
|
|
12266
|
+
customerId: ulidWire,
|
|
12267
|
+
entitlementId: ulidWire,
|
|
12268
|
+
});
|
|
12269
|
+
export const overrideCustomerEntitlementBodyWire = createEntitlementRequestWire;
|
|
12270
|
+
export const overrideCustomerEntitlementResponseWire = entitlementWire;
|
|
12259
12271
|
export const getCustomerEntitlementHistoryPathParamsWire = z.object({
|
|
12260
12272
|
customerId: ulidWire,
|
|
12261
12273
|
entitlementId: ulidWire,
|
package/dist/sdk/internal.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 { CreateCustomerEntitlementRequest, CreateCustomerEntitlementResponse, GetCustomerEntitlementHistoryRequest, GetCustomerEntitlementHistoryResponse, GetCustomerEntitlementRequest, GetCustomerEntitlementResponse, ListCustomerEntitlementsRequest, ListCustomerEntitlementsResponse, ResetCustomerEntitlementUsageRequest, ResetCustomerEntitlementUsageResponse, DeleteCustomerEntitlementRequest, DeleteCustomerEntitlementResponse, VoidCreditGrantRequest, VoidCreditGrantResponse, ListCustomerChargesRequest, ListCustomerChargesResponse, CreateCustomerChargesRequest, CreateCustomerChargesResponse } from '../models/operations/customers.js';
|
|
3
|
+
import type { CreateCustomerEntitlementRequest, CreateCustomerEntitlementResponse, OverrideCustomerEntitlementRequest, OverrideCustomerEntitlementResponse, GetCustomerEntitlementHistoryRequest, GetCustomerEntitlementHistoryResponse, GetCustomerEntitlementRequest, GetCustomerEntitlementResponse, ListCustomerEntitlementsRequest, ListCustomerEntitlementsResponse, ResetCustomerEntitlementUsageRequest, ResetCustomerEntitlementUsageResponse, DeleteCustomerEntitlementRequest, DeleteCustomerEntitlementResponse, VoidCreditGrantRequest, VoidCreditGrantResponse, ListCustomerChargesRequest, ListCustomerChargesResponse, CreateCustomerChargesRequest, CreateCustomerChargesResponse } from '../models/operations/customers.js';
|
|
4
4
|
import type { GetCustomerEntitlementAccessRequest, GetCustomerEntitlementAccessResponse, ListEntitlementsRequest, ListEntitlementsResponse, GetEntitlementRequest, GetEntitlementResponse } from '../models/operations/entitlements.js';
|
|
5
5
|
import type { UnscheduleSubscriptionRequest, UnscheduleSubscriptionResponse, RestoreSubscriptionRequest, RestoreSubscriptionResponse, MigrateSubscriptionRequest, MigrateSubscriptionResponse, CreateSubscriptionAddonRequest, CreateSubscriptionAddonResponse, UpdateSubscriptionAddonRequest, UpdateSubscriptionAddonResponse } from '../models/operations/subscriptions.js';
|
|
6
6
|
import type { UninstallAppRequest, UninstallAppResponse, UpdateAppRequest, UpdateAppResponse, ListAppCatalogRequest, ListAppCatalogResponse, GetAppCatalogItemRequest, GetAppCatalogItemResponse, InstallAppRequest, InstallAppResponse } from '../models/operations/apps.js';
|
|
@@ -65,6 +65,21 @@ export declare class InternalCustomersEntitlements {
|
|
|
65
65
|
* POST /openmeter/customers/{customerId}/entitlements
|
|
66
66
|
*/
|
|
67
67
|
create(request: CreateCustomerEntitlementRequest, options?: RequestOptions): Promise<CreateCustomerEntitlementResponse>;
|
|
68
|
+
/**
|
|
69
|
+
* Override customer entitlement
|
|
70
|
+
*
|
|
71
|
+
* Override an entitlement of the customer with a new one.
|
|
72
|
+
*
|
|
73
|
+
* The referenced entitlement ends and the new one starts at the same instant, so
|
|
74
|
+
* access continues without a gap. Both must belong to the same feature. Use this
|
|
75
|
+
* for upgrades and downgrades.
|
|
76
|
+
*
|
|
77
|
+
* Fails if the referenced entitlement does not exist, is deleted, or is no longer
|
|
78
|
+
* active.
|
|
79
|
+
*
|
|
80
|
+
* PUT /openmeter/customers/{customerId}/entitlements/{entitlementId}/override
|
|
81
|
+
*/
|
|
82
|
+
override(request: OverrideCustomerEntitlementRequest, options?: RequestOptions): Promise<OverrideCustomerEntitlementResponse>;
|
|
68
83
|
/**
|
|
69
84
|
* Get customer entitlement history
|
|
70
85
|
*
|
package/dist/sdk/internal.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 { paginatePages } from '../lib/paginate.js';
|
|
4
|
-
import { createCustomerEntitlement, getCustomerEntitlementHistory, getCustomerEntitlement, listCustomerEntitlements, resetCustomerEntitlementUsage, deleteCustomerEntitlement, voidCreditGrant, listCustomerCharges, createCustomerCharges, } from '../funcs/customers.js';
|
|
4
|
+
import { createCustomerEntitlement, overrideCustomerEntitlement, getCustomerEntitlementHistory, getCustomerEntitlement, listCustomerEntitlements, resetCustomerEntitlementUsage, deleteCustomerEntitlement, voidCreditGrant, listCustomerCharges, createCustomerCharges, } from '../funcs/customers.js';
|
|
5
5
|
import { getCustomerEntitlementAccess, listEntitlements, getEntitlement, } from '../funcs/entitlements.js';
|
|
6
6
|
import { unscheduleSubscription, restoreSubscription, migrateSubscription, createSubscriptionAddon, updateSubscriptionAddon, } from '../funcs/subscriptions.js';
|
|
7
7
|
import { uninstallApp, updateApp, listAppCatalog, getAppCatalogItem, installApp, } from '../funcs/apps.js';
|
|
@@ -99,6 +99,23 @@ export class InternalCustomersEntitlements {
|
|
|
99
99
|
async create(request, options) {
|
|
100
100
|
return unwrap(await createCustomerEntitlement(this._client, request, options));
|
|
101
101
|
}
|
|
102
|
+
/**
|
|
103
|
+
* Override customer entitlement
|
|
104
|
+
*
|
|
105
|
+
* Override an entitlement of the customer with a new one.
|
|
106
|
+
*
|
|
107
|
+
* The referenced entitlement ends and the new one starts at the same instant, so
|
|
108
|
+
* access continues without a gap. Both must belong to the same feature. Use this
|
|
109
|
+
* for upgrades and downgrades.
|
|
110
|
+
*
|
|
111
|
+
* Fails if the referenced entitlement does not exist, is deleted, or is no longer
|
|
112
|
+
* active.
|
|
113
|
+
*
|
|
114
|
+
* PUT /openmeter/customers/{customerId}/entitlements/{entitlementId}/override
|
|
115
|
+
*/
|
|
116
|
+
async override(request, options) {
|
|
117
|
+
return unwrap(await overrideCustomerEntitlement(this._client, request, options));
|
|
118
|
+
}
|
|
102
119
|
/**
|
|
103
120
|
* Get customer entitlement history
|
|
104
121
|
*
|