@citrineos/ocpprouter
Version:
The ocpprouter module for OCPP v2.0.1. This module is not intended to be used directly, but rather as a dependency for other modules.
44 lines (43 loc) • 2 kB
TypeScript
import { AbstractModuleApi, Namespace, OCPP1_6_Namespace, OCPP2_0_1_Namespace } from '@citrineos/base';
import { FastifyInstance, FastifyRequest } from 'fastify';
import { ILogObj, Logger } from 'tslog';
import { IAdminApi } from './interface';
import { MessageRouterImpl } from './router';
import { ChargingStationKeyQuerystring, ModelKeyQuerystring, Subscription } from '@citrineos/data';
/**
* Admin API for the OcppRouter.
*/
export declare class AdminApi extends AbstractModuleApi<MessageRouterImpl> implements IAdminApi {
/**
* Constructs a new instance of the class.
*
* @param {MessageRouterImpl} ocppRouter - The OcppRouter module.
* @param {FastifyInstance} server - The Fastify server instance.
* @param {Logger<ILogObj>} [logger] - The logger instance.
*/
constructor(ocppRouter: MessageRouterImpl, server: FastifyInstance, logger?: Logger<ILogObj>);
/**
* Creates a {@link Subscription}.
* Will always create a new entity and return its id.
*
* @param {FastifyRequest<{ Body: Subscription }>} request - The request object, containing the body which is parsed as a {@link Subscription}.
* @return {Promise<number>} The id of the created subscription.
*/
postSubscription(request: FastifyRequest<{
Body: Subscription;
}>): Promise<number>;
getSubscriptionsByChargingStation(request: FastifyRequest<{
Querystring: ChargingStationKeyQuerystring;
}>): Promise<Subscription[]>;
deleteSubscriptionById(request: FastifyRequest<{
Querystring: ModelKeyQuerystring;
}>): Promise<boolean>;
/**
* Overrides superclass method to generate the URL path based on the input {@link Namespace}
* and the module's endpoint prefix configuration.
*
* @param {Namespace} input - The input {@link Namespace}.
* @return {string} - The generated URL path.
*/
protected _toDataPath(input: OCPP2_0_1_Namespace | OCPP1_6_Namespace | Namespace): string;
}