@openmeter/client 1.0.0-beta-6d41ced5d8d3 → 1.0.0-beta-89ad46498d71

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.
@@ -619,6 +619,19 @@ export interface EntitlementAccessValue {
619
619
  /** The remaining balance of each grant, keyed by grant ID. */
620
620
  grantBalances: Record<string, string>;
621
621
  }
622
+ /**
623
+ * Usage granted automatically after each reset of a metered entitlement. The
624
+ * balance returns to `amount` after every reset.
625
+ */
626
+ export interface EntitlementIssueAfterReset {
627
+ /** The amount granted after each reset, in the feature's unit. */
628
+ amount: string;
629
+ /**
630
+ * The priority of the grant created after each reset. Lower values have higher
631
+ * priority.
632
+ */
633
+ priority: number;
634
+ }
622
635
  /** Cost basis with an explicit conversion rate supplied with the charge. */
623
636
  export interface CreateChargeCostBasisManual {
624
637
  /** Discriminator selecting the cost basis mode. */
@@ -873,6 +886,10 @@ export interface ProfileReference {
873
886
  /** The ID of the billing profile. */
874
887
  id: string;
875
888
  }
889
+ /** Feature reference. */
890
+ export interface FeatureReference {
891
+ id: string;
892
+ }
876
893
  /** Cost basis pinned to a specific cost basis resource of the custom currency. */
877
894
  export interface CreateChargeCostBasisPinned {
878
895
  /** Discriminator selecting the cost basis mode. */
@@ -921,10 +938,6 @@ export interface SubscriptionCostBasisPin {
921
938
  /** The pinned cost basis resource ID. */
922
939
  costBasisId: string;
923
940
  }
924
- /** Feature reference. */
925
- export interface FeatureReference {
926
- id: string;
927
- }
928
941
  /**
929
942
  * Subscription reference represents a reference to the specific subscription item
930
943
  * this entity represents.
@@ -1106,24 +1119,6 @@ export interface AppStripeCreateCustomerPortalSessionResult {
1106
1119
  */
1107
1120
  url: string;
1108
1121
  }
1109
- /**
1110
- * Fiat conversion rate a custom-currency charge is invoiced at. Present once the
1111
- * cost basis is resolved; dynamic cost bases are exposed only after the service
1112
- * period has started.
1113
- */
1114
- export interface ChargeResolvedCostBasis {
1115
- /** The fiat currency the charge amount is converted into for invoicing. */
1116
- fiatCurrency: string;
1117
- /** Fiat amount per one unit of the custom currency. */
1118
- rate: string;
1119
- /**
1120
- * ID of the custom currency's cost basis resource the rate was taken from. Absent
1121
- * for manual cost bases.
1122
- */
1123
- costBasisId?: string;
1124
- /** When the rate was resolved. */
1125
- resolvedAt: Date;
1126
- }
1127
1122
  /**
1128
1123
  * A period with defined start and end dates.
1129
1124
  *
@@ -1143,6 +1138,24 @@ export interface ClosedPeriod {
1143
1138
  */
1144
1139
  to: Date;
1145
1140
  }
1141
+ /**
1142
+ * Fiat conversion rate a custom-currency charge is invoiced at. Present once the
1143
+ * cost basis is resolved; dynamic cost bases are exposed only after the service
1144
+ * period has started.
1145
+ */
1146
+ export interface ChargeResolvedCostBasis {
1147
+ /** The fiat currency the charge amount is converted into for invoicing. */
1148
+ fiatCurrency: string;
1149
+ /** Fiat amount per one unit of the custom currency. */
1150
+ rate: string;
1151
+ /**
1152
+ * ID of the custom currency's cost basis resource the rate was taken from. Absent
1153
+ * for manual cost bases.
1154
+ */
1155
+ costBasisId?: string;
1156
+ /** When the rate was resolved. */
1157
+ resolvedAt: Date;
1158
+ }
1146
1159
  /** A subscription add-on event. */
