0
Fork 0
mirror of https://github.com/logto-io/logto.git synced 2024-12-30 20:33:54 -05:00

refactor: align cloud API response type definition (#6665)

This commit is contained in:
Darcy Ye 2024-10-10 11:10:56 +08:00 committed by GitHub
parent 3eede7893f
commit 026f7e48bc
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 5 additions and 12 deletions

View file

@ -15,13 +15,13 @@ export type Subscription = GuardedResponse<GetRoutes['/api/tenants/:tenantId/sub
export type NewSubscriptionUsageResponse = GuardedResponse< export type NewSubscriptionUsageResponse = GuardedResponse<
GetRoutes['/api/tenants/:tenantId/subscription-usage'] GetRoutes['/api/tenants/:tenantId/subscription-usage']
>; >;
/** The response of `GET /api/tenants/my/subscription/quota` has the same response type. */
export type NewSubscriptionQuota = Omit< export type NewSubscriptionQuota = Omit<
NewSubscriptionUsageResponse['quota'], NewSubscriptionUsageResponse['quota'],
// Since we are deprecation the `organizationsEnabled` key soon (use `organizationsLimit` instead), we exclude it from the quota keys for now to avoid confusion. // Since we are deprecation the `organizationsEnabled` key soon (use `organizationsLimit` instead), we exclude it from the quota keys for now to avoid confusion.
'organizationsEnabled' 'organizationsEnabled'
>; >;
/** The response of `GET /api/tenants/my/subscription/usage` has the same response type. */
export type NewSubscriptionCountBasedUsage = Omit< export type NewSubscriptionCountBasedUsage = Omit<
NewSubscriptionUsageResponse['usage'], NewSubscriptionUsageResponse['usage'],
// Since we are deprecation the `organizationsEnabled` key soon (use `organizationsLimit` instead), we exclude it from the usage keys for now to avoid confusion. // Since we are deprecation the `organizationsEnabled` key soon (use `organizationsLimit` instead), we exclude it from the usage keys for now to avoid confusion.

View file

@ -10,27 +10,20 @@ type RouteResponseType<T extends { search?: unknown; body?: unknown; response?:
type RouteRequestBodyType<T extends { search?: unknown; body?: ZodType; response?: unknown }> = type RouteRequestBodyType<T extends { search?: unknown; body?: ZodType; response?: unknown }> =
z.infer<NonNullable<T['body']>>; z.infer<NonNullable<T['body']>>;
export type Subscription = RouteResponseType<GetRoutes['/api/tenants/:tenantId/subscription']>; export type Subscription = RouteResponseType<GetRoutes['/api/tenants/my/subscription']>;
/** /**
* The type of the response of the `GET /api/tenants/:tenantId/subscription/quota` endpoint.
* It is the same as the response type of `GET /api/tenants/my/subscription/quota` endpoint.
*
* @remarks * @remarks
* The `auditLogsRetentionDays` will be handled by cron job in Azure Functions, outdated audit logs will be removed automatically. * The `auditLogsRetentionDays` will be handled by cron job in Azure Functions, outdated audit logs will be removed automatically.
*/ */
export type SubscriptionQuota = Omit< export type SubscriptionQuota = Omit<
RouteResponseType<GetRoutes['/api/tenants/:tenantId/subscription/quota']>, RouteResponseType<GetRoutes['/api/tenants/my/subscription/quota']>,
// Since we are deprecation the `organizationsEnabled` key soon (use `organizationsLimit` instead), we exclude it from the usage keys for now to avoid confusion. // Since we are deprecation the `organizationsEnabled` key soon (use `organizationsLimit` instead), we exclude it from the usage keys for now to avoid confusion.
'auditLogsRetentionDays' | 'organizationsEnabled' 'auditLogsRetentionDays' | 'organizationsEnabled'
>; >;
/**
* The type of the response of the `GET /api/tenants/:tenantId/subscription/usage` endpoint.
* It is the same as the response type of `GET /api/tenants/my/subscription/usage` endpoint.
*/
export type SubscriptionUsage = Omit< export type SubscriptionUsage = Omit<
RouteResponseType<GetRoutes['/api/tenants/:tenantId/subscription/usage']>, RouteResponseType<GetRoutes['/api/tenants/my/subscription/usage']>,
// Since we are deprecation the `organizationsEnabled` key soon (use `organizationsLimit` instead), we exclude it from the usage keys for now to avoid confusion. // Since we are deprecation the `organizationsEnabled` key soon (use `organizationsLimit` instead), we exclude it from the usage keys for now to avoid confusion.
'organizationsEnabled' 'organizationsEnabled'
>; >;