Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

3.9.0 #75

Merged
merged 19 commits into from
May 30, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
214 changes: 62 additions & 152 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
# swagger-java-client
# jSuplaApi

***

<!--suppress HtmlDeprecatedAttribute -->
<div align="center">
<b><em>jSupla</em></b><br>
<b><em>jSuplaApi</em></b><br>
IoT with Java and <why href="https://supla.org">Supla</why>
</div>

Expand All @@ -18,191 +19,100 @@

***

## Requirements
This library is client for [Supla Cloud](https://cloud.supla.org/).

Building the API client library requires [Maven](https://maven.apache.org/) to be installed.
Swagger documentation can be found here:

## Installation

To install the API client library to your local Maven repository, simply execute:
* [version 2.3.0](https://app.swaggerhub.com/apis/supla/supla-cloud-api/2.3.0)

```shell
mvn install
```
## Example Usage

To deploy it to a remote Maven repository instead, configure the settings of the repository and execute:
```java
import pl.grzeslowski.jsupla.api.Api;

```shell
mvn deploy
class Main {
public static void main(String[] args) {
final String token = "MzFhYTNiZTAwODg5M2E0NDE3OGUwNWE5ZjYzZWQ2YzllZGFiYWRmNDQwNDBlNmZhZGEzN2I3NTJiOWM2ZWEyZg" +
".aHR0cDovL2xvY2FsaG9zdDo5MDkw"; // This part is base64 encoded server URL
Api api = Api.getInstance(token);

// Get API version
final String apiVersion = api.getVersion();
System.out.println("Current API version: " + apiUsageStatistics);

// Find all Channels
api.getChannelApi()
.findChannels()
.forEach(System.out::println);

// Find all devices
api.getDeviceApi()
.findDevices()
.forEach(System.out::println);

// How to check API usage statistics
final String apiUsageStatistics = api.getApiUsageStatistics()
.map(it -> it.toString())
.orElse("<none>");
System.out.println("Your API usage statistics: " + apiUsageStatistics);
}
}
```

Refer to the [official documentation](https://maven.apache.org/plugins/maven-deploy-plugin/usage.html) for more information.
## Installation

### Maven users
### Maven Users

Add this dependency to your project's POM:

```xml
<dependency>
<groupId>io.swagger</groupId>
<artifactId>swagger-java-client</artifactId>
<version>1.0.0</version>
<scope>compile</scope>
<groupId>pl.grzeslowski.jsupla.api</groupId>
<artifactId>jsupla-api</artifactId>
<version>${jSuplaApi.version}</version>
<type>compile</type>
</dependency>
```

### Gradle users
### Gradle Users

Add this dependency to your project's build file:

```groovy
compile "io.swagger:swagger-java-client:1.0.0"
implementation 'pl.grzeslowski.jsupla.api:jsupla-api:$jSuplaApiVersion'
```

### Others

At first generate the JAR by executing:

mvn package
### Fat Jar Artifact

Then manually install the following JARs:

* target/swagger-java-client-1.0.0.jar
* target/lib/*.jar

## Getting Started
From version `3.8.x` you can use `jsupla-api-fat` artifact to import jSuplaApi jar with all its dependencies.

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

```java

import io.swagger.client.*;
import io.swagger.client.auth.*;
import io.swagger.client.model.*;
import io.swagger.client.api.AccessIdentifiersApi;
At first generate the JAR by executing:

import java.io.File;
import java.util.*;
gradlew clean build

public class AccessIdentifiersApiExample {
Then manually install the following JARs:

public static void main(String[] args) {
ApiClient defaultClient = Configuration.getDefaultApiClient();

// Configure OAuth2 access token for authorization: password
OAuth password = (OAuth) defaultClient.getAuthentication("password");
password.setAccessToken("YOUR ACCESS TOKEN");

AccessIdentifiersApi apiInstance = new AccessIdentifiersApi();
try {
AccessIdentifier result = apiInstance.createAccessIdentifier();
System.out.println(result);
} catch (ApiException e) {
System.err.println("Exception when calling AccessIdentifiersApi#createAccessIdentifier");
e.printStackTrace();
}
}
}
* build/libs/jsupla-api-\<version\>.jar

```
## Releases

## Documentation for API Endpoints

All URIs are relative to *https://cloud.supla.org/api/v2.2.0*

Class | Method | HTTP request | Description
------------ | ------------- | ------------- | -------------
*AccessIdentifiersApi* | [**createAccessIdentifier**](docs/AccessIdentifiersApi.md#createAccessIdentifier) | **POST** /accessids | Create a new Access Identifier
*AccessIdentifiersApi* | [**deleteAccessIdentifier**](docs/AccessIdentifiersApi.md#deleteAccessIdentifier) | **DELETE** /accessids/{id} | Delete Access Identifier
*AccessIdentifiersApi* | [**getAccessIdentifier**](docs/AccessIdentifiersApi.md#getAccessIdentifier) | **GET** /accessids/{id} | Get Access Identifier
*AccessIdentifiersApi* | [**getAccessIdentifiers**](docs/AccessIdentifiersApi.md#getAccessIdentifiers) | **GET** /accessids | Get Access Identifiers list
*AccessIdentifiersApi* | [**updateAccessIdentifier**](docs/AccessIdentifiersApi.md#updateAccessIdentifier) | **PUT** /accessids/{id} | Update Access Identifier
*ChannelGroupsApi* | [**createChannelGroup**](docs/ChannelGroupsApi.md#createChannelGroup) | **POST** /channel-groups | Create a new channel group
*ChannelGroupsApi* | [**deleteChannelGroup**](docs/ChannelGroupsApi.md#deleteChannelGroup) | **DELETE** /channel-groups/{id} | Delete Channel Group
*ChannelGroupsApi* | [**executeChannelGroupAction**](docs/ChannelGroupsApi.md#executeChannelGroupAction) | **PATCH** /channel-groups/{id} | Execute action on the channel group
*ChannelGroupsApi* | [**getChannelGroup**](docs/ChannelGroupsApi.md#getChannelGroup) | **GET** /channel-groups/{id} | Get channel group by ID
*ChannelGroupsApi* | [**getChannelGroups**](docs/ChannelGroupsApi.md#getChannelGroups) | **GET** /channel-groups | Get channels list
*ChannelGroupsApi* | [**updateChannelGroup**](docs/ChannelGroupsApi.md#updateChannelGroup) | **PUT** /channel-groups/{id} | Update channel group
*ChannelsApi* | [**executeAction**](docs/ChannelsApi.md#executeAction) | **PATCH** /channels/{id} | Execute action on the channel
*ChannelsApi* | [**getChannel**](docs/ChannelsApi.md#getChannel) | **GET** /channels/{id} | Get channel by ID
*ChannelsApi* | [**getChannelMeasurementLogs**](docs/ChannelsApi.md#getChannelMeasurementLogs) | **GET** /channels/{id}/measurement-logs | Get measurement logs.
*ChannelsApi* | [**getChannelMeasurementLogsCsvFile**](docs/ChannelsApi.md#getChannelMeasurementLogsCsvFile) | **GET** /channels/{id}/measurement-logs-csv | Get measurement logs as zipped CSV file.
*ChannelsApi* | [**getChannelSchedules**](docs/ChannelsApi.md#getChannelSchedules) | **GET** /channels/{id}/schedules | Get schedules list of the channel
*ChannelsApi* | [**getChannels**](docs/ChannelsApi.md#getChannels) | **GET** /channels | Get channels list
*ChannelsApi* | [**updateChannel**](docs/ChannelsApi.md#updateChannel) | **PUT** /channels/{id} | Update channel
*ClientAppsApi* | [**deleteClientApp**](docs/ClientAppsApi.md#deleteClientApp) | **DELETE** /client-apps/{id} | Delete Client App
*ClientAppsApi* | [**getClientApps**](docs/ClientAppsApi.md#getClientApps) | **GET** /client-apps | Get client apps
*ClientAppsApi* | [**updateClientApp**](docs/ClientAppsApi.md#updateClientApp) | **PUT** /client-apps/{id} | Update client app
*IoDevicesApi* | [**deleteIoDevice**](docs/IoDevicesApi.md#deleteIoDevice) | **DELETE** /iodevices/{id} | Delete IO Device
*IoDevicesApi* | [**getIoDevice**](docs/IoDevicesApi.md#getIoDevice) | **GET** /iodevices/{id} | Get IO Device
*IoDevicesApi* | [**getIoDeviceChannels**](docs/IoDevicesApi.md#getIoDeviceChannels) | **GET** /iodevices/{id}/channels | Get Channels that belong to IO Deice
*IoDevicesApi* | [**getIoDevices**](docs/IoDevicesApi.md#getIoDevices) | **GET** /iodevices | Get IO Devices
*IoDevicesApi* | [**updateIoDevice**](docs/IoDevicesApi.md#updateIoDevice) | **PUT** /iodevices/{id} | Update IO Device
*LocationsApi* | [**createLocation**](docs/LocationsApi.md#createLocation) | **POST** /locations | Create a new location
*LocationsApi* | [**deleteLocation**](docs/LocationsApi.md#deleteLocation) | **DELETE** /locations/{id} | Delete location
*LocationsApi* | [**getLocation**](docs/LocationsApi.md#getLocation) | **GET** /locations/{id} | Get location by ID
*LocationsApi* | [**getLocations**](docs/LocationsApi.md#getLocations) | **GET** /locations | Get locations list
*LocationsApi* | [**updateLocation**](docs/LocationsApi.md#updateLocation) | **PUT** /locations/{id} | Update location
*SchedulesApi* | [**createSchedule**](docs/SchedulesApi.md#createSchedule) | **POST** /schedules | Create a new schedule
*SchedulesApi* | [**deleteSchedule**](docs/SchedulesApi.md#deleteSchedule) | **DELETE** /schedules/{id} | Delete Schedule
*SchedulesApi* | [**enableSchedules**](docs/SchedulesApi.md#enableSchedules) | **PATCH** /schedules | Enable schedules
*SchedulesApi* | [**getSchedule**](docs/SchedulesApi.md#getSchedule) | **GET** /schedules/{id} | Get Schedule
*SchedulesApi* | [**getSchedules**](docs/SchedulesApi.md#getSchedules) | **GET** /schedules | Get schedules list
*SchedulesApi* | [**updateSchedule**](docs/SchedulesApi.md#updateSchedule) | **PUT** /schedules/{id} | Update schedule
*ServerApi* | [**getServerInfo**](docs/ServerApi.md#getServerInfo) | **GET** /server-info | Get server info
*ServerApi* | [**getSuplaServerStatus**](docs/ServerApi.md#getSuplaServerStatus) | **GET** /server-status | Get the SUPLA Server status
*UsersApi* | [**getCurrentUser**](docs/UsersApi.md#getCurrentUser) | **GET** /users/current | Get current user
*UsersApi* | [**updateCurrentUser**](docs/UsersApi.md#updateCurrentUser) | **PATCH** /users/current | Update current user


## Documentation for Models

- [AccessIdentifier](docs/AccessIdentifier.md)
- [AccessIdentifierUpdateRequest](docs/AccessIdentifierUpdateRequest.md)
- [Channel](docs/Channel.md)
- [ChannelExecuteActionRequest](docs/ChannelExecuteActionRequest.md)
- [ChannelFunction](docs/ChannelFunction.md)
- [ChannelFunctionAction](docs/ChannelFunctionAction.md)
- [ChannelFunctionActionEnum](docs/ChannelFunctionActionEnum.md)
- [ChannelFunctionEnumNames](docs/ChannelFunctionEnumNames.md)
- [ChannelGroup](docs/ChannelGroup.md)
- [ChannelGroupRequest](docs/ChannelGroupRequest.md)
- [ChannelMeasurementLog](docs/ChannelMeasurementLog.md)
- [ChannelType](docs/ChannelType.md)
- [ChannelUpdateRequest](docs/ChannelUpdateRequest.md)
- [ClientApp](docs/ClientApp.md)
- [ClientAppUpdateRequest](docs/ClientAppUpdateRequest.md)
- [Device](docs/Device.md)
- [IODeviceUpdateRequest](docs/IODeviceUpdateRequest.md)
- [Location](docs/Location.md)
- [LocationUpdateRequest](docs/LocationUpdateRequest.md)
- [Schedule](docs/Schedule.md)
- [ScheduleClosestExecutions](docs/ScheduleClosestExecutions.md)
- [ScheduleFuture](docs/ScheduleFuture.md)
- [SchedulePast](docs/SchedulePast.md)
- [ScheduleRequest](docs/ScheduleRequest.md)
- [ScheduleResult](docs/ScheduleResult.md)
- [SchedulesEnableRequest](docs/SchedulesEnableRequest.md)
- [UserUpdateRequest](docs/UserUpdateRequest.md)


## Documentation for Authorization

Authentication schemes defined for the API:
### password

- **Type**: OAuth
- **Flow**: password
- **Authorization URL**:
- **Scopes**:
- restapi: full API access
Auto generated [**release Notes**](docs/release-notes.md).

This software is proudly released with [Shipkit](https://github.com/mockito/shipkit).

## Recommendation

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

## Author
## Related Projects

1. [jSupla](https://github.com/magx2/jSupla) - Javas implementation of Supla protocol
2. [OpenHAB binding](https://github.com/magx2/openhab2-addons/tree/jSupla) - Binding for OpenHAB
2. [jSuplaServerMock](https://github.com/magx2/jSuplaServerMock) - Mock implementation of Supla Cloud
3. [jSuplaGui](https://github.com/magx2/jSuplaGui) - GUI for Supla Cloud

## Author(s)

**Martin Grześlowski** (github/magx2)
1 change: 1 addition & 0 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ dependencies {
testImplementation 'io.github.glytching:junit-extensions:2.3.0'
testImplementation group: 'org.assertj', name: 'assertj-core', version: '3.13.2'
testImplementation group: 'ch.qos.logback', name: 'logback-classic', version: '1.2.3'
testImplementation group: 'com.google.guava', name: 'guava', version: '29.0-jre'
testRuntimeOnly "org.junit.jupiter:junit-jupiter-engine:$jUnitVersion"
}

Expand Down
16 changes: 0 additions & 16 deletions docs/AccessIdentifier.md

This file was deleted.

14 changes: 0 additions & 14 deletions docs/AccessIdentifierUpdateRequest.md

This file was deleted.

Loading