diff --git a/src/apis/request/biz/alarm/ndm-alarm-host.ts b/src/apis/request/biz/alarm/ndm-alarm-host.ts index 262e621..6135fd9 100644 --- a/src/apis/request/biz/alarm/ndm-alarm-host.ts +++ b/src/apis/request/biz/alarm/ndm-alarm-host.ts @@ -1,6 +1,7 @@ import { ndmClient, userClient, + type ImportMsg, type NdmAlarmHostPageQuery, type NdmAlarmHostResultVO, type NdmAlarmHostSaveVO, @@ -69,3 +70,29 @@ export const deleteAlarmHostApi = async (ids: string[], options?: { stationCode? if (!data) throw new Error(`${data}`); return data; }; + +export const exportAlarmHostApi = async (pageQuery: PageParams, options?: { stationCode?: Station['code']; signal?: AbortSignal }) => { + const { stationCode, signal } = options ?? {}; + const client = stationCode ? ndmClient : userClient; + const prefix = stationCode ? `/${stationCode}` : ''; + const endpoint = `${prefix}/api/ndm/ndmAlarmHost/defaultExportByTemplate`; + const resp = await client.post(endpoint, pageQuery, { responseType: 'blob', retRaw: true, signal }); + const [err, data] = resp; + if (err) throw err; + if (!data) throw new Error(`${data}`); + return data; +}; + +export const importAlarmHostApi = async (file: File, options?: { stationCode?: Station['code']; signal?: AbortSignal }) => { + const { stationCode, signal } = options ?? {}; + const client = stationCode ? ndmClient : userClient; + const prefix = stationCode ? `/${stationCode}` : ''; + const endpoint = `${prefix}/api/ndm/ndmAlarmHost/importReturnMsg`; + const formData = new FormData(); + formData.append('file', file); + const resp = await client.post(endpoint, formData, { signal, upload: true }); + const [err, data] = resp; + if (err) throw err; + if (!data) throw new Error(`${data}`); + return data; +}; diff --git a/src/apis/request/biz/other/ndm-security-box.ts b/src/apis/request/biz/other/ndm-security-box.ts index 9861904..89c2b76 100644 --- a/src/apis/request/biz/other/ndm-security-box.ts +++ b/src/apis/request/biz/other/ndm-security-box.ts @@ -1,6 +1,7 @@ import { ndmClient, userClient, + type ImportMsg, type NdmSecurityBoxPageQuery, type NdmSecurityBoxResultVO, type NdmSecurityBoxSaveVO, @@ -70,6 +71,32 @@ export const deleteSecurityBoxApi = async (ids: string[], options?: { stationCod return data; }; +export const exportSecurityBoxApi = async (pageQuery: PageParams, options?: { stationCode?: Station['code']; signal?: AbortSignal }) => { + const { stationCode, signal } = options ?? {}; + const client = stationCode ? ndmClient : userClient; + const prefix = stationCode ? `/${stationCode}` : ''; + const endpoint = `${prefix}/api/ndm/ndmSecurityBox/defaultExportByTemplate`; + const resp = await client.post(endpoint, pageQuery, { responseType: 'blob', retRaw: true, signal }); + const [err, data] = resp; + if (err) throw err; + if (!data) throw new Error(`${data}`); + return data; +}; + +export const importSecurityBoxApi = async (file: File, options?: { stationCode?: Station['code']; signal?: AbortSignal }) => { + const { stationCode, signal } = options ?? {}; + const client = stationCode ? ndmClient : userClient; + const prefix = stationCode ? `/${stationCode}` : ''; + const endpoint = `${prefix}/api/ndm/ndmSecurityBox/importReturnMsg`; + const formData = new FormData(); + formData.append('file', file); + const resp = await client.post(endpoint, formData, { signal, upload: true }); + const [err, data] = resp; + if (err) throw err; + if (!data) throw new Error(`${data}`); + return data; +}; + export const probeSecurityBoxApi = async (ids: string[], options?: { stationCode?: Station['code']; signal?: AbortSignal }) => { const { stationCode, signal } = options ?? {}; const client = stationCode ? ndmClient : userClient; diff --git a/src/apis/request/biz/other/ndm-switch.ts b/src/apis/request/biz/other/ndm-switch.ts index 4056faa..dc01d5e 100644 --- a/src/apis/request/biz/other/ndm-switch.ts +++ b/src/apis/request/biz/other/ndm-switch.ts @@ -1,4 +1,15 @@ -import { ndmClient, type NdmSwitchPageQuery, type NdmSwitchResultVO, type NdmSwitchSaveVO, type NdmSwitchUpdateVO, type PageParams, type PageResult, type Station } from '@/apis'; +import { + ndmClient, + userClient, + type ImportMsg, + type NdmSwitchPageQuery, + type NdmSwitchResultVO, + type NdmSwitchSaveVO, + type NdmSwitchUpdateVO, + type PageParams, + type PageResult, + type Station, +} from '@/apis'; export const pageSwitchApi = async (pageQuery: PageParams, options?: { stationCode?: Station['code']; signal?: AbortSignal }) => { const { stationCode, signal } = options ?? {}; @@ -60,6 +71,32 @@ export const deleteSwitchApi = async (ids: string[], options?: { stationCode?: S return data; }; +export const exportSwitchApi = async (pageQuery: PageParams, options?: { stationCode?: Station['code']; signal?: AbortSignal }) => { + const { stationCode, signal } = options ?? {}; + const client = stationCode ? ndmClient : ndmClient; + const prefix = stationCode ? `/${stationCode}` : ''; + const endpoint = `${prefix}/api/ndm/ndmSwitch/defaultExportByTemplate`; + const resp = await client.post(endpoint, pageQuery, { responseType: 'blob', retRaw: true, signal }); + const [err, data] = resp; + if (err) throw err; + if (!data) throw new Error(`${data}`); + return data; +}; + +export const importSwitchApi = async (file: File, options?: { stationCode?: Station['code']; signal?: AbortSignal }) => { + const { stationCode, signal } = options ?? {}; + const client = stationCode ? ndmClient : userClient; + const prefix = stationCode ? `/${stationCode}` : ''; + const endpoint = `${prefix}/api/ndm/ndmSwitch/importReturnMsg`; + const formData = new FormData(); + formData.append('file', file); + const resp = await client.post(endpoint, formData, { signal, upload: true }); + const [err, data] = resp; + if (err) throw err; + if (!data) throw new Error(`${data}`); + return data; +}; + export const probeSwitchApi = async (ids: string[], options?: { stationCode?: Station['code']; signal?: AbortSignal }) => { const { stationCode, signal } = options ?? {}; const client = stationCode ? ndmClient : ndmClient; diff --git a/src/apis/request/biz/storage/ndm-nvr.ts b/src/apis/request/biz/storage/ndm-nvr.ts index bfe023e..ea68e2b 100644 --- a/src/apis/request/biz/storage/ndm-nvr.ts +++ b/src/apis/request/biz/storage/ndm-nvr.ts @@ -1,4 +1,4 @@ -import { ndmClient, userClient, type NdmNvrPageQuery, type NdmNvrResultVO, type NdmNvrSaveVO, type NdmNvrUpdateVO, type PageParams, type PageResult, type Station } from '@/apis'; +import { ndmClient, userClient, type ImportMsg, type NdmNvrPageQuery, type NdmNvrResultVO, type NdmNvrSaveVO, type NdmNvrUpdateVO, type PageParams, type PageResult, type Station } from '@/apis'; export const pageNvrPageApi = async (pageQuery: PageParams, options?: { stationCode: Station['code']; signal?: AbortSignal }) => { const { stationCode, signal } = options ?? {}; @@ -60,6 +60,32 @@ export const deleteNvrApi = async (ids: string[], options?: { stationCode?: Stat return data; }; +export const exportNvrApi = async (pageQuery: PageParams, options?: { stationCode?: Station['code']; signal?: AbortSignal }) => { + const { stationCode, signal } = options ?? {}; + const client = stationCode ? ndmClient : userClient; + const prefix = stationCode ? `/${stationCode}` : ''; + const endpoint = `${prefix}/api/ndm/ndmNvr/defaultExportByTemplate`; + const resp = await client.post(endpoint, pageQuery, { responseType: 'blob', retRaw: true, signal }); + const [err, data] = resp; + if (err) throw err; + if (!data) throw new Error(`${data}`); + return data; +}; + +export const importNvrApi = async (file: File, options?: { stationCode?: Station['code']; signal?: AbortSignal }) => { + const { stationCode, signal } = options ?? {}; + const client = stationCode ? ndmClient : userClient; + const prefix = stationCode ? `/${stationCode}` : ''; + const endpoint = `${prefix}/api/ndm/ndmNvr/importReturnMsg`; + const formData = new FormData(); + formData.append('file', file); + const resp = await client.post(endpoint, formData, { signal, upload: true }); + const [err, data] = resp; + if (err) throw err; + if (!data) throw new Error(`${data}`); + return data; +}; + export const probeNvrApi = async (ids: string[], options?: { stationCode?: Station['code']; signal?: AbortSignal }) => { const { stationCode, signal } = options ?? {}; const client = stationCode ? ndmClient : userClient; diff --git a/src/apis/request/biz/video/ndm-camera.ts b/src/apis/request/biz/video/ndm-camera.ts index efbf572..96bb10b 100644 --- a/src/apis/request/biz/video/ndm-camera.ts +++ b/src/apis/request/biz/video/ndm-camera.ts @@ -1,6 +1,7 @@ import { ndmClient, userClient, + type ImportMsg, type NdmCameraPageQuery, type NdmCameraResultVO, type NdmCameraSaveVO, @@ -71,6 +72,32 @@ export const deleteCameraApi = async (ids: string[], options?: { stationCode?: S return data; }; +export const exportCameraApi = async (pageQuery: PageParams, options?: { stationCode?: Station['code']; signal?: AbortSignal }) => { + const { stationCode, signal } = options ?? {}; + const client = stationCode ? ndmClient : userClient; + const prefix = stationCode ? `/${stationCode}` : ''; + const endpoint = `${prefix}/api/ndm/ndmCamera/defaultExportByTemplate`; + const resp = await client.post(endpoint, pageQuery, { responseType: 'blob', retRaw: true, signal }); + const [err, data] = resp; + if (err) throw err; + if (!data) throw new Error(`${data}`); + return data; +}; + +export const importCameraApi = async (file: File, options?: { stationCode?: Station['code']; signal?: AbortSignal }) => { + const { stationCode, signal } = options ?? {}; + const client = stationCode ? ndmClient : userClient; + const prefix = stationCode ? `/${stationCode}` : ''; + const endpoint = `${prefix}/api/ndm/ndmCamera/importReturnMsg`; + const formData = new FormData(); + formData.append('file', file); + const resp = await client.post(endpoint, formData, { signal, upload: true }); + const [err, data] = resp; + if (err) throw err; + if (!data) throw new Error(`${data}`); + return data; +}; + export const getCameraSnapApi = async (deviceId: string, options?: { signal?: AbortSignal }) => { const { signal } = options ?? {}; const endpoint = `/api/ndm/ndmCamera/getSnapByDeviceId`; diff --git a/src/apis/request/biz/video/ndm-decoder.ts b/src/apis/request/biz/video/ndm-decoder.ts index bf901b0..060f47f 100644 --- a/src/apis/request/biz/video/ndm-decoder.ts +++ b/src/apis/request/biz/video/ndm-decoder.ts @@ -1,4 +1,15 @@ -import { ndmClient, userClient, type NdmDecoderPageQuery, type NdmDecoderResultVO, type NdmDecoderSaveVO, type NdmDecoderUpdateVO, type PageParams, type PageResult, type Station } from '@/apis'; +import { + ndmClient, + userClient, + type ImportMsg, + type NdmDecoderPageQuery, + type NdmDecoderResultVO, + type NdmDecoderSaveVO, + type NdmDecoderUpdateVO, + type PageParams, + type PageResult, + type Station, +} from '@/apis'; export const pageDecoderApi = async (pageQuery: PageParams, options?: { stationCode?: Station['code']; signal?: AbortSignal }) => { const { stationCode, signal } = options ?? {}; @@ -60,6 +71,32 @@ export const deleteDecoderApi = async (ids: string[], options?: { stationCode?: return data; }; +export const exportDecoderApi = async (pageQuery: PageParams, options?: { stationCode?: Station['code']; signal?: AbortSignal }) => { + const { stationCode, signal } = options ?? {}; + const client = stationCode ? ndmClient : userClient; + const prefix = stationCode ? `/${stationCode}` : ''; + const endpoint = `${prefix}/api/ndm/ndmDecoder/defaultExportByTemplate`; + const resp = await client.post(endpoint, pageQuery, { responseType: 'blob', retRaw: true, signal }); + const [err, data] = resp; + if (err) throw err; + if (!data) throw new Error(`${data}`); + return data; +}; + +export const importDecoderApi = async (file: File, options?: { stationCode?: Station['code']; signal?: AbortSignal }) => { + const { stationCode, signal } = options ?? {}; + const client = stationCode ? ndmClient : userClient; + const prefix = stationCode ? `/${stationCode}` : ''; + const endpoint = `${prefix}/api/ndm/ndmDecoder/importReturnMsg`; + const formData = new FormData(); + formData.append('file', file); + const resp = await client.post(endpoint, formData, { signal, upload: true }); + const [err, data] = resp; + if (err) throw err; + if (!data) throw new Error(`${data}`); + return data; +}; + export const probeDecoderApi = async (ids: string[], options?: { stationCode?: Station['code']; signal?: AbortSignal }) => { const { stationCode, signal } = options ?? {}; const client = stationCode ? ndmClient : userClient; diff --git a/src/apis/request/biz/video/ndm-keyboard.ts b/src/apis/request/biz/video/ndm-keyboard.ts index 8bae6a8..62978da 100644 --- a/src/apis/request/biz/video/ndm-keyboard.ts +++ b/src/apis/request/biz/video/ndm-keyboard.ts @@ -1,4 +1,15 @@ -import { ndmClient, userClient, type NdmKeyboardPageQuery, type NdmKeyboardResultVO, type NdmKeyboardSaveVO, type NdmKeyboardUpdateVO, type PageParams, type PageResult, type Station } from '@/apis'; +import { + ndmClient, + userClient, + type ImportMsg, + type NdmKeyboardPageQuery, + type NdmKeyboardResultVO, + type NdmKeyboardSaveVO, + type NdmKeyboardUpdateVO, + type PageParams, + type PageResult, + type Station, +} from '@/apis'; export const pageKeyboardApi = async (pageQuery: PageParams, options?: { stationCode?: Station['code']; signal?: AbortSignal }) => { const { stationCode, signal } = options ?? {}; @@ -59,3 +70,29 @@ export const deleteKeyboardApi = async (ids: string[], options?: { stationCode?: if (!data) throw new Error(`${data}`); return data; }; + +export const exportKeyboardApi = async (pageQuery: PageParams, options?: { stationCode?: Station['code']; signal?: AbortSignal }) => { + const { stationCode, signal } = options ?? {}; + const client = stationCode ? ndmClient : userClient; + const prefix = stationCode ? `/${stationCode}` : ''; + const endpoint = `${prefix}/api/ndm/ndmKeyboard/defaultExportByTemplate`; + const resp = await client.post(endpoint, pageQuery, { responseType: 'blob', retRaw: true, signal }); + const [err, data] = resp; + if (err) throw err; + if (!data) throw new Error(`${data}`); + return data; +}; + +export const importKeyboardApi = async (file: File, options?: { stationCode?: Station['code']; signal?: AbortSignal }) => { + const { stationCode, signal } = options ?? {}; + const client = stationCode ? ndmClient : userClient; + const prefix = stationCode ? `/${stationCode}` : ''; + const endpoint = `${prefix}/api/ndm/ndmKeyboard/importReturnMsg`; + const formData = new FormData(); + formData.append('file', file); + const resp = await client.post(endpoint, formData, { signal, upload: true }); + const [err, data] = resp; + if (err) throw err; + if (!data) throw new Error(`${data}`); + return data; +}; diff --git a/src/apis/request/biz/video/ndm-media-server.ts b/src/apis/request/biz/video/ndm-media-server.ts index fe67ec2..09f5a37 100644 --- a/src/apis/request/biz/video/ndm-media-server.ts +++ b/src/apis/request/biz/video/ndm-media-server.ts @@ -1,6 +1,7 @@ import { ndmClient, userClient, + type ImportMsg, type NdmMediaServerPageQuery, type NdmMediaServerResultVO, type NdmMediaServerSaveVO, @@ -70,6 +71,32 @@ export const deleteMediaServerApi = async (ids: string[], options?: { stationCod return data; }; +export const exportMediaServerApi = async (pageQuery: PageParams, options?: { stationCode?: Station['code']; signal?: AbortSignal }) => { + const { stationCode, signal } = options ?? {}; + const client = stationCode ? ndmClient : userClient; + const prefix = stationCode ? `/${stationCode}` : ''; + const endpoint = `${prefix}/api/ndm/ndmMediaServer/defaultExportByTemplate`; + const resp = await client.post(endpoint, pageQuery, { responseType: 'blob', retRaw: true, signal }); + const [err, data] = resp; + if (err) throw err; + if (!data) throw new Error(`${data}`); + return data; +}; + +export const importMediaServerApi = async (file: File, options?: { stationCode?: Station['code']; signal?: AbortSignal }) => { + const { stationCode, signal } = options ?? {}; + const client = stationCode ? ndmClient : userClient; + const prefix = stationCode ? `/${stationCode}` : ''; + const endpoint = `${prefix}/api/ndm/ndmMediaServer/importReturnMsg`; + const formData = new FormData(); + formData.append('file', file); + const resp = await client.post(endpoint, formData, { signal, upload: true }); + const [err, data] = resp; + if (err) throw err; + if (!data) throw new Error(`${data}`); + return data; +}; + export const probeMediaServerApi = async (ids: string[], options?: { stationCode?: Station['code']; signal?: AbortSignal }) => { const { stationCode, signal } = options ?? {}; const client = stationCode ? ndmClient : userClient; diff --git a/src/apis/request/biz/video/ndm-video-server.ts b/src/apis/request/biz/video/ndm-video-server.ts index a4a46bf..811df47 100644 --- a/src/apis/request/biz/video/ndm-video-server.ts +++ b/src/apis/request/biz/video/ndm-video-server.ts @@ -1,6 +1,7 @@ import { ndmClient, userClient, + type ImportMsg, type NdmVideoServerPageQuery, type NdmVideoServerResultVO, type NdmVideoServerSaveVO, @@ -70,6 +71,32 @@ export const deleteVideoServerApi = async (ids: string[], options?: { stationCod return data; }; +export const exportVideoServerApi = async (pageQuery: PageParams, options?: { stationCode?: Station['code']; signal?: AbortSignal }) => { + const { stationCode, signal } = options ?? {}; + const client = stationCode ? ndmClient : userClient; + const prefix = stationCode ? `/${stationCode}` : ''; + const endpoint = `${prefix}/api/ndm/ndmVideoServer/defaultExportByTemplate`; + const resp = await client.post(endpoint, pageQuery, { responseType: 'blob', retRaw: true, signal }); + const [err, data] = resp; + if (err) throw err; + if (!data) throw new Error(`${data}`); + return data; +}; + +export const importVideoServerApi = async (file: File, options?: { stationCode?: Station['code']; signal?: AbortSignal }) => { + const { stationCode, signal } = options ?? {}; + const client = stationCode ? ndmClient : userClient; + const prefix = stationCode ? `/${stationCode}` : ''; + const endpoint = `${prefix}/api/ndm/ndmVideoServer/importReturnMsg`; + const formData = new FormData(); + formData.append('file', file); + const resp = await client.post(endpoint, formData, { signal, upload: true }); + const [err, data] = resp; + if (err) throw err; + if (!data) throw new Error(`${data}`); + return data; +}; + export const probeVideoServerApi = async (ids: string[], options?: { stationCode?: Station['code']; signal?: AbortSignal }) => { const { stationCode, signal } = options ?? {}; const client = stationCode ? ndmClient : userClient;