Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add composables for identity API clients #5705

Merged
merged 2 commits into from
Mar 20, 2025
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
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
import { SpaceConnector } from '@cloudforet/core-lib/space-connector';

import { useAPIQueryKey } from '@/api-clients/_common/composables/use-api-query-key';
import type { ListResponse } from '@/api-clients/_common/schema/api-verbs/list';
import type { DomainGetParameters } from '@/api-clients/identity/domain/schema/api-verbs/get';
import type { DomainGetAuthInfoParams } from '@/api-clients/identity/domain/schema/api-verbs/get-auth-info';
import type { DomainListParameters } from '@/api-clients/identity/domain/schema/api-verbs/list';
import type { DomainModel } from '@/api-clients/identity/domain/schema/model';


export const useDomainApi = () => {
const domainQueryKey = useAPIQueryKey('identity', 'domain', 'get');
const domainListQueryKey = useAPIQueryKey('identity', 'domain', 'list');

const actions = {
get: SpaceConnector.clientV2.identity.domain.get<DomainGetParameters, DomainModel>,
list: SpaceConnector.clientV2.identity.domain.list<DomainListParameters, ListResponse<DomainModel>>,
getAuthInfo: SpaceConnector.clientV2.identity.domain.getAuthInfo<DomainGetAuthInfoParams, any>,
};

return {
domainQueryKey,
domainListQueryKey,
domainAPI: actions,
};
};
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
import { SpaceConnector } from '@cloudforet/core-lib/space-connector';

import { useAPIQueryKey } from '@/api-clients/_common/composables/use-api-query-key';
import type { ListResponse } from '@/api-clients/_common/schema/api-verbs/list';
import type { ProjectGroupAddUsersParameters } from '@/api-clients/identity/project-group/schema/api-verbs/add-users';
import type { ProjectGroupChangeParentGroupParameters } from '@/api-clients/identity/project-group/schema/api-verbs/change-parent-group';
import type { ProjectGroupCreateParameters } from '@/api-clients/identity/project-group/schema/api-verbs/create';
import type { ProjectGroupDeleteParameters } from '@/api-clients/identity/project-group/schema/api-verbs/delete';
import type { ProjectGroupGetParameters } from '@/api-clients/identity/project-group/schema/api-verbs/get';
import type { ProjectGroupListParameters } from '@/api-clients/identity/project-group/schema/api-verbs/list';
import type { ProjectGroupRemoveUsersParameters } from '@/api-clients/identity/project-group/schema/api-verbs/remove-users';
import type { ProjectGroupUpdateParameters } from '@/api-clients/identity/project-group/schema/api-verbs/update';
import type { ProjectGroupModel } from '@/api-clients/identity/project-group/schema/model';


export const useProjectGroupApi = () => {
const projectGroupQueryKey = useAPIQueryKey('identity', 'project-group', 'get');
const projectGroupListQueryKey = useAPIQueryKey('identity', 'project-group', 'list');

const actions = {
create: SpaceConnector.clientV2.identity.projectGroup.create<ProjectGroupCreateParameters, ProjectGroupModel>,
update: SpaceConnector.clientV2.identity.projectGroup.update<ProjectGroupUpdateParameters, ProjectGroupModel>,
delete: SpaceConnector.clientV2.identity.projectGroup.delete<ProjectGroupDeleteParameters>,
get: SpaceConnector.clientV2.identity.projectGroup.get<ProjectGroupGetParameters, ProjectGroupModel>,
list: SpaceConnector.clientV2.identity.projectGroup.list<ProjectGroupListParameters, ListResponse<ProjectGroupModel>>,
addUsers: SpaceConnector.clientV2.identity.projectGroup.addUsers<ProjectGroupAddUsersParameters, ProjectGroupModel>,
removeUsers: SpaceConnector.clientV2.identity.projectGroup.removeUsers<ProjectGroupRemoveUsersParameters, ProjectGroupModel>,
changeParentGroup: SpaceConnector.clientV2.identity.projectGroup.changeParentGroup<ProjectGroupChangeParentGroupParameters, ProjectGroupModel>,
};

return {
projectGroupQueryKey,
projectGroupListQueryKey,
projectGroupAPI: actions,
};
};
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
import { SpaceConnector } from '@cloudforet/core-lib/space-connector';

