Skip to content

Commit 0e32de2

Browse files
authored
feat(iam): add list user grace periods method (#1586)
1 parent 2583b74 commit 0e32de2

File tree

4 files changed

+82
-0
lines changed

4 files changed

+82
-0
lines changed

packages/clients/src/api/iam/v1alpha1/api.gen.ts

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ import {
3434
unmarshalJWT,
3535
unmarshalListAPIKeysResponse,
3636
unmarshalListApplicationsResponse,
37+
unmarshalListGracePeriodsResponse,
3738
unmarshalListGroupsResponse,
3839
unmarshalListJWTsResponse,
3940
unmarshalListLogsResponse,
@@ -86,6 +87,8 @@ import type {
8687
ListAPIKeysResponse,
8788
ListApplicationsRequest,
8889
ListApplicationsResponse,
90+
ListGracePeriodsRequest,
91+
ListGracePeriodsResponse,
8992
ListGroupsRequest,
9093
ListGroupsResponse,
9194
ListJWTsRequest,
@@ -401,6 +404,22 @@ export class API extends ParentAPI {
401404
unmarshalUser,
402405
)
403406

407+
/**
408+
* List grace periods of a user. List the grace periods of a user.
409+
*
410+
* @param request - The request {@link ListGracePeriodsRequest}
411+
* @returns A Promise of ListGracePeriodsResponse
412+
*/
413+
listGracePeriods = (request: Readonly<ListGracePeriodsRequest> = {}) =>
414+
this.client.fetch<ListGracePeriodsResponse>(
415+
{
416+
method: 'GET',
417+
path: `/iam/v1alpha1/grace-periods`,
418+
urlParams: urlParams(['user_id', request.userId]),
419+
},
420+
unmarshalListGracePeriodsResponse,
421+
)
422+
404423
protected pageOfListApplications = (
405424
request: Readonly<ListApplicationsRequest> = {},
406425
) =>

packages/clients/src/api/iam/v1alpha1/index.gen.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,8 @@ export type {
3333
GetQuotumRequest,
3434
GetSSHKeyRequest,
3535
GetUserRequest,
36+
GracePeriod,
37+
GracePeriodType,
3638
Group,
3739
JWT,
3840
ListAPIKeysRequest,
@@ -41,6 +43,8 @@ export type {
4143
ListApplicationsRequest,
4244
ListApplicationsRequestOrderBy,
4345
ListApplicationsResponse,
46+
ListGracePeriodsRequest,
47+
ListGracePeriodsResponse,
4448
ListGroupsRequest,
4549
ListGroupsRequestOrderBy,
4650
ListGroupsResponse,

packages/clients/src/api/iam/v1alpha1/marshalling.gen.ts

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,12 @@ import type {
2222
CreateUserRequest,
2323
CreateUserRequestMember,
2424
EncodedJWT,
25+
GracePeriod,
2526
Group,
2627
JWT,
2728
ListAPIKeysResponse,
2829
ListApplicationsResponse,
30+
ListGracePeriodsResponse,
2931
ListGroupsResponse,
3032
ListJWTsResponse,
3133
ListLogsResponse,
@@ -302,6 +304,37 @@ export const unmarshalListApplicationsResponse = (
302304
} as ListApplicationsResponse
303305
}
304306

307+
const unmarshalGracePeriod = (data: unknown): GracePeriod => {
308+
if (!isJSONObject(data)) {
309+
throw new TypeError(
310+
`Unmarshalling the type 'GracePeriod' failed as data isn't a dictionary.`,
311+
)
312+
}
313+
314+
return {
315+
createdAt: unmarshalDate(data.created_at),
316+
expiresAt: unmarshalDate(data.expires_at),
317+
type: data.type,
318+
} as GracePeriod
319+
}
320+
321+
export const unmarshalListGracePeriodsResponse = (
322+
data: unknown,
323+
): ListGracePeriodsResponse => {
324+
if (!isJSONObject(data)) {
325+
throw new TypeError(
326+
`Unmarshalling the type 'ListGracePeriodsResponse' failed as data isn't a dictionary.`,
327+
)
328+
}
329+
330+
return {
331+
gracePeriods: unmarshalArrayOfObject(
332+
data.grace_periods,
333+
unmarshalGracePeriod,
334+
),
335+
} as ListGracePeriodsResponse
336+
}
337+
305338
export const unmarshalListGroupsResponse = (
306339
data: unknown,
307340
): ListGroupsResponse => {

packages/clients/src/api/iam/v1alpha1/types.gen.ts

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,11 @@
33

44
export type BearerType = 'unknown_bearer_type' | 'user' | 'application'
55

6+
export type GracePeriodType =
7+
| 'unknown_grace_period_type'
8+
| 'update_password'
9+
| 'set_mfa'
10+
611
export type ListAPIKeysRequestOrderBy =
712
| 'created_at_asc'
813
| 'created_at_desc'
@@ -207,6 +212,15 @@ export interface Application {
207212
tags: string[]
208213
}
209214

215+
export interface GracePeriod {
216+
/** Type of grace period. */
217+
type: GracePeriodType
218+
/** Date and time the grace period was created. */
219+
createdAt?: Date
220+
/** Date and time the grace period expires. */
221+
expiresAt?: Date
222+
}
223+
210224
export interface Group {
211225
/** ID of the group. */
212226
id: string
@@ -749,6 +763,16 @@ export interface ListApplicationsResponse {
749763
totalCount: number
750764
}
751765

766+
export type ListGracePeriodsRequest = {
767+
/** ID of the user to list grace periods for. */
768+
userId?: string
769+
}
770+
771+
export interface ListGracePeriodsResponse {
772+
/** List of grace periods. */
773+
gracePeriods: GracePeriod[]
774+
}
775+
752776
export type ListGroupsRequest = {
753777
/** Sort order of groups. */
754778
orderBy?: ListGroupsRequestOrderBy
@@ -960,6 +984,7 @@ export interface ListUsersResponse {
960984
}
961985

962986
export type LockUserRequest = {
987+
/** ID of the user to lock. */
963988
userId: string
964989
}
965990

@@ -999,6 +1024,7 @@ export interface SetRulesResponse {
9991024
}
10001025

10011026
export type UnlockUserRequest = {
1027+
/** ID of the user to unlock. */
10021028
userId: string
10031029
}
10041030

0 commit comments

Comments
 (0)