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.92 kB
// SPDX-FileCopyrightText: 2025 Contributors to the CitrineOS Project // // SPDX-License-Identifier: Apache-2.0 import { OcppError } from '../ocpp/rpc/message.js'; import { EventGroup, MessageOrigin, MessageState } from '../interfaces/messages/internal-types.js'; export class RequestBuilder { static buildCall(ocppConnectionName, correlationId, tenantId, action, payload, eventGroup, origin, protocol, timestamp = new Date()) { return { origin: origin, eventGroup: eventGroup, action, context: { ocppConnectionName, correlationId, tenantId, timestamp: timestamp.toISOString(), }, state: MessageState.Request, protocol, payload, }; } static buildCallResult(ocppConnectionName, correlationId, tenantId, action, payload, eventGroup, origin, protocol, timestamp = new Date()) { return { origin: origin, eventGroup: eventGroup, action, context: { ocppConnectionName, correlationId, tenantId, timestamp: timestamp.toISOString(), }, state: MessageState.Response, protocol, payload, }; } static buildCallError(ocppConnectionName, correlationId, tenantId, action, payload, eventGroup, origin, protocol, timestamp = new Date()) { return { origin: origin, eventGroup: eventGroup, action, context: { ocppConnectionName, correlationId, tenantId, timestamp: timestamp.toISOString(), }, state: MessageState.Response, protocol, payload, }; } } //# sourceMappingURL=request.js.map