import { client } from "@/shared/api"; import { ENDPOINT } from "@/shared/config"; import type { RoleAuthorizationsService, RoleAuthorizationsParams, RoleAuthorizationsList, RoleAuthorizationsData, RoleAuthorizations, WithRoleIdRoleAuthorizationsParams, RoleAuthorizationsByRoleIdList, } from "../model/role-authorization-interface"; export class RoleAuthorizationsApiService implements RoleAuthorizationsService { public async getRoleAuthorizationsList( params: RoleAuthorizationsParams, ): Promise { const response = await client.get( `${ENDPOINT.USER_SERVICE.ROLE_AUTHORIZATIONS}/api`, { params }, ); return response.data; } public async getRoleAuthorizationsListByRoleId( params: WithRoleIdRoleAuthorizationsParams, ): Promise { const response = await client.get( `${ENDPOINT.USER_SERVICE.ROLE_AUTHORIZATIONS}`, { params }, ); return response.data; } public async createRoleAuthorizations( data: RoleAuthorizationsData, ): Promise { const response = await client.post( `${ENDPOINT.USER_SERVICE.ROLE_AUTHORIZATIONS}`, data, ); return response.data; } public async updateRoleAuthorizations( data: RoleAuthorizationsData, ): Promise { const response = await client.put( `${ENDPOINT.USER_SERVICE.ROLE_AUTHORIZATIONS}`, data, ); return response.data; } } export const RoleAuthorizationsApi = new RoleAuthorizationsApiService();