import mainApi from '@/api/buster_rest/instances'; import type { DashboardsListRequest, DashboardCreateRequest, DashboardUpdateRequest, DashboardSubscribeRequest } from '@/api/request_interfaces/dashboards/interfaces'; import type { BusterDashboardListItem, BusterDashboardResponse } from '@/api/asset_interfaces/dashboard'; export const dashboardsGetList = async (params: DashboardsListRequest) => { return await mainApi .get('/dashboards', { params }) .then((res) => res.data); }; export const dashboardsGetDashboard = async ({ id, password }: DashboardSubscribeRequest) => { return await mainApi .get(`/dashboards/${id}`, { params: { password } }) .then((res) => res.data); }; export const dashboardsCreateDashboard = async (params: DashboardCreateRequest) => { return await mainApi.post('/dashboards', params).then((res) => res.data); }; export const dashboardsUpdateDashboard = async (params: DashboardUpdateRequest) => { return await mainApi .put(`/dashboards/${params.id}`, params) .then((res) => res.data); }; export const dashboardsDeleteDashboard = async ({ ids }: { ids: string[] }) => { return await mainApi.delete(`/dashboards`, { data: { ids } }).then((res) => res.data); };