import { useAPIQueryKey } from '@/api-clients/_common/composables/use-api-query-key';
import type { ListResponse } from '@/api-clients/_common/schema/api-verbs/list';
import type { ProjectAddUsersParameters } from '@/api-clients/identity/project/schema/api-verbs/add-users';
import type { ProjectChangeProjectGroupParameters } from '@/api-clients/identity/project/schema/api-verbs/change-project-group';
import type { ProjectCreateParameters } from '@/api-clients/identity/project/schema/api-verbs/create';
import type { ProjectDeleteParameters } from '@/api-clients/identity/project/schema/api-verbs/delete';
import type { ProjectGetParameters } from '@/api-clients/identity/project/schema/api-verbs/get';
import type { ProjectListParameters } from '@/api-clients/identity/project/schema/api-verbs/list';
import type { ProjectRemoveUsersParameters } from '@/api-clients/identity/project/schema/api-verbs/remove-users';
import type { ProjectUpdateParameters } from '@/api-clients/identity/project/schema/api-verbs/udpate';
import type { ProjectUpdateProjectTypeParameters } from '@/api-clients/identity/project/schema/api-verbs/update-project-type';
import type { ProjectModel } from '@/api-clients/identity/project/schema/model';


export const useProjectApi = () => {
const projectQueryKey = useAPIQueryKey('identity', 'project', 'get');
const projectListQueryKey = useAPIQueryKey('identity', 'project', 'list');

const actions = {
create: SpaceConnector.clientV2.identity.project.create<ProjectCreateParameters, ProjectModel>,
update: SpaceConnector.clientV2.identity.project.update<ProjectUpdateParameters, ProjectModel>,
delete: SpaceConnector.clientV2.identity.project.delete<ProjectDeleteParameters>,
get: SpaceConnector.clientV2.identity.project.get<ProjectGetParameters, ProjectModel>,
list: SpaceConnector.clientV2.identity.project.list<ProjectListParameters, ListResponse<ProjectModel>>,
addUsers: SpaceConnector.clientV2.identity.project.addUsers<ProjectAddUsersParameters, ProjectModel>,
removeUsers: SpaceConnector.clientV2.identity.project.removeUsers<ProjectRemoveUsersParameters, ProjectModel>,
changeProjectGroup: SpaceConnector.clientV2.identity.project.changeProjectGroup<ProjectChangeProjectGroupParameters, ProjectModel>,
updateProjectType: SpaceConnector.clientV2.identity.project.updateProjectType<ProjectUpdateProjectTypeParameters, ProjectModel>,
};

return {
projectQueryKey,
projectListQueryKey,
projectAPI: actions,
};
};
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
import { SpaceConnector } from '@cloudforet/core-lib/space-connector';

import { useAPIQueryKey } from '@/api-clients/_common/composables/use-api-query-key';
import type { ListResponse } from '@/api-clients/_common/schema/api-verbs/list';
import type { ProviderCreateParameters } from '@/api-clients/identity/provider/schema/api-verbs/create';
import type { ProviderDeleteParameters } from '@/api-clients/identity/provider/schema/api-verbs/delete';
import type { ProviderGetParameters } from '@/api-clients/identity/provider/schema/api-verbs/get';
import type { ProviderListParameters } from '@/api-clients/identity/provider/schema/api-verbs/list';
import type { ProviderStatParameters } from '@/api-clients/identity/provider/schema/api-verbs/stat';
import type { ProviderUpdateParameters } from '@/api-clients/identity/provider/schema/api-verbs/update';
import type { ProviderModel } from '@/api-clients/identity/provider/schema/model';


