Added OCPI documentation
MODIFY
src/assets/server/rest/v1/docs/e-mobility-oas.json
src/assets/server/rest/v1/docs/e-mobility-oas.json
"$ref": "#/components/parameters/OCPIEndpointID"
}
],
- "requestBody": {
- "content": {
- "application/json": {
- "schema": {
- "$ref": "#/components/schemas/OCPIEndpoint"
- }
- }
- }
- },
"responses": {
"200": {
"description": "OCPI Endpoint registered",
"$ref": "#/components/responses/ResourceDoesNotExists"
}
}
+ },
+ "delete": {
+ "security": [
+ {
+ "bearerAuth": []
+ }
+ ],
+ "description": "Delete an OICP Endpoint",
+ "parameters": [
+ {
+ "$ref": "#/components/parameters/OICPEndpointID"
+ }
+ ],
+ "tags": [
+ "OICP"
+ ],
+ "responses": {
+ "200": {
+ "description": "OICP Endpoint deleted"
+ },
+ "401": {
+ "$ref": "#/components/responses/UnauthorizedError"
+ },
+ "403": {
+ "$ref": "#/components/responses/ForbiddenError"
+ },
+ "500": {
+ "$ref": "#/components/responses/BackendError"
+ },
+ "550": {
+ "$ref": "#/components/responses/ResourceDoesNotExists"
+ }
+ }
}
},
"/api/oicp/endpoints/{id}/ping": {
}
}
}
+ },
+ "/api/oicp/endpoints/{id}/register": {
+ "put": {
+ "security": [
+ {
+ "bearerAuth": []
+ }
+ ],
+ "description": "Register OICP Endpoint",
+ "tags": [
+ "OICP"
+ ],
+ "parameters": [
+ {
+ "$ref": "#/components/parameters/OICPEndpointID"
+ }
+ ],
+ "responses": {
+ "200": {
+ "description": "OCPI Endpoint registered",
+ "content": {
+ "application/json": {
+ "example": {
+ "status": "Success",
+ "statusCode": 200,
+ "statusText": "OK"
+ }
+ }
+ }
+ },
+ "401": {
+ "$ref": "#/components/responses/UnauthorizedError"
+ },
+ "403": {
+ "$ref": "#/components/responses/ForbiddenError"
+ },
+ "500": {
+ "$ref": "#/components/responses/BackendError"
+ },
+ "550": {
+ "$ref": "#/components/responses/ResourceDoesNotExists"
+ }
+ }
+ }
+ },
+ "/api/oicp/endpoints/{id}/unregister": {
+ "put": {
+ "security": [
+ {
+ "bearerAuth": []
+ }
+ ],
+ "description": "Unregister OICP Endpoint",
+ "tags": [
+ "OICP"
+ ],
+ "parameters": [
+ {
+ "$ref": "#/components/parameters/OICPEndpointID"
+ }
+ ],
+ "responses": {
+ "200": {
+ "description": "OICP Endpoint unregistered",
+ "content": {
+ "application/json": {
+ "example": {
+ "status": "Success",
+ "statusCode": 200,
+ "statusText": "OK"
+ }
+ }
+ }
+ },
+ "401": {
+ "$ref": "#/components/responses/UnauthorizedError"
+ },
+ "403": {
+ "$ref": "#/components/responses/ForbiddenError"
+ },
+ "500": {
+ "$ref": "#/components/responses/BackendError"
+ },
+ "550": {
+ "$ref": "#/components/responses/ResourceDoesNotExists"
+ }
+ }
+ }
}
},
"components": {

MODIFY
src/server/rest/v1/router/api/OICPEndpointRouter.ts
src/server/rest/v1/router/api/OICPEndpointRouter.ts
@@ -20,6 +20,9 @@ export default class OICPEndpointRouter {
this.buildRouteOicpEndpoints();
this.buildRouteOicpEndpoint();
this.buildRouteOicpEndpointUpdate();
+ this.buildRouteOicpEndpointUnregister();
+ this.buildRouteOicpEndpointRegister();
+ this.buildRouteOicpEndpointDelete();
return this.router;
}
@@ -69,4 +72,25 @@ export default class OICPEndpointRouter {
await RouterUtils.handleServerAction(OICPEndpointService.handleUpdateOicpEndpoint.bind(this), ServerAction.OICP_ENDPOINT_UPDATE, req, res, next);
});
}
+
+ private buildRouteOicpEndpointUnregister(): void {
+ this.router.put(`/${ServerRoute.REST_OICP_ENDPOINT_UNREGISTER}`, async (req: Request, res: Response, next: NextFunction) => {
+ req.body.id = req.params.id;
+ await RouterUtils.handleServerAction(OICPEndpointService.handleUnregisterOicpEndpoint.bind(this), ServerAction.OICP_ENDPOINT_UNREGISTER, req, res, next);
+ });
+ }
+
+ private buildRouteOicpEndpointRegister(): void {
+ this.router.put(`/${ServerRoute.REST_OICP_ENDPOINT_REGISTER}`, async (req: Request, res: Response, next: NextFunction) => {
+ req.body.id = req.params.id;
+ await RouterUtils.handleServerAction(OICPEndpointService.handleRegisterOicpEndpoint.bind(this), ServerAction.OICP_ENDPOINT_REGISTER, req, res, next);
+ });
+ }
+
+ private buildRouteOicpEndpointDelete(): void {
+ this.router.delete(`/${ServerRoute.REST_OICP_ENDPOINT}`, async (req: Request, res: Response, next: NextFunction) => {
+ req.query.ID = req.params.id;
+ await RouterUtils.handleServerAction(OICPEndpointService.handleDeleteOicpEndpoint.bind(this), ServerAction.OICP_ENDPOINT_DELETE, req, res, next);
+ });
+ }
}

Added OCPI documentation