Commit | Line | Data |
---|---|---|
6c1761d4 | 1 | import type { JsonObject } from './JsonType'; |
d1888640 | 2 | |
4198ad5c JB |
3 | export enum Protocol { |
4 | UI = 'ui', | |
5 | } | |
8244f5f0 | 6 | |
675fa8e3 JB |
7 | export enum ApplicationProtocol { |
8 | HTTP = 'http', | |
9 | WS = 'ws', | |
10 | } | |
11 | ||
8244f5f0 JB |
12 | export enum ProtocolVersion { |
13 | '0.0.1' = '0.0.1', | |
8244f5f0 JB |
14 | } |
15 | ||
89b7a234 JB |
16 | export type ProtocolRequest = [string, ProcedureName, RequestPayload]; |
17 | export type ProtocolResponse = [string, ResponsePayload]; | |
18 | ||
19 | export type ProtocolRequestHandler = ( | |
4e3ff94d JB |
20 | uuid?: string, |
21 | payload?: RequestPayload | |
6c8f5d90 | 22 | ) => undefined | Promise<undefined> | ResponsePayload | Promise<ResponsePayload>; |
89b7a234 | 23 | |
32de5a57 | 24 | export enum ProcedureName { |
ee0f106b | 25 | LIST_CHARGING_STATIONS = 'listChargingStations', |
89b7a234 JB |
26 | START_CHARGING_STATION = 'startChargingStation', |
27 | STOP_CHARGING_STATION = 'stopChargingStation', | |
32de5a57 LM |
28 | START_SIMULATOR = 'startSimulator', |
29 | STOP_SIMULATOR = 'stopSimulator', | |
db2336d9 JB |
30 | OPEN_CONNECTION = 'openConnection', |
31 | CLOSE_CONNECTION = 'closeConnection', | |
4f69be04 JB |
32 | START_TRANSACTION = 'startTransaction', |
33 | STOP_TRANSACTION = 'stopTransaction', | |
34 | START_AUTOMATIC_TRANSACTION_GENERATOR = 'startAutomaticTransactionGenerator', | |
35 | STOP_AUTOMATIC_TRANSACTION_GENERATOR = 'stopAutomaticTransactionGenerator', | |
8244f5f0 | 36 | } |
5612b691 | 37 | |
89b7a234 | 38 | export interface RequestPayload extends JsonObject { |
4eca248c | 39 | hashIds?: string[]; |
757b2ecf | 40 | connectorIds?: number[]; |
89b7a234 | 41 | } |
8244f5f0 | 42 | |
32de5a57 LM |
43 | export enum ResponseStatus { |
44 | SUCCESS = 'success', | |
45 | FAILURE = 'failure', | |
46 | } | |
47 | ||
48 | export interface ResponsePayload extends JsonObject { | |
49 | status: ResponseStatus; | |
0d2cec76 JB |
50 | hashIdsSucceeded?: string[]; |
51 | hashIdsFailed?: string[]; | |
32de5a57 | 52 | } |