Skip to content

Commit 724de44

Browse files
authored
feat(api): add root entitlement v2 APIs (#3372)
1 parent cd605a4 commit 724de44

File tree

16 files changed

+2352
-581
lines changed

16 files changed

+2352
-581
lines changed

api/api.gen.go

Lines changed: 515 additions & 301 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: 833 additions & 262 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: 257 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2331,6 +2331,47 @@ export interface paths {
23312331
patch?: never
23322332
trace?: never
23332333
}
2334+
'/api/v2/entitlements': {
2335+
parameters: {
2336+
query?: never
2337+
header?: never
2338+
path?: never
2339+
cookie?: never
2340+
}
2341+
/**
2342+
* List all entitlements
2343+
* @description List all entitlements for all the customers and features. This endpoint is intended for administrative purposes only.
2344+
* To fetch the entitlements of a specific subject please use the /api/v2/customers/{customerIdOrKey}/entitlements endpoint.
2345+
*/
2346+
get: operations['listEntitlementsV2']
2347+
put?: never
2348+
post?: never
2349+
delete?: never
2350+
options?: never
2351+
head?: never
2352+
patch?: never
2353+
trace?: never
2354+
}
2355+
'/api/v2/entitlements/{entitlementId}': {
2356+
parameters: {
2357+
query?: never
2358+
header?: never
2359+
path?: never
2360+
cookie?: never
2361+
}
2362+
/**
2363+
* Get entitlement by id
2364+
* @description Get entitlement by id.
2365+
*/
2366+
get: operations['getEntitlementByIdV2']
2367+
put?: never
2368+
post?: never
2369+
delete?: never
2370+
options?: never
2371+
head?: never
2372+
patch?: never
2373+
trace?: never
2374+
}
23342375
'/api/v2/events': {
23352376
parameters: {
23362377
query?: never
@@ -26015,6 +26056,222 @@ export interface operations {
2601526056
}
2601626057
}
2601726058
}
26059+
listEntitlementsV2: {
26060+
parameters: {
26061+
query?: {
26062+
/** @description Filtering by multiple features.
26063+
*
26064+
* Usage: `?feature=feature-1&feature=feature-2` */
26065+
feature?: string[]
26066+
/** @description Filtering by multiple customers.
26067+
*
26068+
* Usage: `?customerKeys=customer-1&customerKeys=customer-3` */
26069+
customerKeys?: string[]
26070+
/** @description Filtering by multiple customers.
26071+
*
26072+
* Usage: `?customerIds=01K4WAQ0J99ZZ0MD75HXR112H8&customerIds=01K4WAQ0J99ZZ0MD75HXR112H9` */
26073+
customerIds?: string[]
26074+
/** @description Filtering by multiple entitlement types.
26075+
*
26076+
* Usage: `?entitlementType=metered&entitlementType=boolean` */
26077+
entitlementType?: components['schemas']['EntitlementType'][]
26078+
/** @description Exclude inactive entitlements in the response (those scheduled for later or earlier) */
26079+
excludeInactive?: boolean
26080+
/** @description Page index.
26081+
*
26082+
* Default is 1. */
26083+
page?: components['parameters']['Pagination.page']
26084+
/** @description The maximum number of items per page.
26085+
*
26086+
* Default is 100. */
26087+
pageSize?: components['parameters']['Pagination.pageSize']
26088+
/** @description Number of items to skip.
26089+
*
26090+
* Default is 0. */
26091+
offset?: components['parameters']['LimitOffset.offset']
26092+
/** @description Number of items to return.
26093+
*
26094+
* Default is 100. */
26095+
limit?: components['parameters']['LimitOffset.limit']
26096+
/** @description The order direction. */
26097+
order?: components['parameters']['EntitlementOrderByOrdering.order']
26098+
/** @description The order by field. */
26099+
orderBy?: components['parameters']['EntitlementOrderByOrdering.orderBy']
26100+
}
26101+
header?: never
26102+
path?: never
26103+
cookie?: never
26104+
}
26105+
requestBody?: never
26106+
responses: {
26107+
/** @description The request has succeeded. */
26108+
200: {
26109+
headers: {
26110+
[name: string]: unknown
26111+
}
26112+
content: {
26113+
'application/json': components['schemas']['EntitlementV2PaginatedResponse']
26114+
}
26115+
}
26116+
/** @description The server cannot or will not process the request due to something that is perceived to be a client error (e.g., malformed request syntax, invalid request message framing, or deceptive request routing). */
26117+
400: {
26118+
headers: {
26119+
[name: string]: unknown
26120+
}
26121+
content: {
26122+
'application/problem+json': components['schemas']['BadRequestProblemResponse']
26123+
}
26124+
}
26125+
/** @description The request has not been applied because it lacks valid authentication credentials for the target resource. */
26126+
401: {
26127+
headers: {
26128+
[name: string]: unknown
26129+
}
26130+
content: {
26131+
'application/problem+json': components['schemas']['UnauthorizedProblemResponse']
26132+
}
26133+
}
26134+
/** @description The server understood the request but refuses to authorize it. */
26135+
403: {
26136+
headers: {
26137+
[name: string]: unknown
26138+
}
26139+
content: {
26140+
'application/problem+json': components['schemas']['ForbiddenProblemResponse']
26141+
}
26142+
}
26143+
/** @description One or more conditions given in the request header fields evaluated to false when tested on the server. */
26144+
412: {
26145+
headers: {
26146+
[name: string]: unknown
26147+
}
26148+
content: {
26149+
'application/problem+json': components['schemas']['PreconditionFailedProblemResponse']
26150+
}
26151+
}
26152+
/** @description The server encountered an unexpected condition that prevented it from fulfilling the request. */
26153+
500: {
26154+
headers: {
26155+
[name: string]: unknown
26156+
}
26157+
content: {
26158+
'application/problem+json': components['schemas']['InternalServerErrorProblemResponse']
26159+
}
26160+
}
26161+
/** @description The server is currently unable to handle the request due to a temporary overload or scheduled maintenance, which will likely be alleviated after some delay. */
26162+
503: {
26163+
headers: {
26164+
[name: string]: unknown
26165+
}
26166+
content: {
26167+
'application/problem+json': components['schemas']['ServiceUnavailableProblemResponse']
26168+
}
26169+
}
26170+
/** @description An unexpected error response. */
26171+
default: {
26172+
headers: {
26173+
[name: string]: unknown
26174+
}
26175+
content: {
26176+
'application/problem+json': components['schemas']['UnexpectedProblemResponse']
26177+
}
26178+
}
26179+
}
26180+
}
26181+
getEntitlementByIdV2: {
26182+
parameters: {
26183+
query?: never
26184+
header?: never
26185+
path: {
26186+
entitlementId: string
26187+
}
26188+
cookie?: never
26189+
}
26190+
requestBody?: never
26191+
responses: {
26192+
/** @description The request has succeeded. */
26193+
200: {
26194+
headers: {
26195+
[name: string]: unknown
26196+
}
26197+
content: {
26198+
'application/json': components['schemas']['EntitlementV2']
26199+
}
26200+
}
26201+
/** @description The server cannot or will not process the request due to something that is perceived to be a client error (e.g., malformed request syntax, invalid request message framing, or deceptive request routing). */
26202+
400: {
26203+
headers: {
26204+
[name: string]: unknown
26205+
}
26206+
content: {
26207+
'application/problem+json': components['schemas']['BadRequestProblemResponse']
26208+
}
26209+
}
26210+
/** @description The request has not been applied because it lacks valid authentication credentials for the target resource. */
26211+
401: {
26212+
headers: {
26213+
[name: string]: unknown
26214+
}
26215+
content: {
26216+
'application/problem+json': components['schemas']['UnauthorizedProblemResponse']
26217+
}
26218+
}
26219+
/** @description The server understood the request but refuses to authorize it. */
26220+
403: {
26221+
headers: {
26222+
[name: string]: unknown
26223+
}
26224+
content: {
26225+
'application/problem+json': components['schemas']['ForbiddenProblemResponse']
26226+
}
26227+
}
26228+
/** @description The origin server did not find a current representation for the target resource or is not willing to disclose that one exists. */
26229+
404: {
26230+
headers: {
26231+
[name: string]: unknown
26232+
}
26233+
content: {
26234+
'application/problem+json': components['schemas']['NotFoundProblemResponse']
26235+
}
26236+
}
26237+
/** @description One or more conditions given in the request header fields evaluated to false when tested on the server. */
26238+
412: {
26239+
headers: {
26240+
[name: string]: unknown
26241+
}
26242+
content: {
26243+
'application/problem+json': components['schemas']['PreconditionFailedProblemResponse']
26244+
}
26245+
}
26246+
/** @description The server encountered an unexpected condition that prevented it from fulfilling the request. */
26247+
500: {
26248+
headers: {
26249+
[name: string]: unknown
26250+
}
26251+
content: {
26252+
'application/problem+json': components['schemas']['InternalServerErrorProblemResponse']
26253+
}
26254+
}
26255+
/** @description The server is currently unable to handle the request due to a temporary overload or scheduled maintenance, which will likely be alleviated after some delay. */
26256+
503: {
26257+
headers: {
26258+
[name: string]: unknown
26259+
}
26260+
content: {
26261+
'application/problem+json': components['schemas']['ServiceUnavailableProblemResponse']
26262+
}
26263+
}
26264+
/** @description An unexpected error response. */
26265+
default: {
26266+
headers: {
26267+
[name: string]: unknown
26268+
}
26269+
content: {
26270+
'application/problem+json': components['schemas']['UnexpectedProblemResponse']
26271+
}
26272+
}
26273+
}
26274+
}
2601826275
listEventsV2: {
2601926276
parameters: {
2602026277
query?: {

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

Lines changed: 92 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17979,6 +17979,98 @@ export const getCustomerEntitlementValueV2QueryParams = zod.object({
1797917979
time: zod.coerce.date().optional(),
1798017980
})
1798117981

17982+
/**
17983+
* List all entitlements for all the customers and features. This endpoint is intended for administrative purposes only.
17984+
To fetch the entitlements of a specific subject please use the /api/v2/customers/{customerIdOrKey}/entitlements endpoint.
17985+
* @summary List all entitlements
17986+
*/
17987+
export const listEntitlementsV2QueryExcludeInactiveDefault = false
17988+
export const listEntitlementsV2QueryPageDefault = 1
17989+
export const listEntitlementsV2QueryPageSizeDefault = 100
17990+
export const listEntitlementsV2QueryPageSizeMax = 1000
17991+
export const listEntitlementsV2QueryOffsetDefault = 0
17992+
export const listEntitlementsV2QueryOffsetMin = 0
17993+
export const listEntitlementsV2QueryLimitDefault = 100
17994+
export const listEntitlementsV2QueryLimitMax = 1000
17995+
17996+
export const listEntitlementsV2QueryParams = zod.object({
17997+
customerIds: zod
17998+
.array(zod.coerce.string())
17999+
.optional()
18000+
.describe(
18001+
'Filtering by multiple customers.\n\nUsage: `?customerIds=01K4WAQ0J99ZZ0MD75HXR112H8&customerIds=01K4WAQ0J99ZZ0MD75HXR112H9`'
18002+
),
18003+
customerKeys: zod
18004+
.array(zod.coerce.string())
18005+
.optional()
18006+
.describe(
18007+
'Filtering by multiple customers.\n\nUsage: `?customerKeys=customer-1&customerKeys=customer-3`'
18008+
),
18009+
entitlementType: zod
18010+
.array(
18011+
zod
18012+
.enum(['metered', 'boolean', 'static'])
18013+
.describe('Type of the entitlement.')
18014+
)
18015+
.optional()
18016+
.describe(
18017+
'Filtering by multiple entitlement types.\n\nUsage: `?entitlementType=metered&entitlementType=boolean`'
18018+
),
18019+
excludeInactive: zod.coerce
18020+
.boolean()
18021+
.optional()
18022+
.describe(
18023+
'Exclude inactive entitlements in the response (those scheduled for later or earlier)'
18024+
),
18025+
feature: zod
18026+
.array(zod.coerce.string())
18027+
.optional()
18028+
.describe(
18029+
'Filtering by multiple features.\n\nUsage: `?feature=feature-1&feature=feature-2`'
18030+
),
18031+
limit: zod.coerce
18032+
.number()
18033+
.min(1)
18034+
.max(listEntitlementsV2QueryLimitMax)
18035+
.default(listEntitlementsV2QueryLimitDefault)
18036+
.describe('Number of items to return.\n\nDefault is 100.'),
18037+
offset: zod.coerce
18038+
.number()
18039+
.min(listEntitlementsV2QueryOffsetMin)
18040+
.optional()
18041+
.describe('Number of items to skip.\n\nDefault is 0.'),
18042+
order: zod.enum(['ASC', 'DESC']).optional().describe('The order direction.'),
18043+
orderBy: zod
18044+
.enum(['createdAt', 'updatedAt'])
18045+
.optional()
18046+
.describe('The order by field.'),
18047+
page: zod.coerce
18048+
.number()
18049+
.min(1)
18050+
.default(listEntitlementsV2QueryPageDefault)
18051+
.describe('Page index.\n\nDefault is 1.'),
18052+
pageSize: zod.coerce
18053+
.number()
18054+
.min(1)
18055+
.max(listEntitlementsV2QueryPageSizeMax)
18056+
.default(listEntitlementsV2QueryPageSizeDefault)
18057+
.describe('The maximum number of items per page.\n\nDefault is 100.'),
18058+
})
18059+
18060+
/**
18061+
* Get entitlement by id.
18062+
* @summary Get entitlement by id
18063+
*/
18064+
export const getEntitlementByIdV2PathEntitlementIdRegExp = new RegExp(
18065+
'^[0-7][0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{25}$'
18066+
)
18067+
18068+
export const getEntitlementByIdV2Params = zod.object({
18069+
entitlementId: zod.coerce
18070+
.string()
18071+
.regex(getEntitlementByIdV2PathEntitlementIdRegExp),
18072+
})
18073+
1798218074
/**
1798318075
* List ingested events with advanced filtering and cursor pagination.
1798418076
* @summary List ingested events

0 commit comments

Comments
 (0)