Files
maptology/testing/api-client/docs/DeviceApi.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

627 lines
17 KiB
Markdown

# DeviceApi
All URIs are relative to *http://localhost/api*
Method | HTTP request | Description
------------- | ------------- | -------------
[**addLocations**](DeviceApi.md#addLocations) | **POST** /devices/current/locations | Updates the locations of the current device.
[**createDevice**](DeviceApi.md#createDevice) | **POST** /devices | Creates a new device and returns its handle.
[**deleteCurrentDevice**](DeviceApi.md#deleteCurrentDevice) | **DELETE** /devices/current | Deletes the current device.
[**deleteDevice**](DeviceApi.md#deleteDevice) | **DELETE** /devices/{id} | Deletes a device.
[**getCurrentDevice**](DeviceApi.md#getCurrentDevice) | **GET** /devices/current | Returns the current device.
[**getCurrentUserDevices**](DeviceApi.md#getCurrentUserDevices) | **GET** /users/current/devices | Returns the list of devices for the current user.
[**getDevice**](DeviceApi.md#getDevice) | **GET** /devices/{id} | Gets a device.
[**getDeviceLocation**](DeviceApi.md#getDeviceLocation) | **GET** /devices/{id}/location | Gets the last device location.
[**getDeviceVisits**](DeviceApi.md#getDeviceVisits) | **GET** /devices/{id}/visits | Gets the last device location.
[**getDevices**](DeviceApi.md#getDevices) | **GET** /devices | Returns all devices.
[**setDevice**](DeviceApi.md#setDevice) | **PUT** /devices/{id} | Sets the values of a device.
<a name="addLocations"></a>
# **addLocations**
> addLocations(body)
Updates the locations of the current device.
### Example
```java
// Import classes:
//import io.swagger.client.ApiClient;
//import io.swagger.client.ApiException;
//import io.swagger.client.Configuration;
//import io.swagger.client.auth.*;
//import io.swagger.client.api.DeviceApi;
ApiClient defaultClient = Configuration.getDefaultApiClient();
// Configure API key authorization: device
ApiKeyAuth device = (ApiKeyAuth) defaultClient.getAuthentication("device");
device.setApiKey("YOUR API KEY");
// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
//device.setApiKeyPrefix("Token");
DeviceApi apiInstance = new DeviceApi();
LocationUpdate body = new LocationUpdate(); // LocationUpdate | The location update with the locations to add.
try {
apiInstance.addLocations(body);
} catch (ApiException e) {
System.err.println("Exception when calling DeviceApi#addLocations");
e.printStackTrace();
}
```
### Parameters
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**body** | [**LocationUpdate**](LocationUpdate.md)| The location update with the locations to add. |
### Return type
null (empty response body)
### Authorization
[device](../README.md#device)
### HTTP request headers
- **Content-Type**: application/json, application/xml
- **Accept**: application/json, application/xml
<a name="createDevice"></a>
# **createDevice**
> DeviceHandle createDevice(body)
Creates a new device and returns its handle.
The response will include the auth token to be stored on the device and supplied as authentication on all subsequent api calls. Note that the auth token can not be requested after creation, so when losing the auth token you may lose access to the device data.
### Example
```java
// Import classes:
//import io.swagger.client.ApiException;
//import io.swagger.client.api.DeviceApi;
DeviceApi apiInstance = new DeviceApi();
DeviceInfo body = new DeviceInfo(); // DeviceInfo | Necessary data from to create a device.
try {
DeviceHandle result = apiInstance.createDevice(body);
System.out.println(result);
} catch (ApiException e) {
System.err.println("Exception when calling DeviceApi#createDevice");
e.printStackTrace();
}
```
### Parameters
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**body** | [**DeviceInfo**](DeviceInfo.md)| Necessary data from to create a device. |
### Return type
[**DeviceHandle**](DeviceHandle.md)
### Authorization
No authorization required
### HTTP request headers
- **Content-Type**: application/json, application/xml
- **Accept**: application/json, application/xml
<a name="deleteCurrentDevice"></a>
# **deleteCurrentDevice**
> deleteCurrentDevice()
Deletes the current device.
### Example
```java
// Import classes:
//import io.swagger.client.ApiClient;
//import io.swagger.client.ApiException;
//import io.swagger.client.Configuration;
//import io.swagger.client.auth.*;
//import io.swagger.client.api.DeviceApi;
ApiClient defaultClient = Configuration.getDefaultApiClient();
// Configure API key authorization: device
ApiKeyAuth device = (ApiKeyAuth) defaultClient.getAuthentication("device");
device.setApiKey("YOUR API KEY");
// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
//device.setApiKeyPrefix("Token");
DeviceApi apiInstance = new DeviceApi();
try {
apiInstance.deleteCurrentDevice();
} catch (ApiException e) {
System.err.println("Exception when calling DeviceApi#deleteCurrentDevice");
e.printStackTrace();
}
```
### Parameters
This endpoint does not need any parameter.
### Return type
null (empty response body)
### Authorization
[device](../README.md#device)
### HTTP request headers
- **Content-Type**: application/json, application/xml
- **Accept**: application/json, application/xml
<a name="deleteDevice"></a>
# **deleteDevice**
> deleteDevice(id)
Deletes a device.
### Example
```java
// Import classes:
//import io.swagger.client.ApiClient;
//import io.swagger.client.ApiException;
//import io.swagger.client.Configuration;
//import io.swagger.client.auth.*;
//import io.swagger.client.api.DeviceApi;
ApiClient defaultClient = Configuration.getDefaultApiClient();
// Configure HTTP basic authorization: admin
HttpBasicAuth admin = (HttpBasicAuth) defaultClient.getAuthentication("admin");
admin.setUsername("YOUR USERNAME");
admin.setPassword("YOUR PASSWORD");
// Configure HTTP basic authorization: user
HttpBasicAuth user = (HttpBasicAuth) defaultClient.getAuthentication("user");
user.setUsername("YOUR USERNAME");
user.setPassword("YOUR PASSWORD");
DeviceApi apiInstance = new DeviceApi();
Long id = 789L; // Long | The device id.
try {
apiInstance.deleteDevice(id);
} catch (ApiException e) {
System.err.println("Exception when calling DeviceApi#deleteDevice");
e.printStackTrace();
}
```
### Parameters
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**id** | **Long**| The device id. |
### Return type
null (empty response body)
### Authorization
[admin](../README.md#admin), [user](../README.md#user)
### HTTP request headers
- **Content-Type**: application/json, application/xml
- **Accept**: application/json, application/xml
<a name="getCurrentDevice"></a>
# **getCurrentDevice**
> Device getCurrentDevice()
Returns the current device.
### Example
```java
// Import classes:
//import io.swagger.client.ApiClient;
//import io.swagger.client.ApiException;
//import io.swagger.client.Configuration;
//import io.swagger.client.auth.*;
//import io.swagger.client.api.DeviceApi;
ApiClient defaultClient = Configuration.getDefaultApiClient();
// Configure API key authorization: device
ApiKeyAuth device = (ApiKeyAuth) defaultClient.getAuthentication("device");
device.setApiKey("YOUR API KEY");
// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
//device.setApiKeyPrefix("Token");
DeviceApi apiInstance = new DeviceApi();
try {
Device result = apiInstance.getCurrentDevice();
System.out.println(result);
} catch (ApiException e) {
System.err.println("Exception when calling DeviceApi#getCurrentDevice");
e.printStackTrace();
}
```
### Parameters
This endpoint does not need any parameter.
### Return type
[**Device**](Device.md)
### Authorization
[device](../README.md#device)
### HTTP request headers
- **Content-Type**: application/json, application/xml
- **Accept**: application/json, application/xml
<a name="getCurrentUserDevices"></a>
# **getCurrentUserDevices**
> DevicePage getCurrentUserDevices(pageOffset, pageSize)
Returns the list of devices for the current user.
### Example
```java
// Import classes:
//import io.swagger.client.ApiClient;
//import io.swagger.client.ApiException;
//import io.swagger.client.Configuration;
//import io.swagger.client.auth.*;
//import io.swagger.client.api.DeviceApi;
ApiClient defaultClient = Configuration.getDefaultApiClient();
// Configure HTTP basic authorization: user
HttpBasicAuth user = (HttpBasicAuth) defaultClient.getAuthentication("user");
user.setUsername("YOUR USERNAME");
user.setPassword("YOUR PASSWORD");
DeviceApi apiInstance = new DeviceApi();
Integer pageOffset = 0; // Integer | The offset in terms of elements.
Integer pageSize = 20; // Integer | The maximum number of elements on the page.
try {
DevicePage result = apiInstance.getCurrentUserDevices(pageOffset, pageSize);
System.out.println(result);
} catch (ApiException e) {
System.err.println("Exception when calling DeviceApi#getCurrentUserDevices");
e.printStackTrace();
}
```
### Parameters
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**pageOffset** | **Integer**| The offset in terms of elements. | [optional] [default to 0]
**pageSize** | **Integer**| The maximum number of elements on the page. | [optional] [default to 20]
### Return type
[**DevicePage**](DevicePage.md)
### Authorization
[user](../README.md#user)
### HTTP request headers
- **Content-Type**: application/json, application/xml
- **Accept**: application/json, application/xml
<a name="getDevice"></a>
# **getDevice**
> Device getDevice(id)
Gets a device.
### Example
```java
// Import classes:
//import io.swagger.client.ApiClient;
//import io.swagger.client.ApiException;
//import io.swagger.client.Configuration;
//import io.swagger.client.auth.*;
//import io.swagger.client.api.DeviceApi;
ApiClient defaultClient = Configuration.getDefaultApiClient();
// Configure HTTP basic authorization: admin
HttpBasicAuth admin = (HttpBasicAuth) defaultClient.getAuthentication("admin");
admin.setUsername("YOUR USERNAME");
admin.setPassword("YOUR PASSWORD");
// Configure HTTP basic authorization: user
HttpBasicAuth user = (HttpBasicAuth) defaultClient.getAuthentication("user");
user.setUsername("YOUR USERNAME");
user.setPassword("YOUR PASSWORD");
DeviceApi apiInstance = new DeviceApi();
Long id = 789L; // Long | The device id.
try {
Device result = apiInstance.getDevice(id);
System.out.println(result);
} catch (ApiException e) {
System.err.println("Exception when calling DeviceApi#getDevice");
e.printStackTrace();
}
```
### Parameters
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**id** | **Long**| The device id. |
### Return type
[**Device**](Device.md)
### Authorization
[admin](../README.md#admin), [user](../README.md#user)
### HTTP request headers
- **Content-Type**: application/json, application/xml
- **Accept**: application/json, application/xml
<a name="getDeviceLocation"></a>
# **getDeviceLocation**
> Location getDeviceLocation(id)
Gets the last device location.
### Example
```java
// Import classes:
//import io.swagger.client.ApiClient;
//import io.swagger.client.ApiException;
//import io.swagger.client.Configuration;
//import io.swagger.client.auth.*;
//import io.swagger.client.api.DeviceApi;
ApiClient defaultClient = Configuration.getDefaultApiClient();
// Configure HTTP basic authorization: admin
HttpBasicAuth admin = (HttpBasicAuth) defaultClient.getAuthentication("admin");
admin.setUsername("YOUR USERNAME");
admin.setPassword("YOUR PASSWORD");
// Configure HTTP basic authorization: user
HttpBasicAuth user = (HttpBasicAuth) defaultClient.getAuthentication("user");
user.setUsername("YOUR USERNAME");
user.setPassword("YOUR PASSWORD");
DeviceApi apiInstance = new DeviceApi();
Long id = 789L; // Long | The device id.
try {
Location result = apiInstance.getDeviceLocation(id);
System.out.println(result);
} catch (ApiException e) {
System.err.println("Exception when calling DeviceApi#getDeviceLocation");
e.printStackTrace();
}
```
### Parameters
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**id** | **Long**| The device id. |
### Return type
[**Location**](Location.md)
### Authorization
[admin](../README.md#admin), [user](../README.md#user)
### HTTP request headers
- **Content-Type**: application/json, application/xml
- **Accept**: application/json, application/xml
<a name="getDeviceVisits"></a>
# **getDeviceVisits**
> List&lt;Visit&gt; getDeviceVisits(id, start, duration)
Gets the last device location.
### Example
```java
// Import classes:
//import io.swagger.client.ApiClient;
//import io.swagger.client.ApiException;
//import io.swagger.client.Configuration;
//import io.swagger.client.auth.*;
//import io.swagger.client.api.DeviceApi;
ApiClient defaultClient = Configuration.getDefaultApiClient();
// Configure HTTP basic authorization: admin
HttpBasicAuth admin = (HttpBasicAuth) defaultClient.getAuthentication("admin");
admin.setUsername("YOUR USERNAME");
admin.setPassword("YOUR PASSWORD");
// Configure HTTP basic authorization: user
HttpBasicAuth user = (HttpBasicAuth) defaultClient.getAuthentication("user");
user.setUsername("YOUR USERNAME");
user.setPassword("YOUR PASSWORD");
DeviceApi apiInstance = new DeviceApi();
Long id = 789L; // Long | The device id.
Long start = 789L; // Long | The start time in Epoch milliseconds.
Long duration = 789L; // Long | The duration in milliseconds.
try {
List<Visit> result = apiInstance.getDeviceVisits(id, start, duration);
System.out.println(result);
} catch (ApiException e) {
System.err.println("Exception when calling DeviceApi#getDeviceVisits");
e.printStackTrace();
}
```
### Parameters
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**id** | **Long**| The device id. |
**start** | **Long**| The start time in Epoch milliseconds. |
**duration** | **Long**| The duration in milliseconds. |
### Return type
[**List&lt;Visit&gt;**](Visit.md)
### Authorization
[admin](../README.md#admin), [user](../README.md#user)
### HTTP request headers
- **Content-Type**: application/json, application/xml
- **Accept**: application/json, application/xml
<a name="getDevices"></a>
# **getDevices**
> DevicePage getDevices(pageOffset, pageSize)
Returns all devices.
### Example
```java
// Import classes:
//import io.swagger.client.ApiClient;
//import io.swagger.client.ApiException;
//import io.swagger.client.Configuration;
//import io.swagger.client.auth.*;
//import io.swagger.client.api.DeviceApi;
ApiClient defaultClient = Configuration.getDefaultApiClient();
// Configure HTTP basic authorization: admin
HttpBasicAuth admin = (HttpBasicAuth) defaultClient.getAuthentication("admin");
admin.setUsername("YOUR USERNAME");
admin.setPassword("YOUR PASSWORD");
DeviceApi apiInstance = new DeviceApi();
Integer pageOffset = 0; // Integer | The offset in terms of elements.
Integer pageSize = 20; // Integer | The maximum number of elements on the page.
try {
DevicePage result = apiInstance.getDevices(pageOffset, pageSize);
System.out.println(result);
} catch (ApiException e) {
System.err.println("Exception when calling DeviceApi#getDevices");
e.printStackTrace();
}
```
### Parameters
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**pageOffset** | **Integer**| The offset in terms of elements. | [optional] [default to 0]
**pageSize** | **Integer**| The maximum number of elements on the page. | [optional] [default to 20]
### Return type
[**DevicePage**](DevicePage.md)
### Authorization
[admin](../README.md#admin)
### HTTP request headers
- **Content-Type**: application/json, application/xml
- **Accept**: application/json, application/xml
<a name="setDevice"></a>
# **setDevice**
> Device setDevice(id, body)
Sets the values of a device.
### Example
```java
// Import classes:
//import io.swagger.client.ApiClient;
//import io.swagger.client.ApiException;
//import io.swagger.client.Configuration;
//import io.swagger.client.auth.*;
//import io.swagger.client.api.DeviceApi;
ApiClient defaultClient = Configuration.getDefaultApiClient();
// Configure HTTP basic authorization: admin
HttpBasicAuth admin = (HttpBasicAuth) defaultClient.getAuthentication("admin");
admin.setUsername("YOUR USERNAME");
admin.setPassword("YOUR PASSWORD");
DeviceApi apiInstance = new DeviceApi();
Long id = 789L; // Long | The device id.
Device body = new Device(); // Device | The device values.
try {
Device result = apiInstance.setDevice(id, body);
System.out.println(result);
} catch (ApiException e) {
System.err.println("Exception when calling DeviceApi#setDevice");
e.printStackTrace();
}
```
### Parameters
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**id** | **Long**| The device id. |
**body** | [**Device**](Device.md)| The device values. | [optional]
### Return type
[**Device**](Device.md)
### Authorization
[admin](../README.md#admin)
### HTTP request headers
- **Content-Type**: application/json, application/xml
- **Accept**: application/json, application/xml