Files
maptology/testing/api-client/README.md
T
Ole e3935842c7
lbs-gitea/maptology/master There was a failure building this commit
move generated client code in the projects source folder & successfully create devices
2018-01-25 01:33:33 +01:00

18 KiB

swagger-java-client

Requirements

Building the API client library requires Maven to be installed.

Installation

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

mvn install

To deploy it to a remote Maven repository instead, configure the settings of the repository and execute:

mvn deploy

Refer to the official documentation for more information.

Maven users

Add this dependency to your project's POM:

<dependency>
    <groupId>io.swagger</groupId>
    <artifactId>swagger-java-client</artifactId>
    <version>1.0.0</version>
    <scope>compile</scope>
</dependency>

Gradle users

Add this dependency to your project's build file:

compile "io.swagger:swagger-java-client:1.0.0"

Others

At first generate the JAR by executing:

mvn package

Then manually install the following JARs:

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

Getting Started

Please follow the installation instruction and execute the following Java code:


import io.swagger.client.*;
import io.swagger.client.auth.*;
import io.swagger.client.model.*;
import io.swagger.client.api.DefaultApi;

import java.io.File;
import java.util.*;

public class DefaultApiExample {

    public static void main(String[] args) {
        ApiClient defaultClient = Configuration.getDefaultApiClient();
        
        // Configure HTTP basic authorization: user
        HttpBasicAuth user = (HttpBasicAuth) defaultClient.getAuthentication("user");
        user.setUsername("YOUR USERNAME");
        user.setPassword("YOUR PASSWORD");

        DefaultApi apiInstance = new DefaultApi();
        String share = "share_example"; // String | The token of the share.
        try {
            Privilege result = apiInstance.addCurrentUserPrivilege(share);
            System.out.println(result);
        } catch (ApiException e) {
            System.err.println("Exception when calling DefaultApi#addCurrentUserPrivilege");
            e.printStackTrace();
        }
    }
}

Documentation for API Endpoints

All URIs are relative to http://localhost/api

