An open API service indexing awesome lists of open source software.

https://github.com/extrawest/extrawest-ocpi-2.2.1-emsp-client

Client library for Open Charge-Point Protocol eMSP Server from extrawest.com
https://github.com/extrawest/extrawest-ocpi-2.2.1-emsp-client

emsp ocpi

Last synced: 4 months ago
JSON representation

Client library for Open Charge-Point Protocol eMSP Server from extrawest.com

Awesome Lists containing this project

README

          


# Extrawest-OCPI-2.2.1-EMSP-Client

## Badges

![build](https://img.shields.io/github/actions/workflow/status/extrawest/Extrawest-OCPI-2.2.1-EMSP-Client/docker-image.yml?style=for-the-badge)
![release](https://img.shields.io/github/v/release/extrawest/Extrawest-OCPI-2.2.1-EMSP-Client?style=for-the-badge)
[![Java CI with Maven](https://github.com/extrawest/Extrawest-OCPI-2.2.1-EMSP-Client/actions/workflows/release-publish.yml/badge.svg)](https://github.com/extrawest/Extrawest-OCPI-2.2.1-EMSP-Client/actions/workflows/snapshot-publish.yml)
![contr](https://img.shields.io/github/contributors/extrawest/Extrawest-OCPI-2.2.1-EMSP-Client?style=for-the-badge)
![commits](https://img.shields.io/github/commit-activity/m/extrawest/Extrawest-OCPI-2.2.1-EMSP-Client?style=for-the-badge)
![lastcommit](https://img.shields.io/github/last-commit/extrawest/Extrawest-OCPI-2.2.1-EMSP-Client?style=for-the-badge)
![OCPI](https://img.shields.io/badge/OCPI-2.2.1-yellowgreen?style=for-the-badge)
![JDK](https://img.shields.io/badge/JDK-17-yellow?style=for-the-badge)
![social](https://img.shields.io/github/forks/extrawest/Extrawest-OCPI-2.2.1-EMSP-Client?style=for-the-badge)

## Table of Contents

- [Field of use](#field-of-use)
- [Description](#description)
- [Maven](#maven)
- [Requirements](#requirements)
- [Installation](#installation)
- [Getting Started](#getting-started)
- [Use in Spring Boot App](#using-extrawest-ocpi-221-emsp-client-in-spring-boot-application)
- [API Endpoints](#api-endpoints)
- [Models](#models)
- [Authentication and Authorization](#authentication-and-authorization)
- [Recommendation](#recommendation)
- [License](#license)
- [About Extrawest.com](#about-extrawestcom)

## Field of use
Client library for [OCPI eMSP Server](https://github.com/extrawest/Extrawest-OCPI-2.2.1-EMSP-Server). [Library for OCPI CPO](https://github.com/extrawest/Extrawest-OCPI-2.2.1-CPO-Client) can be found in other repo. Open Charge Point Interface (OCPI) is an open protocol used for connections between charging station operators and service providers. Simply put, this protocol facilitates automated roaming for EV drivers between different EV charging networks.

*Automatically generated by the [OpenAPI Generator](https://openapi-generator.tech)* as a client library for [OCPI Server Library](https://github.com/extrawest/Extrawest-OCPI-2.2.1-EMSP-Server)

Description
=============

With this library, you can easily get started with the Open Charge-Point Interface by making calls to OCPI EMSP Server API. It is a client to [OCPI eMSP Server](https://github.com/extrawest/Extrawest-OCPI-2.2.1-EMSP-Server), created using OpenAPI Generator

Please note, this is a library and not an application, so there is no main method.

Currently we support 2.2.1 OCPI version.

Maven
=====

Find the maven repo here: https://mvnrepository.com/artifact/com.extrawest/Extrawest-OCPI-2.2.1-EMSP-Client

## Requirements

Building the API client library requires:

1. Java 1.8+
2. Maven

## Installation

To install the API client library to your local Maven repository, simply execute:

```shell
mvn clean install
```

### Maven users

Add this dependency to your project's POM:

```xml

com.extrawest
Extrawest-OCPI-2.2.1-EMSP-Client

```

### Others

At first generate the JAR by executing:

```shell
mvn clean package
```

Then manually install the following JARs:

- `target/extrawest-ocpi-2.2.1-emsp-client-0.0.1.jar`
- `target/lib/*.jar`

## Getting Started

Please follow the [installation](#installation) instruction and execute the following Java code:

```java

public class ClientInfoApiExample {

public static void main(String[] args) {
ApiClient defaultClient = Configuration.getDefaultApiClient();
defaultClient.setBasePath("http://localhost:8080");

ClientInfoApi apiInstance = new ClientInfoApi(defaultClient);
String countryCode = "countryCode_example";
String partyId = "partyId_example";
try {
ClientInfoDto result = apiInstance.getHubClientInfo(countryCode, partyId);
System.out.println(result);
} catch (ApiException e) {
System.err.println("Exception when calling ClientInfoApi#getHubClientInfo");
System.err.println("Status code: " + e.getCode());
System.err.println("Reason: " + e.getResponseBody());
System.err.println("Response headers: " + e.getResponseHeaders());
e.printStackTrace();
}
}
}

```
### Using Extrawest-OCPI-2.2.1-EMSP-Client in Spring Boot Application

1. To access the EMSP API classes, we need to configure them as beans:
```java
@Configuration
public class EmspClientConfig {

@Bean
public EmspTariffControllerApi emspTariffApi() {
return new EmspTariffControllerApi(apiClient());
}

@Bean
public ApiClient apiClient() {
return new ApiClient();
}
}
```

2. Since we configured our API classes as beans, we can freely inject them in our Spring-managed classes:
```java

@Service
public class EmspTariffServiceImpl implements EmspTariffService {
@Autowired
private EmspTariffControllerApi emspTariffControllerApi;

@Override
public TariffDto getTariff() {
try {
return emspTariffControllerApi.getTariff("countryCode", "partyId", "tariffId");
} catch (RestClientException e) {
throw new RuntimeException();
}
}
}
```

Spring Boot application, where we have tested Extrawest-OCPI-2.2.1-EMSP-Client, has below Spring dependencies. In case of library and your project dependencies versions incompatibility, try to add next spring versions into you projects:
```bash

org.springframework
spring-web
5.3.24


org.springframework
spring-context
5.3.24


org.springframework
spring-core
5.3.24

```

## API Endpoints

All URIs are relative to *http://localhost:8080*

| Class | Method | HTTP request |
|---------------------------| ------------- | ------------- |
| *ClientInfoApi* | [**getHubClientInfo**](docs/ClientInfoApi.md#getHubClientInfo) | **GET** /api/2.2.1/hubClientInfo/{country_code}/{party_id} |
| *ClientInfoApi* | [**putHubClientInfo**](docs/ClientInfoApi.md#putHubClientInfo) | **PUT** /api/2.2.1/hubClientInfo/{country_code}/{party_id} |
| *EmspCdrApi* | [**getCdr**](docs/EmspCdrApi.md#getCdr) | **GET** /emsp/api/2.2.1/cdr |
| *EmspCdrApi* | [**postCdr**](docs/EmspCdrApi.md#postCdr) | **POST** /emsp/api/2.2.1/cdr |
| *EmspChargingProfilesApi* | [**postChargingProfile**](docs/EmspChargingProfilesApi.md#postChargingProfile) | **POST** /emsp/api/2.2.1/chargingProfiles |
| *EmspChargingProfilesApi* | [**putChargingProfile**](docs/EmspChargingProfilesApi.md#putChargingProfile) | **PUT** /emsp/api/2.2.1/chargingProfiles/{session_id} |
| *EmspCommandsApi* | [**postCommand**](docs/EmspCommandsApi.md#postCommand) | **POST** /emsp/api/2.2.1/commands/{command}/{uid} |
| *EmspCredentialsApi* | [**deleteCredentials**](docs/EmspCredentialsApi.md#deleteCredentials) | **DELETE** /emsp/api/2.2.1/credentials |
| *EmspCredentialsApi* | [**getCredentials**](docs/EmspCredentialsApi.md#getCredentials) | **GET** /emsp/api/2.2.1/credentials |
| *EmspCredentialsApi* | [**postCredentials**](docs/EmspCredentialsApi.md#postCredentials) | **POST** /emsp/api/2.2.1/credentials |
| *EmspCredentialsApi* | [**putCredentials**](docs/EmspCredentialsApi.md#putCredentials) | **PUT** /emsp/api/2.2.1/credentials |
| *EmspLocationApi* | [**getConnector**](docs/EmspLocationApi.md#getConnector) | **GET** /emsp/api/2.2.1/locations/{country_code}/{party_id}/{location_id}/{evse_uid}/{connector_id} |
| *EmspLocationApi* | [**getEvse**](docs/EmspLocationApi.md#getEvse) | **GET** /emsp/api/2.2.1/locations/{country_code}/{party_id}/{location_id}/{evse_uid} |
| *EmspLocationApi* | [**getLocation**](docs/EmspLocationApi.md#getLocation) | **GET** /emsp/api/2.2.1/locations/{country_code}/{party_id}/{location_id} |
| *EmspLocationApi* | [**patchConnector**](docs/EmspLocationApi.md#patchConnector) | **PATCH** /emsp/api/2.2.1/locations/{country_code}/{party_id}/{location_id}/{evse_uid}/{connector_id} |
| *EmspLocationApi* | [**patchEvse**](docs/EmspLocationApi.md#patchEvse) | **PATCH** /emsp/api/2.2.1/locations/{country_code}/{party_id}/{location_id}/{evse_uid} |
| *EmspLocationApi* | [**patchLocation**](docs/EmspLocationApi.md#patchLocation) | **PATCH** /emsp/api/2.2.1/locations/{country_code}/{party_id}/{location_id} |
| *EmspLocationApi* | [**pushConnector**](docs/EmspLocationApi.md#pushConnector) | **PUT** /emsp/api/2.2.1/locations/{country_code}/{party_id}/{location_id}/{evse_uid}/{connector_id} |
| *EmspLocationApi* | [**pushEvse**](docs/EmspLocationApi.md#pushEvse) | **PUT** /emsp/api/2.2.1/locations/{country_code}/{party_id}/{location_id}/{evse_uid} |
| *EmspLocationApi* | [**pushLocation**](docs/EmspLocationApi.md#pushLocation) | **PUT** /emsp/api/2.2.1/locations/{country_code}/{party_id}/{location_id} |
| *EmspSessionsApi* | [**getSession**](docs/EmspSessionsApi.md#getSession) | **GET** /emsp/api/2.2.1/sessions |
| *EmspSessionsApi* | [**patchSession**](docs/EmspSessionsApi.md#patchSession) | **PATCH** /emsp/api/2.2.1/sessions |
| *EmspSessionsApi* | [**putSession**](docs/EmspSessionsApi.md#putSession) | **PUT** /emsp/api/2.2.1/sessions |
| *EmspTariffApi* | [**deleteTariff**](docs/EmspTariffApi.md#deleteTariff) | **DELETE** /emsp/api/2.2.1/tariffs |
| *EmspTariffApi* | [**getTariff**](docs/EmspTariffApi.md#getTariff) | **GET** /emsp/api/2.2.1/tariffs |
| *EmspTariffApi* | [**saveTariff**](docs/EmspTariffApi.md#saveTariff) | **PUT** /emsp/api/2.2.1/tariffs |
| *EmspTokenApi* | [**getTokens**](docs/EmspTokenApi.md#getTokens) | **GET** /emsp/api/2.2.1/tokens |
| *EmspTokenApi* | [**postToken**](docs/EmspTokenApi.md#postToken) | **POST** /emsp/api/2.2.1/tokens/{token_uid}/authorize |
| *EmspVersionApi* | [**getVersionDetails**](docs/EmspVersionApi.md#getVersionDetails) | **GET** /emsp/api/versions/details |
| *EmspVersionApi* | [**getVersions**](docs/EmspVersionApi.md#getVersions) | **GET** /emsp/api/versions |

## Models

- [AbstractProfileResult](docs/AbstractProfileResult.md)
- [ActiveChargingProfile](docs/ActiveChargingProfile.md)
- [AdditionalGeoLocation](docs/AdditionalGeoLocation.md)
- [AuthorizationInfoDto](docs/AuthorizationInfoDto.md)
- [BusinessDetails](docs/BusinessDetails.md)
- [CDRDto](docs/CDRDto.md)
- [CdrDimension](docs/CdrDimension.md)
- [CdrLocation](docs/CdrLocation.md)
- [CdrToken](docs/CdrToken.md)
- [ChargingPeriod](docs/ChargingPeriod.md)
- [ChargingProfile](docs/ChargingProfile.md)
- [ChargingProfilePeriod](docs/ChargingProfilePeriod.md)
- [ClientInfoDto](docs/ClientInfoDto.md)
- [CommandResult](docs/CommandResult.md)
- [Connector](docs/Connector.md)
- [CredentialsDto](docs/CredentialsDto.md)
- [CredentialsRole](docs/CredentialsRole.md)
- [DisplayText](docs/DisplayText.md)
- [EVSE](docs/EVSE.md)
- [Endpoint](docs/Endpoint.md)
- [EnergyContract](docs/EnergyContract.md)
- [EnergyMix](docs/EnergyMix.md)
- [EnergySource](docs/EnergySource.md)
- [EnvironmentalImpact](docs/EnvironmentalImpact.md)
- [ExceptionalPeriod](docs/ExceptionalPeriod.md)
- [GeoLocation](docs/GeoLocation.md)
- [Hours](docs/Hours.md)
- [Image](docs/Image.md)
- [Location](docs/Location.md)
- [LocationReferencesDto](docs/LocationReferencesDto.md)
- [Price](docs/Price.md)
- [PriceComponent](docs/PriceComponent.md)
- [PublishTokenType](docs/PublishTokenType.md)
- [RegularHours](docs/RegularHours.md)
- [ResponseFormatAuthorizationInfoDto](docs/ResponseFormatAuthorizationInfoDto.md)
- [ResponseFormatCDRDto](docs/ResponseFormatCDRDto.md)
- [ResponseFormatCredentialsDto](docs/ResponseFormatCredentialsDto.md)
- [ResponseFormatListTokenDto](docs/ResponseFormatListTokenDto.md)
- [ResponseFormatListVersionDto](docs/ResponseFormatListVersionDto.md)
- [ResponseFormatLocationData](docs/ResponseFormatLocationData.md)
- [ResponseFormatObject](docs/ResponseFormatObject.md)
- [ResponseFormatSessionDto](docs/ResponseFormatSessionDto.md)
- [ResponseFormatString](docs/ResponseFormatString.md)
- [ResponseFormatTariffDto](docs/ResponseFormatTariffDto.md)
- [ResponseFormatVersionDetailsDto](docs/ResponseFormatVersionDetailsDto.md)
- [SessionDto](docs/SessionDto.md)
- [SignedData](docs/SignedData.md)
- [SignedValue](docs/SignedValue.md)
- [StatusSchedule](docs/StatusSchedule.md)
- [TariffDto](docs/TariffDto.md)
- [TariffElement](docs/TariffElement.md)
- [TariffRestrictions](docs/TariffRestrictions.md)
- [TokenDto](docs/TokenDto.md)
- [VersionDetailsDto](docs/VersionDetailsDto.md)
- [VersionDto](docs/VersionDto.md)

## Authentication and Authorization

All endpoints do not require authorization or authentication.

## Recommendation

It's recommended to create an instance of `ApiClient` per thread in a multithreaded environment to avoid any potential issues.

## License

[MIT License](LICENSE)

## About Extrawest.com

We are devoted to push the marked for vehicles charging forward.
There are many standards out there, we intend to implement and share them. Any help is much appreciated!

The market is in its defining state, the practices and standards we come up with now, may very well stick around for decades to come.

See our vision at https://www.extrawest.com/