@openmeter/sdk 1.0.0-beta.220 → 1.0.0-beta.222
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/events.d.cts +1 -0
- 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 +2532 -1707
- package/dist/cjs/src/zod/index.cjs +1808 -1522
- package/dist/cjs/src/zod/index.d.cts +2352 -2172
- package/dist/cjs/src/zod/index.js.map +1 -1
- package/dist/cjs/{tsconfig.ed1bfe74.tsbuildinfo → tsconfig.58b58bc1.tsbuildinfo} +1 -1
- package/dist/cjs/{tsconfig.f862b9eb.tsbuildinfo → tsconfig.7bcc7f9f.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/events.d.ts +1 -0
- 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 +2532 -1707
- package/dist/src/zod/index.d.ts +2352 -2172
- package/dist/src/zod/index.js +1791 -1506
- 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
|
@@ -4498,7 +4498,7 @@ export const listCustomersQueryParams = zod.object({
|
|
|
4498
4498
|
key: zod.coerce
|
|
4499
4499
|
.string()
|
|
4500
4500
|
.optional()
|
|
4501
|
-
.describe('Filter customers by key.\nCase-
|
|
4501
|
+
.describe('Filter customers by key.\nCase-insensitive partial match.'),
|
|
4502
4502
|
name: zod.coerce
|
|
4503
4503
|
.string()
|
|
4504
4504
|
.optional()
|
|
@@ -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,796 +5522,496 @@ 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
|
-
|
|
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()
|
|
5936
5549
|
.min(1)
|
|
5937
|
-
.
|
|
5938
|
-
.
|
|
5939
|
-
|
|
5940
|
-
from: zod.coerce
|
|
5941
|
-
.date()
|
|
5942
|
-
.optional()
|
|
5943
|
-
.describe('Start date-time in RFC 3339 format.\n\nInclusive.'),
|
|
5944
|
-
id: zod.coerce
|
|
5945
|
-
.string()
|
|
5946
|
-
.optional()
|
|
5947
|
-
.describe('The event ID.\n\nAccepts partial ID.'),
|
|
5948
|
-
ingestedAtFrom: zod.coerce
|
|
5949
|
-
.date()
|
|
5950
|
-
.optional()
|
|
5951
|
-
.describe('Start date-time in RFC 3339 format.\n\nInclusive.'),
|
|
5952
|
-
ingestedAtTo: zod.coerce
|
|
5953
|
-
.date()
|
|
5954
|
-
.optional()
|
|
5955
|
-
.describe('End date-time in RFC 3339 format.\n\nInclusive.'),
|
|
5956
|
-
limit: zod.coerce
|
|
5550
|
+
.default(listMarketplaceListingsQueryPageDefault)
|
|
5551
|
+
.describe('Page index.\n\nDefault is 1.'),
|
|
5552
|
+
pageSize: zod.coerce
|
|
5957
5553
|
.number()
|
|
5958
5554
|
.min(1)
|
|
5959
|
-
.max(
|
|
5960
|
-
.default(
|
|
5961
|
-
.describe('
|
|
5962
|
-
|
|
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
|
|
5963
5583
|
.string()
|
|
5964
5584
|
.optional()
|
|
5965
|
-
.describe(
|
|
5966
|
-
|
|
5967
|
-
|
|
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()
|
|
5968
5608
|
.optional()
|
|
5969
|
-
.describe(
|
|
5609
|
+
.describe("Name of the application to install.\n\nIf name is not provided defaults to the marketplace listing's name."),
|
|
5970
5610
|
});
|
|
5971
5611
|
/**
|
|
5972
|
-
*
|
|
5973
|
-
|
|
5612
|
+
* Install an app via OAuth.
|
|
5613
|
+
Returns a URL to start the OAuth 2.0 flow.
|
|
5614
|
+
* @summary Get OAuth2 install URL
|
|
5974
5615
|
*/
|
|
5975
|
-
export const
|
|
5976
|
-
|
|
5977
|
-
|
|
5978
|
-
.union([
|
|
5979
|
-
zod
|
|
5980
|
-
.object({
|
|
5981
|
-
data: zod
|
|
5982
|
-
.record(zod.string(), zod.any())
|
|
5983
|
-
.nullish()
|
|
5984
|
-
.describe('The event payload.\nOptional, if present it must be a JSON object.'),
|
|
5985
|
-
datacontenttype: zod
|
|
5986
|
-
.enum(['application/json'])
|
|
5987
|
-
.nullish()
|
|
5988
|
-
.describe('Content type of the CloudEvents data value. Only the value \"application/json\" is allowed over HTTP.'),
|
|
5989
|
-
dataschema: zod.coerce
|
|
5990
|
-
.string()
|
|
5991
|
-
.url()
|
|
5992
|
-
.min(1)
|
|
5993
|
-
.nullish()
|
|
5994
|
-
.describe('Identifies the schema that data adheres to.'),
|
|
5995
|
-
id: zod.coerce.string().min(1).describe('Identifies the event.'),
|
|
5996
|
-
source: zod.coerce
|
|
5997
|
-
.string()
|
|
5998
|
-
.min(1)
|
|
5999
|
-
.describe('Identifies the context in which an event happened.'),
|
|
6000
|
-
specversion: zod.coerce
|
|
6001
|
-
.string()
|
|
6002
|
-
.min(1)
|
|
6003
|
-
.describe('The version of the CloudEvents specification which the event uses.'),
|
|
6004
|
-
subject: zod.coerce
|
|
6005
|
-
.string()
|
|
6006
|
-
.min(1)
|
|
6007
|
-
.describe('Describes the subject of the event in the context of the event producer (identified by source).'),
|
|
6008
|
-
time: zod.coerce
|
|
6009
|
-
.date()
|
|
6010
|
-
.nullish()
|
|
6011
|
-
.describe('Timestamp of when the occurrence happened. Must adhere to RFC 3339.'),
|
|
6012
|
-
type: zod.coerce
|
|
6013
|
-
.string()
|
|
6014
|
-
.min(1)
|
|
6015
|
-
.describe('Contains a value describing the type of event related to the originating occurrence.'),
|
|
6016
|
-
})
|
|
6017
|
-
.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.'),
|
|
6018
|
-
zod.array(zod
|
|
6019
|
-
.object({
|
|
6020
|
-
data: zod
|
|
6021
|
-
.record(zod.string(), zod.any())
|
|
6022
|
-
.nullish()
|
|
6023
|
-
.describe('The event payload.\nOptional, if present it must be a JSON object.'),
|
|
6024
|
-
datacontenttype: zod
|
|
6025
|
-
.enum(['application/json'])
|
|
6026
|
-
.nullish()
|
|
6027
|
-
.describe('Content type of the CloudEvents data value. Only the value \"application/json\" is allowed over HTTP.'),
|
|
6028
|
-
dataschema: zod.coerce
|
|
6029
|
-
.string()
|
|
6030
|
-
.url()
|
|
6031
|
-
.min(1)
|
|
6032
|
-
.nullish()
|
|
6033
|
-
.describe('Identifies the schema that data adheres to.'),
|
|
6034
|
-
id: zod.coerce.string().min(1).describe('Identifies the event.'),
|
|
6035
|
-
source: zod.coerce
|
|
6036
|
-
.string()
|
|
6037
|
-
.min(1)
|
|
6038
|
-
.describe('Identifies the context in which an event happened.'),
|
|
6039
|
-
specversion: zod.coerce
|
|
6040
|
-
.string()
|
|
6041
|
-
.min(1)
|
|
6042
|
-
.describe('The version of the CloudEvents specification which the event uses.'),
|
|
6043
|
-
subject: zod.coerce
|
|
6044
|
-
.string()
|
|
6045
|
-
.min(1)
|
|
6046
|
-
.describe('Describes the subject of the event in the context of the event producer (identified by source).'),
|
|
6047
|
-
time: zod.coerce
|
|
6048
|
-
.date()
|
|
6049
|
-
.nullish()
|
|
6050
|
-
.describe('Timestamp of when the occurrence happened. Must adhere to RFC 3339.'),
|
|
6051
|
-
type: zod.coerce
|
|
6052
|
-
.string()
|
|
6053
|
-
.min(1)
|
|
6054
|
-
.describe('Contains a value describing the type of event related to the originating occurrence.'),
|
|
6055
|
-
})
|
|
6056
|
-
.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.')),
|
|
6057
|
-
])
|
|
6058
|
-
.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
|
+
});
|
|
6059
5619
|
/**
|
|
6060
|
-
*
|
|
6061
|
-
|
|
5620
|
+
* Authorize OAuth2 code.
|
|
5621
|
+
Verifies the OAuth code and exchanges it for a token and refresh token
|
|
5622
|
+
* @summary Install app via OAuth2
|
|
6062
5623
|
*/
|
|
6063
|
-
export const
|
|
6064
|
-
|
|
6065
|
-
|
|
6066
|
-
|
|
6067
|
-
|
|
6068
|
-
export const
|
|
6069
|
-
|
|
6070
|
-
|
|
6071
|
-
export const listFeaturesQueryParams = zod.object({
|
|
6072
|
-
includeArchived: zod.coerce
|
|
6073
|
-
.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()
|
|
6074
5632
|
.optional()
|
|
6075
|
-
.describe('
|
|
6076
|
-
|
|
6077
|
-
.
|
|
6078
|
-
|
|
6079
|
-
|
|
6080
|
-
|
|
6081
|
-
|
|
6082
|
-
|
|
6083
|
-
|
|
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
|
+
])
|
|
6084
5644
|
.optional()
|
|
6085
|
-
.describe('
|
|
6086
|
-
|
|
6087
|
-
.
|
|
6088
|
-
.min(listFeaturesQueryOffsetMin)
|
|
5645
|
+
.describe('Error code.\nRequired with the error response.'),
|
|
5646
|
+
error_description: zod.coerce
|
|
5647
|
+
.string()
|
|
6089
5648
|
.optional()
|
|
6090
|
-
.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.'),
|
|
6091
5672
|
order: zod.enum(['ASC', 'DESC']).optional().describe('The order direction.'),
|
|
6092
5673
|
orderBy: zod
|
|
6093
|
-
.enum(['
|
|
5674
|
+
.enum(['key', 'name', 'aggregation', 'createdAt', 'updatedAt'])
|
|
6094
5675
|
.optional()
|
|
6095
5676
|
.describe('The order by field.'),
|
|
6096
5677
|
page: zod.coerce
|
|
6097
5678
|
.number()
|
|
6098
5679
|
.min(1)
|
|
6099
|
-
.default(
|
|
5680
|
+
.default(listMetersQueryPageDefault)
|
|
6100
5681
|
.describe('Page index.\n\nDefault is 1.'),
|
|
6101
5682
|
pageSize: zod.coerce
|
|
6102
5683
|
.number()
|
|
6103
5684
|
.min(1)
|
|
6104
|
-
.max(
|
|
6105
|
-
.default(
|
|
5685
|
+
.max(listMetersQueryPageSizeMax)
|
|
5686
|
+
.default(listMetersQueryPageSizeDefault)
|
|
6106
5687
|
.describe('The maximum number of items per page.\n\nDefault is 100.'),
|
|
6107
5688
|
});
|
|
6108
5689
|
/**
|
|
6109
|
-
*
|
|
6110
|
-
|
|
6111
|
-
Only meters with SUM and COUNT aggregation are supported for features.
|
|
6112
|
-
Features cannot be updated later, only archived.
|
|
6113
|
-
* @summary Create feature
|
|
5690
|
+
* Create a meter.
|
|
5691
|
+
* @summary Create meter
|
|
6114
5692
|
*/
|
|
6115
|
-
export const
|
|
6116
|
-
export const
|
|
6117
|
-
export const
|
|
6118
|
-
export const
|
|
6119
|
-
export const
|
|
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
|
|
6120
5698
|
.object({
|
|
6121
|
-
|
|
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
|
|
6122
5713
|
.string()
|
|
6123
5714
|
.min(1)
|
|
6124
|
-
.
|
|
6125
|
-
|
|
6126
|
-
.
|
|
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.'),
|
|
6127
5720
|
metadata: zod
|
|
6128
5721
|
.record(zod.string(), zod.coerce.string())
|
|
6129
5722
|
.describe('Set of key-value pairs.\nMetadata can be used to store additional information about a resource.')
|
|
6130
|
-
.
|
|
6131
|
-
|
|
6132
|
-
|
|
5723
|
+
.nullish()
|
|
5724
|
+
.describe('Additional metadata for the resource.'),
|
|
5725
|
+
name: zod.coerce
|
|
5726
|
+
.string()
|
|
5727
|
+
.min(1)
|
|
5728
|
+
.max(createMeterBodyNameMax)
|
|
6133
5729
|
.optional()
|
|
6134
|
-
.describe('
|
|
6135
|
-
|
|
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
|
|
6136
5738
|
.string()
|
|
6137
5739
|
.min(1)
|
|
6138
|
-
.max(createFeatureBodyMeterSlugMax)
|
|
6139
|
-
.regex(createFeatureBodyMeterSlugRegExp)
|
|
6140
5740
|
.optional()
|
|
6141
|
-
.describe('
|
|
6142
|
-
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."),
|
|
6143
5742
|
})
|
|
6144
|
-
.describe('
|
|
6145
|
-
/**
|
|
6146
|
-
* Get a feature by ID.
|
|
6147
|
-
* @summary Get feature
|
|
6148
|
-
*/
|
|
6149
|
-
export const getFeatureParams = zod.object({
|
|
6150
|
-
featureId: zod.coerce.string(),
|
|
6151
|
-
});
|
|
5743
|
+
.describe('A meter create model.');
|
|
6152
5744
|
/**
|
|
6153
|
-
*
|
|
6154
|
-
|
|
6155
|
-
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.
|
|
6156
|
-
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.
|
|
6157
|
-
* @summary Delete feature
|
|
5745
|
+
* Get a meter by ID or slug.
|
|
5746
|
+
* @summary Get meter
|
|
6158
5747
|
*/
|
|
6159
|
-
export const
|
|
6160
|
-
|
|
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),
|
|
6161
5756
|
});
|
|
6162
5757
|
/**
|
|
6163
|
-
*
|
|
6164
|
-
|
|
6165
|
-
If page is provided that takes precedence and the paginated response is returned.
|
|
6166
|
-
* @summary List grants
|
|
5758
|
+
* Update a meter.
|
|
5759
|
+
* @summary Update meter
|
|
6167
5760
|
*/
|
|
6168
|
-
export const
|
|
6169
|
-
export const
|
|
6170
|
-
export const
|
|
6171
|
-
|
|
6172
|
-
|
|
6173
|
-
export const listGrantsQueryOffsetMin = 0;
|
|
6174
|
-
export const listGrantsQueryLimitDefault = 100;
|
|
6175
|
-
export const listGrantsQueryLimitMax = 1000;
|
|
6176
|
-
export const listGrantsQueryParams = zod.object({
|
|
6177
|
-
feature: zod
|
|
6178
|
-
.array(zod.coerce.string())
|
|
6179
|
-
.optional()
|
|
6180
|
-
.describe('Filtering by multiple features.\n\nUsage: `?feature=feature-1&feature=feature-2`'),
|
|
6181
|
-
includeDeleted: zod.coerce.boolean().optional().describe('Include deleted'),
|
|
6182
|
-
limit: zod.coerce
|
|
6183
|
-
.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()
|
|
6184
5766
|
.min(1)
|
|
6185
|
-
.max(
|
|
6186
|
-
.
|
|
6187
|
-
|
|
6188
|
-
|
|
6189
|
-
|
|
6190
|
-
|
|
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)
|
|
6191
5777
|
.optional()
|
|
6192
|
-
.describe('
|
|
6193
|
-
|
|
6194
|
-
|
|
6195
|
-
.enum(['id', 'createdAt', 'updatedAt'])
|
|
5778
|
+
.describe('Optional description of the resource. Maximum 1024 characters.'),
|
|
5779
|
+
groupBy: zod
|
|
5780
|
+
.record(zod.string(), zod.coerce.string())
|
|
6196
5781
|
.optional()
|
|
6197
|
-
.describe('
|
|
6198
|
-
|
|
6199
|
-
.
|
|
6200
|
-
.
|
|
6201
|
-
.
|
|
6202
|
-
.describe('
|
|
6203
|
-
|
|
6204
|
-
.
|
|
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()
|
|
6205
5790
|
.min(1)
|
|
6206
|
-
.max(
|
|
6207
|
-
.default(listGrantsQueryPageSizeDefault)
|
|
6208
|
-
.describe('The maximum number of items per page.\n\nDefault is 100.'),
|
|
6209
|
-
subject: zod
|
|
6210
|
-
.array(zod.coerce.string())
|
|
5791
|
+
.max(updateMeterBodyNameMax)
|
|
6211
5792
|
.optional()
|
|
6212
|
-
.describe('
|
|
6213
|
-
})
|
|
6214
|
-
|
|
6215
|
-
* 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.
|
|
6216
|
-
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.
|
|
6217
|
-
* @summary Void grant
|
|
6218
|
-
*/
|
|
6219
|
-
export const voidGrantParams = zod.object({
|
|
6220
|
-
grantId: zod.coerce.string(),
|
|
6221
|
-
});
|
|
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.');
|
|
6222
5796
|
/**
|
|
6223
|
-
*
|
|
6224
|
-
* @summary
|
|
5797
|
+
* Delete a meter.
|
|
5798
|
+
* @summary Delete meter
|
|
6225
5799
|
*/
|
|
6226
|
-
export const
|
|
6227
|
-
|
|
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),
|
|
6228
5808
|
});
|
|
6229
5809
|
/**
|
|
6230
|
-
*
|
|
6231
|
-
* @summary
|
|
5810
|
+
* Query meter for usage.
|
|
5811
|
+
* @summary Query meter
|
|
6232
5812
|
*/
|
|
6233
|
-
export const
|
|
6234
|
-
export const
|
|
6235
|
-
export const
|
|
6236
|
-
|
|
6237
|
-
|
|
6238
|
-
.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()
|
|
6239
5818
|
.min(1)
|
|
6240
|
-
.
|
|
6241
|
-
.
|
|
6242
|
-
|
|
6243
|
-
|
|
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()
|
|
6244
5828
|
.min(1)
|
|
6245
|
-
.max(
|
|
6246
|
-
.
|
|
6247
|
-
.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'),
|
|
6248
5865
|
});
|
|
6249
5866
|
/**
|
|
6250
|
-
*
|
|
6251
|
-
* @summary Get app details by type
|
|
5867
|
+
* @summary Query meter
|
|
6252
5868
|
*/
|
|
6253
|
-
export const
|
|
6254
|
-
|
|
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),
|
|
6255
5877
|
});
|
|
6256
|
-
|
|
6257
|
-
|
|
6258
|
-
|
|
6259
|
-
|
|
6260
|
-
export const
|
|
6261
|
-
|
|
6262
|
-
.enum(['stripe', 'sandbox', 'custom_invoicing'])
|
|
6263
|
-
.describe('The type of the app to install.'),
|
|
6264
|
-
});
|
|
6265
|
-
export const marketplaceAppInstallBodyCreateBillingProfileDefault = true;
|
|
6266
|
-
export const marketplaceAppInstallBody = zod
|
|
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
|
|
6267
5884
|
.object({
|
|
6268
|
-
|
|
6269
|
-
.boolean()
|
|
6270
|
-
.default(marketplaceAppInstallBodyCreateBillingProfileDefault)
|
|
6271
|
-
.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.'),
|
|
6272
|
-
name: zod.coerce
|
|
5885
|
+
clientId: zod.coerce
|
|
6273
5886
|
.string()
|
|
5887
|
+
.min(1)
|
|
5888
|
+
.max(queryMeterPostBodyClientIdMax)
|
|
6274
5889
|
.optional()
|
|
6275
|
-
.describe(
|
|
6276
|
-
|
|
6277
|
-
|
|
6278
|
-
|
|
6279
|
-
* Install an marketplace app via API Key.
|
|
6280
|
-
* @summary Install app via API key
|
|
6281
|
-
*/
|
|
6282
|
-
export const marketplaceAppAPIKeyInstallParams = zod.object({
|
|
6283
|
-
type: zod
|
|
6284
|
-
.enum(['stripe', 'sandbox', 'custom_invoicing'])
|
|
6285
|
-
.describe('The type of the app to install.'),
|
|
6286
|
-
});
|
|
6287
|
-
export const marketplaceAppAPIKeyInstallBodyCreateBillingProfileDefault = true;
|
|
6288
|
-
export const marketplaceAppAPIKeyInstallBody = zod.object({
|
|
6289
|
-
apiKey: zod.coerce
|
|
6290
|
-
.string()
|
|
6291
|
-
.describe('The API key for the provider.\nFor example, the Stripe API key.'),
|
|
6292
|
-
createBillingProfile: zod.coerce
|
|
6293
|
-
.boolean()
|
|
6294
|
-
.default(marketplaceAppAPIKeyInstallBodyCreateBillingProfileDefault)
|
|
6295
|
-
.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.'),
|
|
6296
|
-
name: zod.coerce
|
|
6297
|
-
.string()
|
|
5890
|
+
.describe('Client ID\nUseful to track progress of a query.'),
|
|
5891
|
+
filterCustomerId: zod
|
|
5892
|
+
.array(zod.coerce.string())
|
|
5893
|
+
.max(queryMeterPostBodyFilterCustomerIdMax)
|
|
6298
5894
|
.optional()
|
|
6299
|
-
.describe(
|
|
6300
|
-
|
|
6301
|
-
|
|
6302
|
-
* Install an app via OAuth.
|
|
6303
|
-
Returns a URL to start the OAuth 2.0 flow.
|
|
6304
|
-
* @summary Get OAuth2 install URL
|
|
6305
|
-
*/
|
|
6306
|
-
export const marketplaceOAuth2InstallGetURLParams = zod.object({
|
|
6307
|
-
type: zod.enum(['stripe', 'sandbox', 'custom_invoicing']),
|
|
6308
|
-
});
|
|
6309
|
-
/**
|
|
6310
|
-
* Authorize OAuth2 code.
|
|
6311
|
-
Verifies the OAuth code and exchanges it for a token and refresh token
|
|
6312
|
-
* @summary Install app via OAuth2
|
|
6313
|
-
*/
|
|
6314
|
-
export const marketplaceOAuth2InstallAuthorizeParams = zod.object({
|
|
6315
|
-
type: zod
|
|
6316
|
-
.enum(['stripe', 'sandbox', 'custom_invoicing'])
|
|
6317
|
-
.describe('The type of the app to install.'),
|
|
6318
|
-
});
|
|
6319
|
-
export const marketplaceOAuth2InstallAuthorizeQueryParams = zod.object({
|
|
6320
|
-
code: zod.coerce
|
|
6321
|
-
.string()
|
|
5895
|
+
.describe('Filtering by multiple customers.'),
|
|
5896
|
+
filterGroupBy: zod
|
|
5897
|
+
.record(zod.string(), zod.array(zod.coerce.string()))
|
|
6322
5898
|
.optional()
|
|
6323
|
-
.describe('
|
|
6324
|
-
|
|
6325
|
-
.
|
|
6326
|
-
'invalid_request',
|
|
6327
|
-
'unauthorized_client',
|
|
6328
|
-
'access_denied',
|
|
6329
|
-
'unsupported_response_type',
|
|
6330
|
-
'invalid_scope',
|
|
6331
|
-
'server_error',
|
|
6332
|
-
'temporarily_unavailable',
|
|
6333
|
-
])
|
|
5899
|
+
.describe('Simple filter for group bys with exact match.'),
|
|
5900
|
+
from: zod.coerce
|
|
5901
|
+
.date()
|
|
6334
5902
|
.optional()
|
|
6335
|
-
.describe('
|
|
6336
|
-
|
|
6337
|
-
.string()
|
|
5903
|
+
.describe('Start date-time in RFC 3339 format.\n\nInclusive.'),
|
|
5904
|
+
groupBy: zod
|
|
5905
|
+
.array(zod.coerce.string())
|
|
5906
|
+
.max(queryMeterPostBodyGroupByMax)
|
|
6338
5907
|
.optional()
|
|
6339
|
-
.describe('
|
|
6340
|
-
|
|
6341
|
-
.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)
|
|
6342
5912
|
.optional()
|
|
6343
|
-
.describe('
|
|
6344
|
-
|
|
6345
|
-
.
|
|
5913
|
+
.describe('Filtering by multiple subjects.'),
|
|
5914
|
+
to: zod.coerce
|
|
5915
|
+
.date()
|
|
6346
5916
|
.optional()
|
|
6347
|
-
.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),
|
|
6348
5941
|
});
|
|
6349
5942
|
/**
|
|
6350
|
-
* List
|
|
6351
|
-
* @summary List
|
|
5943
|
+
* List all notification channels.
|
|
5944
|
+
* @summary List notification channels
|
|
6352
5945
|
*/
|
|
6353
|
-
export const
|
|
6354
|
-
export const
|
|
6355
|
-
export const
|
|
6356
|
-
export const
|
|
6357
|
-
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({
|
|
6358
5952
|
includeDeleted: zod.coerce
|
|
6359
5953
|
.boolean()
|
|
6360
5954
|
.optional()
|
|
6361
|
-
.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`'),
|
|
6362
5960
|
order: zod.enum(['ASC', 'DESC']).optional().describe('The order direction.'),
|
|
6363
5961
|
orderBy: zod
|
|
6364
|
-
.enum(['
|
|
5962
|
+
.enum(['id', 'type', 'createdAt', 'updatedAt'])
|
|
6365
5963
|
.optional()
|
|
6366
5964
|
.describe('The order by field.'),
|
|
6367
5965
|
page: zod.coerce
|
|
6368
5966
|
.number()
|
|
6369
5967
|
.min(1)
|
|
6370
|
-
.default(
|
|
5968
|
+
.default(listNotificationChannelsQueryPageDefault)
|
|
6371
5969
|
.describe('Page index.\n\nDefault is 1.'),
|
|
6372
5970
|
pageSize: zod.coerce
|
|
6373
5971
|
.number()
|
|
6374
5972
|
.min(1)
|
|
6375
|
-
.max(
|
|
6376
|
-
.default(
|
|
5973
|
+
.max(listNotificationChannelsQueryPageSizeMax)
|
|
5974
|
+
.default(listNotificationChannelsQueryPageSizeDefault)
|
|
6377
5975
|
.describe('The maximum number of items per page.\n\nDefault is 100.'),
|
|
6378
5976
|
});
|
|
6379
5977
|
/**
|
|
6380
|
-
* Create a
|
|
6381
|
-
* @summary Create
|
|
5978
|
+
* Create a new notification channel.
|
|
5979
|
+
* @summary Create a notification channel
|
|
6382
5980
|
*/
|
|
6383
|
-
export const
|
|
6384
|
-
export const
|
|
6385
|
-
export const
|
|
6386
|
-
export const createMeterBodySlugRegExp = new RegExp('^[a-z0-9]+(?:_[a-z0-9]+)*$');
|
|
6387
|
-
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
|
|
6388
5984
|
.object({
|
|
6389
|
-
|
|
6390
|
-
.enum(['SUM', 'COUNT', 'UNIQUE_COUNT', 'AVG', 'MIN', 'MAX', 'LATEST'])
|
|
6391
|
-
.describe('The aggregation type to use for the meter.')
|
|
6392
|
-
.describe('The aggregation type to use for the meter.'),
|
|
6393
|
-
description: zod.coerce
|
|
6394
|
-
.string()
|
|
6395
|
-
.max(createMeterBodyDescriptionMax)
|
|
6396
|
-
.optional()
|
|
6397
|
-
.describe('Optional description of the resource. Maximum 1024 characters.'),
|
|
6398
|
-
eventFrom: zod.coerce
|
|
6399
|
-
.date()
|
|
6400
|
-
.optional()
|
|
6401
|
-
.describe('The date since the meter should include events.\nUseful to skip old events.\nIf not specified, all historical events are included.'),
|
|
6402
|
-
eventType: zod.coerce
|
|
6403
|
-
.string()
|
|
6404
|
-
.min(1)
|
|
6405
|
-
.describe('The event type to aggregate.'),
|
|
6406
|
-
groupBy: zod
|
|
5985
|
+
customHeaders: zod
|
|
6407
5986
|
.record(zod.string(), zod.coerce.string())
|
|
6408
5987
|
.optional()
|
|
6409
|
-
.describe('
|
|
6410
|
-
|
|
6411
|
-
.
|
|
6412
|
-
.describe('Set of key-value pairs.\nMetadata can be used to store additional information about a resource.')
|
|
6413
|
-
.nullish()
|
|
6414
|
-
.describe('Additional metadata for the resource.'),
|
|
6415
|
-
name: zod.coerce
|
|
6416
|
-
.string()
|
|
6417
|
-
.min(1)
|
|
6418
|
-
.max(createMeterBodyNameMax)
|
|
5988
|
+
.describe('Custom HTTP headers sent as part of the webhook request.'),
|
|
5989
|
+
disabled: zod.coerce
|
|
5990
|
+
.boolean()
|
|
6419
5991
|
.optional()
|
|
6420
|
-
.describe('
|
|
6421
|
-
|
|
6422
|
-
|
|
6423
|
-
.min(1)
|
|
6424
|
-
.max(createMeterBodySlugMax)
|
|
6425
|
-
.regex(createMeterBodySlugRegExp)
|
|
6426
|
-
.describe('A unique, human-readable identifier for the meter.\nMust consist only alphanumeric and underscore characters.'),
|
|
6427
|
-
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
|
|
6428
5995
|
.string()
|
|
6429
|
-
.
|
|
5996
|
+
.regex(createNotificationChannelBodySigningSecretRegExp)
|
|
6430
5997
|
.optional()
|
|
6431
|
-
.describe(
|
|
6432
|
-
|
|
6433
|
-
|
|
6434
|
-
/**
|
|
6435
|
-
* Get a meter by ID or slug.
|
|
6436
|
-
* @summary Get meter
|
|
6437
|
-
*/
|
|
6438
|
-
export const getMeterPathMeterIdOrSlugMax = 64;
|
|
6439
|
-
export const getMeterPathMeterIdOrSlugRegExp = new RegExp('^[a-z0-9]+(?:_[a-z0-9]+)*$|^[0-7][0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{25}$');
|
|
6440
|
-
export const getMeterParams = zod.object({
|
|
6441
|
-
meterIdOrSlug: zod.coerce
|
|
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
|
|
6442
6001
|
.string()
|
|
6443
|
-
.
|
|
6444
|
-
|
|
6445
|
-
|
|
6446
|
-
|
|
6002
|
+
.describe('Webhook URL where the notification is sent.'),
|
|
6003
|
+
})
|
|
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.');
|
|
6447
6006
|
/**
|
|
6448
|
-
* Update
|
|
6449
|
-
* @summary Update
|
|
6007
|
+
* Update notification channel.
|
|
6008
|
+
* @summary Update a notification channel
|
|
6450
6009
|
*/
|
|
6451
|
-
export const
|
|
6452
|
-
export const
|
|
6453
|
-
|
|
6454
|
-
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
|
|
6455
6013
|
.string()
|
|
6456
|
-
.
|
|
6457
|
-
.max(updateMeterPathMeterIdOrSlugMax)
|
|
6458
|
-
.regex(updateMeterPathMeterIdOrSlugRegExp),
|
|
6459
|
-
});
|
|
6460
|
-
export const updateMeterBodyDescriptionMax = 1024;
|
|
6461
|
-
export const updateMeterBodyNameMax = 256;
|
|
6462
|
-
export const updateMeterBody = zod
|
|
6463
|
-
.object({
|
|
6464
|
-
description: zod.coerce
|
|
6465
|
-
.string()
|
|
6466
|
-
.max(updateMeterBodyDescriptionMax)
|
|
6467
|
-
.optional()
|
|
6468
|
-
.describe('Optional description of the resource. Maximum 1024 characters.'),
|
|
6469
|
-
groupBy: zod
|
|
6470
|
-
.record(zod.string(), zod.coerce.string())
|
|
6471
|
-
.optional()
|
|
6472
|
-
.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.'),
|
|
6473
|
-
metadata: zod
|
|
6474
|
-
.record(zod.string(), zod.coerce.string())
|
|
6475
|
-
.describe('Set of key-value pairs.\nMetadata can be used to store additional information about a resource.')
|
|
6476
|
-
.nullish()
|
|
6477
|
-
.describe('Additional metadata for the resource.'),
|
|
6478
|
-
name: zod.coerce
|
|
6479
|
-
.string()
|
|
6480
|
-
.min(1)
|
|
6481
|
-
.max(updateMeterBodyNameMax)
|
|
6482
|
-
.optional()
|
|
6483
|
-
.describe('Human-readable name for the resource. Between 1 and 256 characters.\nDefaults to the slug if not specified.'),
|
|
6484
|
-
})
|
|
6485
|
-
.describe('A meter update model.\n\nOnly the properties that can be updated are included.\nFor example, the slug and aggregation cannot be updated.');
|
|
6486
|
-
/**
|
|
6487
|
-
* Delete a meter.
|
|
6488
|
-
* @summary Delete meter
|
|
6489
|
-
*/
|
|
6490
|
-
export const deleteMeterPathMeterIdOrSlugMax = 64;
|
|
6491
|
-
export const deleteMeterPathMeterIdOrSlugRegExp = new RegExp('^[a-z0-9]+(?:_[a-z0-9]+)*$|^[0-7][0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{25}$');
|
|
6492
|
-
export const deleteMeterParams = zod.object({
|
|
6493
|
-
meterIdOrSlug: zod.coerce
|
|
6494
|
-
.string()
|
|
6495
|
-
.min(1)
|
|
6496
|
-
.max(deleteMeterPathMeterIdOrSlugMax)
|
|
6497
|
-
.regex(deleteMeterPathMeterIdOrSlugRegExp),
|
|
6498
|
-
});
|
|
6499
|
-
/**
|
|
6500
|
-
* Query meter for usage.
|
|
6501
|
-
* @summary Query meter
|
|
6502
|
-
*/
|
|
6503
|
-
export const queryMeterPathMeterIdOrSlugMax = 64;
|
|
6504
|
-
export const queryMeterPathMeterIdOrSlugRegExp = new RegExp('^[a-z0-9]+(?:_[a-z0-9]+)*$|^[0-7][0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{25}$');
|
|
6505
|
-
export const queryMeterParams = zod.object({
|
|
6506
|
-
meterIdOrSlug: zod.coerce
|
|
6507
|
-
.string()
|
|
6508
|
-
.min(1)
|
|
6509
|
-
.max(queryMeterPathMeterIdOrSlugMax)
|
|
6510
|
-
.regex(queryMeterPathMeterIdOrSlugRegExp),
|
|
6511
|
-
});
|
|
6512
|
-
export const queryMeterQueryClientIdMax = 36;
|
|
6513
|
-
export const queryMeterQueryWindowTimeZoneDefault = 'UTC';
|
|
6514
|
-
export const queryMeterQueryFilterCustomerIdMax = 100;
|
|
6515
|
-
export const queryMeterQueryParams = zod.object({
|
|
6516
|
-
clientId: zod.coerce
|
|
6517
|
-
.string()
|
|
6518
|
-
.min(1)
|
|
6519
|
-
.max(queryMeterQueryClientIdMax)
|
|
6520
|
-
.optional()
|
|
6521
|
-
.describe('Client ID\nUseful to track progress of a query.'),
|
|
6522
|
-
filterCustomerId: zod
|
|
6523
|
-
.array(zod.coerce.string())
|
|
6524
|
-
.max(queryMeterQueryFilterCustomerIdMax)
|
|
6525
|
-
.optional()
|
|
6526
|
-
.describe('Filtering by multiple customers.\n\nFor example: ?filterCustomerId=customer-1&filterCustomerId=customer-2'),
|
|
6527
|
-
filterGroupBy: zod
|
|
6528
|
-
.record(zod.string(), zod.coerce.string())
|
|
6529
|
-
.optional()
|
|
6530
|
-
.describe('Simple filter for group bys with exact match.\n\nFor example: ?filterGroupBy[vendor]=openai&filterGroupBy[model]=gpt-4-turbo'),
|
|
6531
|
-
from: zod.coerce
|
|
6532
|
-
.date()
|
|
6533
|
-
.optional()
|
|
6534
|
-
.describe('Start date-time in RFC 3339 format.\n\nInclusive.\n\nFor example: ?from=2025-01-01T00%3A00%3A00.000Z'),
|
|
6535
|
-
groupBy: zod
|
|
6536
|
-
.array(zod.coerce.string())
|
|
6537
|
-
.optional()
|
|
6538
|
-
.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'),
|
|
6539
|
-
subject: zod
|
|
6540
|
-
.array(zod.coerce.string())
|
|
6541
|
-
.optional()
|
|
6542
|
-
.describe('Filtering by multiple subjects.\n\nFor example: ?subject=subject-1&subject=subject-2'),
|
|
6543
|
-
to: zod.coerce
|
|
6544
|
-
.date()
|
|
6545
|
-
.optional()
|
|
6546
|
-
.describe('End date-time in RFC 3339 format.\n\nInclusive.\n\nFor example: ?to=2025-02-01T00%3A00%3A00.000Z'),
|
|
6547
|
-
windowSize: zod
|
|
6548
|
-
.enum(['MINUTE', 'HOUR', 'DAY', 'MONTH'])
|
|
6549
|
-
.optional()
|
|
6550
|
-
.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'),
|
|
6551
|
-
windowTimeZone: zod.coerce
|
|
6552
|
-
.string()
|
|
6553
|
-
.default(queryMeterQueryWindowTimeZoneDefault)
|
|
6554
|
-
.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'),
|
|
6555
|
-
});
|
|
6556
|
-
/**
|
|
6557
|
-
* @summary Query meter
|
|
6558
|
-
*/
|
|
6559
|
-
export const queryMeterPostPathMeterIdOrSlugMax = 64;
|
|
6560
|
-
export const queryMeterPostPathMeterIdOrSlugRegExp = new RegExp('^[a-z0-9]+(?:_[a-z0-9]+)*$|^[0-7][0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{25}$');
|
|
6561
|
-
export const queryMeterPostParams = zod.object({
|
|
6562
|
-
meterIdOrSlug: zod.coerce
|
|
6563
|
-
.string()
|
|
6564
|
-
.min(1)
|
|
6565
|
-
.max(queryMeterPostPathMeterIdOrSlugMax)
|
|
6566
|
-
.regex(queryMeterPostPathMeterIdOrSlugRegExp),
|
|
6567
|
-
});
|
|
6568
|
-
export const queryMeterPostBodyClientIdMax = 36;
|
|
6569
|
-
export const queryMeterPostBodyWindowTimeZoneDefault = 'UTC';
|
|
6570
|
-
export const queryMeterPostBodySubjectMax = 100;
|
|
6571
|
-
export const queryMeterPostBodyFilterCustomerIdMax = 100;
|
|
6572
|
-
export const queryMeterPostBodyGroupByMax = 100;
|
|
6573
|
-
export const queryMeterPostBody = zod
|
|
6574
|
-
.object({
|
|
6575
|
-
clientId: zod.coerce
|
|
6576
|
-
.string()
|
|
6577
|
-
.min(1)
|
|
6578
|
-
.max(queryMeterPostBodyClientIdMax)
|
|
6579
|
-
.optional()
|
|
6580
|
-
.describe('Client ID\nUseful to track progress of a query.'),
|
|
6581
|
-
filterCustomerId: zod
|
|
6582
|
-
.array(zod.coerce.string())
|
|
6583
|
-
.max(queryMeterPostBodyFilterCustomerIdMax)
|
|
6584
|
-
.optional()
|
|
6585
|
-
.describe('Filtering by multiple customers.'),
|
|
6586
|
-
filterGroupBy: zod
|
|
6587
|
-
.record(zod.string(), zod.array(zod.coerce.string()))
|
|
6588
|
-
.optional()
|
|
6589
|
-
.describe('Simple filter for group bys with exact match.'),
|
|
6590
|
-
from: zod.coerce
|
|
6591
|
-
.date()
|
|
6592
|
-
.optional()
|
|
6593
|
-
.describe('Start date-time in RFC 3339 format.\n\nInclusive.'),
|
|
6594
|
-
groupBy: zod
|
|
6595
|
-
.array(zod.coerce.string())
|
|
6596
|
-
.max(queryMeterPostBodyGroupByMax)
|
|
6597
|
-
.optional()
|
|
6598
|
-
.describe('If not specified a single aggregate will be returned for each subject and time window.\n`subject` is a reserved group by value.'),
|
|
6599
|
-
subject: zod
|
|
6600
|
-
.array(zod.coerce.string())
|
|
6601
|
-
.max(queryMeterPostBodySubjectMax)
|
|
6602
|
-
.optional()
|
|
6603
|
-
.describe('Filtering by multiple subjects.'),
|
|
6604
|
-
to: zod.coerce
|
|
6605
|
-
.date()
|
|
6606
|
-
.optional()
|
|
6607
|
-
.describe('End date-time in RFC 3339 format.\n\nInclusive.'),
|
|
6608
|
-
windowSize: zod
|
|
6609
|
-
.enum(['MINUTE', 'HOUR', 'DAY', 'MONTH'])
|
|
6610
|
-
.describe('Aggregation window size.')
|
|
6611
|
-
.optional()
|
|
6612
|
-
.describe('If not specified, a single usage aggregate will be returned for the entirety of the specified period for each subject and group.'),
|
|
6613
|
-
windowTimeZone: zod.coerce
|
|
6614
|
-
.string()
|
|
6615
|
-
.default(queryMeterPostBodyWindowTimeZoneDefault)
|
|
6616
|
-
.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.'),
|
|
6617
|
-
})
|
|
6618
|
-
.describe('A meter query request.');
|
|
6619
|
-
/**
|
|
6620
|
-
* List subjects for a meter.
|
|
6621
|
-
* @summary List meter subjects
|
|
6622
|
-
*/
|
|
6623
|
-
export const listMeterSubjectsPathMeterIdOrSlugMax = 64;
|
|
6624
|
-
export const listMeterSubjectsPathMeterIdOrSlugRegExp = new RegExp('^[a-z0-9]+(?:_[a-z0-9]+)*$|^[0-7][0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{25}$');
|
|
6625
|
-
export const listMeterSubjectsParams = zod.object({
|
|
6626
|
-
meterIdOrSlug: zod.coerce
|
|
6627
|
-
.string()
|
|
6628
|
-
.min(1)
|
|
6629
|
-
.max(listMeterSubjectsPathMeterIdOrSlugMax)
|
|
6630
|
-
.regex(listMeterSubjectsPathMeterIdOrSlugRegExp),
|
|
6631
|
-
});
|
|
6632
|
-
/**
|
|
6633
|
-
* List all notification channels.
|
|
6634
|
-
* @summary List notification channels
|
|
6635
|
-
*/
|
|
6636
|
-
export const listNotificationChannelsQueryIncludeDeletedDefault = false;
|
|
6637
|
-
export const listNotificationChannelsQueryIncludeDisabledDefault = false;
|
|
6638
|
-
export const listNotificationChannelsQueryPageDefault = 1;
|
|
6639
|
-
export const listNotificationChannelsQueryPageSizeDefault = 100;
|
|
6640
|
-
export const listNotificationChannelsQueryPageSizeMax = 1000;
|
|
6641
|
-
export const listNotificationChannelsQueryParams = zod.object({
|
|
6642
|
-
includeDeleted: zod.coerce
|
|
6643
|
-
.boolean()
|
|
6644
|
-
.optional()
|
|
6645
|
-
.describe('Include deleted notification channels in response.\n\nUsage: `?includeDeleted=true`'),
|
|
6646
|
-
includeDisabled: zod.coerce
|
|
6647
|
-
.boolean()
|
|
6648
|
-
.optional()
|
|
6649
|
-
.describe('Include disabled notification channels in response.\n\nUsage: `?includeDisabled=false`'),
|
|
6650
|
-
order: zod.enum(['ASC', 'DESC']).optional().describe('The order direction.'),
|
|
6651
|
-
orderBy: zod
|
|
6652
|
-
.enum(['id', 'type', 'createdAt', 'updatedAt'])
|
|
6653
|
-
.optional()
|
|
6654
|
-
.describe('The order by field.'),
|
|
6655
|
-
page: zod.coerce
|
|
6656
|
-
.number()
|
|
6657
|
-
.min(1)
|
|
6658
|
-
.default(listNotificationChannelsQueryPageDefault)
|
|
6659
|
-
.describe('Page index.\n\nDefault is 1.'),
|
|
6660
|
-
pageSize: zod.coerce
|
|
6661
|
-
.number()
|
|
6662
|
-
.min(1)
|
|
6663
|
-
.max(listNotificationChannelsQueryPageSizeMax)
|
|
6664
|
-
.default(listNotificationChannelsQueryPageSizeDefault)
|
|
6665
|
-
.describe('The maximum number of items per page.\n\nDefault is 100.'),
|
|
6666
|
-
});
|
|
6667
|
-
/**
|
|
6668
|
-
* Create a new notification channel.
|
|
6669
|
-
* @summary Create a notification channel
|
|
6670
|
-
*/
|
|
6671
|
-
export const createNotificationChannelBodyDisabledDefault = false;
|
|
6672
|
-
export const createNotificationChannelBodySigningSecretRegExp = new RegExp('^(whsec_)?[a-zA-Z0-9+/=]{32,100}$');
|
|
6673
|
-
export const createNotificationChannelBody = zod
|
|
6674
|
-
.object({
|
|
6675
|
-
customHeaders: zod
|
|
6676
|
-
.record(zod.string(), zod.coerce.string())
|
|
6677
|
-
.optional()
|
|
6678
|
-
.describe('Custom HTTP headers sent as part of the webhook request.'),
|
|
6679
|
-
disabled: zod.coerce
|
|
6680
|
-
.boolean()
|
|
6681
|
-
.optional()
|
|
6682
|
-
.describe('Whether the channel is disabled or not.'),
|
|
6683
|
-
name: zod.coerce.string().describe('User friendly name of the channel.'),
|
|
6684
|
-
signingSecret: zod.coerce
|
|
6685
|
-
.string()
|
|
6686
|
-
.regex(createNotificationChannelBodySigningSecretRegExp)
|
|
6687
|
-
.optional()
|
|
6688
|
-
.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'),
|
|
6689
|
-
type: zod.enum(['WEBHOOK']).describe('Notification channel type.'),
|
|
6690
|
-
url: zod.coerce
|
|
6691
|
-
.string()
|
|
6692
|
-
.describe('Webhook URL where the notification is sent.'),
|
|
6693
|
-
})
|
|
6694
|
-
.describe('Request with input parameters for creating new notification channel with webhook type.')
|
|
6695
|
-
.describe('Union type for requests creating new notification channel with certain type.');
|
|
6696
|
-
/**
|
|
6697
|
-
* Update notification channel.
|
|
6698
|
-
* @summary Update a notification channel
|
|
6699
|
-
*/
|
|
6700
|
-
export const updateNotificationChannelPathChannelIdRegExp = new RegExp('^[0-7][0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{25}$');
|
|
6701
|
-
export const updateNotificationChannelParams = zod.object({
|
|
6702
|
-
channelId: zod.coerce
|
|
6703
|
-
.string()
|
|
6704
|
-
.regex(updateNotificationChannelPathChannelIdRegExp),
|
|
6014
|
+
.regex(updateNotificationChannelPathChannelIdRegExp),
|
|
6705
6015
|
});
|
|
6706
6016
|
export const updateNotificationChannelBodyDisabledDefault = false;
|
|
6707
6017
|
export const updateNotificationChannelBodySigningSecretRegExp = new RegExp('^(whsec_)?[a-zA-Z0-9+/=]{32,100}$');
|
|
@@ -6913,8 +6223,14 @@ export const createNotificationRuleBody = zod
|
|
|
6913
6223
|
.array(zod
|
|
6914
6224
|
.object({
|
|
6915
6225
|
type: zod
|
|
6916
|
-
.enum([
|
|
6917
|
-
|
|
6226
|
+
.enum([
|
|
6227
|
+
'PERCENT',
|
|
6228
|
+
'NUMBER',
|
|
6229
|
+
'balance_value',
|
|
6230
|
+
'usage_percentage',
|
|
6231
|
+
'usage_value',
|
|
6232
|
+
])
|
|
6233
|
+
.describe('Type of the rule in the balance threshold specification:\n* `balance_value`: threshold defined by the remaining balance value based on usage and the total of grants in the current usage period\n* `usage_percentage`: threshold defined by the usage percentage compared to the total of grants in the current usage period\n* `usage_value`: threshold defined by the usage value in the current usage period\n* `NUMBER` (**deprecated**): see `usage_value`\n* `PERCENT` (**deprecated**): see `usage_percentage`')
|
|
6918
6234
|
.describe('Type of the threshold.'),
|
|
6919
6235
|
value: zod.coerce.number().describe('Value of the threshold.'),
|
|
6920
6236
|
})
|
|
@@ -7047,8 +6363,14 @@ export const updateNotificationRuleBody = zod
|
|
|
7047
6363
|
.array(zod
|
|
7048
6364
|
.object({
|
|
7049
6365
|
type: zod
|
|
7050
|
-
.enum([
|
|
7051
|
-
|
|
6366
|
+
.enum([
|
|
6367
|
+
'PERCENT',
|
|
6368
|
+
'NUMBER',
|
|
6369
|
+
'balance_value',
|
|
6370
|
+
'usage_percentage',
|
|
6371
|
+
'usage_value',
|
|
6372
|
+
])
|
|
6373
|
+
.describe('Type of the rule in the balance threshold specification:\n* `balance_value`: threshold defined by the remaining balance value based on usage and the total of grants in the current usage period\n* `usage_percentage`: threshold defined by the usage percentage compared to the total of grants in the current usage period\n* `usage_value`: threshold defined by the usage value in the current usage period\n* `NUMBER` (**deprecated**): see `usage_value`\n* `PERCENT` (**deprecated**): see `usage_percentage`')
|
|
7052
6374
|
.describe('Type of the threshold.'),
|
|
7053
6375
|
value: zod.coerce.number().describe('Value of the threshold.'),
|
|
7054
6376
|
})
|
|
@@ -9246,7 +8568,9 @@ export const createEntitlementBody = zod
|
|
|
9246
8568
|
.describe('A date-time anchor to base the recurring period on.'),
|
|
9247
8569
|
interval: zod
|
|
9248
8570
|
.union([
|
|
9249
|
-
zod.coerce
|
|
8571
|
+
zod.coerce
|
|
8572
|
+
.string()
|
|
8573
|
+
.regex(createEntitlementBodyUsagePeriodIntervalRegExpTwo),
|
|
9250
8574
|
zod
|
|
9251
8575
|
.enum(['DAY', 'WEEK', 'MONTH', 'YEAR'])
|
|
9252
8576
|
.describe('The unit of time for the interval.\nOne of: `day`, `week`, `month`, or `year`.'),
|
|
@@ -9289,7 +8613,9 @@ export const createEntitlementBody = zod
|
|
|
9289
8613
|
.describe('A date-time anchor to base the recurring period on.'),
|
|
9290
8614
|
interval: zod
|
|
9291
8615
|
.union([
|
|
9292
|
-
zod.coerce
|
|
8616
|
+
zod.coerce
|
|
8617
|
+
.string()
|
|
8618
|
+
.regex(createEntitlementBodyUsagePeriodIntervalRegExpSix),
|
|
9293
8619
|
zod
|
|
9294
8620
|
.enum(['DAY', 'WEEK', 'MONTH', 'YEAR'])
|
|
9295
8621
|
.describe('The unit of time for the interval.\nOne of: `day`, `week`, `month`, or `year`.'),
|
|
@@ -9330,7 +8656,9 @@ export const createEntitlementBody = zod
|
|
|
9330
8656
|
.describe('A date-time anchor to base the recurring period on.'),
|
|
9331
8657
|
interval: zod
|
|
9332
8658
|
.union([
|
|
9333
|
-
zod.coerce
|
|
8659
|
+
zod.coerce
|
|
8660
|
+
.string()
|
|
8661
|
+
.regex(createEntitlementBodyUsagePeriodIntervalRegExpOnezero),
|
|
9334
8662
|
zod
|
|
9335
8663
|
.enum(['DAY', 'WEEK', 'MONTH', 'YEAR'])
|
|
9336
8664
|
.describe('The unit of time for the interval.\nOne of: `day`, `week`, `month`, or `year`.'),
|
|
@@ -9442,7 +8770,9 @@ export const createGrantBody = zod
|
|
|
9442
8770
|
.describe('A date-time anchor to base the recurring period on.'),
|
|
9443
8771
|
interval: zod
|
|
9444
8772
|
.union([
|
|
9445
|
-
zod.coerce
|
|
8773
|
+
zod.coerce
|
|
8774
|
+
.string()
|
|
8775
|
+
.regex(createGrantBodyRecurrenceIntervalRegExpTwo),
|
|
9446
8776
|
zod
|
|
9447
8777
|
.enum(['DAY', 'WEEK', 'MONTH', 'YEAR'])
|
|
9448
8778
|
.describe('The unit of time for the interval.\nOne of: `day`, `week`, `month`, or `year`.'),
|
|
@@ -9545,7 +8875,9 @@ export const overrideEntitlementBody = zod
|
|
|
9545
8875
|
.describe('A date-time anchor to base the recurring period on.'),
|
|
9546
8876
|
interval: zod
|
|
9547
8877
|
.union([
|
|
9548
|
-
zod.coerce
|
|
8878
|
+
zod.coerce
|
|
8879
|
+
.string()
|
|
8880
|
+
.regex(overrideEntitlementBodyUsagePeriodIntervalRegExpTwo),
|
|
9549
8881
|
zod
|
|
9550
8882
|
.enum(['DAY', 'WEEK', 'MONTH', 'YEAR'])
|
|
9551
8883
|
.describe('The unit of time for the interval.\nOne of: `day`, `week`, `month`, or `year`.'),
|
|
@@ -9588,7 +8920,9 @@ export const overrideEntitlementBody = zod
|
|
|
9588
8920
|
.describe('A date-time anchor to base the recurring period on.'),
|
|
9589
8921
|
interval: zod
|
|
9590
8922
|
.union([
|
|
9591
|
-
zod.coerce
|
|
8923
|
+
zod.coerce
|
|
8924
|
+
.string()
|
|
8925
|
+
.regex(overrideEntitlementBodyUsagePeriodIntervalRegExpSix),
|
|
9592
8926
|
zod
|
|
9593
8927
|
.enum(['DAY', 'WEEK', 'MONTH', 'YEAR'])
|
|
9594
8928
|
.describe('The unit of time for the interval.\nOne of: `day`, `week`, `month`, or `year`.'),
|
|
@@ -9629,7 +8963,9 @@ export const overrideEntitlementBody = zod
|
|
|
9629
8963
|
.describe('A date-time anchor to base the recurring period on.'),
|
|
9630
8964
|
interval: zod
|
|
9631
8965
|
.union([
|
|
9632
|
-
zod.coerce
|
|
8966
|
+
zod.coerce
|
|
8967
|
+
.string()
|
|
8968
|
+
.regex(overrideEntitlementBodyUsagePeriodIntervalRegExpOnezero),
|
|
9633
8969
|
zod
|
|
9634
8970
|
.enum(['DAY', 'WEEK', 'MONTH', 'YEAR'])
|
|
9635
8971
|
.describe('The unit of time for the interval.\nOne of: `day`, `week`, `month`, or `year`.'),
|
|
@@ -12050,85 +11386,970 @@ export const changeSubscriptionBody = zod
|
|
|
12050
11386
|
.default(changeSubscriptionBodyCustomPlanProRatingConfigDefault)
|
|
12051
11387
|
.describe('Default pro-rating configuration for subscriptions using this plan.'),
|
|
12052
11388
|
})
|
|
12053
|
-
.describe('The template for omitting properties.')
|
|
12054
|
-
.describe('Plan input for custom subscription creation (without key and version).')
|
|
12055
|
-
.describe('The custom plan description which defines the Subscription.'),
|
|
12056
|
-
timing: zod
|
|
12057
|
-
.union([
|
|
12058
|
-
zod
|
|
12059
|
-
.enum(['immediate', 'next_billing_cycle'])
|
|
12060
|
-
.describe('Subscription edit timing.\nWhen immediate, the requested changes take effect immediately.\nWhen nextBillingCycle, the requested changes take effect at the next billing cycle.'),
|
|
12061
|
-
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 listCustomerEntitlementsV2QueryOffsetDefault = 0;
|
|
11701
|
+
export const listCustomerEntitlementsV2QueryOffsetMin = 0;
|
|
11702
|
+
export const listCustomerEntitlementsV2QueryLimitDefault = 100;
|
|
11703
|
+
export const listCustomerEntitlementsV2QueryLimitMax = 1000;
|
|
11704
|
+
export const listCustomerEntitlementsV2QueryParams = zod.object({
|
|
11705
|
+
includeDeleted: zod.coerce.boolean().optional(),
|
|
11706
|
+
limit: zod.coerce
|
|
11707
|
+
.number()
|
|
11708
|
+
.min(1)
|
|
11709
|
+
.max(listCustomerEntitlementsV2QueryLimitMax)
|
|
11710
|
+
.default(listCustomerEntitlementsV2QueryLimitDefault)
|
|
11711
|
+
.describe('Number of items to return.\n\nDefault is 100.'),
|
|
11712
|
+
offset: zod.coerce
|
|
11713
|
+
.number()
|
|
11714
|
+
.min(listCustomerEntitlementsV2QueryOffsetMin)
|
|
11715
|
+
.optional()
|
|
11716
|
+
.describe('Number of items to skip.\n\nDefault is 0.'),
|
|
11717
|
+
order: zod.enum(['ASC', 'DESC']).optional().describe('The order direction.'),
|
|
11718
|
+
orderBy: zod
|
|
11719
|
+
.enum(['createdAt', 'updatedAt'])
|
|
11720
|
+
.optional()
|
|
11721
|
+
.describe('The order by field.'),
|
|
11722
|
+
page: zod.coerce
|
|
11723
|
+
.number()
|
|
11724
|
+
.min(1)
|
|
11725
|
+
.default(listCustomerEntitlementsV2QueryPageDefault)
|
|
11726
|
+
.describe('Page index.\n\nDefault is 1.'),
|
|
11727
|
+
pageSize: zod.coerce
|
|
11728
|
+
.number()
|
|
11729
|
+
.min(1)
|
|
11730
|
+
.max(listCustomerEntitlementsV2QueryPageSizeMax)
|
|
11731
|
+
.default(listCustomerEntitlementsV2QueryPageSizeDefault)
|
|
11732
|
+
.describe('The maximum number of items per page.\n\nDefault is 100.'),
|
|
11733
|
+
});
|
|
11734
|
+
/**
|
|
11735
|
+
* Get entitlement by feature key. For checking entitlement access, use the /value endpoint instead.
|
|
11736
|
+
If featureKey is used, the entitlement is resolved for the current timestamp.
|
|
11737
|
+
* @summary Get customer entitlement
|
|
11738
|
+
*/
|
|
11739
|
+
export const getCustomerEntitlementV2PathEntitlementIdOrFeatureKeyMax = 64;
|
|
11740
|
+
export const getCustomerEntitlementV2PathEntitlementIdOrFeatureKeyRegExp = new RegExp('^[a-z0-9]+(?:_[a-z0-9]+)*$|^[0-7][0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{25}$');
|
|
11741
|
+
export const getCustomerEntitlementV2Params = zod.object({
|
|
11742
|
+
customerIdOrKey: zod.union([
|
|
11743
|
+
zod.coerce
|
|
11744
|
+
.string()
|
|
11745
|
+
.regex(getCustomerEntitlementV2PathCustomerIdOrKeyRegExpOne)
|
|
11746
|
+
.describe('ULID (Universally Unique Lexicographically Sortable Identifier).'),
|
|
11747
|
+
zod.coerce
|
|
11748
|
+
.string()
|
|
11749
|
+
.min(1)
|
|
11750
|
+
.max(getCustomerEntitlementV2PathCustomerIdOrKeyMaxTwo)
|
|
11751
|
+
.describe('ExternalKey is a looser version of key.'),
|
|
11752
|
+
]),
|
|
11753
|
+
entitlementIdOrFeatureKey: zod.coerce
|
|
11754
|
+
.string()
|
|
11755
|
+
.min(1)
|
|
11756
|
+
.max(getCustomerEntitlementV2PathEntitlementIdOrFeatureKeyMax)
|
|
11757
|
+
.regex(getCustomerEntitlementV2PathEntitlementIdOrFeatureKeyRegExp),
|
|
11758
|
+
});
|
|
11759
|
+
/**
|
|
11760
|
+
* 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.
|
|
11761
|
+
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.
|
|
11762
|
+
* @summary Delete customer entitlement
|
|
11763
|
+
*/
|
|
11764
|
+
export const deleteCustomerEntitlementV2PathEntitlementIdOrFeatureKeyMax = 64;
|
|
11765
|
+
export const deleteCustomerEntitlementV2PathEntitlementIdOrFeatureKeyRegExp = new RegExp('^[a-z0-9]+(?:_[a-z0-9]+)*$|^[0-7][0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{25}$');
|
|
11766
|
+
export const deleteCustomerEntitlementV2Params = zod.object({
|
|
11767
|
+
customerIdOrKey: zod.union([
|
|
11768
|
+
zod.coerce
|
|
11769
|
+
.string()
|
|
11770
|
+
.regex(deleteCustomerEntitlementV2PathCustomerIdOrKeyRegExpOne)
|
|
11771
|
+
.describe('ULID (Universally Unique Lexicographically Sortable Identifier).'),
|
|
11772
|
+
zod.coerce
|
|
11773
|
+
.string()
|
|
11774
|
+
.min(1)
|
|
11775
|
+
.max(deleteCustomerEntitlementV2PathCustomerIdOrKeyMaxTwo)
|
|
11776
|
+
.describe('ExternalKey is a looser version of key.'),
|
|
11777
|
+
]),
|
|
11778
|
+
entitlementIdOrFeatureKey: zod.coerce
|
|
11779
|
+
.string()
|
|
11780
|
+
.min(1)
|
|
11781
|
+
.max(deleteCustomerEntitlementV2PathEntitlementIdOrFeatureKeyMax)
|
|
11782
|
+
.regex(deleteCustomerEntitlementV2PathEntitlementIdOrFeatureKeyRegExp),
|
|
11783
|
+
});
|
|
11784
|
+
/**
|
|
11785
|
+
* List all grants issued for an entitlement. The entitlement can be defined either by its id or featureKey.
|
|
11786
|
+
* @summary List customer entitlement grants
|
|
11787
|
+
*/
|
|
11788
|
+
export const listCustomerEntitlementGrantsV2PathEntitlementIdOrFeatureKeyMax = 64;
|
|
11789
|
+
export const listCustomerEntitlementGrantsV2PathEntitlementIdOrFeatureKeyRegExp = new RegExp('^[a-z0-9]+(?:_[a-z0-9]+)*$|^[0-7][0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{25}$');
|
|
11790
|
+
export const listCustomerEntitlementGrantsV2Params = zod.object({
|
|
11791
|
+
customerIdOrKey: zod.union([
|
|
11792
|
+
zod.coerce
|
|
11793
|
+
.string()
|
|
11794
|
+
.regex(listCustomerEntitlementGrantsV2PathCustomerIdOrKeyRegExpOne)
|
|
11795
|
+
.describe('ULID (Universally Unique Lexicographically Sortable Identifier).'),
|
|
11796
|
+
zod.coerce
|
|
11797
|
+
.string()
|
|
11798
|
+
.min(1)
|
|
11799
|
+
.max(listCustomerEntitlementGrantsV2PathCustomerIdOrKeyMaxTwo)
|
|
11800
|
+
.describe('ExternalKey is a looser version of key.'),
|
|
11801
|
+
]),
|
|
11802
|
+
entitlementIdOrFeatureKey: zod.coerce
|
|
11803
|
+
.string()
|
|
11804
|
+
.min(1)
|
|
11805
|
+
.max(listCustomerEntitlementGrantsV2PathEntitlementIdOrFeatureKeyMax)
|
|
11806
|
+
.regex(listCustomerEntitlementGrantsV2PathEntitlementIdOrFeatureKeyRegExp),
|
|
11807
|
+
});
|
|
11808
|
+
export const listCustomerEntitlementGrantsV2QueryIncludeDeletedDefault = false;
|
|
11809
|
+
export const listCustomerEntitlementGrantsV2QueryPageDefault = 1;
|
|
11810
|
+
export const listCustomerEntitlementGrantsV2QueryPageSizeDefault = 100;
|
|
11811
|
+
export const listCustomerEntitlementGrantsV2QueryPageSizeMax = 1000;
|
|
11812
|
+
export const listCustomerEntitlementGrantsV2QueryOffsetDefault = 0;
|
|
11813
|
+
export const listCustomerEntitlementGrantsV2QueryOffsetMin = 0;
|
|
11814
|
+
export const listCustomerEntitlementGrantsV2QueryLimitDefault = 100;
|
|
11815
|
+
export const listCustomerEntitlementGrantsV2QueryLimitMax = 1000;
|
|
11816
|
+
export const listCustomerEntitlementGrantsV2QueryParams = zod.object({
|
|
11817
|
+
includeDeleted: zod.coerce.boolean().optional(),
|
|
11818
|
+
limit: zod.coerce
|
|
11819
|
+
.number()
|
|
11820
|
+
.min(1)
|
|
11821
|
+
.max(listCustomerEntitlementGrantsV2QueryLimitMax)
|
|
11822
|
+
.default(listCustomerEntitlementGrantsV2QueryLimitDefault)
|
|
11823
|
+
.describe('Number of items to return.\n\nDefault is 100.'),
|
|
11824
|
+
offset: zod.coerce
|
|
11825
|
+
.number()
|
|
11826
|
+
.min(listCustomerEntitlementGrantsV2QueryOffsetMin)
|
|
11827
|
+
.optional()
|
|
11828
|
+
.describe('Number of items to skip.\n\nDefault is 0.'),
|
|
11829
|
+
order: zod.enum(['ASC', 'DESC']).optional().describe('The order direction.'),
|
|
11830
|
+
orderBy: zod
|
|
11831
|
+
.enum(['id', 'createdAt', 'updatedAt'])
|
|
11832
|
+
.optional()
|
|
11833
|
+
.describe('The order by field.'),
|
|
11834
|
+
page: zod.coerce
|
|
11835
|
+
.number()
|
|
11836
|
+
.min(1)
|
|
11837
|
+
.default(listCustomerEntitlementGrantsV2QueryPageDefault)
|
|
11838
|
+
.describe('Page index.\n\nDefault is 1.'),
|
|
11839
|
+
pageSize: zod.coerce
|
|
11840
|
+
.number()
|
|
11841
|
+
.min(1)
|
|
11842
|
+
.max(listCustomerEntitlementGrantsV2QueryPageSizeMax)
|
|
11843
|
+
.default(listCustomerEntitlementGrantsV2QueryPageSizeDefault)
|
|
11844
|
+
.describe('The maximum number of items per page.\n\nDefault is 100.'),
|
|
11845
|
+
});
|
|
11846
|
+
/**
|
|
11847
|
+
* 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.
|
|
11848
|
+
|
|
11849
|
+
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.
|
|
11850
|
+
|
|
11851
|
+
Grants have a priority setting that determines their order of use. Lower numbers have higher priority, with 0 being the highest priority.
|
|
11852
|
+
|
|
11853
|
+
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).
|
|
11854
|
+
|
|
11855
|
+
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))
|
|
11856
|
+
|
|
11857
|
+
Grants cannot be changed once created, only deleted. This is to ensure that balance is deterministic regardless of when it is queried.
|
|
11858
|
+
* @summary Create customer entitlement grant
|
|
11859
|
+
*/
|
|
11860
|
+
export const createCustomerEntitlementGrantV2PathEntitlementIdOrFeatureKeyMax = 64;
|
|
11861
|
+
export const createCustomerEntitlementGrantV2PathEntitlementIdOrFeatureKeyRegExp = new RegExp('^[a-z0-9]+(?:_[a-z0-9]+)*$|^[0-7][0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{25}$');
|
|
11862
|
+
export const createCustomerEntitlementGrantV2Params = zod.object({
|
|
11863
|
+
customerIdOrKey: zod.union([
|
|
11864
|
+
zod.coerce
|
|
11865
|
+
.string()
|
|
11866
|
+
.regex(createCustomerEntitlementGrantV2PathCustomerIdOrKeyRegExpOne)
|
|
11867
|
+
.describe('ULID (Universally Unique Lexicographically Sortable Identifier).'),
|
|
11868
|
+
zod.coerce
|
|
11869
|
+
.string()
|
|
11870
|
+
.min(1)
|
|
11871
|
+
.max(createCustomerEntitlementGrantV2PathCustomerIdOrKeyMaxTwo)
|
|
11872
|
+
.describe('ExternalKey is a looser version of key.'),
|
|
11873
|
+
]),
|
|
11874
|
+
entitlementIdOrFeatureKey: zod.coerce
|
|
11875
|
+
.string()
|
|
11876
|
+
.min(1)
|
|
11877
|
+
.max(createCustomerEntitlementGrantV2PathEntitlementIdOrFeatureKeyMax)
|
|
11878
|
+
.regex(createCustomerEntitlementGrantV2PathEntitlementIdOrFeatureKeyRegExp),
|
|
11879
|
+
});
|
|
11880
|
+
export const createCustomerEntitlementGrantV2BodyAmountMin = 0;
|
|
11881
|
+
export const createCustomerEntitlementGrantV2BodyPriorityMax = 255;
|
|
11882
|
+
export const createCustomerEntitlementGrantV2BodyExpirationCountMax = 1000;
|
|
11883
|
+
export const createCustomerEntitlementGrantV2BodyMaxRolloverAmountDefault = 0;
|
|
11884
|
+
export const createCustomerEntitlementGrantV2BodyMinRolloverAmountDefault = 0;
|
|
11885
|
+
export const createCustomerEntitlementGrantV2Body = zod
|
|
11886
|
+
.object({
|
|
11887
|
+
amount: zod.coerce
|
|
11888
|
+
.number()
|
|
11889
|
+
.min(createCustomerEntitlementGrantV2BodyAmountMin)
|
|
11890
|
+
.describe('The amount to grant. Should be a positive number.'),
|
|
11891
|
+
effectiveAt: zod.coerce
|
|
11892
|
+
.date()
|
|
11893
|
+
.describe('Effective date for grants and anchor for recurring grants. Provided value will be ceiled to metering windowSize (minute).'),
|
|
11894
|
+
expiration: zod
|
|
11895
|
+
.object({
|
|
11896
|
+
count: zod.coerce
|
|
11897
|
+
.number()
|
|
11898
|
+
.min(1)
|
|
11899
|
+
.max(createCustomerEntitlementGrantV2BodyExpirationCountMax)
|
|
11900
|
+
.describe('The number of time units in the expiration period.'),
|
|
11901
|
+
duration: zod
|
|
11902
|
+
.enum(['HOUR', 'DAY', 'WEEK', 'MONTH', 'YEAR'])
|
|
11903
|
+
.describe('The expiration duration enum')
|
|
11904
|
+
.describe('The unit of time for the expiration period.'),
|
|
11905
|
+
})
|
|
11906
|
+
.describe('The grant expiration definition')
|
|
11907
|
+
.describe('The grant expiration definition'),
|
|
11908
|
+
maxRolloverAmount: zod.coerce
|
|
11909
|
+
.number()
|
|
11910
|
+
.optional()
|
|
11911
|
+
.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))'),
|
|
11912
|
+
metadata: zod
|
|
11913
|
+
.record(zod.string(), zod.coerce.string())
|
|
11914
|
+
.describe('Set of key-value pairs.\nMetadata can be used to store additional information about a resource.')
|
|
11915
|
+
.optional()
|
|
11916
|
+
.describe('The grant metadata.'),
|
|
11917
|
+
minRolloverAmount: zod.coerce
|
|
11918
|
+
.number()
|
|
11919
|
+
.optional()
|
|
11920
|
+
.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))'),
|
|
11921
|
+
priority: zod.coerce
|
|
11922
|
+
.number()
|
|
11923
|
+
.min(1)
|
|
11924
|
+
.max(createCustomerEntitlementGrantV2BodyPriorityMax)
|
|
11925
|
+
.optional()
|
|
11926
|
+
.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.'),
|
|
11927
|
+
recurrence: zod
|
|
11928
|
+
.object({
|
|
11929
|
+
anchor: zod.coerce
|
|
11930
|
+
.date()
|
|
11931
|
+
.optional()
|
|
11932
|
+
.describe('A date-time anchor to base the recurring period on.'),
|
|
11933
|
+
interval: zod
|
|
11934
|
+
.union([
|
|
11935
|
+
zod.coerce
|
|
11936
|
+
.string()
|
|
11937
|
+
.regex(createCustomerEntitlementGrantV2BodyRecurrenceIntervalRegExpTwo),
|
|
11938
|
+
zod
|
|
11939
|
+
.enum(['DAY', 'WEEK', 'MONTH', 'YEAR'])
|
|
11940
|
+
.describe('The unit of time for the interval.\nOne of: `day`, `week`, `month`, or `year`.'),
|
|
11941
|
+
])
|
|
11942
|
+
.describe('Period duration for the recurrence')
|
|
11943
|
+
.describe('The unit of time for the interval.'),
|
|
11944
|
+
})
|
|
11945
|
+
.describe('Recurring period with an interval and an anchor.')
|
|
11946
|
+
.optional()
|
|
11947
|
+
.describe('The subject of the grant.'),
|
|
11948
|
+
})
|
|
11949
|
+
.describe('The grant creation input.');
|
|
11950
|
+
/**
|
|
11951
|
+
* Returns historical balance and usage data for the entitlement. The queried history can span accross multiple reset events.
|
|
11952
|
+
|
|
11953
|
+
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.
|
|
11954
|
+
|
|
11955
|
+
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.
|
|
11956
|
+
* @summary Get customer entitlement history
|
|
11957
|
+
*/
|
|
11958
|
+
export const getCustomerEntitlementHistoryV2PathEntitlementIdOrFeatureKeyMax = 64;
|
|
11959
|
+
export const getCustomerEntitlementHistoryV2PathEntitlementIdOrFeatureKeyRegExp = new RegExp('^[a-z0-9]+(?:_[a-z0-9]+)*$|^[0-7][0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{25}$');
|
|
11960
|
+
export const getCustomerEntitlementHistoryV2Params = zod.object({
|
|
11961
|
+
customerIdOrKey: zod.union([
|
|
11962
|
+
zod.coerce
|
|
11963
|
+
.string()
|
|
11964
|
+
.regex(getCustomerEntitlementHistoryV2PathCustomerIdOrKeyRegExpOne)
|
|
11965
|
+
.describe('ULID (Universally Unique Lexicographically Sortable Identifier).'),
|
|
11966
|
+
zod.coerce
|
|
11967
|
+
.string()
|
|
11968
|
+
.min(1)
|
|
11969
|
+
.max(getCustomerEntitlementHistoryV2PathCustomerIdOrKeyMaxTwo)
|
|
11970
|
+
.describe('ExternalKey is a looser version of key.'),
|
|
11971
|
+
]),
|
|
11972
|
+
entitlementIdOrFeatureKey: zod.coerce
|
|
11973
|
+
.string()
|
|
11974
|
+
.min(1)
|
|
11975
|
+
.max(getCustomerEntitlementHistoryV2PathEntitlementIdOrFeatureKeyMax)
|
|
11976
|
+
.regex(getCustomerEntitlementHistoryV2PathEntitlementIdOrFeatureKeyRegExp),
|
|
11977
|
+
});
|
|
11978
|
+
export const getCustomerEntitlementHistoryV2QueryWindowTimeZoneDefault = 'UTC';
|
|
11979
|
+
export const getCustomerEntitlementHistoryV2QueryParams = zod.object({
|
|
11980
|
+
from: zod.coerce
|
|
11981
|
+
.date()
|
|
11982
|
+
.optional()
|
|
11983
|
+
.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.'),
|
|
11984
|
+
to: zod.coerce
|
|
11985
|
+
.date()
|
|
11986
|
+
.optional()
|
|
11987
|
+
.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.'),
|
|
11988
|
+
windowSize: zod
|
|
11989
|
+
.enum(['MINUTE', 'HOUR', 'DAY', 'MONTH'])
|
|
11990
|
+
.describe('Windowsize'),
|
|
11991
|
+
windowTimeZone: zod.coerce
|
|
11992
|
+
.string()
|
|
11993
|
+
.default(getCustomerEntitlementHistoryV2QueryWindowTimeZoneDefault)
|
|
11994
|
+
.describe('The timezone used when calculating the windows.'),
|
|
11995
|
+
});
|
|
11996
|
+
/**
|
|
11997
|
+
* 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.
|
|
11998
|
+
|
|
11999
|
+
This endpoint is useful for upgrades, downgrades, or other changes to entitlements that require a new entitlement to be created with zero downtime.
|
|
12000
|
+
* @summary Override customer entitlement
|
|
12001
|
+
*/
|
|
12002
|
+
export const overrideCustomerEntitlementV2Params = zod.object({
|
|
12003
|
+
customerIdOrKey: zod.union([
|
|
12004
|
+
zod.coerce
|
|
12005
|
+
.string()
|
|
12006
|
+
.regex(overrideCustomerEntitlementV2PathCustomerIdOrKeyRegExpOne)
|
|
12007
|
+
.describe('ULID (Universally Unique Lexicographically Sortable Identifier).'),
|
|
12008
|
+
zod.coerce
|
|
12009
|
+
.string()
|
|
12010
|
+
.min(1)
|
|
12011
|
+
.max(overrideCustomerEntitlementV2PathCustomerIdOrKeyMaxTwo)
|
|
12012
|
+
.describe('ExternalKey is a looser version of key.'),
|
|
12013
|
+
]),
|
|
12014
|
+
entitlementIdOrFeatureKey: zod.union([
|
|
12015
|
+
zod.coerce
|
|
12016
|
+
.string()
|
|
12017
|
+
.regex(overrideCustomerEntitlementV2PathEntitlementIdOrFeatureKeyRegExpOne)
|
|
12018
|
+
.describe('ULID (Universally Unique Lexicographically Sortable Identifier).'),
|
|
12019
|
+
zod.coerce
|
|
12020
|
+
.string()
|
|
12021
|
+
.min(1)
|
|
12022
|
+
.max(overrideCustomerEntitlementV2PathEntitlementIdOrFeatureKeyMaxTwo)
|
|
12023
|
+
.describe('ExternalKey is a looser version of key.'),
|
|
12024
|
+
]),
|
|
12025
|
+
});
|
|
12026
|
+
export const overrideCustomerEntitlementV2BodyFeatureKeyMax = 64;
|
|
12027
|
+
export const overrideCustomerEntitlementV2BodyFeatureKeyRegExp = new RegExp('^[a-z0-9]+(?:_[a-z0-9]+)*$');
|
|
12028
|
+
export const overrideCustomerEntitlementV2BodyFeatureIdRegExp = new RegExp('^[0-7][0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{25}$');
|
|
12029
|
+
export const overrideCustomerEntitlementV2BodyIsSoftLimitDefault = false;
|
|
12030
|
+
export const overrideCustomerEntitlementV2BodyIsUnlimitedDefault = false;
|
|
12031
|
+
export const overrideCustomerEntitlementV2BodyIssueAfterResetMin = 0;
|
|
12032
|
+
export const overrideCustomerEntitlementV2BodyIssueAfterResetPriorityDefault = 1;
|
|
12033
|
+
export const overrideCustomerEntitlementV2BodyIssueAfterResetPriorityMax = 255;
|
|
12034
|
+
export const overrideCustomerEntitlementV2BodyPreserveOverageAtResetDefault = false;
|
|
12035
|
+
export const overrideCustomerEntitlementV2BodyFeatureKeyMaxOne = 64;
|
|
12036
|
+
export const overrideCustomerEntitlementV2BodyFeatureKeyRegExpOne = new RegExp('^[a-z0-9]+(?:_[a-z0-9]+)*$');
|
|
12037
|
+
export const overrideCustomerEntitlementV2BodyFeatureIdRegExpOne = new RegExp('^[0-7][0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{25}$');
|
|
12038
|
+
export const overrideCustomerEntitlementV2BodyFeatureKeyMaxTwo = 64;
|
|
12039
|
+
export const overrideCustomerEntitlementV2BodyFeatureKeyRegExpTwo = new RegExp('^[a-z0-9]+(?:_[a-z0-9]+)*$');
|
|
12040
|
+
export const overrideCustomerEntitlementV2BodyFeatureIdRegExpTwo = new RegExp('^[0-7][0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{25}$');
|
|
12041
|
+
export const overrideCustomerEntitlementV2Body = zod
|
|
12042
|
+
.union([
|
|
12043
|
+
zod
|
|
12044
|
+
.object({
|
|
12045
|
+
featureId: zod.coerce
|
|
12046
|
+
.string()
|
|
12047
|
+
.regex(overrideCustomerEntitlementV2BodyFeatureIdRegExp)
|
|
12048
|
+
.optional()
|
|
12049
|
+
.describe('The feature the subject is entitled to use.\nEither featureKey or featureId is required.'),
|
|
12050
|
+
featureKey: zod.coerce
|
|
12051
|
+
.string()
|
|
12052
|
+
.min(1)
|
|
12053
|
+
.max(overrideCustomerEntitlementV2BodyFeatureKeyMax)
|
|
12054
|
+
.regex(overrideCustomerEntitlementV2BodyFeatureKeyRegExp)
|
|
12055
|
+
.optional()
|
|
12056
|
+
.describe('The feature the subject is entitled to use.\nEither featureKey or featureId is required.'),
|
|
12057
|
+
isSoftLimit: zod.coerce
|
|
12058
|
+
.boolean()
|
|
12059
|
+
.optional()
|
|
12060
|
+
.describe('If softLimit=true the subject can use the feature even if the entitlement is exhausted, hasAccess will always be true.'),
|
|
12061
|
+
issueAfterReset: zod.coerce
|
|
12062
|
+
.number()
|
|
12063
|
+
.min(overrideCustomerEntitlementV2BodyIssueAfterResetMin)
|
|
12064
|
+
.optional()
|
|
12065
|
+
.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.'),
|
|
12066
|
+
issueAfterResetPriority: zod.coerce
|
|
12067
|
+
.number()
|
|
12068
|
+
.min(1)
|
|
12069
|
+
.max(overrideCustomerEntitlementV2BodyIssueAfterResetPriorityMax)
|
|
12070
|
+
.default(overrideCustomerEntitlementV2BodyIssueAfterResetPriorityDefault)
|
|
12071
|
+
.describe('Defines the grant priority for the default grant.'),
|
|
12072
|
+
isUnlimited: zod.coerce
|
|
12073
|
+
.boolean()
|
|
12074
|
+
.optional()
|
|
12075
|
+
.describe('Deprecated, ignored by the backend. Please use isSoftLimit instead; this field will be removed in the future.'),
|
|
12076
|
+
measureUsageFrom: zod
|
|
12077
|
+
.union([
|
|
12078
|
+
zod
|
|
12079
|
+
.enum(['CURRENT_PERIOD_START', 'NOW'])
|
|
12080
|
+
.describe('Start of measurement options'),
|
|
12081
|
+
zod.coerce
|
|
12082
|
+
.date()
|
|
12083
|
+
.describe('[RFC3339](https://tools.ietf.org/html/rfc3339) formatted date-time string in UTC.'),
|
|
12084
|
+
])
|
|
12085
|
+
.describe('Measure usage from')
|
|
12086
|
+
.optional()
|
|
12087
|
+
.describe('Defines the time from which usage is measured. If not specified on creation, defaults to entitlement creation time.'),
|
|
12088
|
+
metadata: zod
|
|
12089
|
+
.record(zod.string(), zod.coerce.string())
|
|
12090
|
+
.describe('Set of key-value pairs.\nMetadata can be used to store additional information about a resource.')
|
|
12091
|
+
.optional()
|
|
12092
|
+
.describe('Additional metadata for the feature.'),
|
|
12093
|
+
preserveOverageAtReset: zod.coerce
|
|
12094
|
+
.boolean()
|
|
12095
|
+
.optional()
|
|
12096
|
+
.describe('If true, the overage is preserved at reset. If false, the usage is reset to 0.'),
|
|
12097
|
+
type: zod.enum(['metered']),
|
|
12098
|
+
usagePeriod: zod
|
|
12099
|
+
.object({
|
|
12100
|
+
anchor: zod.coerce
|
|
12101
|
+
.date()
|
|
12102
|
+
.optional()
|
|
12103
|
+
.describe('A date-time anchor to base the recurring period on.'),
|
|
12104
|
+
interval: zod
|
|
12105
|
+
.union([
|
|
12106
|
+
zod.coerce
|
|
12107
|
+
.string()
|
|
12108
|
+
.regex(overrideCustomerEntitlementV2BodyUsagePeriodIntervalRegExpTwo),
|
|
12109
|
+
zod
|
|
12110
|
+
.enum(['DAY', 'WEEK', 'MONTH', 'YEAR'])
|
|
12111
|
+
.describe('The unit of time for the interval.\nOne of: `day`, `week`, `month`, or `year`.'),
|
|
12112
|
+
])
|
|
12113
|
+
.describe('Period duration for the recurrence')
|
|
12114
|
+
.describe('The unit of time for the interval.'),
|
|
12115
|
+
})
|
|
12116
|
+
.describe('Recurring period with an interval and an anchor.')
|
|
12117
|
+
.describe('The usage period associated with the entitlement.'),
|
|
12118
|
+
})
|
|
12119
|
+
.describe('Create inpurs for metered entitlement'),
|
|
12120
|
+
zod
|
|
12121
|
+
.object({
|
|
12122
|
+
config: zod.coerce
|
|
12123
|
+
.string()
|
|
12124
|
+
.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.'),
|
|
12125
|
+
featureId: zod.coerce
|
|
12126
|
+
.string()
|
|
12127
|
+
.regex(overrideCustomerEntitlementV2BodyFeatureIdRegExpOne)
|
|
12128
|
+
.optional()
|
|
12129
|
+
.describe('The feature the subject is entitled to use.\nEither featureKey or featureId is required.'),
|
|
12130
|
+
featureKey: zod.coerce
|
|
12131
|
+
.string()
|
|
12132
|
+
.min(1)
|
|
12133
|
+
.max(overrideCustomerEntitlementV2BodyFeatureKeyMaxOne)
|
|
12134
|
+
.regex(overrideCustomerEntitlementV2BodyFeatureKeyRegExpOne)
|
|
12135
|
+
.optional()
|
|
12136
|
+
.describe('The feature the subject is entitled to use.\nEither featureKey or featureId is required.'),
|
|
12137
|
+
metadata: zod
|
|
12138
|
+
.record(zod.string(), zod.coerce.string())
|
|
12139
|
+
.describe('Set of key-value pairs.\nMetadata can be used to store additional information about a resource.')
|
|
12140
|
+
.optional()
|
|
12141
|
+
.describe('Additional metadata for the feature.'),
|
|
12142
|
+
type: zod.enum(['static']),
|
|
12143
|
+
usagePeriod: zod
|
|
12144
|
+
.object({
|
|
12145
|
+
anchor: zod.coerce
|
|
12146
|
+
.date()
|
|
12147
|
+
.optional()
|
|
12148
|
+
.describe('A date-time anchor to base the recurring period on.'),
|
|
12149
|
+
interval: zod
|
|
12150
|
+
.union([
|
|
12151
|
+
zod.coerce
|
|
12152
|
+
.string()
|
|
12153
|
+
.regex(overrideCustomerEntitlementV2BodyUsagePeriodIntervalRegExpSix),
|
|
12154
|
+
zod
|
|
12155
|
+
.enum(['DAY', 'WEEK', 'MONTH', 'YEAR'])
|
|
12156
|
+
.describe('The unit of time for the interval.\nOne of: `day`, `week`, `month`, or `year`.'),
|
|
12157
|
+
])
|
|
12158
|
+
.describe('Period duration for the recurrence')
|
|
12159
|
+
.describe('The unit of time for the interval.'),
|
|
12160
|
+
})
|
|
12161
|
+
.describe('Recurring period with an interval and an anchor.')
|
|
12162
|
+
.optional()
|
|
12163
|
+
.describe('The usage period associated with the entitlement.'),
|
|
12164
|
+
})
|
|
12165
|
+
.describe('Create inputs for static entitlement'),
|
|
12166
|
+
zod
|
|
12167
|
+
.object({
|
|
12168
|
+
featureId: zod.coerce
|
|
12169
|
+
.string()
|
|
12170
|
+
.regex(overrideCustomerEntitlementV2BodyFeatureIdRegExpTwo)
|
|
12171
|
+
.optional()
|
|
12172
|
+
.describe('The feature the subject is entitled to use.\nEither featureKey or featureId is required.'),
|
|
12173
|
+
featureKey: zod.coerce
|
|
12174
|
+
.string()
|
|
12175
|
+
.min(1)
|
|
12176
|
+
.max(overrideCustomerEntitlementV2BodyFeatureKeyMaxTwo)
|
|
12177
|
+
.regex(overrideCustomerEntitlementV2BodyFeatureKeyRegExpTwo)
|
|
12178
|
+
.optional()
|
|
12179
|
+
.describe('The feature the subject is entitled to use.\nEither featureKey or featureId is required.'),
|
|
12180
|
+
metadata: zod
|
|
12181
|
+
.record(zod.string(), zod.coerce.string())
|
|
12182
|
+
.describe('Set of key-value pairs.\nMetadata can be used to store additional information about a resource.')
|
|
12183
|
+
.optional()
|
|
12184
|
+
.describe('Additional metadata for the feature.'),
|
|
12185
|
+
type: zod.enum(['boolean']),
|
|
12186
|
+
usagePeriod: zod
|
|
12187
|
+
.object({
|
|
12188
|
+
anchor: zod.coerce
|
|
12062
12189
|
.date()
|
|
12063
|
-
.
|
|
12064
|
-
|
|
12065
|
-
|
|
12066
|
-
|
|
12190
|
+
.optional()
|
|
12191
|
+
.describe('A date-time anchor to base the recurring period on.'),
|
|
12192
|
+
interval: zod
|
|
12193
|
+
.union([
|
|
12194
|
+
zod.coerce
|
|
12195
|
+
.string()
|
|
12196
|
+
.regex(overrideCustomerEntitlementV2BodyUsagePeriodIntervalRegExpOnezero),
|
|
12197
|
+
zod
|
|
12198
|
+
.enum(['DAY', 'WEEK', 'MONTH', 'YEAR'])
|
|
12199
|
+
.describe('The unit of time for the interval.\nOne of: `day`, `week`, `month`, or `year`.'),
|
|
12200
|
+
])
|
|
12201
|
+
.describe('Period duration for the recurrence')
|
|
12202
|
+
.describe('The unit of time for the interval.'),
|
|
12203
|
+
})
|
|
12204
|
+
.describe('Recurring period with an interval and an anchor.')
|
|
12205
|
+
.optional()
|
|
12206
|
+
.describe('The usage period associated with the entitlement.'),
|
|
12067
12207
|
})
|
|
12068
|
-
.describe('
|
|
12208
|
+
.describe('Create inputs for boolean entitlement'),
|
|
12069
12209
|
])
|
|
12070
|
-
.describe('
|
|
12210
|
+
.describe('Create inputs for entitlement');
|
|
12071
12211
|
/**
|
|
12072
|
-
*
|
|
12073
|
-
|
|
12074
|
-
|
|
12075
|
-
* @summary
|
|
12212
|
+
* 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.
|
|
12213
|
+
|
|
12214
|
+
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.
|
|
12215
|
+
* @summary Reset customer entitlement
|
|
12076
12216
|
*/
|
|
12077
|
-
export const
|
|
12078
|
-
export const
|
|
12079
|
-
|
|
12217
|
+
export const resetCustomerEntitlementUsageV2PathEntitlementIdOrFeatureKeyMax = 64;
|
|
12218
|
+
export const resetCustomerEntitlementUsageV2PathEntitlementIdOrFeatureKeyRegExp = new RegExp('^[a-z0-9]+(?:_[a-z0-9]+)*$|^[0-7][0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{25}$');
|
|
12219
|
+
export const resetCustomerEntitlementUsageV2Params = zod.object({
|
|
12220
|
+
customerIdOrKey: zod.union([
|
|
12221
|
+
zod.coerce
|
|
12222
|
+
.string()
|
|
12223
|
+
.regex(resetCustomerEntitlementUsageV2PathCustomerIdOrKeyRegExpOne)
|
|
12224
|
+
.describe('ULID (Universally Unique Lexicographically Sortable Identifier).'),
|
|
12225
|
+
zod.coerce
|
|
12226
|
+
.string()
|
|
12227
|
+
.min(1)
|
|
12228
|
+
.max(resetCustomerEntitlementUsageV2PathCustomerIdOrKeyMaxTwo)
|
|
12229
|
+
.describe('ExternalKey is a looser version of key.'),
|
|
12230
|
+
]),
|
|
12231
|
+
entitlementIdOrFeatureKey: zod.coerce
|
|
12080
12232
|
.string()
|
|
12081
|
-
.
|
|
12233
|
+
.min(1)
|
|
12234
|
+
.max(resetCustomerEntitlementUsageV2PathEntitlementIdOrFeatureKeyMax)
|
|
12235
|
+
.regex(resetCustomerEntitlementUsageV2PathEntitlementIdOrFeatureKeyRegExp),
|
|
12082
12236
|
});
|
|
12083
|
-
export const
|
|
12084
|
-
|
|
12085
|
-
|
|
12237
|
+
export const resetCustomerEntitlementUsageV2Body = zod
|
|
12238
|
+
.object({
|
|
12239
|
+
effectiveAt: zod.coerce
|
|
12086
12240
|
.date()
|
|
12087
12241
|
.optional()
|
|
12088
|
-
.describe('The
|
|
12089
|
-
|
|
12090
|
-
.
|
|
12091
|
-
.min(1)
|
|
12242
|
+
.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.'),
|
|
12243
|
+
preserveOverage: zod.coerce
|
|
12244
|
+
.boolean()
|
|
12092
12245
|
.optional()
|
|
12093
|
-
.describe(
|
|
12094
|
-
|
|
12095
|
-
.
|
|
12096
|
-
.min(1)
|
|
12246
|
+
.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."),
|
|
12247
|
+
retainAnchor: zod.coerce
|
|
12248
|
+
.boolean()
|
|
12097
12249
|
.optional()
|
|
12098
|
-
.describe('
|
|
12099
|
-
|
|
12100
|
-
|
|
12101
|
-
|
|
12102
|
-
|
|
12103
|
-
|
|
12250
|
+
.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.'),
|
|
12251
|
+
})
|
|
12252
|
+
.describe('Reset parameters');
|
|
12253
|
+
/**
|
|
12254
|
+
* 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.
|
|
12255
|
+
* @summary Get customer entitlement value
|
|
12256
|
+
*/
|
|
12257
|
+
export const getCustomerEntitlementValueV2PathEntitlementIdOrFeatureKeyMax = 64;
|
|
12258
|
+
export const getCustomerEntitlementValueV2PathEntitlementIdOrFeatureKeyRegExp = new RegExp('^[a-z0-9]+(?:_[a-z0-9]+)*$|^[0-7][0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{25}$');
|
|
12259
|
+
export const getCustomerEntitlementValueV2Params = zod.object({
|
|
12260
|
+
customerIdOrKey: zod.union([
|
|
12104
12261
|
zod.coerce
|
|
12105
|
-
.
|
|
12106
|
-
.
|
|
12107
|
-
|
|
12108
|
-
.
|
|
12109
|
-
|
|
12110
|
-
|
|
12262
|
+
.string()
|
|
12263
|
+
.regex(getCustomerEntitlementValueV2PathCustomerIdOrKeyRegExpOne)
|
|
12264
|
+
.describe('ULID (Universally Unique Lexicographically Sortable Identifier).'),
|
|
12265
|
+
zod.coerce
|
|
12266
|
+
.string()
|
|
12267
|
+
.min(1)
|
|
12268
|
+
.max(getCustomerEntitlementValueV2PathCustomerIdOrKeyMaxTwo)
|
|
12269
|
+
.describe('ExternalKey is a looser version of key.'),
|
|
12270
|
+
]),
|
|
12271
|
+
entitlementIdOrFeatureKey: zod.coerce
|
|
12272
|
+
.string()
|
|
12273
|
+
.min(1)
|
|
12274
|
+
.max(getCustomerEntitlementValueV2PathEntitlementIdOrFeatureKeyMax)
|
|
12275
|
+
.regex(getCustomerEntitlementValueV2PathEntitlementIdOrFeatureKeyRegExp),
|
|
12276
|
+
});
|
|
12277
|
+
export const getCustomerEntitlementValueV2QueryParams = zod.object({
|
|
12278
|
+
time: zod.coerce.date().optional(),
|
|
12111
12279
|
});
|
|
12112
12280
|
/**
|
|
12113
|
-
*
|
|
12114
|
-
|
|
12115
|
-
* @summary
|
|
12281
|
+
* List all entitlements for all the customers and features. This endpoint is intended for administrative purposes only.
|
|
12282
|
+
To fetch the entitlements of a specific subject please use the /api/v2/customers/{customerIdOrKey}/entitlements endpoint.
|
|
12283
|
+
* @summary List all entitlements
|
|
12116
12284
|
*/
|
|
12117
|
-
export const
|
|
12118
|
-
export const
|
|
12119
|
-
|
|
12120
|
-
|
|
12121
|
-
|
|
12285
|
+
export const listEntitlementsV2QueryExcludeInactiveDefault = false;
|
|
12286
|
+
export const listEntitlementsV2QueryPageDefault = 1;
|
|
12287
|
+
export const listEntitlementsV2QueryPageSizeDefault = 100;
|
|
12288
|
+
export const listEntitlementsV2QueryPageSizeMax = 1000;
|
|
12289
|
+
export const listEntitlementsV2QueryOffsetDefault = 0;
|
|
12290
|
+
export const listEntitlementsV2QueryOffsetMin = 0;
|
|
12291
|
+
export const listEntitlementsV2QueryLimitDefault = 100;
|
|
12292
|
+
export const listEntitlementsV2QueryLimitMax = 1000;
|
|
12293
|
+
export const listEntitlementsV2QueryParams = zod.object({
|
|
12294
|
+
customerIds: zod
|
|
12295
|
+
.array(zod.coerce.string())
|
|
12296
|
+
.optional()
|
|
12297
|
+
.describe('Filtering by multiple customers.\n\nUsage: `?customerIds=01K4WAQ0J99ZZ0MD75HXR112H8&customerIds=01K4WAQ0J99ZZ0MD75HXR112H9`'),
|
|
12298
|
+
customerKeys: zod
|
|
12299
|
+
.array(zod.coerce.string())
|
|
12300
|
+
.optional()
|
|
12301
|
+
.describe('Filtering by multiple customers.\n\nUsage: `?customerKeys=customer-1&customerKeys=customer-3`'),
|
|
12302
|
+
entitlementType: zod
|
|
12303
|
+
.array(zod
|
|
12304
|
+
.enum(['metered', 'boolean', 'static'])
|
|
12305
|
+
.describe('Type of the entitlement.'))
|
|
12306
|
+
.optional()
|
|
12307
|
+
.describe('Filtering by multiple entitlement types.\n\nUsage: `?entitlementType=metered&entitlementType=boolean`'),
|
|
12308
|
+
excludeInactive: zod.coerce
|
|
12309
|
+
.boolean()
|
|
12310
|
+
.optional()
|
|
12311
|
+
.describe('Exclude inactive entitlements in the response (those scheduled for later or earlier)'),
|
|
12312
|
+
feature: zod
|
|
12313
|
+
.array(zod.coerce.string())
|
|
12314
|
+
.optional()
|
|
12315
|
+
.describe('Filtering by multiple features.\n\nUsage: `?feature=feature-1&feature=feature-2`'),
|
|
12316
|
+
limit: zod.coerce
|
|
12317
|
+
.number()
|
|
12318
|
+
.min(1)
|
|
12319
|
+
.max(listEntitlementsV2QueryLimitMax)
|
|
12320
|
+
.default(listEntitlementsV2QueryLimitDefault)
|
|
12321
|
+
.describe('Number of items to return.\n\nDefault is 100.'),
|
|
12322
|
+
offset: zod.coerce
|
|
12323
|
+
.number()
|
|
12324
|
+
.min(listEntitlementsV2QueryOffsetMin)
|
|
12325
|
+
.optional()
|
|
12326
|
+
.describe('Number of items to skip.\n\nDefault is 0.'),
|
|
12327
|
+
order: zod.enum(['ASC', 'DESC']).optional().describe('The order direction.'),
|
|
12328
|
+
orderBy: zod
|
|
12329
|
+
.enum(['createdAt', 'updatedAt'])
|
|
12330
|
+
.optional()
|
|
12331
|
+
.describe('The order by field.'),
|
|
12332
|
+
page: zod.coerce
|
|
12333
|
+
.number()
|
|
12334
|
+
.min(1)
|
|
12335
|
+
.default(listEntitlementsV2QueryPageDefault)
|
|
12336
|
+
.describe('Page index.\n\nDefault is 1.'),
|
|
12337
|
+
pageSize: zod.coerce
|
|
12338
|
+
.number()
|
|
12339
|
+
.min(1)
|
|
12340
|
+
.max(listEntitlementsV2QueryPageSizeMax)
|
|
12341
|
+
.default(listEntitlementsV2QueryPageSizeDefault)
|
|
12342
|
+
.describe('The maximum number of items per page.\n\nDefault is 100.'),
|
|
12122
12343
|
});
|
|
12123
12344
|
/**
|
|
12124
|
-
*
|
|
12125
|
-
* @summary
|
|
12345
|
+
* Get entitlement by id.
|
|
12346
|
+
* @summary Get entitlement by id
|
|
12126
12347
|
*/
|
|
12127
|
-
export const
|
|
12128
|
-
export const
|
|
12129
|
-
|
|
12348
|
+
export const getEntitlementByIdV2PathEntitlementIdRegExp = new RegExp('^[0-7][0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{25}$');
|
|
12349
|
+
export const getEntitlementByIdV2Params = zod.object({
|
|
12350
|
+
entitlementId: zod.coerce
|
|
12130
12351
|
.string()
|
|
12131
|
-
.regex(
|
|
12352
|
+
.regex(getEntitlementByIdV2PathEntitlementIdRegExp),
|
|
12132
12353
|
});
|
|
12133
12354
|
/**
|
|
12134
12355
|
* List ingested events with advanced filtering and cursor pagination.
|
|
@@ -12155,4 +12376,68 @@ export const listEventsV2QueryParams = zod.object({
|
|
|
12155
12376
|
.default(listEventsV2QueryLimitDefault)
|
|
12156
12377
|
.describe('The limit of the pagination.'),
|
|
12157
12378
|
});
|
|
12379
|
+
/**
|
|
12380
|
+
* List all grants for all the customers and entitlements. This endpoint is intended for administrative purposes only.
|
|
12381
|
+
To fetch the grants of a specific entitlement please use the /api/v2/customers/{customerIdOrKey}/entitlements/{entitlementIdOrFeatureKey}/grants endpoint.
|
|
12382
|
+
If page is provided that takes precedence and the paginated response is returned.
|
|
12383
|
+
* @summary List grants
|
|
12384
|
+
*/
|
|
12385
|
+
export const listGrantsV2QueryIncludeDeletedDefault = false;
|
|
12386
|
+
export const listGrantsV2QueryPageDefault = 1;
|
|
12387
|
+
export const listGrantsV2QueryPageSizeDefault = 100;
|
|
12388
|
+
export const listGrantsV2QueryPageSizeMax = 1000;
|
|
12389
|
+
export const listGrantsV2QueryOffsetDefault = 0;
|
|
12390
|
+
export const listGrantsV2QueryOffsetMin = 0;
|
|
12391
|
+
export const listGrantsV2QueryLimitDefault = 100;
|
|
12392
|
+
export const listGrantsV2QueryLimitMax = 1000;
|
|
12393
|
+
export const listGrantsV2QueryParams = zod.object({
|
|
12394
|
+
customer: zod
|
|
12395
|
+
.array(zod
|
|
12396
|
+
.union([
|
|
12397
|
+
zod.coerce
|
|
12398
|
+
.string()
|
|
12399
|
+
.regex(listGrantsV2QueryCustomerItemRegExpOne)
|
|
12400
|
+
.describe('ULID (Universally Unique Lexicographically Sortable Identifier).'),
|
|
12401
|
+
zod.coerce
|
|
12402
|
+
.string()
|
|
12403
|
+
.min(1)
|
|
12404
|
+
.max(listGrantsV2QueryCustomerItemMaxTwo)
|
|
12405
|
+
.describe('ExternalKey is a looser version of key.'),
|
|
12406
|
+
])
|
|
12407
|
+
.describe('ULID (Universally Unique Lexicographically Sortable Identifier) or external unique key.'))
|
|
12408
|
+
.optional()
|
|
12409
|
+
.describe('Filtering by multiple customers (either by ID or key).\n\nUsage: `?customer=customer-1&customer=customer-2`'),
|
|
12410
|
+
feature: zod
|
|
12411
|
+
.array(zod.coerce.string())
|
|
12412
|
+
.optional()
|
|
12413
|
+
.describe('Filtering by multiple features.\n\nUsage: `?feature=feature-1&feature=feature-2`'),
|
|
12414
|
+
includeDeleted: zod.coerce.boolean().optional().describe('Include deleted'),
|
|
12415
|
+
limit: zod.coerce
|
|
12416
|
+
.number()
|
|
12417
|
+
.min(1)
|
|
12418
|
+
.max(listGrantsV2QueryLimitMax)
|
|
12419
|
+
.default(listGrantsV2QueryLimitDefault)
|
|
12420
|
+
.describe('Number of items to return.\n\nDefault is 100.'),
|
|
12421
|
+
offset: zod.coerce
|
|
12422
|
+
.number()
|
|
12423
|
+
.min(listGrantsV2QueryOffsetMin)
|
|
12424
|
+
.optional()
|
|
12425
|
+
.describe('Number of items to skip.\n\nDefault is 0.'),
|
|
12426
|
+
order: zod.enum(['ASC', 'DESC']).optional().describe('The order direction.'),
|
|
12427
|
+
orderBy: zod
|
|
12428
|
+
.enum(['id', 'createdAt', 'updatedAt'])
|
|
12429
|
+
.optional()
|
|
12430
|
+
.describe('The order by field.'),
|
|
12431
|
+
page: zod.coerce
|
|
12432
|
+
.number()
|
|
12433
|
+
.min(1)
|
|
12434
|
+
.default(listGrantsV2QueryPageDefault)
|
|
12435
|
+
.describe('Page index.\n\nDefault is 1.'),
|
|
12436
|
+
pageSize: zod.coerce
|
|
12437
|
+
.number()
|
|
12438
|
+
.min(1)
|
|
12439
|
+
.max(listGrantsV2QueryPageSizeMax)
|
|
12440
|
+
.default(listGrantsV2QueryPageSizeDefault)
|
|
12441
|
+
.describe('The maximum number of items per page.\n\nDefault is 100.'),
|
|
12442
|
+
});
|
|
12158
12443
|
//# sourceMappingURL=index.js.map
|