52 lines
1.3 KiB
TypeScript
52 lines
1.3 KiB
TypeScript
import { http } from '@/utils/http';
|
|
|
|
export interface SearchMqttServerQuery extends BasePageQuery {
|
|
serverUrl?: string;
|
|
username?: string;
|
|
}
|
|
|
|
export interface MqttServerDTO {
|
|
mqttServerId?: number;
|
|
serverUrl: string;
|
|
username: string;
|
|
password: string;
|
|
topicFilter: string;
|
|
publishTopic: string;
|
|
}
|
|
|
|
export interface AddMqttServerCommand {
|
|
serverUrl: string;
|
|
username: string;
|
|
password: string;
|
|
topicFilter: string;
|
|
publishTopic: string;
|
|
}
|
|
|
|
export interface UpdateMqttServerCommand extends AddMqttServerCommand {
|
|
mqttServerId: number;
|
|
}
|
|
|
|
export const getMqttServerList = (params?: SearchMqttServerQuery) => {
|
|
return http.request<ResponseData<PageDTO<MqttServerDTO>>>('get', '/cabinet/mqttServer', {
|
|
params
|
|
});
|
|
};
|
|
|
|
export const addMqttServer = (data: AddMqttServerCommand) => {
|
|
return http.request<ResponseData<void>>('post', '/cabinet/mqttServer', {
|
|
data
|
|
});
|
|
};
|
|
|
|
export const updateMqttServer = (serverId: number, data: UpdateMqttServerCommand) => {
|
|
return http.request<ResponseData<void>>('put', `/cabinet/mqttServer/${serverId}`, {
|
|
data: {
|
|
...data,
|
|
mqttServerId: serverId
|
|
}
|
|
});
|
|
};
|
|
|
|
export const deleteMqttServer = (ids: string) => {
|
|
return http.request<ResponseData<void>>('delete', `/cabinet/mqttServer/${ids}`);
|
|
}; |