index.ts
1.74 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
import { defHttp } from '@/utils/external/http/axios';
import { DeviceAttributesRecord, GetDeviceListParams, PublicInterfaceRecord, PublicInterfaceStateEnum } from './model';
import { PaginationResult } from '/#/external/axios';
enum Api {
PUBLIC_API = '/data_view_interface',
ORG_LISt = '/organization/me/list',
DEVICE_PROFILE_LIST = '/device_profile/me/list',
DEVICE_LIST = '/device/list',
DEVICE_ATTR_LIST = '/device/attributes',
GET_PUBLIC_INTERFACE_ALL = '/data_view_interface/find_all_interface',
GET_PUBLIC_INTERFACE_DETAIL = '/data_view_interface/get_interface_details'
}
export const getPublicInterface = async (params: Record<'page' | 'pageSize', number>) => {
return defHttp.get<PaginationResult<PublicInterfaceRecord>>({
url: Api.PUBLIC_API,
params
})
}
export const getOrgList = async () => {
return defHttp.get({
url: Api.ORG_LISt
})
}
export const getDeviceProfileList = async (params?: Record<'deviceType', string>) => {
return defHttp.get({
url: Api.DEVICE_PROFILE_LIST,
params
})
}
export const getDeviceList = async (params?: GetDeviceListParams) => {
return defHttp.get({
url: Api.DEVICE_LIST,
params
})
}
export const getDeviceAttrList = async (deviceProfileId: string) => {
return defHttp.get<DeviceAttributesRecord[]>({
url: `${Api.DEVICE_ATTR_LIST}/${deviceProfileId}`
})
}
export const getDeviceInterfaceDetail = async (interfaces: string[]) => {
return defHttp.get({
url: Api.GET_PUBLIC_INTERFACE_DETAIL,
params: interfaces
})
}
export const getAllPublicInterface = async (params?: { state: PublicInterfaceStateEnum }) => {
return defHttp.get<PublicInterfaceRecord[]>({
url: `${Api.GET_PUBLIC_INTERFACE_ALL}${params?.state ? `/${params.state}` : ''}`
})
}