export const useProviderApi = () => {
const providerQueryKey = useAPIQueryKey('identity', 'provider', 'get');
const providerListQueryKey = useAPIQueryKey('identity', 'provider', 'list');

const actions = {
create: SpaceConnector.clientV2.identity.provider.create<ProviderCreateParameters, ProviderModel>,
update: SpaceConnector.clientV2.identity.provider.update<ProviderUpdateParameters, ProviderModel>,
delete: SpaceConnector.clientV2.identity.provider.delete<ProviderDeleteParameters>,
get: SpaceConnector.clientV2.identity.provider.get<ProviderGetParameters, ProviderModel>,
list: SpaceConnector.clientV2.identity.provider.list<ProviderListParameters, ListResponse<ProviderModel>>,
stat: SpaceConnector.clientV2.identity.provider.stat<ProviderStatParameters, any>,
};

return {
providerQueryKey,
providerListQueryKey,
providerAPI: actions,
};
};
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
import { SpaceConnector } from '@cloudforet/core-lib/space-connector';

import { useAPIQueryKey } from '@/api-clients/_common/composables/use-api-query-key';
import type { ListResponse } from '@/api-clients/_common/schema/api-verbs/list';
import type { ServiceAccountCreateParameters } from '@/api-clients/identity/service-account/schema/api-verbs/create';
import type { ServiceAccountDeleteParameters } from '@/api-clients/identity/service-account/schema/api-verbs/detele';
import type { ServiceAccountDeleteSecretDataParameters } from '@/api-clients/identity/service-account/schema/api-verbs/detele-secret-data';
import type { ServiceAccountGetParameters } from '@/api-clients/identity/service-account/schema/api-verbs/get';
import type { ServiceAccountListParameters } from '@/api-clients/identity/service-account/schema/api-verbs/list';
import type { ServiceAccountStatParameters } from '@/api-clients/identity/service-account/schema/api-verbs/stat';
import type { ServiceAccountUpdateParameters } from '@/api-clients/identity/service-account/schema/api-verbs/update';
import type { ServiceAccountUpdateSecretDataParameters } from '@/api-clients/identity/service-account/schema/api-verbs/update-secret-data';
import type { ServiceAccountModel } from '@/api-clients/identity/service-account/schema/model';


export const useServiceAccountApi = () => {
const serviceAccountQueryKey = useAPIQueryKey('identity', 'service-account', 'get');
const serviceAccountListQueryKey = useAPIQueryKey('identity', 'service-account', 'list');

const actions = {
create: SpaceConnector.clientV2.identity.serviceAccount.create<ServiceAccountCreateParameters, ServiceAccountModel>,
update: SpaceConnector.clientV2.identity.serviceAccount.update<ServiceAccountUpdateParameters, ServiceAccountModel>,
delete: SpaceConnector.clientV2.identity.serviceAccount.delete<ServiceAccountDeleteParameters>,
get: SpaceConnector.clientV2.identity.serviceAccount.get<ServiceAccountGetParameters, ServiceAccountModel>,
list: SpaceConnector.clientV2.identity.serviceAccount.list<ServiceAccountListParameters, ListResponse<ServiceAccountModel>>,
stat: SpaceConnector.clientV2.identity.serviceAccount.stat<ServiceAccountStatParameters, any>,
updateSecretData: SpaceConnector.clientV2.identity.serviceAccount.updateSecretData<ServiceAccountUpdateSecretDataParameters, ServiceAccountModel>,
deleteSecretData: SpaceConnector.clientV2.identity.serviceAccount.deleteSecretData<ServiceAccountDeleteSecretDataParameters>,
};

return {
serviceAccountQueryKey,
serviceAccountListQueryKey,
serviceAccountAPI: actions,
};
};
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import { SpaceConnector } from '@cloudforet/core-lib/space-connector';

import { useAPIQueryKey } from '@/api-clients/_common/composables/use-api-query-key';
import type { TokenGrantParameters } from '@/api-clients/identity/token/schema/api-verbs/grant';
import type { TokenIssueParameters } from '@/api-clients/identity/token/schema/api-verbs/issue';
import type { TokenIssueModel, TokenGrantModel } from '@/api-clients/identity/token/schema/model';


