@openmeter/client 1.0.0-beta-9b0450f0db89 → 1.0.0-beta-0abbaf78837c
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 +14 -11
- package/dist/funcs/customers.d.ts +40 -1
- package/dist/funcs/customers.js +158 -0
- package/dist/index.d.ts +1 -1
- package/dist/lib/version.d.ts +1 -1
- package/dist/lib/version.js +1 -1
- package/dist/models/operations/customers.d.ts +39 -1
- package/dist/models/schemas.d.ts +549 -0
- package/dist/models/schemas.js +143 -2
- package/dist/models/types.d.ts +72 -2
- package/dist/sdk/internal.d.ts +61 -2
- package/dist/sdk/internal.js +72 -1
- package/package.json +1 -1
package/dist/models/schemas.js
CHANGED
|
@@ -3484,7 +3484,7 @@ export const entitlementGrantCreateRequest = z
|
|
|
3484
3484
|
labels: labels.optional(),
|
|
3485
3485
|
recurrence: recurringPeriodInput.optional(),
|
|
3486
3486
|
})
|
|
3487
|
-
.describe('A grant
|
|
3487
|
+
.describe('A grant to issue for a metered entitlement.');
|
|
3488
3488
|
export const createEntitlementStaticRequest = z
|
|
3489
3489
|
.object({
|
|
3490
3490
|
type: z.literal('static').describe('The type of the entitlement.'),
|
|
@@ -3577,6 +3577,31 @@ export const entitlementBoolean = z
|
|
|
3577
3577
|
deletedAt: dateTime.optional(),
|
|
3578
3578
|
})
|
|
3579
3579
|
.describe('A boolean entitlement grants access to a feature.');
|
|
3580
|
+
export const entitlementGrant = z
|
|
3581
|
+
.object({
|
|
3582
|
+
id: ulid,
|
|
3583
|
+
entitlementId: ulid,
|
|
3584
|
+
amount: numeric,
|
|
3585
|
+
priority: z
|
|
3586
|
+
.number()
|
|
3587
|
+
.int()
|
|
3588
|
+
.nonnegative()
|
|
3589
|
+
.lte(255)
|
|
3590
|
+
.describe('The priority of the grant. Lower values are consumed first: a grant with priority 1 is consumed before one with priority 2. Among equal priorities, the grant closest to expiration is consumed first, then the earliest created.'),
|
|
3591
|
+
effectiveAt: dateTime,
|
|
3592
|
+
expiresAfter: iso8601Duration.optional(),
|
|
3593
|
+
expiresAt: dateTime.optional(),
|
|
3594
|
+
maxRolloverAmount: numeric,
|
|
3595
|
+
minRolloverAmount: numeric,
|
|
3596
|
+
recurrence: recurringPeriod.optional(),
|
|
3597
|
+
nextRecurrence: dateTime.optional(),
|
|
3598
|
+
voidedAt: dateTime.optional(),
|
|
3599
|
+
labels: labels.optional(),
|
|
3600
|
+
createdAt: dateTime,
|
|
3601
|
+
updatedAt: dateTime,
|
|
3602
|
+
deletedAt: dateTime.optional(),
|
|
3603
|
+
})
|
|
3604
|
+
.describe("A grant issued for a metered entitlement. Each grant adds its amount to the entitlement's balance from its effective time until it expires, and usage is deducted from the grants in priority order. Grants are immutable, so the balance is deterministic regardless of when it is queried. Deleting a grant ends it at the time of the deletion.");
|
|
3580
3605
|
export const workflowCollectionAlignmentAnchored = z
|
|
3581
3606
|
.object({
|
|
3582
3607
|
type: z.literal('anchored').describe('The type of alignment.'),
|
|
@@ -4182,6 +4207,12 @@ export const entitlement = z
|
|
|
4182
4207
|
entitlementBoolean,
|
|
4183
4208
|
])
|
|
4184
4209
|
.describe('An entitlement grants a customer access to a feature.');
|
|
4210
|
+
export const entitlementGrantPagePaginatedResponse = z
|
|
4211
|
+
.object({
|
|
4212
|
+
data: z.array(entitlementGrant),
|
|
4213
|
+
meta: paginatedMeta,
|
|
4214
|
+
})
|
|
4215
|
+
.describe('Page paginated response.');
|
|
4185
4216
|
export const workflowCollectionAlignment = z
|
|
4186
4217
|
.discriminatedUnion('type', [
|
|
4187
4218
|
workflowCollectionAlignmentSubscription,
|
|
@@ -5763,6 +5794,12 @@ export const createCustomerEntitlementPathParams = z.object({
|
|
|
5763
5794
|
});
|
|
5764
5795
|
export const createCustomerEntitlementBody = createEntitlementRequest;
|
|
5765
5796
|
export const createCustomerEntitlementResponse = entitlement;
|
|
5797
|
+
export const overrideCustomerEntitlementPathParams = z.object({
|
|
5798
|
+
customerId: ulid,
|
|
5799
|
+
entitlementId: ulid,
|
|
5800
|
+
});
|
|
5801
|
+
export const overrideCustomerEntitlementBody = createEntitlementRequest;
|
|
5802
|
+
export const overrideCustomerEntitlementResponse = entitlement;
|
|
5766
5803
|
export const getCustomerEntitlementHistoryPathParams = z.object({
|
|
5767
5804
|
customerId: ulid,
|
|
5768
5805
|
entitlementId: ulid,
|
|
@@ -5837,6 +5874,38 @@ export const getEntitlementPathParams = z.object({
|
|
|
5837
5874
|
entitlementId: ulid,
|
|
5838
5875
|
});
|
|
5839
5876
|
export const getEntitlementResponse = entitlement;
|
|
5877
|
+
export const createCustomerEntitlementGrantPathParams = z.object({
|
|
5878
|
+
customerId: ulid,
|
|
5879
|
+
entitlementId: ulid,
|
|
5880
|
+
});
|
|
5881
|
+
export const createCustomerEntitlementGrantBody = entitlementGrantCreateRequest;
|
|
5882
|
+
export const createCustomerEntitlementGrantResponse = entitlementGrant;
|
|
5883
|
+
export const listCustomerEntitlementGrantsPathParams = z.object({
|
|
5884
|
+
customerId: ulid,
|
|
5885
|
+
entitlementId: ulid,
|
|
5886
|
+
});
|
|
5887
|
+
export const listCustomerEntitlementGrantsQueryParams = z.object({
|
|
5888
|
+
page: z
|
|
5889
|
+
.object({
|
|
5890
|
+
size: z.coerce
|
|
5891
|
+
.number()
|
|
5892
|
+
.int()
|
|
5893
|
+
.optional()
|
|
5894
|
+
.describe('The number of items to include per page.'),
|
|
5895
|
+
number: z.coerce.number().int().optional().describe('The page number.'),
|
|
5896
|
+
})
|
|
5897
|
+
.optional()
|
|
5898
|
+
.describe('Determines which page of the collection to retrieve.'),
|
|
5899
|
+
sort: sortQuery.optional(),
|
|
5900
|
+
includeDeleted: z.coerce
|
|
5901
|
+
.boolean()
|
|
5902
|
+
.optional()
|
|
5903
|
+
.describe('Include deleted grants in the response.'),
|
|
5904
|
+
});
|
|
5905
|
+
export const listCustomerEntitlementGrantsResponse = z.object({
|
|
5906
|
+
data: z.array(entitlementGrant),
|
|
5907
|
+
meta: paginatedMeta,
|
|
5908
|
+
});
|
|
5840
5909
|
export const createCreditGrantPathParams = z.object({
|
|
5841
5910
|
customerId: ulid,
|
|
5842
5911
|
});
|
|
@@ -9976,7 +10045,7 @@ export const entitlementGrantCreateRequestWire = z
|
|
|
9976
10045
|
labels: labelsWire.optional(),
|
|
9977
10046
|
recurrence: recurringPeriodInputWire.optional(),
|
|
9978
10047
|
})
|
|
9979
|
-
.describe('A grant
|
|
10048
|
+
.describe('A grant to issue for a metered entitlement.');
|
|
9980
10049
|
export const createEntitlementStaticRequestWire = z
|
|
9981
10050
|
.strictObject({
|
|
9982
10051
|
type: z.literal('static').describe('The type of the entitlement.'),
|
|
@@ -10066,6 +10135,31 @@ export const entitlementBooleanWire = z
|
|
|
10066
10135
|
deleted_at: dateTimeWire.optional(),
|
|
10067
10136
|
})
|
|
10068
10137
|
.describe('A boolean entitlement grants access to a feature.');
|
|
10138
|
+
export const entitlementGrantWire = z
|
|
10139
|
+
.strictObject({
|
|
10140
|
+
id: ulidWire,
|
|
10141
|
+
entitlement_id: ulidWire,
|
|
10142
|
+
amount: numericWire,
|
|
10143
|
+
priority: z
|
|
10144
|
+
.number()
|
|
10145
|
+
.int()
|
|
10146
|
+
.nonnegative()
|
|
10147
|
+
.lte(255)
|
|
10148
|
+
.describe('The priority of the grant. Lower values are consumed first: a grant with priority 1 is consumed before one with priority 2. Among equal priorities, the grant closest to expiration is consumed first, then the earliest created.'),
|
|
10149
|
+
effective_at: dateTimeWire,
|
|
10150
|
+
expires_after: iso8601DurationWire.optional(),
|
|
10151
|
+
expires_at: dateTimeWire.optional(),
|
|
10152
|
+
max_rollover_amount: numericWire,
|
|
10153
|
+
min_rollover_amount: numericWire,
|
|
10154
|
+
recurrence: recurringPeriodWire.optional(),
|
|
10155
|
+
next_recurrence: dateTimeWire.optional(),
|
|
10156
|
+
voided_at: dateTimeWire.optional(),
|
|
10157
|
+
labels: labelsWire.optional(),
|
|
10158
|
+
created_at: dateTimeWire,
|
|
10159
|
+
updated_at: dateTimeWire,
|
|
10160
|
+
deleted_at: dateTimeWire.optional(),
|
|
10161
|
+
})
|
|
10162
|
+
.describe("A grant issued for a metered entitlement. Each grant adds its amount to the entitlement's balance from its effective time until it expires, and usage is deducted from the grants in priority order. Grants are immutable, so the balance is deterministic regardless of when it is queried. Deleting a grant ends it at the time of the deletion.");
|
|
10069
10163
|
export const workflowCollectionAlignmentAnchoredWire = z
|
|
10070
10164
|
.strictObject({
|
|
10071
10165
|
type: z.literal('anchored').describe('The type of alignment.'),
|
|
@@ -10666,6 +10760,12 @@ export const entitlementWire = z
|
|
|
10666
10760
|
entitlementBooleanWire,
|
|
10667
10761
|
])
|
|
10668
10762
|
.describe('An entitlement grants a customer access to a feature.');
|
|
10763
|
+
export const entitlementGrantPagePaginatedResponseWire = z
|
|
10764
|
+
.strictObject({
|
|
10765
|
+
data: z.array(entitlementGrantWire),
|
|
10766
|
+
meta: paginatedMetaWire,
|
|
10767
|
+
})
|
|
10768
|
+
.describe('Page paginated response.');
|
|
10669
10769
|
export const workflowCollectionAlignmentWire = z
|
|
10670
10770
|
.discriminatedUnion('type', [
|
|
10671
10771
|
workflowCollectionAlignmentSubscriptionWire,
|
|
@@ -12256,6 +12356,12 @@ export const createCustomerEntitlementPathParamsWire = z.object({
|
|
|
12256
12356
|
});
|
|
12257
12357
|
export const createCustomerEntitlementBodyWire = createEntitlementRequestWire;
|
|
12258
12358
|
export const createCustomerEntitlementResponseWire = entitlementWire;
|
|
12359
|
+
export const overrideCustomerEntitlementPathParamsWire = z.object({
|
|
12360
|
+
customerId: ulidWire,
|
|
12361
|
+
entitlementId: ulidWire,
|
|
12362
|
+
});
|
|
12363
|
+
export const overrideCustomerEntitlementBodyWire = createEntitlementRequestWire;
|
|
12364
|
+
export const overrideCustomerEntitlementResponseWire = entitlementWire;
|
|
12259
12365
|
export const getCustomerEntitlementHistoryPathParamsWire = z.object({
|
|
12260
12366
|
customerId: ulidWire,
|
|
12261
12367
|
entitlementId: ulidWire,
|
|
@@ -12335,6 +12441,41 @@ export const getEntitlementPathParamsWire = z.object({
|
|
|
12335
12441
|
entitlementId: ulidWire,
|
|
12336
12442
|
});
|
|
12337
12443
|
export const getEntitlementResponseWire = entitlementWire;
|
|
12444
|
+
export const createCustomerEntitlementGrantPathParamsWire = z.object({
|
|
12445
|
+
customerId: ulidWire,
|
|
12446
|
+
entitlementId: ulidWire,
|
|
12447
|
+
});
|
|
12448
|
+
export const createCustomerEntitlementGrantBodyWire = entitlementGrantCreateRequestWire;
|
|
12449
|
+
export const createCustomerEntitlementGrantResponseWire = entitlementGrantWire;
|
|
12450
|
+
export const listCustomerEntitlementGrantsPathParamsWire = z.object({
|
|
12451
|
+
customerId: ulidWire,
|
|
12452
|
+
entitlementId: ulidWire,
|
|
12453
|
+
});
|
|
12454
|
+
export const listCustomerEntitlementGrantsQueryParamsWire = z.object({
|
|
12455
|
+
page: z
|
|
12456
|
+
.strictObject({
|
|
12457
|
+
size: z.coerce
|
|
12458
|
+
.number()
|
|
12459
|
+
.int()
|
|
12460
|
+
.optional()
|
|
12461
|
+
.describe('The number of items to include per page.'),
|
|
12462
|
+
number: z.coerce.number().int().optional().describe('The page number.'),
|
|
12463
|
+
})
|
|
12464
|
+
.optional()
|
|
12465
|
+
.describe('Determines which page of the collection to retrieve.'),
|
|
12466
|
+
sort: z
|
|
12467
|
+
.string()
|
|
12468
|
+
.optional()
|
|
12469
|
+
.describe('Sort grants returned in the response. Supported sort attributes are: - `created_at` (default) - `updated_at` - `effective_at` - `expires_at` The `asc` suffix is optional as the default sort order is ascending. The `desc` suffix is used to specify a descending order.'),
|
|
12470
|
+
include_deleted: z.coerce
|
|
12471
|
+
.boolean()
|
|
12472
|
+
.optional()
|
|
12473
|
+
.describe('Include deleted grants in the response.'),
|
|
12474
|
+
});
|
|
12475
|
+
export const listCustomerEntitlementGrantsResponseWire = z.strictObject({
|
|
12476
|
+
data: z.array(entitlementGrantWire),
|
|
12477
|
+
meta: paginatedMetaWire,
|
|
12478
|
+
});
|
|
12338
12479
|
export const createCreditGrantPathParamsWire = z.object({
|
|
12339
12480
|
customerId: ulidWire,
|
|
12340
12481
|
});
|
package/dist/models/types.d.ts
CHANGED
|
@@ -3444,7 +3444,7 @@ export interface AppStripeCreateCheckoutSessionConsentCollection {
|
|
|
3444
3444
|
*/
|
|
3445
3445
|
termsOfService?: 'none' | 'required';
|
|
3446
3446
|
}
|
|
3447
|
-
/** A grant
|
|
3447
|
+
/** A grant to issue for a metered entitlement. */
|
|
3448
3448
|
export interface EntitlementGrantCreateRequest {
|
|
3449
3449
|
/** The amount to grant, in the feature's unit. Must be positive. */
|
|
3450
3450
|
amount: string;
|
|
@@ -3456,7 +3456,7 @@ export interface EntitlementGrantCreateRequest {
|
|
|
3456
3456
|
priority?: number;
|
|
3457
3457
|
/**
|
|
3458
3458
|
* The time the grant becomes effective and the anchor for recurring grants. The
|
|
3459
|
-
* value is
|
|
3459
|
+
* value is truncated to the start of the minute.
|
|
3460
3460
|
*/
|
|
3461
3461
|
effectiveAt: Date;
|
|
3462
3462
|
/**
|
|
@@ -3628,6 +3628,71 @@ export interface EntitlementBoolean {
|
|
|
3628
3628
|
/** The time the entitlement was deleted. */
|
|
3629
3629
|
deletedAt?: Date;
|
|
3630
3630
|
}
|
|
3631
|
+
/**
|
|
3632
|
+
* A grant issued for a metered entitlement. Each grant adds its amount to the
|
|
3633
|
+
* entitlement's balance from its effective time until it expires, and usage is
|
|
3634
|
+
* deducted from the grants in priority order.
|
|
3635
|
+
*
|
|
3636
|
+
* Grants are immutable, so the balance is deterministic regardless of when it is
|
|
3637
|
+
* queried. Deleting a grant ends it at the time of the deletion.
|
|
3638
|
+
*/
|
|
3639
|
+
export interface EntitlementGrant {
|
|
3640
|
+
id: string;
|
|
3641
|
+
/** The ID of the entitlement the grant belongs to. */
|
|
3642
|
+
entitlementId: string;
|
|
3643
|
+
/** The granted amount, in the feature's unit. */
|
|
3644
|
+
amount: string;
|
|
3645
|
+
/**
|
|
3646
|
+
* The priority of the grant. Lower values are consumed first: a grant with
|
|
3647
|
+
* priority 1 is consumed before one with priority 2. Among equal priorities, the
|
|
3648
|
+
* grant closest to expiration is consumed first, then the earliest created.
|
|
3649
|
+
*/
|
|
3650
|
+
priority: number;
|
|
3651
|
+
/** The time the grant takes effect. */
|
|
3652
|
+
effectiveAt: Date;
|
|
3653
|
+
/**
|
|
3654
|
+
* The duration after which the grant expires, counted from `effective_at`. Always
|
|
3655
|
+
* a single-unit duration (for example `PT12H`, `P7D`, `P2W`, `P3M`, `P1Y`). Absent
|
|
3656
|
+
* when the grant never expires.
|
|
3657
|
+
*/
|
|
3658
|
+
expiresAfter?: string;
|
|
3659
|
+
/**
|
|
3660
|
+
* The time the grant expires, calculated from `effective_at` and `expires_after`.
|
|
3661
|
+
* The grant is no longer in effect from this time. Absent when the grant never
|
|
3662
|
+
* expires.
|
|
3663
|
+
*/
|
|
3664
|
+
expiresAt?: Date;
|
|
3665
|
+
/**
|
|
3666
|
+
* The maximum balance the grant carries over at reset. The balance after a reset
|
|
3667
|
+
* is `MIN(max_rollover_amount, MAX(balance_before_reset, min_rollover_amount))`.
|
|
3668
|
+
*/
|
|
3669
|
+
maxRolloverAmount: string;
|
|
3670
|
+
/**
|
|
3671
|
+
* The minimum balance the grant carries over at reset. The balance after a reset
|
|
3672
|
+
* is `MIN(max_rollover_amount, MAX(balance_before_reset, min_rollover_amount))`.
|
|
3673
|
+
*/
|
|
3674
|
+
minRolloverAmount: string;
|
|
3675
|
+
/**
|
|
3676
|
+
* The recurrence of the grant. When set, the grant amount is re-issued every
|
|
3677
|
+
* interval from the anchor, which defaults to `effective_at`. Absent for
|
|
3678
|
+
* non-recurring grants.
|
|
3679
|
+
*/
|
|
3680
|
+
recurrence?: RecurringPeriod;
|
|
3681
|
+
/** The next time the grant recurs. Absent for non-recurring grants. */
|
|
3682
|
+
nextRecurrence?: Date;
|
|
3683
|
+
/**
|
|
3684
|
+
* The time the grant was voided. A voided grant is no longer in effect from this
|
|
3685
|
+
* time.
|
|
3686
|
+
*/
|
|
3687
|
+
voidedAt?: Date;
|
|
3688
|
+
labels?: Labels;
|
|
3689
|
+
/** An ISO-8601 timestamp representation of entity creation date. */
|
|
3690
|
+
createdAt: Date;
|
|
3691
|
+
/** An ISO-8601 timestamp representation of entity last update date. */
|
|
3692
|
+
updatedAt: Date;
|
|
3693
|
+
/** An ISO-8601 timestamp representation of entity deletion date. */
|
|
3694
|
+
deletedAt?: Date;
|
|
3695
|
+
}
|
|
3631
3696
|
/**
|
|
3632
3697
|
* BillingWorkflowCollectionAlignmentAnchored specifies the alignment for
|
|
3633
3698
|
* collecting the pending line items into an invoice.
|
|
@@ -4494,6 +4559,11 @@ export interface CreateEntitlementMeteredRequest {
|
|
|
4494
4559
|
/** Grants created together with the entitlement. Cannot be combined with `issue`. */
|
|
4495
4560
|
grants?: EntitlementGrantCreateRequest[];
|
|
4496
4561
|
}
|
|
4562
|
+
/** Page paginated response. */
|
|
4563
|
+
export interface EntitlementGrantPagePaginatedResponse {
|
|
4564
|
+
data: EntitlementGrant[];
|
|
4565
|
+
meta: PaginatedMeta;
|
|
4566
|
+
}
|
|
4497
4567
|
/** Snapshot of the billing workflow configuration captured at invoice creation. */
|
|
4498
4568
|
export interface InvoiceWorkflowSettings {
|
|
4499
4569
|
/** The apps that will be used to orchestrate the invoice's workflow. */
|
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, CreateCustomerEntitlementGrantRequest, CreateCustomerEntitlementGrantResponse, ListCustomerEntitlementGrantsRequest, ListCustomerEntitlementGrantsResponse, 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';
|
|
@@ -10,7 +10,7 @@ import type { ListCurrenciesRequest, ListCurrenciesResponse, CreateCustomCurrenc
|
|
|
10
10
|
import type { ListPlanAddonsRequest, ListPlanAddonsResponse } from '../models/operations/planAddons.js';
|
|
11
11
|
import type { QueryEntitlementAccessRequest, QueryEntitlementAccessResponse } from '../models/operations/entitlementAccess.js';
|
|
12
12
|
import type { ListNotificationChannelsRequest, ListNotificationChannelsResponse, CreateNotificationChannelRequest, CreateNotificationChannelResponse, GetNotificationChannelRequest, GetNotificationChannelResponse, UpdateNotificationChannelRequest, UpdateNotificationChannelResponse, DeleteNotificationChannelRequest, DeleteNotificationChannelResponse } from '../models/operations/notifications.js';
|
|
13
|
-
import type { AppCatalogItem, Charge, CostBasis, Currency, Entitlement, Invoice, NotificationChannel, PlanAddon } from '../models/types.js';
|
|
13
|
+
import type { AppCatalogItem, Charge, CostBasis, Currency, Entitlement, EntitlementGrant, Invoice, NotificationChannel, PlanAddon } from '../models/types.js';
|
|
14
14
|
/**
|
|
15
15
|
* Operations marked internal in the API definition. They are not part of
|
|
16
16
|
* the customer surface: they may require additional permissions, and they
|
|
@@ -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
|
*
|
|
@@ -137,6 +152,50 @@ export declare class InternalCustomersEntitlements {
|
|
|
137
152
|
* DELETE /openmeter/customers/{customerId}/entitlements/{entitlementId}
|
|
138
153
|
*/
|
|
139
154
|
delete(request: DeleteCustomerEntitlementRequest, options?: RequestOptions): Promise<DeleteCustomerEntitlementResponse>;
|
|
155
|
+
private _grants?;
|
|
156
|
+
get grants(): InternalCustomersEntitlementsGrants;
|
|
157
|
+
}
|
|
158
|
+
export declare class InternalCustomersEntitlementsGrants {
|
|
159
|
+
private readonly _client;
|
|
160
|
+
constructor(_client: Client);
|
|
161
|
+
/**
|
|
162
|
+
* Create customer entitlement grant
|
|
163
|
+
*
|
|
164
|
+
* Issue a grant for a metered entitlement of the customer. Boolean and static
|
|
165
|
+
* entitlements cannot have grants, so the request is rejected for them.
|
|
166
|
+
*
|
|
167
|
+
* Grants are immutable. The amount is added to the balance from `effective_at`,
|
|
168
|
+
* which cannot be earlier than the start of the current usage period.
|
|
169
|
+
*
|
|
170
|
+
* POST /openmeter/customers/{customerId}/entitlements/{entitlementId}/grants
|
|
171
|
+
*/
|
|
172
|
+
create(request: CreateCustomerEntitlementGrantRequest, options?: RequestOptions): Promise<CreateCustomerEntitlementGrantResponse>;
|
|
173
|
+
/**
|
|
174
|
+
* List customer entitlement grants
|
|
175
|
+
*
|
|
176
|
+
* List the grants issued for an entitlement of the customer. Grants only exist for
|
|
177
|
+
* metered entitlements, so the list is empty for boolean and static entitlements.
|
|
178
|
+
*
|
|
179
|
+
* Deleted grants are excluded unless `include_deleted` is set. Voided and expired
|
|
180
|
+
* grants are always included, as they are part of the balance history.
|
|
181
|
+
*
|
|
182
|
+
* GET /openmeter/customers/{customerId}/entitlements/{entitlementId}/grants
|
|
183
|
+
*/
|
|
184
|
+
list(request: ListCustomerEntitlementGrantsRequest, options?: RequestOptions): Promise<ListCustomerEntitlementGrantsResponse>;
|
|
185
|
+
/**
|
|
186
|
+
* List customer entitlement grants
|
|
187
|
+
*
|
|
188
|
+
* List the grants issued for an entitlement of the customer. Grants only exist for
|
|
189
|
+
* metered entitlements, so the list is empty for boolean and static entitlements.
|
|
190
|
+
*
|
|
191
|
+
* Deleted grants are excluded unless `include_deleted` is set. Voided and expired
|
|
192
|
+
* grants are always included, as they are part of the balance history.
|
|
193
|
+
*
|
|
194
|
+
* Iterates every item across all pages, fetching more as the returned iterable is consumed.
|
|
195
|
+
*
|
|
196
|
+
* GET /openmeter/customers/{customerId}/entitlements/{entitlementId}/grants
|
|
197
|
+
*/
|
|
198
|
+
listAll(request: ListCustomerEntitlementGrantsRequest, options?: RequestOptions): AsyncIterable<EntitlementGrant>;
|
|
140
199
|
}
|
|
141
200
|
export declare class InternalCustomersCredits {
|
|
142
201
|
private readonly _client;
|
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, createCustomerEntitlementGrant, listCustomerEntitlementGrants, 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
|
*
|
|
@@ -183,6 +200,60 @@ export class InternalCustomersEntitlements {
|
|
|
183
200
|
async delete(request, options) {
|
|
184
201
|
return unwrap(await deleteCustomerEntitlement(this._client, request, options));
|
|
185
202
|
}
|
|
203
|
+
_grants;
|
|
204
|
+
get grants() {
|
|
205
|
+
return (this._grants ??= new InternalCustomersEntitlementsGrants(this._client));
|
|
206
|
+
}
|
|
207
|
+
}
|
|
208
|
+
export class InternalCustomersEntitlementsGrants {
|
|
209
|
+
_client;
|
|
210
|
+
constructor(_client) {
|
|
211
|
+
this._client = _client;
|
|
212
|
+
}
|
|
213
|
+
/**
|
|
214
|
+
* Create customer entitlement grant
|
|
215
|
+
*
|
|
216
|
+
* Issue a grant for a metered entitlement of the customer. Boolean and static
|
|
217
|
+
* entitlements cannot have grants, so the request is rejected for them.
|
|
218
|
+
*
|
|
219
|
+
* Grants are immutable. The amount is added to the balance from `effective_at`,
|
|
220
|
+
* which cannot be earlier than the start of the current usage period.
|
|
221
|
+
*
|
|
222
|
+
* POST /openmeter/customers/{customerId}/entitlements/{entitlementId}/grants
|
|
223
|
+
*/
|
|
224
|
+
async create(request, options) {
|
|
225
|
+
return unwrap(await createCustomerEntitlementGrant(this._client, request, options));
|
|
226
|
+
}
|
|
227
|
+
/**
|
|
228
|
+
* List customer entitlement grants
|
|
229
|
+
*
|
|
230
|
+
* List the grants issued for an entitlement of the customer. Grants only exist for
|
|
231
|
+
* metered entitlements, so the list is empty for boolean and static entitlements.
|
|
232
|
+
*
|
|
233
|
+
* Deleted grants are excluded unless `include_deleted` is set. Voided and expired
|
|
234
|
+
* grants are always included, as they are part of the balance history.
|
|
235
|
+
*
|
|
236
|
+
* GET /openmeter/customers/{customerId}/entitlements/{entitlementId}/grants
|
|
237
|
+
*/
|
|
238
|
+
async list(request, options) {
|
|
239
|
+
return unwrap(await listCustomerEntitlementGrants(this._client, request, options));
|
|
240
|
+
}
|
|
241
|
+
/**
|
|
242
|
+
* List customer entitlement grants
|
|
243
|
+
*
|
|
244
|
+
* List the grants issued for an entitlement of the customer. Grants only exist for
|
|
245
|
+
* metered entitlements, so the list is empty for boolean and static entitlements.
|
|
246
|
+
*
|
|
247
|
+
* Deleted grants are excluded unless `include_deleted` is set. Voided and expired
|
|
248
|
+
* grants are always included, as they are part of the balance history.
|
|
249
|
+
*
|
|
250
|
+
* Iterates every item across all pages, fetching more as the returned iterable is consumed.
|
|
251
|
+
*
|
|
252
|
+
* GET /openmeter/customers/{customerId}/entitlements/{entitlementId}/grants
|
|
253
|
+
*/
|
|
254
|
+
listAll(request, options) {
|
|
255
|
+
return paginatePages((req, opts) => listCustomerEntitlementGrants(this._client, req, opts), request, options);
|
|
256
|
+
}
|
|
186
257
|
}
|
|
187
258
|
export class InternalCustomersCredits {
|
|
188
259
|
_client;
|