Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 19 additions & 0 deletions packages/clients/src/api/iam/v1alpha1/api.gen.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ import {
unmarshalJWT,
unmarshalListAPIKeysResponse,
unmarshalListApplicationsResponse,
unmarshalListGracePeriodsResponse,
unmarshalListGroupsResponse,
unmarshalListJWTsResponse,
unmarshalListLogsResponse,
Expand Down Expand Up @@ -86,6 +87,8 @@ import type {
ListAPIKeysResponse,
ListApplicationsRequest,
ListApplicationsResponse,
ListGracePeriodsRequest,
ListGracePeriodsResponse,
ListGroupsRequest,
ListGroupsResponse,
ListJWTsRequest,
Expand Down Expand Up @@ -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<ListGracePeriodsRequest> = {}) =>
this.client.fetch<ListGracePeriodsResponse>(
{
method: 'GET',
path: `/iam/v1alpha1/grace-periods`,
urlParams: urlParams(['user_id', request.userId]),
},
unmarshalListGracePeriodsResponse,
)

protected pageOfListApplications = (
request: Readonly<ListApplicationsRequest> = {},
) =>
Expand Down
4 changes: 4 additions & 0 deletions packages/clients/src/api/iam/v1alpha1/index.gen.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@ export type {
GetQuotumRequest,
GetSSHKeyRequest,
GetUserRequest,
GracePeriod,
GracePeriodType,
Group,
JWT,
ListAPIKeysRequest,
Expand All @@ -41,6 +43,8 @@ export type {
ListApplicationsRequest,
ListApplicationsRequestOrderBy,
ListApplicationsResponse,
ListGracePeriodsRequest,
ListGracePeriodsResponse,
ListGroupsRequest,
ListGroupsRequestOrderBy,
ListGroupsResponse,
Expand Down
33 changes: 33 additions & 0 deletions packages/clients/src/api/iam/v1alpha1/marshalling.gen.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,12 @@ import type {
CreateUserRequest,
CreateUserRequestMember,
EncodedJWT,
GracePeriod,
Group,
JWT,
ListAPIKeysResponse,
ListApplicationsResponse,
ListGracePeriodsResponse,
ListGroupsResponse,
ListJWTsResponse,
ListLogsResponse,
Expand Down Expand Up @@ -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 => {
Expand Down
26 changes: 26 additions & 0 deletions packages/clients/src/api/iam/v1alpha1/types.gen.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -960,6 +984,7 @@ export interface ListUsersResponse {
}

export type LockUserRequest = {
/** ID of the user to lock. */
userId: string
}

Expand Down Expand Up @@ -999,6 +1024,7 @@ export interface SetRulesResponse {
}

export type UnlockUserRequest = {
/** ID of the user to unlock. */
userId: string
}

Expand Down
Loading