export const useTokenApi = () => {
const tokenQueryKey = useAPIQueryKey('identity', 'token', 'issue');
const tokenGrantQueryKey = useAPIQueryKey('identity', 'token', 'grant');

const actions = {
issue: SpaceConnector.clientV2.identity.token.issue<TokenIssueParameters, TokenIssueModel>,
grant: SpaceConnector.clientV2.identity.token.grant<TokenGrantParameters, TokenGrantModel>,
};

return {
tokenQueryKey,
tokenGrantQueryKey,
tokenAPI: actions,
};
};
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
import { SpaceConnector } from '@cloudforet/core-lib/space-connector';

import { useAPIQueryKey } from '@/api-clients/_common/composables/use-api-query-key';
import type { ListResponse } from '@/api-clients/_common/schema/api-verbs/list';
import type { TrustedAccountCreateParameters } from '@/api-clients/identity/trusted-account/schema/api-verbs/create';
import type { TrustedAccountDeleteParameters } from '@/api-clients/identity/trusted-account/schema/api-verbs/detele';
import type { TrustedAccountGetParameters } from '@/api-clients/identity/trusted-account/schema/api-verbs/get';
import type { TrustedAccountListParameters } from '@/api-clients/identity/trusted-account/schema/api-verbs/list';
import type { TrustedAccountStatParameters } from '@/api-clients/identity/trusted-account/schema/api-verbs/stat';
import type { TrustedAccountUpdateParameters } from '@/api-clients/identity/trusted-account/schema/api-verbs/update';
import type { TrustedAccountUpdateSecretDataParameters } from '@/api-clients/identity/trusted-account/schema/api-verbs/update-secret-data';
import type { TrustedAccountModel } from '@/api-clients/identity/trusted-account/schema/model';


export const useTrustedAccountApi = () => {
const trustedAccountQueryKey = useAPIQueryKey('identity', 'trusted-account', 'get');
const trustedAccountListQueryKey = useAPIQueryKey('identity', 'trusted-account', 'list');

const actions = {
create: SpaceConnector.clientV2.identity.trustedAccount.create<TrustedAccountCreateParameters, TrustedAccountModel>,
update: SpaceConnector.clientV2.identity.trustedAccount.update<TrustedAccountUpdateParameters, TrustedAccountModel>,
delete: SpaceConnector.clientV2.identity.trustedAccount.delete<TrustedAccountDeleteParameters>,
get: SpaceConnector.clientV2.identity.trustedAccount.get<TrustedAccountGetParameters, TrustedAccountModel>,
list: SpaceConnector.clientV2.identity.trustedAccount.list<TrustedAccountListParameters, ListResponse<TrustedAccountModel>>,
stat: SpaceConnector.clientV2.identity.trustedAccount.stat<TrustedAccountStatParameters, any>,
updateSecretData: SpaceConnector.clientV2.identity.trustedAccount.updateSecretData<TrustedAccountUpdateSecretDataParameters, TrustedAccountModel>,
};

return {
trustedAccountQueryKey,
trustedAccountListQueryKey,
trustedAccountAPI: actions,
};
};
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
import { SpaceConnector } from '@cloudforet/core-lib/space-connector';

import { useAPIQueryKey } from '@/api-clients/_common/composables/use-api-query-key';
import type { ListResponse } from '@/api-clients/_common/schema/api-verbs/list';
import type { UserGroupAddUsersParameters } from '@/api-clients/identity/user-group/schema/api-verbs/add-users';
import type { UserGroupCreateParameters } from '@/api-clients/identity/user-group/schema/api-verbs/create';
import type { UserGroupDeleteUserGroupParameters } from '@/api-clients/identity/user-group/schema/api-verbs/delete';
import type { UserGroupGetParameters } from '@/api-clients/identity/user-group/schema/api-verbs/get';
import type { UserGroupListParameters } from '@/api-clients/identity/user-group/schema/api-verbs/list';
import type { UserGroupRemoveUsersParameters } from '@/api-clients/identity/user-group/schema/api-verbs/remove-users';
import type { UserGroupUpdateParameters } from '@/api-clients/identity/user-group/schema/api-verbs/update';
import type { UserGroupModel } from '@/api-clients/identity/user-group/schema/model';


