@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.
78 lines (77 loc) • 4.19 kB
TypeScript
import type { BootstrapConfig, IMessageRouter, INetworkConnection, SystemConfig, WebsocketServerConfig } from '@citrineos/base';
import { AbstractModuleApi, Namespace, OCPP1_6_Namespace, OCPP2_0_1_Namespace } from '@citrineos/base';
import type { ChargingStationKeyQuerystring, ConnectionDeleteQuerystring, IServerNetworkProfileRepository, ISubscriptionRepository, ModelKeyQuerystring, TenantQueryString, WebsocketDeleteQuerystring, WebsocketGetQuerystring, WebsocketMappingQuerystring } from '@citrineos/data';
import { Subscription } from '@citrineos/data';
import type { FastifyInstance, FastifyRequest } from 'fastify';
import type { ILogObj } from 'tslog';
import { Logger } from 'tslog';
import type { IAdminApi } from './interface.js';
/**
* Admin API for the OcppRouter.
*/
export declare class AdminApi extends AbstractModuleApi<IMessageRouter> implements IAdminApi {
private _networkConnection;
private _subscriptionRepository;
private _serverNetworkProfileRepository;
/**
* Constructs a new instance of the class.
*
* @param {IMessageRouter} ocppRouter - The OcppRouter module.
* @param {INetworkConnection} networkConnection - The network connection instance.
* @param {FastifyInstance} server - The Fastify server instance.
* @param {BootstrapConfig & SystemConfig} config - The configuration instance.
* @param {Logger<ILogObj>} [logger] - The logger instance.
* @param {ISubscriptionRepository} [subscriptionRepository] - The subscription repository instance.
* @param {IServerNetworkProfileRepository} [serverNetworkProfileRepository] - The server network profile repository instance.
*/
constructor(ocppRouter: IMessageRouter, networkConnection: INetworkConnection, server: FastifyInstance, config: BootstrapConfig & SystemConfig, logger?: Logger<ILogObj>, subscriptionRepository?: ISubscriptionRepository, serverNetworkProfileRepository?: IServerNetworkProfileRepository);
/**
* 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;
Querystring: TenantQueryString;
}>): Promise<number>;
getSubscriptionsByChargingStation(request: FastifyRequest<{
Querystring: ChargingStationKeyQuerystring;
}>): Promise<Subscription[]>;
deleteSubscriptionById(request: FastifyRequest<{
Querystring: ModelKeyQuerystring;
}>): Promise<boolean>;
getWebsocketConfigurations(request: FastifyRequest<{
Querystring: WebsocketGetQuerystring;
}>): Promise<WebsocketServerConfig[] | WebsocketServerConfig>;
createWebsocketConfiguration(request: FastifyRequest<{
Body: WebsocketServerConfig;
}>): Promise<WebsocketServerConfig>;
/**
* Adds or updates a mapping from a path segment to a tenant for a specific websocket server.
*/
putWebsocketMapping(request: FastifyRequest<{
Querystring: WebsocketMappingQuerystring;
}>): Promise<WebsocketServerConfig>;
/**
* Removes a mapping for a specific path OR all mappings for a specific tenant from a websocket server.
*/
deleteWebsocketMapping(request: FastifyRequest<{
Querystring: WebsocketMappingQuerystring;
}>): Promise<WebsocketServerConfig>;
deleteWebsocketConfiguration(request: FastifyRequest<{
Querystring: WebsocketDeleteQuerystring;
}>): Promise<void>;
deleteWebsocketConnection(request: FastifyRequest<{
Querystring: ConnectionDeleteQuerystring;
}>): Promise<void>;
/**
* 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;
}