Skip to content

Commit d682fe2

Browse files
authored
chore(api): deprecate subject and legacy entitlement endpoints (#3634)
1 parent 8a1bc3f commit d682fe2

File tree

19 files changed

+3278
-2492
lines changed

19 files changed

+3278
-2492
lines changed

api/api.gen.go

Lines changed: 1250 additions & 1226 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

api/client/go/client.gen.go

Lines changed: 1210 additions & 1186 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

api/client/javascript/src/client/schemas.ts

Lines changed: 115 additions & 15 deletions
Large diffs are not rendered by default.

api/client/javascript/src/zod/index.ts

Lines changed: 63 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2289,6 +2289,8 @@ export const uninstallAppParams = zod.object({
22892289

22902290
/**
22912291
* Update the Stripe API key.
2292+
2293+
⚠️ __Deprecated__: Use [`PUT /api/v1/apps/{id}`](#tag/apps/put/api/v1/apps/{id}) instead.
22922294
* @deprecated
22932295
* @summary Update Stripe API key
22942296
*/
@@ -7700,6 +7702,9 @@ export const listCustomerSubscriptionsQueryParams = zod.object({
77007702
* List all entitlements for all the subjects and features. This endpoint is intended for administrative purposes only.
77017703
To fetch the entitlements of a specific subject please use the /api/v1/subjects/{subjectKeyOrID}/entitlements endpoint.
77027704
If page is provided that takes precedence and the paginated response is returned.
7705+
7706+
⚠️ __Deprecated__: Use [`GET /api/v2/entitlements`](#tag/entitlements/get/api/v2/entitlements) instead.
7707+
* @deprecated
77037708
* @summary List all entitlements
77047709
*/
77057710
export const listEntitlementsQueryExcludeInactiveDefault = false as const
@@ -7770,8 +7775,11 @@ export const listEntitlementsQueryParams = zod.object({
77707775
})
77717776

77727777
/**
7773-
* Get entitlement by id.
7774-
* @summary Get entitlement by id
7778+
* Get entitlement by ID.
7779+
7780+
⚠️ __Deprecated__: Use [`GET /api/v2/entitlements/{entitlementId}`](#tag/entitlements/get/api/v2/entitlements/{entitlementId}) instead.
7781+
* @deprecated
7782+
* @summary Get entitlement by ID
77757783
*/
77767784
export const getEntitlementByIdPathEntitlementIdRegExp =
77777785
/^[0-7][0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{25}$/
@@ -8133,7 +8141,7 @@ export const createFeatureBody = zod
81338141
.record(zod.string(), zod.coerce.string())
81348142
.optional()
81358143
.describe(
8136-
'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.',
8144+
'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.\n\n⚠️ __Deprecated__: Use advancedMeterGroupByFilters instead',
81378145
),
81388146
meterSlug: zod.coerce
81398147
.string()
@@ -8173,6 +8181,9 @@ export const deleteFeatureParams = zod.object({
81738181
* List all grants for all the subjects and entitlements. This endpoint is intended for administrative purposes only.
81748182
To fetch the grants of a specific entitlement please use the /api/v1/subjects/{subjectKeyOrID}/entitlements/{entitlementOrFeatureID}/grants endpoint.
81758183
If page is provided that takes precedence and the paginated response is returned.
8184+
8185+
⚠️ __Deprecated__: Use [`GET /api/v2/grants`](#tag/entitlements/get/api/v2/grants) instead.
8186+
* @deprecated
81768187
* @summary List grants
81778188
*/
81788189
export const listGrantsQueryIncludeDeletedDefault = false as const
@@ -8230,6 +8241,9 @@ export const listGrantsQueryParams = zod.object({
82308241
/**
82318242
* 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.
82328243
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.
8244+
8245+
⚠️ __Deprecated__: Use [`DELETE /api/v2/grants/{grantId}`](#tag/entitlements/delete/api/v2/grants/{grantId}) instead.
8246+
* @deprecated
82338247
* @summary Void grant
82348248
*/
82358249
export const voidGrantParams = zod.object({
@@ -8661,7 +8675,7 @@ export const queryMeterQueryParams = zod.object({
86618675
.record(zod.string(), zod.coerce.string())
86628676
.optional()
86638677
.describe(
8664-
'Simple filter for group bys with exact match.\n\nFor example: ?filterGroupBy[vendor]=openai&filterGroupBy[model]=gpt-4-turbo',
8678+
'Simple filter for group bys with exact match.\n\nFor example: ?filterGroupBy[vendor]=openai&filterGroupBy[model]=gpt-4-turbo\n\n⚠️ __Deprecated__: Use `advancedMeterGroupByFilters` instead',
86658679
),
86668680
from: zod.coerce
86678681
.date()
@@ -12199,7 +12213,7 @@ export const queryPortalMeterQueryParams = zod.object({
1219912213
.record(zod.string(), zod.coerce.string())
1220012214
.optional()
1220112215
.describe(
12202-
'Simple filter for group bys with exact match.\n\nFor example: ?filterGroupBy[vendor]=openai&filterGroupBy[model]=gpt-4-turbo',
12216+
'Simple filter for group bys with exact match.\n\nFor example: ?filterGroupBy[vendor]=openai&filterGroupBy[model]=gpt-4-turbo\n\n⚠️ __Deprecated__: Use `advancedMeterGroupByFilters` instead',
1220312217
),
1220412218
from: zod.coerce
1220512219
.date()
@@ -12726,6 +12740,9 @@ export const createStripeCheckoutSessionBody = zod
1272612740

1272712741
If the subject doesn't exist, it will be created.
1272812742
If the subject exists, it will be partially updated with the provided fields.
12743+
12744+
⚠️ __Deprecated__: Subjects as managable entities are being depracated, use customers with subject key usage attribution instead.
12745+
* @deprecated
1272912746
* @summary Upsert subject
1273012747
*/
1273112748
export const upsertSubjectBodyItem = zod
@@ -12756,11 +12773,16 @@ export const upsertSubjectBodyItem = zod
1275612773
.nullish()
1275712774
.describe('The Stripe customer ID for the subject.'),
1275812775
})
12759-
.describe('A subject is a unique identifier for a user or entity.')
12776+
.describe(
12777+
'A subject is a unique identifier for a user or entity.\n\n⚠️ __Deprecated__: Subjects as managable entities are being depracated, use customers with subject key usage attribution instead.',
12778+
)
1276012779
export const upsertSubjectBody = zod.array(upsertSubjectBodyItem)
1276112780

1276212781
/**
1276312782
* Get subject by ID or key.
12783+
12784+
⚠️ __Deprecated__: Subjects as managable entities are being depracated, use customers with subject key usage attribution instead.
12785+
* @deprecated
1276412786
* @summary Get subject
1276512787
*/
1276612788
export const getSubjectParams = zod.object({
@@ -12769,6 +12791,9 @@ export const getSubjectParams = zod.object({
1276912791

1277012792
/**
1277112793
* Delete subject by ID or key.
12794+
12795+
⚠️ __Deprecated__: Subjects as managable entities are being depracated, use customers with subject key usage attribution instead.
12796+
* @deprecated
1277212797
* @summary Delete subject
1277312798
*/
1277412799
export const deleteSubjectParams = zod.object({
@@ -12785,6 +12810,9 @@ export const deleteSubjectParams = zod.object({
1278512810
A given subject 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.
1278612811

1278712812
Once an entitlement is created you cannot modify it, only delete it.
12813+
12814+
⚠️ __Deprecated__: Use [`POST /api/v2/customers/{customerIdOrKey}/entitlements`](#tag/entitlements/post/api/v2/customers/{customerIdOrKey}/entitlements) instead.
12815+
* @deprecated
1278812816
* @summary Create a subject entitlement
1278912817
*/
1279012818
export const createEntitlementParams = zod.object({
@@ -13033,6 +13061,9 @@ export const createEntitlementBody = zod
1303313061

1303413062
/**
1303513063
* List all entitlements for a subject. For checking entitlement access, use the /value endpoint instead.
13064+
13065+
⚠️ __Deprecated__: Use [`GET /api/v2/customers/{customerIdOrKey}/entitlements`](#tag/entitlements/get/api/v2/customers/{customerIdOrKey}/entitlements) instead.
13066+
* @deprecated
1303613067
* @summary List subject entitlements
1303713068
*/
1303813069
export const listSubjectEntitlementsParams = zod.object({
@@ -13047,6 +13078,9 @@ export const listSubjectEntitlementsQueryParams = zod.object({
1304713078

1304813079
/**
1304913080
* List all grants issued for an entitlement. The entitlement can be defined either by its id or featureKey.
13081+
13082+
⚠️ __Deprecated__: Use [`GET /api/v2/customers/{customerIdOrKey}/entitlements/{entitlementIdOrFeatureKey}/grants`](#tag/entitlements/get/api/v2/customers/{customerIdOrKey}/entitlements/{entitlementIdOrFeatureKey}/grants) instead.
13083+
* @deprecated
1305013084
* @summary List subject entitlement grants
1305113085
*/
1305213086
export const listEntitlementGrantsParams = zod.object({
@@ -13073,6 +13107,9 @@ Grants can have a recurrence setting intended to automate the manual reissuing o
1307313107
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))
1307413108

1307513109
Grants cannot be changed once created, only deleted. This is to ensure that balance is deterministic regardless of when it is queried.
13110+
13111+
⚠️ __Deprecated__: Use [`POST /api/v2/customers/{customerIdOrKey}/entitlements/{entitlementIdOrFeatureKey}/grants`](#tag/entitlements/post/api/v2/customers/{customerIdOrKey}/entitlements/{entitlementIdOrFeatureKey}/grants) instead.
13112+
* @deprecated
1307613113
* @summary Create subject entitlement grant
1307713114
*/
1307813115
export const createGrantParams = zod.object({
@@ -13170,6 +13207,9 @@ export const createGrantBody = zod
1317013207
* Overriding an entitlement creates a new entitlement from the provided inputs and soft deletes the previous entitlement for the provided subject-feature pair. If the previous entitlement is already deleted or otherwise doesnt exist, the override will fail.
1317113208

1317213209
This endpoint is useful for upgrades, downgrades, or other changes to entitlements that require a new entitlement to be created with zero downtime.
13210+
13211+
⚠️ __Deprecated__: Use [`PUT /api/v2/customers/{customerIdOrKey}/entitlements/{entitlementIdOrFeatureKey}/override`](#tag/entitlements/put/api/v2/customers/{customerIdOrKey}/entitlements/{entitlementIdOrFeatureKey}/override) instead.
13212+
* @deprecated
1317313213
* @summary Override subject entitlement
1317413214
*/
1317513215
export const overrideEntitlementParams = zod.object({
@@ -13424,6 +13464,9 @@ export const overrideEntitlementBody = zod
1342413464
* This endpoint should be used for access checks and enforcement. All entitlement types share the hasAccess property in their value response, but multiple other properties are returned based on the entitlement type.
1342513465

1342613466
For convenience reasons, /value works with both entitlementId and featureKey.
13467+
13468+
⚠️ __Deprecated__: Use [`GET /api/v2/customers/{customerIdOrKey}/entitlements/{entitlementIdOrFeatureKey}/value`](#tag/entitlements/get/api/v2/customers/{customerIdOrKey}/entitlements/{entitlementIdOrFeatureKey}/value) instead.
13469+
* @deprecated
1342713470
* @summary Get subject entitlement value
1342813471
*/
1342913472
export const getEntitlementValueParams = zod.object({
@@ -13437,6 +13480,9 @@ export const getEntitlementValueQueryParams = zod.object({
1343713480

1343813481
/**
1343913482
* Get entitlement by id. For checking entitlement access, use the /value endpoint instead.
13483+
13484+
⚠️ __Deprecated__: Use [`GET /api/v2/customers/{customerIdOrKey}/entitlements/{entitlementIdOrFeatureKey}`](#tag/entitlements/get/api/v2/customers/{customerIdOrKey}/entitlements/{entitlementIdOrFeatureKey}) instead.
13485+
* @deprecated
1344013486
* @summary Get subject entitlement
1344113487
*/
1344213488
export const getEntitlementParams = zod.object({
@@ -13447,6 +13493,9 @@ export const getEntitlementParams = zod.object({
1344713493
/**
1344813494
* Deleting an entitlement revokes access to the associated feature. As a single subject can only have one entitlement per featureKey, when "migrating" features you have to delete the old entitlements as well.
1344913495
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.
13496+
13497+
⚠️ __Deprecated__: Use [`DELETE /api/v2/customers/{customerIdOrKey}/entitlements/{entitlementIdOrFeatureKey}`](#tag/entitlements/delete/api/v2/customers/{customerIdOrKey}/entitlements/{entitlementIdOrFeatureKey}) instead.
13498+
* @deprecated
1345013499
* @summary Delete subject entitlement
1345113500
*/
1345213501
export const deleteEntitlementParams = zod.object({
@@ -13460,6 +13509,9 @@ export const deleteEntitlementParams = zod.object({
1346013509
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.
1346113510

1346213511
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.
13512+
13513+
⚠️ __Deprecated__: Use [`GET /api/v2/customers/{customerIdOrKey}/entitlements/{entitlementIdOrFeatureKey}/history`](#tag/entitlements/get/api/v2/customers/{customerIdOrKey}/entitlements/{entitlementIdOrFeatureKey}/history) instead.
13514+
* @deprecated
1346313515
* @summary Get subject entitlement history
1346413516
*/
1346513517
export const getEntitlementHistoryParams = zod.object({
@@ -13495,6 +13547,9 @@ export const getEntitlementHistoryQueryParams = zod.object({
1349513547
* 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 subjects billing period to enforce usage based on their subscription.
1349613548

1349713549
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.
13550+
13551+
⚠️ __Deprecated__: Use [`POST /api/v2/customers/{customerIdOrKey}/entitlements/{entitlementIdOrFeatureKey}/reset`](#tag/entitlements/post/api/v2/customers/{customerIdOrKey}/entitlements/{entitlementIdOrFeatureKey}/reset) instead.
13552+
* @deprecated
1349813553
* @summary Reset subject entitlement
1349913554
*/
1350013555
export const resetEntitlementUsageParams = zod.object({
@@ -18819,8 +18874,8 @@ export const listEntitlementsV2QueryParams = zod.object({
1881918874
})
1882018875

1882118876
/**
18822-
* Get entitlement by id.
18823-
* @summary Get entitlement by id
18877+
* Get entitlement by ID.
18878+
* @summary Get entitlement by ID
1882418879
*/
1882518880
export const getEntitlementByIdV2PathEntitlementIdRegExp =
1882618881
/^[0-7][0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{25}$/

0 commit comments

Comments
 (0)