diff --git a/packages/clients/src/api/iam/v1alpha1/api.gen.ts b/packages/clients/src/api/iam/v1alpha1/api.gen.ts index 3f8bc0dd8..99879359e 100644 --- a/packages/clients/src/api/iam/v1alpha1/api.gen.ts +++ b/packages/clients/src/api/iam/v1alpha1/api.gen.ts @@ -34,6 +34,7 @@ import { unmarshalJWT, unmarshalListAPIKeysResponse, unmarshalListApplicationsResponse, + unmarshalListGracePeriodsResponse, unmarshalListGroupsResponse, unmarshalListJWTsResponse, unmarshalListLogsResponse, @@ -86,6 +87,8 @@ import type { ListAPIKeysResponse, ListApplicationsRequest, ListApplicationsResponse, + ListGracePeriodsRequest, + ListGracePeriodsResponse, ListGroupsRequest, ListGroupsResponse, ListJWTsRequest, @@ -401,6 +404,22 @@ export class API extends ParentAPI { unmarshalUser, ) + /** + * List grace periods of a user. List the grace periods of a user. + * + * @param request - The request {@link ListGracePeriodsRequest} + * @returns A Promise of ListGracePeriodsResponse + */ + listGracePeriods = (request: Readonly = {}) => + this.client.fetch( + { + method: 'GET', + path: `/iam/v1alpha1/grace-periods`, + urlParams: urlParams(['user_id', request.userId]), + }, + unmarshalListGracePeriodsResponse, + ) + protected pageOfListApplications = ( request: Readonly = {}, ) => diff --git a/packages/clients/src/api/iam/v1alpha1/index.gen.ts b/packages/clients/src/api/iam/v1alpha1/index.gen.ts index 98597f4e7..991ba5f4f 100644 --- a/packages/clients/src/api/iam/v1alpha1/index.gen.ts +++ b/packages/clients/src/api/iam/v1alpha1/index.gen.ts @@ -33,6 +33,8 @@ export type { GetQuotumRequest, GetSSHKeyRequest, GetUserRequest, + GracePeriod, + GracePeriodType, Group, JWT, ListAPIKeysRequest, @@ -41,6 +43,8 @@ export type { ListApplicationsRequest, ListApplicationsRequestOrderBy, ListApplicationsResponse, + ListGracePeriodsRequest, + ListGracePeriodsResponse, ListGroupsRequest, ListGroupsRequestOrderBy, ListGroupsResponse, diff --git a/packages/clients/src/api/iam/v1alpha1/marshalling.gen.ts b/packages/clients/src/api/iam/v1alpha1/marshalling.gen.ts index 2b7907ba2..3d006df06 100644 --- a/packages/clients/src/api/iam/v1alpha1/marshalling.gen.ts +++ b/packages/clients/src/api/iam/v1alpha1/marshalling.gen.ts @@ -22,10 +22,12 @@ import type { CreateUserRequest, CreateUserRequestMember, EncodedJWT, + GracePeriod, Group, JWT, ListAPIKeysResponse, ListApplicationsResponse, + ListGracePeriodsResponse, ListGroupsResponse, ListJWTsResponse, ListLogsResponse, @@ -302,6 +304,37 @@ export const unmarshalListApplicationsResponse = ( } as ListApplicationsResponse } +const unmarshalGracePeriod = (data: unknown): GracePeriod => { + if (!isJSONObject(data)) { + throw new TypeError( + `Unmarshalling the type 'GracePeriod' failed as data isn't a dictionary.`, + ) + } + + return { + createdAt: unmarshalDate(data.created_at), + expiresAt: unmarshalDate(data.expires_at), + type: data.type, + } as GracePeriod +} + +export const unmarshalListGracePeriodsResponse = ( + data: unknown, +): ListGracePeriodsResponse => { + if (!isJSONObject(data)) { + throw new TypeError( + `Unmarshalling the type 'ListGracePeriodsResponse' failed as data isn't a dictionary.`, + ) + } + + return { + gracePeriods: unmarshalArrayOfObject( + data.grace_periods, + unmarshalGracePeriod, + ), + } as ListGracePeriodsResponse +} + export const unmarshalListGroupsResponse = ( data: unknown, ): ListGroupsResponse => { diff --git a/packages/clients/src/api/iam/v1alpha1/types.gen.ts b/packages/clients/src/api/iam/v1alpha1/types.gen.ts index c9e9d1567..0b6edca60 100644 --- a/packages/clients/src/api/iam/v1alpha1/types.gen.ts +++ b/packages/clients/src/api/iam/v1alpha1/types.gen.ts @@ -3,6 +3,11 @@ export type BearerType = 'unknown_bearer_type' | 'user' | 'application' +export type GracePeriodType = + | 'unknown_grace_period_type' + | 'update_password' + | 'set_mfa' + export type ListAPIKeysRequestOrderBy = | 'created_at_asc' | 'created_at_desc' @@ -207,6 +212,15 @@ export interface Application { tags: string[] } +export interface GracePeriod { + /** Type of grace period. */ + type: GracePeriodType + /** Date and time the grace period was created. */ + createdAt?: Date + /** Date and time the grace period expires. */ + expiresAt?: Date +} + export interface Group { /** ID of the group. */ id: string @@ -749,6 +763,16 @@ export interface ListApplicationsResponse { totalCount: number } +export type ListGracePeriodsRequest = { + /** ID of the user to list grace periods for. */ + userId?: string +} + +export interface ListGracePeriodsResponse { + /** List of grace periods. */ + gracePeriods: GracePeriod[] +} + export type ListGroupsRequest = { /** Sort order of groups. */ orderBy?: ListGroupsRequestOrderBy @@ -960,6 +984,7 @@ export interface ListUsersResponse { } export type LockUserRequest = { + /** ID of the user to lock. */ userId: string } @@ -999,6 +1024,7 @@ export interface SetRulesResponse { } export type UnlockUserRequest = { + /** ID of the user to unlock. */ userId: string }