modelOfMatter.ts
1.49 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
61
62
import { BasicPageParams } from '../model/baseModel';
import { GetModelTslParams, ModelOfMatterParams } from './model/modelOfMatterModel';
import { defHttp } from '/@/utils/http/axios';
import { FunctionType } from '/@/views/device/profiles/step/cpns/physical/cpns/config';
enum ModelOfMatter {
CREATE = '/things_model',
UPDATE = '/things_model',
DELETE = '/things_model',
TSL = '/things_model',
LIST = '/things_model/page',
RELEASE = '/things_model',
}
export const getModelList = (
params: BasicPageParams & {
deviceProfileId: string;
functionTyp?: FunctionType;
nameOrIdentifier?: string;
}
) => {
return defHttp.get({
url: `${ModelOfMatter.LIST}`,
params,
});
};
export const getModelTsl = (params: GetModelTslParams) => {
const { functionType, deviceProfileId } = params;
return defHttp.get({
url: `${ModelOfMatter.TSL}/${functionType}/${deviceProfileId}`,
});
};
export const createModel = (params: Partial<ModelOfMatterParams>) => {
return defHttp.post({
url: ModelOfMatter.CREATE,
params,
});
};
export const updateModel = (params: Partial<ModelOfMatterParams>) => {
return defHttp.put({
url: ModelOfMatter.UPDATE,
params,
});
};
export const deleteModel = (params: string[]) => {
return defHttp.delete({
url: ModelOfMatter.DELETE,
params: {
ids: params,
},
});
};
export const releaseModel = (deviceProfileId: string) => {
return defHttp.put({
url: `${ModelOfMatter.RELEASE}/${deviceProfileId}`,
});
};