From 577e9b12d58f9a59d9f3bcf508ef8b2f96f6f693 Mon Sep 17 00:00:00 2001 From: scaleway-bot Date: Wed, 5 Mar 2025 16:52:44 +0000 Subject: [PATCH] feat: update generated APIs --- .../clients/src/api/iam/v1alpha1/api.gen.ts | 12 +++ .../clients/src/api/iam/v1alpha1/index.gen.ts | 5 ++ .../src/api/iam/v1alpha1/marshalling.gen.ts | 74 +++++++++++++++++++ .../clients/src/api/iam/v1alpha1/types.gen.ts | 29 ++++++++ 4 files changed, 120 insertions(+) diff --git a/packages/clients/src/api/iam/v1alpha1/api.gen.ts b/packages/clients/src/api/iam/v1alpha1/api.gen.ts index c87d7debf..60376a8a4 100644 --- a/packages/clients/src/api/iam/v1alpha1/api.gen.ts +++ b/packages/clients/src/api/iam/v1alpha1/api.gen.ts @@ -33,6 +33,7 @@ import { unmarshalAPIKey, unmarshalApplication, unmarshalEncodedJWT, + unmarshalGetUserConnectionsResponse, unmarshalGroup, unmarshalJWT, unmarshalListAPIKeysResponse, @@ -89,6 +90,8 @@ import type { GetPolicyRequest, GetQuotumRequest, GetSSHKeyRequest, + GetUserConnectionsRequest, + GetUserConnectionsResponse, GetUserRequest, Group, JWT, @@ -509,6 +512,15 @@ export class API extends ParentAPI { unmarshalListGracePeriodsResponse, ) + getUserConnections = (request: Readonly) => + this.client.fetch( + { + method: 'GET', + path: `/iam/v1alpha1/users/${validatePathParam('userId', request.userId)}/connections`, + }, + unmarshalGetUserConnectionsResponse, + ) + 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 80d869148..b985b44ca 100644 --- a/packages/clients/src/api/iam/v1alpha1/index.gen.ts +++ b/packages/clients/src/api/iam/v1alpha1/index.gen.ts @@ -35,6 +35,11 @@ export type { GetPolicyRequest, GetQuotumRequest, GetSSHKeyRequest, + GetUserConnectionsRequest, + GetUserConnectionsResponse, + GetUserConnectionsResponseConnection, + GetUserConnectionsResponseConnectionConnectedOrganization, + GetUserConnectionsResponseConnectionConnectedUser, GetUserRequest, GracePeriod, GracePeriodType, diff --git a/packages/clients/src/api/iam/v1alpha1/marshalling.gen.ts b/packages/clients/src/api/iam/v1alpha1/marshalling.gen.ts index d675d2624..fd48b13c5 100644 --- a/packages/clients/src/api/iam/v1alpha1/marshalling.gen.ts +++ b/packages/clients/src/api/iam/v1alpha1/marshalling.gen.ts @@ -22,6 +22,10 @@ import type { CreateUserRequest, CreateUserRequestMember, EncodedJWT, + GetUserConnectionsResponse, + GetUserConnectionsResponseConnection, + GetUserConnectionsResponseConnectionConnectedOrganization, + GetUserConnectionsResponseConnectionConnectedUser, GracePeriod, Group, JWT, @@ -296,6 +300,76 @@ export const unmarshalEncodedJWT = (data: unknown): EncodedJWT => { } as EncodedJWT } +const unmarshalGetUserConnectionsResponseConnectionConnectedOrganization = ( + data: unknown, +): GetUserConnectionsResponseConnectionConnectedOrganization => { + if (!isJSONObject(data)) { + throw new TypeError( + `Unmarshalling the type 'GetUserConnectionsResponseConnectionConnectedOrganization' failed as data isn't a dictionary.`, + ) + } + + return { + id: data.id, + locked: data.locked, + name: data.name, + } as GetUserConnectionsResponseConnectionConnectedOrganization +} + +const unmarshalGetUserConnectionsResponseConnectionConnectedUser = ( + data: unknown, +): GetUserConnectionsResponseConnectionConnectedUser => { + if (!isJSONObject(data)) { + throw new TypeError( + `Unmarshalling the type 'GetUserConnectionsResponseConnectionConnectedUser' failed as data isn't a dictionary.`, + ) + } + + return { + id: data.id, + type: data.type, + username: data.username, + } as GetUserConnectionsResponseConnectionConnectedUser +} + +const unmarshalGetUserConnectionsResponseConnection = ( + data: unknown, +): GetUserConnectionsResponseConnection => { + if (!isJSONObject(data)) { + throw new TypeError( + `Unmarshalling the type 'GetUserConnectionsResponseConnection' failed as data isn't a dictionary.`, + ) + } + + return { + organization: data.organization + ? unmarshalGetUserConnectionsResponseConnectionConnectedOrganization( + data.organization, + ) + : undefined, + user: data.user + ? unmarshalGetUserConnectionsResponseConnectionConnectedUser(data.user) + : undefined, + } as GetUserConnectionsResponseConnection +} + +export const unmarshalGetUserConnectionsResponse = ( + data: unknown, +): GetUserConnectionsResponse => { + if (!isJSONObject(data)) { + throw new TypeError( + `Unmarshalling the type 'GetUserConnectionsResponse' failed as data isn't a dictionary.`, + ) + } + + return { + connections: unmarshalArrayOfObject( + data.connections, + unmarshalGetUserConnectionsResponseConnection, + ), + } as GetUserConnectionsResponse +} + export const unmarshalListAPIKeysResponse = ( data: unknown, ): ListAPIKeysResponse => { diff --git a/packages/clients/src/api/iam/v1alpha1/types.gen.ts b/packages/clients/src/api/iam/v1alpha1/types.gen.ts index b1451bae1..53591809d 100644 --- a/packages/clients/src/api/iam/v1alpha1/types.gen.ts +++ b/packages/clients/src/api/iam/v1alpha1/types.gen.ts @@ -99,6 +99,18 @@ export type UserStatus = 'unknown_status' | 'invitation_pending' | 'activated' export type UserType = 'unknown_type' | 'guest' | 'owner' | 'member' +export interface GetUserConnectionsResponseConnectionConnectedOrganization { + id: string + name: string + locked: boolean +} + +export interface GetUserConnectionsResponseConnectionConnectedUser { + id: string + username: string + type: UserType +} + export interface QuotumLimit { /** * Whether or not the limit is applied globally. @@ -191,6 +203,13 @@ export interface CreateUserRequestMember { password: string } +export interface GetUserConnectionsResponseConnection { + /** Information about the connected organization. */ + organization?: GetUserConnectionsResponseConnectionConnectedOrganization + /** Information about the connected user. */ + user?: GetUserConnectionsResponseConnectionConnectedUser +} + export interface APIKey { /** Access key of the API key. */ accessKey: string @@ -751,6 +770,16 @@ export type GetSSHKeyRequest = { sshKeyId: string } +export type GetUserConnectionsRequest = { + /** ID of the user to list connections for. */ + userId: string +} + +export interface GetUserConnectionsResponse { + /** List of connections. */ + connections: GetUserConnectionsResponseConnection[] +} + export type GetUserRequest = { /** ID of the user to find. */ userId: string