2017-10-10 16:25:21 -06:00
|
|
|
import { Response as ResponseData } from "@common/sprinklers/requests";
|
|
|
|
|
2018-06-29 14:48:42 -06:00
|
|
|
export interface IError {
|
|
|
|
type: "error";
|
|
|
|
message: string;
|
|
|
|
data: any;
|
|
|
|
}
|
|
|
|
|
2018-06-29 18:16:06 -06:00
|
|
|
export interface IDeviceSubscribeResponse {
|
|
|
|
type: "deviceSubscribeResponse";
|
|
|
|
deviceId: string;
|
|
|
|
result: "success" | "noPermission";
|
|
|
|
}
|
|
|
|
|
2017-10-09 08:09:08 -06:00
|
|
|
export interface IDeviceUpdate {
|
|
|
|
type: "deviceUpdate";
|
2018-06-29 14:48:42 -06:00
|
|
|
deviceId: string;
|
2017-10-09 08:09:08 -06:00
|
|
|
data: any;
|
|
|
|
}
|
|
|
|
|
|
|
|
export interface IDeviceCallResponse {
|
|
|
|
type: "deviceCallResponse";
|
2018-06-30 14:49:13 -06:00
|
|
|
requestId: number;
|
2017-10-10 16:25:21 -06:00
|
|
|
data: ResponseData;
|
2017-10-09 08:09:08 -06:00
|
|
|
}
|
|
|
|
|
2018-06-16 23:54:03 -06:00
|
|
|
export interface IBrokerConnectionUpdate {
|
|
|
|
type: "brokerConnectionUpdate";
|
|
|
|
brokerConnected: boolean;
|
|
|
|
}
|
|
|
|
|
2018-06-29 18:16:06 -06:00
|
|
|
export type IServerMessage = IError | IDeviceSubscribeResponse | IDeviceUpdate | IDeviceCallResponse |
|
|
|
|
IBrokerConnectionUpdate;
|
2018-06-29 14:48:42 -06:00
|
|
|
|
2018-06-30 14:49:13 -06:00
|
|
|
export interface IAuthenticateRequest {
|
|
|
|
type: "authenticateRequest";
|
|
|
|
accessToken: string;
|
|
|
|
}
|
|
|
|
|
2018-06-29 14:48:42 -06:00
|
|
|
export interface IDeviceSubscribeRequest {
|
|
|
|
type: "deviceSubscribeRequest";
|
|
|
|
deviceId: string;
|
|
|
|
}
|
2017-10-09 08:09:08 -06:00
|
|
|
|
|
|
|
export interface IDeviceCallRequest {
|
|
|
|
type: "deviceCallRequest";
|
2018-06-30 14:49:13 -06:00
|
|
|
requestId: number;
|
2018-06-29 14:48:42 -06:00
|
|
|
deviceId: string;
|
2017-10-10 16:25:21 -06:00
|
|
|
data: any;
|
2017-10-09 08:09:08 -06:00
|
|
|
}
|
|
|
|
|
2018-06-29 14:48:42 -06:00
|
|
|
export type IClientMessage = IDeviceSubscribeRequest | IDeviceCallRequest;
|