export const useUserGroupApi = () => {
const userGroupQueryKey = useAPIQueryKey('identity', 'user-group', 'get');
const userGroupListQueryKey = useAPIQueryKey('identity', 'user-group', 'list');

const actions = {
create: SpaceConnector.clientV2.identity.userGroup.create<UserGroupCreateParameters, UserGroupModel>,
update: SpaceConnector.clientV2.identity.userGroup.update<UserGroupUpdateParameters, UserGroupModel>,
delete: SpaceConnector.clientV2.identity.userGroup.delete<UserGroupDeleteUserGroupParameters>,
get: SpaceConnector.clientV2.identity.userGroup.get<UserGroupGetParameters, UserGroupModel>,
list: SpaceConnector.clientV2.identity.userGroup.list<UserGroupListParameters, ListResponse<UserGroupModel>>,
addUsers: SpaceConnector.clientV2.identity.userGroup.addUsers<UserGroupAddUsersParameters, UserGroupModel>,
removeUsers: SpaceConnector.clientV2.identity.userGroup.removeUsers<UserGroupRemoveUsersParameters, UserGroupModel>,
};

return {
userGroupQueryKey,
userGroupListQueryKey,
userGroupAPI: actions,
};
};
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
import { SpaceConnector } from '@cloudforet/core-lib/space-connector';

import { useAPIQueryKey } from '@/api-clients/_common/composables/use-api-query-key';
import type { UserProfileConfirmEmailParameters } from '@/api-clients/identity/user-profile/schema/api-verbs/confirm-email';
import type { UserProfileConfirmMfaParameters } from '@/api-clients/identity/user-profile/schema/api-verbs/confirm-mfa';
import type { UserProfileEnableMfaParameters } from '@/api-clients/identity/user-profile/schema/api-verbs/enable-mfa';
import type { UserProfileGetWorkspacesParameters } from '@/api-clients/identity/user-profile/schema/api-verbs/get-workspaces';
import type { UserProfileResetPasswordParameters } from '@/api-clients/identity/user-profile/schema/api-verbs/reset-password';
import type { UserProfileUpdateParameters } from '@/api-clients/identity/user-profile/schema/api-verbs/update';
import type { UserProfileUpdatePasswordParameters } from '@/api-clients/identity/user-profile/schema/api-verbs/update-password';
import type { UserProfileVerifyEmailParameters } from '@/api-clients/identity/user-profile/schema/api-verbs/verify-email';


export const useUserProfileApi = () => {
const userProfileQueryKey = useAPIQueryKey('identity', 'user-profile', 'get');

const actions = {
update: SpaceConnector.clientV2.identity.userProfile.update<UserProfileUpdateParameters, any>,
updatePassword: SpaceConnector.clientV2.identity.userProfile.updatePassword<UserProfileUpdatePasswordParameters, any>,
resetPassword: SpaceConnector.clientV2.identity.userProfile.resetPassword<UserProfileResetPasswordParameters, any>,
verifyEmail: SpaceConnector.clientV2.identity.userProfile.verifyEmail<UserProfileVerifyEmailParameters, any>,
confirmEmail: SpaceConnector.clientV2.identity.userProfile.confirmEmail<UserProfileConfirmEmailParameters, any>,
enableMfa: SpaceConnector.clientV2.identity.userProfile.enableMfa<UserProfileEnableMfaParameters, any>,
confirmMfa: SpaceConnector.clientV2.identity.userProfile.confirmMfa<UserProfileConfirmMfaParameters, any>,
getWorkspaces: SpaceConnector.clientV2.identity.userProfile.getWorkspaces<UserProfileGetWorkspacesParameters, any>,
};

return {
userProfileQueryKey,
userProfileAPI: actions,
};
};
Loading
Loading