import { ndmClient, type NdmCameraPageQuery, type NdmCameraResultVO, type NdmCameraUpdateVO, type PageParams, type PageResult, type SnapResult } from '@/apis'; export const postNdmCameraPage = async (stationCode: string, pageQuery: PageParams, signal?: AbortSignal) => { const prefix = stationCode ? `/${stationCode}` : ''; const resp = await ndmClient.post>(`${prefix}/api/ndm/ndmCamera/page`, pageQuery, { signal }); const [err, ndmCamera] = resp; if (err || !ndmCamera) { throw err; } return ndmCamera; }; export const getNdmCameraDetail = async (stationCode: string, id: string) => { const prefix = stationCode ? `/${stationCode}` : ''; const resp = await ndmClient.get(`${prefix}/api/ndm/ndmCamera/detail`, { params: { id } }); const [err, ndmCamera] = resp; if (err || !ndmCamera) { throw err; } return ndmCamera; }; export const putNdmCamera = async (stationCode: string, updateVO: NdmCameraUpdateVO) => { const prefix = stationCode ? `/${stationCode}` : ''; const resp = await ndmClient.put(`${prefix}/api/ndm/ndmCamera`, updateVO); const [err, ndmCamera] = resp; if (err || !ndmCamera) { throw err; } return await getNdmCameraDetail(stationCode, ndmCamera.id ?? ''); }; export const getSnapByDeviceIdApi = async (deviceId: string) => { const resp = await ndmClient.get(`/api/ndm/ndmCamera/getSnapByDeviceId`, { params: { deviceId } }); const [err, snap] = resp; if (err || !snap) { throw err; } return snap; };