@openmeter/sdk 1.0.0-beta-8daddaa2afed → 1.0.0-beta-30c15d4607cf

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.
@@ -5011,900 +5011,510 @@ export const deleteCustomerAppDataParams = zod.object({
5011
5011
  ]),
5012
5012
  });
5013
5013
  /**
5014
- * OpenMeter has three types of entitlements: metered, boolean, and static. The type property determines the type of entitlement. The underlying feature has to be compatible with the entitlement type specified in the request (e.g., a metered entitlement needs a feature associated with a meter).
5015
-
5016
- - Boolean entitlements define static feature access, e.g. "Can use SSO authentication".
5017
- - Static entitlements let you pass along a configuration while granting access, e.g. "Using this feature with X Y settings" (passed in the config).
5018
- - Metered entitlements have many use cases, from setting up usage-based access to implementing complex credit systems. Example: The customer can use 10000 AI tokens during the usage period of the entitlement.
5019
-
5020
- A given customer can only have one active (non-deleted) entitlement per featureKey. If you try to create a new entitlement for a featureKey that already has an active entitlement, the request will fail with a 409 error.
5021
-
5022
- Once an entitlement is created you cannot modify it, only delete it.
5023
- * @summary Create a customer entitlement
5014
+ * Checks customer access to a given feature (by key). All entitlement types share the hasAccess property in their value response, but multiple other properties are returned based on the entitlement type.
5015
+ * @summary Get customer entitlement value
5024
5016
  */
