X-Git-Url: https://git.piment-noir.org/?a=blobdiff_plain;f=ui%2Fweb%2Fsrc%2Ftypes%2FUIProtocol.ts;h=5b3efcdcef1efb81cccc8eeddc5525ccda0797f1;hb=e82376450bef7a755869accf8f662826147832d8;hp=15b4b07ca5b8881562288b0c5e4a26f196da961f;hpb=f3095697dad156dcb13ea8247a16eb08ca007e6b;p=e-mobility-charging-stations-simulator.git diff --git a/ui/web/src/types/UIProtocol.ts b/ui/web/src/types/UIProtocol.ts index 15b4b07c..5b3efcdc 100644 --- a/ui/web/src/types/UIProtocol.ts +++ b/ui/web/src/types/UIProtocol.ts @@ -1,29 +1,38 @@ -import type { JsonObject } from './JsonType'; +import type { JsonObject } from './JsonType' export enum Protocol { - UI = 'ui', + UI = 'ui' } export enum ApplicationProtocol { - HTTP = 'http', WS = 'ws', + WSS = 'wss' } export enum ProtocolVersion { - '0.0.1' = '0.0.1', + '0.0.1' = '0.0.1' } -export type ProtocolRequest = [string, ProcedureName, RequestPayload]; -export type ProtocolResponse = [string, ResponsePayload]; +export enum AuthenticationType { + PROTOCOL_BASIC_AUTH = 'protocol-basic-auth' +} + +export type ProtocolRequest = [string, ProcedureName, RequestPayload] +export type ProtocolResponse = [string, ResponsePayload] export type ProtocolRequestHandler = ( - payload: RequestPayload, -) => ResponsePayload | Promise; + payload: RequestPayload +) => ResponsePayload | Promise export enum ProcedureName { + SIMULATOR_STATE = 'simulatorState', START_SIMULATOR = 'startSimulator', STOP_SIMULATOR = 'stopSimulator', + LIST_TEMPLATES = 'listTemplates', LIST_CHARGING_STATIONS = 'listChargingStations', + ADD_CHARGING_STATIONS = 'addChargingStations', + DELETE_CHARGING_STATIONS = 'deleteChargingStations', + SET_SUPERVISION_URL = 'setSupervisionUrl', START_CHARGING_STATION = 'startChargingStation', STOP_CHARGING_STATION = 'stopChargingStation', OPEN_CONNECTION = 'openConnection', @@ -31,20 +40,33 @@ export enum ProcedureName { START_AUTOMATIC_TRANSACTION_GENERATOR = 'startAutomaticTransactionGenerator', STOP_AUTOMATIC_TRANSACTION_GENERATOR = 'stopAutomaticTransactionGenerator', START_TRANSACTION = 'startTransaction', - STOP_TRANSACTION = 'stopTransaction', + STOP_TRANSACTION = 'stopTransaction' } export interface RequestPayload extends JsonObject { - hashIds?: string[]; - connectorIds?: number[]; + hashIds?: string[] + connectorIds?: number[] } export enum ResponseStatus { SUCCESS = 'success', - FAILURE = 'failure', + FAILURE = 'failure' } export interface ResponsePayload extends JsonObject { - status: ResponseStatus; - hashIds?: string[]; + status: ResponseStatus + hashIds?: string[] +} + +interface TemplateStatistics extends JsonObject { + configured: number + added: number + started: number + indexes: number[] +} + +export interface SimulatorState extends JsonObject { + version: string + started: boolean + templateStatistics: Record }