Class Method HTTP request Description
DefaultApi addCurrentUserPrivilege POST /users/current/privileges Add a privilege for the specified user.
DefaultApi addLocations POST /devices/current/locations Updates the locations of the current device.
DefaultApi addNotice POST /notices Adds a new notice and returns the notice as well as its location.
DefaultApi addUser POST /users Adds a user account with the specified roles and emails.
DefaultApi addUserPrivilege POST /users/{id}/privileges Returns the privileges for a particular user.
DefaultApi createDevice POST /devices Creates a new device and returns its handle.
DefaultApi createShare POST /shares Creates a new share.
DefaultApi deleteCurrentDevice DELETE /devices/current Deletes the current device.
DefaultApi deleteDevice DELETE /devices/{id} Deletes a device.
DefaultApi deletePrivilege DELETE /privileges/{id} Deletes a particular privilege.
DefaultApi deleteShare DELETE /shares/{id} Delete a share.
DefaultApi getActiveNotices GET /notices/active Returns a page of notices.
DefaultApi getBuildVersion GET /versions/build Returns the build version.
DefaultApi getCurrentDevice GET /devices/current Returns the current device.
DefaultApi getCurrentUser GET /users/current Returns the user currently authorized.
DefaultApi getCurrentUserDevices GET /users/current/devices Returns the list of devices for the current user.
DefaultApi getCurrentUserPlaces GET /users/current/places Returns the places for the current user.
DefaultApi getCurrentUserPrivileges GET /users/current/privileges Returns the privileges for the current user.
DefaultApi getDevice GET /devices/{id} Gets a device.
DefaultApi getDeviceLocation GET /devices/{id}/location Gets the last device location.
DefaultApi getDeviceVisits GET /devices/{id}/visits Gets the last device location.
DefaultApi getDevices GET /devices Returns all devices.
DefaultApi getEntityStatistics GET /log/entities Returns a list of entity statistics.
DefaultApi getLoadStatistic GET /log/load Returns the current load statistic.
DefaultApi getLogMessages GET /log/messages Returns a list of log messages starting from a particular id.
DefaultApi getNotice GET /notices/{id} Returns the notice with the specified id.
DefaultApi getNotices GET /notices Returns a page of notices.
DefaultApi getPlace GET /places/{id} Returns the place with the specified id.
DefaultApi getPlaceVisits GET /places/{id}/visits Returns the visits for a particular place.
DefaultApi getPrivilege GET /privileges/{id} Returns the privileges for a particular user.
DefaultApi getPrivilegeLocation GET /privileges/{id}/location Returns the location for a particular privilege.
DefaultApi getShare GET /shares/{id} Returns a share.
DefaultApi getShareInfo GET /shares/{token}/info Get a share info by its secret token.
DefaultApi getShareLocation GET /shares/{token}/location Get a shared location by its secret token.
DefaultApi getSystemStatistic GET /log/system Returns the system statistic.
DefaultApi getUpdatedNotices GET /notices/updated Returns all active notices modified after the date.
DefaultApi getUser GET /users/{id} Returns the user account with the specified id.
DefaultApi getUserPlaces GET /users/{id}/places Returns the places for a particular user.
DefaultApi getUserPrivileges GET /users/{id}/privileges Returns the privileges for a particular user.
DefaultApi getUsers GET /users Returns a list of users.
DefaultApi registerUser POST /users/register Registers a new user and sends an email account verification.
DefaultApi resetUser POST /users/reset Sends a password reset email to the correspondence email account of a user.
DefaultApi resetUserPassword PUT /users/password/{token} Sets the password of a user account using a token received via email.
DefaultApi searchUsers GET /users/search Returns a list of users whose login name or name contains the term.
DefaultApi setCurrentPassword PUT /users/current/password Sets the password of the currently authorized user.
DefaultApi setCurrentUser PUT /users/current Updates the currently authorized user.
DefaultApi setDevice PUT /devices/{id} Sets the values of a device.
DefaultApi setNotice PUT /notices/{id} Updates an existing notice.
DefaultApi setPlace PUT /places/{id} Updates the place with the specified id.
DefaultApi setShare PUT /shares/{id} Updates an existing share.
DefaultApi setUser PUT /users/{id} Updates the values of a particular user account.
DefaultApi setUserPassword PUT /users/{id}/password Sets the password of a user.
DefaultApi verifyUserEmail PUT /users/verify/{token} Verifies an email address using a token received via email.
DeviceApi addLocations POST /devices/current/locations Updates the locations of the current device.
DeviceApi createDevice POST /devices Creates a new device and returns its handle.
DeviceApi deleteCurrentDevice DELETE /devices/current Deletes the current device.
DeviceApi deleteDevice DELETE /devices/{id} Deletes a device.
DeviceApi getCurrentDevice GET /devices/current Returns the current device.
DeviceApi getCurrentUserDevices GET /users/current/devices Returns the list of devices for the current user.
DeviceApi getDevice GET /devices/{id} Gets a device.
DeviceApi getDeviceLocation GET /devices/{id}/location Gets the last device location.
DeviceApi getDeviceVisits GET /devices/{id}/visits Gets the last device location.
DeviceApi getDevices GET /devices Returns all devices.
DeviceApi setDevice PUT /devices/{id} Sets the values of a device.
PlaceApi getPlace GET /places/{id} Returns the place with the specified id.
PlaceApi getPlaceVisits GET /places/{id}/visits Returns the visits for a particular place.
PlaceApi setPlace PUT /places/{id} Updates the place with the specified id.
PrivilegeApi deletePrivilege DELETE /privileges/{id} Deletes a particular privilege.
PrivilegeApi getPrivilege GET /privileges/{id} Returns the privileges for a particular user.
PrivilegeApi getPrivilegeLocation GET /privileges/{id}/location Returns the location for a particular privilege.
ServiceApi addNotice POST /notices Adds a new notice and returns the notice as well as its location.
ServiceApi getActiveNotices GET /notices/active Returns a page of notices.
ServiceApi getBuildVersion GET /versions/build Returns the build version.
ServiceApi getEntityStatistics GET /log/entities Returns a list of entity statistics.
ServiceApi getLoadStatistic GET /log/load Returns the current load statistic.
ServiceApi getLogMessages GET /log/messages Returns a list of log messages starting from a particular id.
ServiceApi getNotice GET /notices/{id} Returns the notice with the specified id.
ServiceApi getNotices GET /notices Returns a page of notices.
ServiceApi getSystemStatistic GET /log/system Returns the system statistic.
ServiceApi getUpdatedNotices GET /notices/updated Returns all active notices modified after the date.
ServiceApi setNotice PUT /notices/{id} Updates an existing notice.
ShareApi createShare POST /shares Creates a new share.
ShareApi deleteShare DELETE /shares/{id} Delete a share.
ShareApi getShare GET /shares/{id} Returns a share.
ShareApi getShareInfo GET /shares/{token}/info Get a share info by its secret token.
ShareApi getShareLocation GET /shares/{token}/location Get a shared location by its secret token.
ShareApi setShare PUT /shares/{id} Updates an existing share.
UserApi addCurrentUserPrivilege POST /users/current/privileges Add a privilege for the specified user.
UserApi addUser POST /users Adds a user account with the specified roles and emails.
UserApi addUserPrivilege POST /users/{id}/privileges Returns the privileges for a particular user.
UserApi getCurrentUser GET /users/current Returns the user currently authorized.
UserApi getCurrentUserPlaces GET /users/current/places Returns the places for the current user.
UserApi getCurrentUserPrivileges GET /users/current/privileges Returns the privileges for the current user.
UserApi getUser GET /users/{id} Returns the user account with the specified id.
UserApi getUserPlaces GET /users/{id}/places Returns the places for a particular user.
UserApi getUserPrivileges GET /users/{id}/privileges Returns the privileges for a particular user.
UserApi getUsers GET /users Returns a list of users.
UserApi registerUser POST /users/register Registers a new user and sends an email account verification.
UserApi resetUser POST /users/reset Sends a password reset email to the correspondence email account of a user.
UserApi resetUserPassword PUT /users/password/{token} Sets the password of a user account using a token received via email.
UserApi searchUsers GET /users/search Returns a list of users whose login name or name contains the term.
UserApi setCurrentPassword PUT /users/current/password Sets the password of the currently authorized user.
UserApi setCurrentUser PUT /users/current Updates the currently authorized user.
UserApi setUser PUT /users/{id} Updates the values of a particular user account.
UserApi setUserPassword PUT /users/{id}/password Sets the password of a user.
UserApi verifyUserEmail PUT /users/verify/{token} Verifies an email address using a token received via email.

Documentation for Models

Documentation for Authorization

Authentication schemes defined for the API:

admin

  • Type: HTTP basic authentication

device

  • Type: API key
  • API key parameter name: Authorization
  • Location: HTTP header

user

  • Type: HTTP basic authentication

Recommendation

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

Author

nes-admin@uni-due.de