UNPKG

@citrineos/base

Version:

The base module for OCPP v2.0.1 including all interfaces. This module is not intended to be used directly, but rather as a dependency for other modules.

56 lines 1.76 kB
// Copyright (c) 2023 S44, LLC // Copyright Contributors to the CitrineOS Project // // SPDX-License-Identifier: Apache 2.0 import { MessageState, } from '..'; export class RequestBuilder { static buildCall(stationId, correlationId, tenantId, action, payload, eventGroup, origin, protocol, timestamp = new Date()) { return { origin: origin, eventGroup: eventGroup, action, context: { stationId, correlationId, tenantId, timestamp: timestamp.toISOString(), }, state: MessageState.Request, protocol, payload, }; } static buildCallResult(stationId, correlationId, tenantId, action, payload, eventGroup, origin, protocol, timestamp = new Date()) { return { origin: origin, eventGroup: eventGroup, action, context: { stationId, correlationId, tenantId, timestamp: timestamp.toISOString(), }, state: MessageState.Response, protocol, payload, }; } static buildCallError(stationId, correlationId, tenantId, action, payload, eventGroup, origin, protocol, timestamp = new Date()) { return { origin: origin, eventGroup: eventGroup, action, context: { stationId, correlationId, tenantId, timestamp: timestamp.toISOString(), }, state: MessageState.Response, protocol, payload, }; } } //# sourceMappingURL=request.js.map