@openmeter/sdk 1.0.0-beta.216 → 1.0.0-beta.218
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/billing.d.cts +9 -9
- package/dist/cjs/src/client/customers.cjs +74 -7
- package/dist/cjs/src/client/customers.d.cts +59 -6
- package/dist/cjs/src/client/customers.js.map +1 -1
- package/dist/cjs/src/client/schemas.d.cts +1538 -40
- package/dist/cjs/src/zod/index.cjs +792 -15
- package/dist/cjs/src/zod/index.d.cts +646 -4
- package/dist/cjs/src/zod/index.js.map +1 -1
- package/dist/cjs/{tsconfig.73276a9a.tsbuildinfo → tsconfig.21480b11.tsbuildinfo} +1 -1
- package/dist/cjs/{tsconfig.77ed3edb.tsbuildinfo → tsconfig.a01f809d.tsbuildinfo} +1 -1
- package/dist/src/client/billing.d.ts +9 -9
- package/dist/src/client/customers.d.ts +59 -6
- package/dist/src/client/customers.js +71 -5
- package/dist/src/client/customers.js.map +1 -1
- package/dist/src/client/schemas.d.ts +1538 -40
- package/dist/src/zod/index.d.ts +646 -4
- package/dist/src/zod/index.js +776 -1
- 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
|
@@ -4982,6 +4982,681 @@ export const deleteCustomerAppDataParams = zod.object({
|
|
|
4982
4982
|
.max(deleteCustomerAppDataPathCustomerIdOrKeyMaxTwo)
|
|
4983
4983
|
.describe('ExternalKey is a looser version of key.')),
|
|
4984
4984
|
});
|
|
4985
|
+
/**
|
|
4986
|
+
* 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).
|
|
4987
|
+
|
|
4988
|
+
- Boolean entitlements define static feature access, e.g. "Can use SSO authentication".
|
|
4989
|
+
- Static entitlements let you pass along a configuration while granting access, e.g. "Using this feature with X Y settings" (passed in the config).
|
|
4990
|
+
- 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.
|
|
4991
|
+
|
|
4992
|
+
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.
|
|
4993
|
+
|
|
4994
|
+
Once an entitlement is created you cannot modify it, only delete it.
|
|
4995
|
+
* @summary Create a customer entitlement
|
|
4996
|
+
*/
|
|
4997
|
+
export const createCustomerEntitlementPathCustomerIdOrKeyRegExpOne = new RegExp('^[0-7][0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{25}$');
|
|
4998
|
+
export const createCustomerEntitlementPathCustomerIdOrKeyMaxTwo = 256;
|
|
4999
|
+
export const createCustomerEntitlementParams = zod.object({
|
|
5000
|
+
customerIdOrKey: zod.coerce
|
|
5001
|
+
.string()
|
|
5002
|
+
.regex(createCustomerEntitlementPathCustomerIdOrKeyRegExpOne)
|
|
5003
|
+
.describe('ULID (Universally Unique Lexicographically Sortable Identifier).')
|
|
5004
|
+
.or(zod.coerce
|
|
5005
|
+
.string()
|
|
5006
|
+
.min(1)
|
|
5007
|
+
.max(createCustomerEntitlementPathCustomerIdOrKeyMaxTwo)
|
|
5008
|
+
.describe('ExternalKey is a looser version of key.')),
|
|
5009
|
+
});
|
|
5010
|
+
export const createCustomerEntitlementBodyFeatureKeyMax = 64;
|
|
5011
|
+
export const createCustomerEntitlementBodyFeatureKeyRegExp = new RegExp('^[a-z0-9]+(?:_[a-z0-9]+)*$');
|
|
5012
|
+
export const createCustomerEntitlementBodyFeatureIdRegExp = new RegExp('^[0-7][0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{25}$');
|
|
5013
|
+
export const createCustomerEntitlementBodyIsSoftLimitDefault = false;
|
|
5014
|
+
export const createCustomerEntitlementBodyIsUnlimitedDefault = false;
|
|
5015
|
+
export const createCustomerEntitlementBodyIssueAfterResetMin = 0;
|
|
5016
|
+
export const createCustomerEntitlementBodyIssueAfterResetPriorityDefault = 1;
|
|
5017
|
+
export const createCustomerEntitlementBodyIssueAfterResetPriorityMax = 255;
|
|
5018
|
+
export const createCustomerEntitlementBodyPreserveOverageAtResetDefault = false;
|
|
5019
|
+
export const createCustomerEntitlementBodyFeatureKeyMaxOne = 64;
|
|
5020
|
+
export const createCustomerEntitlementBodyFeatureKeyRegExpOne = new RegExp('^[a-z0-9]+(?:_[a-z0-9]+)*$');
|
|
5021
|
+
export const createCustomerEntitlementBodyFeatureIdRegExpOne = new RegExp('^[0-7][0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{25}$');
|
|
5022
|
+
export const createCustomerEntitlementBodyFeatureKeyMaxTwo = 64;
|
|
5023
|
+
export const createCustomerEntitlementBodyFeatureKeyRegExpTwo = new RegExp('^[a-z0-9]+(?:_[a-z0-9]+)*$');
|
|
5024
|
+
export const createCustomerEntitlementBodyFeatureIdRegExpTwo = new RegExp('^[0-7][0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{25}$');
|
|
5025
|
+
export const createCustomerEntitlementBody = zod
|
|
5026
|
+
.discriminatedUnion('type', [
|
|
5027
|
+
zod
|
|
5028
|
+
.object({
|
|
5029
|
+
featureId: zod.coerce
|
|
5030
|
+
.string()
|
|
5031
|
+
.regex(createCustomerEntitlementBodyFeatureIdRegExp)
|
|
5032
|
+
.optional()
|
|
5033
|
+
.describe('The feature the subject is entitled to use.\nEither featureKey or featureId is required.'),
|
|
5034
|
+
featureKey: zod.coerce
|
|
5035
|
+
.string()
|
|
5036
|
+
.min(1)
|
|
5037
|
+
.max(createCustomerEntitlementBodyFeatureKeyMax)
|
|
5038
|
+
.regex(createCustomerEntitlementBodyFeatureKeyRegExp)
|
|
5039
|
+
.optional()
|
|
5040
|
+
.describe('The feature the subject is entitled to use.\nEither featureKey or featureId is required.'),
|
|
5041
|
+
isSoftLimit: zod.coerce
|
|
5042
|
+
.boolean()
|
|
5043
|
+
.optional()
|
|
5044
|
+
.describe('If softLimit=true the subject can use the feature even if the entitlement is exhausted, hasAccess will always be true.'),
|
|
5045
|
+
issueAfterReset: zod.coerce
|
|
5046
|
+
.number()
|
|
5047
|
+
.min(createCustomerEntitlementBodyIssueAfterResetMin)
|
|
5048
|
+
.optional()
|
|
5049
|
+
.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.'),
|
|
5050
|
+
issueAfterResetPriority: zod.coerce
|
|
5051
|
+
.number()
|
|
5052
|
+
.min(1)
|
|
5053
|
+
.max(createCustomerEntitlementBodyIssueAfterResetPriorityMax)
|
|
5054
|
+
.default(createCustomerEntitlementBodyIssueAfterResetPriorityDefault)
|
|
5055
|
+
.describe('Defines the grant priority for the default grant.'),
|
|
5056
|
+
isUnlimited: zod.coerce
|
|
5057
|
+
.boolean()
|
|
5058
|
+
.optional()
|
|
5059
|
+
.describe('Deprecated, ignored by the backend. Please use isSoftLimit instead; this field will be removed in the future.'),
|
|
5060
|
+
measureUsageFrom: zod
|
|
5061
|
+
.enum(['CURRENT_PERIOD_START', 'NOW'])
|
|
5062
|
+
.describe('Start of measurement options')
|
|
5063
|
+
.or(zod.coerce
|
|
5064
|
+
.date()
|
|
5065
|
+
.describe('[RFC3339](https://tools.ietf.org/html/rfc3339) formatted date-time string in UTC.'))
|
|
5066
|
+
.describe('Measure usage from')
|
|
5067
|
+
.optional()
|
|
5068
|
+
.describe('Defines the time from which usage is measured. If not specified on creation, defaults to entitlement creation time.'),
|
|
5069
|
+
metadata: zod
|
|
5070
|
+
.record(zod.string(), zod.coerce.string())
|
|
5071
|
+
.describe('Set of key-value pairs.\nMetadata can be used to store additional information about a resource.')
|
|
5072
|
+
.optional()
|
|
5073
|
+
.describe('Additional metadata for the feature.'),
|
|
5074
|
+
preserveOverageAtReset: zod.coerce
|
|
5075
|
+
.boolean()
|
|
5076
|
+
.optional()
|
|
5077
|
+
.describe('If true, the overage is preserved at reset. If false, the usage is reset to 0.'),
|
|
5078
|
+
type: zod.enum(['metered']),
|
|
5079
|
+
usagePeriod: zod
|
|
5080
|
+
.object({
|
|
5081
|
+
anchor: zod.coerce
|
|
5082
|
+
.date()
|
|
5083
|
+
.optional()
|
|
5084
|
+
.describe('A date-time anchor to base the recurring period on.'),
|
|
5085
|
+
interval: zod.coerce
|
|
5086
|
+
.string()
|
|
5087
|
+
.or(zod
|
|
5088
|
+
.enum(['DAY', 'WEEK', 'MONTH', 'YEAR'])
|
|
5089
|
+
.describe('The unit of time for the interval.\nOne of: `day`, `week`, `month`, or `year`.'))
|
|
5090
|
+
.describe('Period duration for the recurrence')
|
|
5091
|
+
.describe('The unit of time for the interval.'),
|
|
5092
|
+
})
|
|
5093
|
+
.describe('Recurring period with an interval and an anchor.')
|
|
5094
|
+
.describe('The usage period associated with the entitlement.'),
|
|
5095
|
+
})
|
|
5096
|
+
.describe('Create inpurs for metered entitlement'),
|
|
5097
|
+
zod
|
|
5098
|
+
.object({
|
|
5099
|
+
config: zod.coerce
|
|
5100
|
+
.string()
|
|
5101
|
+
.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.'),
|
|
5102
|
+
featureId: zod.coerce
|
|
5103
|
+
.string()
|
|
5104
|
+
.regex(createCustomerEntitlementBodyFeatureIdRegExpOne)
|
|
5105
|
+
.optional()
|
|
5106
|
+
.describe('The feature the subject is entitled to use.\nEither featureKey or featureId is required.'),
|
|
5107
|
+
featureKey: zod.coerce
|
|
5108
|
+
.string()
|
|
5109
|
+
.min(1)
|
|
5110
|
+
.max(createCustomerEntitlementBodyFeatureKeyMaxOne)
|
|
5111
|
+
.regex(createCustomerEntitlementBodyFeatureKeyRegExpOne)
|
|
5112
|
+
.optional()
|
|
5113
|
+
.describe('The feature the subject is entitled to use.\nEither featureKey or featureId is required.'),
|
|
5114
|
+
metadata: zod
|
|
5115
|
+
.record(zod.string(), zod.coerce.string())
|
|
5116
|
+
.describe('Set of key-value pairs.\nMetadata can be used to store additional information about a resource.')
|
|
5117
|
+
.optional()
|
|
5118
|
+
.describe('Additional metadata for the feature.'),
|
|
5119
|
+
type: zod.enum(['static']),
|
|
5120
|
+
usagePeriod: zod
|
|
5121
|
+
.object({
|
|
5122
|
+
anchor: zod.coerce
|
|
5123
|
+
.date()
|
|
5124
|
+
.optional()
|
|
5125
|
+
.describe('A date-time anchor to base the recurring period on.'),
|
|
5126
|
+
interval: zod.coerce
|
|
5127
|
+
.string()
|
|
5128
|
+
.or(zod
|
|
5129
|
+
.enum(['DAY', 'WEEK', 'MONTH', 'YEAR'])
|
|
5130
|
+
.describe('The unit of time for the interval.\nOne of: `day`, `week`, `month`, or `year`.'))
|
|
5131
|
+
.describe('Period duration for the recurrence')
|
|
5132
|
+
.describe('The unit of time for the interval.'),
|
|
5133
|
+
})
|
|
5134
|
+
.describe('Recurring period with an interval and an anchor.')
|
|
5135
|
+
.optional()
|
|
5136
|
+
.describe('The usage period associated with the entitlement.'),
|
|
5137
|
+
})
|
|
5138
|
+
.describe('Create inputs for static entitlement'),
|
|
5139
|
+
zod
|
|
5140
|
+
.object({
|
|
5141
|
+
featureId: zod.coerce
|
|
5142
|
+
.string()
|
|
5143
|
+
.regex(createCustomerEntitlementBodyFeatureIdRegExpTwo)
|
|
5144
|
+
.optional()
|
|
5145
|
+
.describe('The feature the subject is entitled to use.\nEither featureKey or featureId is required.'),
|
|
5146
|
+
featureKey: zod.coerce
|
|
5147
|
+
.string()
|
|
5148
|
+
.min(1)
|
|
5149
|
+
.max(createCustomerEntitlementBodyFeatureKeyMaxTwo)
|
|
5150
|
+
.regex(createCustomerEntitlementBodyFeatureKeyRegExpTwo)
|
|
5151
|
+
.optional()
|
|
5152
|
+
.describe('The feature the subject is entitled to use.\nEither featureKey or featureId is required.'),
|
|
5153
|
+
metadata: zod
|
|
5154
|
+
.record(zod.string(), zod.coerce.string())
|
|
5155
|
+
.describe('Set of key-value pairs.\nMetadata can be used to store additional information about a resource.')
|
|
5156
|
+
.optional()
|
|
5157
|
+
.describe('Additional metadata for the feature.'),
|
|
5158
|
+
type: zod.enum(['boolean']),
|
|
5159
|
+
usagePeriod: zod
|
|
5160
|
+
.object({
|
|
5161
|
+
anchor: zod.coerce
|
|
5162
|
+
.date()
|
|
5163
|
+
.optional()
|
|
5164
|
+
.describe('A date-time anchor to base the recurring period on.'),
|
|
5165
|
+
interval: zod.coerce
|
|
5166
|
+
.string()
|
|
5167
|
+
.or(zod
|
|
5168
|
+
.enum(['DAY', 'WEEK', 'MONTH', 'YEAR'])
|
|
5169
|
+
.describe('The unit of time for the interval.\nOne of: `day`, `week`, `month`, or `year`.'))
|
|
5170
|
+
.describe('Period duration for the recurrence')
|
|
5171
|
+
.describe('The unit of time for the interval.'),
|
|
5172
|
+
})
|
|
5173
|
+
.describe('Recurring period with an interval and an anchor.')
|
|
5174
|
+
.optional()
|
|
5175
|
+
.describe('The usage period associated with the entitlement.'),
|
|
5176
|
+
})
|
|
5177
|
+
.describe('Create inputs for boolean entitlement'),
|
|
5178
|
+
])
|
|
5179
|
+
.describe('Create inputs for entitlement');
|
|
5180
|
+
/**
|
|
5181
|
+
* List all entitlements for a customer. For checking entitlement access, use the /value endpoint instead.
|
|
5182
|
+
* @summary List customer entitlements
|
|
5183
|
+
*/
|
|
5184
|
+
export const listCustomerEntitlementsPathCustomerIdOrKeyRegExpOne = new RegExp('^[0-7][0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{25}$');
|
|
5185
|
+
export const listCustomerEntitlementsPathCustomerIdOrKeyMaxTwo = 256;
|
|
5186
|
+
export const listCustomerEntitlementsParams = zod.object({
|
|
5187
|
+
customerIdOrKey: zod.coerce
|
|
5188
|
+
.string()
|
|
5189
|
+
.regex(listCustomerEntitlementsPathCustomerIdOrKeyRegExpOne)
|
|
5190
|
+
.describe('ULID (Universally Unique Lexicographically Sortable Identifier).')
|
|
5191
|
+
.or(zod.coerce
|
|
5192
|
+
.string()
|
|
5193
|
+
.min(1)
|
|
5194
|
+
.max(listCustomerEntitlementsPathCustomerIdOrKeyMaxTwo)
|
|
5195
|
+
.describe('ExternalKey is a looser version of key.')),
|
|
5196
|
+
});
|
|
5197
|
+
export const listCustomerEntitlementsQueryIncludeDeletedDefault = false;
|
|
5198
|
+
export const listCustomerEntitlementsQueryParams = zod.object({
|
|
5199
|
+
includeDeleted: zod.coerce.boolean().optional(),
|
|
5200
|
+
});
|
|
5201
|
+
/**
|
|
5202
|
+
* Get entitlement by feature key. For checking entitlement access, use the /value endpoint instead.
|
|
5203
|
+
* @summary Get customer entitlement
|
|
5204
|
+
*/
|
|
5205
|
+
export const getCustomerEntitlementPathCustomerIdOrKeyRegExpOne = new RegExp('^[0-7][0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{25}$');
|
|
5206
|
+
export const getCustomerEntitlementPathCustomerIdOrKeyMaxTwo = 256;
|
|
5207
|
+
export const getCustomerEntitlementPathFeatureKeyMax = 64;
|
|
5208
|
+
export const getCustomerEntitlementPathFeatureKeyRegExp = new RegExp('^[a-z0-9]+(?:_[a-z0-9]+)*$');
|
|
5209
|
+
export const getCustomerEntitlementParams = zod.object({
|
|
5210
|
+
customerIdOrKey: zod.coerce
|
|
5211
|
+
.string()
|
|
5212
|
+
.regex(getCustomerEntitlementPathCustomerIdOrKeyRegExpOne)
|
|
5213
|
+
.describe('ULID (Universally Unique Lexicographically Sortable Identifier).')
|
|
5214
|
+
.or(zod.coerce
|
|
5215
|
+
.string()
|
|
5216
|
+
.min(1)
|
|
5217
|
+
.max(getCustomerEntitlementPathCustomerIdOrKeyMaxTwo)
|
|
5218
|
+
.describe('ExternalKey is a looser version of key.')),
|
|
5219
|
+
featureKey: zod.coerce
|
|
5220
|
+
.string()
|
|
5221
|
+
.min(1)
|
|
5222
|
+
.max(getCustomerEntitlementPathFeatureKeyMax)
|
|
5223
|
+
.regex(getCustomerEntitlementPathFeatureKeyRegExp),
|
|
5224
|
+
});
|
|
5225
|
+
/**
|
|
5226
|
+
* 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.
|
|
5227
|
+
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.
|
|
5228
|
+
* @summary Delete customer entitlement
|
|
5229
|
+
*/
|
|
5230
|
+
export const deleteCustomerEntitlementPathCustomerIdOrKeyRegExpOne = new RegExp('^[0-7][0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{25}$');
|
|
5231
|
+
export const deleteCustomerEntitlementPathCustomerIdOrKeyMaxTwo = 256;
|
|
5232
|
+
export const deleteCustomerEntitlementPathFeatureKeyMax = 64;
|
|
5233
|
+
export const deleteCustomerEntitlementPathFeatureKeyRegExp = new RegExp('^[a-z0-9]+(?:_[a-z0-9]+)*$');
|
|
5234
|
+
export const deleteCustomerEntitlementParams = zod.object({
|
|
5235
|
+
customerIdOrKey: zod.coerce
|
|
5236
|
+
.string()
|
|
5237
|
+
.regex(deleteCustomerEntitlementPathCustomerIdOrKeyRegExpOne)
|
|
5238
|
+
.describe('ULID (Universally Unique Lexicographically Sortable Identifier).')
|
|
5239
|
+
.or(zod.coerce
|
|
5240
|
+
.string()
|
|
5241
|
+
.min(1)
|
|
5242
|
+
.max(deleteCustomerEntitlementPathCustomerIdOrKeyMaxTwo)
|
|
5243
|
+
.describe('ExternalKey is a looser version of key.')),
|
|
5244
|
+
featureKey: zod.coerce
|
|
5245
|
+
.string()
|
|
5246
|
+
.min(1)
|
|
5247
|
+
.max(deleteCustomerEntitlementPathFeatureKeyMax)
|
|
5248
|
+
.regex(deleteCustomerEntitlementPathFeatureKeyRegExp),
|
|
5249
|
+
});
|
|
5250
|
+
/**
|
|
5251
|
+
* List all grants issued for an entitlement. The entitlement can be defined either by its id or featureKey.
|
|
5252
|
+
* @summary List customer entitlement grants
|
|
5253
|
+
*/
|
|
5254
|
+
export const listCustomerEntitlementGrantsPathCustomerIdOrKeyRegExpOne = new RegExp('^[0-7][0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{25}$');
|
|
5255
|
+
export const listCustomerEntitlementGrantsPathCustomerIdOrKeyMaxTwo = 256;
|
|
5256
|
+
export const listCustomerEntitlementGrantsPathFeatureKeyMax = 64;
|
|
5257
|
+
export const listCustomerEntitlementGrantsPathFeatureKeyRegExp = new RegExp('^[a-z0-9]+(?:_[a-z0-9]+)*$');
|
|
5258
|
+
export const listCustomerEntitlementGrantsParams = zod.object({
|
|
5259
|
+
customerIdOrKey: zod.coerce
|
|
5260
|
+
.string()
|
|
5261
|
+
.regex(listCustomerEntitlementGrantsPathCustomerIdOrKeyRegExpOne)
|
|
5262
|
+
.describe('ULID (Universally Unique Lexicographically Sortable Identifier).')
|
|
5263
|
+
.or(zod.coerce
|
|
5264
|
+
.string()
|
|
5265
|
+
.min(1)
|
|
5266
|
+
.max(listCustomerEntitlementGrantsPathCustomerIdOrKeyMaxTwo)
|
|
5267
|
+
.describe('ExternalKey is a looser version of key.')),
|
|
5268
|
+
featureKey: zod.coerce
|
|
5269
|
+
.string()
|
|
5270
|
+
.min(1)
|
|
5271
|
+
.max(listCustomerEntitlementGrantsPathFeatureKeyMax)
|
|
5272
|
+
.regex(listCustomerEntitlementGrantsPathFeatureKeyRegExp),
|
|
5273
|
+
});
|
|
5274
|
+
export const listCustomerEntitlementGrantsQueryIncludeDeletedDefault = false;
|
|
5275
|
+
export const listCustomerEntitlementGrantsQueryParams = zod.object({
|
|
5276
|
+
includeDeleted: zod.coerce.boolean().optional(),
|
|
5277
|
+
orderBy: zod.enum(['id', 'createdAt', 'updatedAt']).optional(),
|
|
5278
|
+
});
|
|
5279
|
+
/**
|
|
5280
|
+
* 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.
|
|
5281
|
+
|
|
5282
|
+
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.
|
|
5283
|
+
|
|
5284
|
+
Grants have a priority setting that determines their order of use. Lower numbers have higher priority, with 0 being the highest priority.
|
|
5285
|
+
|
|
5286
|
+
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).
|
|
5287
|
+
|
|
5288
|
+
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))
|
|
5289
|
+
|
|
5290
|
+
Grants cannot be changed once created, only deleted. This is to ensure that balance is deterministic regardless of when it is queried.
|
|
5291
|
+
* @summary Create customer entitlement grant
|
|
5292
|
+
*/
|
|
5293
|
+
export const createCustomerEntitlementGrantPathCustomerIdOrKeyRegExpOne = new RegExp('^[0-7][0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{25}$');
|
|
5294
|
+
export const createCustomerEntitlementGrantPathCustomerIdOrKeyMaxTwo = 256;
|
|
5295
|
+
export const createCustomerEntitlementGrantPathFeatureKeyMax = 64;
|
|
5296
|
+
export const createCustomerEntitlementGrantPathFeatureKeyRegExp = new RegExp('^[a-z0-9]+(?:_[a-z0-9]+)*$');
|
|
5297
|
+
export const createCustomerEntitlementGrantParams = zod.object({
|
|
5298
|
+
customerIdOrKey: zod.coerce
|
|
5299
|
+
.string()
|
|
5300
|
+
.regex(createCustomerEntitlementGrantPathCustomerIdOrKeyRegExpOne)
|
|
5301
|
+
.describe('ULID (Universally Unique Lexicographically Sortable Identifier).')
|
|
5302
|
+
.or(zod.coerce
|
|
5303
|
+
.string()
|
|
5304
|
+
.min(1)
|
|
5305
|
+
.max(createCustomerEntitlementGrantPathCustomerIdOrKeyMaxTwo)
|
|
5306
|
+
.describe('ExternalKey is a looser version of key.')),
|
|
5307
|
+
featureKey: zod.coerce
|
|
5308
|
+
.string()
|
|
5309
|
+
.min(1)
|
|
5310
|
+
.max(createCustomerEntitlementGrantPathFeatureKeyMax)
|
|
5311
|
+
.regex(createCustomerEntitlementGrantPathFeatureKeyRegExp),
|
|
5312
|
+
});
|
|
5313
|
+
export const createCustomerEntitlementGrantBodyAmountMin = 0;
|
|
5314
|
+
export const createCustomerEntitlementGrantBodyPriorityMax = 255;
|
|
5315
|
+
export const createCustomerEntitlementGrantBodyMaxRolloverAmountDefault = 0;
|
|
5316
|
+
export const createCustomerEntitlementGrantBodyMinRolloverAmountDefault = 0;
|
|
5317
|
+
export const createCustomerEntitlementGrantBody = zod
|
|
5318
|
+
.object({
|
|
5319
|
+
amount: zod.coerce
|
|
5320
|
+
.number()
|
|
5321
|
+
.min(createCustomerEntitlementGrantBodyAmountMin)
|
|
5322
|
+
.describe('The amount to grant. Should be a positive number.'),
|
|
5323
|
+
effectiveAt: zod.coerce
|
|
5324
|
+
.date()
|
|
5325
|
+
.describe('Effective date for grants and anchor for recurring grants. Provided value will be ceiled to metering windowSize (minute).'),
|
|
5326
|
+
expiration: zod
|
|
5327
|
+
.object({
|
|
5328
|
+
count: zod.coerce
|
|
5329
|
+
.number()
|
|
5330
|
+
.describe('The number of time units in the expiration period.'),
|
|
5331
|
+
duration: zod
|
|
5332
|
+
.enum(['HOUR', 'DAY', 'WEEK', 'MONTH', 'YEAR'])
|
|
5333
|
+
.describe('The expiration duration enum')
|
|
5334
|
+
.describe('The unit of time for the expiration period.'),
|
|
5335
|
+
})
|
|
5336
|
+
.describe('The grant expiration definition')
|
|
5337
|
+
.describe('The grant expiration definition'),
|
|
5338
|
+
maxRolloverAmount: zod.coerce
|
|
5339
|
+
.number()
|
|
5340
|
+
.optional()
|
|
5341
|
+
.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))'),
|
|
5342
|
+
metadata: zod
|
|
5343
|
+
.record(zod.string(), zod.coerce.string())
|
|
5344
|
+
.describe('Set of key-value pairs.\nMetadata can be used to store additional information about a resource.')
|
|
5345
|
+
.optional()
|
|
5346
|
+
.describe('The grant metadata.'),
|
|
5347
|
+
minRolloverAmount: zod.coerce
|
|
5348
|
+
.number()
|
|
5349
|
+
.optional()
|
|
5350
|
+
.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))'),
|
|
5351
|
+
priority: zod.coerce
|
|
5352
|
+
.number()
|
|
5353
|
+
.min(1)
|
|
5354
|
+
.max(createCustomerEntitlementGrantBodyPriorityMax)
|
|
5355
|
+
.optional()
|
|
5356
|
+
.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.'),
|
|
5357
|
+
recurrence: zod
|
|
5358
|
+
.object({
|
|
5359
|
+
anchor: zod.coerce
|
|
5360
|
+
.date()
|
|
5361
|
+
.optional()
|
|
5362
|
+
.describe('A date-time anchor to base the recurring period on.'),
|
|
5363
|
+
interval: zod.coerce
|
|
5364
|
+
.string()
|
|
5365
|
+
.or(zod
|
|
5366
|
+
.enum(['DAY', 'WEEK', 'MONTH', 'YEAR'])
|
|
5367
|
+
.describe('The unit of time for the interval.\nOne of: `day`, `week`, `month`, or `year`.'))
|
|
5368
|
+
.describe('Period duration for the recurrence')
|
|
5369
|
+
.describe('The unit of time for the interval.'),
|
|
5370
|
+
})
|
|
5371
|
+
.describe('Recurring period with an interval and an anchor.')
|
|
5372
|
+
.optional()
|
|
5373
|
+
.describe('The subject of the grant.'),
|
|
5374
|
+
})
|
|
5375
|
+
.describe('The grant creation input.');
|
|
5376
|
+
/**
|
|
5377
|
+
* Returns historical balance and usage data for the entitlement. The queried history can span accross multiple reset events.
|
|
5378
|
+
|
|
5379
|
+
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.
|
|
5380
|
+
|
|
5381
|
+
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.
|
|
5382
|
+
* @summary Get customer entitlement history
|
|
5383
|
+
*/
|
|
5384
|
+
export const getCustomerEntitlementHistoryPathCustomerIdOrKeyRegExpOne = new RegExp('^[0-7][0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{25}$');
|
|
5385
|
+
export const getCustomerEntitlementHistoryPathCustomerIdOrKeyMaxTwo = 256;
|
|
5386
|
+
export const getCustomerEntitlementHistoryPathFeatureKeyMax = 64;
|
|
5387
|
+
export const getCustomerEntitlementHistoryPathFeatureKeyRegExp = new RegExp('^[a-z0-9]+(?:_[a-z0-9]+)*$');
|
|
5388
|
+
export const getCustomerEntitlementHistoryParams = zod.object({
|
|
5389
|
+
customerIdOrKey: zod.coerce
|
|
5390
|
+
.string()
|
|
5391
|
+
.regex(getCustomerEntitlementHistoryPathCustomerIdOrKeyRegExpOne)
|
|
5392
|
+
.describe('ULID (Universally Unique Lexicographically Sortable Identifier).')
|
|
5393
|
+
.or(zod.coerce
|
|
5394
|
+
.string()
|
|
5395
|
+
.min(1)
|
|
5396
|
+
.max(getCustomerEntitlementHistoryPathCustomerIdOrKeyMaxTwo)
|
|
5397
|
+
.describe('ExternalKey is a looser version of key.')),
|
|
5398
|
+
featureKey: zod.coerce
|
|
5399
|
+
.string()
|
|
5400
|
+
.min(1)
|
|
5401
|
+
.max(getCustomerEntitlementHistoryPathFeatureKeyMax)
|
|
5402
|
+
.regex(getCustomerEntitlementHistoryPathFeatureKeyRegExp),
|
|
5403
|
+
});
|
|
5404
|
+
export const getCustomerEntitlementHistoryQueryWindowTimeZoneDefault = 'UTC';
|
|
5405
|
+
export const getCustomerEntitlementHistoryQueryParams = zod.object({
|
|
5406
|
+
from: zod.coerce
|
|
5407
|
+
.date()
|
|
5408
|
+
.optional()
|
|
5409
|
+
.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.'),
|
|
5410
|
+
to: zod.coerce
|
|
5411
|
+
.date()
|
|
5412
|
+
.optional()
|
|
5413
|
+
.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.'),
|
|
5414
|
+
windowSize: zod
|
|
5415
|
+
.enum(['MINUTE', 'HOUR', 'DAY', 'MONTH'])
|
|
5416
|
+
.describe('Windowsize'),
|
|
5417
|
+
windowTimeZone: zod.coerce
|
|
5418
|
+
.string()
|
|
5419
|
+
.default(getCustomerEntitlementHistoryQueryWindowTimeZoneDefault)
|
|
5420
|
+
.describe('The timezone used when calculating the windows.'),
|
|
5421
|
+
});
|
|
5422
|
+
/**
|
|
5423
|
+
* 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.
|
|
5424
|
+
|
|
5425
|
+
This endpoint is useful for upgrades, downgrades, or other changes to entitlements that require a new entitlement to be created with zero downtime.
|
|
5426
|
+
* @summary Override customer entitlement
|
|
5427
|
+
*/
|
|
5428
|
+
export const overrideCustomerEntitlementPathCustomerIdOrKeyRegExpOne = new RegExp('^[0-7][0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{25}$');
|
|
5429
|
+
export const overrideCustomerEntitlementPathCustomerIdOrKeyMaxTwo = 256;
|
|
5430
|
+
export const overrideCustomerEntitlementPathFeatureKeyMax = 64;
|
|
5431
|
+
export const overrideCustomerEntitlementPathFeatureKeyRegExp = new RegExp('^[a-z0-9]+(?:_[a-z0-9]+)*$');
|
|
5432
|
+
export const overrideCustomerEntitlementParams = zod.object({
|
|
5433
|
+
customerIdOrKey: zod.coerce
|
|
5434
|
+
.string()
|
|
5435
|
+
.regex(overrideCustomerEntitlementPathCustomerIdOrKeyRegExpOne)
|
|
5436
|
+
.describe('ULID (Universally Unique Lexicographically Sortable Identifier).')
|
|
5437
|
+
.or(zod.coerce
|
|
5438
|
+
.string()
|
|
5439
|
+
.min(1)
|
|
5440
|
+
.max(overrideCustomerEntitlementPathCustomerIdOrKeyMaxTwo)
|
|
5441
|
+
.describe('ExternalKey is a looser version of key.')),
|
|
5442
|
+
featureKey: zod.coerce
|
|
5443
|
+
.string()
|
|
5444
|
+
.min(1)
|
|
5445
|
+
.max(overrideCustomerEntitlementPathFeatureKeyMax)
|
|
5446
|
+
.regex(overrideCustomerEntitlementPathFeatureKeyRegExp),
|
|
5447
|
+
});
|
|
5448
|
+
export const overrideCustomerEntitlementBodyFeatureKeyMax = 64;
|
|
5449
|
+
export const overrideCustomerEntitlementBodyFeatureKeyRegExp = new RegExp('^[a-z0-9]+(?:_[a-z0-9]+)*$');
|
|
5450
|
+
export const overrideCustomerEntitlementBodyFeatureIdRegExp = new RegExp('^[0-7][0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{25}$');
|
|
5451
|
+
export const overrideCustomerEntitlementBodyIsSoftLimitDefault = false;
|
|
5452
|
+
export const overrideCustomerEntitlementBodyIsUnlimitedDefault = false;
|
|
5453
|
+
export const overrideCustomerEntitlementBodyIssueAfterResetMin = 0;
|
|
5454
|
+
export const overrideCustomerEntitlementBodyIssueAfterResetPriorityDefault = 1;
|
|
5455
|
+
export const overrideCustomerEntitlementBodyIssueAfterResetPriorityMax = 255;
|
|
5456
|
+
export const overrideCustomerEntitlementBodyPreserveOverageAtResetDefault = false;
|
|
5457
|
+
export const overrideCustomerEntitlementBodyFeatureKeyMaxOne = 64;
|
|
5458
|
+
export const overrideCustomerEntitlementBodyFeatureKeyRegExpOne = new RegExp('^[a-z0-9]+(?:_[a-z0-9]+)*$');
|
|
5459
|
+
export const overrideCustomerEntitlementBodyFeatureIdRegExpOne = new RegExp('^[0-7][0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{25}$');
|
|
5460
|
+
export const overrideCustomerEntitlementBodyFeatureKeyMaxTwo = 64;
|
|
5461
|
+
export const overrideCustomerEntitlementBodyFeatureKeyRegExpTwo = new RegExp('^[a-z0-9]+(?:_[a-z0-9]+)*$');
|
|
5462
|
+
export const overrideCustomerEntitlementBodyFeatureIdRegExpTwo = new RegExp('^[0-7][0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{25}$');
|
|
5463
|
+
export const overrideCustomerEntitlementBody = zod
|
|
5464
|
+
.discriminatedUnion('type', [
|
|
5465
|
+
zod
|
|
5466
|
+
.object({
|
|
5467
|
+
featureId: zod.coerce
|
|
5468
|
+
.string()
|
|
5469
|
+
.regex(overrideCustomerEntitlementBodyFeatureIdRegExp)
|
|
5470
|
+
.optional()
|
|
5471
|
+
.describe('The feature the subject is entitled to use.\nEither featureKey or featureId is required.'),
|
|
5472
|
+
featureKey: zod.coerce
|
|
5473
|
+
.string()
|
|
5474
|
+
.min(1)
|
|
5475
|
+
.max(overrideCustomerEntitlementBodyFeatureKeyMax)
|
|
5476
|
+
.regex(overrideCustomerEntitlementBodyFeatureKeyRegExp)
|
|
5477
|
+
.optional()
|
|
5478
|
+
.describe('The feature the subject is entitled to use.\nEither featureKey or featureId is required.'),
|
|
5479
|
+
isSoftLimit: zod.coerce
|
|
5480
|
+
.boolean()
|
|
5481
|
+
.optional()
|
|
5482
|
+
.describe('If softLimit=true the subject can use the feature even if the entitlement is exhausted, hasAccess will always be true.'),
|
|
5483
|
+
issueAfterReset: zod.coerce
|
|
5484
|
+
.number()
|
|
5485
|
+
.min(overrideCustomerEntitlementBodyIssueAfterResetMin)
|
|
5486
|
+
.optional()
|
|
5487
|
+
.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.'),
|
|
5488
|
+
issueAfterResetPriority: zod.coerce
|
|
5489
|
+
.number()
|
|
5490
|
+
.min(1)
|
|
5491
|
+
.max(overrideCustomerEntitlementBodyIssueAfterResetPriorityMax)
|
|
5492
|
+
.default(overrideCustomerEntitlementBodyIssueAfterResetPriorityDefault)
|
|
5493
|
+
.describe('Defines the grant priority for the default grant.'),
|
|
5494
|
+
isUnlimited: zod.coerce
|
|
5495
|
+
.boolean()
|
|
5496
|
+
.optional()
|
|
5497
|
+
.describe('Deprecated, ignored by the backend. Please use isSoftLimit instead; this field will be removed in the future.'),
|
|
5498
|
+
measureUsageFrom: zod
|
|
5499
|
+
.enum(['CURRENT_PERIOD_START', 'NOW'])
|
|
5500
|
+
.describe('Start of measurement options')
|
|
5501
|
+
.or(zod.coerce
|
|
5502
|
+
.date()
|
|
5503
|
+
.describe('[RFC3339](https://tools.ietf.org/html/rfc3339) formatted date-time string in UTC.'))
|
|
5504
|
+
.describe('Measure usage from')
|
|
5505
|
+
.optional()
|
|
5506
|
+
.describe('Defines the time from which usage is measured. If not specified on creation, defaults to entitlement creation time.'),
|
|
5507
|
+
metadata: zod
|
|
5508
|
+
.record(zod.string(), zod.coerce.string())
|
|
5509
|
+
.describe('Set of key-value pairs.\nMetadata can be used to store additional information about a resource.')
|
|
5510
|
+
.optional()
|
|
5511
|
+
.describe('Additional metadata for the feature.'),
|
|
5512
|
+
preserveOverageAtReset: zod.coerce
|
|
5513
|
+
.boolean()
|
|
5514
|
+
.optional()
|
|
5515
|
+
.describe('If true, the overage is preserved at reset. If false, the usage is reset to 0.'),
|
|
5516
|
+
type: zod.enum(['metered']),
|
|
5517
|
+
usagePeriod: zod
|
|
5518
|
+
.object({
|
|
5519
|
+
anchor: zod.coerce
|
|
5520
|
+
.date()
|
|
5521
|
+
.optional()
|
|
5522
|
+
.describe('A date-time anchor to base the recurring period on.'),
|
|
5523
|
+
interval: zod.coerce
|
|
5524
|
+
.string()
|
|
5525
|
+
.or(zod
|
|
5526
|
+
.enum(['DAY', 'WEEK', 'MONTH', 'YEAR'])
|
|
5527
|
+
.describe('The unit of time for the interval.\nOne of: `day`, `week`, `month`, or `year`.'))
|
|
5528
|
+
.describe('Period duration for the recurrence')
|
|
5529
|
+
.describe('The unit of time for the interval.'),
|
|
5530
|
+
})
|
|
5531
|
+
.describe('Recurring period with an interval and an anchor.')
|
|
5532
|
+
.describe('The usage period associated with the entitlement.'),
|
|
5533
|
+
})
|
|
5534
|
+
.describe('Create inpurs for metered entitlement'),
|
|
5535
|
+
zod
|
|
5536
|
+
.object({
|
|
5537
|
+
config: zod.coerce
|
|
5538
|
+
.string()
|
|
5539
|
+
.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.'),
|
|
5540
|
+
featureId: zod.coerce
|
|
5541
|
+
.string()
|
|
5542
|
+
.regex(overrideCustomerEntitlementBodyFeatureIdRegExpOne)
|
|
5543
|
+
.optional()
|
|
5544
|
+
.describe('The feature the subject is entitled to use.\nEither featureKey or featureId is required.'),
|
|
5545
|
+
featureKey: zod.coerce
|
|
5546
|
+
.string()
|
|
5547
|
+
.min(1)
|
|
5548
|
+
.max(overrideCustomerEntitlementBodyFeatureKeyMaxOne)
|
|
5549
|
+
.regex(overrideCustomerEntitlementBodyFeatureKeyRegExpOne)
|
|
5550
|
+
.optional()
|
|
5551
|
+
.describe('The feature the subject is entitled to use.\nEither featureKey or featureId is required.'),
|
|
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
|
+
type: zod.enum(['static']),
|
|
5558
|
+
usagePeriod: zod
|
|
5559
|
+
.object({
|
|
5560
|
+
anchor: zod.coerce
|
|
5561
|
+
.date()
|
|
5562
|
+
.optional()
|
|
5563
|
+
.describe('A date-time anchor to base the recurring period on.'),
|
|
5564
|
+
interval: zod.coerce
|
|
5565
|
+
.string()
|
|
5566
|
+
.or(zod
|
|
5567
|
+
.enum(['DAY', 'WEEK', 'MONTH', 'YEAR'])
|
|
5568
|
+
.describe('The unit of time for the interval.\nOne of: `day`, `week`, `month`, or `year`.'))
|
|
5569
|
+
.describe('Period duration for the recurrence')
|
|
5570
|
+
.describe('The unit of time for the interval.'),
|
|
5571
|
+
})
|
|
5572
|
+
.describe('Recurring period with an interval and an anchor.')
|
|
5573
|
+
.optional()
|
|
5574
|
+
.describe('The usage period associated with the entitlement.'),
|
|
5575
|
+
})
|
|
5576
|
+
.describe('Create inputs for static entitlement'),
|
|
5577
|
+
zod
|
|
5578
|
+
.object({
|
|
5579
|
+
featureId: zod.coerce
|
|
5580
|
+
.string()
|
|
5581
|
+
.regex(overrideCustomerEntitlementBodyFeatureIdRegExpTwo)
|
|
5582
|
+
.optional()
|
|
5583
|
+
.describe('The feature the subject is entitled to use.\nEither featureKey or featureId is required.'),
|
|
5584
|
+
featureKey: zod.coerce
|
|
5585
|
+
.string()
|
|
5586
|
+
.min(1)
|
|
5587
|
+
.max(overrideCustomerEntitlementBodyFeatureKeyMaxTwo)
|
|
5588
|
+
.regex(overrideCustomerEntitlementBodyFeatureKeyRegExpTwo)
|
|
5589
|
+
.optional()
|
|
5590
|
+
.describe('The feature the subject is entitled to use.\nEither featureKey or featureId is required.'),
|
|
5591
|
+
metadata: zod
|
|
5592
|
+
.record(zod.string(), zod.coerce.string())
|
|
5593
|
+
.describe('Set of key-value pairs.\nMetadata can be used to store additional information about a resource.')
|
|
5594
|
+
.optional()
|
|
5595
|
+
.describe('Additional metadata for the feature.'),
|
|
5596
|
+
type: zod.enum(['boolean']),
|
|
5597
|
+
usagePeriod: zod
|
|
5598
|
+
.object({
|
|
5599
|
+
anchor: zod.coerce
|
|
5600
|
+
.date()
|
|
5601
|
+
.optional()
|
|
5602
|
+
.describe('A date-time anchor to base the recurring period on.'),
|
|
5603
|
+
interval: zod.coerce
|
|
5604
|
+
.string()
|
|
5605
|
+
.or(zod
|
|
5606
|
+
.enum(['DAY', 'WEEK', 'MONTH', 'YEAR'])
|
|
5607
|
+
.describe('The unit of time for the interval.\nOne of: `day`, `week`, `month`, or `year`.'))
|
|
5608
|
+
.describe('Period duration for the recurrence')
|
|
5609
|
+
.describe('The unit of time for the interval.'),
|
|
5610
|
+
})
|
|
5611
|
+
.describe('Recurring period with an interval and an anchor.')
|
|
5612
|
+
.optional()
|
|
5613
|
+
.describe('The usage period associated with the entitlement.'),
|
|
5614
|
+
})
|
|
5615
|
+
.describe('Create inputs for boolean entitlement'),
|
|
5616
|
+
])
|
|
5617
|
+
.describe('Create inputs for entitlement');
|
|
5618
|
+
/**
|
|
5619
|
+
* 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.
|
|
5620
|
+
|
|
5621
|
+
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.
|
|
5622
|
+
* @summary Reset customer entitlement
|
|
5623
|
+
*/
|
|
5624
|
+
export const resetCustomerEntitlementUsagePathCustomerIdOrKeyRegExpOne = new RegExp('^[0-7][0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{25}$');
|
|
5625
|
+
export const resetCustomerEntitlementUsagePathCustomerIdOrKeyMaxTwo = 256;
|
|
5626
|
+
export const resetCustomerEntitlementUsagePathFeatureKeyMax = 64;
|
|
5627
|
+
export const resetCustomerEntitlementUsagePathFeatureKeyRegExp = new RegExp('^[a-z0-9]+(?:_[a-z0-9]+)*$');
|
|
5628
|
+
export const resetCustomerEntitlementUsageParams = zod.object({
|
|
5629
|
+
customerIdOrKey: zod.coerce
|
|
5630
|
+
.string()
|
|
5631
|
+
.regex(resetCustomerEntitlementUsagePathCustomerIdOrKeyRegExpOne)
|
|
5632
|
+
.describe('ULID (Universally Unique Lexicographically Sortable Identifier).')
|
|
5633
|
+
.or(zod.coerce
|
|
5634
|
+
.string()
|
|
5635
|
+
.min(1)
|
|
5636
|
+
.max(resetCustomerEntitlementUsagePathCustomerIdOrKeyMaxTwo)
|
|
5637
|
+
.describe('ExternalKey is a looser version of key.')),
|
|
5638
|
+
featureKey: zod.coerce
|
|
5639
|
+
.string()
|
|
5640
|
+
.min(1)
|
|
5641
|
+
.max(resetCustomerEntitlementUsagePathFeatureKeyMax)
|
|
5642
|
+
.regex(resetCustomerEntitlementUsagePathFeatureKeyRegExp),
|
|
5643
|
+
});
|
|
5644
|
+
export const resetCustomerEntitlementUsageBody = zod
|
|
5645
|
+
.object({
|
|
5646
|
+
effectiveAt: zod.coerce
|
|
5647
|
+
.date()
|
|
5648
|
+
.optional()
|
|
5649
|
+
.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.'),
|
|
5650
|
+
preserveOverage: zod.coerce
|
|
5651
|
+
.boolean()
|
|
5652
|
+
.optional()
|
|
5653
|
+
.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."),
|
|
5654
|
+
retainAnchor: zod.coerce
|
|
5655
|
+
.boolean()
|
|
5656
|
+
.optional()
|
|
5657
|
+
.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.'),
|
|
5658
|
+
})
|
|
5659
|
+
.describe('Reset parameters');
|
|
4985
5660
|
/**
|
|
4986
5661
|
* 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.
|
|
4987
5662
|
* @summary Get customer entitlement value
|
|
@@ -5009,6 +5684,88 @@ export const getCustomerEntitlementValueParams = zod.object({
|
|
|
5009
5684
|
export const getCustomerEntitlementValueQueryParams = zod.object({
|
|
5010
5685
|
time: zod.coerce.date().optional(),
|
|
5011
5686
|
});
|
|
5687
|
+
/**
|
|
5688
|
+
* Get stripe app data for a customer.
|
|
5689
|
+
Only returns data if the customer billing profile is linked to a stripe app.
|
|
5690
|
+
* @summary Get customer stripe app data
|
|
5691
|
+
*/
|
|
5692
|
+
export const getCustomerStripeAppDataPathCustomerIdOrKeyRegExpOne = new RegExp('^[0-7][0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{25}$');
|
|
5693
|
+
export const getCustomerStripeAppDataPathCustomerIdOrKeyMaxTwo = 256;
|
|
5694
|
+
export const getCustomerStripeAppDataParams = zod.object({
|
|
5695
|
+
customerIdOrKey: zod.coerce
|
|
5696
|
+
.string()
|
|
5697
|
+
.regex(getCustomerStripeAppDataPathCustomerIdOrKeyRegExpOne)
|
|
5698
|
+
.describe('ULID (Universally Unique Lexicographically Sortable Identifier).')
|
|
5699
|
+
.or(zod.coerce
|
|
5700
|
+
.string()
|
|
5701
|
+
.min(1)
|
|
5702
|
+
.max(getCustomerStripeAppDataPathCustomerIdOrKeyMaxTwo)
|
|
5703
|
+
.describe('ExternalKey is a looser version of key.')),
|
|
5704
|
+
});
|
|
5705
|
+
/**
|
|
5706
|
+
* Upsert stripe app data for a customer.
|
|
5707
|
+
Only updates data if the customer billing profile is linked to a stripe app.
|
|
5708
|
+
* @summary Upsert customer stripe app data
|
|
5709
|
+
*/
|
|
5710
|
+
export const upsertCustomerStripeAppDataPathCustomerIdOrKeyRegExpOne = new RegExp('^[0-7][0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{25}$');
|
|
5711
|
+
export const upsertCustomerStripeAppDataPathCustomerIdOrKeyMaxTwo = 256;
|
|
5712
|
+
export const upsertCustomerStripeAppDataParams = zod.object({
|
|
5713
|
+
customerIdOrKey: zod.coerce
|
|
5714
|
+
.string()
|
|
5715
|
+
.regex(upsertCustomerStripeAppDataPathCustomerIdOrKeyRegExpOne)
|
|
5716
|
+
.describe('ULID (Universally Unique Lexicographically Sortable Identifier).')
|
|
5717
|
+
.or(zod.coerce
|
|
5718
|
+
.string()
|
|
5719
|
+
.min(1)
|
|
5720
|
+
.max(upsertCustomerStripeAppDataPathCustomerIdOrKeyMaxTwo)
|
|
5721
|
+
.describe('ExternalKey is a looser version of key.')),
|
|
5722
|
+
});
|
|
5723
|
+
export const upsertCustomerStripeAppDataBody = zod
|
|
5724
|
+
.object({
|
|
5725
|
+
stripeCustomerId: zod.coerce.string().describe('The Stripe customer ID.'),
|
|
5726
|
+
stripeDefaultPaymentMethodId: zod.coerce
|
|
5727
|
+
.string()
|
|
5728
|
+
.optional()
|
|
5729
|
+
.describe('The Stripe default payment method ID.'),
|
|
5730
|
+
})
|
|
5731
|
+
.describe('Stripe Customer App Data Base.');
|
|
5732
|
+
/**
|
|
5733
|
+
* Create Stripe customer portal session.
|
|
5734
|
+
Only returns URL if the customer billing profile is linked to a stripe app and customer.
|
|
5735
|
+
|
|
5736
|
+
Useful to redirect the customer to the Stripe customer portal to manage their payment methods,
|
|
5737
|
+
change their billing address and access their invoice history.
|
|
5738
|
+
* @summary Create Stripe customer portal session
|
|
5739
|
+
*/
|
|
5740
|
+
export const createCustomerStripePortalSessionPathCustomerIdOrKeyRegExpOne = new RegExp('^[0-7][0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{25}$');
|
|
5741
|
+
export const createCustomerStripePortalSessionPathCustomerIdOrKeyMaxTwo = 256;
|
|
5742
|
+
export const createCustomerStripePortalSessionParams = zod.object({
|
|
5743
|
+
customerIdOrKey: zod.coerce
|
|
5744
|
+
.string()
|
|
5745
|
+
.regex(createCustomerStripePortalSessionPathCustomerIdOrKeyRegExpOne)
|
|
5746
|
+
.describe('ULID (Universally Unique Lexicographically Sortable Identifier).')
|
|
5747
|
+
.or(zod.coerce
|
|
5748
|
+
.string()
|
|
5749
|
+
.min(1)
|
|
5750
|
+
.max(createCustomerStripePortalSessionPathCustomerIdOrKeyMaxTwo)
|
|
5751
|
+
.describe('ExternalKey is a looser version of key.')),
|
|
5752
|
+
});
|
|
5753
|
+
export const createCustomerStripePortalSessionBody = zod
|
|
5754
|
+
.object({
|
|
5755
|
+
configurationId: zod.coerce
|
|
5756
|
+
.string()
|
|
5757
|
+
.optional()
|
|
5758
|
+
.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'),
|
|
5759
|
+
locale: zod.coerce
|
|
5760
|
+
.string()
|
|
5761
|
+
.optional()
|
|
5762
|
+
.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'),
|
|
5763
|
+
returnUrl: zod.coerce
|
|
5764
|
+
.string()
|
|
5765
|
+
.optional()
|
|
5766
|
+
.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'),
|
|
5767
|
+
})
|
|
5768
|
+
.describe('Stripe customer portal request params.');
|
|
5012
5769
|
/**
|
|
5013
5770
|
* Lists all subscriptions for a customer.
|
|
5014
5771
|
* @summary List customer subscriptions
|
|
@@ -5700,6 +6457,7 @@ export const queryMeterParams = zod.object({
|
|
|
5700
6457
|
});
|
|
5701
6458
|
export const queryMeterQueryClientIdMax = 36;
|
|
5702
6459
|
export const queryMeterQueryWindowTimeZoneDefault = 'UTC';
|
|
6460
|
+
export const queryMeterQueryFilterCustomerIdMax = 100;
|
|
5703
6461
|
export const queryMeterQueryParams = zod.object({
|
|
5704
6462
|
clientId: zod.coerce
|
|
5705
6463
|
.string()
|
|
@@ -5707,6 +6465,11 @@ export const queryMeterQueryParams = zod.object({
|
|
|
5707
6465
|
.max(queryMeterQueryClientIdMax)
|
|
5708
6466
|
.optional()
|
|
5709
6467
|
.describe('Client ID\nUseful to track progress of a query.'),
|
|
6468
|
+
filterCustomerId: zod
|
|
6469
|
+
.array(zod.coerce.string())
|
|
6470
|
+
.max(queryMeterQueryFilterCustomerIdMax)
|
|
6471
|
+
.optional()
|
|
6472
|
+
.describe('Filtering by multiple customers.\n\nFor example: ?filterCustomerId=customer-1&filterCustomerId=customer-2'),
|
|
5710
6473
|
filterGroupBy: zod
|
|
5711
6474
|
.record(zod.string(), zod.coerce.string())
|
|
5712
6475
|
.optional()
|
|
@@ -5722,7 +6485,7 @@ export const queryMeterQueryParams = zod.object({
|
|
|
5722
6485
|
subject: zod
|
|
5723
6486
|
.array(zod.coerce.string())
|
|
5724
6487
|
.optional()
|
|
5725
|
-
.describe('Filtering by multiple subjects.\n\nFor example: ?subject=
|
|
6488
|
+
.describe('Filtering by multiple subjects.\n\nFor example: ?subject=subject-1&subject=subject-2'),
|
|
5726
6489
|
to: zod.coerce
|
|
5727
6490
|
.date()
|
|
5728
6491
|
.optional()
|
|
@@ -5751,6 +6514,7 @@ export const queryMeterPostParams = zod.object({
|
|
|
5751
6514
|
export const queryMeterPostBodyClientIdMax = 36;
|
|
5752
6515
|
export const queryMeterPostBodyWindowTimeZoneDefault = 'UTC';
|
|
5753
6516
|
export const queryMeterPostBodySubjectMax = 100;
|
|
6517
|
+
export const queryMeterPostBodyFilterCustomerIdMax = 100;
|
|
5754
6518
|
export const queryMeterPostBodyGroupByMax = 100;
|
|
5755
6519
|
export const queryMeterPostBody = zod
|
|
5756
6520
|
.object({
|
|
@@ -5760,6 +6524,11 @@ export const queryMeterPostBody = zod
|
|
|
5760
6524
|
.max(queryMeterPostBodyClientIdMax)
|
|
5761
6525
|
.optional()
|
|
5762
6526
|
.describe('Client ID\nUseful to track progress of a query.'),
|
|
6527
|
+
filterCustomerId: zod
|
|
6528
|
+
.array(zod.coerce.string())
|
|
6529
|
+
.max(queryMeterPostBodyFilterCustomerIdMax)
|
|
6530
|
+
.optional()
|
|
6531
|
+
.describe('Filtering by multiple customers.'),
|
|
5763
6532
|
filterGroupBy: zod
|
|
5764
6533
|
.record(zod.string(), zod.array(zod.coerce.string()))
|
|
5765
6534
|
.optional()
|
|
@@ -7906,6 +8675,7 @@ export const queryPortalMeterParams = zod.object({
|
|
|
7906
8675
|
});
|
|
7907
8676
|
export const queryPortalMeterQueryClientIdMax = 36;
|
|
7908
8677
|
export const queryPortalMeterQueryWindowTimeZoneDefault = 'UTC';
|
|
8678
|
+
export const queryPortalMeterQueryFilterCustomerIdMax = 100;
|
|
7909
8679
|
export const queryPortalMeterQueryParams = zod.object({
|
|
7910
8680
|
clientId: zod.coerce
|
|
7911
8681
|
.string()
|
|
@@ -7913,6 +8683,11 @@ export const queryPortalMeterQueryParams = zod.object({
|
|
|
7913
8683
|
.max(queryPortalMeterQueryClientIdMax)
|
|
7914
8684
|
.optional()
|
|
7915
8685
|
.describe('Client ID\nUseful to track progress of a query.'),
|
|
8686
|
+
filterCustomerId: zod
|
|
8687
|
+
.array(zod.coerce.string())
|
|
8688
|
+
.max(queryPortalMeterQueryFilterCustomerIdMax)
|
|
8689
|
+
.optional()
|
|
8690
|
+
.describe('Filtering by multiple customers.\n\nFor example: ?filterCustomerId=customer-1&filterCustomerId=customer-2'),
|
|
7916
8691
|
filterGroupBy: zod
|
|
7917
8692
|
.record(zod.string(), zod.coerce.string())
|
|
7918
8693
|
.optional()
|