5025
- export const createCustomerEntitlementParams = zod.object({
5017
+ export const getCustomerEntitlementValuePathFeatureKeyMax = 64;
5018
+ export const getCustomerEntitlementValuePathFeatureKeyRegExp = new RegExp('^[a-z0-9]+(?:_[a-z0-9]+)*$');
5019
+ export const getCustomerEntitlementValueParams = zod.object({
5026
5020
  customerIdOrKey: zod.union([
5027
5021
  zod.coerce
5028
5022
  .string()
5029
- .regex(createCustomerEntitlementPathCustomerIdOrKeyRegExpOne)
5023
+ .regex(getCustomerEntitlementValuePathCustomerIdOrKeyRegExpOne)
5030
5024
  .describe('ULID (Universally Unique Lexicographically Sortable Identifier).'),
5031
5025
  zod.coerce
5032
5026
  .string()
5033
5027
  .min(1)
5034
- .max(createCustomerEntitlementPathCustomerIdOrKeyMaxTwo)
5028
+ .max(getCustomerEntitlementValuePathCustomerIdOrKeyMaxTwo)
5035
5029
  .describe('ExternalKey is a looser version of key.'),
5036
5030
  ]),
5031
+ featureKey: zod.coerce
5032
+ .string()
5033
+ .min(1)
5034
+ .max(getCustomerEntitlementValuePathFeatureKeyMax)
5035
+ .regex(getCustomerEntitlementValuePathFeatureKeyRegExp),
5036
+ });
5037
+ export const getCustomerEntitlementValueQueryParams = zod.object({
5038
+ time: zod.coerce.date().optional(),
5037
5039
  });
5038
- export const createCustomerEntitlementBodyFeatureKeyMax = 64;
5039
- export const createCustomerEntitlementBodyFeatureKeyRegExp = new RegExp('^[a-z0-9]+(?:_[a-z0-9]+)*$');
5040
- export const createCustomerEntitlementBodyFeatureIdRegExp = new RegExp('^[0-7][0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{25}$');
5041
- export const createCustomerEntitlementBodyIsSoftLimitDefault = false;
5042
- export const createCustomerEntitlementBodyIsUnlimitedDefault = false;
5043
- export const createCustomerEntitlementBodyIssueAfterResetMin = 0;
5044
- export const createCustomerEntitlementBodyIssueAfterResetPriorityDefault = 1;
5045
- export const createCustomerEntitlementBodyIssueAfterResetPriorityMax = 255;
5046
- export const createCustomerEntitlementBodyPreserveOverageAtResetDefault = false;
5047
- export const createCustomerEntitlementBodyFeatureKeyMaxOne = 64;
5048
- export const createCustomerEntitlementBodyFeatureKeyRegExpOne = new RegExp('^[a-z0-9]+(?:_[a-z0-9]+)*$');
5049
- export const createCustomerEntitlementBodyFeatureIdRegExpOne = new RegExp('^[0-7][0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{25}$');
5050
- export const createCustomerEntitlementBodyFeatureKeyMaxTwo = 64;
5051
- export const createCustomerEntitlementBodyFeatureKeyRegExpTwo = new RegExp('^[a-z0-9]+(?:_[a-z0-9]+)*$');
5052
- export const createCustomerEntitlementBodyFeatureIdRegExpTwo = new RegExp('^[0-7][0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{25}$');
5053
- export const createCustomerEntitlementBody = zod
5054
- .union([
5055
- zod
5056
- .object({
5057
- featureId: zod.coerce
5058
- .string()
5059
- .regex(createCustomerEntitlementBodyFeatureIdRegExp)
5060
- .optional()
5061
- .describe('The feature the subject is entitled to use.\nEither featureKey or featureId is required.'),
5062
- featureKey: zod.coerce
5063
- .string()
5064
- .min(1)
5065
- .max(createCustomerEntitlementBodyFeatureKeyMax)
5066
- .regex(createCustomerEntitlementBodyFeatureKeyRegExp)
5067
- .optional()
5068
- .describe('The feature the subject is entitled to use.\nEither featureKey or featureId is required.'),
5069
- isSoftLimit: zod.coerce
5070
- .boolean()
5071
- .optional()
5072
- .describe('If softLimit=true the subject can use the feature even if the entitlement is exhausted, hasAccess will always be true.'),
5073
- issueAfterReset: zod.coerce
5074
- .number()
5075
- .min(createCustomerEntitlementBodyIssueAfterResetMin)
5076
- .optional()
5077
- .describe('You can grant usage automatically alongside the entitlement, the example scenario would be creating a starting balance.\nIf an amount is specified here, a grant will be created alongside the entitlement with the specified amount.\nThat grant will have it\'s rollover settings configured in a way that after each reset operation, the balance will return the original amount specified here.\nManually creating such a grant would mean having the \"amount\", \"minRolloverAmount\", and \"maxRolloverAmount\" fields all be the same.'),
5078
- issueAfterResetPriority: zod.coerce
5079
- .number()
5080
- .min(1)
5081
- .max(createCustomerEntitlementBodyIssueAfterResetPriorityMax)
5082
- .default(createCustomerEntitlementBodyIssueAfterResetPriorityDefault)
5083
- .describe('Defines the grant priority for the default grant.'),
5084
- isUnlimited: zod.coerce
5085
- .boolean()
5086
- .optional()
5087
- .describe('Deprecated, ignored by the backend. Please use isSoftLimit instead; this field will be removed in the future.'),
5088
- measureUsageFrom: zod
5089
- .union([
5090
- zod
5091
- .enum(['CURRENT_PERIOD_START', 'NOW'])
5092
- .describe('Start of measurement options'),
5093
- zod.coerce
5094
- .date()
5095
- .describe('[RFC3339](https://tools.ietf.org/html/rfc3339) formatted date-time string in UTC.'),
5096
- ])
5097
- .describe('Measure usage from')
5098
- .optional()
5099
- .describe('Defines the time from which usage is measured. If not specified on creation, defaults to entitlement creation time.'),
5100
- metadata: zod
5101
- .record(zod.string(), zod.coerce.string())
5102
- .describe('Set of key-value pairs.\nMetadata can be used to store additional information about a resource.')
5103
- .optional()
5104
- .describe('Additional metadata for the feature.'),
5105
- preserveOverageAtReset: zod.coerce
5106
- .boolean()
5107
- .optional()
5108
- .describe('If true, the overage is preserved at reset. If false, the usage is reset to 0.'),
5109
- type: zod.enum(['metered']),
5110
- usagePeriod: zod
5111
- .object({
5112
- anchor: zod.coerce
5113
- .date()
5114
- .optional()
5115
- .describe('A date-time anchor to base the recurring period on.'),
5116
- interval: zod
5117
- .union([
5118
- zod.coerce.string(),
5119
- zod
5120
- .enum(['DAY', 'WEEK', 'MONTH', 'YEAR'])
5121
- .describe('The unit of time for the interval.\nOne of: `day`, `week`, `month`, or `year`.'),
5122
- ])
5123
- .describe('Period duration for the recurrence')
5124
- .describe('The unit of time for the interval.'),
5125
- })
5126
- .describe('Recurring period with an interval and an anchor.')
5127
- .describe('The usage period associated with the entitlement.'),
5128
- })
5129
- .describe('Create inpurs for metered entitlement'),
5130
- zod
5131
- .object({
5132
- config: zod.coerce
5133
- .string()
5134
- .describe('The JSON parsable config of the entitlement. This value is also returned when checking entitlement access and it is useful for configuring fine-grained access settings to the feature, implemented in your own system. Has to be an object.'),
5135
- featureId: zod.coerce
5136
- .string()
5137
- .regex(createCustomerEntitlementBodyFeatureIdRegExpOne)
5138
- .optional()
5139
- .describe('The feature the subject is entitled to use.\nEither featureKey or featureId is required.'),
5140
- featureKey: zod.coerce
5141
- .string()
5142
- .min(1)
5143
- .max(createCustomerEntitlementBodyFeatureKeyMaxOne)
5144
- .regex(createCustomerEntitlementBodyFeatureKeyRegExpOne)
5145
- .optional()
5146
- .describe('The feature the subject is entitled to use.\nEither featureKey or featureId is required.'),
5147
- metadata: zod
5148
- .record(zod.string(), zod.coerce.string())
5149
- .describe('Set of key-value pairs.\nMetadata can be used to store additional information about a resource.')
5150
- .optional()
5151
- .describe('Additional metadata for the feature.'),
5152
- type: zod.enum(['static']),
5153
- usagePeriod: zod
5154
- .object({
5155
- anchor: zod.coerce
5156
- .date()
5157
- .optional()
5158
- .describe('A date-time anchor to base the recurring period on.'),
5159
- interval: zod
5160
- .union([
5161
- zod.coerce.string(),
5162
- zod
5163
- .enum(['DAY', 'WEEK', 'MONTH', 'YEAR'])
5164
- .describe('The unit of time for the interval.\nOne of: `day`, `week`, `month`, or `year`.'),
5165
- ])
5166
- .describe('Period duration for the recurrence')
5167
- .describe('The unit of time for the interval.'),
5168
- })
5169
- .describe('Recurring period with an interval and an anchor.')
5170
- .optional()
5171
- .describe('The usage period associated with the entitlement.'),
5172
- })
5173
- .describe('Create inputs for static entitlement'),
5174
- zod
5175
- .object({
5176
- featureId: zod.coerce
5177
- .string()
5178
- .regex(createCustomerEntitlementBodyFeatureIdRegExpTwo)
5179
- .optional()
5180
- .describe('The feature the subject is entitled to use.\nEither featureKey or featureId is required.'),
5181
- featureKey: zod.coerce
5182
- .string()
5183
- .min(1)
5184
- .max(createCustomerEntitlementBodyFeatureKeyMaxTwo)
5185
- .regex(createCustomerEntitlementBodyFeatureKeyRegExpTwo)
5186
- .optional()
5187
- .describe('The feature the subject is entitled to use.\nEither featureKey or featureId is required.'),
5188
- metadata: zod
5189
- .record(zod.string(), zod.coerce.string())
5190
- .describe('Set of key-value pairs.\nMetadata can be used to store additional information about a resource.')
5191
- .optional()
5192
- .describe('Additional metadata for the feature.'),
5193
- type: zod.enum(['boolean']),
5194
- usagePeriod: zod
5195
- .object({
5196
- anchor: zod.coerce
5197
- .date()
5198
- .optional()
5199
- .describe('A date-time anchor to base the recurring period on.'),
5200
- interval: zod
5201
- .union([
5202
- zod.coerce.string(),
5203
- zod
5204
- .enum(['DAY', 'WEEK', 'MONTH', 'YEAR'])
5205
- .describe('The unit of time for the interval.\nOne of: `day`, `week`, `month`, or `year`.'),
5206
- ])
5207
- .describe('Period duration for the recurrence')
5208
- .describe('The unit of time for the interval.'),
5209
- })
5210
- .describe('Recurring period with an interval and an anchor.')
5211
- .optional()
5212
- .describe('The usage period associated with the entitlement.'),
5213
- })
5214
- .describe('Create inputs for boolean entitlement'),
5215
- ])
5216
- .describe('Create inputs for entitlement');
5217
5040
  /**
5218
- * List all entitlements for a customer. For checking entitlement access, use the /value endpoint instead.
5219
- * @summary List customer entitlements
5041
+ * Get stripe app data for a customer.
5042
+ Only returns data if the customer billing profile is linked to a stripe app.
5043
+ * @summary Get customer stripe app data
5220
5044
  */
5221
- export const listCustomerEntitlementsParams = zod.object({
5045
+ export const getCustomerStripeAppDataParams = zod.object({
5222
5046
  customerIdOrKey: zod.union([
5223
5047
  zod.coerce
5224
5048
  .string()
5225
- .regex(listCustomerEntitlementsPathCustomerIdOrKeyRegExpOne)
5049
+ .regex(getCustomerStripeAppDataPathCustomerIdOrKeyRegExpOne)
5226
5050
  .describe('ULID (Universally Unique Lexicographically Sortable Identifier).'),
5227
5051
  zod.coerce
5228
5052
  .string()
5229
5053
  .min(1)
5230
- .max(listCustomerEntitlementsPathCustomerIdOrKeyMaxTwo)
5054
+ .max(getCustomerStripeAppDataPathCustomerIdOrKeyMaxTwo)
5231
5055
  .describe('ExternalKey is a looser version of key.'),
5232
5056
  ]),
5233
5057
  });
5234
- export const listCustomerEntitlementsQueryIncludeDeletedDefault = false;
5235
- export const listCustomerEntitlementsQueryParams = zod.object({
5236
- includeDeleted: zod.coerce.boolean().optional(),
5237
- });
5238
5058
  /**
5239
- * Get entitlement by feature key. For checking entitlement access, use the /value endpoint instead.
5240
- * @summary Get customer entitlement
5059
+ * Upsert stripe app data for a customer.
5060
+ Only updates data if the customer billing profile is linked to a stripe app.
5061
+ * @summary Upsert customer stripe app data
5241
5062
  */
5242
- export const getCustomerEntitlementPathFeatureKeyMax = 64;
5243
- export const getCustomerEntitlementPathFeatureKeyRegExp = new RegExp('^[a-z0-9]+(?:_[a-z0-9]+)*$');
5244
- export const getCustomerEntitlementParams = zod.object({
5063
+ export const upsertCustomerStripeAppDataParams = zod.object({
5245
5064
  customerIdOrKey: zod.union([
5246
5065
  zod.coerce
5247
5066
  .string()
5248
- .regex(getCustomerEntitlementPathCustomerIdOrKeyRegExpOne)
5067
+ .regex(upsertCustomerStripeAppDataPathCustomerIdOrKeyRegExpOne)
5249
5068
  .describe('ULID (Universally Unique Lexicographically Sortable Identifier).'),
5250
5069
  zod.coerce
5251
5070
  .string()
5252
5071
  .min(1)
5253
- .max(getCustomerEntitlementPathCustomerIdOrKeyMaxTwo)
5072
+ .max(upsertCustomerStripeAppDataPathCustomerIdOrKeyMaxTwo)
5254
5073
  .describe('ExternalKey is a looser version of key.'),
5255
5074
  ]),
5256
- featureKey: zod.coerce
5257
- .string()
5258
- .min(1)
5259
- .max(getCustomerEntitlementPathFeatureKeyMax)
5260
- .regex(getCustomerEntitlementPathFeatureKeyRegExp),
5261
5075
  });
5076
+ export const upsertCustomerStripeAppDataBody = zod
5077
+ .object({
5078
+ stripeCustomerId: zod.coerce.string().describe('The Stripe customer ID.'),
5079
+ stripeDefaultPaymentMethodId: zod.coerce
5080
+ .string()
5081
+ .optional()
5082
+ .describe('The Stripe default payment method ID.'),
5083
+ })
5084
+ .describe('Stripe Customer App Data Base.');
5262
5085
  /**
5263
- * Deleting an entitlement revokes access to the associated feature. As a single customer can only have one entitlement per featureKey, when "migrating" features you have to delete the old entitlements as well.
5264
- As access and status checks can be historical queries, deleting an entitlement populates the deletedAt timestamp. When queried for a time before that, the entitlement is still considered active, you cannot have retroactive changes to access, which is important for, among other things, auditing.
5265
- * @summary Delete customer entitlement
5086
+ * Create Stripe customer portal session.
5087
+ Only returns URL if the customer billing profile is linked to a stripe app and customer.
5088
+
5089
+ Useful to redirect the customer to the Stripe customer portal to manage their payment methods,
5090
+ change their billing address and access their invoice history.
5091
+ * @summary Create Stripe customer portal session
5266
5092
  */
5267
- export const deleteCustomerEntitlementPathFeatureKeyMax = 64;
5268
- export const deleteCustomerEntitlementPathFeatureKeyRegExp = new RegExp('^[a-z0-9]+(?:_[a-z0-9]+)*$');
5269
- export const deleteCustomerEntitlementParams = zod.object({
5093
+ export const createCustomerStripePortalSessionParams = zod.object({
5270
5094
  customerIdOrKey: zod.union([
5271
5095
  zod.coerce
5272
5096
  .string()
5273
- .regex(deleteCustomerEntitlementPathCustomerIdOrKeyRegExpOne)
5097
+ .regex(createCustomerStripePortalSessionPathCustomerIdOrKeyRegExpOne)
5274
5098
  .describe('ULID (Universally Unique Lexicographically Sortable Identifier).'),
5275
5099
  zod.coerce
5276
5100
  .string()
5277
5101
  .min(1)
5278
- .max(deleteCustomerEntitlementPathCustomerIdOrKeyMaxTwo)
5102
+ .max(createCustomerStripePortalSessionPathCustomerIdOrKeyMaxTwo)
5279
5103
  .describe('ExternalKey is a looser version of key.'),
5280
5104
  ]),
5281
- featureKey: zod.coerce
5282
- .string()
5283
- .min(1)
5284
- .max(deleteCustomerEntitlementPathFeatureKeyMax)
5285
- .regex(deleteCustomerEntitlementPathFeatureKeyRegExp),
5286
5105
  });
5106
+ export const createCustomerStripePortalSessionBody = zod
5107
+ .object({
5108
+ configurationId: zod.coerce
5109
+ .string()
5110
+ .optional()
5111
+ .describe('The ID of an existing configuration to use for this session,\ndescribing its functionality and features.\nIf not specified, the session uses the default configuration.\n\nSee https://docs.stripe.com/api/customer_portal/sessions/create#create_portal_session-configuration'),
5112
+ locale: zod.coerce
5113
+ .string()
5114
+ .optional()
5115
+ .describe('The IETF language tag of the locale customer portal is displayed in.\nIf blank or auto, the customer’s preferred_locales or browser’s locale is used.\n\nSee: https://docs.stripe.com/api/customer_portal/sessions/create#create_portal_session-locale'),
5116
+ returnUrl: zod.coerce
5117
+ .string()
5118
+ .optional()
5119
+ .describe('The URL to redirect the customer to after they have completed\ntheir requested actions.\n\nSee: https://docs.stripe.com/api/customer_portal/sessions/create#create_portal_session-return_url'),
5120
+ })
5121
+ .describe('Stripe customer portal request params.');
5287
5122
  /**
5288
- * List all grants issued for an entitlement. The entitlement can be defined either by its id or featureKey.
5289
- * @summary List customer entitlement grants
5123
+ * Lists all subscriptions for a customer.
5124
+ * @summary List customer subscriptions
5290
5125
  */
5291
- export const listCustomerEntitlementGrantsPathFeatureKeyMax = 64;
5292
- export const listCustomerEntitlementGrantsPathFeatureKeyRegExp = new RegExp('^[a-z0-9]+(?:_[a-z0-9]+)*$');
5293
- export const listCustomerEntitlementGrantsParams = zod.object({
5126
+ export const listCustomerSubscriptionsParams = zod.object({
5294
5127
  customerIdOrKey: zod.union([
5295
5128
  zod.coerce
5296
5129
  .string()
5297
- .regex(listCustomerEntitlementGrantsPathCustomerIdOrKeyRegExpOne)
5130
+ .regex(listCustomerSubscriptionsPathCustomerIdOrKeyRegExpOne)
5298
5131
  .describe('ULID (Universally Unique Lexicographically Sortable Identifier).'),
5299
5132
  zod.coerce
5300
5133
  .string()
5301
5134
  .min(1)
5302
- .max(listCustomerEntitlementGrantsPathCustomerIdOrKeyMaxTwo)
5135
+ .max(listCustomerSubscriptionsPathCustomerIdOrKeyMaxTwo)
5303
5136
  .describe('ExternalKey is a looser version of key.'),
5304
5137
  ]),
5305
- featureKey: zod.coerce
5306
- .string()
5307
- .min(1)
5308
- .max(listCustomerEntitlementGrantsPathFeatureKeyMax)
5309
- .regex(listCustomerEntitlementGrantsPathFeatureKeyRegExp),
5310
- });
5311
- export const listCustomerEntitlementGrantsQueryIncludeDeletedDefault = false;
5312
- export const listCustomerEntitlementGrantsQueryParams = zod.object({
5313
- includeDeleted: zod.coerce.boolean().optional(),
5314
- orderBy: zod.enum(['id', 'createdAt', 'updatedAt']).optional(),
5315
5138
  });
5316
- /**
5317
- * Grants define a behavior of granting usage for a metered entitlement. They can have complicated recurrence and rollover rules, thanks to which you can define a wide range of access patterns with a single grant, in most cases you don't have to periodically create new grants. You can only issue grants for active metered entitlements.
5318
-
5319
- A grant defines a given amount of usage that can be consumed for the entitlement. The grant is in effect between its effective date and its expiration date. Specifying both is mandatory for new grants.
5320
-
5321
- Grants have a priority setting that determines their order of use. Lower numbers have higher priority, with 0 being the highest priority.
5322
-
5323
- Grants can have a recurrence setting intended to automate the manual reissuing of grants. For example, a daily recurrence is equal to reissuing that same grant every day (ignoring rollover settings).
5324
-
5325
- Rollover settings define what happens to the remaining balance of a grant at a reset. Balance_After_Reset = MIN(MaxRolloverAmount, MAX(Balance_Before_Reset, MinRolloverAmount))
5326
-
5327
- Grants cannot be changed once created, only deleted. This is to ensure that balance is deterministic regardless of when it is queried.
5328
- * @summary Create customer entitlement grant
5329
- */
5330
- export const createCustomerEntitlementGrantPathFeatureKeyMax = 64;
5331
- export const createCustomerEntitlementGrantPathFeatureKeyRegExp = new RegExp('^[a-z0-9]+(?:_[a-z0-9]+)*$');
5332
- export const createCustomerEntitlementGrantParams = zod.object({
5333
- customerIdOrKey: zod.union([
5334
- zod.coerce
5335
- .string()
5336
- .regex(createCustomerEntitlementGrantPathCustomerIdOrKeyRegExpOne)
5337
- .describe('ULID (Universally Unique Lexicographically Sortable Identifier).'),
5338
- zod.coerce
5339
- .string()
5340
- .min(1)
5341
- .max(createCustomerEntitlementGrantPathCustomerIdOrKeyMaxTwo)
5342
- .describe('ExternalKey is a looser version of key.'),
5343
- ]),
5344
- featureKey: zod.coerce
5345
- .string()
5346
- .min(1)
5347
- .max(createCustomerEntitlementGrantPathFeatureKeyMax)
5348
- .regex(createCustomerEntitlementGrantPathFeatureKeyRegExp),
5349
- });
5350
- export const createCustomerEntitlementGrantBodyAmountMin = 0;
5351
- export const createCustomerEntitlementGrantBodyPriorityMax = 255;
5352
- export const createCustomerEntitlementGrantBodyExpirationCountMax = 1000;
5353
- export const createCustomerEntitlementGrantBodyMaxRolloverAmountDefault = 0;
5354
- export const createCustomerEntitlementGrantBodyMinRolloverAmountDefault = 0;
5355
- export const createCustomerEntitlementGrantBody = zod
5356
- .object({
5357
- amount: zod.coerce
5139
+ export const listCustomerSubscriptionsQueryPageDefault = 1;
5140
+ export const listCustomerSubscriptionsQueryPageSizeDefault = 100;
5141
+ export const listCustomerSubscriptionsQueryPageSizeMax = 1000;
5142
+ export const listCustomerSubscriptionsQueryParams = zod.object({
5143
+ page: zod.coerce
5358
5144
  .number()
5359
- .min(createCustomerEntitlementGrantBodyAmountMin)
5360
- .describe('The amount to grant. Should be a positive number.'),
5361
- effectiveAt: zod.coerce
5362
- .date()
5363
- .describe('Effective date for grants and anchor for recurring grants. Provided value will be ceiled to metering windowSize (minute).'),
5364
- expiration: zod
5365
- .object({
5366
- count: zod.coerce
5367
- .number()
5368
- .min(1)
5369
- .max(createCustomerEntitlementGrantBodyExpirationCountMax)
5370
- .describe('The number of time units in the expiration period.'),
5371
- duration: zod
5372
- .enum(['HOUR', 'DAY', 'WEEK', 'MONTH', 'YEAR'])
5373
- .describe('The expiration duration enum')
5374
- .describe('The unit of time for the expiration period.'),
5375
- })
5376
- .describe('The grant expiration definition')
5377
- .describe('The grant expiration definition'),
5378
- maxRolloverAmount: zod.coerce
5145
+ .min(1)
5146
+ .default(listCustomerSubscriptionsQueryPageDefault)
5147
+ .describe('Page index.\n\nDefault is 1.'),
5148
+ pageSize: zod.coerce
5379
5149
  .number()
5150
+ .min(1)
5151
+ .max(listCustomerSubscriptionsQueryPageSizeMax)
5152
+ .default(listCustomerSubscriptionsQueryPageSizeDefault)
5153
+ .describe('The maximum number of items per page.\n\nDefault is 100.'),
5154
+ });
5155
+ /**
5156
+ * List all entitlements for all the subjects and features. This endpoint is intended for administrative purposes only.
5157
+ To fetch the entitlements of a specific subject please use the /api/v1/subjects/{subjectKeyOrID}/entitlements endpoint.
5158
+ If page is provided that takes precedence and the paginated response is returned.
5159
+ * @summary List all entitlements
5160
+ */
5161
+ export const listEntitlementsQueryExcludeInactiveDefault = false;
5162
+ export const listEntitlementsQueryPageDefault = 1;
5163
+ export const listEntitlementsQueryPageSizeDefault = 100;
5164
+ export const listEntitlementsQueryPageSizeMax = 1000;
5165
+ export const listEntitlementsQueryOffsetDefault = 0;
5166
+ export const listEntitlementsQueryOffsetMin = 0;
5167
+ export const listEntitlementsQueryLimitDefault = 100;
5168
+ export const listEntitlementsQueryLimitMax = 1000;
5169
+ export const listEntitlementsQueryParams = zod.object({
5170
+ entitlementType: zod
5171
+ .array(zod
5172
+ .enum(['metered', 'boolean', 'static'])
5173
+ .describe('Type of the entitlement.'))
5380
5174
  .optional()
5381
- .describe('Grants are rolled over at reset, after which they can have a different balance compared to what they had before the reset.\nBalance after the reset is calculated as: Balance_After_Reset = MIN(MaxRolloverAmount, MAX(Balance_Before_Reset, MinRolloverAmount))'),
5382
- metadata: zod
5383
- .record(zod.string(), zod.coerce.string())
5384
- .describe('Set of key-value pairs.\nMetadata can be used to store additional information about a resource.')
5175
+ .describe('Filtering by multiple entitlement types.\n\nUsage: `?entitlementType=metered&entitlementType=boolean`'),
5176
+ excludeInactive: zod.coerce
5177
+ .boolean()
5385
5178
  .optional()
5386
- .describe('The grant metadata.'),
5387
- minRolloverAmount: zod.coerce
5388
- .number()
5179
+ .describe('Exclude inactive entitlements in the response (those scheduled for later or earlier)'),
5180
+ feature: zod
5181
+ .array(zod.coerce.string())
5389
5182
  .optional()
5390
- .describe('Grants are rolled over at reset, after which they can have a different balance compared to what they had before the reset.\nBalance after the reset is calculated as: Balance_After_Reset = MIN(MaxRolloverAmount, MAX(Balance_Before_Reset, MinRolloverAmount))'),
5391
- priority: zod.coerce
5183
+ .describe('Filtering by multiple features.\n\nUsage: `?feature=feature-1&feature=feature-2`'),
5184
+ limit: zod.coerce
5392
5185
  .number()
5393
5186
  .min(1)
5394
- .max(createCustomerEntitlementGrantBodyPriorityMax)
5187
+ .max(listEntitlementsQueryLimitMax)
5188
+ .default(listEntitlementsQueryLimitDefault)
5189
+ .describe('Number of items to return.\n\nDefault is 100.'),
5190
+ offset: zod.coerce
5191
+ .number()
5192
+ .min(listEntitlementsQueryOffsetMin)
5395
5193
  .optional()
5396
- .describe('The priority of the grant. Grants with higher priority are applied first.\nPriority is a positive decimal numbers. With lower numbers indicating higher importance.\nFor example, a priority of 1 is more urgent than a priority of 2.\nWhen there are several grants available for the same subject, the system selects the grant with the highest priority.\nIn cases where grants share the same priority level, the grant closest to its expiration will be used first.\nIn the case of two grants have identical priorities and expiration dates, the system will use the grant that was created first.'),
5397
- recurrence: zod
5398
- .object({
5399
- anchor: zod.coerce
5400
- .date()
5401
- .optional()
5402
- .describe('A date-time anchor to base the recurring period on.'),
5403
- interval: zod
5404
- .union([
5405
- zod.coerce.string(),
5406
- zod
5407
- .enum(['DAY', 'WEEK', 'MONTH', 'YEAR'])
5408
- .describe('The unit of time for the interval.\nOne of: `day`, `week`, `month`, or `year`.'),
5409
- ])
5410
- .describe('Period duration for the recurrence')
5411
- .describe('The unit of time for the interval.'),
5412
- })
5413
- .describe('Recurring period with an interval and an anchor.')
5194
+ .describe('Number of items to skip.\n\nDefault is 0.'),
5195
+ order: zod.enum(['ASC', 'DESC']).optional().describe('The order direction.'),
5196
+ orderBy: zod
5197
+ .enum(['createdAt', 'updatedAt'])
5414
5198
  .optional()
5415
- .describe('The subject of the grant.'),
5416
- })
5417
- .describe('The grant creation input.');
5199
+ .describe('The order by field.'),
5200
+ page: zod.coerce
5201
+ .number()
5202
+ .min(1)
5203
+ .default(listEntitlementsQueryPageDefault)
5204
+ .describe('Page index.\n\nDefault is 1.'),
5205
+ pageSize: zod.coerce
5206
+ .number()
5207
+ .min(1)
5208
+ .max(listEntitlementsQueryPageSizeMax)
5209
+ .default(listEntitlementsQueryPageSizeDefault)
5210
+ .describe('The maximum number of items per page.\n\nDefault is 100.'),
5211
+ subject: zod
5212
+ .array(zod.coerce.string())
5213
+ .optional()
5214
+ .describe('Filtering by multiple subjects.\n\nUsage: `?subject=customer-1&subject=customer-2`'),
5215
+ });
5418
5216
  /**
5419
- * Returns historical balance and usage data for the entitlement. The queried history can span accross multiple reset events.
5420
-
5421
- BurndownHistory returns a continous history of segments, where the segments are seperated by events that changed either the grant burndown priority or the usage period.
5217
+ * Get entitlement by id.
5218
+ * @summary Get entitlement by id
5219
+ */
5220
+ export const getEntitlementByIdPathEntitlementIdRegExp = new RegExp('^[0-7][0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{25}$');
5221
+ export const getEntitlementByIdParams = zod.object({
5222
+ entitlementId: zod.coerce
5223
+ .string()
5224
+ .regex(getEntitlementByIdPathEntitlementIdRegExp),
5225
+ });
5226
+ /**
5227
+ * List ingested events within a time range.
5422
5228
 
5423
- WindowedHistory returns windowed usage data for the period enriched with balance information and the list of grants that were being burnt down in that window.
5424
- * @summary Get customer entitlement history
5229
+ If the from query param is not provided it defaults to last 72 hours.
5230
+ * @summary List ingested events
5425
5231
  */
5426
- export const getCustomerEntitlementHistoryPathFeatureKeyMax = 64;
5427
- export const getCustomerEntitlementHistoryPathFeatureKeyRegExp = new RegExp('^[a-z0-9]+(?:_[a-z0-9]+)*$');
5428
- export const getCustomerEntitlementHistoryParams = zod.object({
5429
- customerIdOrKey: zod.union([
5430
- zod.coerce
5431
- .string()
5432
- .regex(getCustomerEntitlementHistoryPathCustomerIdOrKeyRegExpOne)
5433
- .describe('ULID (Universally Unique Lexicographically Sortable Identifier).'),
5434
- zod.coerce
5435
- .string()
5436
- .min(1)
5437
- .max(getCustomerEntitlementHistoryPathCustomerIdOrKeyMaxTwo)
5438
- .describe('ExternalKey is a looser version of key.'),
5439
- ]),
5440
- featureKey: zod.coerce
5232
+ export const listEventsQueryClientIdMax = 36;
5233
+ export const listEventsQueryCustomerIdItemRegExp = new RegExp('^[0-7][0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{25}$');
5234
+ export const listEventsQueryLimitDefault = 100;
5235
+ export const listEventsQueryLimitMax = 100;
5236
+ export const listEventsQueryParams = zod.object({
5237
+ clientId: zod.coerce
5441
5238
  .string()
5442
5239
  .min(1)
5443
- .max(getCustomerEntitlementHistoryPathFeatureKeyMax)
5444
- .regex(getCustomerEntitlementHistoryPathFeatureKeyRegExp),
5445
- });
5446
- export const getCustomerEntitlementHistoryQueryWindowTimeZoneDefault = 'UTC';
5447
- export const getCustomerEntitlementHistoryQueryParams = zod.object({
5240
+ .max(listEventsQueryClientIdMax)
5241
+ .optional()
5242
+ .describe('Client ID\nUseful to track progress of a query.'),
5243
+ customerId: zod
5244
+ .array(zod.coerce
5245
+ .string()
5246
+ .regex(listEventsQueryCustomerIdItemRegExp)
5247
+ .describe('ULID (Universally Unique Lexicographically Sortable Identifier).'))
5248
+ .optional()
5249
+ .describe('The event customer ID.'),
5448
5250
  from: zod.coerce
5449
5251
  .date()
5450
5252
  .optional()
5451
- .describe('Start of time range to query entitlement: date-time in RFC 3339 format. Defaults to the last reset. Gets truncated to the granularity of the underlying meter.'),
5452
- to: zod.coerce
5253
+ .describe('Start date-time in RFC 3339 format.\n\nInclusive.'),
5254
+ id: zod.coerce
5255
+ .string()
5256
+ .optional()
5257
+ .describe('The event ID.\n\nAccepts partial ID.'),
5258
+ ingestedAtFrom: zod.coerce
5453
5259
  .date()
5454
5260
  .optional()
5455
- .describe('End of time range to query entitlement: date-time in RFC 3339 format. Defaults to now.\nIf not now then gets truncated to the granularity of the underlying meter.'),
5456
- windowSize: zod
5457
- .enum(['MINUTE', 'HOUR', 'DAY', 'MONTH'])
5458
- .describe('Windowsize'),
5459
- windowTimeZone: zod.coerce
5261
+ .describe('Start date-time in RFC 3339 format.\n\nInclusive.'),
5262
+ ingestedAtTo: zod.coerce
5263
+ .date()
5264
+ .optional()
5265
+ .describe('End date-time in RFC 3339 format.\n\nInclusive.'),
5266
+ limit: zod.coerce
5267
+ .number()
5268
+ .min(1)
5269
+ .max(listEventsQueryLimitMax)
5270
+ .default(listEventsQueryLimitDefault)
5271
+ .describe('Number of events to return.'),
5272
+ subject: zod.coerce
5460
5273
  .string()
5461
- .default(getCustomerEntitlementHistoryQueryWindowTimeZoneDefault)
5462
- .describe('The timezone used when calculating the windows.'),
5274
+ .optional()
5275
+ .describe('The event subject.\n\nAccepts partial subject.'),
5276
+ to: zod.coerce
5277
+ .date()
5278
+ .optional()
5279
+ .describe('End date-time in RFC 3339 format.\n\nInclusive.'),
5463
5280
  });
5464
5281
  /**
5465
- * Overriding an entitlement creates a new entitlement from the provided inputs and soft deletes the previous entitlement for the provided customer-feature pair. If the previous entitlement is already deleted or otherwise doesnt exist, the override will fail.
5466
-
5467
- This endpoint is useful for upgrades, downgrades, or other changes to entitlements that require a new entitlement to be created with zero downtime.
5468
- * @summary Override customer entitlement
5282
+ * Ingests an event or batch of events following the CloudEvents specification.
5283
+ * @summary Ingest events
5469
5284
  */
5470
- export const overrideCustomerEntitlementPathFeatureKeyMax = 64;
5471
- export const overrideCustomerEntitlementPathFeatureKeyRegExp = new RegExp('^[a-z0-9]+(?:_[a-z0-9]+)*$');
5472
- export const overrideCustomerEntitlementParams = zod.object({
5473
- customerIdOrKey: zod.union([
5474
- zod.coerce
5475
- .string()
5476
- .regex(overrideCustomerEntitlementPathCustomerIdOrKeyRegExpOne)
5477
- .describe('ULID (Universally Unique Lexicographically Sortable Identifier).'),
5478
- zod.coerce
5479
- .string()
5480
- .min(1)
5481
- .max(overrideCustomerEntitlementPathCustomerIdOrKeyMaxTwo)
5482
- .describe('ExternalKey is a looser version of key.'),
5483
- ]),
5484
- featureKey: zod.coerce
5485
- .string()
5486
- .min(1)
5487
- .max(overrideCustomerEntitlementPathFeatureKeyMax)
5488
- .regex(overrideCustomerEntitlementPathFeatureKeyRegExp),
5489
- });
5490
- export const overrideCustomerEntitlementBodyFeatureKeyMax = 64;
5491
- export const overrideCustomerEntitlementBodyFeatureKeyRegExp = new RegExp('^[a-z0-9]+(?:_[a-z0-9]+)*$');
5492
- export const overrideCustomerEntitlementBodyFeatureIdRegExp = new RegExp('^[0-7][0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{25}$');
5493
- export const overrideCustomerEntitlementBodyIsSoftLimitDefault = false;
5494
- export const overrideCustomerEntitlementBodyIsUnlimitedDefault = false;
5495
- export const overrideCustomerEntitlementBodyIssueAfterResetMin = 0;
5496
- export const overrideCustomerEntitlementBodyIssueAfterResetPriorityDefault = 1;
5497
- export const overrideCustomerEntitlementBodyIssueAfterResetPriorityMax = 255;
5498
- export const overrideCustomerEntitlementBodyPreserveOverageAtResetDefault = false;
5499
- export const overrideCustomerEntitlementBodyFeatureKeyMaxOne = 64;
5500
- export const overrideCustomerEntitlementBodyFeatureKeyRegExpOne = new RegExp('^[a-z0-9]+(?:_[a-z0-9]+)*$');
5501
- export const overrideCustomerEntitlementBodyFeatureIdRegExpOne = new RegExp('^[0-7][0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{25}$');
5502
- export const overrideCustomerEntitlementBodyFeatureKeyMaxTwo = 64;
5503
- export const overrideCustomerEntitlementBodyFeatureKeyRegExpTwo = new RegExp('^[a-z0-9]+(?:_[a-z0-9]+)*$');
5504
- export const overrideCustomerEntitlementBodyFeatureIdRegExpTwo = new RegExp('^[0-7][0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{25}$');
5505
- export const overrideCustomerEntitlementBody = zod
5285
+ export const ingestEventsBodySpecversionDefault = '1.0';
5286
+ export const ingestEventsBodyItemSpecversionDefault = '1.0';
5287
+ export const ingestEventsBody = zod
5506
5288
  .union([
5507
5289
  zod
5508
5290
  .object({
5509
- featureId: zod.coerce
5291
+ data: zod
5292
+ .record(zod.string(), zod.any())
5293
+ .nullish()
5294
+ .describe('The event payload.\nOptional, if present it must be a JSON object.'),
5295
+ datacontenttype: zod
5296
+ .enum(['application/json'])
5297
+ .nullish()
5298
+ .describe('Content type of the CloudEvents data value. Only the value \"application/json\" is allowed over HTTP.'),
5299
+ dataschema: zod.coerce
5510
5300
  .string()
5511
- .regex(overrideCustomerEntitlementBodyFeatureIdRegExp)
5512
- .optional()
5513
- .describe('The feature the subject is entitled to use.\nEither featureKey or featureId is required.'),
5514
- featureKey: zod.coerce
5301
+ .url()
5302
+ .min(1)
5303
+ .nullish()
5304
+ .describe('Identifies the schema that data adheres to.'),
5305
+ id: zod.coerce.string().min(1).describe('Identifies the event.'),
5306
+ source: zod.coerce
5515
5307
  .string()
5516
5308
  .min(1)
5517
- .max(overrideCustomerEntitlementBodyFeatureKeyMax)
5518
- .regex(overrideCustomerEntitlementBodyFeatureKeyRegExp)
5519
- .optional()
5520
- .describe('The feature the subject is entitled to use.\nEither featureKey or featureId is required.'),
5521
- isSoftLimit: zod.coerce
5522
- .boolean()
5523
- .optional()
5524
- .describe('If softLimit=true the subject can use the feature even if the entitlement is exhausted, hasAccess will always be true.'),
5525
- issueAfterReset: zod.coerce
5526
- .number()
5527
- .min(overrideCustomerEntitlementBodyIssueAfterResetMin)
5528
- .optional()
5529
- .describe('You can grant usage automatically alongside the entitlement, the example scenario would be creating a starting balance.\nIf an amount is specified here, a grant will be created alongside the entitlement with the specified amount.\nThat grant will have it\'s rollover settings configured in a way that after each reset operation, the balance will return the original amount specified here.\nManually creating such a grant would mean having the \"amount\", \"minRolloverAmount\", and \"maxRolloverAmount\" fields all be the same.'),
5530
- issueAfterResetPriority: zod.coerce
5531
- .number()
5309
+ .describe('Identifies the context in which an event happened.'),
5310
+ specversion: zod.coerce
5311
+ .string()
5532
5312
  .min(1)
5533
- .max(overrideCustomerEntitlementBodyIssueAfterResetPriorityMax)
5534
- .default(overrideCustomerEntitlementBodyIssueAfterResetPriorityDefault)
5535
- .describe('Defines the grant priority for the default grant.'),
5536
- isUnlimited: zod.coerce
5537
- .boolean()
5538
- .optional()
5539
- .describe('Deprecated, ignored by the backend. Please use isSoftLimit instead; this field will be removed in the future.'),
5540
- measureUsageFrom: zod
5541
- .union([
5542
- zod
5543
- .enum(['CURRENT_PERIOD_START', 'NOW'])
5544
- .describe('Start of measurement options'),
5545
- zod.coerce
5546
- .date()
5547
- .describe('[RFC3339](https://tools.ietf.org/html/rfc3339) formatted date-time string in UTC.'),
5548
- ])
5549
- .describe('Measure usage from')
5550
- .optional()
5551
- .describe('Defines the time from which usage is measured. If not specified on creation, defaults to entitlement creation time.'),
5552
- metadata: zod
5553
- .record(zod.string(), zod.coerce.string())
5554
- .describe('Set of key-value pairs.\nMetadata can be used to store additional information about a resource.')
5555
- .optional()
5556
- .describe('Additional metadata for the feature.'),
5557
- preserveOverageAtReset: zod.coerce
5558
- .boolean()
5559
- .optional()
5560
- .describe('If true, the overage is preserved at reset. If false, the usage is reset to 0.'),
5561
- type: zod.enum(['metered']),
5562
- usagePeriod: zod
5563
- .object({
5564
- anchor: zod.coerce
5565
- .date()
5566
- .optional()
5567
- .describe('A date-time anchor to base the recurring period on.'),
5568
- interval: zod
5569
- .union([
5570
- zod.coerce.string(),
5571
- zod
5572
- .enum(['DAY', 'WEEK', 'MONTH', 'YEAR'])
5573
- .describe('The unit of time for the interval.\nOne of: `day`, `week`, `month`, or `year`.'),
5574
- ])
5575
- .describe('Period duration for the recurrence')
5576
- .describe('The unit of time for the interval.'),
5577
- })
5578
- .describe('Recurring period with an interval and an anchor.')
5579
- .describe('The usage period associated with the entitlement.'),
5313
+ .describe('The version of the CloudEvents specification which the event uses.'),
5314
+ subject: zod.coerce
5315
+ .string()
5316
+ .min(1)
5317
+ .describe('Describes the subject of the event in the context of the event producer (identified by source).'),
5318
+ time: zod.coerce
5319
+ .date()
5320
+ .nullish()
5321
+ .describe('Timestamp of when the occurrence happened. Must adhere to RFC 3339.'),
5322
+ type: zod.coerce
5323
+ .string()
5324
+ .min(1)
5325
+ .describe('Contains a value describing the type of event related to the originating occurrence.'),
5580
5326
  })
5581
- .describe('Create inpurs for metered entitlement'),
5582
- zod
5327
+ .describe('CloudEvents Specification JSON Schema\n\nOptional properties are nullable according to the CloudEvents specification:\nOPTIONAL not omitted attributes MAY be represented as a null JSON value.'),
5328
+ zod.array(zod
5583
5329
  .object({
5584
- config: zod.coerce
5330
+ data: zod
5331
+ .record(zod.string(), zod.any())
5332
+ .nullish()
5333
+ .describe('The event payload.\nOptional, if present it must be a JSON object.'),
5334
+ datacontenttype: zod
5335
+ .enum(['application/json'])
5336
+ .nullish()
5337
+ .describe('Content type of the CloudEvents data value. Only the value \"application/json\" is allowed over HTTP.'),
5338
+ dataschema: zod.coerce
5585
5339
  .string()
5586
- .describe('The JSON parsable config of the entitlement. This value is also returned when checking entitlement access and it is useful for configuring fine-grained access settings to the feature, implemented in your own system. Has to be an object.'),
5587
- featureId: zod.coerce
5340
+ .url()
5341
+ .min(1)
5342
+ .nullish()
5343
+ .describe('Identifies the schema that data adheres to.'),
5344
+ id: zod.coerce.string().min(1).describe('Identifies the event.'),
5345
+ source: zod.coerce
5588
5346
  .string()
5589
- .regex(overrideCustomerEntitlementBodyFeatureIdRegExpOne)
5590
- .optional()
5591
- .describe('The feature the subject is entitled to use.\nEither featureKey or featureId is required.'),
5592
- featureKey: zod.coerce
5347
+ .min(1)
5348
+ .describe('Identifies the context in which an event happened.'),
5349
+ specversion: zod.coerce
5593
5350
  .string()
5594
5351
  .min(1)
5595
- .max(overrideCustomerEntitlementBodyFeatureKeyMaxOne)
5596
- .regex(overrideCustomerEntitlementBodyFeatureKeyRegExpOne)
5597
- .optional()
5598
- .describe('The feature the subject is entitled to use.\nEither featureKey or featureId is required.'),
5599
- metadata: zod
5600
- .record(zod.string(), zod.coerce.string())
5601
- .describe('Set of key-value pairs.\nMetadata can be used to store additional information about a resource.')
5602
- .optional()
5603
- .describe('Additional metadata for the feature.'),
5604
- type: zod.enum(['static']),
5605
- usagePeriod: zod
5606
- .object({
5607
- anchor: zod.coerce
5608
- .date()
5609
- .optional()
5610
- .describe('A date-time anchor to base the recurring period on.'),
5611
- interval: zod
5612
- .union([
5613
- zod.coerce.string(),
5614
- zod
5615
- .enum(['DAY', 'WEEK', 'MONTH', 'YEAR'])
5616
- .describe('The unit of time for the interval.\nOne of: `day`, `week`, `month`, or `year`.'),
5617
- ])
5618
- .describe('Period duration for the recurrence')
5619
- .describe('The unit of time for the interval.'),
5620
- })
5621
- .describe('Recurring period with an interval and an anchor.')
5622
- .optional()
5623
- .describe('The usage period associated with the entitlement.'),
5624
- })
5625
- .describe('Create inputs for static entitlement'),
5626
- zod
5627
- .object({
5628
- featureId: zod.coerce
5352
+ .describe('The version of the CloudEvents specification which the event uses.'),
5353
+ subject: zod.coerce
5629
5354
  .string()
5630
- .regex(overrideCustomerEntitlementBodyFeatureIdRegExpTwo)
5631
- .optional()
5632
- .describe('The feature the subject is entitled to use.\nEither featureKey or featureId is required.'),
5633
- featureKey: zod.coerce
5355
+ .min(1)
5356
+ .describe('Describes the subject of the event in the context of the event producer (identified by source).'),
5357
+ time: zod.coerce
5358
+ .date()
5359
+ .nullish()
5360
+ .describe('Timestamp of when the occurrence happened. Must adhere to RFC 3339.'),
5361
+ type: zod.coerce
5634
5362
  .string()
5635
5363
  .min(1)
5636
- .max(overrideCustomerEntitlementBodyFeatureKeyMaxTwo)
5637
- .regex(overrideCustomerEntitlementBodyFeatureKeyRegExpTwo)
5638
- .optional()
5639
- .describe('The feature the subject is entitled to use.\nEither featureKey or featureId is required.'),
5640
- metadata: zod
5641
- .record(zod.string(), zod.coerce.string())
5642
- .describe('Set of key-value pairs.\nMetadata can be used to store additional information about a resource.')
5643
- .optional()
5644
- .describe('Additional metadata for the feature.'),
5645
- type: zod.enum(['boolean']),
5646
- usagePeriod: zod
5647
- .object({
5648
- anchor: zod.coerce
5649
- .date()
5650
- .optional()
5651
- .describe('A date-time anchor to base the recurring period on.'),
5652
- interval: zod
5653
- .union([
5654
- zod.coerce.string(),
5655
- zod
5656
- .enum(['DAY', 'WEEK', 'MONTH', 'YEAR'])
5657
- .describe('The unit of time for the interval.\nOne of: `day`, `week`, `month`, or `year`.'),
5658
- ])
5659
- .describe('Period duration for the recurrence')
5660
- .describe('The unit of time for the interval.'),
5661
- })
5662
- .describe('Recurring period with an interval and an anchor.')
5663
- .optional()
5664
- .describe('The usage period associated with the entitlement.'),
5364
+ .describe('Contains a value describing the type of event related to the originating occurrence.'),
5665
5365
  })
5666
- .describe('Create inputs for boolean entitlement'),
5366
+ .describe('CloudEvents Specification JSON Schema\n\nOptional properties are nullable according to the CloudEvents specification:\nOPTIONAL not omitted attributes MAY be represented as a null JSON value.')),
5667
5367
  ])
5668
- .describe('Create inputs for entitlement');
5368
+ .describe('The body of the events request.\nEither a single event or a batch of events.');
5669
5369
  /**
5670
- * Reset marks the start of a new usage period for the entitlement and initiates grant rollover. At the start of a period usage is zerod out and grants are rolled over based on their rollover settings. It would typically be synced with the customers billing period to enforce usage based on their subscription.
5671
-
5672
- Usage is automatically reset for metered entitlements based on their usage period, but this endpoint allows to manually reset it at any time. When doing so the period anchor of the entitlement can be changed if needed.
5673
- * @summary Reset customer entitlement
5370
+ * List features.
5371
+ * @summary List features
5674
5372
  */
5675
- export const resetCustomerEntitlementUsagePathFeatureKeyMax = 64;
5676
- export const resetCustomerEntitlementUsagePathFeatureKeyRegExp = new RegExp('^[a-z0-9]+(?:_[a-z0-9]+)*$');
5677
- export const resetCustomerEntitlementUsageParams = zod.object({
5678
- customerIdOrKey: zod.union([
5679
- zod.coerce
5680
- .string()
5681
- .regex(resetCustomerEntitlementUsagePathCustomerIdOrKeyRegExpOne)
5682
- .describe('ULID (Universally Unique Lexicographically Sortable Identifier).'),
5683
- zod.coerce
5684
- .string()
5685
- .min(1)
5686
- .max(resetCustomerEntitlementUsagePathCustomerIdOrKeyMaxTwo)
5687
- .describe('ExternalKey is a looser version of key.'),
5688
- ]),
5689
- featureKey: zod.coerce
5690
- .string()
5373
+ export const listFeaturesQueryIncludeArchivedDefault = false;
5374
+ export const listFeaturesQueryPageDefault = 1;
5375
+ export const listFeaturesQueryPageSizeDefault = 100;
5376
+ export const listFeaturesQueryPageSizeMax = 1000;
5377
+ export const listFeaturesQueryOffsetDefault = 0;
5378
+ export const listFeaturesQueryOffsetMin = 0;
5379
+ export const listFeaturesQueryLimitDefault = 100;
5380
+ export const listFeaturesQueryLimitMax = 1000;
5381
+ export const listFeaturesQueryParams = zod.object({
5382
+ includeArchived: zod.coerce
5383
+ .boolean()
5384
+ .optional()
5385
+ .describe('Filter by meterGroupByFilters'),
5386
+ limit: zod.coerce
5387
+ .number()
5691
5388
  .min(1)
5692
- .max(resetCustomerEntitlementUsagePathFeatureKeyMax)
5693
- .regex(resetCustomerEntitlementUsagePathFeatureKeyRegExp),
5694
- });
5695
- export const resetCustomerEntitlementUsageBody = zod
5696
- .object({
5697
- effectiveAt: zod.coerce
5698
- .date()
5389
+ .max(listFeaturesQueryLimitMax)
5390
+ .default(listFeaturesQueryLimitDefault)
5391
+ .describe('Number of items to return.\n\nDefault is 100.'),
5392
+ meterSlug: zod
5393
+ .array(zod.coerce.string())
5699
5394
  .optional()
5700
- .describe('The time at which the reset takes effect, defaults to now. The reset cannot be in the future. The provided value is truncated to the minute due to how historical meter data is stored.'),
5701
- preserveOverage: zod.coerce
5702
- .boolean()
5395
+ .describe('Filter by meterSlug'),
5396
+ offset: zod.coerce
5397
+ .number()
5398
+ .min(listFeaturesQueryOffsetMin)
5703
5399
  .optional()
5704
- .describe("Determines whether the overage is preserved or forgiven, overriding the entitlement's default behavior.\n- If true, the overage is preserved.\n- If false, the overage is forgiven."),
5705
- retainAnchor: zod.coerce
5706
- .boolean()
5400
+ .describe('Number of items to skip.\n\nDefault is 0.'),
5401
+ order: zod.enum(['ASC', 'DESC']).optional().describe('The order direction.'),
5402
+ orderBy: zod
5403
+ .enum(['id', 'key', 'name', 'createdAt', 'updatedAt'])
5707
5404
  .optional()
5708
- .describe('Determines whether the usage period anchor is retained or reset to the effectiveAt time.\n- If true, the usage period anchor is retained.\n- If false, the usage period anchor is reset to the effectiveAt time.'),
5709
- })
5710
- .describe('Reset parameters');
5405
+ .describe('The order by field.'),
5406
+ page: zod.coerce
5407
+ .number()
5408
+ .min(1)
5409
+ .default(listFeaturesQueryPageDefault)
5410
+ .describe('Page index.\n\nDefault is 1.'),
5411
+ pageSize: zod.coerce
5412
+ .number()
5413
+ .min(1)
5414
+ .max(listFeaturesQueryPageSizeMax)
5415
+ .default(listFeaturesQueryPageSizeDefault)
5416
+ .describe('The maximum number of items per page.\n\nDefault is 100.'),
5417
+ });
5711
5418
  /**
5712
- * Checks customer access to a given feature (by key). All entitlement types share the hasAccess property in their value response, but multiple other properties are returned based on the entitlement type.
5713
- * @summary Get customer entitlement value
5419
+ * Features are either metered or static. A feature is metered if meterSlug is provided at creation.
5420
+ For metered features you can pass additional filters that will be applied when calculating feature usage, based on the meter's groupBy fields.
5421
+ Only meters with SUM and COUNT aggregation are supported for features.
5422
+ Features cannot be updated later, only archived.
5423
+ * @summary Create feature
5714
5424
  */
5715
- export const getCustomerEntitlementValuePathFeatureKeyMax = 64;
5716
- export const getCustomerEntitlementValuePathFeatureKeyRegExp = new RegExp('^[a-z0-9]+(?:_[a-z0-9]+)*$');
5717
- export const getCustomerEntitlementValueParams = zod.object({
5718
- customerIdOrKey: zod.union([
5719
- zod.coerce
5720
- .string()
5721
- .regex(getCustomerEntitlementValuePathCustomerIdOrKeyRegExpOne)
5722
- .describe('ULID (Universally Unique Lexicographically Sortable Identifier).'),
5723
- zod.coerce
5724
- .string()
5725
- .min(1)
5726
- .max(getCustomerEntitlementValuePathCustomerIdOrKeyMaxTwo)
5727
- .describe('ExternalKey is a looser version of key.'),
5728
- ]),
5729
- featureKey: zod.coerce
5425
+ export const createFeatureBodyKeyMax = 64;
5426
+ export const createFeatureBodyKeyRegExp = new RegExp('^[a-z0-9]+(?:_[a-z0-9]+)*$');
5427
+ export const createFeatureBodyMeterSlugMax = 64;
5428
+ export const createFeatureBodyMeterSlugRegExp = new RegExp('^[a-z0-9]+(?:_[a-z0-9]+)*$');
5429
+ export const createFeatureBody = zod
5430
+ .object({
5431
+ key: zod.coerce
5730
5432
  .string()
5731
5433
  .min(1)
5732
- .max(getCustomerEntitlementValuePathFeatureKeyMax)
5733
- .regex(getCustomerEntitlementValuePathFeatureKeyRegExp),
5734
- });
5735
- export const getCustomerEntitlementValueQueryParams = zod.object({
5736
- time: zod.coerce.date().optional(),
5737
- });
5738
- /**
5739
- * Get stripe app data for a customer.
5740
- Only returns data if the customer billing profile is linked to a stripe app.
5741
- * @summary Get customer stripe app data
5742
- */
5743
- export const getCustomerStripeAppDataParams = zod.object({
5744
- customerIdOrKey: zod.union([
5745
- zod.coerce
5746
- .string()
5747
- .regex(getCustomerStripeAppDataPathCustomerIdOrKeyRegExpOne)
5748
- .describe('ULID (Universally Unique Lexicographically Sortable Identifier).'),
5749
- zod.coerce
5750
- .string()
5751
- .min(1)
5752
- .max(getCustomerStripeAppDataPathCustomerIdOrKeyMaxTwo)
5753
- .describe('ExternalKey is a looser version of key.'),
5754
- ]),
5755
- });
5756
- /**
5757
- * Upsert stripe app data for a customer.
5758
- Only updates data if the customer billing profile is linked to a stripe app.
5759
- * @summary Upsert customer stripe app data
5760
- */
5761
- export const upsertCustomerStripeAppDataParams = zod.object({
5762
- customerIdOrKey: zod.union([
5763
- zod.coerce
5764
- .string()
5765
- .regex(upsertCustomerStripeAppDataPathCustomerIdOrKeyRegExpOne)
5766
- .describe('ULID (Universally Unique Lexicographically Sortable Identifier).'),
5767
- zod.coerce
5768
- .string()
5769
- .min(1)
5770
- .max(upsertCustomerStripeAppDataPathCustomerIdOrKeyMaxTwo)
5771
- .describe('ExternalKey is a looser version of key.'),
5772
- ]),
5773
- });
5774
- export const upsertCustomerStripeAppDataBody = zod
5775
- .object({
5776
- stripeCustomerId: zod.coerce.string().describe('The Stripe customer ID.'),
5777
- stripeDefaultPaymentMethodId: zod.coerce
5434
+ .max(createFeatureBodyKeyMax)
5435
+ .regex(createFeatureBodyKeyRegExp)
5436
+ .describe('A key is a unique string that is used to identify a resource.'),
5437
+ metadata: zod
5438
+ .record(zod.string(), zod.coerce.string())
5439
+ .describe('Set of key-value pairs.\nMetadata can be used to store additional information about a resource.')
5440
+ .optional(),
5441
+ meterGroupByFilters: zod
5442
+ .record(zod.string(), zod.coerce.string())
5443
+ .optional()
5444
+ .describe('Optional meter group by filters.\nUseful if the meter scope is broader than what feature tracks.\nExample scenario would be a meter tracking all token use with groupBy fields for the model,\nthen the feature could filter for model=gpt-4.'),
5445
+ meterSlug: zod.coerce
5778
5446
  .string()
5447
+ .min(1)
5448
+ .max(createFeatureBodyMeterSlugMax)
5449
+ .regex(createFeatureBodyMeterSlugRegExp)
5779
5450
  .optional()
5780
- .describe('The Stripe default payment method ID.'),
5451
+ .describe('A key is a unique string that is used to identify a resource.'),
5452
+ name: zod.coerce.string(),
5781
5453
  })
5782
- .describe('Stripe Customer App Data Base.');
5454
+ .describe('Represents a feature that can be enabled or disabled for a plan.\nUsed both for product catalog and entitlements.');
5783
5455
  /**
5784
- * Create Stripe customer portal session.
5785
- Only returns URL if the customer billing profile is linked to a stripe app and customer.
5786
-
5787
- Useful to redirect the customer to the Stripe customer portal to manage their payment methods,
5788
- change their billing address and access their invoice history.
5789
- * @summary Create Stripe customer portal session
5456
+ * Get a feature by ID.
5457
+ * @summary Get feature
5790
5458
  */
5791
- export const createCustomerStripePortalSessionParams = zod.object({
5792
- customerIdOrKey: zod.union([
5793
- zod.coerce
5794
- .string()
5795
- .regex(createCustomerStripePortalSessionPathCustomerIdOrKeyRegExpOne)
5796
- .describe('ULID (Universally Unique Lexicographically Sortable Identifier).'),
5797
- zod.coerce
5798
- .string()
5799
- .min(1)
5800
- .max(createCustomerStripePortalSessionPathCustomerIdOrKeyMaxTwo)
5801
- .describe('ExternalKey is a looser version of key.'),
5802
- ]),
5459
+ export const getFeatureParams = zod.object({
5460
+ featureId: zod.coerce.string(),
5803
5461
  });
5804
- export const createCustomerStripePortalSessionBody = zod
5805
- .object({
5806
- configurationId: zod.coerce
5807
- .string()
5808
- .optional()
5809
- .describe('The ID of an existing configuration to use for this session,\ndescribing its functionality and features.\nIf not specified, the session uses the default configuration.\n\nSee https://docs.stripe.com/api/customer_portal/sessions/create#create_portal_session-configuration'),
5810
- locale: zod.coerce
5811
- .string()
5812
- .optional()
5813
- .describe('The IETF language tag of the locale customer portal is displayed in.\nIf blank or auto, the customer’s preferred_locales or browser’s locale is used.\n\nSee: https://docs.stripe.com/api/customer_portal/sessions/create#create_portal_session-locale'),
5814
- returnUrl: zod.coerce
5815
- .string()
5816
- .optional()
5817
- .describe('The URL to redirect the customer to after they have completed\ntheir requested actions.\n\nSee: https://docs.stripe.com/api/customer_portal/sessions/create#create_portal_session-return_url'),
5818
- })
5819
- .describe('Stripe customer portal request params.');
5820
5462
  /**
5821
- * Lists all subscriptions for a customer.
5822
- * @summary List customer subscriptions
5463
+ * Archive a feature by ID.
5464
+
5465
+ Once a feature is archived it cannot be unarchived. If a feature is archived, new entitlements cannot be created for it, but archiving the feature does not affect existing entitlements.
5466
+ This means, if you want to create a new feature with the same key, and then create entitlements for it, the previous entitlements have to be deleted first on a per subject basis.
5467
+ * @summary Delete feature
5823
5468
  */
5824
- export const listCustomerSubscriptionsParams = zod.object({
5825
- customerIdOrKey: zod.union([
5826
- zod.coerce
5827
- .string()
5828
- .regex(listCustomerSubscriptionsPathCustomerIdOrKeyRegExpOne)
5829
- .describe('ULID (Universally Unique Lexicographically Sortable Identifier).'),
5830
- zod.coerce
5831
- .string()
5832
- .min(1)
5833
- .max(listCustomerSubscriptionsPathCustomerIdOrKeyMaxTwo)
5834
- .describe('ExternalKey is a looser version of key.'),
5835
- ]),
5836
- });
5837
- export const listCustomerSubscriptionsQueryPageDefault = 1;
5838
- export const listCustomerSubscriptionsQueryPageSizeDefault = 100;
5839
- export const listCustomerSubscriptionsQueryPageSizeMax = 1000;
5840
- export const listCustomerSubscriptionsQueryParams = zod.object({
5841
- page: zod.coerce
5842
- .number()
5843
- .min(1)
5844
- .default(listCustomerSubscriptionsQueryPageDefault)
5845
- .describe('Page index.\n\nDefault is 1.'),
5846
- pageSize: zod.coerce
5847
- .number()
5848
- .min(1)
5849
- .max(listCustomerSubscriptionsQueryPageSizeMax)
5850
- .default(listCustomerSubscriptionsQueryPageSizeDefault)
5851
- .describe('The maximum number of items per page.\n\nDefault is 100.'),
5469
+ export const deleteFeatureParams = zod.object({
5470
+ featureId: zod.coerce.string(),
5852
5471
  });
5853
5472
  /**
5854
- * List all entitlements for all the subjects and features. This endpoint is intended for administrative purposes only.
5855
- To fetch the entitlements of a specific subject please use the /api/v1/subjects/{subjectKeyOrID}/entitlements endpoint.
5473
+ * List all grants for all the subjects and entitlements. This endpoint is intended for administrative purposes only.
5474
+ To fetch the grants of a specific entitlement please use the /api/v1/subjects/{subjectKeyOrID}/entitlements/{entitlementOrFeatureID}/grants endpoint.
5856
5475
  If page is provided that takes precedence and the paginated response is returned.
5857
- * @summary List all entitlements
5476
+ * @summary List grants
5858
5477
  */
5859
- export const listEntitlementsQueryExcludeInactiveDefault = false;
5860
- export const listEntitlementsQueryPageDefault = 1;
5861
- export const listEntitlementsQueryPageSizeDefault = 100;
5862
- export const listEntitlementsQueryPageSizeMax = 1000;
5863
- export const listEntitlementsQueryOffsetDefault = 0;
5864
- export const listEntitlementsQueryOffsetMin = 0;
5865
- export const listEntitlementsQueryLimitDefault = 100;
5866
- export const listEntitlementsQueryLimitMax = 1000;
5867
- export const listEntitlementsQueryParams = zod.object({
5868
- entitlementType: zod
5869
- .array(zod
5870
- .enum(['metered', 'boolean', 'static'])
5871
- .describe('Type of the entitlement.'))
5872
- .optional()
5873
- .describe('Filtering by multiple entitlement types.\n\nUsage: `?entitlementType=metered&entitlementType=boolean`'),
5874
- excludeInactive: zod.coerce
5875
- .boolean()
5876
- .optional()
5877
- .describe('Exclude inactive entitlements in the response (those scheduled for later or earlier)'),
5478
+ export const listGrantsQueryIncludeDeletedDefault = false;
5479
+ export const listGrantsQueryPageDefault = 1;
5480
+ export const listGrantsQueryPageSizeDefault = 100;
5481
+ export const listGrantsQueryPageSizeMax = 1000;
5482
+ export const listGrantsQueryOffsetDefault = 0;
5483
+ export const listGrantsQueryOffsetMin = 0;
5484
+ export const listGrantsQueryLimitDefault = 100;
5485
+ export const listGrantsQueryLimitMax = 1000;
5486
+ export const listGrantsQueryParams = zod.object({
5878
5487
  feature: zod
5879
5488
  .array(zod.coerce.string())
5880
5489
  .optional()
5881
5490
  .describe('Filtering by multiple features.\n\nUsage: `?feature=feature-1&feature=feature-2`'),
5491
+ includeDeleted: zod.coerce.boolean().optional().describe('Include deleted'),
5882
5492
  limit: zod.coerce
5883
5493
  .number()
5884
5494
  .min(1)
5885
- .max(listEntitlementsQueryLimitMax)
5886
- .default(listEntitlementsQueryLimitDefault)
5495
+ .max(listGrantsQueryLimitMax)
5496
+ .default(listGrantsQueryLimitDefault)
5887
5497
  .describe('Number of items to return.\n\nDefault is 100.'),
5888
5498
  offset: zod.coerce
5889
5499
  .number()
5890
- .min(listEntitlementsQueryOffsetMin)
5500
+ .min(listGrantsQueryOffsetMin)
5891
5501
  .optional()
5892
5502
  .describe('Number of items to skip.\n\nDefault is 0.'),
5893
5503
  order: zod.enum(['ASC', 'DESC']).optional().describe('The order direction.'),
5894
5504
  orderBy: zod
5895
- .enum(['createdAt', 'updatedAt'])
5505
+ .enum(['id', 'createdAt', 'updatedAt'])
5896
5506
  .optional()
5897
5507
  .describe('The order by field.'),
5898
5508
  page: zod.coerce
5899
5509
  .number()
5900
5510
  .min(1)
5901
- .default(listEntitlementsQueryPageDefault)
5511
+ .default(listGrantsQueryPageDefault)
5902
5512
  .describe('Page index.\n\nDefault is 1.'),
5903
5513
  pageSize: zod.coerce
5904
5514
  .number()
5905
5515
  .min(1)
5906
- .max(listEntitlementsQueryPageSizeMax)
5907
- .default(listEntitlementsQueryPageSizeDefault)
5516
+ .max(listGrantsQueryPageSizeMax)
5517
+ .default(listGrantsQueryPageSizeDefault)
5908
5518
  .describe('The maximum number of items per page.\n\nDefault is 100.'),
5909
5519
  subject: zod
5910
5520
  .array(zod.coerce.string())
@@ -5912,619 +5522,311 @@ export const listEntitlementsQueryParams = zod.object({
5912
5522
  .describe('Filtering by multiple subjects.\n\nUsage: `?subject=customer-1&subject=customer-2`'),
5913
5523
  });
5914
5524
  /**
5915
- * Get entitlement by id.
5916
- * @summary Get entitlement by id
5525
+ * Voiding a grant means it is no longer valid, it doesn't take part in further balance calculations. Voiding a grant does not retroactively take effect, meaning any usage that has already been attributed to the grant will remain, but future usage cannot be burnt down from the grant.
5526
+ For example, if you have a single grant for your metered entitlement with an initial amount of 100, and so far 60 usage has been metered, the grant (and the entitlement itself) would have a balance of 40. If you then void that grant, balance becomes 0, but the 60 previous usage will not be affected.
5527
+ * @summary Void grant
5917
5528
  */
5918
- export const getEntitlementByIdPathEntitlementIdRegExp = new RegExp('^[0-7][0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{25}$');
5919
- export const getEntitlementByIdParams = zod.object({
5920
- entitlementId: zod.coerce
5921
- .string()
5922
- .regex(getEntitlementByIdPathEntitlementIdRegExp),
5529
+ export const voidGrantParams = zod.object({
5530
+ grantId: zod.coerce.string(),
5923
5531
  });
5924
5532
  /**
5925
- * List ingested events within a time range.
5926
-
5927
- If the from query param is not provided it defaults to last 72 hours.
5928
- * @summary List ingested events
5533
+ * Get progress
5534
+ * @summary Get progress
5929
5535
  */
5930
- export const listEventsQueryClientIdMax = 36;
5931
- export const listEventsQueryCustomerIdItemRegExp = new RegExp('^[0-7][0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{25}$');
5932
- export const listEventsQueryLimitDefault = 100;
5933
- export const listEventsQueryLimitMax = 100;
5934
- export const listEventsQueryParams = zod.object({
5935
- clientId: zod.coerce
5936
- .string()
5536
+ export const getProgressParams = zod.object({
5537
+ id: zod.coerce.string(),
5538
+ });
5539
+ /**
5540
+ * List available apps of the app marketplace.
5541
+ * @summary List available apps
5542
+ */
5543
+ export const listMarketplaceListingsQueryPageDefault = 1;
5544
+ export const listMarketplaceListingsQueryPageSizeDefault = 100;
5545
+ export const listMarketplaceListingsQueryPageSizeMax = 1000;
5546
+ export const listMarketplaceListingsQueryParams = zod.object({
5547
+ page: zod.coerce
5548
+ .number()
5937
5549
  .min(1)
5938
- .max(listEventsQueryClientIdMax)
5939
- .optional()
5940
- .describe('Client ID\nUseful to track progress of a query.'),
5941
- customerId: zod
5942
- .array(zod.coerce
5943
- .string()
5944
- .regex(listEventsQueryCustomerIdItemRegExp)
5945
- .describe('ULID (Universally Unique Lexicographically Sortable Identifier).'))
5550
+ .default(listMarketplaceListingsQueryPageDefault)
5551
+ .describe('Page index.\n\nDefault is 1.'),
5552
+ pageSize: zod.coerce
5553
+ .number()
5554
+ .min(1)
5555
+ .max(listMarketplaceListingsQueryPageSizeMax)
5556
+ .default(listMarketplaceListingsQueryPageSizeDefault)
5557
+ .describe('The maximum number of items per page.\n\nDefault is 100.'),
5558
+ });
5559
+ /**
5560
+ * Get a marketplace listing by type.
5561
+ * @summary Get app details by type
5562
+ */
5563
+ export const getMarketplaceListingParams = zod.object({
5564
+ type: zod.enum(['stripe', 'sandbox', 'custom_invoicing']),
5565
+ });
5566
+ /**
5567
+ * Install an app from the marketplace.
5568
+ * @summary Install app
5569
+ */
5570
+ export const marketplaceAppInstallParams = zod.object({
5571
+ type: zod
5572
+ .enum(['stripe', 'sandbox', 'custom_invoicing'])
5573
+ .describe('The type of the app to install.'),
5574
+ });
5575
+ export const marketplaceAppInstallBodyCreateBillingProfileDefault = true;
5576
+ export const marketplaceAppInstallBody = zod
5577
+ .object({
5578
+ createBillingProfile: zod.coerce
5579
+ .boolean()
5580
+ .default(marketplaceAppInstallBodyCreateBillingProfileDefault)
5581
+ .describe('If true, a billing profile will be created for the app.\nThe Stripe app will be also set as the default billing profile if the current default is a Sandbox app.'),
5582
+ name: zod.coerce
5583
+ .string()
5946
5584
  .optional()
5947
- .describe('The event customer ID.'),
5948
- from: zod.coerce
5949
- .date()
5585
+ .describe("Name of the application to install.\n\nIf name is not provided defaults to the marketplace listing's name."),
5586
+ })
5587
+ .describe('Marketplace install request payload.');
5588
+ /**
5589
+ * Install an marketplace app via API Key.
5590
+ * @summary Install app via API key
5591
+ */
5592
+ export const marketplaceAppAPIKeyInstallParams = zod.object({
5593
+ type: zod
5594
+ .enum(['stripe', 'sandbox', 'custom_invoicing'])
5595
+ .describe('The type of the app to install.'),
5596
+ });
5597
+ export const marketplaceAppAPIKeyInstallBodyCreateBillingProfileDefault = true;
5598
+ export const marketplaceAppAPIKeyInstallBody = zod.object({
5599
+ apiKey: zod.coerce
5600
+ .string()
5601
+ .describe('The API key for the provider.\nFor example, the Stripe API key.'),
5602
+ createBillingProfile: zod.coerce
5603
+ .boolean()
5604
+ .default(marketplaceAppAPIKeyInstallBodyCreateBillingProfileDefault)
5605
+ .describe('If true, a billing profile will be created for the app.\nThe Stripe app will be also set as the default billing profile if the current default is a Sandbox app.'),
5606
+ name: zod.coerce
5607
+ .string()
5950
5608
  .optional()
5951
- .describe('Start date-time in RFC 3339 format.\n\nInclusive.'),
5952
- id: zod.coerce
5609
+ .describe("Name of the application to install.\n\nIf name is not provided defaults to the marketplace listing's name."),
5610
+ });
5611
+ /**
5612
+ * Install an app via OAuth.
5613
+ Returns a URL to start the OAuth 2.0 flow.
5614
+ * @summary Get OAuth2 install URL
5615
+ */
5616
+ export const marketplaceOAuth2InstallGetURLParams = zod.object({
5617
+ type: zod.enum(['stripe', 'sandbox', 'custom_invoicing']),
5618
+ });
5619
+ /**
5620
+ * Authorize OAuth2 code.
5621
+ Verifies the OAuth code and exchanges it for a token and refresh token
5622
+ * @summary Install app via OAuth2
5623
+ */
5624
+ export const marketplaceOAuth2InstallAuthorizeParams = zod.object({
5625
+ type: zod
5626
+ .enum(['stripe', 'sandbox', 'custom_invoicing'])
5627
+ .describe('The type of the app to install.'),
5628
+ });
5629
+ export const marketplaceOAuth2InstallAuthorizeQueryParams = zod.object({
5630
+ code: zod.coerce
5953
5631
  .string()
5954
5632
  .optional()
5955
- .describe('The event ID.\n\nAccepts partial ID.'),
5956
- ingestedAtFrom: zod.coerce
5957
- .date()
5633
+ .describe('Authorization code which the client will later exchange for an access token.\nRequired with the success response.'),
5634
+ error: zod
5635
+ .enum([
5636
+ 'invalid_request',
5637
+ 'unauthorized_client',
5638
+ 'access_denied',
5639
+ 'unsupported_response_type',
5640
+ 'invalid_scope',
5641
+ 'server_error',
5642
+ 'temporarily_unavailable',
5643
+ ])
5958
5644
  .optional()
5959
- .describe('Start date-time in RFC 3339 format.\n\nInclusive.'),
5960
- ingestedAtTo: zod.coerce
5961
- .date()
5645
+ .describe('Error code.\nRequired with the error response.'),
5646
+ error_description: zod.coerce
5647
+ .string()
5962
5648
  .optional()
5963
- .describe('End date-time in RFC 3339 format.\n\nInclusive.'),
5964
- limit: zod.coerce
5965
- .number()
5966
- .min(1)
5967
- .max(listEventsQueryLimitMax)
5968
- .default(listEventsQueryLimitDefault)
5969
- .describe('Number of events to return.'),
5970
- subject: zod.coerce
5649
+ .describe('Optional human-readable text providing additional information,\nused to assist the client developer in understanding the error that occurred.'),
5650
+ error_uri: zod.coerce
5971
5651
  .string()
5972
5652
  .optional()
5973
- .describe('The event subject.\n\nAccepts partial subject.'),
5974
- to: zod.coerce
5975
- .date()
5653
+ .describe('Optional uri identifying a human-readable web page with\ninformation about the error, used to provide the client\ndeveloper with additional information about the error'),
5654
+ state: zod.coerce
5655
+ .string()
5976
5656
  .optional()
5977
- .describe('End date-time in RFC 3339 format.\n\nInclusive.'),
5657
+ .describe('Required if the \"state\" parameter was present in the client authorization request.\nThe exact value received from the client:\n\nUnique, randomly generated, opaque, and non-guessable string that is sent\nwhen starting an authentication request and validated when processing the response.'),
5978
5658
  });
5979
5659
  /**
5980
- * Ingests an event or batch of events following the CloudEvents specification.
5981
- * @summary Ingest events
5982
- */
5983
- export const ingestEventsBodySpecversionDefault = '1.0';
5984
- export const ingestEventsBodyItemSpecversionDefault = '1.0';
5985
- export const ingestEventsBody = zod
5986
- .union([
5987
- zod
5988
- .object({
5989
- data: zod
5990
- .record(zod.string(), zod.any())
5991
- .nullish()
5992
- .describe('The event payload.\nOptional, if present it must be a JSON object.'),
5993
- datacontenttype: zod
5994
- .enum(['application/json'])
5995
- .nullish()
5996
- .describe('Content type of the CloudEvents data value. Only the value \"application/json\" is allowed over HTTP.'),
5997
- dataschema: zod.coerce
5998
- .string()
5999
- .url()
6000
- .min(1)
6001
- .nullish()
6002
- .describe('Identifies the schema that data adheres to.'),
6003
- id: zod.coerce.string().min(1).describe('Identifies the event.'),
6004
- source: zod.coerce
6005
- .string()
6006
- .min(1)
6007
- .describe('Identifies the context in which an event happened.'),
6008
- specversion: zod.coerce
6009
- .string()
6010
- .min(1)
6011
- .describe('The version of the CloudEvents specification which the event uses.'),
6012
- subject: zod.coerce
6013
- .string()
6014
- .min(1)
6015
- .describe('Describes the subject of the event in the context of the event producer (identified by source).'),
6016
- time: zod.coerce
6017
- .date()
6018
- .nullish()
6019
- .describe('Timestamp of when the occurrence happened. Must adhere to RFC 3339.'),
6020
- type: zod.coerce
6021
- .string()
6022
- .min(1)
6023
- .describe('Contains a value describing the type of event related to the originating occurrence.'),
6024
- })
6025
- .describe('CloudEvents Specification JSON Schema\n\nOptional properties are nullable according to the CloudEvents specification:\nOPTIONAL not omitted attributes MAY be represented as a null JSON value.'),
6026
- zod.array(zod
6027
- .object({
6028
- data: zod
6029
- .record(zod.string(), zod.any())
6030
- .nullish()
6031
- .describe('The event payload.\nOptional, if present it must be a JSON object.'),
6032
- datacontenttype: zod
6033
- .enum(['application/json'])
6034
- .nullish()
6035
- .describe('Content type of the CloudEvents data value. Only the value \"application/json\" is allowed over HTTP.'),
6036
- dataschema: zod.coerce
6037
- .string()
6038
- .url()
6039
- .min(1)
6040
- .nullish()
6041
- .describe('Identifies the schema that data adheres to.'),
6042
- id: zod.coerce.string().min(1).describe('Identifies the event.'),
6043
- source: zod.coerce
6044
- .string()
6045
- .min(1)
6046
- .describe('Identifies the context in which an event happened.'),
6047
- specversion: zod.coerce
6048
- .string()
6049
- .min(1)
6050
- .describe('The version of the CloudEvents specification which the event uses.'),
6051
- subject: zod.coerce
6052
- .string()
6053
- .min(1)
6054
- .describe('Describes the subject of the event in the context of the event producer (identified by source).'),
6055
- time: zod.coerce
6056
- .date()
6057
- .nullish()
6058
- .describe('Timestamp of when the occurrence happened. Must adhere to RFC 3339.'),
6059
- type: zod.coerce
6060
- .string()
6061
- .min(1)
6062
- .describe('Contains a value describing the type of event related to the originating occurrence.'),
6063
- })
6064
- .describe('CloudEvents Specification JSON Schema\n\nOptional properties are nullable according to the CloudEvents specification:\nOPTIONAL not omitted attributes MAY be represented as a null JSON value.')),
6065
- ])
6066
- .describe('The body of the events request.\nEither a single event or a batch of events.');
6067
- /**
6068
- * List features.
6069
- * @summary List features
5660
+ * List meters.
5661
+ * @summary List meters
6070
5662
  */
6071
- export const listFeaturesQueryIncludeArchivedDefault = false;
6072
- export const listFeaturesQueryPageDefault = 1;
6073
- export const listFeaturesQueryPageSizeDefault = 100;
6074
- export const listFeaturesQueryPageSizeMax = 1000;
6075
- export const listFeaturesQueryOffsetDefault = 0;
6076
- export const listFeaturesQueryOffsetMin = 0;
6077
- export const listFeaturesQueryLimitDefault = 100;
6078
- export const listFeaturesQueryLimitMax = 1000;
6079
- export const listFeaturesQueryParams = zod.object({
6080
- includeArchived: zod.coerce
5663
+ export const listMetersQueryPageDefault = 1;
5664
+ export const listMetersQueryPageSizeDefault = 100;
5665
+ export const listMetersQueryPageSizeMax = 1000;
5666
+ export const listMetersQueryIncludeDeletedDefault = false;
5667
+ export const listMetersQueryParams = zod.object({
5668
+ includeDeleted: zod.coerce
6081
5669
  .boolean()
6082
5670
  .optional()
6083
- .describe('Filter by meterGroupByFilters'),
6084
- limit: zod.coerce
6085
- .number()
6086
- .min(1)
6087
- .max(listFeaturesQueryLimitMax)
6088
- .default(listFeaturesQueryLimitDefault)
6089
- .describe('Number of items to return.\n\nDefault is 100.'),
6090
- meterSlug: zod
6091
- .array(zod.coerce.string())
6092
- .optional()
6093
- .describe('Filter by meterSlug'),
6094
- offset: zod.coerce
6095
- .number()
6096
- .min(listFeaturesQueryOffsetMin)
6097
- .optional()
6098
- .describe('Number of items to skip.\n\nDefault is 0.'),
5671
+ .describe('Include deleted meters.'),
6099
5672
  order: zod.enum(['ASC', 'DESC']).optional().describe('The order direction.'),
6100
5673
  orderBy: zod
6101
- .enum(['id', 'key', 'name', 'createdAt', 'updatedAt'])
5674
+ .enum(['key', 'name', 'aggregation', 'createdAt', 'updatedAt'])
6102
5675
  .optional()
6103
5676
  .describe('The order by field.'),
6104
5677
  page: zod.coerce
6105
5678
  .number()
6106
5679
  .min(1)
6107
- .default(listFeaturesQueryPageDefault)
5680
+ .default(listMetersQueryPageDefault)
6108
5681
  .describe('Page index.\n\nDefault is 1.'),
6109
5682
  pageSize: zod.coerce
6110
5683
  .number()
6111
5684
  .min(1)
6112
- .max(listFeaturesQueryPageSizeMax)
6113
- .default(listFeaturesQueryPageSizeDefault)
5685
+ .max(listMetersQueryPageSizeMax)
5686
+ .default(listMetersQueryPageSizeDefault)
6114
5687
  .describe('The maximum number of items per page.\n\nDefault is 100.'),
6115
5688
  });
6116
5689
  /**
6117
- * Features are either metered or static. A feature is metered if meterSlug is provided at creation.
6118
- For metered features you can pass additional filters that will be applied when calculating feature usage, based on the meter's groupBy fields.
6119
- Only meters with SUM and COUNT aggregation are supported for features.
6120
- Features cannot be updated later, only archived.
6121
- * @summary Create feature
5690
+ * Create a meter.
5691
+ * @summary Create meter
6122
5692
  */
6123
- export const createFeatureBodyKeyMax = 64;
6124
- export const createFeatureBodyKeyRegExp = new RegExp('^[a-z0-9]+(?:_[a-z0-9]+)*$');
6125
- export const createFeatureBodyMeterSlugMax = 64;
6126
- export const createFeatureBodyMeterSlugRegExp = new RegExp('^[a-z0-9]+(?:_[a-z0-9]+)*$');
6127
- export const createFeatureBody = zod
5693
+ export const createMeterBodyDescriptionMax = 1024;
5694
+ export const createMeterBodyNameMax = 256;
5695
+ export const createMeterBodySlugMax = 64;
5696
+ export const createMeterBodySlugRegExp = new RegExp('^[a-z0-9]+(?:_[a-z0-9]+)*$');
5697
+ export const createMeterBody = zod
6128
5698
  .object({
6129
- key: zod.coerce
5699
+ aggregation: zod
5700
+ .enum(['SUM', 'COUNT', 'UNIQUE_COUNT', 'AVG', 'MIN', 'MAX', 'LATEST'])
5701
+ .describe('The aggregation type to use for the meter.')
5702
+ .describe('The aggregation type to use for the meter.'),
5703
+ description: zod.coerce
5704
+ .string()
5705
+ .max(createMeterBodyDescriptionMax)
5706
+ .optional()
5707
+ .describe('Optional description of the resource. Maximum 1024 characters.'),
5708
+ eventFrom: zod.coerce
5709
+ .date()
5710
+ .optional()
5711
+ .describe('The date since the meter should include events.\nUseful to skip old events.\nIf not specified, all historical events are included.'),
5712
+ eventType: zod.coerce
6130
5713
  .string()
6131
5714
  .min(1)
6132
- .max(createFeatureBodyKeyMax)
6133
- .regex(createFeatureBodyKeyRegExp)
6134
- .describe('A key is a unique string that is used to identify a resource.'),
5715
+ .describe('The event type to aggregate.'),
5716
+ groupBy: zod
5717
+ .record(zod.string(), zod.coerce.string())
5718
+ .optional()
5719
+ .describe('Named JSONPath expressions to extract the group by values from the event data.\n\nKeys must be unique and consist only alphanumeric and underscore characters.'),
6135
5720
  metadata: zod
6136
5721
  .record(zod.string(), zod.coerce.string())
6137
5722
  .describe('Set of key-value pairs.\nMetadata can be used to store additional information about a resource.')
6138
- .optional(),
6139
- meterGroupByFilters: zod
6140
- .record(zod.string(), zod.coerce.string())
5723
+ .nullish()
5724
+ .describe('Additional metadata for the resource.'),
5725
+ name: zod.coerce
5726
+ .string()
5727
+ .min(1)
5728
+ .max(createMeterBodyNameMax)
6141
5729
  .optional()
6142
- .describe('Optional meter group by filters.\nUseful if the meter scope is broader than what feature tracks.\nExample scenario would be a meter tracking all token use with groupBy fields for the model,\nthen the feature could filter for model=gpt-4.'),
6143
- meterSlug: zod.coerce
5730
+ .describe('Human-readable name for the resource. Between 1 and 256 characters.\nDefaults to the slug if not specified.'),
5731
+ slug: zod.coerce
5732
+ .string()
5733
+ .min(1)
5734
+ .max(createMeterBodySlugMax)
5735
+ .regex(createMeterBodySlugRegExp)
5736
+ .describe('A unique, human-readable identifier for the meter.\nMust consist only alphanumeric and underscore characters.'),
5737
+ valueProperty: zod.coerce
6144
5738
  .string()
6145
5739
  .min(1)
6146
- .max(createFeatureBodyMeterSlugMax)
6147
- .regex(createFeatureBodyMeterSlugRegExp)
6148
5740
  .optional()
6149
- .describe('A key is a unique string that is used to identify a resource.'),
6150
- name: zod.coerce.string(),
5741
+ .describe("JSONPath expression to extract the value from the ingested event's data property.\n\nThe ingested value for SUM, AVG, MIN, and MAX aggregations is a number or a string that can be parsed to a number.\n\nFor UNIQUE_COUNT aggregation, the ingested value must be a string. For COUNT aggregation the valueProperty is ignored."),
6151
5742
  })
6152
- .describe('Represents a feature that can be enabled or disabled for a plan.\nUsed both for product catalog and entitlements.');
6153
- /**
6154
- * Get a feature by ID.
6155
- * @summary Get feature
6156
- */
6157
- export const getFeatureParams = zod.object({
6158
- featureId: zod.coerce.string(),
6159
- });
5743
+ .describe('A meter create model.');
6160
5744
  /**
6161
- * Archive a feature by ID.
6162
-
6163
- Once a feature is archived it cannot be unarchived. If a feature is archived, new entitlements cannot be created for it, but archiving the feature does not affect existing entitlements.
6164
- This means, if you want to create a new feature with the same key, and then create entitlements for it, the previous entitlements have to be deleted first on a per subject basis.
6165
- * @summary Delete feature
5745
+ * Get a meter by ID or slug.
5746
+ * @summary Get meter
6166
5747
  */
6167
- export const deleteFeatureParams = zod.object({
6168
- featureId: zod.coerce.string(),
5748
+ export const getMeterPathMeterIdOrSlugMax = 64;
5749
+ export const getMeterPathMeterIdOrSlugRegExp = new RegExp('^[a-z0-9]+(?:_[a-z0-9]+)*$|^[0-7][0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{25}$');
5750
+ export const getMeterParams = zod.object({
5751
+ meterIdOrSlug: zod.coerce
5752
+ .string()
5753
+ .min(1)
5754
+ .max(getMeterPathMeterIdOrSlugMax)
5755
+ .regex(getMeterPathMeterIdOrSlugRegExp),
6169
5756
  });
6170
5757
  /**
6171
- * List all grants for all the subjects and entitlements. This endpoint is intended for administrative purposes only.
6172
- To fetch the grants of a specific entitlement please use the /api/v1/subjects/{subjectKeyOrID}/entitlements/{entitlementOrFeatureID}/grants endpoint.
6173
- If page is provided that takes precedence and the paginated response is returned.
6174
- * @summary List grants
5758
+ * Update a meter.
5759
+ * @summary Update meter
6175
5760
  */
6176
- export const listGrantsQueryIncludeDeletedDefault = false;
6177
- export const listGrantsQueryPageDefault = 1;
6178
- export const listGrantsQueryPageSizeDefault = 100;
6179
- export const listGrantsQueryPageSizeMax = 1000;
6180
- export const listGrantsQueryOffsetDefault = 0;
6181
- export const listGrantsQueryOffsetMin = 0;
6182
- export const listGrantsQueryLimitDefault = 100;
6183
- export const listGrantsQueryLimitMax = 1000;
6184
- export const listGrantsQueryParams = zod.object({
6185
- feature: zod
6186
- .array(zod.coerce.string())
6187
- .optional()
6188
- .describe('Filtering by multiple features.\n\nUsage: `?feature=feature-1&feature=feature-2`'),
6189
- includeDeleted: zod.coerce.boolean().optional().describe('Include deleted'),
6190
- limit: zod.coerce
6191
- .number()
5761
+ export const updateMeterPathMeterIdOrSlugMax = 64;
5762
+ export const updateMeterPathMeterIdOrSlugRegExp = new RegExp('^[a-z0-9]+(?:_[a-z0-9]+)*$|^[0-7][0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{25}$');
5763
+ export const updateMeterParams = zod.object({
5764
+ meterIdOrSlug: zod.coerce
5765
+ .string()
6192
5766
  .min(1)
6193
- .max(listGrantsQueryLimitMax)
6194
- .default(listGrantsQueryLimitDefault)
6195
- .describe('Number of items to return.\n\nDefault is 100.'),
6196
- offset: zod.coerce
6197
- .number()
6198
- .min(listGrantsQueryOffsetMin)
5767
+ .max(updateMeterPathMeterIdOrSlugMax)
5768
+ .regex(updateMeterPathMeterIdOrSlugRegExp),
5769
+ });
5770
+ export const updateMeterBodyDescriptionMax = 1024;
5771
+ export const updateMeterBodyNameMax = 256;
5772
+ export const updateMeterBody = zod
5773
+ .object({
5774
+ description: zod.coerce
5775
+ .string()
5776
+ .max(updateMeterBodyDescriptionMax)
6199
5777
  .optional()
6200
- .describe('Number of items to skip.\n\nDefault is 0.'),
6201
- order: zod.enum(['ASC', 'DESC']).optional().describe('The order direction.'),
6202
- orderBy: zod
6203
- .enum(['id', 'createdAt', 'updatedAt'])
5778
+ .describe('Optional description of the resource. Maximum 1024 characters.'),
5779
+ groupBy: zod
5780
+ .record(zod.string(), zod.coerce.string())
6204
5781
  .optional()
6205
- .describe('The order by field.'),
6206
- page: zod.coerce
6207
- .number()
6208
- .min(1)
6209
- .default(listGrantsQueryPageDefault)
6210
- .describe('Page index.\n\nDefault is 1.'),
6211
- pageSize: zod.coerce
6212
- .number()
5782
+ .describe('Named JSONPath expressions to extract the group by values from the event data.\n\nKeys must be unique and consist only alphanumeric and underscore characters.'),
5783
+ metadata: zod
5784
+ .record(zod.string(), zod.coerce.string())
5785
+ .describe('Set of key-value pairs.\nMetadata can be used to store additional information about a resource.')
5786
+ .nullish()
5787
+ .describe('Additional metadata for the resource.'),
5788
+ name: zod.coerce
5789
+ .string()
6213
5790
  .min(1)
6214
- .max(listGrantsQueryPageSizeMax)
6215
- .default(listGrantsQueryPageSizeDefault)
6216
- .describe('The maximum number of items per page.\n\nDefault is 100.'),
6217
- subject: zod
6218
- .array(zod.coerce.string())
5791
+ .max(updateMeterBodyNameMax)
6219
5792
  .optional()
6220
- .describe('Filtering by multiple subjects.\n\nUsage: `?subject=customer-1&subject=customer-2`'),
6221
- });
6222
- /**
6223
- * Voiding a grant means it is no longer valid, it doesn't take part in further balance calculations. Voiding a grant does not retroactively take effect, meaning any usage that has already been attributed to the grant will remain, but future usage cannot be burnt down from the grant.
6224
- For example, if you have a single grant for your metered entitlement with an initial amount of 100, and so far 60 usage has been metered, the grant (and the entitlement itself) would have a balance of 40. If you then void that grant, balance becomes 0, but the 60 previous usage will not be affected.
6225
- * @summary Void grant
6226
- */
6227
- export const voidGrantParams = zod.object({
6228
- grantId: zod.coerce.string(),
6229
- });
6230
- /**
6231
- * Get progress
6232
- * @summary Get progress
6233
- */
6234
- export const getProgressParams = zod.object({
6235
- id: zod.coerce.string(),
6236
- });
5793
+ .describe('Human-readable name for the resource. Between 1 and 256 characters.\nDefaults to the slug if not specified.'),
5794
+ })
5795
+ .describe('A meter update model.\n\nOnly the properties that can be updated are included.\nFor example, the slug and aggregation cannot be updated.');
6237
5796
  /**
6238
- * List available apps of the app marketplace.
6239
- * @summary List available apps
5797
+ * Delete a meter.
5798
+ * @summary Delete meter
6240
5799
  */
6241
- export const listMarketplaceListingsQueryPageDefault = 1;
6242
- export const listMarketplaceListingsQueryPageSizeDefault = 100;
6243
- export const listMarketplaceListingsQueryPageSizeMax = 1000;
6244
- export const listMarketplaceListingsQueryParams = zod.object({
6245
- page: zod.coerce
6246
- .number()
6247
- .min(1)
6248
- .default(listMarketplaceListingsQueryPageDefault)
6249
- .describe('Page index.\n\nDefault is 1.'),
6250
- pageSize: zod.coerce
6251
- .number()
5800
+ export const deleteMeterPathMeterIdOrSlugMax = 64;
5801
+ export const deleteMeterPathMeterIdOrSlugRegExp = new RegExp('^[a-z0-9]+(?:_[a-z0-9]+)*$|^[0-7][0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{25}$');
5802
+ export const deleteMeterParams = zod.object({
5803
+ meterIdOrSlug: zod.coerce
5804
+ .string()
6252
5805
  .min(1)
6253
- .max(listMarketplaceListingsQueryPageSizeMax)
6254
- .default(listMarketplaceListingsQueryPageSizeDefault)
6255
- .describe('The maximum number of items per page.\n\nDefault is 100.'),
6256
- });
6257
- /**
6258
- * Get a marketplace listing by type.
6259
- * @summary Get app details by type
6260
- */
6261
- export const getMarketplaceListingParams = zod.object({
6262
- type: zod.enum(['stripe', 'sandbox', 'custom_invoicing']),
5806
+ .max(deleteMeterPathMeterIdOrSlugMax)
5807
+ .regex(deleteMeterPathMeterIdOrSlugRegExp),
6263
5808
  });
6264
5809
  /**
6265
- * Install an app from the marketplace.
6266
- * @summary Install app
5810
+ * Query meter for usage.
5811
+ * @summary Query meter
6267
5812
  */
6268
- export const marketplaceAppInstallParams = zod.object({
6269
- type: zod
6270
- .enum(['stripe', 'sandbox', 'custom_invoicing'])
6271
- .describe('The type of the app to install.'),
5813
+ export const queryMeterPathMeterIdOrSlugMax = 64;
5814
+ export const queryMeterPathMeterIdOrSlugRegExp = new RegExp('^[a-z0-9]+(?:_[a-z0-9]+)*$|^[0-7][0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{25}$');
5815
+ export const queryMeterParams = zod.object({
5816
+ meterIdOrSlug: zod.coerce
5817
+ .string()
5818
+ .min(1)
5819
+ .max(queryMeterPathMeterIdOrSlugMax)
5820
+ .regex(queryMeterPathMeterIdOrSlugRegExp),
6272
5821
  });
6273
- export const marketplaceAppInstallBodyCreateBillingProfileDefault = true;
6274
- export const marketplaceAppInstallBody = zod
6275
- .object({
6276
- createBillingProfile: zod.coerce
6277
- .boolean()
6278
- .default(marketplaceAppInstallBodyCreateBillingProfileDefault)
6279
- .describe('If true, a billing profile will be created for the app.\nThe Stripe app will be also set as the default billing profile if the current default is a Sandbox app.'),
6280
- name: zod.coerce
5822
+ export const queryMeterQueryClientIdMax = 36;
5823
+ export const queryMeterQueryWindowTimeZoneDefault = 'UTC';
5824
+ export const queryMeterQueryFilterCustomerIdMax = 100;
5825
+ export const queryMeterQueryParams = zod.object({
5826
+ clientId: zod.coerce
6281
5827
  .string()
6282
- .optional()
6283
- .describe("Name of the application to install.\n\nIf name is not provided defaults to the marketplace listing's name."),
6284
- })
6285
- .describe('Marketplace install request payload.');
6286
- /**
6287
- * Install an marketplace app via API Key.
6288
- * @summary Install app via API key
6289
- */
6290
- export const marketplaceAppAPIKeyInstallParams = zod.object({
6291
- type: zod
6292
- .enum(['stripe', 'sandbox', 'custom_invoicing'])
6293
- .describe('The type of the app to install.'),
6294
- });
6295
- export const marketplaceAppAPIKeyInstallBodyCreateBillingProfileDefault = true;
6296
- export const marketplaceAppAPIKeyInstallBody = zod.object({
6297
- apiKey: zod.coerce
6298
- .string()
6299
- .describe('The API key for the provider.\nFor example, the Stripe API key.'),
6300
- createBillingProfile: zod.coerce
6301
- .boolean()
6302
- .default(marketplaceAppAPIKeyInstallBodyCreateBillingProfileDefault)
6303
- .describe('If true, a billing profile will be created for the app.\nThe Stripe app will be also set as the default billing profile if the current default is a Sandbox app.'),
6304
- name: zod.coerce
6305
- .string()
6306
- .optional()
6307
- .describe("Name of the application to install.\n\nIf name is not provided defaults to the marketplace listing's name."),
6308
- });
6309
- /**
6310
- * Install an app via OAuth.
6311
- Returns a URL to start the OAuth 2.0 flow.
6312
- * @summary Get OAuth2 install URL
6313
- */
6314
- export const marketplaceOAuth2InstallGetURLParams = zod.object({
6315
- type: zod.enum(['stripe', 'sandbox', 'custom_invoicing']),
6316
- });
6317
- /**
6318
- * Authorize OAuth2 code.
6319
- Verifies the OAuth code and exchanges it for a token and refresh token
6320
- * @summary Install app via OAuth2
6321
- */
6322
- export const marketplaceOAuth2InstallAuthorizeParams = zod.object({
6323
- type: zod
6324
- .enum(['stripe', 'sandbox', 'custom_invoicing'])
6325
- .describe('The type of the app to install.'),
6326
- });
6327
- export const marketplaceOAuth2InstallAuthorizeQueryParams = zod.object({
6328
- code: zod.coerce
6329
- .string()
6330
- .optional()
6331
- .describe('Authorization code which the client will later exchange for an access token.\nRequired with the success response.'),
6332
- error: zod
6333
- .enum([
6334
- 'invalid_request',
6335
- 'unauthorized_client',
6336
- 'access_denied',
6337
- 'unsupported_response_type',
6338
- 'invalid_scope',
6339
- 'server_error',
6340
- 'temporarily_unavailable',
6341
- ])
6342
- .optional()
6343
- .describe('Error code.\nRequired with the error response.'),
6344
- error_description: zod.coerce
6345
- .string()
6346
- .optional()
6347
- .describe('Optional human-readable text providing additional information,\nused to assist the client developer in understanding the error that occurred.'),
6348
- error_uri: zod.coerce
6349
- .string()
6350
- .optional()
6351
- .describe('Optional uri identifying a human-readable web page with\ninformation about the error, used to provide the client\ndeveloper with additional information about the error'),
6352
- state: zod.coerce
6353
- .string()
6354
- .optional()
6355
- .describe('Required if the \"state\" parameter was present in the client authorization request.\nThe exact value received from the client:\n\nUnique, randomly generated, opaque, and non-guessable string that is sent\nwhen starting an authentication request and validated when processing the response.'),
6356
- });
6357
- /**
6358
- * List meters.
6359
- * @summary List meters
6360
- */
6361
- export const listMetersQueryPageDefault = 1;
6362
- export const listMetersQueryPageSizeDefault = 100;
6363
- export const listMetersQueryPageSizeMax = 1000;
6364
- export const listMetersQueryIncludeDeletedDefault = false;
6365
- export const listMetersQueryParams = zod.object({
6366
- includeDeleted: zod.coerce
6367
- .boolean()
6368
- .optional()
6369
- .describe('Include deleted meters.'),
6370
- order: zod.enum(['ASC', 'DESC']).optional().describe('The order direction.'),
6371
- orderBy: zod
6372
- .enum(['key', 'name', 'aggregation', 'createdAt', 'updatedAt'])
6373
- .optional()
6374
- .describe('The order by field.'),
6375
- page: zod.coerce
6376
- .number()
6377
- .min(1)
6378
- .default(listMetersQueryPageDefault)
6379
- .describe('Page index.\n\nDefault is 1.'),
6380
- pageSize: zod.coerce
6381
- .number()
6382
- .min(1)
6383
- .max(listMetersQueryPageSizeMax)
6384
- .default(listMetersQueryPageSizeDefault)
6385
- .describe('The maximum number of items per page.\n\nDefault is 100.'),
6386
- });
6387
- /**
6388
- * Create a meter.
6389
- * @summary Create meter
6390
- */
6391
- export const createMeterBodyDescriptionMax = 1024;
6392
- export const createMeterBodyNameMax = 256;
6393
- export const createMeterBodySlugMax = 64;
6394
- export const createMeterBodySlugRegExp = new RegExp('^[a-z0-9]+(?:_[a-z0-9]+)*$');
6395
- export const createMeterBody = zod
6396
- .object({
6397
- aggregation: zod
6398
- .enum(['SUM', 'COUNT', 'UNIQUE_COUNT', 'AVG', 'MIN', 'MAX', 'LATEST'])
6399
- .describe('The aggregation type to use for the meter.')
6400
- .describe('The aggregation type to use for the meter.'),
6401
- description: zod.coerce
6402
- .string()
6403
- .max(createMeterBodyDescriptionMax)
6404
- .optional()
6405
- .describe('Optional description of the resource. Maximum 1024 characters.'),
6406
- eventFrom: zod.coerce
6407
- .date()
6408
- .optional()
6409
- .describe('The date since the meter should include events.\nUseful to skip old events.\nIf not specified, all historical events are included.'),
6410
- eventType: zod.coerce
6411
- .string()
6412
- .min(1)
6413
- .describe('The event type to aggregate.'),
6414
- groupBy: zod
6415
- .record(zod.string(), zod.coerce.string())
6416
- .optional()
6417
- .describe('Named JSONPath expressions to extract the group by values from the event data.\n\nKeys must be unique and consist only alphanumeric and underscore characters.'),
6418
- metadata: zod
6419
- .record(zod.string(), zod.coerce.string())
6420
- .describe('Set of key-value pairs.\nMetadata can be used to store additional information about a resource.')
6421
- .nullish()
6422
- .describe('Additional metadata for the resource.'),
6423
- name: zod.coerce
6424
- .string()
6425
- .min(1)
6426
- .max(createMeterBodyNameMax)
6427
- .optional()
6428
- .describe('Human-readable name for the resource. Between 1 and 256 characters.\nDefaults to the slug if not specified.'),
6429
- slug: zod.coerce
6430
- .string()
6431
- .min(1)
6432
- .max(createMeterBodySlugMax)
6433
- .regex(createMeterBodySlugRegExp)
6434
- .describe('A unique, human-readable identifier for the meter.\nMust consist only alphanumeric and underscore characters.'),
6435
- valueProperty: zod.coerce
6436
- .string()
6437
- .min(1)
6438
- .optional()
6439
- .describe("JSONPath expression to extract the value from the ingested event's data property.\n\nThe ingested value for SUM, AVG, MIN, and MAX aggregations is a number or a string that can be parsed to a number.\n\nFor UNIQUE_COUNT aggregation, the ingested value must be a string. For COUNT aggregation the valueProperty is ignored."),
6440
- })
6441
- .describe('A meter create model.');
6442
- /**
6443
- * Get a meter by ID or slug.
6444
- * @summary Get meter
6445
- */
6446
- export const getMeterPathMeterIdOrSlugMax = 64;
6447
- export const getMeterPathMeterIdOrSlugRegExp = new RegExp('^[a-z0-9]+(?:_[a-z0-9]+)*$|^[0-7][0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{25}$');
6448
- export const getMeterParams = zod.object({
6449
- meterIdOrSlug: zod.coerce
6450
- .string()
6451
- .min(1)
6452
- .max(getMeterPathMeterIdOrSlugMax)
6453
- .regex(getMeterPathMeterIdOrSlugRegExp),
6454
- });
6455
- /**
6456
- * Update a meter.
6457
- * @summary Update meter
6458
- */
6459
- export const updateMeterPathMeterIdOrSlugMax = 64;
6460
- export const updateMeterPathMeterIdOrSlugRegExp = new RegExp('^[a-z0-9]+(?:_[a-z0-9]+)*$|^[0-7][0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{25}$');
6461
- export const updateMeterParams = zod.object({
6462
- meterIdOrSlug: zod.coerce
6463
- .string()
6464
- .min(1)
6465
- .max(updateMeterPathMeterIdOrSlugMax)
6466
- .regex(updateMeterPathMeterIdOrSlugRegExp),
6467
- });
6468
- export const updateMeterBodyDescriptionMax = 1024;
6469
- export const updateMeterBodyNameMax = 256;
6470
- export const updateMeterBody = zod
6471
- .object({
6472
- description: zod.coerce
6473
- .string()
6474
- .max(updateMeterBodyDescriptionMax)
6475
- .optional()
6476
- .describe('Optional description of the resource. Maximum 1024 characters.'),
6477
- groupBy: zod
6478
- .record(zod.string(), zod.coerce.string())
6479
- .optional()
6480
- .describe('Named JSONPath expressions to extract the group by values from the event data.\n\nKeys must be unique and consist only alphanumeric and underscore characters.'),
6481
- metadata: zod
6482
- .record(zod.string(), zod.coerce.string())
6483
- .describe('Set of key-value pairs.\nMetadata can be used to store additional information about a resource.')
6484
- .nullish()
6485
- .describe('Additional metadata for the resource.'),
6486
- name: zod.coerce
6487
- .string()
6488
- .min(1)
6489
- .max(updateMeterBodyNameMax)
6490
- .optional()
6491
- .describe('Human-readable name for the resource. Between 1 and 256 characters.\nDefaults to the slug if not specified.'),
6492
- })
6493
- .describe('A meter update model.\n\nOnly the properties that can be updated are included.\nFor example, the slug and aggregation cannot be updated.');
6494
- /**
6495
- * Delete a meter.
6496
- * @summary Delete meter
6497
- */
6498
- export const deleteMeterPathMeterIdOrSlugMax = 64;
6499
- export const deleteMeterPathMeterIdOrSlugRegExp = new RegExp('^[a-z0-9]+(?:_[a-z0-9]+)*$|^[0-7][0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{25}$');
6500
- export const deleteMeterParams = zod.object({
6501
- meterIdOrSlug: zod.coerce
6502
- .string()
6503
- .min(1)
6504
- .max(deleteMeterPathMeterIdOrSlugMax)
6505
- .regex(deleteMeterPathMeterIdOrSlugRegExp),
6506
- });
6507
- /**
6508
- * Query meter for usage.
6509
- * @summary Query meter
6510
- */
6511
- export const queryMeterPathMeterIdOrSlugMax = 64;
6512
- export const queryMeterPathMeterIdOrSlugRegExp = new RegExp('^[a-z0-9]+(?:_[a-z0-9]+)*$|^[0-7][0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{25}$');
6513
- export const queryMeterParams = zod.object({
6514
- meterIdOrSlug: zod.coerce
6515
- .string()
6516
- .min(1)
6517
- .max(queryMeterPathMeterIdOrSlugMax)
6518
- .regex(queryMeterPathMeterIdOrSlugRegExp),
6519
- });
6520
- export const queryMeterQueryClientIdMax = 36;
6521
- export const queryMeterQueryWindowTimeZoneDefault = 'UTC';
6522
- export const queryMeterQueryFilterCustomerIdMax = 100;
6523
- export const queryMeterQueryParams = zod.object({
6524
- clientId: zod.coerce
6525
- .string()
6526
- .min(1)
6527
- .max(queryMeterQueryClientIdMax)
5828
+ .min(1)
5829
+ .max(queryMeterQueryClientIdMax)
6528
5830
  .optional()
6529
5831
  .describe('Client ID\nUseful to track progress of a query.'),
6530
5832
  filterCustomerId: zod
@@ -12076,79 +11378,875 @@ export const changeSubscriptionBody = zod
12076
11378
  timing: zod
12077
11379
  .union([
12078
11380
  zod
12079
- .enum(['immediate', 'next_billing_cycle'])
12080
- .describe('Subscription edit timing.\nWhen immediate, the requested changes take effect immediately.\nWhen nextBillingCycle, the requested changes take effect at the next billing cycle.'),
11381
+ .enum(['immediate', 'next_billing_cycle'])
11382
+ .describe('Subscription edit timing.\nWhen immediate, the requested changes take effect immediately.\nWhen nextBillingCycle, the requested changes take effect at the next billing cycle.'),
11383
+ zod.coerce
11384
+ .date()
11385
+ .describe('[RFC3339](https://tools.ietf.org/html/rfc3339) formatted date-time string in UTC.'),
11386
+ ])
11387
+ .describe('Subscription edit timing defined when the changes should take effect.\nIf the provided configuration is not supported by the subscription, an error will be returned.')
11388
+ .describe('Timing configuration for the change, when the change should take effect.\nFor changing a subscription, the accepted values depend on the subscription configuration.'),
11389
+ })
11390
+ .describe('Change a custom subscription.'),
11391
+ ])
11392
+ .describe('Change a subscription.');
11393
+ /**
11394
+ * Migrates the subscripiton to the provided version of the current plan.
11395
+ If possible, the migration will be done immediately.
11396
+ If not, the migration will be scheduled to the end of the current billing period.
11397
+ * @summary Migrate subscription
11398
+ */
11399
+ export const migrateSubscriptionPathSubscriptionIdRegExp = new RegExp('^[0-7][0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{25}$');
11400
+ export const migrateSubscriptionParams = zod.object({
11401
+ subscriptionId: zod.coerce
11402
+ .string()
11403
+ .regex(migrateSubscriptionPathSubscriptionIdRegExp),
11404
+ });
11405
+ export const migrateSubscriptionBodyTimingDefault = 'immediate';
11406
+ export const migrateSubscriptionBody = zod.object({
11407
+ billingAnchor: zod.coerce
11408
+ .date()
11409
+ .optional()
11410
+ .describe('The billing anchor of the subscription. The provided date will be normalized according to the billing cadence to the nearest recurrence before start time. If not provided, the previous subscription billing anchor will be used.'),
11411
+ startingPhase: zod.coerce
11412
+ .string()
11413
+ .min(1)
11414
+ .optional()
11415
+ .describe('The key of the phase to start the subscription in.\nIf not provided, the subscription will start in the first phase of the plan.'),
11416
+ targetVersion: zod.coerce
11417
+ .number()
11418
+ .min(1)
11419
+ .optional()
11420
+ .describe('The version of the plan to migrate to.\nIf not provided, the subscription will migrate to the latest version of the current plan.'),
11421
+ timing: zod
11422
+ .union([
11423
+ zod
11424
+ .enum(['immediate', 'next_billing_cycle'])
11425
+ .describe('Subscription edit timing.\nWhen immediate, the requested changes take effect immediately.\nWhen nextBillingCycle, the requested changes take effect at the next billing cycle.'),
11426
+ zod.coerce
11427
+ .date()
11428
+ .describe('[RFC3339](https://tools.ietf.org/html/rfc3339) formatted date-time string in UTC.'),
11429
+ ])
11430
+ .describe('Subscription edit timing defined when the changes should take effect.\nIf the provided configuration is not supported by the subscription, an error will be returned.')
11431
+ .default(migrateSubscriptionBodyTimingDefault)
11432
+ .describe('Timing configuration for the migration, when the migration should take effect.\nIf not supported by the subscription, 400 will be returned.'),
11433
+ });
11434
+ /**
11435
+ * Restores a canceled subscription.
11436
+ Any subscription scheduled to start later will be deleted and this subscription will be continued indefinitely.
11437
+ * @summary Restore subscription
11438
+ */
11439
+ export const restoreSubscriptionPathSubscriptionIdRegExp = new RegExp('^[0-7][0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{25}$');
11440
+ export const restoreSubscriptionParams = zod.object({
11441
+ subscriptionId: zod.coerce
11442
+ .string()
11443
+ .regex(restoreSubscriptionPathSubscriptionIdRegExp),
11444
+ });
11445
+ /**
11446
+ * Cancels the scheduled cancelation.
11447
+ * @summary Unschedule cancelation
11448
+ */
11449
+ export const unscheduleCancelationPathSubscriptionIdRegExp = new RegExp('^[0-7][0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{25}$');
11450
+ export const unscheduleCancelationParams = zod.object({
11451
+ subscriptionId: zod.coerce
11452
+ .string()
11453
+ .regex(unscheduleCancelationPathSubscriptionIdRegExp),
11454
+ });
11455
+ /**
11456
+ * OpenMeter has three types of entitlements: metered, boolean, and static. The type property determines the type of entitlement. The underlying feature has to be compatible with the entitlement type specified in the request (e.g., a metered entitlement needs a feature associated with a meter).
11457
+
11458
+ - Boolean entitlements define static feature access, e.g. "Can use SSO authentication".
11459
+ - Static entitlements let you pass along a configuration while granting access, e.g. "Using this feature with X Y settings" (passed in the config).
11460
+ - Metered entitlements have many use cases, from setting up usage-based access to implementing complex credit systems. Example: The customer can use 10000 AI tokens during the usage period of the entitlement.
11461
+
11462
+ A given customer can only have one active (non-deleted) entitlement per featureKey. If you try to create a new entitlement for a featureKey that already has an active entitlement, the request will fail with a 409 error.
11463
+
11464
+ Once an entitlement is created you cannot modify it, only delete it.
11465
+ * @summary Create a customer entitlement
11466
+ */
11467
+ export const createCustomerEntitlementV2Params = zod.object({
11468
+ customerIdOrKey: zod.union([
11469
+ zod.coerce
11470
+ .string()
11471
+ .regex(createCustomerEntitlementV2PathCustomerIdOrKeyRegExpOne)
11472
+ .describe('ULID (Universally Unique Lexicographically Sortable Identifier).'),
11473
+ zod.coerce
11474
+ .string()
11475
+ .min(1)
11476
+ .max(createCustomerEntitlementV2PathCustomerIdOrKeyMaxTwo)
11477
+ .describe('ExternalKey is a looser version of key.'),
11478
+ ]),
11479
+ });
11480
+ export const createCustomerEntitlementV2BodyFeatureKeyMax = 64;
11481
+ export const createCustomerEntitlementV2BodyFeatureKeyRegExp = new RegExp('^[a-z0-9]+(?:_[a-z0-9]+)*$');
11482
+ export const createCustomerEntitlementV2BodyFeatureIdRegExp = new RegExp('^[0-7][0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{25}$');
11483
+ export const createCustomerEntitlementV2BodyIsSoftLimitDefault = false;
11484
+ export const createCustomerEntitlementV2BodyIsUnlimitedDefault = false;
11485
+ export const createCustomerEntitlementV2BodyIssueAfterResetMin = 0;
11486
+ export const createCustomerEntitlementV2BodyIssueAfterResetPriorityDefault = 1;
11487
+ export const createCustomerEntitlementV2BodyIssueAfterResetPriorityMax = 255;
11488
+ export const createCustomerEntitlementV2BodyPreserveOverageAtResetDefault = false;
11489
+ export const createCustomerEntitlementV2BodyFeatureKeyMaxOne = 64;
11490
+ export const createCustomerEntitlementV2BodyFeatureKeyRegExpOne = new RegExp('^[a-z0-9]+(?:_[a-z0-9]+)*$');
11491
+ export const createCustomerEntitlementV2BodyFeatureIdRegExpOne = new RegExp('^[0-7][0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{25}$');
11492
+ export const createCustomerEntitlementV2BodyFeatureKeyMaxTwo = 64;
11493
+ export const createCustomerEntitlementV2BodyFeatureKeyRegExpTwo = new RegExp('^[a-z0-9]+(?:_[a-z0-9]+)*$');
11494
+ export const createCustomerEntitlementV2BodyFeatureIdRegExpTwo = new RegExp('^[0-7][0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{25}$');
11495
+ export const createCustomerEntitlementV2Body = zod
11496
+ .union([
11497
+ zod
11498
+ .object({
11499
+ featureId: zod.coerce
11500
+ .string()
11501
+ .regex(createCustomerEntitlementV2BodyFeatureIdRegExp)
11502
+ .optional()
11503
+ .describe('The feature the subject is entitled to use.\nEither featureKey or featureId is required.'),
11504
+ featureKey: zod.coerce
11505
+ .string()
11506
+ .min(1)
11507
+ .max(createCustomerEntitlementV2BodyFeatureKeyMax)
11508
+ .regex(createCustomerEntitlementV2BodyFeatureKeyRegExp)
11509
+ .optional()
11510
+ .describe('The feature the subject is entitled to use.\nEither featureKey or featureId is required.'),
11511
+ isSoftLimit: zod.coerce
11512
+ .boolean()
11513
+ .optional()
11514
+ .describe('If softLimit=true the subject can use the feature even if the entitlement is exhausted, hasAccess will always be true.'),
11515
+ issueAfterReset: zod.coerce
11516
+ .number()
11517
+ .min(createCustomerEntitlementV2BodyIssueAfterResetMin)
11518
+ .optional()
11519
+ .describe('You can grant usage automatically alongside the entitlement, the example scenario would be creating a starting balance.\nIf an amount is specified here, a grant will be created alongside the entitlement with the specified amount.\nThat grant will have it\'s rollover settings configured in a way that after each reset operation, the balance will return the original amount specified here.\nManually creating such a grant would mean having the \"amount\", \"minRolloverAmount\", and \"maxRolloverAmount\" fields all be the same.'),
11520
+ issueAfterResetPriority: zod.coerce
11521
+ .number()
11522
+ .min(1)
11523
+ .max(createCustomerEntitlementV2BodyIssueAfterResetPriorityMax)
11524
+ .default(createCustomerEntitlementV2BodyIssueAfterResetPriorityDefault)
11525
+ .describe('Defines the grant priority for the default grant.'),
11526
+ isUnlimited: zod.coerce
11527
+ .boolean()
11528
+ .optional()
11529
+ .describe('Deprecated, ignored by the backend. Please use isSoftLimit instead; this field will be removed in the future.'),
11530
+ measureUsageFrom: zod
11531
+ .union([
11532
+ zod
11533
+ .enum(['CURRENT_PERIOD_START', 'NOW'])
11534
+ .describe('Start of measurement options'),
11535
+ zod.coerce
11536
+ .date()
11537
+ .describe('[RFC3339](https://tools.ietf.org/html/rfc3339) formatted date-time string in UTC.'),
11538
+ ])
11539
+ .describe('Measure usage from')
11540
+ .optional()
11541
+ .describe('Defines the time from which usage is measured. If not specified on creation, defaults to entitlement creation time.'),
11542
+ metadata: zod
11543
+ .record(zod.string(), zod.coerce.string())
11544
+ .describe('Set of key-value pairs.\nMetadata can be used to store additional information about a resource.')
11545
+ .optional()
11546
+ .describe('Additional metadata for the feature.'),
11547
+ preserveOverageAtReset: zod.coerce
11548
+ .boolean()
11549
+ .optional()
11550
+ .describe('If true, the overage is preserved at reset. If false, the usage is reset to 0.'),
11551
+ type: zod.enum(['metered']),
11552
+ usagePeriod: zod
11553
+ .object({
11554
+ anchor: zod.coerce
11555
+ .date()
11556
+ .optional()
11557
+ .describe('A date-time anchor to base the recurring period on.'),
11558
+ interval: zod
11559
+ .union([
11560
+ zod.coerce.string(),
11561
+ zod
11562
+ .enum(['DAY', 'WEEK', 'MONTH', 'YEAR'])
11563
+ .describe('The unit of time for the interval.\nOne of: `day`, `week`, `month`, or `year`.'),
11564
+ ])
11565
+ .describe('Period duration for the recurrence')
11566
+ .describe('The unit of time for the interval.'),
11567
+ })
11568
+ .describe('Recurring period with an interval and an anchor.')
11569
+ .describe('The usage period associated with the entitlement.'),
11570
+ })
11571
+ .describe('Create inpurs for metered entitlement'),
11572
+ zod
11573
+ .object({
11574
+ config: zod.coerce
11575
+ .string()
11576
+ .describe('The JSON parsable config of the entitlement. This value is also returned when checking entitlement access and it is useful for configuring fine-grained access settings to the feature, implemented in your own system. Has to be an object.'),
11577
+ featureId: zod.coerce
11578
+ .string()
11579
+ .regex(createCustomerEntitlementV2BodyFeatureIdRegExpOne)
11580
+ .optional()
11581
+ .describe('The feature the subject is entitled to use.\nEither featureKey or featureId is required.'),
11582
+ featureKey: zod.coerce
11583
+ .string()
11584
+ .min(1)
11585
+ .max(createCustomerEntitlementV2BodyFeatureKeyMaxOne)
11586
+ .regex(createCustomerEntitlementV2BodyFeatureKeyRegExpOne)
11587
+ .optional()
11588
+ .describe('The feature the subject is entitled to use.\nEither featureKey or featureId is required.'),
11589
+ metadata: zod
11590
+ .record(zod.string(), zod.coerce.string())
11591
+ .describe('Set of key-value pairs.\nMetadata can be used to store additional information about a resource.')
11592
+ .optional()
11593
+ .describe('Additional metadata for the feature.'),
11594
+ type: zod.enum(['static']),
11595
+ usagePeriod: zod
11596
+ .object({
11597
+ anchor: zod.coerce
11598
+ .date()
11599
+ .optional()
11600
+ .describe('A date-time anchor to base the recurring period on.'),
11601
+ interval: zod
11602
+ .union([
11603
+ zod.coerce.string(),
11604
+ zod
11605
+ .enum(['DAY', 'WEEK', 'MONTH', 'YEAR'])
11606
+ .describe('The unit of time for the interval.\nOne of: `day`, `week`, `month`, or `year`.'),
11607
+ ])
11608
+ .describe('Period duration for the recurrence')
11609
+ .describe('The unit of time for the interval.'),
11610
+ })
11611
+ .describe('Recurring period with an interval and an anchor.')
11612
+ .optional()
11613
+ .describe('The usage period associated with the entitlement.'),
11614
+ })
11615
+ .describe('Create inputs for static entitlement'),
11616
+ zod
11617
+ .object({
11618
+ featureId: zod.coerce
11619
+ .string()
11620
+ .regex(createCustomerEntitlementV2BodyFeatureIdRegExpTwo)
11621
+ .optional()
11622
+ .describe('The feature the subject is entitled to use.\nEither featureKey or featureId is required.'),
11623
+ featureKey: zod.coerce
11624
+ .string()
11625
+ .min(1)
11626
+ .max(createCustomerEntitlementV2BodyFeatureKeyMaxTwo)
11627
+ .regex(createCustomerEntitlementV2BodyFeatureKeyRegExpTwo)
11628
+ .optional()
11629
+ .describe('The feature the subject is entitled to use.\nEither featureKey or featureId is required.'),
11630
+ metadata: zod
11631
+ .record(zod.string(), zod.coerce.string())
11632
+ .describe('Set of key-value pairs.\nMetadata can be used to store additional information about a resource.')
11633
+ .optional()
11634
+ .describe('Additional metadata for the feature.'),
11635
+ type: zod.enum(['boolean']),
11636
+ usagePeriod: zod
11637
+ .object({
11638
+ anchor: zod.coerce
11639
+ .date()
11640
+ .optional()
11641
+ .describe('A date-time anchor to base the recurring period on.'),
11642
+ interval: zod
11643
+ .union([
11644
+ zod.coerce.string(),
11645
+ zod
11646
+ .enum(['DAY', 'WEEK', 'MONTH', 'YEAR'])
11647
+ .describe('The unit of time for the interval.\nOne of: `day`, `week`, `month`, or `year`.'),
11648
+ ])
11649
+ .describe('Period duration for the recurrence')
11650
+ .describe('The unit of time for the interval.'),
11651
+ })
11652
+ .describe('Recurring period with an interval and an anchor.')
11653
+ .optional()
11654
+ .describe('The usage period associated with the entitlement.'),
11655
+ })
11656
+ .describe('Create inputs for boolean entitlement'),
11657
+ ])
11658
+ .describe('Create inputs for entitlement');
11659
+ /**
11660
+ * List all entitlements for a customer. For checking entitlement access, use the /value endpoint instead.
11661
+ * @summary List customer entitlements
11662
+ */
11663
+ export const listCustomerEntitlementsV2Params = zod.object({
11664
+ customerIdOrKey: zod.union([
11665
+ zod.coerce
11666
+ .string()
11667
+ .regex(listCustomerEntitlementsV2PathCustomerIdOrKeyRegExpOne)
11668
+ .describe('ULID (Universally Unique Lexicographically Sortable Identifier).'),
11669
+ zod.coerce
11670
+ .string()
11671
+ .min(1)
11672
+ .max(listCustomerEntitlementsV2PathCustomerIdOrKeyMaxTwo)
11673
+ .describe('ExternalKey is a looser version of key.'),
11674
+ ]),
11675
+ });
11676
+ export const listCustomerEntitlementsV2QueryIncludeDeletedDefault = false;
11677
+ export const listCustomerEntitlementsV2QueryPageDefault = 1;
11678
+ export const listCustomerEntitlementsV2QueryPageSizeDefault = 100;
11679
+ export const listCustomerEntitlementsV2QueryPageSizeMax = 1000;
11680
+ export const listCustomerEntitlementsV2QueryOffsetDefault = 0;
11681
+ export const listCustomerEntitlementsV2QueryOffsetMin = 0;
11682
+ export const listCustomerEntitlementsV2QueryLimitDefault = 100;
11683
+ export const listCustomerEntitlementsV2QueryLimitMax = 1000;
11684
+ export const listCustomerEntitlementsV2QueryParams = zod.object({
11685
+ includeDeleted: zod.coerce.boolean().optional(),
11686
+ limit: zod.coerce
11687
+ .number()
11688
+ .min(1)
11689
+ .max(listCustomerEntitlementsV2QueryLimitMax)
11690
+ .default(listCustomerEntitlementsV2QueryLimitDefault)
11691
+ .describe('Number of items to return.\n\nDefault is 100.'),
11692
+ offset: zod.coerce
11693
+ .number()
11694
+ .min(listCustomerEntitlementsV2QueryOffsetMin)
11695
+ .optional()
11696
+ .describe('Number of items to skip.\n\nDefault is 0.'),
11697
+ order: zod.enum(['ASC', 'DESC']).optional().describe('The order direction.'),
11698
+ orderBy: zod
11699
+ .enum(['createdAt', 'updatedAt'])
11700
+ .optional()
11701
+ .describe('The order by field.'),
11702
+ page: zod.coerce
11703
+ .number()
11704
+ .min(1)
11705
+ .default(listCustomerEntitlementsV2QueryPageDefault)
11706
+ .describe('Page index.\n\nDefault is 1.'),
11707
+ pageSize: zod.coerce
11708
+ .number()
11709
+ .min(1)
11710
+ .max(listCustomerEntitlementsV2QueryPageSizeMax)
11711
+ .default(listCustomerEntitlementsV2QueryPageSizeDefault)
11712
+ .describe('The maximum number of items per page.\n\nDefault is 100.'),
11713
+ });
11714
+ /**
11715
+ * Get entitlement by feature key. For checking entitlement access, use the /value endpoint instead.
11716
+ * @summary Get customer entitlement
11717
+ */
11718
+ export const getCustomerEntitlementV2PathEntitlementIdOrFeatureKeyMax = 64;
11719
+ export const getCustomerEntitlementV2PathEntitlementIdOrFeatureKeyRegExp = new RegExp('^[a-z0-9]+(?:_[a-z0-9]+)*$|^[0-7][0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{25}$');
11720
+ export const getCustomerEntitlementV2Params = zod.object({
11721
+ customerIdOrKey: zod.union([
11722
+ zod.coerce
11723
+ .string()
11724
+ .regex(getCustomerEntitlementV2PathCustomerIdOrKeyRegExpOne)
11725
+ .describe('ULID (Universally Unique Lexicographically Sortable Identifier).'),
11726
+ zod.coerce
11727
+ .string()
11728
+ .min(1)
11729
+ .max(getCustomerEntitlementV2PathCustomerIdOrKeyMaxTwo)
11730
+ .describe('ExternalKey is a looser version of key.'),
11731
+ ]),
11732
+ entitlementIdOrFeatureKey: zod.coerce
11733
+ .string()
11734
+ .min(1)
11735
+ .max(getCustomerEntitlementV2PathEntitlementIdOrFeatureKeyMax)
11736
+ .regex(getCustomerEntitlementV2PathEntitlementIdOrFeatureKeyRegExp),
11737
+ });
11738
+ /**
11739
+ * Deleting an entitlement revokes access to the associated feature. As a single customer can only have one entitlement per featureKey, when "migrating" features you have to delete the old entitlements as well.
11740
+ As access and status checks can be historical queries, deleting an entitlement populates the deletedAt timestamp. When queried for a time before that, the entitlement is still considered active, you cannot have retroactive changes to access, which is important for, among other things, auditing.
11741
+ * @summary Delete customer entitlement
11742
+ */
11743
+ export const deleteCustomerEntitlementV2PathEntitlementIdOrFeatureKeyMax = 64;
11744
+ export const deleteCustomerEntitlementV2PathEntitlementIdOrFeatureKeyRegExp = new RegExp('^[a-z0-9]+(?:_[a-z0-9]+)*$|^[0-7][0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{25}$');
11745
+ export const deleteCustomerEntitlementV2Params = zod.object({
11746
+ customerIdOrKey: zod.union([
11747
+ zod.coerce
11748
+ .string()
11749
+ .regex(deleteCustomerEntitlementV2PathCustomerIdOrKeyRegExpOne)
11750
+ .describe('ULID (Universally Unique Lexicographically Sortable Identifier).'),
11751
+ zod.coerce
11752
+ .string()
11753
+ .min(1)
11754
+ .max(deleteCustomerEntitlementV2PathCustomerIdOrKeyMaxTwo)
11755
+ .describe('ExternalKey is a looser version of key.'),
11756
+ ]),
11757
+ entitlementIdOrFeatureKey: zod.coerce
11758
+ .string()
11759
+ .min(1)
11760
+ .max(deleteCustomerEntitlementV2PathEntitlementIdOrFeatureKeyMax)
11761
+ .regex(deleteCustomerEntitlementV2PathEntitlementIdOrFeatureKeyRegExp),
11762
+ });
11763
+ /**
11764
+ * List all grants issued for an entitlement. The entitlement can be defined either by its id or featureKey.
11765
+ * @summary List customer entitlement grants
11766
+ */
11767
+ export const listCustomerEntitlementGrantsV2PathEntitlementIdOrFeatureKeyMax = 64;
11768
+ export const listCustomerEntitlementGrantsV2PathEntitlementIdOrFeatureKeyRegExp = new RegExp('^[a-z0-9]+(?:_[a-z0-9]+)*$|^[0-7][0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{25}$');
11769
+ export const listCustomerEntitlementGrantsV2Params = zod.object({
11770
+ customerIdOrKey: zod.union([
11771
+ zod.coerce
11772
+ .string()
11773
+ .regex(listCustomerEntitlementGrantsV2PathCustomerIdOrKeyRegExpOne)
11774
+ .describe('ULID (Universally Unique Lexicographically Sortable Identifier).'),
11775
+ zod.coerce
11776
+ .string()
11777
+ .min(1)
11778
+ .max(listCustomerEntitlementGrantsV2PathCustomerIdOrKeyMaxTwo)
11779
+ .describe('ExternalKey is a looser version of key.'),
11780
+ ]),
11781
+ entitlementIdOrFeatureKey: zod.coerce
11782
+ .string()
11783
+ .min(1)
11784
+ .max(listCustomerEntitlementGrantsV2PathEntitlementIdOrFeatureKeyMax)
11785
+ .regex(listCustomerEntitlementGrantsV2PathEntitlementIdOrFeatureKeyRegExp),
11786
+ });
11787
+ export const listCustomerEntitlementGrantsV2QueryIncludeDeletedDefault = false;
11788
+ export const listCustomerEntitlementGrantsV2QueryPageDefault = 1;
11789
+ export const listCustomerEntitlementGrantsV2QueryPageSizeDefault = 100;
11790
+ export const listCustomerEntitlementGrantsV2QueryPageSizeMax = 1000;
11791
+ export const listCustomerEntitlementGrantsV2QueryOffsetDefault = 0;
11792
+ export const listCustomerEntitlementGrantsV2QueryOffsetMin = 0;
11793
+ export const listCustomerEntitlementGrantsV2QueryLimitDefault = 100;
11794
+ export const listCustomerEntitlementGrantsV2QueryLimitMax = 1000;
11795
+ export const listCustomerEntitlementGrantsV2QueryParams = zod.object({
11796
+ includeDeleted: zod.coerce.boolean().optional(),
11797
+ limit: zod.coerce
11798
+ .number()
11799
+ .min(1)
11800
+ .max(listCustomerEntitlementGrantsV2QueryLimitMax)
11801
+ .default(listCustomerEntitlementGrantsV2QueryLimitDefault)
11802
+ .describe('Number of items to return.\n\nDefault is 100.'),
11803
+ offset: zod.coerce
11804
+ .number()
11805
+ .min(listCustomerEntitlementGrantsV2QueryOffsetMin)
11806
+ .optional()
11807
+ .describe('Number of items to skip.\n\nDefault is 0.'),
11808
+ order: zod.enum(['ASC', 'DESC']).optional().describe('The order direction.'),
11809
+ orderBy: zod
11810
+ .enum(['id', 'createdAt', 'updatedAt'])
11811
+ .optional()
11812
+ .describe('The order by field.'),
11813
+ page: zod.coerce
11814
+ .number()
11815
+ .min(1)
11816
+ .default(listCustomerEntitlementGrantsV2QueryPageDefault)
11817
+ .describe('Page index.\n\nDefault is 1.'),
11818
+ pageSize: zod.coerce
11819
+ .number()
11820
+ .min(1)
11821
+ .max(listCustomerEntitlementGrantsV2QueryPageSizeMax)
11822
+ .default(listCustomerEntitlementGrantsV2QueryPageSizeDefault)
11823
+ .describe('The maximum number of items per page.\n\nDefault is 100.'),
11824
+ });
11825
+ /**
11826
+ * Grants define a behavior of granting usage for a metered entitlement. They can have complicated recurrence and rollover rules, thanks to which you can define a wide range of access patterns with a single grant, in most cases you don't have to periodically create new grants. You can only issue grants for active metered entitlements.
11827
+
11828
+ A grant defines a given amount of usage that can be consumed for the entitlement. The grant is in effect between its effective date and its expiration date. Specifying both is mandatory for new grants.
11829
+
11830
+ Grants have a priority setting that determines their order of use. Lower numbers have higher priority, with 0 being the highest priority.
11831
+
11832
+ Grants can have a recurrence setting intended to automate the manual reissuing of grants. For example, a daily recurrence is equal to reissuing that same grant every day (ignoring rollover settings).
11833
+
11834
+ Rollover settings define what happens to the remaining balance of a grant at a reset. Balance_After_Reset = MIN(MaxRolloverAmount, MAX(Balance_Before_Reset, MinRolloverAmount))
11835
+
11836
+ Grants cannot be changed once created, only deleted. This is to ensure that balance is deterministic regardless of when it is queried.
11837
+ * @summary Create customer entitlement grant
11838
+ */
11839
+ export const createCustomerEntitlementGrantV2PathEntitlementIdOrFeatureKeyMax = 64;
11840
+ export const createCustomerEntitlementGrantV2PathEntitlementIdOrFeatureKeyRegExp = new RegExp('^[a-z0-9]+(?:_[a-z0-9]+)*$|^[0-7][0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{25}$');
11841
+ export const createCustomerEntitlementGrantV2Params = zod.object({
11842
+ customerIdOrKey: zod.union([
11843
+ zod.coerce
11844
+ .string()
11845
+ .regex(createCustomerEntitlementGrantV2PathCustomerIdOrKeyRegExpOne)
11846
+ .describe('ULID (Universally Unique Lexicographically Sortable Identifier).'),
11847
+ zod.coerce
11848
+ .string()
11849
+ .min(1)
11850
+ .max(createCustomerEntitlementGrantV2PathCustomerIdOrKeyMaxTwo)
11851
+ .describe('ExternalKey is a looser version of key.'),
11852
+ ]),
11853
+ entitlementIdOrFeatureKey: zod.coerce
11854
+ .string()
11855
+ .min(1)
11856
+ .max(createCustomerEntitlementGrantV2PathEntitlementIdOrFeatureKeyMax)
11857
+ .regex(createCustomerEntitlementGrantV2PathEntitlementIdOrFeatureKeyRegExp),
11858
+ });
11859
+ export const createCustomerEntitlementGrantV2BodyAmountMin = 0;
11860
+ export const createCustomerEntitlementGrantV2BodyPriorityMax = 255;
11861
+ export const createCustomerEntitlementGrantV2BodyExpirationCountMax = 1000;
11862
+ export const createCustomerEntitlementGrantV2BodyMaxRolloverAmountDefault = 0;
11863
+ export const createCustomerEntitlementGrantV2BodyMinRolloverAmountDefault = 0;
11864
+ export const createCustomerEntitlementGrantV2Body = zod
11865
+ .object({
11866
+ amount: zod.coerce
11867
+ .number()
11868
+ .min(createCustomerEntitlementGrantV2BodyAmountMin)
11869
+ .describe('The amount to grant. Should be a positive number.'),
11870
+ effectiveAt: zod.coerce
11871
+ .date()
11872
+ .describe('Effective date for grants and anchor for recurring grants. Provided value will be ceiled to metering windowSize (minute).'),
11873
+ expiration: zod
11874
+ .object({
11875
+ count: zod.coerce
11876
+ .number()
11877
+ .min(1)
11878
+ .max(createCustomerEntitlementGrantV2BodyExpirationCountMax)
11879
+ .describe('The number of time units in the expiration period.'),
11880
+ duration: zod
11881
+ .enum(['HOUR', 'DAY', 'WEEK', 'MONTH', 'YEAR'])
11882
+ .describe('The expiration duration enum')
11883
+ .describe('The unit of time for the expiration period.'),
11884
+ })
11885
+ .describe('The grant expiration definition')
11886
+ .describe('The grant expiration definition'),
11887
+ maxRolloverAmount: zod.coerce
11888
+ .number()
11889
+ .optional()
11890
+ .describe('Grants are rolled over at reset, after which they can have a different balance compared to what they had before the reset.\nBalance after the reset is calculated as: Balance_After_Reset = MIN(MaxRolloverAmount, MAX(Balance_Before_Reset, MinRolloverAmount))'),
11891
+ metadata: zod
11892
+ .record(zod.string(), zod.coerce.string())
11893
+ .describe('Set of key-value pairs.\nMetadata can be used to store additional information about a resource.')
11894
+ .optional()
11895
+ .describe('The grant metadata.'),
11896
+ minRolloverAmount: zod.coerce
11897
+ .number()
11898
+ .optional()
11899
+ .describe('Grants are rolled over at reset, after which they can have a different balance compared to what they had before the reset.\nBalance after the reset is calculated as: Balance_After_Reset = MIN(MaxRolloverAmount, MAX(Balance_Before_Reset, MinRolloverAmount))'),
11900
+ priority: zod.coerce
11901
+ .number()
11902
+ .min(1)
11903
+ .max(createCustomerEntitlementGrantV2BodyPriorityMax)
11904
+ .optional()
11905
+ .describe('The priority of the grant. Grants with higher priority are applied first.\nPriority is a positive decimal numbers. With lower numbers indicating higher importance.\nFor example, a priority of 1 is more urgent than a priority of 2.\nWhen there are several grants available for the same subject, the system selects the grant with the highest priority.\nIn cases where grants share the same priority level, the grant closest to its expiration will be used first.\nIn the case of two grants have identical priorities and expiration dates, the system will use the grant that was created first.'),
11906
+ recurrence: zod
11907
+ .object({
11908
+ anchor: zod.coerce
11909
+ .date()
11910
+ .optional()
11911
+ .describe('A date-time anchor to base the recurring period on.'),
11912
+ interval: zod
11913
+ .union([
11914
+ zod.coerce.string(),
11915
+ zod
11916
+ .enum(['DAY', 'WEEK', 'MONTH', 'YEAR'])
11917
+ .describe('The unit of time for the interval.\nOne of: `day`, `week`, `month`, or `year`.'),
11918
+ ])
11919
+ .describe('Period duration for the recurrence')
11920
+ .describe('The unit of time for the interval.'),
11921
+ })
11922
+ .describe('Recurring period with an interval and an anchor.')
11923
+ .optional()
11924
+ .describe('The subject of the grant.'),
11925
+ })
11926
+ .describe('The grant creation input.');
11927
+ /**
11928
+ * Returns historical balance and usage data for the entitlement. The queried history can span accross multiple reset events.
11929
+
11930
+ BurndownHistory returns a continous history of segments, where the segments are seperated by events that changed either the grant burndown priority or the usage period.
11931
+
11932
+ WindowedHistory returns windowed usage data for the period enriched with balance information and the list of grants that were being burnt down in that window.
11933
+ * @summary Get customer entitlement history
11934
+ */
11935
+ export const getCustomerEntitlementHistoryV2PathEntitlementIdOrFeatureKeyMax = 64;
11936
+ export const getCustomerEntitlementHistoryV2PathEntitlementIdOrFeatureKeyRegExp = new RegExp('^[a-z0-9]+(?:_[a-z0-9]+)*$|^[0-7][0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{25}$');
11937
+ export const getCustomerEntitlementHistoryV2Params = zod.object({
11938
+ customerIdOrKey: zod.union([
11939
+ zod.coerce
11940
+ .string()
11941
+ .regex(getCustomerEntitlementHistoryV2PathCustomerIdOrKeyRegExpOne)
11942
+ .describe('ULID (Universally Unique Lexicographically Sortable Identifier).'),
11943
+ zod.coerce
11944
+ .string()
11945
+ .min(1)
11946
+ .max(getCustomerEntitlementHistoryV2PathCustomerIdOrKeyMaxTwo)
11947
+ .describe('ExternalKey is a looser version of key.'),
11948
+ ]),
11949
+ entitlementIdOrFeatureKey: zod.coerce
11950
+ .string()
11951
+ .min(1)
11952
+ .max(getCustomerEntitlementHistoryV2PathEntitlementIdOrFeatureKeyMax)
11953
+ .regex(getCustomerEntitlementHistoryV2PathEntitlementIdOrFeatureKeyRegExp),
11954
+ });
11955
+ export const getCustomerEntitlementHistoryV2QueryWindowTimeZoneDefault = 'UTC';
11956
+ export const getCustomerEntitlementHistoryV2QueryParams = zod.object({
11957
+ from: zod.coerce
11958
+ .date()
11959
+ .optional()
11960
+ .describe('Start of time range to query entitlement: date-time in RFC 3339 format. Defaults to the last reset. Gets truncated to the granularity of the underlying meter.'),
11961
+ to: zod.coerce
11962
+ .date()
11963
+ .optional()
11964
+ .describe('End of time range to query entitlement: date-time in RFC 3339 format. Defaults to now.\nIf not now then gets truncated to the granularity of the underlying meter.'),
11965
+ windowSize: zod
11966
+ .enum(['MINUTE', 'HOUR', 'DAY', 'MONTH'])
11967
+ .describe('Windowsize'),
11968
+ windowTimeZone: zod.coerce
11969
+ .string()
11970
+ .default(getCustomerEntitlementHistoryV2QueryWindowTimeZoneDefault)
11971
+ .describe('The timezone used when calculating the windows.'),
11972
+ });
11973
+ /**
11974
+ * Overriding an entitlement creates a new entitlement from the provided inputs and soft deletes the previous entitlement for the provided customer-feature pair. If the previous entitlement is already deleted or otherwise doesnt exist, the override will fail.
11975
+
11976
+ This endpoint is useful for upgrades, downgrades, or other changes to entitlements that require a new entitlement to be created with zero downtime.
11977
+ * @summary Override customer entitlement
11978
+ */
11979
+ export const overrideCustomerEntitlementV2Params = zod.object({
11980
+ customerIdOrKey: zod.union([
11981
+ zod.coerce
11982
+ .string()
11983
+ .regex(overrideCustomerEntitlementV2PathCustomerIdOrKeyRegExpOne)
11984
+ .describe('ULID (Universally Unique Lexicographically Sortable Identifier).'),
11985
+ zod.coerce
11986
+ .string()
11987
+ .min(1)
11988
+ .max(overrideCustomerEntitlementV2PathCustomerIdOrKeyMaxTwo)
11989
+ .describe('ExternalKey is a looser version of key.'),
11990
+ ]),
11991
+ entitlementIdOrFeatureKey: zod.union([
11992
+ zod.coerce
11993
+ .string()
11994
+ .regex(overrideCustomerEntitlementV2PathEntitlementIdOrFeatureKeyRegExpOne)
11995
+ .describe('ULID (Universally Unique Lexicographically Sortable Identifier).'),
11996
+ zod.coerce
11997
+ .string()
11998
+ .min(1)
11999
+ .max(overrideCustomerEntitlementV2PathEntitlementIdOrFeatureKeyMaxTwo)
12000
+ .describe('ExternalKey is a looser version of key.'),
12001
+ ]),
12002
+ });
12003
+ export const overrideCustomerEntitlementV2BodyFeatureKeyMax = 64;
12004
+ export const overrideCustomerEntitlementV2BodyFeatureKeyRegExp = new RegExp('^[a-z0-9]+(?:_[a-z0-9]+)*$');
12005
+ export const overrideCustomerEntitlementV2BodyFeatureIdRegExp = new RegExp('^[0-7][0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{25}$');
12006
+ export const overrideCustomerEntitlementV2BodyIsSoftLimitDefault = false;
12007
+ export const overrideCustomerEntitlementV2BodyIsUnlimitedDefault = false;
12008
+ export const overrideCustomerEntitlementV2BodyIssueAfterResetMin = 0;
12009
+ export const overrideCustomerEntitlementV2BodyIssueAfterResetPriorityDefault = 1;
12010
+ export const overrideCustomerEntitlementV2BodyIssueAfterResetPriorityMax = 255;
12011
+ export const overrideCustomerEntitlementV2BodyPreserveOverageAtResetDefault = false;
12012
+ export const overrideCustomerEntitlementV2BodyFeatureKeyMaxOne = 64;
12013
+ export const overrideCustomerEntitlementV2BodyFeatureKeyRegExpOne = new RegExp('^[a-z0-9]+(?:_[a-z0-9]+)*$');
12014
+ export const overrideCustomerEntitlementV2BodyFeatureIdRegExpOne = new RegExp('^[0-7][0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{25}$');
12015
+ export const overrideCustomerEntitlementV2BodyFeatureKeyMaxTwo = 64;
12016
+ export const overrideCustomerEntitlementV2BodyFeatureKeyRegExpTwo = new RegExp('^[a-z0-9]+(?:_[a-z0-9]+)*$');
12017
+ export const overrideCustomerEntitlementV2BodyFeatureIdRegExpTwo = new RegExp('^[0-7][0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{25}$');
12018
+ export const overrideCustomerEntitlementV2Body = zod
12019
+ .union([
12020
+ zod
12021
+ .object({
12022
+ featureId: zod.coerce
12023
+ .string()
12024
+ .regex(overrideCustomerEntitlementV2BodyFeatureIdRegExp)
12025
+ .optional()
12026
+ .describe('The feature the subject is entitled to use.\nEither featureKey or featureId is required.'),
12027
+ featureKey: zod.coerce
12028
+ .string()
12029
+ .min(1)
12030
+ .max(overrideCustomerEntitlementV2BodyFeatureKeyMax)
12031
+ .regex(overrideCustomerEntitlementV2BodyFeatureKeyRegExp)
12032
+ .optional()
12033
+ .describe('The feature the subject is entitled to use.\nEither featureKey or featureId is required.'),
12034
+ isSoftLimit: zod.coerce
12035
+ .boolean()
12036
+ .optional()
12037
+ .describe('If softLimit=true the subject can use the feature even if the entitlement is exhausted, hasAccess will always be true.'),
12038
+ issueAfterReset: zod.coerce
12039
+ .number()
12040
+ .min(overrideCustomerEntitlementV2BodyIssueAfterResetMin)
12041
+ .optional()
12042
+ .describe('You can grant usage automatically alongside the entitlement, the example scenario would be creating a starting balance.\nIf an amount is specified here, a grant will be created alongside the entitlement with the specified amount.\nThat grant will have it\'s rollover settings configured in a way that after each reset operation, the balance will return the original amount specified here.\nManually creating such a grant would mean having the \"amount\", \"minRolloverAmount\", and \"maxRolloverAmount\" fields all be the same.'),
12043
+ issueAfterResetPriority: zod.coerce
12044
+ .number()
12045
+ .min(1)
12046
+ .max(overrideCustomerEntitlementV2BodyIssueAfterResetPriorityMax)
12047
+ .default(overrideCustomerEntitlementV2BodyIssueAfterResetPriorityDefault)
12048
+ .describe('Defines the grant priority for the default grant.'),
12049
+ isUnlimited: zod.coerce
12050
+ .boolean()
12051
+ .optional()
12052
+ .describe('Deprecated, ignored by the backend. Please use isSoftLimit instead; this field will be removed in the future.'),
12053
+ measureUsageFrom: zod
12054
+ .union([
12055
+ zod
12056
+ .enum(['CURRENT_PERIOD_START', 'NOW'])
12057
+ .describe('Start of measurement options'),
12081
12058
  zod.coerce
12082
12059
  .date()
12083
12060
  .describe('[RFC3339](https://tools.ietf.org/html/rfc3339) formatted date-time string in UTC.'),
12084
12061
  ])
12085
- .describe('Subscription edit timing defined when the changes should take effect.\nIf the provided configuration is not supported by the subscription, an error will be returned.')
12086
- .describe('Timing configuration for the change, when the change should take effect.\nFor changing a subscription, the accepted values depend on the subscription configuration.'),
12062
+ .describe('Measure usage from')
12063
+ .optional()
12064
+ .describe('Defines the time from which usage is measured. If not specified on creation, defaults to entitlement creation time.'),
12065
+ metadata: zod
12066
+ .record(zod.string(), zod.coerce.string())
12067
+ .describe('Set of key-value pairs.\nMetadata can be used to store additional information about a resource.')
12068
+ .optional()
12069
+ .describe('Additional metadata for the feature.'),
12070
+ preserveOverageAtReset: zod.coerce
12071
+ .boolean()
12072
+ .optional()
12073
+ .describe('If true, the overage is preserved at reset. If false, the usage is reset to 0.'),
12074
+ type: zod.enum(['metered']),
12075
+ usagePeriod: zod
12076
+ .object({
12077
+ anchor: zod.coerce
12078
+ .date()
12079
+ .optional()
12080
+ .describe('A date-time anchor to base the recurring period on.'),
12081
+ interval: zod
12082
+ .union([
12083
+ zod.coerce.string(),
12084
+ zod
12085
+ .enum(['DAY', 'WEEK', 'MONTH', 'YEAR'])
12086
+ .describe('The unit of time for the interval.\nOne of: `day`, `week`, `month`, or `year`.'),
12087
+ ])
12088
+ .describe('Period duration for the recurrence')
12089
+ .describe('The unit of time for the interval.'),
12090
+ })
12091
+ .describe('Recurring period with an interval and an anchor.')
12092
+ .describe('The usage period associated with the entitlement.'),
12087
12093
  })
12088
- .describe('Change a custom subscription.'),
12094
+ .describe('Create inpurs for metered entitlement'),
12095
+ zod
12096
+ .object({
12097
+ config: zod.coerce
12098
+ .string()
12099
+ .describe('The JSON parsable config of the entitlement. This value is also returned when checking entitlement access and it is useful for configuring fine-grained access settings to the feature, implemented in your own system. Has to be an object.'),
12100
+ featureId: zod.coerce
12101
+ .string()
12102
+ .regex(overrideCustomerEntitlementV2BodyFeatureIdRegExpOne)
12103
+ .optional()
12104
+ .describe('The feature the subject is entitled to use.\nEither featureKey or featureId is required.'),
12105
+ featureKey: zod.coerce
12106
+ .string()
12107
+ .min(1)
12108
+ .max(overrideCustomerEntitlementV2BodyFeatureKeyMaxOne)
12109
+ .regex(overrideCustomerEntitlementV2BodyFeatureKeyRegExpOne)
12110
+ .optional()
12111
+ .describe('The feature the subject is entitled to use.\nEither featureKey or featureId is required.'),
12112
+ metadata: zod
12113
+ .record(zod.string(), zod.coerce.string())
12114
+ .describe('Set of key-value pairs.\nMetadata can be used to store additional information about a resource.')
12115
+ .optional()
12116
+ .describe('Additional metadata for the feature.'),
12117
+ type: zod.enum(['static']),
12118
+ usagePeriod: zod
12119
+ .object({
12120
+ anchor: zod.coerce
12121
+ .date()
12122
+ .optional()
12123
+ .describe('A date-time anchor to base the recurring period on.'),
12124
+ interval: zod
12125
+ .union([
12126
+ zod.coerce.string(),
12127
+ zod
12128
+ .enum(['DAY', 'WEEK', 'MONTH', 'YEAR'])
12129
+ .describe('The unit of time for the interval.\nOne of: `day`, `week`, `month`, or `year`.'),
12130
+ ])
12131
+ .describe('Period duration for the recurrence')
12132
+ .describe('The unit of time for the interval.'),
12133
+ })
12134
+ .describe('Recurring period with an interval and an anchor.')
12135
+ .optional()
12136
+ .describe('The usage period associated with the entitlement.'),
12137
+ })
12138
+ .describe('Create inputs for static entitlement'),
12139
+ zod
12140
+ .object({
12141
+ featureId: zod.coerce
12142
+ .string()
12143
+ .regex(overrideCustomerEntitlementV2BodyFeatureIdRegExpTwo)
12144
+ .optional()
12145
+ .describe('The feature the subject is entitled to use.\nEither featureKey or featureId is required.'),
12146
+ featureKey: zod.coerce
12147
+ .string()
12148
+ .min(1)
12149
+ .max(overrideCustomerEntitlementV2BodyFeatureKeyMaxTwo)
12150
+ .regex(overrideCustomerEntitlementV2BodyFeatureKeyRegExpTwo)
12151
+ .optional()
12152
+ .describe('The feature the subject is entitled to use.\nEither featureKey or featureId is required.'),
12153
+ metadata: zod
12154
+ .record(zod.string(), zod.coerce.string())
12155
+ .describe('Set of key-value pairs.\nMetadata can be used to store additional information about a resource.')
12156
+ .optional()
12157
+ .describe('Additional metadata for the feature.'),
12158
+ type: zod.enum(['boolean']),
12159
+ usagePeriod: zod
12160
+ .object({
12161
+ anchor: zod.coerce
12162
+ .date()
12163
+ .optional()
12164
+ .describe('A date-time anchor to base the recurring period on.'),
12165
+ interval: zod
12166
+ .union([
12167
+ zod.coerce.string(),
12168
+ zod
12169
+ .enum(['DAY', 'WEEK', 'MONTH', 'YEAR'])
12170
+ .describe('The unit of time for the interval.\nOne of: `day`, `week`, `month`, or `year`.'),
12171
+ ])
12172
+ .describe('Period duration for the recurrence')
12173
+ .describe('The unit of time for the interval.'),
12174
+ })
12175
+ .describe('Recurring period with an interval and an anchor.')
12176
+ .optional()
12177
+ .describe('The usage period associated with the entitlement.'),
12178
+ })
12179
+ .describe('Create inputs for boolean entitlement'),
12089
12180
  ])
12090
- .describe('Change a subscription.');
12181
+ .describe('Create inputs for entitlement');
12091
12182
  /**
12092
- * Migrates the subscripiton to the provided version of the current plan.
12093
- If possible, the migration will be done immediately.
12094
- If not, the migration will be scheduled to the end of the current billing period.
12095
- * @summary Migrate subscription
12183
+ * Reset marks the start of a new usage period for the entitlement and initiates grant rollover. At the start of a period usage is zerod out and grants are rolled over based on their rollover settings. It would typically be synced with the customers billing period to enforce usage based on their subscription.
12184
+
12185
+ Usage is automatically reset for metered entitlements based on their usage period, but this endpoint allows to manually reset it at any time. When doing so the period anchor of the entitlement can be changed if needed.
12186
+ * @summary Reset customer entitlement
12096
12187
  */
12097
- export const migrateSubscriptionPathSubscriptionIdRegExp = new RegExp('^[0-7][0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{25}$');
12098
- export const migrateSubscriptionParams = zod.object({
12099
- subscriptionId: zod.coerce
12188
+ export const resetCustomerEntitlementUsageV2PathEntitlementIdOrFeatureKeyMax = 64;
12189
+ export const resetCustomerEntitlementUsageV2PathEntitlementIdOrFeatureKeyRegExp = new RegExp('^[a-z0-9]+(?:_[a-z0-9]+)*$|^[0-7][0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{25}$');
12190
+ export const resetCustomerEntitlementUsageV2Params = zod.object({
12191
+ customerIdOrKey: zod.union([
12192
+ zod.coerce
12193
+ .string()
12194
+ .regex(resetCustomerEntitlementUsageV2PathCustomerIdOrKeyRegExpOne)
12195
+ .describe('ULID (Universally Unique Lexicographically Sortable Identifier).'),
12196
+ zod.coerce
12197
+ .string()
12198
+ .min(1)
12199
+ .max(resetCustomerEntitlementUsageV2PathCustomerIdOrKeyMaxTwo)
12200
+ .describe('ExternalKey is a looser version of key.'),
12201
+ ]),
12202
+ entitlementIdOrFeatureKey: zod.coerce
12100
12203
  .string()
12101
- .regex(migrateSubscriptionPathSubscriptionIdRegExp),
12204
+ .min(1)
12205
+ .max(resetCustomerEntitlementUsageV2PathEntitlementIdOrFeatureKeyMax)
12206
+ .regex(resetCustomerEntitlementUsageV2PathEntitlementIdOrFeatureKeyRegExp),
12102
12207
  });
12103
- export const migrateSubscriptionBodyTimingDefault = 'immediate';
12104
- export const migrateSubscriptionBody = zod.object({
12105
- billingAnchor: zod.coerce
12208
+ export const resetCustomerEntitlementUsageV2Body = zod
12209
+ .object({
12210
+ effectiveAt: zod.coerce
12106
12211
  .date()
12107
12212
  .optional()
12108
- .describe('The billing anchor of the subscription. The provided date will be normalized according to the billing cadence to the nearest recurrence before start time. If not provided, the previous subscription billing anchor will be used.'),
12109
- startingPhase: zod.coerce
12110
- .string()
12111
- .min(1)
12213
+ .describe('The time at which the reset takes effect, defaults to now. The reset cannot be in the future. The provided value is truncated to the minute due to how historical meter data is stored.'),
12214
+ preserveOverage: zod.coerce
12215
+ .boolean()
12112
12216
  .optional()
12113
- .describe('The key of the phase to start the subscription in.\nIf not provided, the subscription will start in the first phase of the plan.'),
12114
- targetVersion: zod.coerce
12115
- .number()
12116
- .min(1)
12217
+ .describe("Determines whether the overage is preserved or forgiven, overriding the entitlement's default behavior.\n- If true, the overage is preserved.\n- If false, the overage is forgiven."),
12218
+ retainAnchor: zod.coerce
12219
+ .boolean()
12117
12220
  .optional()
12118
- .describe('The version of the plan to migrate to.\nIf not provided, the subscription will migrate to the latest version of the current plan.'),
12119
- timing: zod
12120
- .union([
12121
- zod
12122
- .enum(['immediate', 'next_billing_cycle'])
12123
- .describe('Subscription edit timing.\nWhen immediate, the requested changes take effect immediately.\nWhen nextBillingCycle, the requested changes take effect at the next billing cycle.'),
12124
- zod.coerce
12125
- .date()
12126
- .describe('[RFC3339](https://tools.ietf.org/html/rfc3339) formatted date-time string in UTC.'),
12127
- ])
12128
- .describe('Subscription edit timing defined when the changes should take effect.\nIf the provided configuration is not supported by the subscription, an error will be returned.')
12129
- .default(migrateSubscriptionBodyTimingDefault)
12130
- .describe('Timing configuration for the migration, when the migration should take effect.\nIf not supported by the subscription, 400 will be returned.'),
12131
- });
12221
+ .describe('Determines whether the usage period anchor is retained or reset to the effectiveAt time.\n- If true, the usage period anchor is retained.\n- If false, the usage period anchor is reset to the effectiveAt time.'),
12222
+ })
12223
+ .describe('Reset parameters');
12132
12224
  /**
12133
- * Restores a canceled subscription.
12134
- Any subscription scheduled to start later will be deleted and this subscription will be continued indefinitely.
12135
- * @summary Restore subscription
12225
+ * Checks customer access to a given feature (by key). All entitlement types share the hasAccess property in their value response, but multiple other properties are returned based on the entitlement type.
12226
+ * @summary Get customer entitlement value
12136
12227
  */
12137
- export const restoreSubscriptionPathSubscriptionIdRegExp = new RegExp('^[0-7][0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{25}$');
12138
- export const restoreSubscriptionParams = zod.object({
12139
- subscriptionId: zod.coerce
12228
+ export const getCustomerEntitlementValueV2PathEntitlementIdOrFeatureKeyMax = 64;
12229
+ export const getCustomerEntitlementValueV2PathEntitlementIdOrFeatureKeyRegExp = new RegExp('^[a-z0-9]+(?:_[a-z0-9]+)*$|^[0-7][0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{25}$');
12230
+ export const getCustomerEntitlementValueV2Params = zod.object({
12231
+ customerIdOrKey: zod.union([
12232
+ zod.coerce
12233
+ .string()
12234
+ .regex(getCustomerEntitlementValueV2PathCustomerIdOrKeyRegExpOne)
12235
+ .describe('ULID (Universally Unique Lexicographically Sortable Identifier).'),
12236
+ zod.coerce
12237
+ .string()
12238
+ .min(1)
12239
+ .max(getCustomerEntitlementValueV2PathCustomerIdOrKeyMaxTwo)
12240
+ .describe('ExternalKey is a looser version of key.'),
12241
+ ]),
12242
+ entitlementIdOrFeatureKey: zod.coerce
12140
12243
  .string()
12141
- .regex(restoreSubscriptionPathSubscriptionIdRegExp),
12244
+ .min(1)
12245
+ .max(getCustomerEntitlementValueV2PathEntitlementIdOrFeatureKeyMax)
12246
+ .regex(getCustomerEntitlementValueV2PathEntitlementIdOrFeatureKeyRegExp),
12142
12247
  });
12143
- /**
12144
- * Cancels the scheduled cancelation.
12145
- * @summary Unschedule cancelation
12146
- */
12147
- export const unscheduleCancelationPathSubscriptionIdRegExp = new RegExp('^[0-7][0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{25}$');
12148
- export const unscheduleCancelationParams = zod.object({
12149
- subscriptionId: zod.coerce
12150
- .string()
12151
- .regex(unscheduleCancelationPathSubscriptionIdRegExp),
12248
+ export const getCustomerEntitlementValueV2QueryParams = zod.object({
12249
+ time: zod.coerce.date().optional(),
12152
12250
  });
12153
12251
  /**
12154
12252
  * List ingested events with advanced filtering and cursor pagination.
@@ -12175,4 +12273,68 @@ export const listEventsV2QueryParams = zod.object({
12175
12273
  .default(listEventsV2QueryLimitDefault)
12176
12274
  .describe('The limit of the pagination.'),
12177
12275
  });
12276
+ /**
12277
+ * List all grants for all the subjects and entitlements. This endpoint is intended for administrative purposes only.
12278
+ To fetch the grants of a specific entitlement please use the /api/v1/subjects/{subjectKeyOrID}/entitlements/{entitlementOrFeatureID}/grants endpoint.
12279
+ If page is provided that takes precedence and the paginated response is returned.
12280
+ * @summary List grants
12281
+ */
12282
+ export const listGrantsV2QueryIncludeDeletedDefault = false;
12283
+ export const listGrantsV2QueryPageDefault = 1;
12284
+ export const listGrantsV2QueryPageSizeDefault = 100;
12285
+ export const listGrantsV2QueryPageSizeMax = 1000;
12286
+ export const listGrantsV2QueryOffsetDefault = 0;
12287
+ export const listGrantsV2QueryOffsetMin = 0;
12288
+ export const listGrantsV2QueryLimitDefault = 100;
12289
+ export const listGrantsV2QueryLimitMax = 1000;
12290
+ export const listGrantsV2QueryParams = zod.object({
12291
+ customer: zod
12292
+ .array(zod
12293
+ .union([
12294
+ zod.coerce
12295
+ .string()
12296
+ .regex(listGrantsV2QueryCustomerItemRegExpOne)
12297
+ .describe('ULID (Universally Unique Lexicographically Sortable Identifier).'),
12298
+ zod.coerce
12299
+ .string()
12300
+ .min(1)
12301
+ .max(listGrantsV2QueryCustomerItemMaxTwo)
12302
+ .describe('ExternalKey is a looser version of key.'),
12303
+ ])
12304
+ .describe('ULID (Universally Unique Lexicographically Sortable Identifier) or external unique key.'))
12305
+ .optional()
12306
+ .describe('Filtering by multiple customers (either by ID or key).\n\nUsage: `?customer=customer-1&customer=customer-2`'),
12307
+ feature: zod
12308
+ .array(zod.coerce.string())
12309
+ .optional()
12310
+ .describe('Filtering by multiple features.\n\nUsage: `?feature=feature-1&feature=feature-2`'),
12311
+ includeDeleted: zod.coerce.boolean().optional().describe('Include deleted'),
12312
+ limit: zod.coerce
12313
+ .number()
12314
+ .min(1)
12315
+ .max(listGrantsV2QueryLimitMax)
12316
+ .default(listGrantsV2QueryLimitDefault)
12317
+ .describe('Number of items to return.\n\nDefault is 100.'),
12318
+ offset: zod.coerce
12319
+ .number()
12320
+ .min(listGrantsV2QueryOffsetMin)
12321
+ .optional()
12322
+ .describe('Number of items to skip.\n\nDefault is 0.'),
12323
+ order: zod.enum(['ASC', 'DESC']).optional().describe('The order direction.'),
12324
+ orderBy: zod
12325
+ .enum(['id', 'createdAt', 'updatedAt'])
12326
+ .optional()
12327
+ .describe('The order by field.'),
12328
+ page: zod.coerce
12329
+ .number()
12330
+ .min(1)
12331
+ .default(listGrantsV2QueryPageDefault)
12332
+ .describe('Page index.\n\nDefault is 1.'),
12333
+ pageSize: zod.coerce
12334
+ .number()
12335
+ .min(1)
12336
+ .max(listGrantsV2QueryPageSizeMax)
12337
+ .default(listGrantsV2QueryPageSizeDefault)
12338
+ .describe('The maximum number of items per page.\n\nDefault is 100.'),
12339
+ });
12178
12340
  //# sourceMappingURL=index.js.map