index overview
Table of contents
Handler
RequestHandler (type alias)
TS is still not very good with dependent-typing (i.e. making the return type differ on the input type) so when using this it is advisable to do type assertions.
Signature
export type RequestHandler<T extends ActionName<V>, Metadata = undefined, V extends OCPPVersion = OCPPVersion> = (
request: Request<T, V>,
extra: Metadata
) => Result<Response<T, V>>
Message Type
Request (type alias)
Signature
export type Request<T extends ActionName<V>, V extends OCPPVersion = OCPPVersion> = ReqRes<T, V>['request']
Example
import { Request } from '@voltbras/ts-ocpp'
type ChargeRelatedRequest = Request<'StartTransaction' | 'StopTransaction'>
Response (type alias)
Signature
export type Response<T extends ActionName<V>, V extends OCPPVersion = OCPPVersion> = ReqRes<T, V>['response']
Example
import { Response } from '@voltbras/ts-ocpp'
type ChargeRelatedResponse = Response<'StartTransaction' | 'StopTransaction'>
utils
ActionName (type alias)
Signature
export type ActionName<V extends OCPPVersion = OCPPVersion> = ChargePointAction<V> | CentralSystemAction<V>