19 lines
627 B
TypeScript
19 lines
627 B
TypeScript
import { get, post } from './request';
|
|
import type { Device, ControlCommand } from '@/types';
|
|
|
|
export function getDevices(params?: Record<string, unknown>): Promise<Device[]> {
|
|
return get<Device[]>('/devices', params);
|
|
}
|
|
|
|
export function getDevice(id: string): Promise<Device> {
|
|
return get<Device>(`/devices/${id}`);
|
|
}
|
|
|
|
export function sendControl(command: ControlCommand): Promise<unknown> {
|
|
return post<unknown>('/control/send', command as unknown as Record<string, unknown>);
|
|
}
|
|
|
|
export function getControlLogs(params?: Record<string, unknown>): Promise<unknown[]> {
|
|
return get<unknown[]>('/control/logs', params);
|
|
}
|