1147
1160
  export interface SubscriptionAddonTimelineSegment {
1148
1161
  /** An ISO-8601 timestamp representation of the cadence start of the resource. */
@@ -1780,6 +1793,23 @@ export interface CustomerStripeCreateCustomerPortalSessionRequest {
1780
1793
  /** Options for configuring the Stripe Customer Portal Session. */
1781
1794
  stripeOptions: AppStripeCreateCustomerPortalSessionOptions;
1782
1795
  }
1796
+ /**
1797
+ * Recurring period input. The anchor is optional; the owning resource defines the
1798
+ * default, typically its creation time.
1799
+ */
1800
+ export interface RecurringPeriodInput {
1801
+ /** The interval duration in ISO 8601 format. */
1802
+ interval: string;
1803
+ /** A date-time anchor to base the recurring period on. */
1804
+ anchor?: Date;
1805
+ }
1806
+ /** Recurring period with an anchor and an interval. */
1807
+ export interface RecurringPeriod {
1808
+ /** A date-time anchor to base the recurring period on. */
1809
+ anchor: Date;
1810
+ /** The interval duration in ISO 8601 format. */
1811
+ interval: string;
1812
+ }
1783
1813
  /** The entitlement template of a metered entitlement. */
1784
1814
  export interface RateCardMeteredEntitlement {
1785
1815
  /** The type of the entitlement template. */
@@ -1830,13 +1860,6 @@ export interface SubscriptionEditStretchPhase {
1830
1860
  /** The ISO-8601 duration to extend the phase by. */
1831
1861
  extendBy: string;
1832
1862
  }
1833
- /** Recurring period with an anchor and an interval. */
1834
- export interface RecurringPeriod {
1835
- /** A date-time anchor to base the recurring period on. */
1836
- anchor: Date;
1837
- /** The interval duration in ISO 8601 format. */
1838
- interval: string;
1839
- }
1840
1863
  /**
1841
1864
  * Request body for updating the external payment settlement status of a credit
1842
1865
  * grant.
@@ -3194,15 +3217,189 @@ export interface AppStripeCreateCheckoutSessionConsentCollection {
3194
3217
  */
3195
3218
  termsOfService?: 'none' | 'required';
3196
3219
  }
3220
+ /** A grant created together with a metered entitlement. */
3221
+ export interface EntitlementGrantCreateRequest {
3222
+ /** The amount to grant, in the feature's unit. Must be positive. */
3223
+ amount: string;
3224
+ /**
3225
+ * The priority of the grant. Lower values have higher priority. Grants are
3226
+ * consumed in priority order, then by closest expiration, then by earliest
3227
+ * creation.
3228
+ */
3229
+ priority?: number;
3230
+ /**
3231
+ * The time the grant becomes effective and the anchor for recurring grants. The
3232
+ * value is rounded up to the next minute.
3233
+ */
3234
+ effectiveAt: Date;
3235
+ /**
3236
+ * The duration after which the grant expires, counted from `effective_at`. Only
3237
+ * single-unit durations are accepted, such as `PT12H`, `P7D`, `P2W`, `P3M`, or
3238
+ * `P1Y`. If omitted, the grant never expires.
3239
+ */
3240
+ expiresAfter?: string;
3241
+ /**
3242
+ * The maximum balance carried over at reset. The balance after a reset is
3243
+ * `MIN(max_rollover_amount, MAX(balance_before_reset, min_rollover_amount))`.
3244
+ * Defaults to `amount`.
3245
+ */
3246
+ maxRolloverAmount?: string;
3247
+ /**
3248
+ * The minimum balance carried over at reset. The balance after a reset is
3249
+ * `MIN(max_rollover_amount, MAX(balance_before_reset, min_rollover_amount))`.
3250
+ * Defaults to `0`.
3251
+ */
3252
+ minRolloverAmount?: string;
3253
+ labels?: Labels;
3254
+ /**
3255
+ * The recurrence of the grant. When set, the amount is issued again every
3256
+ * interval. The anchor defaults to `effective_at`.
3257
+ */
3258
+ recurrence?: RecurringPeriodInput;
3259
+ }
3260
+ /** Static entitlement create request. */
3261
+ export interface CreateEntitlementStaticRequest {
3262
+ /** The type of the entitlement. */
3263
+ type: 'static';
3264
+ /** The feature the customer is entitled to use. */
3265
+ feature: FeatureReference;
3266
+ labels?: Labels;
3267
+ /**
3268
+ * The entitlement configuration as a JSON value. Returned when checking
3269
+ * entitlement access.
3270
+ */
3271
+ config: unknown;
3272
+ /**
3273
+ * The usage period of the entitlement. The anchor defaults to the entitlement
3274
+ * creation time.
3275
+ */
3276
+ usagePeriod?: RecurringPeriodInput;
3277
+ }
3278
+ /** Boolean entitlement create request. */
3279
+ export interface CreateEntitlementBooleanRequest {
3280
+ /** The type of the entitlement. */
3281
+ type: 'boolean';
3282
+ /** The feature the customer is entitled to use. */
3283
+ feature: FeatureReference;
3284
+ labels?: Labels;
3285
+ /**
3286
+ * The usage period of the entitlement. The anchor defaults to the entitlement
3287
+ * creation time.
3288
+ */
3289
+ usagePeriod?: RecurringPeriodInput;
3290
+ }
3197
3291
  /**
3198
- * Add a new phase to the subscription. The phase is created without items; use
3199
- * add-item operations to populate it.
3292
+ * A metered entitlement grants a usage allowance for a feature. Access is
3293
+ * determined by the balance: the allowance provided by grants is burnt down by
3294
+ * usage.
3200
3295
  */
3201
- export interface SubscriptionEditAddPhase {
3202
- /** Discriminator for the add-phase operation. */
3203
- type: 'add_phase';
3204
- /** The phase to add. */
3205
- phase: SubscriptionPhaseCreate;
3296
+ export interface EntitlementMetered {
3297
+ id: string;
3298
+ /** The type of the entitlement. */
3299
+ type: 'metered';
3300
+ /** The feature the customer is entitled to use. */
3301
+ feature: FeatureReference;
3302
+ /** The customer the entitlement belongs to. */
3303
+ customer: CustomerReference;
3304
+ labels?: Labels;
3305
+ /** The time from which the entitlement is active. */
3306
+ activeFrom: Date;
3307
+ /**
3308
+ * The time until which the entitlement is active. If not set, the entitlement is
3309
+ * active until deleted.
3310
+ */
3311
+ activeTo?: Date;
3312
+ /** The time the entitlement was created. */
3313
+ createdAt: Date;
3314
+ /** The time the entitlement was last updated. */
3315
+ updatedAt: Date;
3316
+ /** The time the entitlement was deleted. */
3317
+ deletedAt?: Date;
3318
+ /**
3319
+ * The usage period of the entitlement. The balance resets at the start of every
3320
+ * period.
3321
+ */
3322
+ usagePeriod: RecurringPeriod;
3323
+ /** The current usage period of the entitlement. */
3324
+ currentUsagePeriod: ClosedPeriod;
3325
+ /**
3326
+ * If true, the customer keeps access to the feature after the balance is
3327
+ * exhausted.
3328
+ */
3329
+ isSoftLimit: boolean;
3330
+ /** Usage granted automatically after each reset. Cannot be combined with `grants`. */
3331
+ issue?: EntitlementIssueAfterReset;
3332
+ /** The amount granted automatically after each reset. */
3333
+ issueAfterReset?: string;
3334
+ /** The priority of the grant created after each reset. */
3335
+ issueAfterResetPriority: number;
3336
+ /** If true, the overage is preserved at reset. If false, the usage is reset to 0. */
3337
+ preserveOverageAtReset: boolean;
3338
+ /** The time from which usage is measured. */
3339
+ measureUsageFrom: Date;
3340
+ /** The time of the last reset. */
3341
+ lastReset: Date;
3342
+ }
3343
+ /** A static entitlement grants access to a feature together with a configuration. */
3344
+ export interface EntitlementStatic {
3345
+ id: string;
3346
+ /** The type of the entitlement. */
3347
+ type: 'static';
3348
+ /** The feature the customer is entitled to use. */
3349
+ feature: FeatureReference;
3350
+ /** The customer the entitlement belongs to. */
3351
+ customer: CustomerReference;
3352
+ labels?: Labels;
3353
+ /** The usage period of the entitlement. */
3354
+ usagePeriod?: RecurringPeriod;
3355
+ /** The current usage period of the entitlement. */
3356
+ currentUsagePeriod?: ClosedPeriod;
3357
+ /** The time from which the entitlement is active. */
3358
+ activeFrom: Date;
3359
+ /**
3360
+ * The time until which the entitlement is active. If not set, the entitlement is
3361
+ * active until deleted.
3362
+ */
3363
+ activeTo?: Date;
3364
+ /** The time the entitlement was created. */
3365
+ createdAt: Date;
3366
+ /** The time the entitlement was last updated. */
3367
+ updatedAt: Date;
3368
+ /** The time the entitlement was deleted. */
3369
+ deletedAt?: Date;
3370
+ /**
3371
+ * The entitlement configuration as a JSON value. Returned when checking
3372
+ * entitlement access.
3373
+ */
3374
+ config: unknown;
3375
+ }
3376
+ /** A boolean entitlement grants access to a feature. */
3377
+ export interface EntitlementBoolean {
3378
+ id: string;
3379
+ /** The type of the entitlement. */
3380
+ type: 'boolean';
3381
+ /** The feature the customer is entitled to use. */
3382
+ feature: FeatureReference;
3383
+ /** The customer the entitlement belongs to. */
3384
+ customer: CustomerReference;
3385
+ labels?: Labels;
3386
+ /** The usage period of the entitlement. */
3387
+ usagePeriod?: RecurringPeriod;
3388
+ /** The current usage period of the entitlement. */
3389
+ currentUsagePeriod?: ClosedPeriod;
3390
+ /** The time from which the entitlement is active. */
3391
+ activeFrom: Date;
3392
+ /**
3393
+ * The time until which the entitlement is active. If not set, the entitlement is
3394
+ * active until deleted.
3395
+ */
3396
+ activeTo?: Date;
3397
+ /** The time the entitlement was created. */
3398
+ createdAt: Date;
3399
+ /** The time the entitlement was last updated. */
3400
+ updatedAt: Date;
3401
+ /** The time the entitlement was deleted. */
3402
+ deletedAt?: Date;
3206
3403
  }
3207
3404
  /**
3208
3405
  * BillingWorkflowCollectionAlignmentAnchored specifies the alignment for
@@ -3214,6 +3411,16 @@ export interface WorkflowCollectionAlignmentAnchored {
3214
3411
  /** The recurring period for the alignment. */
3215
3412
  recurringPeriod: RecurringPeriod;
3216
3413
  }
3414
+ /**
3415
+ * Add a new phase to the subscription. The phase is created without items; use
3416
+ * add-item operations to populate it.
3417
+ */
3418
+ export interface SubscriptionEditAddPhase {
3419
+ /** Discriminator for the add-phase operation. */
3420
+ type: 'add_phase';
3421
+ /** The phase to add. */
3422
+ phase: SubscriptionPhaseCreate;
3423
+ }
3217
3424
  /** Subscription fields without phases or the current billing period. */
3218
3425
  export interface SubscriptionBase {
3219
3426
  id: string;
@@ -3980,6 +4187,39 @@ export interface AppStripeCreateCheckoutSessionRequestOptions {
3980
4187
  /** Configuration for collecting tax IDs during checkout. */
3981
4188
  taxIdCollection?: AppStripeCreateCheckoutSessionTaxIdCollection;
3982
4189
  }
4190
+ /** Metered entitlement create request. */
4191
+ export interface CreateEntitlementMeteredRequest {
4192
+ /** The type of the entitlement. */
4193
+ type: 'metered';
4194
+ /** The feature the customer is entitled to use. */
4195
+ feature: FeatureReference;
4196
+ labels?: Labels;
4197
+ /**
4198
+ * If true, the customer keeps access to the feature after the balance is
4199
+ * exhausted.
4200
+ */
4201
+ isSoftLimit: boolean;
4202
+ /** Usage granted automatically after each reset. Cannot be combined with `grants`. */
4203
+ issue?: EntitlementIssueAfterReset;
4204
+ /** The amount granted automatically after each reset. */
4205
+ issueAfterReset?: string;
4206
+ /** The priority of the grant created after each reset. */
4207
+ issueAfterResetPriority: number;
4208
+ /** If true, the overage is preserved at reset. If false, the usage is reset to 0. */
4209
+ preserveOverageAtReset: boolean;
4210
+ /**
4211
+ * The usage period of the entitlement. The balance resets at the start of every
4212
+ * period. The anchor defaults to the entitlement creation time.
4213
+ */
4214
+ usagePeriod: RecurringPeriodInput;
4215
+ /**
4216
+ * The time from which usage is measured. Defaults to the entitlement creation
4217
+ * time.
4218
+ */
4219
+ measureUsageFrom?: EntitlementMeasureUsageFrom;
4220
+ /** Grants created together with the entitlement. Cannot be combined with `issue`. */
4221
+ grants?: EntitlementGrantCreateRequest[];
4222
+ }
3983
4223
  /** Snapshot of the billing workflow configuration captured at invoice creation. */
3984
4224
  export interface InvoiceWorkflowSettings {
3985
4225
  /** The apps that will be used to orchestrate the invoice's workflow. */
@@ -6374,6 +6614,8 @@ export type DateTimeFieldFilter = Date | {
6374
6614
  gt?: Date;
6375
6615
  gte?: Date;
6376
6616
  };
6617
+ /** The time from which usage is measured, as a preset or an explicit timestamp. */
6618
+ export type EntitlementMeasureUsageFrom = 'current_period_start' | 'now' | Date;
6377
6619
  /** Payment settings for a billing workflow. */
6378
6620
  export type WorkflowPaymentSettings = WorkflowPaymentChargeAutomaticallySettings | WorkflowPaymentSendInvoiceSettings;
6379
6621
  /**
@@ -6429,6 +6671,8 @@ export type ChargeRealizationDetailedLine = ChargeRealizationDetailedLineFlatFee
6429
6671
  export type Currency = CurrencyFiat | CurrencyCustom;
6430
6672
  /** Customer or reference. */
6431
6673
  export type CustomerOrReference = Customer | CustomerReference;
6674
+ /** An entitlement grants a customer access to a feature. */
6675
+ export type Entitlement = EntitlementMetered | EntitlementStatic | EntitlementBoolean;
6432
6676
  /**
6433
6677
  * The alignment for collecting the pending line items into an invoice.
6434
6678
  *
@@ -6448,6 +6692,8 @@ export type Price = PriceFree | PriceFlat | PriceUnit | PriceGraduated | PriceVo
6448
6692
  export type PriceUsageBased = PriceUnit | PriceGraduated | PriceVolume;
6449
6693
  /** Price. */
6450
6694
  export type UpdatePrice = UpdatePriceFree | UpdatePriceFlat | UpdatePriceUnit | UpdatePriceGraduated | UpdatePriceVolume;
6695
+ /** Entitlement create request. */
6696
+ export type CreateEntitlementRequest = CreateEntitlementMeteredRequest | CreateEntitlementStaticRequest | CreateEntitlementBooleanRequest;
6451
6697
  /** Installed application. */
6452
6698
  export type App = AppStripe | AppSandbox | AppExternalInvoicing;
6453
6699
  /** Response of the app install. */
@@ -6576,6 +6822,19 @@ export interface UpdateBillingWorkflowPaymentSendInvoiceSettingsInput {
6576
6822
  */
6577
6823
  dueAfter?: string;
6578
6824
  }
6825
+ /**
6826
+ * Usage granted automatically after each reset of a metered entitlement. The
6827
+ * balance returns to `amount` after every reset.
6828
+ */
6829
+ export interface EntitlementIssueAfterResetInput {
6830
+ /** The amount granted after each reset, in the feature's unit. */
6831
+ amount: string;
6832
+ /**
6833
+ * The priority of the grant created after each reset. Lower values have higher
6834
+ * priority.
6835
+ */
6836
+ priority?: number;
6837
+ }
6579
6838
  /** Metering event following the CloudEvents specification. */
6580
6839
  export interface EventInput {
6581
6840
  /** Identifies the event. */
@@ -6805,6 +7064,58 @@ export interface IngestedEventInput {
6805
7064
  /** The validation errors of the ingested event. */
6806
7065
  validationErrors?: IngestedEventValidationError[];
6807
7066
  }
7067
+ /**
7068
+ * A metered entitlement grants a usage allowance for a feature. Access is
7069
+ * determined by the balance: the allowance provided by grants is burnt down by
7070
+ * usage.
7071
+ */
7072
+ export interface EntitlementMeteredInput {
7073
+ id: string;
7074
+ /** The type of the entitlement. */
7075
+ type: 'metered';
7076
+ /** The feature the customer is entitled to use. */
7077
+ feature: FeatureReference;
7078
+ /** The customer the entitlement belongs to. */
7079
+ customer: CustomerReference;
7080
+ labels?: Labels;
7081
+ /** The time from which the entitlement is active. */
7082
+ activeFrom: Date;
7083
+ /**
7084
+ * The time until which the entitlement is active. If not set, the entitlement is
7085
+ * active until deleted.
7086
+ */
7087
+ activeTo?: Date;
7088
+ /** The time the entitlement was created. */
7089
+ createdAt: Date;
7090
+ /** The time the entitlement was last updated. */
7091
+ updatedAt: Date;
7092
+ /** The time the entitlement was deleted. */
7093
+ deletedAt?: Date;
7094
+ /**
7095
+ * The usage period of the entitlement. The balance resets at the start of every
7096
+ * period.
7097
+ */
7098
+ usagePeriod: RecurringPeriod;
7099
+ /** The current usage period of the entitlement. */
7100
+ currentUsagePeriod: ClosedPeriod;
7101
+ /**
7102
+ * If true, the customer keeps access to the feature after the balance is
7103
+ * exhausted.
7104
+ */
7105
+ isSoftLimit?: boolean;
7106
+ /** Usage granted automatically after each reset. Cannot be combined with `grants`. */
7107
+ issue?: EntitlementIssueAfterResetInput;
7108
+ /** The amount granted automatically after each reset. */
7109
+ issueAfterReset?: string;
7110
+ /** The priority of the grant created after each reset. */
7111
+ issueAfterResetPriority?: number;
7112
+ /** If true, the overage is preserved at reset. If false, the usage is reset to 0. */
7113
+ preserveOverageAtReset?: boolean;
7114
+ /** The time from which usage is measured. */
7115
+ measureUsageFrom: Date;
7116
+ /** The time of the last reset. */
7117
+ lastReset: Date;
7118
+ }
6808
7119
  /** Subscription fields without phases or the current billing period. */
6809
7120
  export interface SubscriptionBaseInput {
6810
7121
  id: string;
@@ -7160,6 +7471,39 @@ export interface AppStripeCreateCheckoutSessionRequestOptionsInput {
7160
7471
  /** Configuration for collecting tax IDs during checkout. */
7161
7472
  taxIdCollection?: AppStripeCreateCheckoutSessionTaxIdCollectionInput;
7162
7473
  }
7474
+ /** Metered entitlement create request. */
7475
+ export interface CreateEntitlementMeteredRequestInput {
7476
+ /** The type of the entitlement. */
7477
+ type: 'metered';
7478
+ /** The feature the customer is entitled to use. */
7479
+ feature: FeatureReference;
7480
+ labels?: Labels;
7481
+ /**
7482
+ * If true, the customer keeps access to the feature after the balance is
7483
+ * exhausted.
7484
+ */
7485
+ isSoftLimit?: boolean;
7486
+ /** Usage granted automatically after each reset. Cannot be combined with `grants`. */
7487
+ issue?: EntitlementIssueAfterResetInput;
7488
+ /** The amount granted automatically after each reset. */
7489
+ issueAfterReset?: string;
7490
+ /** The priority of the grant created after each reset. */
7491
+ issueAfterResetPriority?: number;
7492
+ /** If true, the overage is preserved at reset. If false, the usage is reset to 0. */
7493
+ preserveOverageAtReset?: boolean;
7494
+ /**
7495
+ * The usage period of the entitlement. The balance resets at the start of every
7496
+ * period. The anchor defaults to the entitlement creation time.
7497
+ */
7498
+ usagePeriod: RecurringPeriodInput;
7499
+ /**
7500
+ * The time from which usage is measured. Defaults to the entitlement creation
7501
+ * time.
7502
+ */
7503
+ measureUsageFrom?: EntitlementMeasureUsageFrom;
7504
+ /** Grants created together with the entitlement. Cannot be combined with `issue`. */
7505
+ grants?: EntitlementGrantCreateRequest[];
7506
+ }
7163
7507
  /** Snapshot of the billing workflow configuration captured at invoice creation. */
7164
7508
  export interface InvoiceWorkflowSettingsInput {
7165
7509
  /** The apps that will be used to orchestrate the invoice's workflow. */
@@ -8995,6 +9339,10 @@ export type UpdateBillingWorkflowPaymentSettingsInput = UpdateBillingWorkflowPay
8995
9339
  * rate card itself, so it is omitted here.
8996
9340
  */
8997
9341
  export type RateCardEntitlementInput = RateCardMeteredEntitlementInput | RateCardStaticEntitlement | RateCardBooleanEntitlement;
9342
+ /** An entitlement grants a customer access to a feature. */
9343
+ export type EntitlementInput = EntitlementMeteredInput | EntitlementStatic | EntitlementBoolean;
9344
+ /** Entitlement create request. */
9345
+ export type CreateEntitlementRequestInput = CreateEntitlementMeteredRequestInput | CreateEntitlementStaticRequest | CreateEntitlementBooleanRequest;
8998
9346
  /** ChargeRealizationInvoice or reference. */
8999
9347
  export type ChargeRealizationInvoiceOrReferenceInput = ChargeRealizationInvoiceInput | ChargeRealizationInvoiceReference;
9000
9348
  /** Customer charge. */
@@ -1,6 +1,6 @@
1
1
  import { type Client } from '../core.js';
2
2
  import { type RequestOptions } from '../lib/types.js';
3
- import type { VoidCreditGrantRequest, VoidCreditGrantResponse, ListCustomerChargesRequest, ListCustomerChargesResponse, CreateCustomerChargesRequest, CreateCustomerChargesResponse } from '../models/operations/customers.js';
3
+ import type { CreateCustomerEntitlementRequest, CreateCustomerEntitlementResponse, VoidCreditGrantRequest, VoidCreditGrantResponse, ListCustomerChargesRequest, ListCustomerChargesResponse, CreateCustomerChargesRequest, CreateCustomerChargesResponse } from '../models/operations/customers.js';
4
4
  import type { UnscheduleSubscriptionRequest, UnscheduleSubscriptionResponse, RestoreSubscriptionRequest, RestoreSubscriptionResponse, MigrateSubscriptionRequest, MigrateSubscriptionResponse, CreateSubscriptionAddonRequest, CreateSubscriptionAddonResponse, UpdateSubscriptionAddonRequest, UpdateSubscriptionAddonResponse } from '../models/operations/subscriptions.js';
5
5
  import type { UninstallAppRequest, UninstallAppResponse, UpdateAppRequest, UpdateAppResponse, ListAppCatalogRequest, ListAppCatalogResponse, GetAppCatalogItemRequest, GetAppCatalogItemResponse, InstallAppRequest, InstallAppResponse } from '../models/operations/apps.js';
6
6
  import type { ListInvoicesRequest, ListInvoicesResponse, GetInvoiceRequest, GetInvoiceResponse, UpdateInvoiceRequest, UpdateInvoiceResponse, DeleteInvoiceRequest, DeleteInvoiceResponse, AdvanceInvoiceRequest, AdvanceInvoiceResponse, ApproveInvoiceRequest, ApproveInvoiceResponse, RetryInvoiceRequest, RetryInvoiceResponse, SnapshotQuantitiesInvoiceRequest, SnapshotQuantitiesInvoiceResponse } from '../models/operations/invoices.js';
@@ -37,11 +37,29 @@ export declare class Internal {
37
37
  export declare class InternalCustomers {
38
38
  private readonly _client;
39
39
  constructor(_client: Client);
40
+ private _entitlements?;
41
+ get entitlements(): InternalCustomersEntitlements;
40
42
  private _credits?;
41
43
  get credits(): InternalCustomersCredits;
42
44
  private _charges?;
43
45
  get charges(): InternalCustomersCharges;
44
46
  }
47
+ export declare class InternalCustomersEntitlements {
48
+ private readonly _client;
49
+ constructor(_client: Client);
50
+ /**
51
+ * Create customer entitlement
52
+ *
53
+ * Create an entitlement for the customer.
54
+ *
55
+ * A customer can have only one active entitlement per feature. The feature must be
56
+ * compatible with the entitlement type. Entitlements cannot be modified after
57
+ * creation, only deleted.
58
+ *
59
+ * POST /openmeter/customers/{customerId}/entitlements
60
+ */
61
+ create(request: CreateCustomerEntitlementRequest, options?: RequestOptions): Promise<CreateCustomerEntitlementResponse>;
62
+ }
45
63
  export declare class InternalCustomersCredits {
46
64
  private readonly _client;
47
65
  constructor(_client: Client);
@@ -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 { voidCreditGrant, listCustomerCharges, createCustomerCharges, } from '../funcs/customers.js';
4
+ import { createCustomerEntitlement, voidCreditGrant, listCustomerCharges, createCustomerCharges, } from '../funcs/customers.js';
5
5
  import { unscheduleSubscription, restoreSubscription, migrateSubscription, createSubscriptionAddon, updateSubscriptionAddon, } from '../funcs/subscriptions.js';
6
6
  import { uninstallApp, updateApp, listAppCatalog, getAppCatalogItem, installApp, } from '../funcs/apps.js';
7
7
  import { listInvoices, getInvoice, updateInvoice, deleteInvoice, advanceInvoice, approveInvoice, retryInvoice, snapshotQuantitiesInvoice, } from '../funcs/invoices.js';
@@ -57,6 +57,10 @@ export class InternalCustomers {
57
57
  constructor(_client) {
58
58
  this._client = _client;
59
59
  }
60
+ _entitlements;
61
+ get entitlements() {
62
+ return (this._entitlements ??= new InternalCustomersEntitlements(this._client));
63
+ }
60
64
  _credits;
61
65
  get credits() {
62
66
  return (this._credits ??= new InternalCustomersCredits(this._client));
@@ -66,6 +70,26 @@ export class InternalCustomers {
66
70
  return (this._charges ??= new InternalCustomersCharges(this._client));
67
71
  }
68
72
  }
73
+ export class InternalCustomersEntitlements {
74
+ _client;
75
+ constructor(_client) {
76
+ this._client = _client;
77
+ }
78
+ /**
79
+ * Create customer entitlement
80
+ *
81
+ * Create an entitlement for the customer.
82
+ *
83
+ * A customer can have only one active entitlement per feature. The feature must be
84
+ * compatible with the entitlement type. Entitlements cannot be modified after
85
+ * creation, only deleted.
86
+ *
87
+ * POST /openmeter/customers/{customerId}/entitlements
88
+ */
89
+ async create(request, options) {
90
+ return unwrap(await createCustomerEntitlement(this._client, request, options));
91
+ }
92
+ }
69
93
  export class InternalCustomersCredits {
70
94
  _client;
71
95
  constructor(_client) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@openmeter/client",
3
- "version": "1.0.0-beta-6d41ced5d8d3",
3
+ "version": "1.0.0-beta-89ad46498d71",
4
4
  "description": "Official TypeScript SDK for the OpenMeter API — usage metering and billing",
5
5
  "keywords": [
6
6
  "openmeter",