import * as rpc from "../jsonRpc/index"; import { IUser } from "@common/httpApi"; import { Response as ResponseData } from "@common/sprinklersRpc/deviceRequests"; export interface IAuthenticateRequest { accessToken: string; } export interface IDeviceSubscribeRequest { deviceId: string; } export interface IDeviceCallRequest { deviceId: string; data: any; } export interface IClientRequestTypes { "authenticate": IAuthenticateRequest; "deviceSubscribe": IDeviceSubscribeRequest; "deviceUnsubscribe": IDeviceSubscribeRequest; "deviceCall": IDeviceCallRequest; } export interface IAuthenticateResponse { authenticated: boolean; message: string; user: IUser; } export interface IDeviceSubscribeResponse { deviceId: string; } export interface IDeviceCallResponse { data: ResponseData; } export interface IServerResponseTypes { "authenticate": IAuthenticateResponse; "deviceSubscribe": IDeviceSubscribeResponse; "deviceUnsubscribe": IDeviceSubscribeResponse; "deviceCall": IDeviceCallResponse; } export type ClientRequestMethods = keyof IClientRequestTypes; export interface IBrokerConnectionUpdate { brokerConnected: boolean; } export interface IDeviceUpdate { deviceId: string; data: any; } export interface IServerNotificationTypes { "brokerConnectionUpdate": IBrokerConnectionUpdate; "deviceUpdate": IDeviceUpdate; "error": IError; } export type ServerNotificationMethod = keyof IServerNotificationTypes; export type IError = rpc.DefaultErrorType; export type ErrorData = rpc.ErrorData; export type ServerMessage = rpc.Message<{}, IServerResponseTypes, IError, IServerNotificationTypes>; export type ServerNotification = rpc.Notification; export type ServerResponse = rpc.Response; export type ServerResponseData = rpc.ResponseData; export type ServerResponseHandlers = rpc.ResponseHandlers; export type ServerNotificationHandlers = rpc.NotificationHandlers; export type ClientRequest = rpc.Request; export type ClientMessage = rpc.Message; export type ClientRequestHandlers = rpc.RequestHandlers;