@openmeter/sdk 1.0.0-beta.221 → 1.0.0-beta.223
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/src/client/customers.cjs +188 -2
- package/dist/cjs/src/client/customers.d.cts +363 -1
- package/dist/cjs/src/client/customers.js.map +1 -1
- package/dist/cjs/src/client/entitlements.cjs +92 -1
- package/dist/cjs/src/client/entitlements.d.cts +139 -28
- package/dist/cjs/src/client/entitlements.js.map +1 -1
- package/dist/cjs/src/client/index.cjs +3 -1
- package/dist/cjs/src/client/index.d.cts +3 -2
- package/dist/cjs/src/client/index.js.map +1 -1
- package/dist/cjs/src/client/schemas.d.cts +2551 -1738
- package/dist/cjs/src/client/subjects.d.cts +9 -0
- package/dist/cjs/src/zod/index.cjs +1890 -1639
- package/dist/cjs/src/zod/index.d.cts +1751 -1585
- package/dist/cjs/src/zod/index.js.map +1 -1
- package/dist/cjs/{tsconfig.0bedc47d.tsbuildinfo → tsconfig.07c9b9a6.tsbuildinfo} +1 -1
- package/dist/cjs/{tsconfig.c449a50f.tsbuildinfo → tsconfig.5c5dbdc6.tsbuildinfo} +1 -1
- package/dist/src/client/customers.d.ts +363 -1
- package/dist/src/client/customers.js +186 -1
- package/dist/src/client/customers.js.map +1 -1
- package/dist/src/client/entitlements.d.ts +139 -28
- package/dist/src/client/entitlements.js +89 -0
- package/dist/src/client/entitlements.js.map +1 -1
- package/dist/src/client/index.d.ts +3 -2
- package/dist/src/client/index.js +4 -2
- package/dist/src/client/index.js.map +1 -1
- package/dist/src/client/schemas.d.ts +2551 -1738
- package/dist/src/client/subjects.d.ts +9 -0
- package/dist/src/zod/index.d.ts +1751 -1585
- package/dist/src/zod/index.js +1873 -1623
- package/dist/src/zod/index.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +1 -1
package/dist/src/zod/index.js
CHANGED
|
@@ -5011,900 +5011,510 @@ export const deleteCustomerAppDataParams = zod.object({
|
|
|
5011
5011
|
]),
|
|
5012
5012
|
});
|
|
5013
5013
|
/**
|
|
5014
|
-
*
|
|
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
|
|
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(
|
|
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(
|
|
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
|
-
*
|
|
5219
|
-
|
|
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
|
|
5045
|
+
export const getCustomerStripeAppDataParams = zod.object({
|
|
5222
5046
|
customerIdOrKey: zod.union([
|
|
5223
5047
|
zod.coerce
|
|
5224
5048
|
.string()
|
|
5225
|
-
.regex(
|
|
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(
|
|
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
|
-
*
|
|
5240
|
-
|
|
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
|
|
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(
|
|
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(
|
|
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
|
-
*
|
|
5264
|
-
|
|
5265
|
-
|
|
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
|
|
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(
|
|
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(
|
|
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
|
-
*
|
|
5289
|
-
* @summary List customer
|
|
5123
|
+
* Lists all subscriptions for a customer.
|
|
5124
|
+
* @summary List customer subscriptions
|
|
5290
5125
|
*/
|
|
5291
|
-
export const
|
|
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(
|
|
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(
|
|
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
5138
|
});
|
|
5311
|
-
export const
|
|
5312
|
-
export const
|
|
5313
|
-
|
|
5314
|
-
|
|
5315
|
-
|
|
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(
|
|
5360
|
-
.
|
|
5361
|
-
|
|
5362
|
-
|
|
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('
|
|
5382
|
-
|
|
5383
|
-
.
|
|
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('
|
|
5387
|
-
|
|
5388
|
-
.
|
|
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('
|
|
5391
|
-
|
|
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(
|
|
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('
|
|
5397
|
-
|
|
5398
|
-
|
|
5399
|
-
|
|
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
|
|
5416
|
-
|
|
5417
|
-
|
|
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
|
-
*
|
|
5420
|
-
|
|
5421
|
-
|
|
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
|
-
|
|
5424
|
-
* @summary
|
|
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
|
|
5427
|
-
export const
|
|
5428
|
-
export const
|
|
5429
|
-
|
|
5430
|
-
|
|
5431
|
-
|
|
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(
|
|
5444
|
-
.
|
|
5445
|
-
|
|
5446
|
-
|
|
5447
|
-
|
|
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
|
|
5452
|
-
|
|
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('
|
|
5456
|
-
|
|
5457
|
-
.
|
|
5458
|
-
.
|
|
5459
|
-
|
|
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
|
-
.
|
|
5462
|
-
.describe('The
|
|
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
|
-
*
|
|
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
|
|
5471
|
-
export const
|
|
5472
|
-
export const
|
|
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
|
-
|
|
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
|
-
.
|
|
5512
|
-
.
|
|
5513
|
-
.
|
|
5514
|
-
|
|
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
|
-
.
|
|
5518
|
-
|
|
5519
|
-
.
|
|
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
|
-
.
|
|
5534
|
-
|
|
5535
|
-
.
|
|
5536
|
-
|
|
5537
|
-
.
|
|
5538
|
-
|
|
5539
|
-
.
|
|
5540
|
-
|
|
5541
|
-
.
|
|
5542
|
-
|
|
5543
|
-
|
|
5544
|
-
|
|
5545
|
-
|
|
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('
|
|
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
|
-
|
|
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
|
-
.
|
|
5587
|
-
|
|
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
|
-
.
|
|
5590
|
-
.
|
|
5591
|
-
|
|
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
|
-
.
|
|
5596
|
-
|
|
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
|
-
.
|
|
5631
|
-
.
|
|
5632
|
-
|
|
5633
|
-
|
|
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
|
-
.
|
|
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('
|
|
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('
|
|
5368
|
+
.describe('The body of the events request.\nEither a single event or a batch of events.');
|
|
5669
5369
|
/**
|
|
5670
|
-
*
|
|
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
|
|
5676
|
-
export const
|
|
5677
|
-
export const
|
|
5678
|
-
|
|
5679
|
-
|
|
5680
|
-
|
|
5681
|
-
|
|
5682
|
-
|
|
5683
|
-
|
|
5684
|
-
|
|
5685
|
-
|
|
5686
|
-
|
|
5687
|
-
|
|
5688
|
-
|
|
5689
|
-
|
|
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(
|
|
5693
|
-
.
|
|
5694
|
-
|
|
5695
|
-
|
|
5696
|
-
|
|
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('
|
|
5701
|
-
|
|
5702
|
-
.
|
|
5395
|
+
.describe('Filter by meterSlug'),
|
|
5396
|
+
offset: zod.coerce
|
|
5397
|
+
.number()
|
|
5398
|
+
.min(listFeaturesQueryOffsetMin)
|
|
5703
5399
|
.optional()
|
|
5704
|
-
.describe(
|
|
5705
|
-
|
|
5706
|
-
|
|
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('
|
|
5709
|
-
|
|
5710
|
-
|
|
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
|
-
*
|
|
5713
|
-
|
|
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
|
|
5716
|
-
export const
|
|
5717
|
-
export const
|
|
5718
|
-
|
|
5719
|
-
|
|
5720
|
-
|
|
5721
|
-
|
|
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(
|
|
5733
|
-
.regex(
|
|
5734
|
-
|
|
5735
|
-
|
|
5736
|
-
|
|
5737
|
-
|
|
5738
|
-
|
|
5739
|
-
|
|
5740
|
-
|
|
5741
|
-
|
|
5742
|
-
|
|
5743
|
-
|
|
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('
|
|
5451
|
+
.describe('A key is a unique string that is used to identify a resource.'),
|
|
5452
|
+
name: zod.coerce.string(),
|
|
5781
5453
|
})
|
|
5782
|
-
.describe('
|
|
5454
|
+
.describe('Represents a feature that can be enabled or disabled for a plan.\nUsed both for product catalog and entitlements.');
|
|
5783
5455
|
/**
|
|
5784
|
-
*
|
|
5785
|
-
|
|
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
|
|
5792
|
-
|
|
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
|
-
*
|
|
5822
|
-
|
|
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
|
|
5825
|
-
|
|
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
|
|
5855
|
-
To fetch the
|
|
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
|
|
5476
|
+
* @summary List grants
|
|
5858
5477
|
*/
|
|
5859
|
-
export const
|
|
5860
|
-
export const
|
|
5861
|
-
export const
|
|
5862
|
-
export const
|
|
5863
|
-
export const
|
|
5864
|
-
export const
|
|
5865
|
-
export const
|
|
5866
|
-
export const
|
|
5867
|
-
export const
|
|
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(
|
|
5886
|
-
.default(
|
|
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(
|
|
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(
|
|
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(
|
|
5907
|
-
.default(
|
|
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,956 +5522,648 @@ 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
|
-
*
|
|
5916
|
-
|
|
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
|
|
5919
|
-
|
|
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
|
-
*
|
|
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
|
|
5931
|
-
|
|
5932
|
-
|
|
5933
|
-
|
|
5934
|
-
|
|
5935
|
-
|
|
5936
|
-
|
|
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
|
-
.
|
|
5939
|
-
.
|
|
5940
|
-
|
|
5941
|
-
customerId: zod
|
|
5942
|
-
.array(zod.coerce
|
|
5943
|
-
.string()
|
|
5944
|
-
.regex(listEventsQueryCustomerIdItemRegExp)
|
|
5945
|
-
.describe('ULID (Universally Unique Lexicographically Sortable Identifier).'))
|
|
5946
|
-
.optional()
|
|
5947
|
-
.describe('The event customer ID.'),
|
|
5948
|
-
from: zod.coerce
|
|
5949
|
-
.date()
|
|
5950
|
-
.optional()
|
|
5951
|
-
.describe('Start date-time in RFC 3339 format.\n\nInclusive.'),
|
|
5952
|
-
id: zod.coerce
|
|
5953
|
-
.string()
|
|
5954
|
-
.optional()
|
|
5955
|
-
.describe('The event ID.\n\nAccepts partial ID.'),
|
|
5956
|
-
ingestedAtFrom: zod.coerce
|
|
5957
|
-
.date()
|
|
5958
|
-
.optional()
|
|
5959
|
-
.describe('Start date-time in RFC 3339 format.\n\nInclusive.'),
|
|
5960
|
-
ingestedAtTo: zod.coerce
|
|
5961
|
-
.date()
|
|
5962
|
-
.optional()
|
|
5963
|
-
.describe('End date-time in RFC 3339 format.\n\nInclusive.'),
|
|
5964
|
-
limit: zod.coerce
|
|
5550
|
+
.default(listMarketplaceListingsQueryPageDefault)
|
|
5551
|
+
.describe('Page index.\n\nDefault is 1.'),
|
|
5552
|
+
pageSize: zod.coerce
|
|
5965
5553
|
.number()
|
|
5966
5554
|
.min(1)
|
|
5967
|
-
.max(
|
|
5968
|
-
.default(
|
|
5969
|
-
.describe('
|
|
5970
|
-
|
|
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
|
|
5971
5583
|
.string()
|
|
5972
5584
|
.optional()
|
|
5973
|
-
.describe(
|
|
5974
|
-
|
|
5975
|
-
|
|
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()
|
|
5976
5608
|
.optional()
|
|
5977
|
-
.describe(
|
|
5609
|
+
.describe("Name of the application to install.\n\nIf name is not provided defaults to the marketplace listing's name."),
|
|
5978
5610
|
});
|
|
5979
5611
|
/**
|
|
5980
|
-
*
|
|
5981
|
-
|
|
5612
|
+
* Install an app via OAuth.
|
|
5613
|
+
Returns a URL to start the OAuth 2.0 flow.
|
|
5614
|
+
* @summary Get OAuth2 install URL
|
|
5982
5615
|
*/
|
|
5983
|
-
export const
|
|
5984
|
-
|
|
5985
|
-
|
|
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.');
|
|
5616
|
+
export const marketplaceOAuth2InstallGetURLParams = zod.object({
|
|
5617
|
+
type: zod.enum(['stripe', 'sandbox', 'custom_invoicing']),
|
|
5618
|
+
});
|
|
6067
5619
|
/**
|
|
6068
|
-
*
|
|
6069
|
-
|
|
5620
|
+
* Authorize OAuth2 code.
|
|
5621
|
+
Verifies the OAuth code and exchanges it for a token and refresh token
|
|
5622
|
+
* @summary Install app via OAuth2
|
|
6070
5623
|
*/
|
|
6071
|
-
export const
|
|
6072
|
-
|
|
6073
|
-
|
|
6074
|
-
|
|
6075
|
-
|
|
6076
|
-
export const
|
|
6077
|
-
|
|
6078
|
-
|
|
6079
|
-
export const listFeaturesQueryParams = zod.object({
|
|
6080
|
-
includeArchived: zod.coerce
|
|
6081
|
-
.boolean()
|
|
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
|
|
5631
|
+
.string()
|
|
6082
5632
|
.optional()
|
|
6083
|
-
.describe('
|
|
6084
|
-
|
|
6085
|
-
.
|
|
6086
|
-
|
|
6087
|
-
|
|
6088
|
-
|
|
6089
|
-
|
|
6090
|
-
|
|
6091
|
-
|
|
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
|
+
])
|
|
6092
5644
|
.optional()
|
|
6093
|
-
.describe('
|
|
6094
|
-
|
|
6095
|
-
.
|
|
6096
|
-
.min(listFeaturesQueryOffsetMin)
|
|
5645
|
+
.describe('Error code.\nRequired with the error response.'),
|
|
5646
|
+
error_description: zod.coerce
|
|
5647
|
+
.string()
|
|
6097
5648
|
.optional()
|
|
6098
|
-
.describe('
|
|
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
|
|
5651
|
+
.string()
|
|
5652
|
+
.optional()
|
|
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()
|
|
5656
|
+
.optional()
|
|
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.'),
|
|
5658
|
+
});
|
|
5659
|
+
/**
|
|
5660
|
+
* List meters.
|
|
5661
|
+
* @summary List meters
|
|
5662
|
+
*/
|
|
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
|
|
5669
|
+
.boolean()
|
|
5670
|
+
.optional()
|
|
5671
|
+
.describe('Include deleted meters.'),
|
|
6099
5672
|
order: zod.enum(['ASC', 'DESC']).optional().describe('The order direction.'),
|
|
6100
5673
|
orderBy: zod
|
|
6101
|
-
.enum(['
|
|
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(
|
|
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(
|
|
6113
|
-
.default(
|
|
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
|
-
*
|
|
6118
|
-
|
|
6119
|
-
|
|
6120
|
-
|
|
6121
|
-
|
|
6122
|
-
|
|
6123
|
-
export const
|
|
6124
|
-
export const
|
|
6125
|
-
export const createFeatureBodyMeterSlugMax = 64;
|
|
6126
|
-
export const createFeatureBodyMeterSlugRegExp = new RegExp('^[a-z0-9]+(?:_[a-z0-9]+)*$');
|
|
6127
|
-
export const createFeatureBody = zod
|
|
5690
|
+
* Create a meter.
|
|
5691
|
+
* @summary Create meter
|
|
5692
|
+
*/
|
|
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
|
-
|
|
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
|
-
.
|
|
6133
|
-
|
|
6134
|
-
.
|
|
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
|
-
.
|
|
6139
|
-
|
|
6140
|
-
|
|
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('
|
|
6143
|
-
|
|
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('
|
|
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('
|
|
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
|
-
*
|
|
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
|
|
6168
|
-
|
|
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
|
-
*
|
|
6172
|
-
|
|
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
|
|
6177
|
-
export const
|
|
6178
|
-
export const
|
|
6179
|
-
|
|
6180
|
-
|
|
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(
|
|
6194
|
-
.
|
|
6195
|
-
|
|
6196
|
-
|
|
6197
|
-
|
|
6198
|
-
|
|
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('
|
|
6201
|
-
|
|
6202
|
-
|
|
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('
|
|
6206
|
-
|
|
6207
|
-
.
|
|
6208
|
-
.
|
|
6209
|
-
.
|
|
6210
|
-
.describe('
|
|
6211
|
-
|
|
6212
|
-
.
|
|
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(
|
|
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('
|
|
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
|
-
});
|
|
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.');
|
|
6230
5796
|
/**
|
|
6231
|
-
*
|
|
6232
|
-
* @summary
|
|
5797
|
+
* Delete a meter.
|
|
5798
|
+
* @summary Delete meter
|
|
6233
5799
|
*/
|
|
6234
|
-
export const
|
|
6235
|
-
|
|
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()
|
|
5805
|
+
.min(1)
|
|
5806
|
+
.max(deleteMeterPathMeterIdOrSlugMax)
|
|
5807
|
+
.regex(deleteMeterPathMeterIdOrSlugRegExp),
|
|
6236
5808
|
});
|
|
6237
5809
|
/**
|
|
6238
|
-
*
|
|
6239
|
-
* @summary
|
|
5810
|
+
* Query meter for usage.
|
|
5811
|
+
* @summary Query meter
|
|
6240
5812
|
*/
|
|
6241
|
-
export const
|
|
6242
|
-
export const
|
|
6243
|
-
export const
|
|
6244
|
-
|
|
6245
|
-
|
|
6246
|
-
.number()
|
|
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()
|
|
6247
5818
|
.min(1)
|
|
6248
|
-
.
|
|
6249
|
-
.
|
|
6250
|
-
|
|
6251
|
-
|
|
5819
|
+
.max(queryMeterPathMeterIdOrSlugMax)
|
|
5820
|
+
.regex(queryMeterPathMeterIdOrSlugRegExp),
|
|
5821
|
+
});
|
|
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
|
|
5827
|
+
.string()
|
|
6252
5828
|
.min(1)
|
|
6253
|
-
.max(
|
|
6254
|
-
.
|
|
6255
|
-
.describe('
|
|
5829
|
+
.max(queryMeterQueryClientIdMax)
|
|
5830
|
+
.optional()
|
|
5831
|
+
.describe('Client ID\nUseful to track progress of a query.'),
|
|
5832
|
+
filterCustomerId: zod
|
|
5833
|
+
.array(zod.coerce.string())
|
|
5834
|
+
.max(queryMeterQueryFilterCustomerIdMax)
|
|
5835
|
+
.optional()
|
|
5836
|
+
.describe('Filtering by multiple customers.\n\nFor example: ?filterCustomerId=customer-1&filterCustomerId=customer-2'),
|
|
5837
|
+
filterGroupBy: zod
|
|
5838
|
+
.record(zod.string(), zod.coerce.string())
|
|
5839
|
+
.optional()
|
|
5840
|
+
.describe('Simple filter for group bys with exact match.\n\nFor example: ?filterGroupBy[vendor]=openai&filterGroupBy[model]=gpt-4-turbo'),
|
|
5841
|
+
from: zod.coerce
|
|
5842
|
+
.date()
|
|
5843
|
+
.optional()
|
|
5844
|
+
.describe('Start date-time in RFC 3339 format.\n\nInclusive.\n\nFor example: ?from=2025-01-01T00%3A00%3A00.000Z'),
|
|
5845
|
+
groupBy: zod
|
|
5846
|
+
.array(zod.coerce.string())
|
|
5847
|
+
.optional()
|
|
5848
|
+
.describe('If not specified a single aggregate will be returned for each subject and time window.\n`subject` is a reserved group by value.\n\nFor example: ?groupBy=subject&groupBy=model'),
|
|
5849
|
+
subject: zod
|
|
5850
|
+
.array(zod.coerce.string())
|
|
5851
|
+
.optional()
|
|
5852
|
+
.describe('Filtering by multiple subjects.\n\nFor example: ?subject=subject-1&subject=subject-2'),
|
|
5853
|
+
to: zod.coerce
|
|
5854
|
+
.date()
|
|
5855
|
+
.optional()
|
|
5856
|
+
.describe('End date-time in RFC 3339 format.\n\nInclusive.\n\nFor example: ?to=2025-02-01T00%3A00%3A00.000Z'),
|
|
5857
|
+
windowSize: zod
|
|
5858
|
+
.enum(['MINUTE', 'HOUR', 'DAY', 'MONTH'])
|
|
5859
|
+
.optional()
|
|
5860
|
+
.describe('If not specified, a single usage aggregate will be returned for the entirety of the specified period for each subject and group.\n\nFor example: ?windowSize=DAY'),
|
|
5861
|
+
windowTimeZone: zod.coerce
|
|
5862
|
+
.string()
|
|
5863
|
+
.default(queryMeterQueryWindowTimeZoneDefault)
|
|
5864
|
+
.describe('The value is the name of the time zone as defined in the IANA Time Zone Database (http://www.iana.org/time-zones).\nIf not specified, the UTC timezone will be used.\n\nFor example: ?windowTimeZone=UTC'),
|
|
6256
5865
|
});
|
|
6257
5866
|
/**
|
|
6258
|
-
*
|
|
6259
|
-
* @summary Get app details by type
|
|
5867
|
+
* @summary Query meter
|
|
6260
5868
|
*/
|
|
6261
|
-
export const
|
|
6262
|
-
|
|
6263
|
-
|
|
6264
|
-
|
|
6265
|
-
|
|
6266
|
-
|
|
6267
|
-
|
|
6268
|
-
|
|
6269
|
-
type: zod
|
|
6270
|
-
.enum(['stripe', 'sandbox', 'custom_invoicing'])
|
|
6271
|
-
.describe('The type of the app to install.'),
|
|
5869
|
+
export const queryMeterPostPathMeterIdOrSlugMax = 64;
|
|
5870
|
+
export const queryMeterPostPathMeterIdOrSlugRegExp = new RegExp('^[a-z0-9]+(?:_[a-z0-9]+)*$|^[0-7][0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{25}$');
|
|
5871
|
+
export const queryMeterPostParams = zod.object({
|
|
5872
|
+
meterIdOrSlug: zod.coerce
|
|
5873
|
+
.string()
|
|
5874
|
+
.min(1)
|
|
5875
|
+
.max(queryMeterPostPathMeterIdOrSlugMax)
|
|
5876
|
+
.regex(queryMeterPostPathMeterIdOrSlugRegExp),
|
|
6272
5877
|
});
|
|
6273
|
-
export const
|
|
6274
|
-
export const
|
|
5878
|
+
export const queryMeterPostBodyClientIdMax = 36;
|
|
5879
|
+
export const queryMeterPostBodyWindowTimeZoneDefault = 'UTC';
|
|
5880
|
+
export const queryMeterPostBodySubjectMax = 100;
|
|
5881
|
+
export const queryMeterPostBodyFilterCustomerIdMax = 100;
|
|
5882
|
+
export const queryMeterPostBodyGroupByMax = 100;
|
|
5883
|
+
export const queryMeterPostBody = zod
|
|
6275
5884
|
.object({
|
|
6276
|
-
|
|
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
|
|
5885
|
+
clientId: zod.coerce
|
|
6281
5886
|
.string()
|
|
5887
|
+
.min(1)
|
|
5888
|
+
.max(queryMeterPostBodyClientIdMax)
|
|
6282
5889
|
.optional()
|
|
6283
|
-
.describe(
|
|
6284
|
-
|
|
6285
|
-
|
|
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()
|
|
5890
|
+
.describe('Client ID\nUseful to track progress of a query.'),
|
|
5891
|
+
filterCustomerId: zod
|
|
5892
|
+
.array(zod.coerce.string())
|
|
5893
|
+
.max(queryMeterPostBodyFilterCustomerIdMax)
|
|
6306
5894
|
.optional()
|
|
6307
|
-
.describe(
|
|
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()
|
|
5895
|
+
.describe('Filtering by multiple customers.'),
|
|
5896
|
+
filterGroupBy: zod
|
|
5897
|
+
.record(zod.string(), zod.array(zod.coerce.string()))
|
|
6330
5898
|
.optional()
|
|
6331
|
-
.describe('
|
|
6332
|
-
|
|
6333
|
-
.
|
|
6334
|
-
'invalid_request',
|
|
6335
|
-
'unauthorized_client',
|
|
6336
|
-
'access_denied',
|
|
6337
|
-
'unsupported_response_type',
|
|
6338
|
-
'invalid_scope',
|
|
6339
|
-
'server_error',
|
|
6340
|
-
'temporarily_unavailable',
|
|
6341
|
-
])
|
|
5899
|
+
.describe('Simple filter for group bys with exact match.'),
|
|
5900
|
+
from: zod.coerce
|
|
5901
|
+
.date()
|
|
6342
5902
|
.optional()
|
|
6343
|
-
.describe('
|
|
6344
|
-
|
|
6345
|
-
.string()
|
|
5903
|
+
.describe('Start date-time in RFC 3339 format.\n\nInclusive.'),
|
|
5904
|
+
groupBy: zod
|
|
5905
|
+
.array(zod.coerce.string())
|
|
5906
|
+
.max(queryMeterPostBodyGroupByMax)
|
|
6346
5907
|
.optional()
|
|
6347
|
-
.describe('
|
|
6348
|
-
|
|
6349
|
-
.string()
|
|
5908
|
+
.describe('If not specified a single aggregate will be returned for each subject and time window.\n`subject` is a reserved group by value.'),
|
|
5909
|
+
subject: zod
|
|
5910
|
+
.array(zod.coerce.string())
|
|
5911
|
+
.max(queryMeterPostBodySubjectMax)
|
|
6350
5912
|
.optional()
|
|
6351
|
-
.describe('
|
|
6352
|
-
|
|
6353
|
-
.
|
|
5913
|
+
.describe('Filtering by multiple subjects.'),
|
|
5914
|
+
to: zod.coerce
|
|
5915
|
+
.date()
|
|
6354
5916
|
.optional()
|
|
6355
|
-
.describe('
|
|
5917
|
+
.describe('End date-time in RFC 3339 format.\n\nInclusive.'),
|
|
5918
|
+
windowSize: zod
|
|
5919
|
+
.enum(['MINUTE', 'HOUR', 'DAY', 'MONTH'])
|
|
5920
|
+
.describe('Aggregation window size.')
|
|
5921
|
+
.optional()
|
|
5922
|
+
.describe('If not specified, a single usage aggregate will be returned for the entirety of the specified period for each subject and group.'),
|
|
5923
|
+
windowTimeZone: zod.coerce
|
|
5924
|
+
.string()
|
|
5925
|
+
.default(queryMeterPostBodyWindowTimeZoneDefault)
|
|
5926
|
+
.describe('The value is the name of the time zone as defined in the IANA Time Zone Database (http://www.iana.org/time-zones).\nIf not specified, the UTC timezone will be used.'),
|
|
5927
|
+
})
|
|
5928
|
+
.describe('A meter query request.');
|
|
5929
|
+
/**
|
|
5930
|
+
* List subjects for a meter.
|
|
5931
|
+
* @summary List meter subjects
|
|
5932
|
+
*/
|
|
5933
|
+
export const listMeterSubjectsPathMeterIdOrSlugMax = 64;
|
|
5934
|
+
export const listMeterSubjectsPathMeterIdOrSlugRegExp = new RegExp('^[a-z0-9]+(?:_[a-z0-9]+)*$|^[0-7][0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{25}$');
|
|
5935
|
+
export const listMeterSubjectsParams = zod.object({
|
|
5936
|
+
meterIdOrSlug: zod.coerce
|
|
5937
|
+
.string()
|
|
5938
|
+
.min(1)
|
|
5939
|
+
.max(listMeterSubjectsPathMeterIdOrSlugMax)
|
|
5940
|
+
.regex(listMeterSubjectsPathMeterIdOrSlugRegExp),
|
|
6356
5941
|
});
|
|
6357
5942
|
/**
|
|
6358
|
-
* List
|
|
6359
|
-
* @summary List
|
|
5943
|
+
* List all notification channels.
|
|
5944
|
+
* @summary List notification channels
|
|
6360
5945
|
*/
|
|
6361
|
-
export const
|
|
6362
|
-
export const
|
|
6363
|
-
export const
|
|
6364
|
-
export const
|
|
6365
|
-
export const
|
|
5946
|
+
export const listNotificationChannelsQueryIncludeDeletedDefault = false;
|
|
5947
|
+
export const listNotificationChannelsQueryIncludeDisabledDefault = false;
|
|
5948
|
+
export const listNotificationChannelsQueryPageDefault = 1;
|
|
5949
|
+
export const listNotificationChannelsQueryPageSizeDefault = 100;
|
|
5950
|
+
export const listNotificationChannelsQueryPageSizeMax = 1000;
|
|
5951
|
+
export const listNotificationChannelsQueryParams = zod.object({
|
|
6366
5952
|
includeDeleted: zod.coerce
|
|
6367
5953
|
.boolean()
|
|
6368
5954
|
.optional()
|
|
6369
|
-
.describe('Include deleted
|
|
5955
|
+
.describe('Include deleted notification channels in response.\n\nUsage: `?includeDeleted=true`'),
|
|
5956
|
+
includeDisabled: zod.coerce
|
|
5957
|
+
.boolean()
|
|
5958
|
+
.optional()
|
|
5959
|
+
.describe('Include disabled notification channels in response.\n\nUsage: `?includeDisabled=false`'),
|
|
6370
5960
|
order: zod.enum(['ASC', 'DESC']).optional().describe('The order direction.'),
|
|
6371
5961
|
orderBy: zod
|
|
6372
|
-
.enum(['
|
|
5962
|
+
.enum(['id', 'type', 'createdAt', 'updatedAt'])
|
|
6373
5963
|
.optional()
|
|
6374
5964
|
.describe('The order by field.'),
|
|
6375
5965
|
page: zod.coerce
|
|
6376
5966
|
.number()
|
|
6377
5967
|
.min(1)
|
|
6378
|
-
.default(
|
|
5968
|
+
.default(listNotificationChannelsQueryPageDefault)
|
|
6379
5969
|
.describe('Page index.\n\nDefault is 1.'),
|
|
6380
5970
|
pageSize: zod.coerce
|
|
6381
5971
|
.number()
|
|
6382
5972
|
.min(1)
|
|
6383
|
-
.max(
|
|
6384
|
-
.default(
|
|
5973
|
+
.max(listNotificationChannelsQueryPageSizeMax)
|
|
5974
|
+
.default(listNotificationChannelsQueryPageSizeDefault)
|
|
6385
5975
|
.describe('The maximum number of items per page.\n\nDefault is 100.'),
|
|
6386
5976
|
});
|
|
6387
5977
|
/**
|
|
6388
|
-
* Create a
|
|
6389
|
-
* @summary Create
|
|
5978
|
+
* Create a new notification channel.
|
|
5979
|
+
* @summary Create a notification channel
|
|
6390
5980
|
*/
|
|
6391
|
-
export const
|
|
6392
|
-
export const
|
|
6393
|
-
export const
|
|
6394
|
-
export const createMeterBodySlugRegExp = new RegExp('^[a-z0-9]+(?:_[a-z0-9]+)*$');
|
|
6395
|
-
export const createMeterBody = zod
|
|
5981
|
+
export const createNotificationChannelBodyDisabledDefault = false;
|
|
5982
|
+
export const createNotificationChannelBodySigningSecretRegExp = new RegExp('^(whsec_)?[a-zA-Z0-9+/=]{32,100}$');
|
|
5983
|
+
export const createNotificationChannelBody = zod
|
|
6396
5984
|
.object({
|
|
6397
|
-
|
|
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
|
|
5985
|
+
customHeaders: zod
|
|
6415
5986
|
.record(zod.string(), zod.coerce.string())
|
|
6416
5987
|
.optional()
|
|
6417
|
-
.describe('
|
|
6418
|
-
|
|
6419
|
-
.
|
|
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)
|
|
5988
|
+
.describe('Custom HTTP headers sent as part of the webhook request.'),
|
|
5989
|
+
disabled: zod.coerce
|
|
5990
|
+
.boolean()
|
|
6427
5991
|
.optional()
|
|
6428
|
-
.describe('
|
|
6429
|
-
|
|
6430
|
-
|
|
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
|
|
5992
|
+
.describe('Whether the channel is disabled or not.'),
|
|
5993
|
+
name: zod.coerce.string().describe('User friendly name of the channel.'),
|
|
5994
|
+
signingSecret: zod.coerce
|
|
6436
5995
|
.string()
|
|
6437
|
-
.
|
|
5996
|
+
.regex(createNotificationChannelBodySigningSecretRegExp)
|
|
6438
5997
|
.optional()
|
|
6439
|
-
.describe(
|
|
5998
|
+
.describe('Signing secret used for webhook request validation on the receiving end.\n\nFormat: `base64` encoded random bytes optionally prefixed with `whsec_`. Recommended size: 24'),
|
|
5999
|
+
type: zod.enum(['WEBHOOK']).describe('Notification channel type.'),
|
|
6000
|
+
url: zod.coerce
|
|
6001
|
+
.string()
|
|
6002
|
+
.describe('Webhook URL where the notification is sent.'),
|
|
6440
6003
|
})
|
|
6441
|
-
.describe('
|
|
6004
|
+
.describe('Request with input parameters for creating new notification channel with webhook type.')
|
|
6005
|
+
.describe('Union type for requests creating new notification channel with certain type.');
|
|
6442
6006
|
/**
|
|
6443
|
-
*
|
|
6444
|
-
* @summary
|
|
6007
|
+
* Update notification channel.
|
|
6008
|
+
* @summary Update a notification channel
|
|
6445
6009
|
*/
|
|
6446
|
-
export const
|
|
6447
|
-
export const
|
|
6448
|
-
|
|
6449
|
-
meterIdOrSlug: zod.coerce
|
|
6010
|
+
export const updateNotificationChannelPathChannelIdRegExp = new RegExp('^[0-7][0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{25}$');
|
|
6011
|
+
export const updateNotificationChannelParams = zod.object({
|
|
6012
|
+
channelId: zod.coerce
|
|
6450
6013
|
.string()
|
|
6451
|
-
.
|
|
6452
|
-
.max(getMeterPathMeterIdOrSlugMax)
|
|
6453
|
-
.regex(getMeterPathMeterIdOrSlugRegExp),
|
|
6014
|
+
.regex(updateNotificationChannelPathChannelIdRegExp),
|
|
6454
6015
|
});
|
|
6455
|
-
|
|
6456
|
-
|
|
6457
|
-
|
|
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
|
|
6016
|
+
export const updateNotificationChannelBodyDisabledDefault = false;
|
|
6017
|
+
export const updateNotificationChannelBodySigningSecretRegExp = new RegExp('^(whsec_)?[a-zA-Z0-9+/=]{32,100}$');
|
|
6018
|
+
export const updateNotificationChannelBody = zod
|
|
6471
6019
|
.object({
|
|
6472
|
-
|
|
6473
|
-
.string()
|
|
6474
|
-
.max(updateMeterBodyDescriptionMax)
|
|
6475
|
-
.optional()
|
|
6476
|
-
.describe('Optional description of the resource. Maximum 1024 characters.'),
|
|
6477
|
-
groupBy: zod
|
|
6020
|
+
customHeaders: zod
|
|
6478
6021
|
.record(zod.string(), zod.coerce.string())
|
|
6479
6022
|
.optional()
|
|
6480
|
-
.describe('
|
|
6481
|
-
|
|
6482
|
-
.
|
|
6483
|
-
.
|
|
6484
|
-
.
|
|
6485
|
-
|
|
6486
|
-
|
|
6023
|
+
.describe('Custom HTTP headers sent as part of the webhook request.'),
|
|
6024
|
+
disabled: zod.coerce
|
|
6025
|
+
.boolean()
|
|
6026
|
+
.optional()
|
|
6027
|
+
.describe('Whether the channel is disabled or not.'),
|
|
6028
|
+
name: zod.coerce.string().describe('User friendly name of the channel.'),
|
|
6029
|
+
signingSecret: zod.coerce
|
|
6487
6030
|
.string()
|
|
6488
|
-
.
|
|
6489
|
-
.max(updateMeterBodyNameMax)
|
|
6031
|
+
.regex(updateNotificationChannelBodySigningSecretRegExp)
|
|
6490
6032
|
.optional()
|
|
6491
|
-
.describe('
|
|
6033
|
+
.describe('Signing secret used for webhook request validation on the receiving end.\n\nFormat: `base64` encoded random bytes optionally prefixed with `whsec_`. Recommended size: 24'),
|
|
6034
|
+
type: zod.enum(['WEBHOOK']).describe('Notification channel type.'),
|
|
6035
|
+
url: zod.coerce
|
|
6036
|
+
.string()
|
|
6037
|
+
.describe('Webhook URL where the notification is sent.'),
|
|
6492
6038
|
})
|
|
6493
|
-
.describe('
|
|
6039
|
+
.describe('Request with input parameters for creating new notification channel with webhook type.')
|
|
6040
|
+
.describe('Union type for requests creating new notification channel with certain type.');
|
|
6494
6041
|
/**
|
|
6495
|
-
*
|
|
6496
|
-
* @summary
|
|
6042
|
+
* Get a notification channel by id.
|
|
6043
|
+
* @summary Get notification channel
|
|
6497
6044
|
*/
|
|
6498
|
-
export const
|
|
6499
|
-
export const
|
|
6500
|
-
|
|
6501
|
-
meterIdOrSlug: zod.coerce
|
|
6045
|
+
export const getNotificationChannelPathChannelIdRegExp = new RegExp('^[0-7][0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{25}$');
|
|
6046
|
+
export const getNotificationChannelParams = zod.object({
|
|
6047
|
+
channelId: zod.coerce
|
|
6502
6048
|
.string()
|
|
6503
|
-
.
|
|
6504
|
-
.max(deleteMeterPathMeterIdOrSlugMax)
|
|
6505
|
-
.regex(deleteMeterPathMeterIdOrSlugRegExp),
|
|
6049
|
+
.regex(getNotificationChannelPathChannelIdRegExp),
|
|
6506
6050
|
});
|
|
6507
6051
|
/**
|
|
6508
|
-
*
|
|
6509
|
-
|
|
6052
|
+
* Soft delete notification channel by id.
|
|
6053
|
+
|
|
6054
|
+
Once a notification channel is deleted it cannot be undeleted.
|
|
6055
|
+
* @summary Delete a notification channel
|
|
6510
6056
|
*/
|
|
6511
|
-
export const
|
|
6512
|
-
export const
|
|
6513
|
-
|
|
6514
|
-
meterIdOrSlug: zod.coerce
|
|
6057
|
+
export const deleteNotificationChannelPathChannelIdRegExp = new RegExp('^[0-7][0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{25}$');
|
|
6058
|
+
export const deleteNotificationChannelParams = zod.object({
|
|
6059
|
+
channelId: zod.coerce
|
|
6515
6060
|
.string()
|
|
6516
|
-
.
|
|
6517
|
-
.max(queryMeterPathMeterIdOrSlugMax)
|
|
6518
|
-
.regex(queryMeterPathMeterIdOrSlugRegExp),
|
|
6061
|
+
.regex(deleteNotificationChannelPathChannelIdRegExp),
|
|
6519
6062
|
});
|
|
6520
|
-
|
|
6521
|
-
|
|
6522
|
-
|
|
6523
|
-
|
|
6524
|
-
|
|
6063
|
+
/**
|
|
6064
|
+
* List all notification events.
|
|
6065
|
+
* @summary List notification events
|
|
6066
|
+
*/
|
|
6067
|
+
export const listNotificationEventsQueryRuleItemRegExp = new RegExp('^[0-7][0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{25}$');
|
|
6068
|
+
export const listNotificationEventsQueryChannelItemRegExp = new RegExp('^[0-7][0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{25}$');
|
|
6069
|
+
export const listNotificationEventsQueryPageDefault = 1;
|
|
6070
|
+
export const listNotificationEventsQueryPageSizeDefault = 100;
|
|
6071
|
+
export const listNotificationEventsQueryPageSizeMax = 1000;
|
|
6072
|
+
export const listNotificationEventsQueryParams = zod.object({
|
|
6073
|
+
channel: zod
|
|
6074
|
+
.array(zod.coerce
|
|
6525
6075
|
.string()
|
|
6526
|
-
.
|
|
6527
|
-
.
|
|
6076
|
+
.regex(listNotificationEventsQueryChannelItemRegExp)
|
|
6077
|
+
.describe('ULID (Universally Unique Lexicographically Sortable Identifier).'))
|
|
6528
6078
|
.optional()
|
|
6529
|
-
.describe('
|
|
6530
|
-
|
|
6079
|
+
.describe('Filtering by multiple channel ids.\n\nUsage: `?channel=01J8J4RXH778XB056JS088PCYT&channel=01J8J4S1R1G9EVN62RG23A9M6J`'),
|
|
6080
|
+
feature: zod
|
|
6531
6081
|
.array(zod.coerce.string())
|
|
6532
|
-
.max(queryMeterQueryFilterCustomerIdMax)
|
|
6533
|
-
.optional()
|
|
6534
|
-
.describe('Filtering by multiple customers.\n\nFor example: ?filterCustomerId=customer-1&filterCustomerId=customer-2'),
|
|
6535
|
-
filterGroupBy: zod
|
|
6536
|
-
.record(zod.string(), zod.coerce.string())
|
|
6537
6082
|
.optional()
|
|
6538
|
-
.describe('
|
|
6083
|
+
.describe('Filtering by multiple feature ids or keys.\n\nUsage: `?feature=feature-1&feature=feature-2`'),
|
|
6539
6084
|
from: zod.coerce
|
|
6540
6085
|
.date()
|
|
6541
6086
|
.optional()
|
|
6542
|
-
.describe('Start date-time in RFC 3339 format.\
|
|
6543
|
-
|
|
6544
|
-
|
|
6087
|
+
.describe('Start date-time in RFC 3339 format.\nInclusive.'),
|
|
6088
|
+
order: zod.enum(['ASC', 'DESC']).optional().describe('The order direction.'),
|
|
6089
|
+
orderBy: zod
|
|
6090
|
+
.enum(['id', 'createdAt'])
|
|
6545
6091
|
.optional()
|
|
6546
|
-
.describe('
|
|
6092
|
+
.describe('The order by field.'),
|
|
6093
|
+
page: zod.coerce
|
|
6094
|
+
.number()
|
|
6095
|
+
.min(1)
|
|
6096
|
+
.default(listNotificationEventsQueryPageDefault)
|
|
6097
|
+
.describe('Page index.\n\nDefault is 1.'),
|
|
6098
|
+
pageSize: zod.coerce
|
|
6099
|
+
.number()
|
|
6100
|
+
.min(1)
|
|
6101
|
+
.max(listNotificationEventsQueryPageSizeMax)
|
|
6102
|
+
.default(listNotificationEventsQueryPageSizeDefault)
|
|
6103
|
+
.describe('The maximum number of items per page.\n\nDefault is 100.'),
|
|
6104
|
+
rule: zod
|
|
6105
|
+
.array(zod.coerce
|
|
6106
|
+
.string()
|
|
6107
|
+
.regex(listNotificationEventsQueryRuleItemRegExp)
|
|
6108
|
+
.describe('ULID (Universally Unique Lexicographically Sortable Identifier).'))
|
|
6109
|
+
.optional()
|
|
6110
|
+
.describe('Filtering by multiple rule ids.\n\nUsage: `?rule=01J8J2XYZ2N5WBYK09EDZFBSZM&rule=01J8J4R4VZH180KRKQ63NB2VA5`'),
|
|
6547
6111
|
subject: zod
|
|
6548
6112
|
.array(zod.coerce.string())
|
|
6549
6113
|
.optional()
|
|
6550
|
-
.describe('Filtering by multiple
|
|
6114
|
+
.describe('Filtering by multiple subject ids or keys.\n\nUsage: `?subject=subject-1&subject=subject-2`'),
|
|
6551
6115
|
to: zod.coerce
|
|
6552
6116
|
.date()
|
|
6553
6117
|
.optional()
|
|
6554
|
-
.describe('End date-time in RFC 3339 format.\
|
|
6555
|
-
windowSize: zod
|
|
6556
|
-
.enum(['MINUTE', 'HOUR', 'DAY', 'MONTH'])
|
|
6557
|
-
.optional()
|
|
6558
|
-
.describe('If not specified, a single usage aggregate will be returned for the entirety of the specified period for each subject and group.\n\nFor example: ?windowSize=DAY'),
|
|
6559
|
-
windowTimeZone: zod.coerce
|
|
6560
|
-
.string()
|
|
6561
|
-
.default(queryMeterQueryWindowTimeZoneDefault)
|
|
6562
|
-
.describe('The value is the name of the time zone as defined in the IANA Time Zone Database (http://www.iana.org/time-zones).\nIf not specified, the UTC timezone will be used.\n\nFor example: ?windowTimeZone=UTC'),
|
|
6118
|
+
.describe('End date-time in RFC 3339 format.\nInclusive.'),
|
|
6563
6119
|
});
|
|
6564
6120
|
/**
|
|
6565
|
-
*
|
|
6121
|
+
* Get a notification event by id.
|
|
6122
|
+
* @summary Get notification event
|
|
6566
6123
|
*/
|
|
6567
|
-
export const
|
|
6568
|
-
|
|
6569
|
-
export const queryMeterPostParams = zod.object({
|
|
6570
|
-
meterIdOrSlug: zod.coerce
|
|
6571
|
-
.string()
|
|
6572
|
-
.min(1)
|
|
6573
|
-
.max(queryMeterPostPathMeterIdOrSlugMax)
|
|
6574
|
-
.regex(queryMeterPostPathMeterIdOrSlugRegExp),
|
|
6124
|
+
export const getNotificationEventParams = zod.object({
|
|
6125
|
+
eventId: zod.coerce.string(),
|
|
6575
6126
|
});
|
|
6576
|
-
|
|
6577
|
-
|
|
6578
|
-
|
|
6579
|
-
|
|
6580
|
-
export const
|
|
6581
|
-
export const
|
|
6582
|
-
|
|
6583
|
-
|
|
6584
|
-
|
|
6585
|
-
|
|
6586
|
-
|
|
6587
|
-
|
|
6588
|
-
|
|
6589
|
-
filterCustomerId: zod
|
|
6127
|
+
/**
|
|
6128
|
+
* List all notification rules.
|
|
6129
|
+
* @summary List notification rules
|
|
6130
|
+
*/
|
|
6131
|
+
export const listNotificationRulesQueryIncludeDeletedDefault = false;
|
|
6132
|
+
export const listNotificationRulesQueryIncludeDisabledDefault = false;
|
|
6133
|
+
export const listNotificationRulesQueryFeatureItemMax = 64;
|
|
6134
|
+
export const listNotificationRulesQueryFeatureItemRegExp = new RegExp('^[a-z0-9]+(?:_[a-z0-9]+)*$|^[0-7][0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{25}$');
|
|
6135
|
+
export const listNotificationRulesQueryPageDefault = 1;
|
|
6136
|
+
export const listNotificationRulesQueryPageSizeDefault = 100;
|
|
6137
|
+
export const listNotificationRulesQueryPageSizeMax = 1000;
|
|
6138
|
+
export const listNotificationRulesQueryParams = zod.object({
|
|
6139
|
+
channel: zod
|
|
6590
6140
|
.array(zod.coerce.string())
|
|
6591
|
-
.max(queryMeterPostBodyFilterCustomerIdMax)
|
|
6592
|
-
.optional()
|
|
6593
|
-
.describe('Filtering by multiple customers.'),
|
|
6594
|
-
filterGroupBy: zod
|
|
6595
|
-
.record(zod.string(), zod.array(zod.coerce.string()))
|
|
6596
6141
|
.optional()
|
|
6597
|
-
.describe('
|
|
6598
|
-
|
|
6599
|
-
.
|
|
6600
|
-
.
|
|
6601
|
-
.
|
|
6602
|
-
|
|
6603
|
-
.
|
|
6604
|
-
.
|
|
6142
|
+
.describe('Filtering by multiple notifiaction channel ids.\n\nUsage: `?channel=01ARZ3NDEKTSV4RRFFQ69G5FAV&channel=01J8J2Y5X4NNGQS32CF81W95E3`'),
|
|
6143
|
+
feature: zod
|
|
6144
|
+
.array(zod.coerce
|
|
6145
|
+
.string()
|
|
6146
|
+
.min(1)
|
|
6147
|
+
.max(listNotificationRulesQueryFeatureItemMax)
|
|
6148
|
+
.regex(listNotificationRulesQueryFeatureItemRegExp)
|
|
6149
|
+
.describe('ULID (Universally Unique Lexicographically Sortable Identifier).\nA key is a unique string that is used to identify a resource.\n\nTODO: this is a temporary solution to support both ULID and Key in the same spec for codegen.'))
|
|
6605
6150
|
.optional()
|
|
6606
|
-
.describe('
|
|
6607
|
-
|
|
6608
|
-
.
|
|
6609
|
-
.max(queryMeterPostBodySubjectMax)
|
|
6151
|
+
.describe('Filtering by multiple feature ids/keys.\n\nUsage: `?feature=feature-1&feature=feature-2`'),
|
|
6152
|
+
includeDeleted: zod.coerce
|
|
6153
|
+
.boolean()
|
|
6610
6154
|
.optional()
|
|
6611
|
-
.describe('
|
|
6612
|
-
|
|
6613
|
-
.
|
|
6155
|
+
.describe('Include deleted notification rules in response.\n\nUsage: `?includeDeleted=true`'),
|
|
6156
|
+
includeDisabled: zod.coerce
|
|
6157
|
+
.boolean()
|
|
6614
6158
|
.optional()
|
|
6615
|
-
.describe('
|
|
6616
|
-
|
|
6617
|
-
|
|
6618
|
-
.
|
|
6159
|
+
.describe('Include disabled notification rules in response.\n\nUsage: `?includeDisabled=false`'),
|
|
6160
|
+
order: zod.enum(['ASC', 'DESC']).optional().describe('The order direction.'),
|
|
6161
|
+
orderBy: zod
|
|
6162
|
+
.enum(['id', 'type', 'createdAt', 'updatedAt'])
|
|
6619
6163
|
.optional()
|
|
6620
|
-
.describe('
|
|
6621
|
-
|
|
6622
|
-
.
|
|
6623
|
-
.default(queryMeterPostBodyWindowTimeZoneDefault)
|
|
6624
|
-
.describe('The value is the name of the time zone as defined in the IANA Time Zone Database (http://www.iana.org/time-zones).\nIf not specified, the UTC timezone will be used.'),
|
|
6625
|
-
})
|
|
6626
|
-
.describe('A meter query request.');
|
|
6627
|
-
/**
|
|
6628
|
-
* List subjects for a meter.
|
|
6629
|
-
* @summary List meter subjects
|
|
6630
|
-
*/
|
|
6631
|
-
export const listMeterSubjectsPathMeterIdOrSlugMax = 64;
|
|
6632
|
-
export const listMeterSubjectsPathMeterIdOrSlugRegExp = new RegExp('^[a-z0-9]+(?:_[a-z0-9]+)*$|^[0-7][0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{25}$');
|
|
6633
|
-
export const listMeterSubjectsParams = zod.object({
|
|
6634
|
-
meterIdOrSlug: zod.coerce
|
|
6635
|
-
.string()
|
|
6636
|
-
.min(1)
|
|
6637
|
-
.max(listMeterSubjectsPathMeterIdOrSlugMax)
|
|
6638
|
-
.regex(listMeterSubjectsPathMeterIdOrSlugRegExp),
|
|
6639
|
-
});
|
|
6640
|
-
/**
|
|
6641
|
-
* List all notification channels.
|
|
6642
|
-
* @summary List notification channels
|
|
6643
|
-
*/
|
|
6644
|
-
export const listNotificationChannelsQueryIncludeDeletedDefault = false;
|
|
6645
|
-
export const listNotificationChannelsQueryIncludeDisabledDefault = false;
|
|
6646
|
-
export const listNotificationChannelsQueryPageDefault = 1;
|
|
6647
|
-
export const listNotificationChannelsQueryPageSizeDefault = 100;
|
|
6648
|
-
export const listNotificationChannelsQueryPageSizeMax = 1000;
|
|
6649
|
-
export const listNotificationChannelsQueryParams = zod.object({
|
|
6650
|
-
includeDeleted: zod.coerce
|
|
6651
|
-
.boolean()
|
|
6652
|
-
.optional()
|
|
6653
|
-
.describe('Include deleted notification channels in response.\n\nUsage: `?includeDeleted=true`'),
|
|
6654
|
-
includeDisabled: zod.coerce
|
|
6655
|
-
.boolean()
|
|
6656
|
-
.optional()
|
|
6657
|
-
.describe('Include disabled notification channels in response.\n\nUsage: `?includeDisabled=false`'),
|
|
6658
|
-
order: zod.enum(['ASC', 'DESC']).optional().describe('The order direction.'),
|
|
6659
|
-
orderBy: zod
|
|
6660
|
-
.enum(['id', 'type', 'createdAt', 'updatedAt'])
|
|
6661
|
-
.optional()
|
|
6662
|
-
.describe('The order by field.'),
|
|
6663
|
-
page: zod.coerce
|
|
6664
|
-
.number()
|
|
6665
|
-
.min(1)
|
|
6666
|
-
.default(listNotificationChannelsQueryPageDefault)
|
|
6667
|
-
.describe('Page index.\n\nDefault is 1.'),
|
|
6668
|
-
pageSize: zod.coerce
|
|
6669
|
-
.number()
|
|
6670
|
-
.min(1)
|
|
6671
|
-
.max(listNotificationChannelsQueryPageSizeMax)
|
|
6672
|
-
.default(listNotificationChannelsQueryPageSizeDefault)
|
|
6673
|
-
.describe('The maximum number of items per page.\n\nDefault is 100.'),
|
|
6674
|
-
});
|
|
6675
|
-
/**
|
|
6676
|
-
* Create a new notification channel.
|
|
6677
|
-
* @summary Create a notification channel
|
|
6678
|
-
*/
|
|
6679
|
-
export const createNotificationChannelBodyDisabledDefault = false;
|
|
6680
|
-
export const createNotificationChannelBodySigningSecretRegExp = new RegExp('^(whsec_)?[a-zA-Z0-9+/=]{32,100}$');
|
|
6681
|
-
export const createNotificationChannelBody = zod
|
|
6682
|
-
.object({
|
|
6683
|
-
customHeaders: zod
|
|
6684
|
-
.record(zod.string(), zod.coerce.string())
|
|
6685
|
-
.optional()
|
|
6686
|
-
.describe('Custom HTTP headers sent as part of the webhook request.'),
|
|
6687
|
-
disabled: zod.coerce
|
|
6688
|
-
.boolean()
|
|
6689
|
-
.optional()
|
|
6690
|
-
.describe('Whether the channel is disabled or not.'),
|
|
6691
|
-
name: zod.coerce.string().describe('User friendly name of the channel.'),
|
|
6692
|
-
signingSecret: zod.coerce
|
|
6693
|
-
.string()
|
|
6694
|
-
.regex(createNotificationChannelBodySigningSecretRegExp)
|
|
6695
|
-
.optional()
|
|
6696
|
-
.describe('Signing secret used for webhook request validation on the receiving end.\n\nFormat: `base64` encoded random bytes optionally prefixed with `whsec_`. Recommended size: 24'),
|
|
6697
|
-
type: zod.enum(['WEBHOOK']).describe('Notification channel type.'),
|
|
6698
|
-
url: zod.coerce
|
|
6699
|
-
.string()
|
|
6700
|
-
.describe('Webhook URL where the notification is sent.'),
|
|
6701
|
-
})
|
|
6702
|
-
.describe('Request with input parameters for creating new notification channel with webhook type.')
|
|
6703
|
-
.describe('Union type for requests creating new notification channel with certain type.');
|
|
6704
|
-
/**
|
|
6705
|
-
* Update notification channel.
|
|
6706
|
-
* @summary Update a notification channel
|
|
6707
|
-
*/
|
|
6708
|
-
export const updateNotificationChannelPathChannelIdRegExp = new RegExp('^[0-7][0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{25}$');
|
|
6709
|
-
export const updateNotificationChannelParams = zod.object({
|
|
6710
|
-
channelId: zod.coerce
|
|
6711
|
-
.string()
|
|
6712
|
-
.regex(updateNotificationChannelPathChannelIdRegExp),
|
|
6713
|
-
});
|
|
6714
|
-
export const updateNotificationChannelBodyDisabledDefault = false;
|
|
6715
|
-
export const updateNotificationChannelBodySigningSecretRegExp = new RegExp('^(whsec_)?[a-zA-Z0-9+/=]{32,100}$');
|
|
6716
|
-
export const updateNotificationChannelBody = zod
|
|
6717
|
-
.object({
|
|
6718
|
-
customHeaders: zod
|
|
6719
|
-
.record(zod.string(), zod.coerce.string())
|
|
6720
|
-
.optional()
|
|
6721
|
-
.describe('Custom HTTP headers sent as part of the webhook request.'),
|
|
6722
|
-
disabled: zod.coerce
|
|
6723
|
-
.boolean()
|
|
6724
|
-
.optional()
|
|
6725
|
-
.describe('Whether the channel is disabled or not.'),
|
|
6726
|
-
name: zod.coerce.string().describe('User friendly name of the channel.'),
|
|
6727
|
-
signingSecret: zod.coerce
|
|
6728
|
-
.string()
|
|
6729
|
-
.regex(updateNotificationChannelBodySigningSecretRegExp)
|
|
6730
|
-
.optional()
|
|
6731
|
-
.describe('Signing secret used for webhook request validation on the receiving end.\n\nFormat: `base64` encoded random bytes optionally prefixed with `whsec_`. Recommended size: 24'),
|
|
6732
|
-
type: zod.enum(['WEBHOOK']).describe('Notification channel type.'),
|
|
6733
|
-
url: zod.coerce
|
|
6734
|
-
.string()
|
|
6735
|
-
.describe('Webhook URL where the notification is sent.'),
|
|
6736
|
-
})
|
|
6737
|
-
.describe('Request with input parameters for creating new notification channel with webhook type.')
|
|
6738
|
-
.describe('Union type for requests creating new notification channel with certain type.');
|
|
6739
|
-
/**
|
|
6740
|
-
* Get a notification channel by id.
|
|
6741
|
-
* @summary Get notification channel
|
|
6742
|
-
*/
|
|
6743
|
-
export const getNotificationChannelPathChannelIdRegExp = new RegExp('^[0-7][0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{25}$');
|
|
6744
|
-
export const getNotificationChannelParams = zod.object({
|
|
6745
|
-
channelId: zod.coerce
|
|
6746
|
-
.string()
|
|
6747
|
-
.regex(getNotificationChannelPathChannelIdRegExp),
|
|
6748
|
-
});
|
|
6749
|
-
/**
|
|
6750
|
-
* Soft delete notification channel by id.
|
|
6751
|
-
|
|
6752
|
-
Once a notification channel is deleted it cannot be undeleted.
|
|
6753
|
-
* @summary Delete a notification channel
|
|
6754
|
-
*/
|
|
6755
|
-
export const deleteNotificationChannelPathChannelIdRegExp = new RegExp('^[0-7][0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{25}$');
|
|
6756
|
-
export const deleteNotificationChannelParams = zod.object({
|
|
6757
|
-
channelId: zod.coerce
|
|
6758
|
-
.string()
|
|
6759
|
-
.regex(deleteNotificationChannelPathChannelIdRegExp),
|
|
6760
|
-
});
|
|
6761
|
-
/**
|
|
6762
|
-
* List all notification events.
|
|
6763
|
-
* @summary List notification events
|
|
6764
|
-
*/
|
|
6765
|
-
export const listNotificationEventsQueryRuleItemRegExp = new RegExp('^[0-7][0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{25}$');
|
|
6766
|
-
export const listNotificationEventsQueryChannelItemRegExp = new RegExp('^[0-7][0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{25}$');
|
|
6767
|
-
export const listNotificationEventsQueryPageDefault = 1;
|
|
6768
|
-
export const listNotificationEventsQueryPageSizeDefault = 100;
|
|
6769
|
-
export const listNotificationEventsQueryPageSizeMax = 1000;
|
|
6770
|
-
export const listNotificationEventsQueryParams = zod.object({
|
|
6771
|
-
channel: zod
|
|
6772
|
-
.array(zod.coerce
|
|
6773
|
-
.string()
|
|
6774
|
-
.regex(listNotificationEventsQueryChannelItemRegExp)
|
|
6775
|
-
.describe('ULID (Universally Unique Lexicographically Sortable Identifier).'))
|
|
6776
|
-
.optional()
|
|
6777
|
-
.describe('Filtering by multiple channel ids.\n\nUsage: `?channel=01J8J4RXH778XB056JS088PCYT&channel=01J8J4S1R1G9EVN62RG23A9M6J`'),
|
|
6778
|
-
feature: zod
|
|
6779
|
-
.array(zod.coerce.string())
|
|
6780
|
-
.optional()
|
|
6781
|
-
.describe('Filtering by multiple feature ids or keys.\n\nUsage: `?feature=feature-1&feature=feature-2`'),
|
|
6782
|
-
from: zod.coerce
|
|
6783
|
-
.date()
|
|
6784
|
-
.optional()
|
|
6785
|
-
.describe('Start date-time in RFC 3339 format.\nInclusive.'),
|
|
6786
|
-
order: zod.enum(['ASC', 'DESC']).optional().describe('The order direction.'),
|
|
6787
|
-
orderBy: zod
|
|
6788
|
-
.enum(['id', 'createdAt'])
|
|
6789
|
-
.optional()
|
|
6790
|
-
.describe('The order by field.'),
|
|
6791
|
-
page: zod.coerce
|
|
6792
|
-
.number()
|
|
6793
|
-
.min(1)
|
|
6794
|
-
.default(listNotificationEventsQueryPageDefault)
|
|
6795
|
-
.describe('Page index.\n\nDefault is 1.'),
|
|
6796
|
-
pageSize: zod.coerce
|
|
6797
|
-
.number()
|
|
6798
|
-
.min(1)
|
|
6799
|
-
.max(listNotificationEventsQueryPageSizeMax)
|
|
6800
|
-
.default(listNotificationEventsQueryPageSizeDefault)
|
|
6801
|
-
.describe('The maximum number of items per page.\n\nDefault is 100.'),
|
|
6802
|
-
rule: zod
|
|
6803
|
-
.array(zod.coerce
|
|
6804
|
-
.string()
|
|
6805
|
-
.regex(listNotificationEventsQueryRuleItemRegExp)
|
|
6806
|
-
.describe('ULID (Universally Unique Lexicographically Sortable Identifier).'))
|
|
6807
|
-
.optional()
|
|
6808
|
-
.describe('Filtering by multiple rule ids.\n\nUsage: `?rule=01J8J2XYZ2N5WBYK09EDZFBSZM&rule=01J8J4R4VZH180KRKQ63NB2VA5`'),
|
|
6809
|
-
subject: zod
|
|
6810
|
-
.array(zod.coerce.string())
|
|
6811
|
-
.optional()
|
|
6812
|
-
.describe('Filtering by multiple subject ids or keys.\n\nUsage: `?subject=subject-1&subject=subject-2`'),
|
|
6813
|
-
to: zod.coerce
|
|
6814
|
-
.date()
|
|
6815
|
-
.optional()
|
|
6816
|
-
.describe('End date-time in RFC 3339 format.\nInclusive.'),
|
|
6817
|
-
});
|
|
6818
|
-
/**
|
|
6819
|
-
* Get a notification event by id.
|
|
6820
|
-
* @summary Get notification event
|
|
6821
|
-
*/
|
|
6822
|
-
export const getNotificationEventParams = zod.object({
|
|
6823
|
-
eventId: zod.coerce.string(),
|
|
6824
|
-
});
|
|
6825
|
-
/**
|
|
6826
|
-
* List all notification rules.
|
|
6827
|
-
* @summary List notification rules
|
|
6828
|
-
*/
|
|
6829
|
-
export const listNotificationRulesQueryIncludeDeletedDefault = false;
|
|
6830
|
-
export const listNotificationRulesQueryIncludeDisabledDefault = false;
|
|
6831
|
-
export const listNotificationRulesQueryFeatureItemMax = 64;
|
|
6832
|
-
export const listNotificationRulesQueryFeatureItemRegExp = new RegExp('^[a-z0-9]+(?:_[a-z0-9]+)*$|^[0-7][0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{25}$');
|
|
6833
|
-
export const listNotificationRulesQueryPageDefault = 1;
|
|
6834
|
-
export const listNotificationRulesQueryPageSizeDefault = 100;
|
|
6835
|
-
export const listNotificationRulesQueryPageSizeMax = 1000;
|
|
6836
|
-
export const listNotificationRulesQueryParams = zod.object({
|
|
6837
|
-
channel: zod
|
|
6838
|
-
.array(zod.coerce.string())
|
|
6839
|
-
.optional()
|
|
6840
|
-
.describe('Filtering by multiple notifiaction channel ids.\n\nUsage: `?channel=01ARZ3NDEKTSV4RRFFQ69G5FAV&channel=01J8J2Y5X4NNGQS32CF81W95E3`'),
|
|
6841
|
-
feature: zod
|
|
6842
|
-
.array(zod.coerce
|
|
6843
|
-
.string()
|
|
6844
|
-
.min(1)
|
|
6845
|
-
.max(listNotificationRulesQueryFeatureItemMax)
|
|
6846
|
-
.regex(listNotificationRulesQueryFeatureItemRegExp)
|
|
6847
|
-
.describe('ULID (Universally Unique Lexicographically Sortable Identifier).\nA key is a unique string that is used to identify a resource.\n\nTODO: this is a temporary solution to support both ULID and Key in the same spec for codegen.'))
|
|
6848
|
-
.optional()
|
|
6849
|
-
.describe('Filtering by multiple feature ids/keys.\n\nUsage: `?feature=feature-1&feature=feature-2`'),
|
|
6850
|
-
includeDeleted: zod.coerce
|
|
6851
|
-
.boolean()
|
|
6852
|
-
.optional()
|
|
6853
|
-
.describe('Include deleted notification rules in response.\n\nUsage: `?includeDeleted=true`'),
|
|
6854
|
-
includeDisabled: zod.coerce
|
|
6855
|
-
.boolean()
|
|
6856
|
-
.optional()
|
|
6857
|
-
.describe('Include disabled notification rules in response.\n\nUsage: `?includeDisabled=false`'),
|
|
6858
|
-
order: zod.enum(['ASC', 'DESC']).optional().describe('The order direction.'),
|
|
6859
|
-
orderBy: zod
|
|
6860
|
-
.enum(['id', 'type', 'createdAt', 'updatedAt'])
|
|
6861
|
-
.optional()
|
|
6862
|
-
.describe('The order by field.'),
|
|
6863
|
-
page: zod.coerce
|
|
6864
|
-
.number()
|
|
6164
|
+
.describe('The order by field.'),
|
|
6165
|
+
page: zod.coerce
|
|
6166
|
+
.number()
|
|
6865
6167
|
.min(1)
|
|
6866
6168
|
.default(listNotificationRulesQueryPageDefault)
|
|
6867
6169
|
.describe('Page index.\n\nDefault is 1.'),
|
|
@@ -9266,7 +8568,9 @@ export const createEntitlementBody = zod
|
|
|
9266
8568
|
.describe('A date-time anchor to base the recurring period on.'),
|
|
9267
8569
|
interval: zod
|
|
9268
8570
|
.union([
|
|
9269
|
-
zod.coerce
|
|
8571
|
+
zod.coerce
|
|
8572
|
+
.string()
|
|
8573
|
+
.regex(createEntitlementBodyUsagePeriodIntervalRegExpTwo),
|
|
9270
8574
|
zod
|
|
9271
8575
|
.enum(['DAY', 'WEEK', 'MONTH', 'YEAR'])
|
|
9272
8576
|
.describe('The unit of time for the interval.\nOne of: `day`, `week`, `month`, or `year`.'),
|
|
@@ -9309,7 +8613,9 @@ export const createEntitlementBody = zod
|
|
|
9309
8613
|
.describe('A date-time anchor to base the recurring period on.'),
|
|
9310
8614
|
interval: zod
|
|
9311
8615
|
.union([
|
|
9312
|
-
zod.coerce
|
|
8616
|
+
zod.coerce
|
|
8617
|
+
.string()
|
|
8618
|
+
.regex(createEntitlementBodyUsagePeriodIntervalRegExpSix),
|
|
9313
8619
|
zod
|
|
9314
8620
|
.enum(['DAY', 'WEEK', 'MONTH', 'YEAR'])
|
|
9315
8621
|
.describe('The unit of time for the interval.\nOne of: `day`, `week`, `month`, or `year`.'),
|
|
@@ -9350,7 +8656,9 @@ export const createEntitlementBody = zod
|
|
|
9350
8656
|
.describe('A date-time anchor to base the recurring period on.'),
|
|
9351
8657
|
interval: zod
|
|
9352
8658
|
.union([
|
|
9353
|
-
zod.coerce
|
|
8659
|
+
zod.coerce
|
|
8660
|
+
.string()
|
|
8661
|
+
.regex(createEntitlementBodyUsagePeriodIntervalRegExpOnezero),
|
|
9354
8662
|
zod
|
|
9355
8663
|
.enum(['DAY', 'WEEK', 'MONTH', 'YEAR'])
|
|
9356
8664
|
.describe('The unit of time for the interval.\nOne of: `day`, `week`, `month`, or `year`.'),
|
|
@@ -9462,7 +8770,9 @@ export const createGrantBody = zod
|
|
|
9462
8770
|
.describe('A date-time anchor to base the recurring period on.'),
|
|
9463
8771
|
interval: zod
|
|
9464
8772
|
.union([
|
|
9465
|
-
zod.coerce
|
|
8773
|
+
zod.coerce
|
|
8774
|
+
.string()
|
|
8775
|
+
.regex(createGrantBodyRecurrenceIntervalRegExpTwo),
|
|
9466
8776
|
zod
|
|
9467
8777
|
.enum(['DAY', 'WEEK', 'MONTH', 'YEAR'])
|
|
9468
8778
|
.describe('The unit of time for the interval.\nOne of: `day`, `week`, `month`, or `year`.'),
|
|
@@ -9565,7 +8875,9 @@ export const overrideEntitlementBody = zod
|
|
|
9565
8875
|
.describe('A date-time anchor to base the recurring period on.'),
|
|
9566
8876
|
interval: zod
|
|
9567
8877
|
.union([
|
|
9568
|
-
zod.coerce
|
|
8878
|
+
zod.coerce
|
|
8879
|
+
.string()
|
|
8880
|
+
.regex(overrideEntitlementBodyUsagePeriodIntervalRegExpTwo),
|
|
9569
8881
|
zod
|
|
9570
8882
|
.enum(['DAY', 'WEEK', 'MONTH', 'YEAR'])
|
|
9571
8883
|
.describe('The unit of time for the interval.\nOne of: `day`, `week`, `month`, or `year`.'),
|
|
@@ -9608,7 +8920,9 @@ export const overrideEntitlementBody = zod
|
|
|
9608
8920
|
.describe('A date-time anchor to base the recurring period on.'),
|
|
9609
8921
|
interval: zod
|
|
9610
8922
|
.union([
|
|
9611
|
-
zod.coerce
|
|
8923
|
+
zod.coerce
|
|
8924
|
+
.string()
|
|
8925
|
+
.regex(overrideEntitlementBodyUsagePeriodIntervalRegExpSix),
|
|
9612
8926
|
zod
|
|
9613
8927
|
.enum(['DAY', 'WEEK', 'MONTH', 'YEAR'])
|
|
9614
8928
|
.describe('The unit of time for the interval.\nOne of: `day`, `week`, `month`, or `year`.'),
|
|
@@ -9649,7 +8963,9 @@ export const overrideEntitlementBody = zod
|
|
|
9649
8963
|
.describe('A date-time anchor to base the recurring period on.'),
|
|
9650
8964
|
interval: zod
|
|
9651
8965
|
.union([
|
|
9652
|
-
zod.coerce
|
|
8966
|
+
zod.coerce
|
|
8967
|
+
.string()
|
|
8968
|
+
.regex(overrideEntitlementBodyUsagePeriodIntervalRegExpOnezero),
|
|
9653
8969
|
zod
|
|
9654
8970
|
.enum(['DAY', 'WEEK', 'MONTH', 'YEAR'])
|
|
9655
8971
|
.describe('The unit of time for the interval.\nOne of: `day`, `week`, `month`, or `year`.'),
|
|
@@ -12070,85 +11386,955 @@ export const changeSubscriptionBody = zod
|
|
|
12070
11386
|
.default(changeSubscriptionBodyCustomPlanProRatingConfigDefault)
|
|
12071
11387
|
.describe('Default pro-rating configuration for subscriptions using this plan.'),
|
|
12072
11388
|
})
|
|
12073
|
-
.describe('The template for omitting properties.')
|
|
12074
|
-
.describe('Plan input for custom subscription creation (without key and version).')
|
|
12075
|
-
.describe('The custom plan description which defines the Subscription.'),
|
|
12076
|
-
timing: zod
|
|
12077
|
-
.union([
|
|
12078
|
-
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.'),
|
|
12081
|
-
zod.coerce
|
|
11389
|
+
.describe('The template for omitting properties.')
|
|
11390
|
+
.describe('Plan input for custom subscription creation (without key and version).')
|
|
11391
|
+
.describe('The custom plan description which defines the Subscription.'),
|
|
11392
|
+
timing: zod
|
|
11393
|
+
.union([
|
|
11394
|
+
zod
|
|
11395
|
+
.enum(['immediate', 'next_billing_cycle'])
|
|
11396
|
+
.describe('Subscription edit timing.\nWhen immediate, the requested changes take effect immediately.\nWhen nextBillingCycle, the requested changes take effect at the next billing cycle.'),
|
|
11397
|
+
zod.coerce
|
|
11398
|
+
.date()
|
|
11399
|
+
.describe('[RFC3339](https://tools.ietf.org/html/rfc3339) formatted date-time string in UTC.'),
|
|
11400
|
+
])
|
|
11401
|
+
.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.')
|
|
11402
|
+
.describe('Timing configuration for the change, when the change should take effect.\nFor changing a subscription, the accepted values depend on the subscription configuration.'),
|
|
11403
|
+
})
|
|
11404
|
+
.describe('Change a custom subscription.'),
|
|
11405
|
+
])
|
|
11406
|
+
.describe('Change a subscription.');
|
|
11407
|
+
/**
|
|
11408
|
+
* Migrates the subscripiton to the provided version of the current plan.
|
|
11409
|
+
If possible, the migration will be done immediately.
|
|
11410
|
+
If not, the migration will be scheduled to the end of the current billing period.
|
|
11411
|
+
* @summary Migrate subscription
|
|
11412
|
+
*/
|
|
11413
|
+
export const migrateSubscriptionPathSubscriptionIdRegExp = new RegExp('^[0-7][0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{25}$');
|
|
11414
|
+
export const migrateSubscriptionParams = zod.object({
|
|
11415
|
+
subscriptionId: zod.coerce
|
|
11416
|
+
.string()
|
|
11417
|
+
.regex(migrateSubscriptionPathSubscriptionIdRegExp),
|
|
11418
|
+
});
|
|
11419
|
+
export const migrateSubscriptionBodyTimingDefault = 'immediate';
|
|
11420
|
+
export const migrateSubscriptionBody = zod.object({
|
|
11421
|
+
billingAnchor: zod.coerce
|
|
11422
|
+
.date()
|
|
11423
|
+
.optional()
|
|
11424
|
+
.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.'),
|
|
11425
|
+
startingPhase: zod.coerce
|
|
11426
|
+
.string()
|
|
11427
|
+
.min(1)
|
|
11428
|
+
.optional()
|
|
11429
|
+
.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.'),
|
|
11430
|
+
targetVersion: zod.coerce
|
|
11431
|
+
.number()
|
|
11432
|
+
.min(1)
|
|
11433
|
+
.optional()
|
|
11434
|
+
.describe('The version of the plan to migrate to.\nIf not provided, the subscription will migrate to the latest version of the current plan.'),
|
|
11435
|
+
timing: zod
|
|
11436
|
+
.union([
|
|
11437
|
+
zod
|
|
11438
|
+
.enum(['immediate', 'next_billing_cycle'])
|
|
11439
|
+
.describe('Subscription edit timing.\nWhen immediate, the requested changes take effect immediately.\nWhen nextBillingCycle, the requested changes take effect at the next billing cycle.'),
|
|
11440
|
+
zod.coerce
|
|
11441
|
+
.date()
|
|
11442
|
+
.describe('[RFC3339](https://tools.ietf.org/html/rfc3339) formatted date-time string in UTC.'),
|
|
11443
|
+
])
|
|
11444
|
+
.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.')
|
|
11445
|
+
.default(migrateSubscriptionBodyTimingDefault)
|
|
11446
|
+
.describe('Timing configuration for the migration, when the migration should take effect.\nIf not supported by the subscription, 400 will be returned.'),
|
|
11447
|
+
});
|
|
11448
|
+
/**
|
|
11449
|
+
* Restores a canceled subscription.
|
|
11450
|
+
Any subscription scheduled to start later will be deleted and this subscription will be continued indefinitely.
|
|
11451
|
+
* @summary Restore subscription
|
|
11452
|
+
*/
|
|
11453
|
+
export const restoreSubscriptionPathSubscriptionIdRegExp = new RegExp('^[0-7][0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{25}$');
|
|
11454
|
+
export const restoreSubscriptionParams = zod.object({
|
|
11455
|
+
subscriptionId: zod.coerce
|
|
11456
|
+
.string()
|
|
11457
|
+
.regex(restoreSubscriptionPathSubscriptionIdRegExp),
|
|
11458
|
+
});
|
|
11459
|
+
/**
|
|
11460
|
+
* Cancels the scheduled cancelation.
|
|
11461
|
+
* @summary Unschedule cancelation
|
|
11462
|
+
*/
|
|
11463
|
+
export const unscheduleCancelationPathSubscriptionIdRegExp = new RegExp('^[0-7][0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{25}$');
|
|
11464
|
+
export const unscheduleCancelationParams = zod.object({
|
|
11465
|
+
subscriptionId: zod.coerce
|
|
11466
|
+
.string()
|
|
11467
|
+
.regex(unscheduleCancelationPathSubscriptionIdRegExp),
|
|
11468
|
+
});
|
|
11469
|
+
/**
|
|
11470
|
+
* 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).
|
|
11471
|
+
|
|
11472
|
+
- Boolean entitlements define static feature access, e.g. "Can use SSO authentication".
|
|
11473
|
+
- Static entitlements let you pass along a configuration while granting access, e.g. "Using this feature with X Y settings" (passed in the config).
|
|
11474
|
+
- 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.
|
|
11475
|
+
|
|
11476
|
+
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.
|
|
11477
|
+
|
|
11478
|
+
Once an entitlement is created you cannot modify it, only delete it.
|
|
11479
|
+
* @summary Create a customer entitlement
|
|
11480
|
+
*/
|
|
11481
|
+
export const createCustomerEntitlementV2Params = zod.object({
|
|
11482
|
+
customerIdOrKey: zod.union([
|
|
11483
|
+
zod.coerce
|
|
11484
|
+
.string()
|
|
11485
|
+
.regex(createCustomerEntitlementV2PathCustomerIdOrKeyRegExpOne)
|
|
11486
|
+
.describe('ULID (Universally Unique Lexicographically Sortable Identifier).'),
|
|
11487
|
+
zod.coerce
|
|
11488
|
+
.string()
|
|
11489
|
+
.min(1)
|
|
11490
|
+
.max(createCustomerEntitlementV2PathCustomerIdOrKeyMaxTwo)
|
|
11491
|
+
.describe('ExternalKey is a looser version of key.'),
|
|
11492
|
+
]),
|
|
11493
|
+
});
|
|
11494
|
+
export const createCustomerEntitlementV2BodyFeatureKeyMax = 64;
|
|
11495
|
+
export const createCustomerEntitlementV2BodyFeatureKeyRegExp = new RegExp('^[a-z0-9]+(?:_[a-z0-9]+)*$');
|
|
11496
|
+
export const createCustomerEntitlementV2BodyFeatureIdRegExp = new RegExp('^[0-7][0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{25}$');
|
|
11497
|
+
export const createCustomerEntitlementV2BodyIsSoftLimitDefault = false;
|
|
11498
|
+
export const createCustomerEntitlementV2BodyIsUnlimitedDefault = false;
|
|
11499
|
+
export const createCustomerEntitlementV2BodyIssueAfterResetMin = 0;
|
|
11500
|
+
export const createCustomerEntitlementV2BodyIssueAfterResetPriorityDefault = 1;
|
|
11501
|
+
export const createCustomerEntitlementV2BodyIssueAfterResetPriorityMax = 255;
|
|
11502
|
+
export const createCustomerEntitlementV2BodyPreserveOverageAtResetDefault = false;
|
|
11503
|
+
export const createCustomerEntitlementV2BodyFeatureKeyMaxOne = 64;
|
|
11504
|
+
export const createCustomerEntitlementV2BodyFeatureKeyRegExpOne = new RegExp('^[a-z0-9]+(?:_[a-z0-9]+)*$');
|
|
11505
|
+
export const createCustomerEntitlementV2BodyFeatureIdRegExpOne = new RegExp('^[0-7][0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{25}$');
|
|
11506
|
+
export const createCustomerEntitlementV2BodyFeatureKeyMaxTwo = 64;
|
|
11507
|
+
export const createCustomerEntitlementV2BodyFeatureKeyRegExpTwo = new RegExp('^[a-z0-9]+(?:_[a-z0-9]+)*$');
|
|
11508
|
+
export const createCustomerEntitlementV2BodyFeatureIdRegExpTwo = new RegExp('^[0-7][0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{25}$');
|
|
11509
|
+
export const createCustomerEntitlementV2Body = zod
|
|
11510
|
+
.union([
|
|
11511
|
+
zod
|
|
11512
|
+
.object({
|
|
11513
|
+
featureId: zod.coerce
|
|
11514
|
+
.string()
|
|
11515
|
+
.regex(createCustomerEntitlementV2BodyFeatureIdRegExp)
|
|
11516
|
+
.optional()
|
|
11517
|
+
.describe('The feature the subject is entitled to use.\nEither featureKey or featureId is required.'),
|
|
11518
|
+
featureKey: zod.coerce
|
|
11519
|
+
.string()
|
|
11520
|
+
.min(1)
|
|
11521
|
+
.max(createCustomerEntitlementV2BodyFeatureKeyMax)
|
|
11522
|
+
.regex(createCustomerEntitlementV2BodyFeatureKeyRegExp)
|
|
11523
|
+
.optional()
|
|
11524
|
+
.describe('The feature the subject is entitled to use.\nEither featureKey or featureId is required.'),
|
|
11525
|
+
isSoftLimit: zod.coerce
|
|
11526
|
+
.boolean()
|
|
11527
|
+
.optional()
|
|
11528
|
+
.describe('If softLimit=true the subject can use the feature even if the entitlement is exhausted, hasAccess will always be true.'),
|
|
11529
|
+
issueAfterReset: zod.coerce
|
|
11530
|
+
.number()
|
|
11531
|
+
.min(createCustomerEntitlementV2BodyIssueAfterResetMin)
|
|
11532
|
+
.optional()
|
|
11533
|
+
.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.'),
|
|
11534
|
+
issueAfterResetPriority: zod.coerce
|
|
11535
|
+
.number()
|
|
11536
|
+
.min(1)
|
|
11537
|
+
.max(createCustomerEntitlementV2BodyIssueAfterResetPriorityMax)
|
|
11538
|
+
.default(createCustomerEntitlementV2BodyIssueAfterResetPriorityDefault)
|
|
11539
|
+
.describe('Defines the grant priority for the default grant.'),
|
|
11540
|
+
isUnlimited: zod.coerce
|
|
11541
|
+
.boolean()
|
|
11542
|
+
.optional()
|
|
11543
|
+
.describe('Deprecated, ignored by the backend. Please use isSoftLimit instead; this field will be removed in the future.'),
|
|
11544
|
+
measureUsageFrom: zod
|
|
11545
|
+
.union([
|
|
11546
|
+
zod
|
|
11547
|
+
.enum(['CURRENT_PERIOD_START', 'NOW'])
|
|
11548
|
+
.describe('Start of measurement options'),
|
|
11549
|
+
zod.coerce
|
|
11550
|
+
.date()
|
|
11551
|
+
.describe('[RFC3339](https://tools.ietf.org/html/rfc3339) formatted date-time string in UTC.'),
|
|
11552
|
+
])
|
|
11553
|
+
.describe('Measure usage from')
|
|
11554
|
+
.optional()
|
|
11555
|
+
.describe('Defines the time from which usage is measured. If not specified on creation, defaults to entitlement creation time.'),
|
|
11556
|
+
metadata: zod
|
|
11557
|
+
.record(zod.string(), zod.coerce.string())
|
|
11558
|
+
.describe('Set of key-value pairs.\nMetadata can be used to store additional information about a resource.')
|
|
11559
|
+
.optional()
|
|
11560
|
+
.describe('Additional metadata for the feature.'),
|
|
11561
|
+
preserveOverageAtReset: zod.coerce
|
|
11562
|
+
.boolean()
|
|
11563
|
+
.optional()
|
|
11564
|
+
.describe('If true, the overage is preserved at reset. If false, the usage is reset to 0.'),
|
|
11565
|
+
type: zod.enum(['metered']),
|
|
11566
|
+
usagePeriod: zod
|
|
11567
|
+
.object({
|
|
11568
|
+
anchor: zod.coerce
|
|
11569
|
+
.date()
|
|
11570
|
+
.optional()
|
|
11571
|
+
.describe('A date-time anchor to base the recurring period on.'),
|
|
11572
|
+
interval: zod
|
|
11573
|
+
.union([
|
|
11574
|
+
zod.coerce
|
|
11575
|
+
.string()
|
|
11576
|
+
.regex(createCustomerEntitlementV2BodyUsagePeriodIntervalRegExpTwo),
|
|
11577
|
+
zod
|
|
11578
|
+
.enum(['DAY', 'WEEK', 'MONTH', 'YEAR'])
|
|
11579
|
+
.describe('The unit of time for the interval.\nOne of: `day`, `week`, `month`, or `year`.'),
|
|
11580
|
+
])
|
|
11581
|
+
.describe('Period duration for the recurrence')
|
|
11582
|
+
.describe('The unit of time for the interval.'),
|
|
11583
|
+
})
|
|
11584
|
+
.describe('Recurring period with an interval and an anchor.')
|
|
11585
|
+
.describe('The usage period associated with the entitlement.'),
|
|
11586
|
+
})
|
|
11587
|
+
.describe('Create inpurs for metered entitlement'),
|
|
11588
|
+
zod
|
|
11589
|
+
.object({
|
|
11590
|
+
config: zod.coerce
|
|
11591
|
+
.string()
|
|
11592
|
+
.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.'),
|
|
11593
|
+
featureId: zod.coerce
|
|
11594
|
+
.string()
|
|
11595
|
+
.regex(createCustomerEntitlementV2BodyFeatureIdRegExpOne)
|
|
11596
|
+
.optional()
|
|
11597
|
+
.describe('The feature the subject is entitled to use.\nEither featureKey or featureId is required.'),
|
|
11598
|
+
featureKey: zod.coerce
|
|
11599
|
+
.string()
|
|
11600
|
+
.min(1)
|
|
11601
|
+
.max(createCustomerEntitlementV2BodyFeatureKeyMaxOne)
|
|
11602
|
+
.regex(createCustomerEntitlementV2BodyFeatureKeyRegExpOne)
|
|
11603
|
+
.optional()
|
|
11604
|
+
.describe('The feature the subject is entitled to use.\nEither featureKey or featureId is required.'),
|
|
11605
|
+
metadata: zod
|
|
11606
|
+
.record(zod.string(), zod.coerce.string())
|
|
11607
|
+
.describe('Set of key-value pairs.\nMetadata can be used to store additional information about a resource.')
|
|
11608
|
+
.optional()
|
|
11609
|
+
.describe('Additional metadata for the feature.'),
|
|
11610
|
+
type: zod.enum(['static']),
|
|
11611
|
+
usagePeriod: zod
|
|
11612
|
+
.object({
|
|
11613
|
+
anchor: zod.coerce
|
|
11614
|
+
.date()
|
|
11615
|
+
.optional()
|
|
11616
|
+
.describe('A date-time anchor to base the recurring period on.'),
|
|
11617
|
+
interval: zod
|
|
11618
|
+
.union([
|
|
11619
|
+
zod.coerce
|
|
11620
|
+
.string()
|
|
11621
|
+
.regex(createCustomerEntitlementV2BodyUsagePeriodIntervalRegExpSix),
|
|
11622
|
+
zod
|
|
11623
|
+
.enum(['DAY', 'WEEK', 'MONTH', 'YEAR'])
|
|
11624
|
+
.describe('The unit of time for the interval.\nOne of: `day`, `week`, `month`, or `year`.'),
|
|
11625
|
+
])
|
|
11626
|
+
.describe('Period duration for the recurrence')
|
|
11627
|
+
.describe('The unit of time for the interval.'),
|
|
11628
|
+
})
|
|
11629
|
+
.describe('Recurring period with an interval and an anchor.')
|
|
11630
|
+
.optional()
|
|
11631
|
+
.describe('The usage period associated with the entitlement.'),
|
|
11632
|
+
})
|
|
11633
|
+
.describe('Create inputs for static entitlement'),
|
|
11634
|
+
zod
|
|
11635
|
+
.object({
|
|
11636
|
+
featureId: zod.coerce
|
|
11637
|
+
.string()
|
|
11638
|
+
.regex(createCustomerEntitlementV2BodyFeatureIdRegExpTwo)
|
|
11639
|
+
.optional()
|
|
11640
|
+
.describe('The feature the subject is entitled to use.\nEither featureKey or featureId is required.'),
|
|
11641
|
+
featureKey: zod.coerce
|
|
11642
|
+
.string()
|
|
11643
|
+
.min(1)
|
|
11644
|
+
.max(createCustomerEntitlementV2BodyFeatureKeyMaxTwo)
|
|
11645
|
+
.regex(createCustomerEntitlementV2BodyFeatureKeyRegExpTwo)
|
|
11646
|
+
.optional()
|
|
11647
|
+
.describe('The feature the subject is entitled to use.\nEither featureKey or featureId is required.'),
|
|
11648
|
+
metadata: zod
|
|
11649
|
+
.record(zod.string(), zod.coerce.string())
|
|
11650
|
+
.describe('Set of key-value pairs.\nMetadata can be used to store additional information about a resource.')
|
|
11651
|
+
.optional()
|
|
11652
|
+
.describe('Additional metadata for the feature.'),
|
|
11653
|
+
type: zod.enum(['boolean']),
|
|
11654
|
+
usagePeriod: zod
|
|
11655
|
+
.object({
|
|
11656
|
+
anchor: zod.coerce
|
|
11657
|
+
.date()
|
|
11658
|
+
.optional()
|
|
11659
|
+
.describe('A date-time anchor to base the recurring period on.'),
|
|
11660
|
+
interval: zod
|
|
11661
|
+
.union([
|
|
11662
|
+
zod.coerce
|
|
11663
|
+
.string()
|
|
11664
|
+
.regex(createCustomerEntitlementV2BodyUsagePeriodIntervalRegExpOnezero),
|
|
11665
|
+
zod
|
|
11666
|
+
.enum(['DAY', 'WEEK', 'MONTH', 'YEAR'])
|
|
11667
|
+
.describe('The unit of time for the interval.\nOne of: `day`, `week`, `month`, or `year`.'),
|
|
11668
|
+
])
|
|
11669
|
+
.describe('Period duration for the recurrence')
|
|
11670
|
+
.describe('The unit of time for the interval.'),
|
|
11671
|
+
})
|
|
11672
|
+
.describe('Recurring period with an interval and an anchor.')
|
|
11673
|
+
.optional()
|
|
11674
|
+
.describe('The usage period associated with the entitlement.'),
|
|
11675
|
+
})
|
|
11676
|
+
.describe('Create inputs for boolean entitlement'),
|
|
11677
|
+
])
|
|
11678
|
+
.describe('Create inputs for entitlement');
|
|
11679
|
+
/**
|
|
11680
|
+
* List all entitlements for a customer. For checking entitlement access, use the /value endpoint instead.
|
|
11681
|
+
* @summary List customer entitlements
|
|
11682
|
+
*/
|
|
11683
|
+
export const listCustomerEntitlementsV2Params = zod.object({
|
|
11684
|
+
customerIdOrKey: zod.union([
|
|
11685
|
+
zod.coerce
|
|
11686
|
+
.string()
|
|
11687
|
+
.regex(listCustomerEntitlementsV2PathCustomerIdOrKeyRegExpOne)
|
|
11688
|
+
.describe('ULID (Universally Unique Lexicographically Sortable Identifier).'),
|
|
11689
|
+
zod.coerce
|
|
11690
|
+
.string()
|
|
11691
|
+
.min(1)
|
|
11692
|
+
.max(listCustomerEntitlementsV2PathCustomerIdOrKeyMaxTwo)
|
|
11693
|
+
.describe('ExternalKey is a looser version of key.'),
|
|
11694
|
+
]),
|
|
11695
|
+
});
|
|
11696
|
+
export const listCustomerEntitlementsV2QueryIncludeDeletedDefault = false;
|
|
11697
|
+
export const listCustomerEntitlementsV2QueryPageDefault = 1;
|
|
11698
|
+
export const listCustomerEntitlementsV2QueryPageSizeDefault = 100;
|
|
11699
|
+
export const listCustomerEntitlementsV2QueryPageSizeMax = 1000;
|
|
11700
|
+
export const listCustomerEntitlementsV2QueryParams = zod.object({
|
|
11701
|
+
includeDeleted: zod.coerce.boolean().optional(),
|
|
11702
|
+
order: zod.enum(['ASC', 'DESC']).optional().describe('The order direction.'),
|
|
11703
|
+
orderBy: zod
|
|
11704
|
+
.enum(['createdAt', 'updatedAt'])
|
|
11705
|
+
.optional()
|
|
11706
|
+
.describe('The order by field.'),
|
|
11707
|
+
page: zod.coerce
|
|
11708
|
+
.number()
|
|
11709
|
+
.min(1)
|
|
11710
|
+
.default(listCustomerEntitlementsV2QueryPageDefault)
|
|
11711
|
+
.describe('Page index.\n\nDefault is 1.'),
|
|
11712
|
+
pageSize: zod.coerce
|
|
11713
|
+
.number()
|
|
11714
|
+
.min(1)
|
|
11715
|
+
.max(listCustomerEntitlementsV2QueryPageSizeMax)
|
|
11716
|
+
.default(listCustomerEntitlementsV2QueryPageSizeDefault)
|
|
11717
|
+
.describe('The maximum number of items per page.\n\nDefault is 100.'),
|
|
11718
|
+
});
|
|
11719
|
+
/**
|
|
11720
|
+
* Get entitlement by feature key. For checking entitlement access, use the /value endpoint instead.
|
|
11721
|
+
If featureKey is used, the entitlement is resolved for the current timestamp.
|
|
11722
|
+
* @summary Get customer entitlement
|
|
11723
|
+
*/
|
|
11724
|
+
export const getCustomerEntitlementV2PathEntitlementIdOrFeatureKeyMax = 64;
|
|
11725
|
+
export const getCustomerEntitlementV2PathEntitlementIdOrFeatureKeyRegExp = new RegExp('^[a-z0-9]+(?:_[a-z0-9]+)*$|^[0-7][0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{25}$');
|
|
11726
|
+
export const getCustomerEntitlementV2Params = zod.object({
|
|
11727
|
+
customerIdOrKey: zod.union([
|
|
11728
|
+
zod.coerce
|
|
11729
|
+
.string()
|
|
11730
|
+
.regex(getCustomerEntitlementV2PathCustomerIdOrKeyRegExpOne)
|
|
11731
|
+
.describe('ULID (Universally Unique Lexicographically Sortable Identifier).'),
|
|
11732
|
+
zod.coerce
|
|
11733
|
+
.string()
|
|
11734
|
+
.min(1)
|
|
11735
|
+
.max(getCustomerEntitlementV2PathCustomerIdOrKeyMaxTwo)
|
|
11736
|
+
.describe('ExternalKey is a looser version of key.'),
|
|
11737
|
+
]),
|
|
11738
|
+
entitlementIdOrFeatureKey: zod.coerce
|
|
11739
|
+
.string()
|
|
11740
|
+
.min(1)
|
|
11741
|
+
.max(getCustomerEntitlementV2PathEntitlementIdOrFeatureKeyMax)
|
|
11742
|
+
.regex(getCustomerEntitlementV2PathEntitlementIdOrFeatureKeyRegExp),
|
|
11743
|
+
});
|
|
11744
|
+
/**
|
|
11745
|
+
* 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.
|
|
11746
|
+
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.
|
|
11747
|
+
* @summary Delete customer entitlement
|
|
11748
|
+
*/
|
|
11749
|
+
export const deleteCustomerEntitlementV2PathEntitlementIdOrFeatureKeyMax = 64;
|
|
11750
|
+
export const deleteCustomerEntitlementV2PathEntitlementIdOrFeatureKeyRegExp = new RegExp('^[a-z0-9]+(?:_[a-z0-9]+)*$|^[0-7][0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{25}$');
|
|
11751
|
+
export const deleteCustomerEntitlementV2Params = zod.object({
|
|
11752
|
+
customerIdOrKey: zod.union([
|
|
11753
|
+
zod.coerce
|
|
11754
|
+
.string()
|
|
11755
|
+
.regex(deleteCustomerEntitlementV2PathCustomerIdOrKeyRegExpOne)
|
|
11756
|
+
.describe('ULID (Universally Unique Lexicographically Sortable Identifier).'),
|
|
11757
|
+
zod.coerce
|
|
11758
|
+
.string()
|
|
11759
|
+
.min(1)
|
|
11760
|
+
.max(deleteCustomerEntitlementV2PathCustomerIdOrKeyMaxTwo)
|
|
11761
|
+
.describe('ExternalKey is a looser version of key.'),
|
|
11762
|
+
]),
|
|
11763
|
+
entitlementIdOrFeatureKey: zod.coerce
|
|
11764
|
+
.string()
|
|
11765
|
+
.min(1)
|
|
11766
|
+
.max(deleteCustomerEntitlementV2PathEntitlementIdOrFeatureKeyMax)
|
|
11767
|
+
.regex(deleteCustomerEntitlementV2PathEntitlementIdOrFeatureKeyRegExp),
|
|
11768
|
+
});
|
|
11769
|
+
/**
|
|
11770
|
+
* List all grants issued for an entitlement. The entitlement can be defined either by its id or featureKey.
|
|
11771
|
+
* @summary List customer entitlement grants
|
|
11772
|
+
*/
|
|
11773
|
+
export const listCustomerEntitlementGrantsV2PathEntitlementIdOrFeatureKeyMax = 64;
|
|
11774
|
+
export const listCustomerEntitlementGrantsV2PathEntitlementIdOrFeatureKeyRegExp = new RegExp('^[a-z0-9]+(?:_[a-z0-9]+)*$|^[0-7][0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{25}$');
|
|
11775
|
+
export const listCustomerEntitlementGrantsV2Params = zod.object({
|
|
11776
|
+
customerIdOrKey: zod.union([
|
|
11777
|
+
zod.coerce
|
|
11778
|
+
.string()
|
|
11779
|
+
.regex(listCustomerEntitlementGrantsV2PathCustomerIdOrKeyRegExpOne)
|
|
11780
|
+
.describe('ULID (Universally Unique Lexicographically Sortable Identifier).'),
|
|
11781
|
+
zod.coerce
|
|
11782
|
+
.string()
|
|
11783
|
+
.min(1)
|
|
11784
|
+
.max(listCustomerEntitlementGrantsV2PathCustomerIdOrKeyMaxTwo)
|
|
11785
|
+
.describe('ExternalKey is a looser version of key.'),
|
|
11786
|
+
]),
|
|
11787
|
+
entitlementIdOrFeatureKey: zod.coerce
|
|
11788
|
+
.string()
|
|
11789
|
+
.min(1)
|
|
11790
|
+
.max(listCustomerEntitlementGrantsV2PathEntitlementIdOrFeatureKeyMax)
|
|
11791
|
+
.regex(listCustomerEntitlementGrantsV2PathEntitlementIdOrFeatureKeyRegExp),
|
|
11792
|
+
});
|
|
11793
|
+
export const listCustomerEntitlementGrantsV2QueryIncludeDeletedDefault = false;
|
|
11794
|
+
export const listCustomerEntitlementGrantsV2QueryPageDefault = 1;
|
|
11795
|
+
export const listCustomerEntitlementGrantsV2QueryPageSizeDefault = 100;
|
|
11796
|
+
export const listCustomerEntitlementGrantsV2QueryPageSizeMax = 1000;
|
|
11797
|
+
export const listCustomerEntitlementGrantsV2QueryOffsetDefault = 0;
|
|
11798
|
+
export const listCustomerEntitlementGrantsV2QueryOffsetMin = 0;
|
|
11799
|
+
export const listCustomerEntitlementGrantsV2QueryLimitDefault = 100;
|
|
11800
|
+
export const listCustomerEntitlementGrantsV2QueryLimitMax = 1000;
|
|
11801
|
+
export const listCustomerEntitlementGrantsV2QueryParams = zod.object({
|
|
11802
|
+
includeDeleted: zod.coerce.boolean().optional(),
|
|
11803
|
+
limit: zod.coerce
|
|
11804
|
+
.number()
|
|
11805
|
+
.min(1)
|
|
11806
|
+
.max(listCustomerEntitlementGrantsV2QueryLimitMax)
|
|
11807
|
+
.default(listCustomerEntitlementGrantsV2QueryLimitDefault)
|
|
11808
|
+
.describe('Number of items to return.\n\nDefault is 100.'),
|
|
11809
|
+
offset: zod.coerce
|
|
11810
|
+
.number()
|
|
11811
|
+
.min(listCustomerEntitlementGrantsV2QueryOffsetMin)
|
|
11812
|
+
.optional()
|
|
11813
|
+
.describe('Number of items to skip.\n\nDefault is 0.'),
|
|
11814
|
+
order: zod.enum(['ASC', 'DESC']).optional().describe('The order direction.'),
|
|
11815
|
+
orderBy: zod
|
|
11816
|
+
.enum(['id', 'createdAt', 'updatedAt'])
|
|
11817
|
+
.optional()
|
|
11818
|
+
.describe('The order by field.'),
|
|
11819
|
+
page: zod.coerce
|
|
11820
|
+
.number()
|
|
11821
|
+
.min(1)
|
|
11822
|
+
.default(listCustomerEntitlementGrantsV2QueryPageDefault)
|
|
11823
|
+
.describe('Page index.\n\nDefault is 1.'),
|
|
11824
|
+
pageSize: zod.coerce
|
|
11825
|
+
.number()
|
|
11826
|
+
.min(1)
|
|
11827
|
+
.max(listCustomerEntitlementGrantsV2QueryPageSizeMax)
|
|
11828
|
+
.default(listCustomerEntitlementGrantsV2QueryPageSizeDefault)
|
|
11829
|
+
.describe('The maximum number of items per page.\n\nDefault is 100.'),
|
|
11830
|
+
});
|
|
11831
|
+
/**
|
|
11832
|
+
* 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.
|
|
11833
|
+
|
|
11834
|
+
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.
|
|
11835
|
+
|
|
11836
|
+
Grants have a priority setting that determines their order of use. Lower numbers have higher priority, with 0 being the highest priority.
|
|
11837
|
+
|
|
11838
|
+
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).
|
|
11839
|
+
|
|
11840
|
+
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))
|
|
11841
|
+
|
|
11842
|
+
Grants cannot be changed once created, only deleted. This is to ensure that balance is deterministic regardless of when it is queried.
|
|
11843
|
+
* @summary Create customer entitlement grant
|
|
11844
|
+
*/
|
|
11845
|
+
export const createCustomerEntitlementGrantV2PathEntitlementIdOrFeatureKeyMax = 64;
|
|
11846
|
+
export const createCustomerEntitlementGrantV2PathEntitlementIdOrFeatureKeyRegExp = new RegExp('^[a-z0-9]+(?:_[a-z0-9]+)*$|^[0-7][0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{25}$');
|
|
11847
|
+
export const createCustomerEntitlementGrantV2Params = zod.object({
|
|
11848
|
+
customerIdOrKey: zod.union([
|
|
11849
|
+
zod.coerce
|
|
11850
|
+
.string()
|
|
11851
|
+
.regex(createCustomerEntitlementGrantV2PathCustomerIdOrKeyRegExpOne)
|
|
11852
|
+
.describe('ULID (Universally Unique Lexicographically Sortable Identifier).'),
|
|
11853
|
+
zod.coerce
|
|
11854
|
+
.string()
|
|
11855
|
+
.min(1)
|
|
11856
|
+
.max(createCustomerEntitlementGrantV2PathCustomerIdOrKeyMaxTwo)
|
|
11857
|
+
.describe('ExternalKey is a looser version of key.'),
|
|
11858
|
+
]),
|
|
11859
|
+
entitlementIdOrFeatureKey: zod.coerce
|
|
11860
|
+
.string()
|
|
11861
|
+
.min(1)
|
|
11862
|
+
.max(createCustomerEntitlementGrantV2PathEntitlementIdOrFeatureKeyMax)
|
|
11863
|
+
.regex(createCustomerEntitlementGrantV2PathEntitlementIdOrFeatureKeyRegExp),
|
|
11864
|
+
});
|
|
11865
|
+
export const createCustomerEntitlementGrantV2BodyAmountMin = 0;
|
|
11866
|
+
export const createCustomerEntitlementGrantV2BodyPriorityMax = 255;
|
|
11867
|
+
export const createCustomerEntitlementGrantV2BodyExpirationCountMax = 1000;
|
|
11868
|
+
export const createCustomerEntitlementGrantV2BodyMaxRolloverAmountDefault = 0;
|
|
11869
|
+
export const createCustomerEntitlementGrantV2BodyMinRolloverAmountDefault = 0;
|
|
11870
|
+
export const createCustomerEntitlementGrantV2Body = zod
|
|
11871
|
+
.object({
|
|
11872
|
+
amount: zod.coerce
|
|
11873
|
+
.number()
|
|
11874
|
+
.min(createCustomerEntitlementGrantV2BodyAmountMin)
|
|
11875
|
+
.describe('The amount to grant. Should be a positive number.'),
|
|
11876
|
+
effectiveAt: zod.coerce
|
|
11877
|
+
.date()
|
|
11878
|
+
.describe('Effective date for grants and anchor for recurring grants. Provided value will be ceiled to metering windowSize (minute).'),
|
|
11879
|
+
expiration: zod
|
|
11880
|
+
.object({
|
|
11881
|
+
count: zod.coerce
|
|
11882
|
+
.number()
|
|
11883
|
+
.min(1)
|
|
11884
|
+
.max(createCustomerEntitlementGrantV2BodyExpirationCountMax)
|
|
11885
|
+
.describe('The number of time units in the expiration period.'),
|
|
11886
|
+
duration: zod
|
|
11887
|
+
.enum(['HOUR', 'DAY', 'WEEK', 'MONTH', 'YEAR'])
|
|
11888
|
+
.describe('The expiration duration enum')
|
|
11889
|
+
.describe('The unit of time for the expiration period.'),
|
|
11890
|
+
})
|
|
11891
|
+
.describe('The grant expiration definition')
|
|
11892
|
+
.describe('The grant expiration definition'),
|
|
11893
|
+
maxRolloverAmount: zod.coerce
|
|
11894
|
+
.number()
|
|
11895
|
+
.optional()
|
|
11896
|
+
.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))'),
|
|
11897
|
+
metadata: zod
|
|
11898
|
+
.record(zod.string(), zod.coerce.string())
|
|
11899
|
+
.describe('Set of key-value pairs.\nMetadata can be used to store additional information about a resource.')
|
|
11900
|
+
.optional()
|
|
11901
|
+
.describe('The grant metadata.'),
|
|
11902
|
+
minRolloverAmount: zod.coerce
|
|
11903
|
+
.number()
|
|
11904
|
+
.optional()
|
|
11905
|
+
.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))'),
|
|
11906
|
+
priority: zod.coerce
|
|
11907
|
+
.number()
|
|
11908
|
+
.min(1)
|
|
11909
|
+
.max(createCustomerEntitlementGrantV2BodyPriorityMax)
|
|
11910
|
+
.optional()
|
|
11911
|
+
.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.'),
|
|
11912
|
+
recurrence: zod
|
|
11913
|
+
.object({
|
|
11914
|
+
anchor: zod.coerce
|
|
11915
|
+
.date()
|
|
11916
|
+
.optional()
|
|
11917
|
+
.describe('A date-time anchor to base the recurring period on.'),
|
|
11918
|
+
interval: zod
|
|
11919
|
+
.union([
|
|
11920
|
+
zod.coerce
|
|
11921
|
+
.string()
|
|
11922
|
+
.regex(createCustomerEntitlementGrantV2BodyRecurrenceIntervalRegExpTwo),
|
|
11923
|
+
zod
|
|
11924
|
+
.enum(['DAY', 'WEEK', 'MONTH', 'YEAR'])
|
|
11925
|
+
.describe('The unit of time for the interval.\nOne of: `day`, `week`, `month`, or `year`.'),
|
|
11926
|
+
])
|
|
11927
|
+
.describe('Period duration for the recurrence')
|
|
11928
|
+
.describe('The unit of time for the interval.'),
|
|
11929
|
+
})
|
|
11930
|
+
.describe('Recurring period with an interval and an anchor.')
|
|
11931
|
+
.optional()
|
|
11932
|
+
.describe('The subject of the grant.'),
|
|
11933
|
+
})
|
|
11934
|
+
.describe('The grant creation input.');
|
|
11935
|
+
/**
|
|
11936
|
+
* Returns historical balance and usage data for the entitlement. The queried history can span accross multiple reset events.
|
|
11937
|
+
|
|
11938
|
+
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.
|
|
11939
|
+
|
|
11940
|
+
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.
|
|
11941
|
+
* @summary Get customer entitlement history
|
|
11942
|
+
*/
|
|
11943
|
+
export const getCustomerEntitlementHistoryV2PathEntitlementIdOrFeatureKeyMax = 64;
|
|
11944
|
+
export const getCustomerEntitlementHistoryV2PathEntitlementIdOrFeatureKeyRegExp = new RegExp('^[a-z0-9]+(?:_[a-z0-9]+)*$|^[0-7][0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{25}$');
|
|
11945
|
+
export const getCustomerEntitlementHistoryV2Params = zod.object({
|
|
11946
|
+
customerIdOrKey: zod.union([
|
|
11947
|
+
zod.coerce
|
|
11948
|
+
.string()
|
|
11949
|
+
.regex(getCustomerEntitlementHistoryV2PathCustomerIdOrKeyRegExpOne)
|
|
11950
|
+
.describe('ULID (Universally Unique Lexicographically Sortable Identifier).'),
|
|
11951
|
+
zod.coerce
|
|
11952
|
+
.string()
|
|
11953
|
+
.min(1)
|
|
11954
|
+
.max(getCustomerEntitlementHistoryV2PathCustomerIdOrKeyMaxTwo)
|
|
11955
|
+
.describe('ExternalKey is a looser version of key.'),
|
|
11956
|
+
]),
|
|
11957
|
+
entitlementIdOrFeatureKey: zod.coerce
|
|
11958
|
+
.string()
|
|
11959
|
+
.min(1)
|
|
11960
|
+
.max(getCustomerEntitlementHistoryV2PathEntitlementIdOrFeatureKeyMax)
|
|
11961
|
+
.regex(getCustomerEntitlementHistoryV2PathEntitlementIdOrFeatureKeyRegExp),
|
|
11962
|
+
});
|
|
11963
|
+
export const getCustomerEntitlementHistoryV2QueryWindowTimeZoneDefault = 'UTC';
|
|
11964
|
+
export const getCustomerEntitlementHistoryV2QueryParams = zod.object({
|
|
11965
|
+
from: zod.coerce
|
|
11966
|
+
.date()
|
|
11967
|
+
.optional()
|
|
11968
|
+
.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.'),
|
|
11969
|
+
to: zod.coerce
|
|
11970
|
+
.date()
|
|
11971
|
+
.optional()
|
|
11972
|
+
.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.'),
|
|
11973
|
+
windowSize: zod
|
|
11974
|
+
.enum(['MINUTE', 'HOUR', 'DAY', 'MONTH'])
|
|
11975
|
+
.describe('Windowsize'),
|
|
11976
|
+
windowTimeZone: zod.coerce
|
|
11977
|
+
.string()
|
|
11978
|
+
.default(getCustomerEntitlementHistoryV2QueryWindowTimeZoneDefault)
|
|
11979
|
+
.describe('The timezone used when calculating the windows.'),
|
|
11980
|
+
});
|
|
11981
|
+
/**
|
|
11982
|
+
* 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.
|
|
11983
|
+
|
|
11984
|
+
This endpoint is useful for upgrades, downgrades, or other changes to entitlements that require a new entitlement to be created with zero downtime.
|
|
11985
|
+
* @summary Override customer entitlement
|
|
11986
|
+
*/
|
|
11987
|
+
export const overrideCustomerEntitlementV2Params = zod.object({
|
|
11988
|
+
customerIdOrKey: zod.union([
|
|
11989
|
+
zod.coerce
|
|
11990
|
+
.string()
|
|
11991
|
+
.regex(overrideCustomerEntitlementV2PathCustomerIdOrKeyRegExpOne)
|
|
11992
|
+
.describe('ULID (Universally Unique Lexicographically Sortable Identifier).'),
|
|
11993
|
+
zod.coerce
|
|
11994
|
+
.string()
|
|
11995
|
+
.min(1)
|
|
11996
|
+
.max(overrideCustomerEntitlementV2PathCustomerIdOrKeyMaxTwo)
|
|
11997
|
+
.describe('ExternalKey is a looser version of key.'),
|
|
11998
|
+
]),
|
|
11999
|
+
entitlementIdOrFeatureKey: zod.union([
|
|
12000
|
+
zod.coerce
|
|
12001
|
+
.string()
|
|
12002
|
+
.regex(overrideCustomerEntitlementV2PathEntitlementIdOrFeatureKeyRegExpOne)
|
|
12003
|
+
.describe('ULID (Universally Unique Lexicographically Sortable Identifier).'),
|
|
12004
|
+
zod.coerce
|
|
12005
|
+
.string()
|
|
12006
|
+
.min(1)
|
|
12007
|
+
.max(overrideCustomerEntitlementV2PathEntitlementIdOrFeatureKeyMaxTwo)
|
|
12008
|
+
.describe('ExternalKey is a looser version of key.'),
|
|
12009
|
+
]),
|
|
12010
|
+
});
|
|
12011
|
+
export const overrideCustomerEntitlementV2BodyFeatureKeyMax = 64;
|
|
12012
|
+
export const overrideCustomerEntitlementV2BodyFeatureKeyRegExp = new RegExp('^[a-z0-9]+(?:_[a-z0-9]+)*$');
|
|
12013
|
+
export const overrideCustomerEntitlementV2BodyFeatureIdRegExp = new RegExp('^[0-7][0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{25}$');
|
|
12014
|
+
export const overrideCustomerEntitlementV2BodyIsSoftLimitDefault = false;
|
|
12015
|
+
export const overrideCustomerEntitlementV2BodyIsUnlimitedDefault = false;
|
|
12016
|
+
export const overrideCustomerEntitlementV2BodyIssueAfterResetMin = 0;
|
|
12017
|
+
export const overrideCustomerEntitlementV2BodyIssueAfterResetPriorityDefault = 1;
|
|
12018
|
+
export const overrideCustomerEntitlementV2BodyIssueAfterResetPriorityMax = 255;
|
|
12019
|
+
export const overrideCustomerEntitlementV2BodyPreserveOverageAtResetDefault = false;
|
|
12020
|
+
export const overrideCustomerEntitlementV2BodyFeatureKeyMaxOne = 64;
|
|
12021
|
+
export const overrideCustomerEntitlementV2BodyFeatureKeyRegExpOne = new RegExp('^[a-z0-9]+(?:_[a-z0-9]+)*$');
|
|
12022
|
+
export const overrideCustomerEntitlementV2BodyFeatureIdRegExpOne = new RegExp('^[0-7][0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{25}$');
|
|
12023
|
+
export const overrideCustomerEntitlementV2BodyFeatureKeyMaxTwo = 64;
|
|
12024
|
+
export const overrideCustomerEntitlementV2BodyFeatureKeyRegExpTwo = new RegExp('^[a-z0-9]+(?:_[a-z0-9]+)*$');
|
|
12025
|
+
export const overrideCustomerEntitlementV2BodyFeatureIdRegExpTwo = new RegExp('^[0-7][0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{25}$');
|
|
12026
|
+
export const overrideCustomerEntitlementV2Body = zod
|
|
12027
|
+
.union([
|
|
12028
|
+
zod
|
|
12029
|
+
.object({
|
|
12030
|
+
featureId: zod.coerce
|
|
12031
|
+
.string()
|
|
12032
|
+
.regex(overrideCustomerEntitlementV2BodyFeatureIdRegExp)
|
|
12033
|
+
.optional()
|
|
12034
|
+
.describe('The feature the subject is entitled to use.\nEither featureKey or featureId is required.'),
|
|
12035
|
+
featureKey: zod.coerce
|
|
12036
|
+
.string()
|
|
12037
|
+
.min(1)
|
|
12038
|
+
.max(overrideCustomerEntitlementV2BodyFeatureKeyMax)
|
|
12039
|
+
.regex(overrideCustomerEntitlementV2BodyFeatureKeyRegExp)
|
|
12040
|
+
.optional()
|
|
12041
|
+
.describe('The feature the subject is entitled to use.\nEither featureKey or featureId is required.'),
|
|
12042
|
+
isSoftLimit: zod.coerce
|
|
12043
|
+
.boolean()
|
|
12044
|
+
.optional()
|
|
12045
|
+
.describe('If softLimit=true the subject can use the feature even if the entitlement is exhausted, hasAccess will always be true.'),
|
|
12046
|
+
issueAfterReset: zod.coerce
|
|
12047
|
+
.number()
|
|
12048
|
+
.min(overrideCustomerEntitlementV2BodyIssueAfterResetMin)
|
|
12049
|
+
.optional()
|
|
12050
|
+
.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.'),
|
|
12051
|
+
issueAfterResetPriority: zod.coerce
|
|
12052
|
+
.number()
|
|
12053
|
+
.min(1)
|
|
12054
|
+
.max(overrideCustomerEntitlementV2BodyIssueAfterResetPriorityMax)
|
|
12055
|
+
.default(overrideCustomerEntitlementV2BodyIssueAfterResetPriorityDefault)
|
|
12056
|
+
.describe('Defines the grant priority for the default grant.'),
|
|
12057
|
+
isUnlimited: zod.coerce
|
|
12058
|
+
.boolean()
|
|
12059
|
+
.optional()
|
|
12060
|
+
.describe('Deprecated, ignored by the backend. Please use isSoftLimit instead; this field will be removed in the future.'),
|
|
12061
|
+
measureUsageFrom: zod
|
|
12062
|
+
.union([
|
|
12063
|
+
zod
|
|
12064
|
+
.enum(['CURRENT_PERIOD_START', 'NOW'])
|
|
12065
|
+
.describe('Start of measurement options'),
|
|
12066
|
+
zod.coerce
|
|
12067
|
+
.date()
|
|
12068
|
+
.describe('[RFC3339](https://tools.ietf.org/html/rfc3339) formatted date-time string in UTC.'),
|
|
12069
|
+
])
|
|
12070
|
+
.describe('Measure usage from')
|
|
12071
|
+
.optional()
|
|
12072
|
+
.describe('Defines the time from which usage is measured. If not specified on creation, defaults to entitlement creation time.'),
|
|
12073
|
+
metadata: zod
|
|
12074
|
+
.record(zod.string(), zod.coerce.string())
|
|
12075
|
+
.describe('Set of key-value pairs.\nMetadata can be used to store additional information about a resource.')
|
|
12076
|
+
.optional()
|
|
12077
|
+
.describe('Additional metadata for the feature.'),
|
|
12078
|
+
preserveOverageAtReset: zod.coerce
|
|
12079
|
+
.boolean()
|
|
12080
|
+
.optional()
|
|
12081
|
+
.describe('If true, the overage is preserved at reset. If false, the usage is reset to 0.'),
|
|
12082
|
+
type: zod.enum(['metered']),
|
|
12083
|
+
usagePeriod: zod
|
|
12084
|
+
.object({
|
|
12085
|
+
anchor: zod.coerce
|
|
12086
|
+
.date()
|
|
12087
|
+
.optional()
|
|
12088
|
+
.describe('A date-time anchor to base the recurring period on.'),
|
|
12089
|
+
interval: zod
|
|
12090
|
+
.union([
|
|
12091
|
+
zod.coerce
|
|
12092
|
+
.string()
|
|
12093
|
+
.regex(overrideCustomerEntitlementV2BodyUsagePeriodIntervalRegExpTwo),
|
|
12094
|
+
zod
|
|
12095
|
+
.enum(['DAY', 'WEEK', 'MONTH', 'YEAR'])
|
|
12096
|
+
.describe('The unit of time for the interval.\nOne of: `day`, `week`, `month`, or `year`.'),
|
|
12097
|
+
])
|
|
12098
|
+
.describe('Period duration for the recurrence')
|
|
12099
|
+
.describe('The unit of time for the interval.'),
|
|
12100
|
+
})
|
|
12101
|
+
.describe('Recurring period with an interval and an anchor.')
|
|
12102
|
+
.describe('The usage period associated with the entitlement.'),
|
|
12103
|
+
})
|
|
12104
|
+
.describe('Create inpurs for metered entitlement'),
|
|
12105
|
+
zod
|
|
12106
|
+
.object({
|
|
12107
|
+
config: zod.coerce
|
|
12108
|
+
.string()
|
|
12109
|
+
.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.'),
|
|
12110
|
+
featureId: zod.coerce
|
|
12111
|
+
.string()
|
|
12112
|
+
.regex(overrideCustomerEntitlementV2BodyFeatureIdRegExpOne)
|
|
12113
|
+
.optional()
|
|
12114
|
+
.describe('The feature the subject is entitled to use.\nEither featureKey or featureId is required.'),
|
|
12115
|
+
featureKey: zod.coerce
|
|
12116
|
+
.string()
|
|
12117
|
+
.min(1)
|
|
12118
|
+
.max(overrideCustomerEntitlementV2BodyFeatureKeyMaxOne)
|
|
12119
|
+
.regex(overrideCustomerEntitlementV2BodyFeatureKeyRegExpOne)
|
|
12120
|
+
.optional()
|
|
12121
|
+
.describe('The feature the subject is entitled to use.\nEither featureKey or featureId is required.'),
|
|
12122
|
+
metadata: zod
|
|
12123
|
+
.record(zod.string(), zod.coerce.string())
|
|
12124
|
+
.describe('Set of key-value pairs.\nMetadata can be used to store additional information about a resource.')
|
|
12125
|
+
.optional()
|
|
12126
|
+
.describe('Additional metadata for the feature.'),
|
|
12127
|
+
type: zod.enum(['static']),
|
|
12128
|
+
usagePeriod: zod
|
|
12129
|
+
.object({
|
|
12130
|
+
anchor: zod.coerce
|
|
12131
|
+
.date()
|
|
12132
|
+
.optional()
|
|
12133
|
+
.describe('A date-time anchor to base the recurring period on.'),
|
|
12134
|
+
interval: zod
|
|
12135
|
+
.union([
|
|
12136
|
+
zod.coerce
|
|
12137
|
+
.string()
|
|
12138
|
+
.regex(overrideCustomerEntitlementV2BodyUsagePeriodIntervalRegExpSix),
|
|
12139
|
+
zod
|
|
12140
|
+
.enum(['DAY', 'WEEK', 'MONTH', 'YEAR'])
|
|
12141
|
+
.describe('The unit of time for the interval.\nOne of: `day`, `week`, `month`, or `year`.'),
|
|
12142
|
+
])
|
|
12143
|
+
.describe('Period duration for the recurrence')
|
|
12144
|
+
.describe('The unit of time for the interval.'),
|
|
12145
|
+
})
|
|
12146
|
+
.describe('Recurring period with an interval and an anchor.')
|
|
12147
|
+
.optional()
|
|
12148
|
+
.describe('The usage period associated with the entitlement.'),
|
|
12149
|
+
})
|
|
12150
|
+
.describe('Create inputs for static entitlement'),
|
|
12151
|
+
zod
|
|
12152
|
+
.object({
|
|
12153
|
+
featureId: zod.coerce
|
|
12154
|
+
.string()
|
|
12155
|
+
.regex(overrideCustomerEntitlementV2BodyFeatureIdRegExpTwo)
|
|
12156
|
+
.optional()
|
|
12157
|
+
.describe('The feature the subject is entitled to use.\nEither featureKey or featureId is required.'),
|
|
12158
|
+
featureKey: zod.coerce
|
|
12159
|
+
.string()
|
|
12160
|
+
.min(1)
|
|
12161
|
+
.max(overrideCustomerEntitlementV2BodyFeatureKeyMaxTwo)
|
|
12162
|
+
.regex(overrideCustomerEntitlementV2BodyFeatureKeyRegExpTwo)
|
|
12163
|
+
.optional()
|
|
12164
|
+
.describe('The feature the subject is entitled to use.\nEither featureKey or featureId is required.'),
|
|
12165
|
+
metadata: zod
|
|
12166
|
+
.record(zod.string(), zod.coerce.string())
|
|
12167
|
+
.describe('Set of key-value pairs.\nMetadata can be used to store additional information about a resource.')
|
|
12168
|
+
.optional()
|
|
12169
|
+
.describe('Additional metadata for the feature.'),
|
|
12170
|
+
type: zod.enum(['boolean']),
|
|
12171
|
+
usagePeriod: zod
|
|
12172
|
+
.object({
|
|
12173
|
+
anchor: zod.coerce
|
|
12082
12174
|
.date()
|
|
12083
|
-
.
|
|
12084
|
-
|
|
12085
|
-
|
|
12086
|
-
|
|
12175
|
+
.optional()
|
|
12176
|
+
.describe('A date-time anchor to base the recurring period on.'),
|
|
12177
|
+
interval: zod
|
|
12178
|
+
.union([
|
|
12179
|
+
zod.coerce
|
|
12180
|
+
.string()
|
|
12181
|
+
.regex(overrideCustomerEntitlementV2BodyUsagePeriodIntervalRegExpOnezero),
|
|
12182
|
+
zod
|
|
12183
|
+
.enum(['DAY', 'WEEK', 'MONTH', 'YEAR'])
|
|
12184
|
+
.describe('The unit of time for the interval.\nOne of: `day`, `week`, `month`, or `year`.'),
|
|
12185
|
+
])
|
|
12186
|
+
.describe('Period duration for the recurrence')
|
|
12187
|
+
.describe('The unit of time for the interval.'),
|
|
12188
|
+
})
|
|
12189
|
+
.describe('Recurring period with an interval and an anchor.')
|
|
12190
|
+
.optional()
|
|
12191
|
+
.describe('The usage period associated with the entitlement.'),
|
|
12087
12192
|
})
|
|
12088
|
-
.describe('
|
|
12193
|
+
.describe('Create inputs for boolean entitlement'),
|
|
12089
12194
|
])
|
|
12090
|
-
.describe('
|
|
12195
|
+
.describe('Create inputs for entitlement');
|
|
12091
12196
|
/**
|
|
12092
|
-
*
|
|
12093
|
-
|
|
12094
|
-
|
|
12095
|
-
* @summary
|
|
12197
|
+
* 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.
|
|
12198
|
+
|
|
12199
|
+
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.
|
|
12200
|
+
* @summary Reset customer entitlement
|
|
12096
12201
|
*/
|
|
12097
|
-
export const
|
|
12098
|
-
export const
|
|
12099
|
-
|
|
12202
|
+
export const resetCustomerEntitlementUsageV2PathEntitlementIdOrFeatureKeyMax = 64;
|
|
12203
|
+
export const resetCustomerEntitlementUsageV2PathEntitlementIdOrFeatureKeyRegExp = new RegExp('^[a-z0-9]+(?:_[a-z0-9]+)*$|^[0-7][0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{25}$');
|
|
12204
|
+
export const resetCustomerEntitlementUsageV2Params = zod.object({
|
|
12205
|
+
customerIdOrKey: zod.union([
|
|
12206
|
+
zod.coerce
|
|
12207
|
+
.string()
|
|
12208
|
+
.regex(resetCustomerEntitlementUsageV2PathCustomerIdOrKeyRegExpOne)
|
|
12209
|
+
.describe('ULID (Universally Unique Lexicographically Sortable Identifier).'),
|
|
12210
|
+
zod.coerce
|
|
12211
|
+
.string()
|
|
12212
|
+
.min(1)
|
|
12213
|
+
.max(resetCustomerEntitlementUsageV2PathCustomerIdOrKeyMaxTwo)
|
|
12214
|
+
.describe('ExternalKey is a looser version of key.'),
|
|
12215
|
+
]),
|
|
12216
|
+
entitlementIdOrFeatureKey: zod.coerce
|
|
12100
12217
|
.string()
|
|
12101
|
-
.
|
|
12218
|
+
.min(1)
|
|
12219
|
+
.max(resetCustomerEntitlementUsageV2PathEntitlementIdOrFeatureKeyMax)
|
|
12220
|
+
.regex(resetCustomerEntitlementUsageV2PathEntitlementIdOrFeatureKeyRegExp),
|
|
12102
12221
|
});
|
|
12103
|
-
export const
|
|
12104
|
-
|
|
12105
|
-
|
|
12222
|
+
export const resetCustomerEntitlementUsageV2Body = zod
|
|
12223
|
+
.object({
|
|
12224
|
+
effectiveAt: zod.coerce
|
|
12106
12225
|
.date()
|
|
12107
12226
|
.optional()
|
|
12108
|
-
.describe('The
|
|
12109
|
-
|
|
12110
|
-
.
|
|
12111
|
-
.min(1)
|
|
12227
|
+
.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.'),
|
|
12228
|
+
preserveOverage: zod.coerce
|
|
12229
|
+
.boolean()
|
|
12112
12230
|
.optional()
|
|
12113
|
-
.describe(
|
|
12114
|
-
|
|
12115
|
-
.
|
|
12116
|
-
.min(1)
|
|
12231
|
+
.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."),
|
|
12232
|
+
retainAnchor: zod.coerce
|
|
12233
|
+
.boolean()
|
|
12117
12234
|
.optional()
|
|
12118
|
-
.describe('
|
|
12119
|
-
|
|
12120
|
-
|
|
12121
|
-
|
|
12122
|
-
|
|
12123
|
-
|
|
12235
|
+
.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.'),
|
|
12236
|
+
})
|
|
12237
|
+
.describe('Reset parameters');
|
|
12238
|
+
/**
|
|
12239
|
+
* 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.
|
|
12240
|
+
* @summary Get customer entitlement value
|
|
12241
|
+
*/
|
|
12242
|
+
export const getCustomerEntitlementValueV2PathEntitlementIdOrFeatureKeyMax = 64;
|
|
12243
|
+
export const getCustomerEntitlementValueV2PathEntitlementIdOrFeatureKeyRegExp = new RegExp('^[a-z0-9]+(?:_[a-z0-9]+)*$|^[0-7][0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{25}$');
|
|
12244
|
+
export const getCustomerEntitlementValueV2Params = zod.object({
|
|
12245
|
+
customerIdOrKey: zod.union([
|
|
12124
12246
|
zod.coerce
|
|
12125
|
-
.
|
|
12126
|
-
.
|
|
12127
|
-
|
|
12128
|
-
.
|
|
12129
|
-
|
|
12130
|
-
|
|
12247
|
+
.string()
|
|
12248
|
+
.regex(getCustomerEntitlementValueV2PathCustomerIdOrKeyRegExpOne)
|
|
12249
|
+
.describe('ULID (Universally Unique Lexicographically Sortable Identifier).'),
|
|
12250
|
+
zod.coerce
|
|
12251
|
+
.string()
|
|
12252
|
+
.min(1)
|
|
12253
|
+
.max(getCustomerEntitlementValueV2PathCustomerIdOrKeyMaxTwo)
|
|
12254
|
+
.describe('ExternalKey is a looser version of key.'),
|
|
12255
|
+
]),
|
|
12256
|
+
entitlementIdOrFeatureKey: zod.coerce
|
|
12257
|
+
.string()
|
|
12258
|
+
.min(1)
|
|
12259
|
+
.max(getCustomerEntitlementValueV2PathEntitlementIdOrFeatureKeyMax)
|
|
12260
|
+
.regex(getCustomerEntitlementValueV2PathEntitlementIdOrFeatureKeyRegExp),
|
|
12261
|
+
});
|
|
12262
|
+
export const getCustomerEntitlementValueV2QueryParams = zod.object({
|
|
12263
|
+
time: zod.coerce.date().optional(),
|
|
12131
12264
|
});
|
|
12132
12265
|
/**
|
|
12133
|
-
*
|
|
12134
|
-
|
|
12135
|
-
* @summary
|
|
12266
|
+
* List all entitlements for all the customers and features. This endpoint is intended for administrative purposes only.
|
|
12267
|
+
To fetch the entitlements of a specific subject please use the /api/v2/customers/{customerIdOrKey}/entitlements endpoint.
|
|
12268
|
+
* @summary List all entitlements
|
|
12136
12269
|
*/
|
|
12137
|
-
export const
|
|
12138
|
-
export const
|
|
12139
|
-
|
|
12140
|
-
|
|
12141
|
-
|
|
12270
|
+
export const listEntitlementsV2QueryExcludeInactiveDefault = false;
|
|
12271
|
+
export const listEntitlementsV2QueryPageDefault = 1;
|
|
12272
|
+
export const listEntitlementsV2QueryPageSizeDefault = 100;
|
|
12273
|
+
export const listEntitlementsV2QueryPageSizeMax = 1000;
|
|
12274
|
+
export const listEntitlementsV2QueryOffsetDefault = 0;
|
|
12275
|
+
export const listEntitlementsV2QueryOffsetMin = 0;
|
|
12276
|
+
export const listEntitlementsV2QueryLimitDefault = 100;
|
|
12277
|
+
export const listEntitlementsV2QueryLimitMax = 1000;
|
|
12278
|
+
export const listEntitlementsV2QueryParams = zod.object({
|
|
12279
|
+
customerIds: zod
|
|
12280
|
+
.array(zod.coerce.string())
|
|
12281
|
+
.optional()
|
|
12282
|
+
.describe('Filtering by multiple customers.\n\nUsage: `?customerIds=01K4WAQ0J99ZZ0MD75HXR112H8&customerIds=01K4WAQ0J99ZZ0MD75HXR112H9`'),
|
|
12283
|
+
customerKeys: zod
|
|
12284
|
+
.array(zod.coerce.string())
|
|
12285
|
+
.optional()
|
|
12286
|
+
.describe('Filtering by multiple customers.\n\nUsage: `?customerKeys=customer-1&customerKeys=customer-3`'),
|
|
12287
|
+
entitlementType: zod
|
|
12288
|
+
.array(zod
|
|
12289
|
+
.enum(['metered', 'boolean', 'static'])
|
|
12290
|
+
.describe('Type of the entitlement.'))
|
|
12291
|
+
.optional()
|
|
12292
|
+
.describe('Filtering by multiple entitlement types.\n\nUsage: `?entitlementType=metered&entitlementType=boolean`'),
|
|
12293
|
+
excludeInactive: zod.coerce
|
|
12294
|
+
.boolean()
|
|
12295
|
+
.optional()
|
|
12296
|
+
.describe('Exclude inactive entitlements in the response (those scheduled for later or earlier)'),
|
|
12297
|
+
feature: zod
|
|
12298
|
+
.array(zod.coerce.string())
|
|
12299
|
+
.optional()
|
|
12300
|
+
.describe('Filtering by multiple features.\n\nUsage: `?feature=feature-1&feature=feature-2`'),
|
|
12301
|
+
limit: zod.coerce
|
|
12302
|
+
.number()
|
|
12303
|
+
.min(1)
|
|
12304
|
+
.max(listEntitlementsV2QueryLimitMax)
|
|
12305
|
+
.default(listEntitlementsV2QueryLimitDefault)
|
|
12306
|
+
.describe('Number of items to return.\n\nDefault is 100.'),
|
|
12307
|
+
offset: zod.coerce
|
|
12308
|
+
.number()
|
|
12309
|
+
.min(listEntitlementsV2QueryOffsetMin)
|
|
12310
|
+
.optional()
|
|
12311
|
+
.describe('Number of items to skip.\n\nDefault is 0.'),
|
|
12312
|
+
order: zod.enum(['ASC', 'DESC']).optional().describe('The order direction.'),
|
|
12313
|
+
orderBy: zod
|
|
12314
|
+
.enum(['createdAt', 'updatedAt'])
|
|
12315
|
+
.optional()
|
|
12316
|
+
.describe('The order by field.'),
|
|
12317
|
+
page: zod.coerce
|
|
12318
|
+
.number()
|
|
12319
|
+
.min(1)
|
|
12320
|
+
.default(listEntitlementsV2QueryPageDefault)
|
|
12321
|
+
.describe('Page index.\n\nDefault is 1.'),
|
|
12322
|
+
pageSize: zod.coerce
|
|
12323
|
+
.number()
|
|
12324
|
+
.min(1)
|
|
12325
|
+
.max(listEntitlementsV2QueryPageSizeMax)
|
|
12326
|
+
.default(listEntitlementsV2QueryPageSizeDefault)
|
|
12327
|
+
.describe('The maximum number of items per page.\n\nDefault is 100.'),
|
|
12142
12328
|
});
|
|
12143
12329
|
/**
|
|
12144
|
-
*
|
|
12145
|
-
* @summary
|
|
12330
|
+
* Get entitlement by id.
|
|
12331
|
+
* @summary Get entitlement by id
|
|
12146
12332
|
*/
|
|
12147
|
-
export const
|
|
12148
|
-
export const
|
|
12149
|
-
|
|
12333
|
+
export const getEntitlementByIdV2PathEntitlementIdRegExp = new RegExp('^[0-7][0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{25}$');
|
|
12334
|
+
export const getEntitlementByIdV2Params = zod.object({
|
|
12335
|
+
entitlementId: zod.coerce
|
|
12150
12336
|
.string()
|
|
12151
|
-
.regex(
|
|
12337
|
+
.regex(getEntitlementByIdV2PathEntitlementIdRegExp),
|
|
12152
12338
|
});
|
|
12153
12339
|
/**
|
|
12154
12340
|
* List ingested events with advanced filtering and cursor pagination.
|
|
@@ -12175,4 +12361,68 @@ export const listEventsV2QueryParams = zod.object({
|
|
|
12175
12361
|
.default(listEventsV2QueryLimitDefault)
|
|
12176
12362
|
.describe('The limit of the pagination.'),
|
|
12177
12363
|
});
|
|
12364
|
+
/**
|
|
12365
|
+
* List all grants for all the customers and entitlements. This endpoint is intended for administrative purposes only.
|
|
12366
|
+
To fetch the grants of a specific entitlement please use the /api/v2/customers/{customerIdOrKey}/entitlements/{entitlementIdOrFeatureKey}/grants endpoint.
|
|
12367
|
+
If page is provided that takes precedence and the paginated response is returned.
|
|
12368
|
+
* @summary List grants
|
|
12369
|
+
*/
|
|
12370
|
+
export const listGrantsV2QueryIncludeDeletedDefault = false;
|
|
12371
|
+
export const listGrantsV2QueryPageDefault = 1;
|
|
12372
|
+
export const listGrantsV2QueryPageSizeDefault = 100;
|
|
12373
|
+
export const listGrantsV2QueryPageSizeMax = 1000;
|
|
12374
|
+
export const listGrantsV2QueryOffsetDefault = 0;
|
|
12375
|
+
export const listGrantsV2QueryOffsetMin = 0;
|
|
12376
|
+
export const listGrantsV2QueryLimitDefault = 100;
|
|
12377
|
+
export const listGrantsV2QueryLimitMax = 1000;
|
|
12378
|
+
export const listGrantsV2QueryParams = zod.object({
|
|
12379
|
+
customer: zod
|
|
12380
|
+
.array(zod
|
|
12381
|
+
.union([
|
|
12382
|
+
zod.coerce
|
|
12383
|
+
.string()
|
|
12384
|
+
.regex(listGrantsV2QueryCustomerItemRegExpOne)
|
|
12385
|
+
.describe('ULID (Universally Unique Lexicographically Sortable Identifier).'),
|
|
12386
|
+
zod.coerce
|
|
12387
|
+
.string()
|
|
12388
|
+
.min(1)
|
|
12389
|
+
.max(listGrantsV2QueryCustomerItemMaxTwo)
|
|
12390
|
+
.describe('ExternalKey is a looser version of key.'),
|
|
12391
|
+
])
|
|
12392
|
+
.describe('ULID (Universally Unique Lexicographically Sortable Identifier) or external unique key.'))
|
|
12393
|
+
.optional()
|
|
12394
|
+
.describe('Filtering by multiple customers (either by ID or key).\n\nUsage: `?customer=customer-1&customer=customer-2`'),
|
|
12395
|
+
feature: zod
|
|
12396
|
+
.array(zod.coerce.string())
|
|
12397
|
+
.optional()
|
|
12398
|
+
.describe('Filtering by multiple features.\n\nUsage: `?feature=feature-1&feature=feature-2`'),
|
|
12399
|
+
includeDeleted: zod.coerce.boolean().optional().describe('Include deleted'),
|
|
12400
|
+
limit: zod.coerce
|
|
12401
|
+
.number()
|
|
12402
|
+
.min(1)
|
|
12403
|
+
.max(listGrantsV2QueryLimitMax)
|
|
12404
|
+
.default(listGrantsV2QueryLimitDefault)
|
|
12405
|
+
.describe('Number of items to return.\n\nDefault is 100.'),
|
|
12406
|
+
offset: zod.coerce
|
|
12407
|
+
.number()
|
|
12408
|
+
.min(listGrantsV2QueryOffsetMin)
|
|
12409
|
+
.optional()
|
|
12410
|
+
.describe('Number of items to skip.\n\nDefault is 0.'),
|
|
12411
|
+
order: zod.enum(['ASC', 'DESC']).optional().describe('The order direction.'),
|
|
12412
|
+
orderBy: zod
|
|
12413
|
+
.enum(['id', 'createdAt', 'updatedAt'])
|
|
12414
|
+
.optional()
|
|
12415
|
+
.describe('The order by field.'),
|
|
12416
|
+
page: zod.coerce
|
|
12417
|
+
.number()
|
|
12418
|
+
.min(1)
|
|
12419
|
+
.default(listGrantsV2QueryPageDefault)
|
|
12420
|
+
.describe('Page index.\n\nDefault is 1.'),
|
|
12421
|
+
pageSize: zod.coerce
|
|
12422
|
+
.number()
|
|
12423
|
+
.min(1)
|
|
12424
|
+
.max(listGrantsV2QueryPageSizeMax)
|
|
12425
|
+
.default(listGrantsV2QueryPageSizeDefault)
|
|
12426
|
+
.describe('The maximum number of items per page.\n\nDefault is 100.'),
|
|
12427
|
+
});
|
|
12178
12428
|
//# sourceMappingURL=index.js.map
|