diff --git a/.gitignore b/.gitignore index b6caf46..61cb44c 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ .idea/ vendor/ /*.php +/*.jar diff --git a/Development.md b/Development.md new file mode 100644 index 0000000..7998e44 --- /dev/null +++ b/Development.md @@ -0,0 +1,9 @@ +# Regenerate the Client: + +1. Download resolved JSON API Specification from [SwaggerHub](https://app.swaggerhub.com/apis/supla/supla-cloud-api) and save it as `swagger.json` in project's root. +1. Download `swagger-codegent-cli` jar file from the [Maven repo](http://central.maven.org/maven2/io/swagger/swagger-codegen-cli/) and save it as `swagger-codegen.jar` in project's root. +1. Make sure you have `java` installed and available in your command line. +1. Run `composer install` +1. Run `composer run-script generate` +1. Declare all possibly new endpoints in the `SuplApi` class PHPDOC. +1. Review, commit and push API changes. diff --git a/README.md b/README.md index 5987529..eb2a6a2 100644 --- a/README.md +++ b/README.md @@ -1,8 +1,8 @@ # SUPLA-API-CLIENT for PHP - - [![Latest Release](https://img.shields.io/github/release/SUPLA/api-client-php.svg)](https://github.com/SUPLA/api-client-php/releases/latest) - [![Build Status](https://travis-ci.org/SUPLA/api-client-php.svg?branch=master)](https://travis-ci.org/SUPLA/supla-cloud) - [![Packagist Downloads](https://img.shields.io/packagist/dt/SUPLA/api-client.svg)](https://packagist.org/packages/supla/api-client) + +[![Latest Release](https://img.shields.io/github/release/SUPLA/api-client-php.svg)](https://github.com/SUPLA/api-client-php/releases/latest) +[![Build Status](https://travis-ci.org/SUPLA/api-client-php.svg?branch=master)](https://travis-ci.org/SUPLA/supla-cloud) +[![Packagist Downloads](https://img.shields.io/packagist/dt/SUPLA/api-client.svg)](https://packagist.org/packages/supla/api-client) Your home connected. www.supla.org @@ -25,22 +25,104 @@ Then create an instance of a client in your code. ```php 'svrX.supla.org', - 'clientId' => 'YOUR_CLIENT_ID', - 'secret' => 'YOUR_SECRET', - 'username' => 'YOUR_USERNAME', - 'password' => 'YOUR_PASSWORD', -]); +require_once(__DIR__ . '/vendor/autoload.php'); + +$client = new SuplaApi( + 'https://svr4.supla.org', // address of the SUPLA Cloud + '1_6cabrio4xdcsw8sk4socc04k00os4ssw88wc0kkws0g4ogkwgg', // Client ID + '54etn7d5ops0cooww80s0c8o88ssgkgsw4c4o8ks4wswgc0ww4', // Client Secret + 'api_1', // Username + 'pass' // Password +); ``` -# Usage +## Requirements -### Getting server info +PHP 5.5 and later -``` -$client->getServerInfo(); -``` +## 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/Api/AccessIdentifiersApi.md#createaccessidentifier) | **POST** /accessids | Create a new Access Identifier +*AccessIdentifiersApi* | [**deleteAccessIdentifier**](docs/Api/AccessIdentifiersApi.md#deleteaccessidentifier) | **DELETE** /accessids/{id} | Delete Access Identifier +*AccessIdentifiersApi* | [**getAccessIdentifier**](docs/Api/AccessIdentifiersApi.md#getaccessidentifier) | **GET** /accessids/{id} | Get Access Identifier +*AccessIdentifiersApi* | [**getAccessIdentifiers**](docs/Api/AccessIdentifiersApi.md#getaccessidentifiers) | **GET** /accessids | Get Access Identifiers list +*AccessIdentifiersApi* | [**updateAccessIdentifier**](docs/Api/AccessIdentifiersApi.md#updateaccessidentifier) | **PUT** /accessids/{id} | Update Access Identifier +*ChannelGroupsApi* | [**createChannelGroup**](docs/Api/ChannelGroupsApi.md#createchannelgroup) | **POST** /channel-groups | Create a new channel group +*ChannelGroupsApi* | [**deleteChannelGroup**](docs/Api/ChannelGroupsApi.md#deletechannelgroup) | **DELETE** /channel-groups/{id} | Delete Channel Group +*ChannelGroupsApi* | [**executeChannelGroupAction**](docs/Api/ChannelGroupsApi.md#executechannelgroupaction) | **PATCH** /channel-groups/{id} | Execute action on the channel group +*ChannelGroupsApi* | [**getChannelGroup**](docs/Api/ChannelGroupsApi.md#getchannelgroup) | **GET** /channel-groups/{id} | Get channel group by ID +*ChannelGroupsApi* | [**getChannelGroups**](docs/Api/ChannelGroupsApi.md#getchannelgroups) | **GET** /channel-groups | Get channels list +*ChannelGroupsApi* | [**updateChannelGroup**](docs/Api/ChannelGroupsApi.md#updatechannelgroup) | **PUT** /channel-groups/{id} | Update channel group +*ChannelsApi* | [**executeAction**](docs/Api/ChannelsApi.md#executeaction) | **PATCH** /channels/{id} | Execute action on the channel +*ChannelsApi* | [**getChannel**](docs/Api/ChannelsApi.md#getchannel) | **GET** /channels/{id} | Get channel by ID +*ChannelsApi* | [**getChannelMeasurementLogs**](docs/Api/ChannelsApi.md#getchannelmeasurementlogs) | **GET** /channels/{id}/measurement-logs | Get measurement logs. +*ChannelsApi* | [**getChannelMeasurementLogsCsvFile**](docs/Api/ChannelsApi.md#getchannelmeasurementlogscsvfile) | **GET** /channels/{id}/measurement-logs-csv | Get measurement logs as zipped CSV file. +*ChannelsApi* | [**getChannelSchedules**](docs/Api/ChannelsApi.md#getchannelschedules) | **GET** /channels/{id}/schedules | Get schedules list of the channel +*ChannelsApi* | [**getChannels**](docs/Api/ChannelsApi.md#getchannels) | **GET** /channels | Get channels list +*ChannelsApi* | [**updateChannel**](docs/Api/ChannelsApi.md#updatechannel) | **PUT** /channels/{id} | Update channel +*ClientAppsApi* | [**deleteClientApp**](docs/Api/ClientAppsApi.md#deleteclientapp) | **DELETE** /client-apps/{id} | Delete Client App +*ClientAppsApi* | [**getClientApps**](docs/Api/ClientAppsApi.md#getclientapps) | **GET** /client-apps | Get client apps +*ClientAppsApi* | [**updateClientApp**](docs/Api/ClientAppsApi.md#updateclientapp) | **PUT** /client-apps/{id} | Update client app +*IODevicesApi* | [**deleteIoDevice**](docs/Api/IODevicesApi.md#deleteiodevice) | **DELETE** /iodevices/{id} | Delete IO Device +*IODevicesApi* | [**getIoDevice**](docs/Api/IODevicesApi.md#getiodevice) | **GET** /iodevices/{id} | Get IO Device +*IODevicesApi* | [**getIoDeviceChannels**](docs/Api/IODevicesApi.md#getiodevicechannels) | **GET** /iodevices/{id}/channels | Get Channels that belong to IO Deice +*IODevicesApi* | [**getIoDevices**](docs/Api/IODevicesApi.md#getiodevices) | **GET** /iodevices | Get IO Devices +*IODevicesApi* | [**updateIoDevice**](docs/Api/IODevicesApi.md#updateiodevice) | **PUT** /iodevices/{id} | Update IO Device +*LocationsApi* | [**createLocation**](docs/Api/LocationsApi.md#createlocation) | **POST** /locations | Create a new location +*LocationsApi* | [**deleteLocation**](docs/Api/LocationsApi.md#deletelocation) | **DELETE** /locations/{id} | Delete location +*LocationsApi* | [**getLocation**](docs/Api/LocationsApi.md#getlocation) | **GET** /locations/{id} | Get location by ID +*LocationsApi* | [**getLocations**](docs/Api/LocationsApi.md#getlocations) | **GET** /locations | Get locations list +*LocationsApi* | [**updateLocation**](docs/Api/LocationsApi.md#updatelocation) | **PUT** /locations/{id} | Update location +*SchedulesApi* | [**createSchedule**](docs/Api/SchedulesApi.md#createschedule) | **POST** /schedules | Create a new schedule +*SchedulesApi* | [**deleteSchedule**](docs/Api/SchedulesApi.md#deleteschedule) | **DELETE** /schedules/{id} | Delete Schedule +*SchedulesApi* | [**enableSchedules**](docs/Api/SchedulesApi.md#enableschedules) | **PATCH** /schedules | Enable schedules +*SchedulesApi* | [**getSchedule**](docs/Api/SchedulesApi.md#getschedule) | **GET** /schedules/{id} | Get Schedule +*SchedulesApi* | [**getSchedules**](docs/Api/SchedulesApi.md#getschedules) | **GET** /schedules | Get schedules list +*SchedulesApi* | [**updateSchedule**](docs/Api/SchedulesApi.md#updateschedule) | **PUT** /schedules/{id} | Update schedule +*ServerApi* | [**getServerInfo**](docs/Api/ServerApi.md#getserverinfo) | **GET** /server-info | Get server info +*ServerApi* | [**getSuplaServerStatus**](docs/Api/ServerApi.md#getsuplaserverstatus) | **GET** /server-status | Get the SUPLA Server status +*UsersApi* | [**getCurrentUser**](docs/Api/UsersApi.md#getcurrentuser) | **GET** /users/current | Get current user +*UsersApi* | [**updateCurrentUser**](docs/Api/UsersApi.md#updatecurrentuser) | **PATCH** /users/current | Update current user + + +## Documentation For Models -TODO + - [AccessIdentifier](docs/Model/AccessIdentifier.md) + - [AccessIdentifierUpdateRequest](docs/Model/AccessIdentifierUpdateRequest.md) + - [Channel](docs/Model/Channel.md) + - [ChannelActionExecutionFailedResponse](docs/Model/ChannelActionExecutionFailedResponse.md) + - [ChannelExecuteActionRequest](docs/Model/ChannelExecuteActionRequest.md) + - [ChannelFunction](docs/Model/ChannelFunction.md) + - [ChannelFunctionAction](docs/Model/ChannelFunctionAction.md) + - [ChannelFunctionActionEnum](docs/Model/ChannelFunctionActionEnum.md) + - [ChannelFunctionEnumNames](docs/Model/ChannelFunctionEnumNames.md) + - [ChannelGroup](docs/Model/ChannelGroup.md) + - [ChannelGroupRequest](docs/Model/ChannelGroupRequest.md) + - [ChannelMeasurementLog](docs/Model/ChannelMeasurementLog.md) + - [ChannelParam](docs/Model/ChannelParam.md) + - [ChannelType](docs/Model/ChannelType.md) + - [ChannelUnsupportedFunctionResponse](docs/Model/ChannelUnsupportedFunctionResponse.md) + - [ChannelUpdateConfirmationResponse](docs/Model/ChannelUpdateConfirmationResponse.md) + - [ChannelUpdateRequest](docs/Model/ChannelUpdateRequest.md) + - [ClientApp](docs/Model/ClientApp.md) + - [ClientAppUpdateRequest](docs/Model/ClientAppUpdateRequest.md) + - [Device](docs/Model/Device.md) + - [IODeviceUpdateRequest](docs/Model/IODeviceUpdateRequest.md) + - [Location](docs/Model/Location.md) + - [LocationUpdateRequest](docs/Model/LocationUpdateRequest.md) + - [Schedule](docs/Model/Schedule.md) + - [ScheduleClosestExecutions](docs/Model/ScheduleClosestExecutions.md) + - [ScheduleFuture](docs/Model/ScheduleFuture.md) + - [SchedulePast](docs/Model/SchedulePast.md) + - [ScheduleRequest](docs/Model/ScheduleRequest.md) + - [ScheduleResult](docs/Model/ScheduleResult.md) + - [SchedulesEnableRequest](docs/Model/SchedulesEnableRequest.md) + - [ServerInfo](docs/Model/ServerInfo.md) + - [ServerInfoTimezone](docs/Model/ServerInfoTimezone.md) + - [UserData](docs/Model/UserData.md) + - [UserUpdateRequest](docs/Model/UserUpdateRequest.md) diff --git a/codegen-template/ApiException.mustache b/codegen-template/ApiException.mustache new file mode 100644 index 0000000..e8115d2 --- /dev/null +++ b/codegen-template/ApiException.mustache @@ -0,0 +1,111 @@ +partial_header}} +/** + * NOTE: This class is auto generated by the swagger code generator program. + * https://github.com/swagger-api/swagger-codegen + * Do not edit the class manually. + */ + +namespace {{invokerPackage}}; + +use \Exception; + +/** + * ApiException Class Doc Comment + * + * @category Class + * @package {{invokerPackage}} + * @author Swagger Codegen team + * @link https://github.com/swagger-api/swagger-codegen + */ +class ApiException extends Exception +{ + + /** + * The HTTP body of the server response either as Json or string. + * + * @var mixed + */ + protected $responseBody; + + /** + * The HTTP header of the server response. + * + * @var string[]|null + */ + protected $responseHeaders; + + /** + * The deserialized response object + * + * @var $responseObject; + */ + protected $responseObject; + + /** + * Constructor + * + * @param string $message Error message + * @param int $code HTTP status code + * @param string[]|null $responseHeaders HTTP response header + * @param mixed $responseBody HTTP decoded body of the server response either as \stdClass or string + */ + public function __construct($message = "", $code = 0, $responseHeaders = [], $responseBody = null) + { + parent::__construct($message, $code); + $this->responseHeaders = $responseHeaders; + $this->responseBody = $responseBody; + } + + /** + * Gets the HTTP response header + * + * @return string[]|null HTTP response header + */ + public function getResponseHeaders() + { + return $this->responseHeaders; + } + + /** + * Gets the HTTP body of the server response either as Json or string + * + * @return mixed HTTP body of the server response either as \stdClass or string + */ + public function getResponseBody() + { + return $this->responseBody; + } + + /** + * Sets the deseralized response object (during deserialization) + * + * @param mixed $obj Deserialized response object + * + * @return void + */ + public function setResponseObject($obj) + { + $this->responseObject = $obj; + } + + /** + * Gets the deseralized response object (during deserialization) + * + * @return mixed the deserialized response object + */ + public function getResponseObject() + { + return $this->responseObject; + } +} diff --git a/codegen-template/Configuration.mustache b/codegen-template/Configuration.mustache new file mode 100644 index 0000000..cdbba93 --- /dev/null +++ b/codegen-template/Configuration.mustache @@ -0,0 +1,422 @@ +partial_header}} +/** + * NOTE: This class is auto generated by the swagger code generator program. + * https://github.com/swagger-api/swagger-codegen + * Do not edit the class manually. + */ + +namespace {{invokerPackage}}; + +/** + * Configuration Class Doc Comment + * PHP version 5 + * + * @category Class + * @package {{invokerPackage}} + * @author Swagger Codegen team + * @link https://github.com/swagger-api/swagger-codegen + */ +class Configuration +{ + private static $defaultConfiguration; + + /** + * Associate array to store API key(s) + * + * @var string[] + */ + protected $apiKeys = []; + + /** + * Associate array to store API prefix (e.g. Bearer) + * + * @var string[] + */ + protected $apiKeyPrefixes = []; + + /** + * Access token for OAuth + * + * @var string + */ + protected $accessToken = ''; + + /** + * Username for HTTP basic authentication + * + * @var string + */ + protected $username = ''; + + /** + * Password for HTTP basic authentication + * + * @var string + */ + protected $password = ''; + + /** + * The host + * + * @var string + */ + protected $host = '{{basePath}}'; + + /** + * User agent of the HTTP request, set to "PHP-Swagger" by default + * + * @var string + */ + protected $userAgent = '{{#httpUserAgent}}{{{.}}}{{/httpUserAgent}}{{^httpUserAgent}}Swagger-Codegen/{{#artifactVersion}}{{{.}}}{{/artifactVersion}}{{^artifactVersion}}1.0.0{{/artifactVersion}}/php{{/httpUserAgent}}'; + + /** + * Debug switch (default set to false) + * + * @var bool + */ + protected $debug = false; + + /** + * Debug file location (log to STDOUT by default) + * + * @var string + */ + protected $debugFile = 'php://output'; + + /** + * Debug file location (log to STDOUT by default) + * + * @var string + */ + protected $tempFolderPath; + + /** + * Constructor + */ + public function __construct() + { + $this->tempFolderPath = sys_get_temp_dir(); + } + + /** + * Sets API key + * + * @param string $apiKeyIdentifier API key identifier (authentication scheme) + * @param string $key API key or token + * + * @return $this + */ + public function setApiKey($apiKeyIdentifier, $key) + { + $this->apiKeys[$apiKeyIdentifier] = $key; + return $this; + } + + /** + * Gets API key + * + * @param string $apiKeyIdentifier API key identifier (authentication scheme) + * + * @return string API key or token + */ + public function getApiKey($apiKeyIdentifier) + { + return isset($this->apiKeys[$apiKeyIdentifier]) ? $this->apiKeys[$apiKeyIdentifier] : null; + } + + /** + * Sets the prefix for API key (e.g. Bearer) + * + * @param string $apiKeyIdentifier API key identifier (authentication scheme) + * @param string $prefix API key prefix, e.g. Bearer + * + * @return $this + */ + public function setApiKeyPrefix($apiKeyIdentifier, $prefix) + { + $this->apiKeyPrefixes[$apiKeyIdentifier] = $prefix; + return $this; + } + + /** + * Gets API key prefix + * + * @param string $apiKeyIdentifier API key identifier (authentication scheme) + * + * @return string + */ + public function getApiKeyPrefix($apiKeyIdentifier) + { + return isset($this->apiKeyPrefixes[$apiKeyIdentifier]) ? $this->apiKeyPrefixes[$apiKeyIdentifier] : null; + } + + /** + * Sets the access token for OAuth + * + * @param string $accessToken Token for OAuth + * + * @return $this + */ + public function setAccessToken($accessToken) + { + $this->accessToken = $accessToken; + return $this; + } + + /** + * Gets the access token for OAuth + * + * @return string Access token for OAuth + */ + public function getAccessToken() + { + return $this->accessToken; + } + + /** + * Sets the username for HTTP basic authentication + * + * @param string $username Username for HTTP basic authentication + * + * @return $this + */ + public function setUsername($username) + { + $this->username = $username; + return $this; + } + + /** + * Gets the username for HTTP basic authentication + * + * @return string Username for HTTP basic authentication + */ + public function getUsername() + { + return $this->username; + } + + /** + * Sets the password for HTTP basic authentication + * + * @param string $password Password for HTTP basic authentication + * + * @return $this + */ + public function setPassword($password) + { + $this->password = $password; + return $this; + } + + /** + * Gets the password for HTTP basic authentication + * + * @return string Password for HTTP basic authentication + */ + public function getPassword() + { + return $this->password; + } + + /** + * Sets the host + * + * @param string $host Host + * + * @return $this + */ + public function setHost($host) + { + $this->host = $host; + return $this; + } + + /** + * Gets the host + * + * @return string Host + */ + public function getHost() + { + return $this->host; + } + + /** + * Sets the user agent of the api client + * + * @param string $userAgent the user agent of the api client + * + * @throws \InvalidArgumentException + * @return $this + */ + public function setUserAgent($userAgent) + { + if (!is_string($userAgent)) { + throw new \InvalidArgumentException('User-agent must be a string.'); + } + + $this->userAgent = $userAgent; + return $this; + } + + /** + * Gets the user agent of the api client + * + * @return string user agent + */ + public function getUserAgent() + { + return $this->userAgent; + } + + /** + * Sets debug flag + * + * @param bool $debug Debug flag + * + * @return $this + */ + public function setDebug($debug) + { + $this->debug = $debug; + return $this; + } + + /** + * Gets the debug flag + * + * @return bool + */ + public function getDebug() + { + return $this->debug; + } + + /** + * Sets the debug file + * + * @param string $debugFile Debug file + * + * @return $this + */ + public function setDebugFile($debugFile) + { + $this->debugFile = $debugFile; + return $this; + } + + /** + * Gets the debug file + * + * @return string + */ + public function getDebugFile() + { + return $this->debugFile; + } + + /** + * Sets the temp folder path + * + * @param string $tempFolderPath Temp folder path + * + * @return $this + */ + public function setTempFolderPath($tempFolderPath) + { + $this->tempFolderPath = $tempFolderPath; + return $this; + } + + /** + * Gets the temp folder path + * + * @return string Temp folder path + */ + public function getTempFolderPath() + { + return $this->tempFolderPath; + } + + /** + * Gets the default configuration instance + * + * @return Configuration + */ + public static function getDefaultConfiguration() + { + if (self::$defaultConfiguration === null) { + self::$defaultConfiguration = new Configuration(); + } + + return self::$defaultConfiguration; + } + + /** + * Sets the detault configuration instance + * + * @param Configuration $config An instance of the Configuration Object + * + * @return void + */ + public static function setDefaultConfiguration(Configuration $config) + { + self::$defaultConfiguration = $config; + } + + /** + * Gets the essential information for debugging + * + * @return string The report for debugging + */ + public static function toDebugReport() + { + $report = 'PHP SDK ({{invokerPackage}}) Debug Report:' . PHP_EOL; + $report .= ' OS: ' . php_uname() . PHP_EOL; + $report .= ' PHP Version: ' . PHP_VERSION . PHP_EOL; + $report .= ' OpenAPI Spec Version: {{version}}' . PHP_EOL; + {{#artifactVersion}} + $report .= ' SDK Package Version: {{artifactVersion}}' . PHP_EOL; + {{/artifactVersion}} + $report .= ' Temp Folder Path: ' . self::getDefaultConfiguration()->getTempFolderPath() . PHP_EOL; + + return $report; + } + + /** + * Get API key (with prefix if set) + * + * @param string $apiKeyIdentifier name of apikey + * + * @return string API key with the prefix + */ + public function getApiKeyWithPrefix($apiKeyIdentifier) + { + $prefix = $this->getApiKeyPrefix($apiKeyIdentifier); + $apiKey = $this->getApiKey($apiKeyIdentifier); + + if ($apiKey === null) { + return null; + } + + if ($prefix === null) { + $keyWithPrefix = $apiKey; + } else { + $keyWithPrefix = $prefix . ' ' . $apiKey; + } + + return $keyWithPrefix; + } +} diff --git a/codegen-template/HeaderSelector.mustache b/codegen-template/HeaderSelector.mustache new file mode 100644 index 0000000..909beb1 --- /dev/null +++ b/codegen-template/HeaderSelector.mustache @@ -0,0 +1,100 @@ +partial_header}} +/** + * NOTE: This class is auto generated by the swagger code generator program. + * https://github.com/swagger-api/swagger-codegen + * Do not edit the class manually. + */ + +namespace {{invokerPackage}}; + +use \Exception; + +/** + * ApiException Class Doc Comment + * + * @category Class + * @package {{invokerPackage}} + * @author Swagger Codegen team + * @link https://github.com/swagger-api/swagger-codegen + */ +class HeaderSelector +{ + + /** + * @param string[] $accept + * @param string[] $contentTypes + * @return array + */ + public function selectHeaders($accept, $contentTypes) + { + $headers = []; + + $accept = $this->selectAcceptHeader($accept); + if ($accept !== null) { + $headers['Accept'] = $accept; + } + + $headers['Content-Type'] = $this->selectContentTypeHeader($contentTypes); + return $headers; + } + + /** + * @param string[] $accept + * @return array + */ + public function selectHeadersForMultipart($accept) + { + $headers = $this->selectHeaders($accept, []); + + unset($headers['Content-Type']); + return $headers; + } + + /** + * Return the header 'Accept' based on an array of Accept provided + * + * @param string[] $accept Array of header + * + * @return string Accept (e.g. application/json) + */ + private function selectAcceptHeader($accept) + { + if (count($accept) === 0 || (count($accept) === 1 && $accept[0] === '')) { + return null; + } elseif (preg_grep("/application\/json/i", $accept)) { + return 'application/json'; + } else { + return implode(',', $accept); + } + } + + /** + * Return the content type based on an array of content-type provided + * + * @param string[] $contentType Array fo content-type + * + * @return string Content-Type (e.g. application/json) + */ + private function selectContentTypeHeader($contentType) + { + if (count($contentType) === 0 || (count($contentType) === 1 && $contentType[0] === '')) { + return 'application/json'; + } elseif (preg_grep("/application\/json/i", $contentType)) { + return 'application/json'; + } else { + return implode(',', $contentType); + } + } +} + diff --git a/codegen-template/ModelInterface.mustache b/codegen-template/ModelInterface.mustache new file mode 100644 index 0000000..538bf66 --- /dev/null +++ b/codegen-template/ModelInterface.mustache @@ -0,0 +1,86 @@ +partial_header}} +/** + * NOTE: This class is auto generated by the swagger code generator program. + * https://github.com/swagger-api/swagger-codegen + * Do not edit the class manually. + */ + +namespace {{modelPackage}}; + +/** + * Interface abstracting model access. + * + * @package {{modelPackage}} + * @author Swagger Codegen team + */ +interface ModelInterface +{ + /** + * The original name of the model. + * + * @return string + */ + public function getModelName(); + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function swaggerTypes(); + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function swaggerFormats(); + + /** + * Array of attributes where the key is the local name, and the value is the original name + * + * @return array + */ + public static function attributeMap(); + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters(); + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters(); + + /** + * Show all the invalid properties with reasons. + * + * @return array + */ + public function listInvalidProperties(); + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool + */ + public function valid(); +} diff --git a/codegen-template/ObjectSerializer.mustache b/codegen-template/ObjectSerializer.mustache new file mode 100644 index 0000000..460b69b --- /dev/null +++ b/codegen-template/ObjectSerializer.mustache @@ -0,0 +1,307 @@ +partial_header}} +/** + * NOTE: This class is auto generated by the swagger code generator program. + * https://github.com/swagger-api/swagger-codegen + * Do not edit the class manually. + */ + +namespace {{invokerPackage}}; + +/** + * ObjectSerializer Class Doc Comment + * + * @category Class + * @package {{invokerPackage}} + * @author Swagger Codegen team + * @link https://github.com/swagger-api/swagger-codegen + */ +class ObjectSerializer +{ + /** + * Serialize data + * + * @param mixed $data the data to serialize + * @param string $type the SwaggerType of the data + * @param string $format the format of the Swagger type of the data + * + * @return string|object serialized form of $data + */ + public static function sanitizeForSerialization($data, $type = null, $format = null) + { + if (is_scalar($data) || null === $data) { + return $data; + } elseif ($data instanceof \DateTime) { + return ($format === 'date') ? $data->format('Y-m-d') : $data->format(\DateTime::ATOM); + } elseif (is_array($data)) { + foreach ($data as $property => $value) { + $data[$property] = self::sanitizeForSerialization($value); + } + return $data; + } elseif (is_object($data)) { + $values = []; + $formats = $data::swaggerFormats(); + foreach ($data::swaggerTypes() as $property => $swaggerType) { + $getter = $data::getters()[$property]; + $value = $data->$getter(); + if ($value !== null + && !in_array($swaggerType, [{{&primitives}}], true) + && method_exists($swaggerType, 'getAllowableEnumValues') + && !in_array($value, $swaggerType::getAllowableEnumValues())) { + $imploded = implode("', '", $swaggerType::getAllowableEnumValues()); + throw new \InvalidArgumentException("Invalid value for enum '$swaggerType', must be one of: '$imploded'"); + } + if ($value !== null) { + $values[$data::attributeMap()[$property]] = self::sanitizeForSerialization($value, $swaggerType, $formats[$property]); + } + } + return (object)$values; + } else { + return (string)$data; + } + } + + /** + * Sanitize filename by removing path. + * e.g. ../../sun.gif becomes sun.gif + * + * @param string $filename filename to be sanitized + * + * @return string the sanitized filename + */ + public static function sanitizeFilename($filename) + { + if (preg_match("/.*[\/\\\\](.*)$/", $filename, $match)) { + return $match[1]; + } else { + return $filename; + } + } + + /** + * Take value and turn it into a string suitable for inclusion in + * the path, by url-encoding. + * + * @param string $value a string which will be part of the path + * + * @return string the serialized object + */ + public static function toPathValue($value) + { + return rawurlencode(self::toString($value)); + } + + /** + * Take value and turn it into a string suitable for inclusion in + * the query, by imploding comma-separated if it's an object. + * If it's a string, pass through unchanged. It will be url-encoded + * later. + * + * @param string[]|string|\DateTime $object an object to be serialized to a string + * + * @return string the serialized object + */ + public static function toQueryValue($object) + { + if (is_array($object)) { + return implode(',', $object); + } else { + return self::toString($object); + } + } + + /** + * Take value and turn it into a string suitable for inclusion in + * the header. If it's a string, pass through unchanged + * If it's a datetime object, format it in ISO8601 + * + * @param string $value a string which will be part of the header + * + * @return string the header string + */ + public static function toHeaderValue($value) + { + return self::toString($value); + } + + /** + * Take value and turn it into a string suitable for inclusion in + * the http body (form parameter). If it's a string, pass through unchanged + * If it's a datetime object, format it in ISO8601 + * + * @param string|\SplFileObject $value the value of the form parameter + * + * @return string the form string + */ + public static function toFormValue($value) + { + if ($value instanceof \SplFileObject) { + return $value->getRealPath(); + } else { + return self::toString($value); + } + } + + /** + * Take value and turn it into a string suitable for inclusion in + * the parameter. If it's a string, pass through unchanged + * If it's a datetime object, format it in ISO8601 + * + * @param string|\DateTime $value the value of the parameter + * + * @return string the header string + */ + public static function toString($value) + { + if ($value instanceof \DateTime) { // datetime in ISO8601 format + return $value->format(\DateTime::ATOM); + } else { + return $value; + } + } + + /** + * Serialize an array to a string. + * + * @param array $collection collection to serialize to a string + * @param string $collectionFormat the format use for serialization (csv, + * ssv, tsv, pipes, multi) + * @param bool $allowCollectionFormatMulti allow collection format to be a multidimensional array + * + * @return string + */ + public static function serializeCollection(array $collection, $collectionFormat, $allowCollectionFormatMulti = false) + { + if ($allowCollectionFormatMulti && ('multi' === $collectionFormat)) { + // http_build_query() almost does the job for us. We just + // need to fix the result of multidimensional arrays. + return preg_replace('/%5B[0-9]+%5D=/', '=', http_build_query($collection, '', '&')); + } + switch ($collectionFormat) { + case 'pipes': + return implode('|', $collection); + + case 'tsv': + return implode("\t", $collection); + + case 'ssv': + return implode(' ', $collection); + + case 'csv': + // Deliberate fall through. CSV is default format. + default: + return implode(',', $collection); + } + } + + /** + * Deserialize a JSON string into an object + * + * @param mixed $data object or primitive to be deserialized + * @param string $class class name is passed as a string + * @param string[] $httpHeaders HTTP headers + * @param string $discriminator discriminator if polymorphism is used + * + * @return object|array|null an single or an array of $class instances + */ + public static function deserialize($data, $class, $httpHeaders = null) + { + if (null === $data) { + return null; + } elseif (substr($class, 0, 4) === 'map[') { // for associative array e.g. map[string,int] + $inner = substr($class, 4, -1); + $deserialized = []; + if (strrpos($inner, ",") !== false) { + $subClass_array = explode(',', $inner, 2); + $subClass = $subClass_array[1]; + foreach ($data as $key => $value) { + $deserialized[$key] = self::deserialize($value, $subClass, null); + } + } + return $deserialized; + } elseif (strcasecmp(substr($class, -2), '[]') === 0) { + $subClass = substr($class, 0, -2); + $values = []; + foreach ($data as $key => $value) { + $values[] = self::deserialize($value, $subClass, null); + } + return $values; + } elseif ($class === 'object') { + settype($data, 'array'); + return $data; + } elseif ($class === '\DateTime') { + // Some API's return an invalid, empty string as a + // date-time property. DateTime::__construct() will return + // the current time for empty input which is probably not + // what is meant. The invalid empty string is probably to + // be interpreted as a missing field/value. Let's handle + // this graceful. + if (!empty($data)) { + return new \DateTime($data); + } else { + return null; + } + } elseif (in_array($class, [{{&primitives}}], true)) { + settype($data, $class); + return $data; + } elseif ($class === '\SplFileObject') { + /** @var \Psr\Http\Message\StreamInterface $data */ + + // determine file name + if (array_key_exists('Content-Disposition', $httpHeaders) && + preg_match('/inline; filename=[\'"]?([^\'"\s]+)[\'"]?$/i', $httpHeaders['Content-Disposition'], $match)) { + $filename = Configuration::getDefaultConfiguration()->getTempFolderPath() . DIRECTORY_SEPARATOR . self::sanitizeFilename($match[1]); + } else { + $filename = tempnam(Configuration::getDefaultConfiguration()->getTempFolderPath(), ''); + } + + $file = fopen($filename, 'w'); + while ($chunk = $data->read(200)) { + fwrite($file, $chunk); + } + fclose($file); + + return new \SplFileObject($filename, 'r'); + } elseif (method_exists($class, 'getAllowableEnumValues')) { + if (!in_array($data, $class::getAllowableEnumValues())) { + $imploded = implode("', '", $class::getAllowableEnumValues()); + throw new \InvalidArgumentException("Invalid value for enum '$class', must be one of: '$imploded'"); + } + return $data; + } else { + // If a discriminator is defined and points to a valid subclass, use it. + $discriminator = $class::DISCRIMINATOR; + if (!empty($discriminator) && isset($data->{$discriminator}) && is_string($data->{$discriminator})) { + $subclass = '\{{invokerPackage}}\Model\\' . $data->{$discriminator}; + if (is_subclass_of($subclass, $class)) { + $class = $subclass; + } + } + $instance = new $class(); + foreach ($instance::swaggerTypes() as $property => $type) { + $propertySetter = $instance::setters()[$property]; + + if (!isset($propertySetter) || !isset($data->{$instance::attributeMap()[$property]})) { + continue; + } + + $propertyValue = $data->{$instance::attributeMap()[$property]}; + if (isset($propertyValue)) { + $instance->$propertySetter(self::deserialize($propertyValue, $type, null)); + } + } + return $instance; + } + } +} diff --git a/codegen-template/README.mustache b/codegen-template/README.mustache new file mode 100644 index 0000000..f60d265 --- /dev/null +++ b/codegen-template/README.mustache @@ -0,0 +1,55 @@ +# SUPLA-API-CLIENT for PHP + +[![Latest Release](https://img.shields.io/github/release/SUPLA/api-client-php.svg)](https://github.com/SUPLA/api-client-php/releases/latest) +[![Build Status](https://travis-ci.org/SUPLA/api-client-php.svg?branch=master)](https://travis-ci.org/SUPLA/supla-cloud) +[![Packagist Downloads](https://img.shields.io/packagist/dt/SUPLA/api-client.svg)](https://packagist.org/packages/supla/api-client) + +Your home connected. www.supla.org + +# Installation + +Install with [Composer](https://getcomposer.org/). + +``` +composer require supla/api-client +``` + +# Configuration + +Get the API configuration values from the SUPLA-CLOUD you use. +You can find them on the *RESTFUL API* page after enabling it. + +![](img/restful-api-cloud.jpg) + +Then create an instance of a client in your code. + +```php +partial_header}} +/** + * NOTE: This class is auto generated by the swagger code generator program. + * https://github.com/swagger-api/swagger-codegen + * Do not edit the class manually. + */ + +namespace {{apiPackage}}; + +use GuzzleHttp\Client; +use GuzzleHttp\ClientInterface; +use GuzzleHttp\Exception\RequestException; +use GuzzleHttp\Psr7\MultipartStream; +use GuzzleHttp\Psr7\Request; +use GuzzleHttp\RequestOptions; +use {{invokerPackage}}\ApiException; +use {{invokerPackage}}\Configuration; +use {{invokerPackage}}\HeaderSelector; +use {{invokerPackage}}\ObjectSerializer; + +/** + * {{classname}} Class Doc Comment + * + * @category Class + * @package {{invokerPackage}} + * @author Swagger Codegen team + * @link https://github.com/swagger-api/swagger-codegen + */ +{{#operations}}class {{classname}} +{ + /** + * @var ClientInterface + */ + protected $client; + + /** + * @var Configuration + */ + protected $config; + + /** + * @var HeaderSelector + */ + protected $headerSelector; + + /** + * @param ClientInterface $client + * @param Configuration $config + * @param HeaderSelector $selector + */ + public function __construct( + ClientInterface $client = null, + Configuration $config = null, + HeaderSelector $selector = null + ) { + $this->client = $client ?: new Client(); + $this->config = $config ?: new Configuration(); + $this->headerSelector = $selector ?: new HeaderSelector(); + } + + /** + * @return Configuration + */ + public function getConfig() + { + return $this->config; + } + +{{#operation}} + /** + * Operation {{{operationId}}} +{{#summary}} + * + * {{{summary}}} +{{/summary}} + * +{{#description}} + * {{.}} + * +{{/description}} +{{#allParams}} + * @param {{dataType}} ${{paramName}}{{#description}} {{description}}{{/description}}{{^description}} {{paramName}}{{/description}} {{#required}}(required){{/required}}{{^required}}(optional{{#defaultValue}}, default to {{{.}}}{{/defaultValue}}){{/required}} +{{/allParams}} + * + * @throws \{{invokerPackage}}\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return {{#returnType}}{{{returnType}}}{{/returnType}}{{^returnType}}void{{/returnType}} + */ + public function {{operationId}}({{#allParams}}${{paramName}}{{^required}} = {{#defaultValue}}'{{{.}}}'{{/defaultValue}}{{^defaultValue}}null{{/defaultValue}}{{/required}}{{#hasMore}}, {{/hasMore}}{{/allParams}}) + { + {{#returnType}}list($response) = {{/returnType}}$this->{{operationId}}WithHttpInfo({{#allParams}}${{paramName}}{{#hasMore}}, {{/hasMore}}{{/allParams}});{{#returnType}} + return $response;{{/returnType}} + } + + /** + * Operation {{{operationId}}}WithHttpInfo +{{#summary}} + * + * {{{summary}}} +{{/summary}} + * +{{#description}} + * {{.}} + * +{{/description}} +{{#allParams}} + * @param {{dataType}} ${{paramName}}{{#description}} {{description}}{{/description}} {{#required}}(required){{/required}}{{^required}}(optional{{#defaultValue}}, default to {{{.}}}{{/defaultValue}}){{/required}} +{{/allParams}} + * + * @throws \{{invokerPackage}}\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of {{#returnType}}{{{returnType}}}{{/returnType}}{{^returnType}}null{{/returnType}}, HTTP status code, HTTP response headers (array of strings) + */ + public function {{operationId}}WithHttpInfo({{#allParams}}${{paramName}}{{^required}} = {{#defaultValue}}'{{{.}}}'{{/defaultValue}}{{^defaultValue}}null{{/defaultValue}}{{/required}}{{#hasMore}}, {{/hasMore}}{{/allParams}}) + { + $returnType = '{{returnType}}'; + $request = $this->{{operationId}}Request({{#allParams}}${{paramName}}{{#hasMore}}, {{/hasMore}}{{/allParams}}); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + ); + } + + $statusCode = $response->getStatusCode(); + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $response->getBody() + ); + } + + {{#returnType}} + $responseBody = $response->getBody(); + if ($returnType === '\SplFileObject') { + $content = $responseBody; //stream goes to serializer + } else { + $content = $responseBody->getContents(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + {{/returnType}} + {{^returnType}} + return [null, $statusCode, $response->getHeaders()]; + {{/returnType}} + + } catch (ApiException $e) { + switch ($e->getCode()) { + {{#responses}} + {{#dataType}} + {{^isWildcard}}case {{code}}:{{/isWildcard}}{{#isWildcard}}default:{{/isWildcard}} + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '{{dataType}}', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + {{/dataType}} + {{/responses}} + } + throw $e; + } + } + + /** + * Operation {{{operationId}}}Async + * + * {{{summary}}} + * +{{#description}} + * {{.}} + * +{{/description}} +{{#allParams}} + * @param {{dataType}} ${{paramName}}{{#description}} {{description}}{{/description}} {{#required}}(required){{/required}}{{^required}}(optional{{#defaultValue}}, default to {{{.}}}{{/defaultValue}}){{/required}} +{{/allParams}} + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function {{operationId}}Async({{#allParams}}${{paramName}}{{^required}} = {{#defaultValue}}'{{{.}}}'{{/defaultValue}}{{^defaultValue}}null{{/defaultValue}}{{/required}}{{#hasMore}}, {{/hasMore}}{{/allParams}}) + { + return $this->{{operationId}}AsyncWithHttpInfo({{#allParams}}${{paramName}}{{#hasMore}}, {{/hasMore}}{{/allParams}}) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation {{{operationId}}}AsyncWithHttpInfo + * + * {{{summary}}} + * +{{#description}} + * {{.}} + * +{{/description}} +{{#allParams}} + * @param {{dataType}} ${{paramName}}{{#description}} {{description}}{{/description}} {{#required}}(required){{/required}}{{^required}}(optional{{#defaultValue}}, default to {{{.}}}{{/defaultValue}}){{/required}} +{{/allParams}} + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function {{operationId}}AsyncWithHttpInfo({{#allParams}}${{paramName}}{{^required}} = {{#defaultValue}}'{{{.}}}'{{/defaultValue}}{{^defaultValue}}null{{/defaultValue}}{{/required}}{{#hasMore}}, {{/hasMore}}{{/allParams}}) + { + $returnType = '{{returnType}}'; + $request = $this->{{operationId}}Request({{#allParams}}${{paramName}}{{#hasMore}}, {{/hasMore}}{{/allParams}}); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + {{#returnType}} + $responseBody = $response->getBody(); + if ($returnType === '\SplFileObject') { + $content = $responseBody; //stream goes to serializer + } else { + $content = $responseBody->getContents(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + {{/returnType}} + {{^returnType}} + return [null, $response->getStatusCode(), $response->getHeaders()]; + {{/returnType}} + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + $response->getBody() + ); + } + ); + } + + /** + * Create request for operation '{{{operationId}}}' + * +{{#allParams}} + * @param {{dataType}} ${{paramName}}{{#description}} {{description}}{{/description}} {{#required}}(required){{/required}}{{^required}}(optional{{#defaultValue}}, default to {{{.}}}{{/defaultValue}}){{/required}} +{{/allParams}} + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + protected function {{operationId}}Request({{#allParams}}${{paramName}}{{^required}} = {{#defaultValue}}'{{{.}}}'{{/defaultValue}}{{^defaultValue}}null{{/defaultValue}}{{/required}}{{#hasMore}}, {{/hasMore}}{{/allParams}}) + { + {{#allParams}} + {{#required}} + // verify the required parameter '{{paramName}}' is set + if (${{paramName}} === null || (is_array(${{paramName}}) && count(${{paramName}}) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter ${{paramName}} when calling {{operationId}}' + ); + } + {{/required}} + {{#hasValidation}} + {{#maxLength}} + if ({{^required}}${{paramName}} !== null && {{/required}}strlen(${{paramName}}) > {{maxLength}}) { + throw new \InvalidArgumentException('invalid length for "${{paramName}}" when calling {{classname}}.{{operationId}}, must be smaller than or equal to {{maxLength}}.'); + } + {{/maxLength}} + {{#minLength}} + if ({{^required}}${{paramName}} !== null && {{/required}}strlen(${{paramName}}) < {{minLength}}) { + throw new \InvalidArgumentException('invalid length for "${{paramName}}" when calling {{classname}}.{{operationId}}, must be bigger than or equal to {{minLength}}.'); + } + {{/minLength}} + {{#maximum}} + if ({{^required}}${{paramName}} !== null && {{/required}}${{paramName}} >{{#exclusiveMaximum}}={{/exclusiveMaximum}} {{maximum}}) { + throw new \InvalidArgumentException('invalid value for "${{paramName}}" when calling {{classname}}.{{operationId}}, must be smaller than {{^exclusiveMaximum}}or equal to {{/exclusiveMaximum}}{{maximum}}.'); + } + {{/maximum}} + {{#minimum}} + if ({{^required}}${{paramName}} !== null && {{/required}}${{paramName}} <{{#exclusiveMinimum}}={{/exclusiveMinimum}} {{minimum}}) { + throw new \InvalidArgumentException('invalid value for "${{paramName}}" when calling {{classname}}.{{operationId}}, must be bigger than {{^exclusiveMinimum}}or equal to {{/exclusiveMinimum}}{{minimum}}.'); + } + {{/minimum}} + {{#pattern}} + if ({{^required}}${{paramName}} !== null && {{/required}}!preg_match("{{{pattern}}}", ${{paramName}})) { + throw new \InvalidArgumentException("invalid value for \"{{paramName}}\" when calling {{classname}}.{{operationId}}, must conform to the pattern {{{pattern}}}."); + } + {{/pattern}} + {{#maxItems}} + if ({{^required}}${{paramName}} !== null && {{/required}}count(${{paramName}}) > {{maxItems}}) { + throw new \InvalidArgumentException('invalid value for "${{paramName}}" when calling {{classname}}.{{operationId}}, number of items must be less than or equal to {{maxItems}}.'); + } + {{/maxItems}} + {{#minItems}} + if ({{^required}}${{paramName}} !== null && {{/required}}count(${{paramName}}) < {{minItems}}) { + throw new \InvalidArgumentException('invalid value for "${{paramName}}" when calling {{classname}}.{{operationId}}, number of items must be greater than or equal to {{minItems}}.'); + } + {{/minItems}} + + {{/hasValidation}} + {{/allParams}} + + $resourcePath = '{{{path}}}'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + {{#queryParams}} + // query params + {{#collectionFormat}} + if (is_array(${{paramName}})) { + ${{paramName}} = ObjectSerializer::serializeCollection(${{paramName}}, '{{collectionFormat}}', true); + } + {{/collectionFormat}} + if (${{paramName}} !== null) { + $queryParams['{{baseName}}'] = ObjectSerializer::toQueryValue(${{paramName}}); + } + {{/queryParams}} + {{#headerParams}} + // header params + {{#collectionFormat}} + if (is_array(${{paramName}})) { + ${{paramName}} = ObjectSerializer::serializeCollection(${{paramName}}, '{{collectionFormat}}'); + } + {{/collectionFormat}} + if (${{paramName}} !== null) { + $headerParams['{{baseName}}'] = ObjectSerializer::toHeaderValue(${{paramName}}); + } + {{/headerParams}} + + {{#pathParams}} + // path params + {{#collectionFormat}} + if (is_array(${{paramName}})) { + ${{paramName}} = ObjectSerializer::serializeCollection(${{paramName}}, '{{collectionFormat}}'); + } + {{/collectionFormat}} + if (${{paramName}} !== null) { + $resourcePath = str_replace( + '{' . '{{baseName}}' . '}', + ObjectSerializer::toPathValue(${{paramName}}), + $resourcePath + ); + } + {{/pathParams}} + + {{#formParams}} + // form params + if (${{paramName}} !== null) { + {{#isFile}} + $multipart = true; + $formParams['{{baseName}}'] = \GuzzleHttp\Psr7\try_fopen(ObjectSerializer::toFormValue(${{paramName}}), 'rb'); + {{/isFile}} + {{^isFile}} + $formParams['{{baseName}}'] = ObjectSerializer::toFormValue(${{paramName}}); + {{/isFile}} + } + {{/formParams}} + // body params + $_tempBody = null; + {{#bodyParams}} + if (isset(${{paramName}})) { + $_tempBody = ${{paramName}}; + } + {{/bodyParams}} + + if ($multipart) { + $headers = $this->headerSelector->selectHeadersForMultipart( + [{{#produces}}'{{{mediaType}}}'{{#hasMore}}, {{/hasMore}}{{/produces}}] + ); + } else { + $headers = $this->headerSelector->selectHeaders( + [{{#produces}}'{{{mediaType}}}'{{#hasMore}}, {{/hasMore}}{{/produces}}], + [{{#consumes}}'{{{mediaType}}}'{{#hasMore}}, {{/hasMore}}{{/consumes}}] + ); + } + + // for model (json/xml) + if (isset($_tempBody)) { + // $_tempBody is the method argument, if present + $httpBody = $_tempBody; + // \stdClass has no __toString(), so we should encode it manually + if ($httpBody instanceof \stdClass && $headers['Content-Type'] === 'application/json') { + $httpBody = \GuzzleHttp\json_encode($httpBody); + } + } elseif (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValue + ]; + } + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); + + } elseif ($headers['Content-Type'] === 'application/json') { + $httpBody = \GuzzleHttp\json_encode($formParams); + + } else { + // for HTTP post (form) + $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + } + } + + {{#authMethods}} + {{#isApiKey}} + // this endpoint requires API key authentication + $apiKey = $this->config->getApiKeyWithPrefix('{{keyParamName}}'); + if ($apiKey !== null) { + {{#isKeyInHeader}}$headers['{{keyParamName}}'] = $apiKey;{{/isKeyInHeader}}{{#isKeyInQuery}}$queryParams['{{keyParamName}}'] = $apiKey;{{/isKeyInQuery}} + } + {{/isApiKey}} + {{#isBasic}} + // this endpoint requires HTTP basic authentication + if ($this->config->getUsername() !== null || $this->config->getPassword() !== null) { + $headers['Authorization'] = 'Basic ' . base64_encode($this->config->getUsername() . ":" . $this->config->getPassword()); + } + {{/isBasic}} + {{#isOAuth}} + // this endpoint requires OAuth (access token) + if ($this->config->getAccessToken() !== null) { + $headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken(); + } + {{/isOAuth}} + {{/authMethods}} + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $query = \GuzzleHttp\Psr7\build_query($queryParams); + return new Request( + '{{httpMethod}}', + $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + {{/operation}} + /** + * Create http client option + * + * @throws \RuntimeException on file opening failure + * @return array of http client options + */ + protected function createHttpClientOption() + { + $options = []; + if ($this->config->getDebug()) { + $options[RequestOptions::DEBUG] = fopen($this->config->getDebugFile(), 'a'); + if (!$options[RequestOptions::DEBUG]) { + throw new \RuntimeException('Failed to open the debug file: ' . $this->config->getDebugFile()); + } + } + + return $options; + } +} +{{/operations}} diff --git a/codegen-template/api_doc.mustache b/codegen-template/api_doc.mustache new file mode 100644 index 0000000..e41e85a --- /dev/null +++ b/codegen-template/api_doc.mustache @@ -0,0 +1,39 @@ +# {{invokerPackage}}\{{classname}}{{#description}} +{{description}}{{/description}} + +Method | HTTP request | Description +------------- | ------------- | ------------- +{{#operations}}{{#operation}}[**{{operationId}}**]({{classname}}.md#{{operationId}}) | **{{httpMethod}}** {{path}} | {{#summary}}{{summary}}{{/summary}} +{{/operation}}{{/operations}} + +{{#operations}} +{{#operation}} +# **{{{operationId}}}** + +{{{summary}}}{{#notes}} + +{{{notes}}}{{/notes}} + +### Example +```php +{{#allParams}}${{paramName}} = {{{example}}}; // {{{dataType}}} | {{{description}}} +{{/allParams}} +{{#returnType}}$result = {{/returnType}}$client->{{classVarName}}()->{{operationId}}({{#allParams}}${{paramName}}{{#hasMore}}, {{/hasMore}}{{/allParams}});{{#returnType}} +print_r($result);{{/returnType}} +``` + +{{#allParams}}{{#-last}} +### Parameters +Name | Type | Description | Notes +------------- | ------------- | ------------- | -------------{{/-last}}{{/allParams}} +{{#allParams}} **{{paramName}}** | {{#isFile}}**{{dataType}}**{{/isFile}}{{#isPrimitiveType}}**{{dataType}}**{{/isPrimitiveType}}{{^isPrimitiveType}}{{^isFile}}[**{{dataType}}**](../Model/{{baseType}}.md){{/isFile}}{{/isPrimitiveType}}| {{description}} |{{^required}} [optional]{{/required}}{{#defaultValue}} [default to {{defaultValue}}]{{/defaultValue}} +{{/allParams}} + +### Return type + +{{#returnType}}{{#returnTypeIsPrimitive}}**{{{returnType}}}**{{/returnTypeIsPrimitive}}{{^returnTypeIsPrimitive}}[**{{{returnType}}}**](../Model/{{returnBaseType}}.md){{/returnTypeIsPrimitive}}{{/returnType}}{{^returnType}}void (empty response body){{/returnType}} + +[[Back to top]](#) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to Model list]](../../README.md#documentation-for-models) [[Back to README]](../../README.md) + +{{/operation}} +{{/operations}} diff --git a/codegen-template/api_test.mustache b/codegen-template/api_test.mustache new file mode 100644 index 0000000..af93752 --- /dev/null +++ b/codegen-template/api_test.mustache @@ -0,0 +1,76 @@ +partial_header}} +/** + * NOTE: This class is auto generated by the swagger code generator program. + * https://github.com/swagger-api/swagger-codegen + * Please update the test case below to test the endpoint. + */ + +namespace {{invokerPackage}}; + +use \{{invokerPackage}}\Configuration; +use \{{invokerPackage}}\ApiException; +use \{{invokerPackage}}\ObjectSerializer; + +/** + * {{classname}}Test Class Doc Comment + * + * @category Class + * @package {{invokerPackage}} + * @author Swagger Codegen team + * @link https://github.com/swagger-api/swagger-codegen + */ +{{#operations}}class {{classname}}Test extends \PHPUnit_Framework_TestCase +{ + + /** + * Setup before running any test cases + */ + public static function setUpBeforeClass() + { + } + + /** + * Setup before running each test case + */ + public function setUp() + { + } + + /** + * Clean up after running each test case + */ + public function tearDown() + { + } + + /** + * Clean up after running all test cases + */ + public static function tearDownAfterClass() + { + } + {{#operation}} + + /** + * Test case for {{{operationId}}} + * + * {{{summary}}}. + * + */ + public function test{{vendorExtensions.x-testOperationId}}() + { + } + {{/operation}} +} +{{/operations}} diff --git a/codegen-template/config.json b/codegen-template/config.json new file mode 100644 index 0000000..ee336ac --- /dev/null +++ b/codegen-template/config.json @@ -0,0 +1,4 @@ +{ + "packagePath": "SuplaApiGenerated", + "variableNamingConvention": "camelCase" +} diff --git a/codegen-template/model.mustache b/codegen-template/model.mustache new file mode 100644 index 0000000..9382cfa --- /dev/null +++ b/codegen-template/model.mustache @@ -0,0 +1,43 @@ +partial_header}} +/** + * NOTE: This class is auto generated by the swagger code generator program. + * https://github.com/swagger-api/swagger-codegen + * Do not edit the class manually. + */ + +namespace {{modelPackage}}; +{{^isEnum}} +{{^parentSchema}} + +use \ArrayAccess; +{{/parentSchema}} +{{/isEnum}} +use \{{invokerPackage}}\ObjectSerializer; + +/** + * {{classname}} Class Doc Comment + * + * @category Class +{{#description}} + * @description {{description}} +{{/description}} + * @package {{invokerPackage}} + * @author Swagger Codegen team + * @link https://github.com/swagger-api/swagger-codegen + */ +{{#isEnum}}{{>model_enum}}{{/isEnum}}{{^isEnum}}{{>model_generic}}{{/isEnum}} +{{/model}}{{/models}} diff --git a/codegen-template/model_doc.mustache b/codegen-template/model_doc.mustache new file mode 100644 index 0000000..569550d --- /dev/null +++ b/codegen-template/model_doc.mustache @@ -0,0 +1,11 @@ +{{#models}}{{#model}}# {{classname}} + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +{{#vars}}**{{name}}** | {{#isPrimitiveType}}**{{datatype}}**{{/isPrimitiveType}}{{^isPrimitiveType}}[**{{datatype}}**]({{complexType}}.md){{/isPrimitiveType}} | {{description}} | {{^required}}[optional] {{/required}}{{#readOnly}}[readonly] {{/readOnly}}{{#defaultValue}}[default to {{{.}}}]{{/defaultValue}} +{{/vars}} + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + +{{/model}}{{/models}} diff --git a/codegen-template/model_enum.mustache b/codegen-template/model_enum.mustache new file mode 100644 index 0000000..5e6b2ae --- /dev/null +++ b/codegen-template/model_enum.mustache @@ -0,0 +1,19 @@ +class {{classname}} +{ + /** + * Possible values of this enum + */ + {{#allowableValues}}{{#enumVars}}const {{{name}}} = {{{value}}}; + {{/enumVars}}{{/allowableValues}} + /** + * Gets allowable values of the enum + * @return string[] + */ + public static function getAllowableEnumValues() + { + return [ + {{#allowableValues}}{{#enumVars}}self::{{{name}}},{{^-last}} + {{/-last}}{{/enumVars}}{{/allowableValues}} + ]; + } +} diff --git a/codegen-template/model_generic.mustache b/codegen-template/model_generic.mustache new file mode 100644 index 0000000..c2952c5 --- /dev/null +++ b/codegen-template/model_generic.mustache @@ -0,0 +1,418 @@ +class {{classname}} {{#parentSchema}}extends {{{parent}}} {{/parentSchema}}{{^parentSchema}}implements ModelInterface, ArrayAccess{{/parentSchema}} +{ + const DISCRIMINATOR = {{#discriminator}}'{{discriminator}}'{{/discriminator}}{{^discriminator}}null{{/discriminator}}; + + /** + * The original name of the model. + * + * @var string + */ + protected static $swaggerModelName = '{{name}}'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $swaggerTypes = [ + {{#vars}}'{{name}}' => '{{{datatype}}}'{{#hasMore}}, + {{/hasMore}}{{/vars}} + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $swaggerFormats = [ + {{#vars}}'{{name}}' => {{#dataFormat}}'{{{dataFormat}}}'{{/dataFormat}}{{^dataFormat}}null{{/dataFormat}}{{#hasMore}}, + {{/hasMore}}{{/vars}} + ]; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function swaggerTypes() + { + return self::$swaggerTypes{{#parentSchema}} + parent::swaggerTypes(){{/parentSchema}}; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function swaggerFormats() + { + return self::$swaggerFormats{{#parentSchema}} + parent::swaggerFormats(){{/parentSchema}}; + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + {{#vars}}'{{name}}' => '{{baseName}}'{{#hasMore}}, + {{/hasMore}}{{/vars}} + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + {{#vars}}'{{name}}' => '{{setter}}'{{#hasMore}}, + {{/hasMore}}{{/vars}} + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + {{#vars}}'{{name}}' => '{{getter}}'{{#hasMore}}, + {{/hasMore}}{{/vars}} + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return {{#parentSchema}}parent::attributeMap() + {{/parentSchema}}self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return {{#parentSchema}}parent::setters() + {{/parentSchema}}self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return {{#parentSchema}}parent::getters() + {{/parentSchema}}self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$swaggerModelName; + } + + {{#vars}}{{#isEnum}}{{#allowableValues}}{{#enumVars}}const {{enumName}}_{{{name}}} = {{{value}}}; + {{/enumVars}}{{/allowableValues}}{{/isEnum}}{{/vars}} + + {{#vars}}{{#isEnum}} + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function {{getter}}AllowableValues() + { + return [ + {{#allowableValues}}{{#enumVars}}self::{{enumName}}_{{{name}}},{{^-last}} + {{/-last}}{{/enumVars}}{{/allowableValues}} + ]; + } + {{/isEnum}}{{/vars}} + + {{^parentSchema}} + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + {{/parentSchema}} + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + {{#parentSchema}} + parent::__construct($data); + + {{/parentSchema}} + {{#vars}} + $this->container['{{name}}'] = isset($data['{{name}}']) ? $data['{{name}}'] : {{#defaultValue}}{{{defaultValue}}}{{/defaultValue}}{{^defaultValue}}null{{/defaultValue}}; + {{/vars}} + {{#discriminator}} + + // Initialize discriminator property with the model name. + $discriminator = array_search('{{discriminator}}', self::$attributeMap); + $this->container[$discriminator] = static::$swaggerModelName; + {{/discriminator}} + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + {{#parent}} + $invalidProperties = parent::listInvalidProperties(); + {{/parent}} + {{^parent}} + $invalidProperties = []; + {{/parent}} + + {{#vars}} + {{#required}} + if ($this->container['{{name}}'] === null) { + $invalidProperties[] = "'{{name}}' can't be null"; + } + {{/required}} + {{#isEnum}} + {{^isContainer}} + $allowedValues = $this->{{getter}}AllowableValues(); + if (!is_null($this->container['{{name}}']) && !in_array($this->container['{{name}}'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value for '{{name}}', must be one of '%s'", + implode("', '", $allowedValues) + ); + } + + {{/isContainer}} + {{/isEnum}} + {{#hasValidation}} + {{#maxLength}} + if ({{^required}}!is_null($this->container['{{name}}']) && {{/required}}(mb_strlen($this->container['{{name}}']) > {{maxLength}})) { + $invalidProperties[] = "invalid value for '{{name}}', the character length must be smaller than or equal to {{{maxLength}}}."; + } + + {{/maxLength}} + {{#minLength}} + if ({{^required}}!is_null($this->container['{{name}}']) && {{/required}}(mb_strlen($this->container['{{name}}']) < {{minLength}})) { + $invalidProperties[] = "invalid value for '{{name}}', the character length must be bigger than or equal to {{{minLength}}}."; + } + + {{/minLength}} + {{#maximum}} + if ({{^required}}!is_null($this->container['{{name}}']) && {{/required}}($this->container['{{name}}'] >{{#exclusiveMaximum}}={{/exclusiveMaximum}} {{maximum}})) { + $invalidProperties[] = "invalid value for '{{name}}', must be smaller than {{^exclusiveMaximum}}or equal to {{/exclusiveMaximum}}{{maximum}}."; + } + + {{/maximum}} + {{#minimum}} + if ({{^required}}!is_null($this->container['{{name}}']) && {{/required}}($this->container['{{name}}'] <{{#exclusiveMinimum}}={{/exclusiveMinimum}} {{minimum}})) { + $invalidProperties[] = "invalid value for '{{name}}', must be bigger than {{^exclusiveMinimum}}or equal to {{/exclusiveMinimum}}{{minimum}}."; + } + + {{/minimum}} + {{#pattern}} + if ({{^required}}!is_null($this->container['{{name}}']) && {{/required}}!preg_match("{{{pattern}}}", $this->container['{{name}}'])) { + $invalidProperties[] = "invalid value for '{{name}}', must be conform to the pattern {{{pattern}}}."; + } + + {{/pattern}} + {{#maxItems}} + if ({{^required}}!is_null($this->container['{{name}}']) && {{/required}}(count($this->container['{{name}}']) > {{maxItems}})) { + $invalidProperties[] = "invalid value for '{{name}}', number of items must be less than or equal to {{{maxItems}}}."; + } + + {{/maxItems}} + {{#minItems}} + if ({{^required}}!is_null($this->container['{{name}}']) && {{/required}}(count($this->container['{{name}}']) < {{minItems}})) { + $invalidProperties[] = "invalid value for '{{name}}', number of items must be greater than or equal to {{{minItems}}}."; + } + + {{/minItems}} + {{/hasValidation}} + {{/vars}} + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + {{#vars}} + + /** + * Gets {{name}} + * + * @return {{datatype}} + */ + public function {{getter}}() + { + return $this->container['{{name}}']; + } + + /** + * Sets {{name}} + * + * @param {{datatype}} ${{name}}{{#description}} {{{description}}}{{/description}}{{^description}} {{{name}}}{{/description}} + * + * @return $this + */ + public function {{setter}}(${{name}}) + { + {{#isEnum}} + $allowedValues = $this->{{getter}}AllowableValues(); + {{^isContainer}} + if ({{^required}}!is_null(${{name}}) && {{/required}}!in_array(${{{name}}}, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value for '{{name}}', must be one of '%s'", + implode("', '", $allowedValues) + ) + ); + } + {{/isContainer}} + {{#isContainer}} + if ({{^required}}!is_null(${{name}}) && {{/required}}array_diff(${{{name}}}, $allowedValues)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value for '{{name}}', must be one of '%s'", + implode("', '", $allowedValues) + ) + ); + } + {{/isContainer}} + {{/isEnum}} + {{#hasValidation}} + {{#maxLength}} + if ({{^required}}!is_null(${{name}}) && {{/required}}(mb_strlen(${{name}}) > {{maxLength}})) { + throw new \InvalidArgumentException('invalid length for ${{name}} when calling {{classname}}.{{operationId}}, must be smaller than or equal to {{maxLength}}.'); + }{{/maxLength}} + {{#minLength}} + if ({{^required}}!is_null(${{name}}) && {{/required}}(mb_strlen(${{name}}) < {{minLength}})) { + throw new \InvalidArgumentException('invalid length for ${{name}} when calling {{classname}}.{{operationId}}, must be bigger than or equal to {{minLength}}.'); + } + {{/minLength}} + {{#maximum}} + if ({{^required}}!is_null(${{name}}) && {{/required}}(${{name}} >{{#exclusiveMaximum}}={{/exclusiveMaximum}} {{maximum}})) { + throw new \InvalidArgumentException('invalid value for ${{name}} when calling {{classname}}.{{operationId}}, must be smaller than {{^exclusiveMaximum}}or equal to {{/exclusiveMaximum}}{{maximum}}.'); + } + {{/maximum}} + {{#minimum}} + if ({{^required}}!is_null(${{name}}) && {{/required}}(${{name}} <{{#exclusiveMinimum}}={{/exclusiveMinimum}} {{minimum}})) { + throw new \InvalidArgumentException('invalid value for ${{name}} when calling {{classname}}.{{operationId}}, must be bigger than {{^exclusiveMinimum}}or equal to {{/exclusiveMinimum}}{{minimum}}.'); + } + {{/minimum}} + {{#pattern}} + if ({{^required}}!is_null(${{name}}) && {{/required}}(!preg_match("{{{pattern}}}", ${{name}}))) { + throw new \InvalidArgumentException("invalid value for ${{name}} when calling {{classname}}.{{operationId}}, must conform to the pattern {{{pattern}}}."); + } + {{/pattern}} + {{#maxItems}} + if ({{^required}}!is_null(${{name}}) && {{/required}}(count(${{name}}) > {{maxItems}})) { + throw new \InvalidArgumentException('invalid value for ${{name}} when calling {{classname}}.{{operationId}}, number of items must be less than or equal to {{maxItems}}.'); + }{{/maxItems}} + {{#minItems}} + if ({{^required}}!is_null(${{name}}) && {{/required}}(count(${{name}}) < {{minItems}})) { + throw new \InvalidArgumentException('invalid length for ${{name}} when calling {{classname}}.{{operationId}}, number of items must be greater than or equal to {{minItems}}.'); + } + {{/minItems}} + {{/hasValidation}} + $this->container['{{name}}'] = ${{name}}; + + return $this; + } + {{/vars}} + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset) + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed + */ + public function offsetGet($offset) + { + return isset($this->container[$offset]) ? $this->container[$offset] : null; + } + + /** + * Sets value based on offset. + * + * @param integer $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value) + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset) + { + unset($this->container[$offset]); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} diff --git a/codegen-template/model_test.mustache b/codegen-template/model_test.mustache new file mode 100644 index 0000000..9906430 --- /dev/null +++ b/codegen-template/model_test.mustache @@ -0,0 +1,81 @@ +partial_header}} +/** + * NOTE: This class is auto generated by the swagger code generator program. + * https://github.com/swagger-api/swagger-codegen + * Please update the test case below to test the model. + */ + +namespace {{invokerPackage}}; + +/** + * {{classname}}Test Class Doc Comment + * + * @category Class + * @description {{#description}}{{description}}{{/description}}{{^description}}{{classname}}{{/description}} + * @package {{invokerPackage}} + * @author Swagger Codegen team + * @link https://github.com/swagger-api/swagger-codegen + */ +class {{classname}}Test extends \PHPUnit_Framework_TestCase +{ + + /** + * Setup before running any test case + */ + public static function setUpBeforeClass() + { + } + + /** + * Setup before running each test case + */ + public function setUp() + { + } + + /** + * Clean up after running each test case + */ + public function tearDown() + { + } + + /** + * Clean up after running all test cases + */ + public static function tearDownAfterClass() + { + } + + /** + * Test "{{classname}}" + */ + public function test{{classname}}() + { + } +{{#vars}} + + /** + * Test attribute "{{name}}" + */ + public function testProperty{{nameInCamelCase}}() + { + } +{{/vars}} +} +{{/model}} +{{/models}} diff --git a/codegen-template/partial_header.mustache b/codegen-template/partial_header.mustache new file mode 100644 index 0000000..4cf2337 --- /dev/null +++ b/codegen-template/partial_header.mustache @@ -0,0 +1,14 @@ +/** + {{#appName}} + * {{{appName}}} + * + {{/appName}} + {{#appDescription}} + * {{{appDescription}}} + * + {{/appDescription}} + * {{#version}}OpenAPI spec version: {{{version}}}{{/version}} + * {{#infoEmail}}Contact: {{{infoEmail}}}{{/infoEmail}} + * Generated by: https://github.com/swagger-api/swagger-codegen.git + * Swagger Codegen version: {{{generatorVersion}}} + */ diff --git a/composer.json b/composer.json index d9c708d..b425b9e 100644 --- a/composer.json +++ b/composer.json @@ -1,18 +1,33 @@ { "name": "supla/api-client", - "autoload": { - "psr-4": { - "Supla\\ApiClient\\": "src" - } - }, "require": { - "ext-curl": "*" + "php": ">=5.5", + "ext-curl": "*", + "ext-json": "*", + "ext-mbstring": "*", + "guzzlehttp/guzzle": "^6.2" }, "require-dev": { "squizlabs/php_codesniffer": "^2.8" }, + "autoload": { + "psr-4": { + "Swagger\\Client\\": "lib/", + "Supla\\ApiClient\\": "src/" + } + }, "scripts": { "phpcs": "phpcs src --standard=phpcs-rules.xml", - "phpcbf": "phpcbf src --standard=phpcs-rules.xml" + "phpcbf": "phpcbf src --standard=phpcs-rules.xml", + "generate": [ + "rm -fr output", + "mkdir output", + "java -jar swagger-codegen.jar generate -i swagger.json -l php -o output -t codegen-template -c codegen-template/config.json", + "rm -fr docs lib README.md", + "mv output/SuplaApiGenerated/docs .", + "mv output/SuplaApiGenerated/lib .", + "mv output/SuplaApiGenerated/README.md .", + "rm -fr output" + ] } } diff --git a/composer.lock b/composer.lock index 48a7ab1..835c7ab 100644 --- a/composer.lock +++ b/composer.lock @@ -4,21 +4,253 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file", "This file is @generated automatically" ], - "content-hash": "b9d5a909289fe563931dea8f193c9c54", - "packages": [], + "content-hash": "50d1ecda7b600133f5d97de70da2fd2e", + "packages": [ + { + "name": "guzzlehttp/guzzle", + "version": "6.3.3", + "source": { + "type": "git", + "url": "https://github.com/guzzle/guzzle.git", + "reference": "407b0cb880ace85c9b63c5f9551db498cb2d50ba" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/guzzle/guzzle/zipball/407b0cb880ace85c9b63c5f9551db498cb2d50ba", + "reference": "407b0cb880ace85c9b63c5f9551db498cb2d50ba", + "shasum": "" + }, + "require": { + "guzzlehttp/promises": "^1.0", + "guzzlehttp/psr7": "^1.4", + "php": ">=5.5" + }, + "require-dev": { + "ext-curl": "*", + "phpunit/phpunit": "^4.8.35 || ^5.7 || ^6.4 || ^7.0", + "psr/log": "^1.0" + }, + "suggest": { + "psr/log": "Required for using the Log middleware" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "6.3-dev" + } + }, + "autoload": { + "files": [ + "src/functions_include.php" + ], + "psr-4": { + "GuzzleHttp\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Michael Dowling", + "email": "mtdowling@gmail.com", + "homepage": "https://github.com/mtdowling" + } + ], + "description": "Guzzle is a PHP HTTP client library", + "homepage": "http://guzzlephp.org/", + "keywords": [ + "client", + "curl", + "framework", + "http", + "http client", + "rest", + "web service" + ], + "time": "2018-04-22T15:46:56+00:00" + }, + { + "name": "guzzlehttp/promises", + "version": "v1.3.1", + "source": { + "type": "git", + "url": "https://github.com/guzzle/promises.git", + "reference": "a59da6cf61d80060647ff4d3eb2c03a2bc694646" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/guzzle/promises/zipball/a59da6cf61d80060647ff4d3eb2c03a2bc694646", + "reference": "a59da6cf61d80060647ff4d3eb2c03a2bc694646", + "shasum": "" + }, + "require": { + "php": ">=5.5.0" + }, + "require-dev": { + "phpunit/phpunit": "^4.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.4-dev" + } + }, + "autoload": { + "psr-4": { + "GuzzleHttp\\Promise\\": "src/" + }, + "files": [ + "src/functions_include.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Michael Dowling", + "email": "mtdowling@gmail.com", + "homepage": "https://github.com/mtdowling" + } + ], + "description": "Guzzle promises library", + "keywords": [ + "promise" + ], + "time": "2016-12-20T10:07:11+00:00" + }, + { + "name": "guzzlehttp/psr7", + "version": "1.4.2", + "source": { + "type": "git", + "url": "https://github.com/guzzle/psr7.git", + "reference": "f5b8a8512e2b58b0071a7280e39f14f72e05d87c" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/guzzle/psr7/zipball/f5b8a8512e2b58b0071a7280e39f14f72e05d87c", + "reference": "f5b8a8512e2b58b0071a7280e39f14f72e05d87c", + "shasum": "" + }, + "require": { + "php": ">=5.4.0", + "psr/http-message": "~1.0" + }, + "provide": { + "psr/http-message-implementation": "1.0" + }, + "require-dev": { + "phpunit/phpunit": "~4.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.4-dev" + } + }, + "autoload": { + "psr-4": { + "GuzzleHttp\\Psr7\\": "src/" + }, + "files": [ + "src/functions_include.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Michael Dowling", + "email": "mtdowling@gmail.com", + "homepage": "https://github.com/mtdowling" + }, + { + "name": "Tobias Schultze", + "homepage": "https://github.com/Tobion" + } + ], + "description": "PSR-7 message implementation that also provides common utility methods", + "keywords": [ + "http", + "message", + "request", + "response", + "stream", + "uri", + "url" + ], + "time": "2017-03-20T17:10:46+00:00" + }, + { + "name": "psr/http-message", + "version": "1.0.1", + "source": { + "type": "git", + "url": "https://github.com/php-fig/http-message.git", + "reference": "f6561bf28d520154e4b0ec72be95418abe6d9363" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/php-fig/http-message/zipball/f6561bf28d520154e4b0ec72be95418abe6d9363", + "reference": "f6561bf28d520154e4b0ec72be95418abe6d9363", + "shasum": "" + }, + "require": { + "php": ">=5.3.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0.x-dev" + } + }, + "autoload": { + "psr-4": { + "Psr\\Http\\Message\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "PHP-FIG", + "homepage": "http://www.php-fig.org/" + } + ], + "description": "Common interface for HTTP messages", + "homepage": "https://github.com/php-fig/http-message", + "keywords": [ + "http", + "http-message", + "psr", + "psr-7", + "request", + "response" + ], + "time": "2016-08-06T14:39:51+00:00" + } + ], "packages-dev": [ { "name": "squizlabs/php_codesniffer", - "version": "2.8.1", + "version": "2.9.1", "source": { "type": "git", "url": "https://github.com/squizlabs/PHP_CodeSniffer.git", - "reference": "d7cf0d894e8aa4c73712ee4a331cc1eaa37cdc7d" + "reference": "dcbed1074f8244661eecddfc2a675430d8d33f62" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/squizlabs/PHP_CodeSniffer/zipball/d7cf0d894e8aa4c73712ee4a331cc1eaa37cdc7d", - "reference": "d7cf0d894e8aa4c73712ee4a331cc1eaa37cdc7d", + "url": "https://api.github.com/repos/squizlabs/PHP_CodeSniffer/zipball/dcbed1074f8244661eecddfc2a675430d8d33f62", + "reference": "dcbed1074f8244661eecddfc2a675430d8d33f62", "shasum": "" }, "require": { @@ -83,7 +315,7 @@ "phpcs", "standards" ], - "time": "2017-03-01T22:17:45+00:00" + "time": "2017-05-22T02:43:20+00:00" } ], "aliases": [], @@ -91,6 +323,11 @@ "stability-flags": [], "prefer-stable": false, "prefer-lowest": false, - "platform": [], + "platform": { + "php": ">=5.5", + "ext-curl": "*", + "ext-json": "*", + "ext-mbstring": "*" + }, "platform-dev": [] } diff --git a/docs/Api/AccessIdentifiersApi.md b/docs/Api/AccessIdentifiersApi.md new file mode 100644 index 0000000..84b3a02 --- /dev/null +++ b/docs/Api/AccessIdentifiersApi.md @@ -0,0 +1,124 @@ +# Swagger\Client\AccessIdentifiersApi + +Method | HTTP request | Description +------------- | ------------- | ------------- +[**createAccessIdentifier**](AccessIdentifiersApi.md#createAccessIdentifier) | **POST** /accessids | Create a new Access Identifier +[**deleteAccessIdentifier**](AccessIdentifiersApi.md#deleteAccessIdentifier) | **DELETE** /accessids/{id} | Delete Access Identifier +[**getAccessIdentifier**](AccessIdentifiersApi.md#getAccessIdentifier) | **GET** /accessids/{id} | Get Access Identifier +[**getAccessIdentifiers**](AccessIdentifiersApi.md#getAccessIdentifiers) | **GET** /accessids | Get Access Identifiers list +[**updateAccessIdentifier**](AccessIdentifiersApi.md#updateAccessIdentifier) | **PUT** /accessids/{id} | Update Access Identifier + + +# **createAccessIdentifier** + +Create a new Access Identifier + +### Example +```php +$result = $client->accessIdentifiers()->createAccessIdentifier(); +print_r($result); +``` + + + +### Return type + +[**\Swagger\Client\Model\AccessIdentifier**](../Model/AccessIdentifier.md) + +[[Back to top]](#) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to Model list]](../../README.md#documentation-for-models) [[Back to README]](../../README.md) + +# **deleteAccessIdentifier** + +Delete Access Identifier + +### Example +```php +$id = 56; // int | +$client->accessIdentifiers()->deleteAccessIdentifier($id); +``` + + +### Parameters +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **id** | **int**| | + +### Return type + +void (empty response body) + +[[Back to top]](#) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to Model list]](../../README.md#documentation-for-models) [[Back to README]](../../README.md) + +# **getAccessIdentifier** + +Get Access Identifier + +### Example +```php +$id = 56; // int | +$include = array("include_example"); // string[] | Specify what extra fields to include in the response. +$result = $client->accessIdentifiers()->getAccessIdentifier($id, $include); +print_r($result); +``` + + +### Parameters +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **id** | **int**| | + **include** | [**string[]**](../Model/string.md)| Specify what extra fields to include in the response. | [optional] + +### Return type + +[**\Swagger\Client\Model\AccessIdentifier**](../Model/AccessIdentifier.md) + +[[Back to top]](#) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to Model list]](../../README.md#documentation-for-models) [[Back to README]](../../README.md) + +# **getAccessIdentifiers** + +Get Access Identifiers list + +### Example +```php +$include = array("include_example"); // string[] | Specify what extra fields to include in the response. +$result = $client->accessIdentifiers()->getAccessIdentifiers($include); +print_r($result); +``` + + +### Parameters +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **include** | [**string[]**](../Model/string.md)| Specify what extra fields to include in the response. | [optional] + +### Return type + +[**\Swagger\Client\Model\AccessIdentifier[]**](../Model/AccessIdentifier.md) + +[[Back to top]](#) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to Model list]](../../README.md#documentation-for-models) [[Back to README]](../../README.md) + +# **updateAccessIdentifier** + +Update Access Identifier + +### Example +```php +$id = 56; // int | +$body = new \Swagger\Client\Model\AccessIdentifierUpdateRequest(); // \Swagger\Client\Model\AccessIdentifierUpdateRequest | +$result = $client->accessIdentifiers()->updateAccessIdentifier($id, $body); +print_r($result); +``` + + +### Parameters +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **id** | **int**| | + **body** | [**\Swagger\Client\Model\AccessIdentifierUpdateRequest**](../Model/AccessIdentifierUpdateRequest.md)| | + +### Return type + +[**\Swagger\Client\Model\AccessIdentifier**](../Model/AccessIdentifier.md) + +[[Back to top]](#) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to Model list]](../../README.md#documentation-for-models) [[Back to README]](../../README.md) + diff --git a/docs/Api/ChannelGroupsApi.md b/docs/Api/ChannelGroupsApi.md new file mode 100644 index 0000000..bdcdae8 --- /dev/null +++ b/docs/Api/ChannelGroupsApi.md @@ -0,0 +1,154 @@ +# Swagger\Client\ChannelGroupsApi + +Method | HTTP request | Description +------------- | ------------- | ------------- +[**createChannelGroup**](ChannelGroupsApi.md#createChannelGroup) | **POST** /channel-groups | Create a new channel group +[**deleteChannelGroup**](ChannelGroupsApi.md#deleteChannelGroup) | **DELETE** /channel-groups/{id} | Delete Channel Group +[**executeChannelGroupAction**](ChannelGroupsApi.md#executeChannelGroupAction) | **PATCH** /channel-groups/{id} | Execute action on the channel group +[**getChannelGroup**](ChannelGroupsApi.md#getChannelGroup) | **GET** /channel-groups/{id} | Get channel group by ID +[**getChannelGroups**](ChannelGroupsApi.md#getChannelGroups) | **GET** /channel-groups | Get channels list +[**updateChannelGroup**](ChannelGroupsApi.md#updateChannelGroup) | **PUT** /channel-groups/{id} | Update channel group + + +# **createChannelGroup** + +Create a new channel group + +### Example +```php +$body = new \Swagger\Client\Model\ChannelGroupRequest(); // \Swagger\Client\Model\ChannelGroupRequest | +$result = $client->channelGroups()->createChannelGroup($body); +print_r($result); +``` + + +### Parameters +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **body** | [**\Swagger\Client\Model\ChannelGroupRequest**](../Model/ChannelGroupRequest.md)| | + +### Return type + +[**\Swagger\Client\Model\ChannelGroup**](../Model/ChannelGroup.md) + +[[Back to top]](#) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to Model list]](../../README.md#documentation-for-models) [[Back to README]](../../README.md) + +# **deleteChannelGroup** + +Delete Channel Group + +### Example +```php +$id = 56; // int | +$client->channelGroups()->deleteChannelGroup($id); +``` + + +### Parameters +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **id** | **int**| | + +### Return type + +void (empty response body) + +[[Back to top]](#) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to Model list]](../../README.md#documentation-for-models) [[Back to README]](../../README.md) + +# **executeChannelGroupAction** + +Execute action on the channel group + +### Example +```php +$id = 56; // int | +$body = new \Swagger\Client\Model\ChannelExecuteActionRequest(); // \Swagger\Client\Model\ChannelExecuteActionRequest | Defines an action to execute on channel group. The `action` key is always required. The rest of the keys are params depending on the chosen action. Read more on [Github Wiki](https://github.com/SUPLA/supla-cloud/wiki/Channel-Actions). +$client->channelGroups()->executeChannelGroupAction($id, $body); +``` + + +### Parameters +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **id** | **int**| | + **body** | [**\Swagger\Client\Model\ChannelExecuteActionRequest**](../Model/ChannelExecuteActionRequest.md)| Defines an action to execute on channel group. The `action` key is always required. The rest of the keys are params depending on the chosen action. Read more on [Github Wiki](https://github.com/SUPLA/supla-cloud/wiki/Channel-Actions). | + +### Return type + +void (empty response body) + +[[Back to top]](#) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to Model list]](../../README.md#documentation-for-models) [[Back to README]](../../README.md) + +# **getChannelGroup** + +Get channel group by ID + +### Example +```php +$id = 56; // int | +$include = array("include_example"); // string[] | Specify what extra fields to include in the response. +$result = $client->channelGroups()->getChannelGroup($id, $include); +print_r($result); +``` + + +### Parameters +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **id** | **int**| | + **include** | [**string[]**](../Model/string.md)| Specify what extra fields to include in the response. | [optional] + +### Return type + +[**\Swagger\Client\Model\ChannelGroup**](../Model/ChannelGroup.md) + +[[Back to top]](#) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to Model list]](../../README.md#documentation-for-models) [[Back to README]](../../README.md) + +# **getChannelGroups** + +Get channels list + +### Example +```php +$include = array("include_example"); // string[] | Specify what extra fields to include in the response. +$result = $client->channelGroups()->getChannelGroups($include); +print_r($result); +``` + + +### Parameters +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **include** | [**string[]**](../Model/string.md)| Specify what extra fields to include in the response. | [optional] + +### Return type + +[**\Swagger\Client\Model\ChannelGroup[]**](../Model/ChannelGroup.md) + +[[Back to top]](#) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to Model list]](../../README.md#documentation-for-models) [[Back to README]](../../README.md) + +# **updateChannelGroup** + +Update channel group + +### Example +```php +$id = 56; // int | +$body = new \Swagger\Client\Model\ChannelGroupRequest(); // \Swagger\Client\Model\ChannelGroupRequest | +$result = $client->channelGroups()->updateChannelGroup($id, $body); +print_r($result); +``` + + +### Parameters +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **id** | **int**| | + **body** | [**\Swagger\Client\Model\ChannelGroupRequest**](../Model/ChannelGroupRequest.md)| | + +### Return type + +[**\Swagger\Client\Model\ChannelGroup**](../Model/ChannelGroup.md) + +[[Back to top]](#) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to Model list]](../../README.md#documentation-for-models) [[Back to README]](../../README.md) + diff --git a/docs/Api/ChannelsApi.md b/docs/Api/ChannelsApi.md new file mode 100644 index 0000000..b6df58f --- /dev/null +++ b/docs/Api/ChannelsApi.md @@ -0,0 +1,195 @@ +# Swagger\Client\ChannelsApi + +Method | HTTP request | Description +------------- | ------------- | ------------- +[**executeAction**](ChannelsApi.md#executeAction) | **PATCH** /channels/{id} | Execute action on the channel +[**getChannel**](ChannelsApi.md#getChannel) | **GET** /channels/{id} | Get channel by ID +[**getChannelMeasurementLogs**](ChannelsApi.md#getChannelMeasurementLogs) | **GET** /channels/{id}/measurement-logs | Get measurement logs. +[**getChannelMeasurementLogsCsvFile**](ChannelsApi.md#getChannelMeasurementLogsCsvFile) | **GET** /channels/{id}/measurement-logs-csv | Get measurement logs as zipped CSV file. +[**getChannelSchedules**](ChannelsApi.md#getChannelSchedules) | **GET** /channels/{id}/schedules | Get schedules list of the channel +[**getChannels**](ChannelsApi.md#getChannels) | **GET** /channels | Get channels list +[**updateChannel**](ChannelsApi.md#updateChannel) | **PUT** /channels/{id} | Update channel + + +# **executeAction** + +Execute action on the channel + +### Example +```php +$id = 56; // int | +$body = new \Swagger\Client\Model\ChannelExecuteActionRequest(); // \Swagger\Client\Model\ChannelExecuteActionRequest | Defines an action to execute on channel. The `action` key is always required. The rest of the keys are params depending on the chosen action. Read more on [Github Wiki](https://github.com/SUPLA/supla-cloud/wiki/Channel-Actions). +$client->channels()->executeAction($id, $body); +``` + + +### Parameters +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **id** | **int**| | + **body** | [**\Swagger\Client\Model\ChannelExecuteActionRequest**](../Model/ChannelExecuteActionRequest.md)| Defines an action to execute on channel. The `action` key is always required. The rest of the keys are params depending on the chosen action. Read more on [Github Wiki](https://github.com/SUPLA/supla-cloud/wiki/Channel-Actions). | + +### Return type + +void (empty response body) + +[[Back to top]](#) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to Model list]](../../README.md#documentation-for-models) [[Back to README]](../../README.md) + +# **getChannel** + +Get channel by ID + +### Example +```php +$id = 56; // int | +$include = array("include_example"); // string[] | Specify what extra fields to include in the response. +$result = $client->channels()->getChannel($id, $include); +print_r($result); +``` + + +### Parameters +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **id** | **int**| | + **include** | [**string[]**](../Model/string.md)| Specify what extra fields to include in the response. | [optional] + +### Return type + +[**\Swagger\Client\Model\Channel**](../Model/Channel.md) + +[[Back to top]](#) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to Model list]](../../README.md#documentation-for-models) [[Back to README]](../../README.md) + +# **getChannelMeasurementLogs** + +Get measurement logs. + +Supported channel functions: `THERMOMETER` and `HUMIDITYANDTEMPERATURE`. Logs ordered by date, descending. + +### Example +```php +$id = 56; // int | +$limit = 5000; // int | Maximum items count in response, from 1 to 5000 +$offset = 56; // int | Pagination offset +$result = $client->channels()->getChannelMeasurementLogs($id, $limit, $offset); +print_r($result); +``` + + +### Parameters +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **id** | **int**| | + **limit** | **int**| Maximum items count in response, from 1 to 5000 | [optional] [default to 5000] + **offset** | **int**| Pagination offset | [optional] + +### Return type + +[**\Swagger\Client\Model\ChannelMeasurementLog[]**](../Model/ChannelMeasurementLog.md) + +[[Back to top]](#) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to Model list]](../../README.md#documentation-for-models) [[Back to README]](../../README.md) + +# **getChannelMeasurementLogsCsvFile** + +Get measurement logs as zipped CSV file. + +Supported channel functions: `THERMOMETER` and `HUMIDITYANDTEMPERATURE`. Logs ordered by date, descending. + +### Example +```php +$id = 56; // int | +$result = $client->channels()->getChannelMeasurementLogsCsvFile($id); +print_r($result); +``` + + +### Parameters +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **id** | **int**| | + +### Return type + +[**\SplFileObject**](../Model/\SplFileObject.md) + +[[Back to top]](#) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to Model list]](../../README.md#documentation-for-models) [[Back to README]](../../README.md) + +# **getChannelSchedules** + +Get schedules list of the channel + +### Example +```php +$id = 56; // int | +$include = array("include_example"); // string[] | Specify what extra fields to include in the response. +$result = $client->channels()->getChannelSchedules($id, $include); +print_r($result); +``` + + +### Parameters +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **id** | **int**| | + **include** | [**string[]**](../Model/string.md)| Specify what extra fields to include in the response. | [optional] + +### Return type + +[**\Swagger\Client\Model\Schedule[]**](../Model/Schedule.md) + +[[Back to top]](#) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to Model list]](../../README.md#documentation-for-models) [[Back to README]](../../README.md) + +# **getChannels** + +Get channels list + +### Example +```php +$include = array("include_example"); // string[] | Specify what extra fields to include in the response. +$function = array("function_example"); // string[] | +$io = "io_example"; // string | Return only `input` or `output` channels. +$hasFunction = true; // bool | Return only channels with (`true`) or without (`false`) chosen functions. +$result = $client->channels()->getChannels($include, $function, $io, $hasFunction); +print_r($result); +``` + + +### Parameters +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **include** | [**string[]**](../Model/string.md)| Specify what extra fields to include in the response. | [optional] + **function** | [**string[]**](../Model/string.md)| | [optional] + **io** | **string**| Return only `input` or `output` channels. | [optional] + **hasFunction** | **bool**| Return only channels with (`true`) or without (`false`) chosen functions. | [optional] + +### Return type + +[**\Swagger\Client\Model\Channel[]**](../Model/Channel.md) + +[[Back to top]](#) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to Model list]](../../README.md#documentation-for-models) [[Back to README]](../../README.md) + +# **updateChannel** + +Update channel + +### Example +```php +$id = 56; // int | +$body = new \Swagger\Client\Model\ChannelUpdateRequest(); // \Swagger\Client\Model\ChannelUpdateRequest | +$result = $client->channels()->updateChannel($id, $body); +print_r($result); +``` + + +### Parameters +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **id** | **int**| | + **body** | [**\Swagger\Client\Model\ChannelUpdateRequest**](../Model/ChannelUpdateRequest.md)| | + +### Return type + +[**\Swagger\Client\Model\Channel**](../Model/Channel.md) + +[[Back to top]](#) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to Model list]](../../README.md#documentation-for-models) [[Back to README]](../../README.md) + diff --git a/docs/Api/ClientAppsApi.md b/docs/Api/ClientAppsApi.md new file mode 100644 index 0000000..4e185e2 --- /dev/null +++ b/docs/Api/ClientAppsApi.md @@ -0,0 +1,79 @@ +# Swagger\Client\ClientAppsApi + +Method | HTTP request | Description +------------- | ------------- | ------------- +[**deleteClientApp**](ClientAppsApi.md#deleteClientApp) | **DELETE** /client-apps/{id} | Delete Client App +[**getClientApps**](ClientAppsApi.md#getClientApps) | **GET** /client-apps | Get client apps +[**updateClientApp**](ClientAppsApi.md#updateClientApp) | **PUT** /client-apps/{id} | Update client app + + +# **deleteClientApp** + +Delete Client App + +### Example +```php +$id = 56; // int | +$client->clientApps()->deleteClientApp($id); +``` + + +### Parameters +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **id** | **int**| | + +### Return type + +void (empty response body) + +[[Back to top]](#) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to Model list]](../../README.md#documentation-for-models) [[Back to README]](../../README.md) + +# **getClientApps** + +Get client apps + +### Example +```php +$include = array("include_example"); // string[] | Specify what extra fields to include in the response. +$result = $client->clientApps()->getClientApps($include); +print_r($result); +``` + + +### Parameters +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **include** | [**string[]**](../Model/string.md)| Specify what extra fields to include in the response. | [optional] + +### Return type + +[**\Swagger\Client\Model\ClientApp[]**](../Model/ClientApp.md) + +[[Back to top]](#) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to Model list]](../../README.md#documentation-for-models) [[Back to README]](../../README.md) + +# **updateClientApp** + +Update client app + +### Example +```php +$id = 56; // int | +$body = new \Swagger\Client\Model\ClientAppUpdateRequest(); // \Swagger\Client\Model\ClientAppUpdateRequest | +$result = $client->clientApps()->updateClientApp($id, $body); +print_r($result); +``` + + +### Parameters +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **id** | **int**| | + **body** | [**\Swagger\Client\Model\ClientAppUpdateRequest**](../Model/ClientAppUpdateRequest.md)| | + +### Return type + +[**\Swagger\Client\Model\ClientApp**](../Model/ClientApp.md) + +[[Back to top]](#) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to Model list]](../../README.md#documentation-for-models) [[Back to README]](../../README.md) + diff --git a/docs/Api/IODevicesApi.md b/docs/Api/IODevicesApi.md new file mode 100644 index 0000000..5f96232 --- /dev/null +++ b/docs/Api/IODevicesApi.md @@ -0,0 +1,131 @@ +# Swagger\Client\IODevicesApi + +Method | HTTP request | Description +------------- | ------------- | ------------- +[**deleteIoDevice**](IODevicesApi.md#deleteIoDevice) | **DELETE** /iodevices/{id} | Delete IO Device +[**getIoDevice**](IODevicesApi.md#getIoDevice) | **GET** /iodevices/{id} | Get IO Device +[**getIoDeviceChannels**](IODevicesApi.md#getIoDeviceChannels) | **GET** /iodevices/{id}/channels | Get Channels that belong to IO Deice +[**getIoDevices**](IODevicesApi.md#getIoDevices) | **GET** /iodevices | Get IO Devices +[**updateIoDevice**](IODevicesApi.md#updateIoDevice) | **PUT** /iodevices/{id} | Update IO Device + + +# **deleteIoDevice** + +Delete IO Device + +### Example +```php +$id = 56; // int | +$client->iODevices()->deleteIoDevice($id); +``` + + +### Parameters +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **id** | **int**| | + +### Return type + +void (empty response body) + +[[Back to top]](#) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to Model list]](../../README.md#documentation-for-models) [[Back to README]](../../README.md) + +# **getIoDevice** + +Get IO Device + +### Example +```php +$id = 56; // int | +$include = array("include_example"); // string[] | Specify what extra fields to include in the response. +$result = $client->iODevices()->getIoDevice($id, $include); +print_r($result); +``` + + +### Parameters +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **id** | **int**| | + **include** | [**string[]**](../Model/string.md)| Specify what extra fields to include in the response. | [optional] + +### Return type + +[**\Swagger\Client\Model\Device**](../Model/Device.md) + +[[Back to top]](#) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to Model list]](../../README.md#documentation-for-models) [[Back to README]](../../README.md) + +# **getIoDeviceChannels** + +Get Channels that belong to IO Deice + +### Example +```php +$id = 56; // int | +$include = array("include_example"); // string[] | Specify what extra fields to include in the response. +$result = $client->iODevices()->getIoDeviceChannels($id, $include); +print_r($result); +``` + + +### Parameters +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **id** | **int**| | + **include** | [**string[]**](../Model/string.md)| Specify what extra fields to include in the response. | [optional] + +### Return type + +[**\Swagger\Client\Model\Channel**](../Model/Channel.md) + +[[Back to top]](#) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to Model list]](../../README.md#documentation-for-models) [[Back to README]](../../README.md) + +# **getIoDevices** + +Get IO Devices + +### Example +```php +$include = array("include_example"); // string[] | Specify what extra fields to include in the response. +$result = $client->iODevices()->getIoDevices($include); +print_r($result); +``` + + +### Parameters +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **include** | [**string[]**](../Model/string.md)| Specify what extra fields to include in the response. | [optional] + +### Return type + +[**\Swagger\Client\Model\Device[]**](../Model/Device.md) + +[[Back to top]](#) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to Model list]](../../README.md#documentation-for-models) [[Back to README]](../../README.md) + +# **updateIoDevice** + +Update IO Device + +### Example +```php +$id = 56; // int | +$body = new \Swagger\Client\Model\IODeviceUpdateRequest(); // \Swagger\Client\Model\IODeviceUpdateRequest | +$result = $client->iODevices()->updateIoDevice($id, $body); +print_r($result); +``` + + +### Parameters +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **id** | **int**| | + **body** | [**\Swagger\Client\Model\IODeviceUpdateRequest**](../Model/IODeviceUpdateRequest.md)| | + +### Return type + +[**\Swagger\Client\Model\Device**](../Model/Device.md) + +[[Back to top]](#) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to Model list]](../../README.md#documentation-for-models) [[Back to README]](../../README.md) + diff --git a/docs/Api/LocationsApi.md b/docs/Api/LocationsApi.md new file mode 100644 index 0000000..5ee9dd0 --- /dev/null +++ b/docs/Api/LocationsApi.md @@ -0,0 +1,128 @@ +# Swagger\Client\LocationsApi + +Method | HTTP request | Description +------------- | ------------- | ------------- +[**createLocation**](LocationsApi.md#createLocation) | **POST** /locations | Create a new location +[**deleteLocation**](LocationsApi.md#deleteLocation) | **DELETE** /locations/{id} | Delete location +[**getLocation**](LocationsApi.md#getLocation) | **GET** /locations/{id} | Get location by ID +[**getLocations**](LocationsApi.md#getLocations) | **GET** /locations | Get locations list +[**updateLocation**](LocationsApi.md#updateLocation) | **PUT** /locations/{id} | Update location + + +# **createLocation** + +Create a new location + +### Example +```php +$result = $client->locations()->createLocation(); +print_r($result); +``` + + + +### Return type + +[**\Swagger\Client\Model\Location**](../Model/Location.md) + +[[Back to top]](#) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to Model list]](../../README.md#documentation-for-models) [[Back to README]](../../README.md) + +# **deleteLocation** + +Delete location + +### Example +```php +$id = 56; // int | +$include = array("include_example"); // string[] | Specify what extra fields to include in the response. +$client->locations()->deleteLocation($id, $include); +``` + + +### Parameters +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **id** | **int**| | + **include** | [**string[]**](../Model/string.md)| Specify what extra fields to include in the response. | [optional] + +### Return type + +void (empty response body) + +[[Back to top]](#) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to Model list]](../../README.md#documentation-for-models) [[Back to README]](../../README.md) + +# **getLocation** + +Get location by ID + +### Example +```php +$id = 56; // int | +$include = array("include_example"); // string[] | Specify what extra fields to include in the response. +$result = $client->locations()->getLocation($id, $include); +print_r($result); +``` + + +### Parameters +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **id** | **int**| | + **include** | [**string[]**](../Model/string.md)| Specify what extra fields to include in the response. | [optional] + +### Return type + +[**\Swagger\Client\Model\Location**](../Model/Location.md) + +[[Back to top]](#) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to Model list]](../../README.md#documentation-for-models) [[Back to README]](../../README.md) + +# **getLocations** + +Get locations list + +### Example +```php +$include = array("include_example"); // string[] | Specify what extra fields to include in the response. +$result = $client->locations()->getLocations($include); +print_r($result); +``` + + +### Parameters +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **include** | [**string[]**](../Model/string.md)| Specify what extra fields to include in the response. | [optional] + +### Return type + +[**\Swagger\Client\Model\Location[]**](../Model/Location.md) + +[[Back to top]](#) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to Model list]](../../README.md#documentation-for-models) [[Back to README]](../../README.md) + +# **updateLocation** + +Update location + +### Example +```php +$id = 56; // int | +$body = new \Swagger\Client\Model\LocationUpdateRequest(); // \Swagger\Client\Model\LocationUpdateRequest | +$include = array("include_example"); // string[] | Specify what extra fields to include in the response. +$result = $client->locations()->updateLocation($id, $body, $include); +print_r($result); +``` + + +### Parameters +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **id** | **int**| | + **body** | [**\Swagger\Client\Model\LocationUpdateRequest**](../Model/LocationUpdateRequest.md)| | + **include** | [**string[]**](../Model/string.md)| Specify what extra fields to include in the response. | [optional] + +### Return type + +[**\Swagger\Client\Model\Location**](../Model/Location.md) + +[[Back to top]](#) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to Model list]](../../README.md#documentation-for-models) [[Back to README]](../../README.md) + diff --git a/docs/Api/SchedulesApi.md b/docs/Api/SchedulesApi.md new file mode 100644 index 0000000..c550446 --- /dev/null +++ b/docs/Api/SchedulesApi.md @@ -0,0 +1,154 @@ +# Swagger\Client\SchedulesApi + +Method | HTTP request | Description +------------- | ------------- | ------------- +[**createSchedule**](SchedulesApi.md#createSchedule) | **POST** /schedules | Create a new schedule +[**deleteSchedule**](SchedulesApi.md#deleteSchedule) | **DELETE** /schedules/{id} | Delete Schedule +[**enableSchedules**](SchedulesApi.md#enableSchedules) | **PATCH** /schedules | Enable schedules +[**getSchedule**](SchedulesApi.md#getSchedule) | **GET** /schedules/{id} | Get Schedule +[**getSchedules**](SchedulesApi.md#getSchedules) | **GET** /schedules | Get schedules list +[**updateSchedule**](SchedulesApi.md#updateSchedule) | **PUT** /schedules/{id} | Update schedule + + +# **createSchedule** + +Create a new schedule + +### Example +```php +$body = new \Swagger\Client\Model\ScheduleRequest(); // \Swagger\Client\Model\ScheduleRequest | +$result = $client->schedules()->createSchedule($body); +print_r($result); +``` + + +### Parameters +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **body** | [**\Swagger\Client\Model\ScheduleRequest**](../Model/ScheduleRequest.md)| | + +### Return type + +[**\Swagger\Client\Model\Schedule**](../Model/Schedule.md) + +[[Back to top]](#) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to Model list]](../../README.md#documentation-for-models) [[Back to README]](../../README.md) + +# **deleteSchedule** + +Delete Schedule + +### Example +```php +$id = 56; // int | +$client->schedules()->deleteSchedule($id); +``` + + +### Parameters +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **id** | **int**| | + +### Return type + +void (empty response body) + +[[Back to top]](#) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to Model list]](../../README.md#documentation-for-models) [[Back to README]](../../README.md) + +# **enableSchedules** + +Enable schedules + +### Example +```php +$body = new \Swagger\Client\Model\SchedulesEnableRequest(); // \Swagger\Client\Model\SchedulesEnableRequest | +$client->schedules()->enableSchedules($body); +``` + + +### Parameters +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **body** | [**\Swagger\Client\Model\SchedulesEnableRequest**](../Model/SchedulesEnableRequest.md)| | + +### Return type + +void (empty response body) + +[[Back to top]](#) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to Model list]](../../README.md#documentation-for-models) [[Back to README]](../../README.md) + +# **getSchedule** + +Get Schedule + +### Example +```php +$id = 56; // int | +$include = array("include_example"); // string[] | Specify what extra fields to include in the response. +$result = $client->schedules()->getSchedule($id, $include); +print_r($result); +``` + + +### Parameters +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **id** | **int**| | + **include** | [**string[]**](../Model/string.md)| Specify what extra fields to include in the response. | [optional] + +### Return type + +[**\Swagger\Client\Model\Schedule**](../Model/Schedule.md) + +[[Back to top]](#) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to Model list]](../../README.md#documentation-for-models) [[Back to README]](../../README.md) + +# **getSchedules** + +Get schedules list + +### Example +```php +$include = array("include_example"); // string[] | Specify what extra fields to include in the response. +$result = $client->schedules()->getSchedules($include); +print_r($result); +``` + + +### Parameters +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **include** | [**string[]**](../Model/string.md)| Specify what extra fields to include in the response. | [optional] + +### Return type + +[**\Swagger\Client\Model\Schedule[]**](../Model/Schedule.md) + +[[Back to top]](#) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to Model list]](../../README.md#documentation-for-models) [[Back to README]](../../README.md) + +# **updateSchedule** + +Update schedule + +### Example +```php +$id = 56; // int | +$body = new \Swagger\Client\Model\ScheduleRequest(); // \Swagger\Client\Model\ScheduleRequest | +$enable = true; // bool | Set to `true` to enable the schedule after saving. +$result = $client->schedules()->updateSchedule($id, $body, $enable); +print_r($result); +``` + + +### Parameters +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **id** | **int**| | + **body** | [**\Swagger\Client\Model\ScheduleRequest**](../Model/ScheduleRequest.md)| | + **enable** | **bool**| Set to `true` to enable the schedule after saving. | [optional] + +### Return type + +[**\Swagger\Client\Model\Schedule**](../Model/Schedule.md) + +[[Back to top]](#) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to Model list]](../../README.md#documentation-for-models) [[Back to README]](../../README.md) + diff --git a/docs/Api/ServerApi.md b/docs/Api/ServerApi.md new file mode 100644 index 0000000..7b606dc --- /dev/null +++ b/docs/Api/ServerApi.md @@ -0,0 +1,43 @@ +# Swagger\Client\ServerApi + +Method | HTTP request | Description +------------- | ------------- | ------------- +[**getServerInfo**](ServerApi.md#getServerInfo) | **GET** /server-info | Get server info +[**getSuplaServerStatus**](ServerApi.md#getSuplaServerStatus) | **GET** /server-status | Get the SUPLA Server status + + +# **getServerInfo** + +Get server info + +### Example +```php +$result = $client->server()->getServerInfo(); +print_r($result); +``` + + + +### Return type + +[**\Swagger\Client\Model\ServerInfo**](../Model/ServerInfo.md) + +[[Back to top]](#) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to Model list]](../../README.md#documentation-for-models) [[Back to README]](../../README.md) + +# **getSuplaServerStatus** + +Get the SUPLA Server status + +### Example +```php +$client->server()->getSuplaServerStatus(); +``` + + + +### Return type + +void (empty response body) + +[[Back to top]](#) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to Model list]](../../README.md#documentation-for-models) [[Back to README]](../../README.md) + diff --git a/docs/Api/UsersApi.md b/docs/Api/UsersApi.md new file mode 100644 index 0000000..656c84c --- /dev/null +++ b/docs/Api/UsersApi.md @@ -0,0 +1,48 @@ +# Swagger\Client\UsersApi + +Method | HTTP request | Description +------------- | ------------- | ------------- +[**getCurrentUser**](UsersApi.md#getCurrentUser) | **GET** /users/current | Get current user +[**updateCurrentUser**](UsersApi.md#updateCurrentUser) | **PATCH** /users/current | Update current user + + +# **getCurrentUser** + +Get current user + +### Example +```php +$result = $client->users()->getCurrentUser(); +print_r($result); +``` + + + +### Return type + +[**\Swagger\Client\Model\UserData**](../Model/UserData.md) + +[[Back to top]](#) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to Model list]](../../README.md#documentation-for-models) [[Back to README]](../../README.md) + +# **updateCurrentUser** + +Update current user + +### Example +```php +$body = new \Swagger\Client\Model\UserUpdateRequest(); // \Swagger\Client\Model\UserUpdateRequest | +$client->users()->updateCurrentUser($body); +``` + + +### Parameters +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **body** | [**\Swagger\Client\Model\UserUpdateRequest**](../Model/UserUpdateRequest.md)| | + +### Return type + +void (empty response body) + +[[Back to top]](#) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to Model list]](../../README.md#documentation-for-models) [[Back to README]](../../README.md) + diff --git a/docs/Model/AccessIdentifier.md b/docs/Model/AccessIdentifier.md new file mode 100644 index 0000000..70cef92 --- /dev/null +++ b/docs/Model/AccessIdentifier.md @@ -0,0 +1,16 @@ +# AccessIdentifier + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **int** | Access Identifier identifier | [optional] +**caption** | **string** | Location caption | [optional] +**enabled** | **bool** | `true` if the location is enabled, `false` otherwise | [optional] +**locationsIds** | **int[]** | array containing the location idenfifiers assigned to this access ID | [optional] +**clientAppsIds** | **int[]** | array containing the client apps idenfifiers assigned to this access ID | [optional] +**locations** | [**\Swagger\Client\Model\Location[]**](Location.md) | Returned only if requested by the `include` parameter. | [optional] +**clientApps** | [**\Swagger\Client\Model\ClientApp[]**](ClientApp.md) | Returned only if requested by the `include` parameter. | [optional] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/Model/AccessIdentifierUpdateRequest.md b/docs/Model/AccessIdentifierUpdateRequest.md new file mode 100644 index 0000000..1d6b377 --- /dev/null +++ b/docs/Model/AccessIdentifierUpdateRequest.md @@ -0,0 +1,14 @@ +# AccessIdentifierUpdateRequest + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**enabled** | **bool** | | [optional] +**caption** | **string** | | [optional] +**password** | **string** | Provide new password if you want to change it. | [optional] +**locationsIds** | **int[]** | Locations identifiers to assign to this Access Identifier. | [optional] +**clientAppsIds** | **int[]** | Client Apps identifiers to assign to this Access Identifier. If client app is connected to any other Client ID, it will be disconnected from the old one before assigning. | [optional] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/Model/Channel.md b/docs/Model/Channel.md new file mode 100644 index 0000000..7bd4b88 --- /dev/null +++ b/docs/Model/Channel.md @@ -0,0 +1,28 @@ +# Channel + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **int** | Channel identifier | [optional] +**channelNumber** | **int** | Channel ordinal number in its IO Device | [optional] +**caption** | **string** | Channel caption | [optional] +**type** | [**\Swagger\Client\Model\ChannelType**](ChannelType.md) | | [optional] +**function** | [**\Swagger\Client\Model\ChannelFunction**](ChannelFunction.md) | | [optional] +**param1** | [**\Swagger\Client\Model\ChannelParam**](ChannelParam.md) | | [optional] +**param2** | [**\Swagger\Client\Model\ChannelParam**](ChannelParam.md) | | [optional] +**param3** | [**\Swagger\Client\Model\ChannelParam**](ChannelParam.md) | | [optional] +**altIcon** | **int** | Chosen alternative icon idenifier. Should not be greater than `funciton.maxAlternativeIconIndex` | [optional] +**hidden** | **bool** | Whether this channel is shown on client apps or not | [optional] +**inheritedLocation** | **bool** | Whether this channel inherits its IO Device's location (`true`) or not (`false`) | [optional] +**iodeviceId** | **int** | | [optional] +**locationId** | **int** | | [optional] +**functionId** | **int** | | [optional] +**typeId** | **int** | | [optional] +**iodevice** | [**\Swagger\Client\Model\Device**](Device.md) | | [optional] +**location** | [**\Swagger\Client\Model\Location**](Location.md) | | [optional] +**connected** | **bool** | | [optional] +**supportedFunctions** | [**\Swagger\Client\Model\ChannelFunction[]**](ChannelFunction.md) | | [optional] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/Model/ChannelActionExecutionFailedResponse.md b/docs/Model/ChannelActionExecutionFailedResponse.md new file mode 100644 index 0000000..63ecf60 --- /dev/null +++ b/docs/Model/ChannelActionExecutionFailedResponse.md @@ -0,0 +1,11 @@ +# ChannelActionExecutionFailedResponse + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**status** | **int** | | [optional] +**message** | **string** | | [optional] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/Model/ChannelExecuteActionRequest.md b/docs/Model/ChannelExecuteActionRequest.md new file mode 100644 index 0000000..bfdee22 --- /dev/null +++ b/docs/Model/ChannelExecuteActionRequest.md @@ -0,0 +1,14 @@ +# ChannelExecuteActionRequest + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**action** | [**\Swagger\Client\Model\ChannelFunctionActionEnum**](ChannelFunctionActionEnum.md) | | +**percentage** | **int** | | [optional] +**color** | **string** | | [optional] +**colorBrightness** | **int** | | [optional] +**brightness** | **int** | | [optional] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/Model/ChannelFunction.md b/docs/Model/ChannelFunction.md new file mode 100644 index 0000000..42cf02a --- /dev/null +++ b/docs/Model/ChannelFunction.md @@ -0,0 +1,14 @@ +# ChannelFunction + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **int** | | [optional] +**name** | [**\Swagger\Client\Model\ChannelFunctionEnumNames**](ChannelFunctionEnumNames.md) | | [optional] +**caption** | **string** | | [optional] +**maxAlternativeIconIndex** | **int** | | [optional] +**possibleActions** | [**\Swagger\Client\Model\ChannelFunctionAction[]**](ChannelFunctionAction.md) | What can you with with this channel? | [optional] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/Model/ChannelFunctionAction.md b/docs/Model/ChannelFunctionAction.md new file mode 100644 index 0000000..42e2195 --- /dev/null +++ b/docs/Model/ChannelFunctionAction.md @@ -0,0 +1,12 @@ +# ChannelFunctionAction + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **int** | | [optional] +**name** | [**\Swagger\Client\Model\ChannelFunctionActionEnum**](ChannelFunctionActionEnum.md) | | [optional] +**caption** | **string** | | [optional] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/Model/ChannelFunctionActionEnum.md b/docs/Model/ChannelFunctionActionEnum.md new file mode 100644 index 0000000..48bdfde --- /dev/null +++ b/docs/Model/ChannelFunctionActionEnum.md @@ -0,0 +1,9 @@ +# ChannelFunctionActionEnum + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/Model/ChannelFunctionEnumNames.md b/docs/Model/ChannelFunctionEnumNames.md new file mode 100644 index 0000000..e76d13a --- /dev/null +++ b/docs/Model/ChannelFunctionEnumNames.md @@ -0,0 +1,9 @@ +# ChannelFunctionEnumNames + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/Model/ChannelGroup.md b/docs/Model/ChannelGroup.md new file mode 100644 index 0000000..3e1141c --- /dev/null +++ b/docs/Model/ChannelGroup.md @@ -0,0 +1,19 @@ +# ChannelGroup + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **int** | Channel group identifier | [optional] +**hidden** | **bool** | Whether this channel group is shown on client apps or not | [optional] +**caption** | **string** | Channel caption | [optional] +**function** | [**\Swagger\Client\Model\ChannelFunction**](ChannelFunction.md) | | [optional] +**functionId** | **int** | | [optional] +**locationId** | **int** | | [optional] +**location** | [**\Swagger\Client\Model\Location**](Location.md) | | [optional] +**channelIds** | **int[]** | | [optional] +**channels** | [**\Swagger\Client\Model\Channel[]**](Channel.md) | Returned only if requested by the `include` parameter. | [optional] +**altIcon** | **int** | Chosen alternative icon idenifier. Should not be greater than `funciton.maxAlternativeIconIndex` | [optional] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/Model/ChannelGroupRequest.md b/docs/Model/ChannelGroupRequest.md new file mode 100644 index 0000000..2273667 --- /dev/null +++ b/docs/Model/ChannelGroupRequest.md @@ -0,0 +1,14 @@ +# ChannelGroupRequest + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**caption** | **string** | | [optional] +**altIcon** | **int** | | [optional] +**hidden** | **bool** | | [optional] +**locationId** | **int** | | [optional] +**channelIds** | **int[]** | | + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/Model/ChannelMeasurementLog.md b/docs/Model/ChannelMeasurementLog.md new file mode 100644 index 0000000..cce201d --- /dev/null +++ b/docs/Model/ChannelMeasurementLog.md @@ -0,0 +1,12 @@ +# ChannelMeasurementLog + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**dateTimestamp** | **int** | | [optional] +**temperature** | **float** | Temperature in Celsius | [optional] +**humidity** | **float** | Humidity percent. Available only if channel function is `HUMIDITYANDTEMPERATURE`. | [optional] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/Model/ChannelParam.md b/docs/Model/ChannelParam.md new file mode 100644 index 0000000..db70bce --- /dev/null +++ b/docs/Model/ChannelParam.md @@ -0,0 +1,9 @@ +# ChannelParam + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/Model/ChannelType.md b/docs/Model/ChannelType.md new file mode 100644 index 0000000..73fee38 --- /dev/null +++ b/docs/Model/ChannelType.md @@ -0,0 +1,13 @@ +# ChannelType + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **int** | Channel type identifier | [optional] +**name** | **string** | | [optional] +**caption** | **string** | | [optional] +**output** | **bool** | Whether the channel is output type (i.e. can take action) or input (i.e. provide data) | [optional] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/Model/ChannelUnsupportedFunctionResponse.md b/docs/Model/ChannelUnsupportedFunctionResponse.md new file mode 100644 index 0000000..ba0aa3c --- /dev/null +++ b/docs/Model/ChannelUnsupportedFunctionResponse.md @@ -0,0 +1,11 @@ +# ChannelUnsupportedFunctionResponse + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**status** | **int** | | [optional] +**message** | **string** | | [optional] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/Model/ChannelUpdateConfirmationResponse.md b/docs/Model/ChannelUpdateConfirmationResponse.md new file mode 100644 index 0000000..17d590c --- /dev/null +++ b/docs/Model/ChannelUpdateConfirmationResponse.md @@ -0,0 +1,11 @@ +# ChannelUpdateConfirmationResponse + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**schedules** | [**\Swagger\Client\Model\Schedule[]**](Schedule.md) | Schedules that will be deleted after this request. | [optional] +**groups** | [**\Swagger\Client\Model\ChannelGroup[]**](ChannelGroup.md) | Channel groups that this channel will be removed from after this request. | [optional] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/Model/ChannelUpdateRequest.md b/docs/Model/ChannelUpdateRequest.md new file mode 100644 index 0000000..0d2df0f --- /dev/null +++ b/docs/Model/ChannelUpdateRequest.md @@ -0,0 +1,18 @@ +# ChannelUpdateRequest + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**functionId** | **int** | | [optional] +**param1** | **int** | | [optional] +**param2** | **int** | | [optional] +**param3** | **int** | | [optional] +**caption** | **string** | | [optional] +**altIcon** | **int** | | [optional] +**hidden** | **bool** | | [optional] +**locationId** | **int** | | [optional] +**inheritedLocation** | **bool** | | [optional] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/Model/ClientApp.md b/docs/Model/ClientApp.md new file mode 100644 index 0000000..8488fd9 --- /dev/null +++ b/docs/Model/ClientApp.md @@ -0,0 +1,22 @@ +# ClientApp + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **int** | Client application identifier | [optional] +**name** | **string** | | [optional] +**caption** | **string** | | [optional] +**enabled** | **bool** | | [optional] +**regIpv4** | **int** | | [optional] +**regDate** | [**\DateTime**](\DateTime.md) | | [optional] +**lastAccessIpv4** | **int** | | [optional] +**lastAccessDate** | [**\DateTime**](\DateTime.md) | | [optional] +**softwareVersion** | **string** | | [optional] +**protocolVersion** | **int** | | [optional] +**accessIdId** | **int** | | [optional] +**connected** | **bool** | | [optional] +**accessId** | [**\Swagger\Client\Model\AccessIdentifier**](AccessIdentifier.md) | | [optional] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/Model/ClientAppUpdateRequest.md b/docs/Model/ClientAppUpdateRequest.md new file mode 100644 index 0000000..7727fd3 --- /dev/null +++ b/docs/Model/ClientAppUpdateRequest.md @@ -0,0 +1,12 @@ +# ClientAppUpdateRequest + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**caption** | **string** | | [optional] +**enabled** | **bool** | | [optional] +**accessIdId** | **int** | | [optional] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/Model/Device.md b/docs/Model/Device.md new file mode 100644 index 0000000..2de2a3a --- /dev/null +++ b/docs/Model/Device.md @@ -0,0 +1,27 @@ +# Device + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **int** | Device identifier | [optional] +**name** | **string** | | [optional] +**enabled** | **bool** | | [optional] +**comment** | **string** | | [optional] +**regDate** | [**\DateTime**](\DateTime.md) | | [optional] +**regIpv4** | **int** | | [optional] +**lastConnected** | [**\DateTime**](\DateTime.md) | | [optional] +**lastIpv4** | **int** | | [optional] +**softwareVersion** | **string** | | [optional] +**gUIDString** | **string** | | [optional] +**locationId** | **int** | | [optional] +**originalLocationId** | **int** | | [optional] +**channelsIds** | **int[]** | | [optional] +**connected** | **bool** | | [optional] +**location** | [**\Swagger\Client\Model\Location**](Location.md) | | [optional] +**originalLocation** | [**\Swagger\Client\Model\Location**](Location.md) | | [optional] +**channels** | [**\Swagger\Client\Model\Channel[]**](Channel.md) | Returned only if requested by the `include` parameter. | [optional] +**schedules** | [**\Swagger\Client\Model\Schedule[]**](Schedule.md) | Returned only if requested by the `include` parameter. | [optional] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/Model/IODeviceUpdateRequest.md b/docs/Model/IODeviceUpdateRequest.md new file mode 100644 index 0000000..2ede08d --- /dev/null +++ b/docs/Model/IODeviceUpdateRequest.md @@ -0,0 +1,12 @@ +# IODeviceUpdateRequest + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**comment** | **string** | | [optional] +**enabled** | **bool** | | [optional] +**locationId** | **int** | | [optional] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/Model/Location.md b/docs/Model/Location.md new file mode 100644 index 0000000..3af4b58 --- /dev/null +++ b/docs/Model/Location.md @@ -0,0 +1,21 @@ +# Location + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **int** | Location identifier | [optional] +**caption** | **string** | Location caption | [optional] +**enabled** | **bool** | `true` if the location is enabled, `false` otherwise | [optional] +**iodevicesIds** | **int[]** | array containing the IO Devices identifiers assigned to this location | [optional] +**channelGroupsIds** | **int[]** | array containing the Channel groups identifiers assigned to this location | [optional] +**channelsIds** | **int[]** | array containing the Channels identifiers expicitely assigned to this location | [optional] +**accessIdsIds** | **int[]** | array containing the Access Identifiers identifiers assigned to this location | [optional] +**password** | **string** | Location password (plain text). Returned only if requested by the `include` parameter. | [optional] +**iodevices** | [**\Swagger\Client\Model\Device[]**](Device.md) | Returned only if requested by the `include` parameter. | [optional] +**channelGroups** | [**\Swagger\Client\Model\ChannelGroup[]**](ChannelGroup.md) | Returned only if requested by the `include` parameter. | [optional] +**accessIds** | [**\Swagger\Client\Model\AccessIdentifier[]**](AccessIdentifier.md) | Returned only if requested by the `include` parameter. | [optional] +**channels** | [**\Swagger\Client\Model\Channel[]**](Channel.md) | Returned only if requested by the `include` parameter. | [optional] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/Model/LocationUpdateRequest.md b/docs/Model/LocationUpdateRequest.md new file mode 100644 index 0000000..8f52168 --- /dev/null +++ b/docs/Model/LocationUpdateRequest.md @@ -0,0 +1,13 @@ +# LocationUpdateRequest + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**enabled** | **bool** | | [optional] +**caption** | **string** | | [optional] +**password** | **string** | Provide new password if you want to change it. | [optional] +**accessIdsIds** | **int[]** | Access Identifiers identifiers to assign to this location. | [optional] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/Model/Schedule.md b/docs/Model/Schedule.md new file mode 100644 index 0000000..f372df1 --- /dev/null +++ b/docs/Model/Schedule.md @@ -0,0 +1,22 @@ +# Schedule + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **int** | Schedule identifier | [optional] +**timeExpression** | **string** | Schedule time expression in crontab notation (with some custom additions). | [optional] +**action** | [**\Swagger\Client\Model\ChannelFunctionAction**](ChannelFunctionAction.md) | | [optional] +**mode** | **string** | | [optional] +**dateStart** | [**\DateTime**](\DateTime.md) | | [optional] +**dateEnd** | [**\DateTime**](\DateTime.md) | | [optional] +**enabled** | **bool** | | [optional] +**caption** | **string** | | [optional] +**retry** | **bool** | | [optional] +**channelId** | **int** | | [optional] +**actionId** | **int** | | [optional] +**channel** | [**\Swagger\Client\Model\Channel**](Channel.md) | | [optional] +**closestExecutions** | [**\Swagger\Client\Model\ScheduleClosestExecutions[]**](ScheduleClosestExecutions.md) | Returned only if requested by the `include` parameter. Contains two arrays of maximum 3 closest past and future executions. | [optional] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/Model/ScheduleClosestExecutions.md b/docs/Model/ScheduleClosestExecutions.md new file mode 100644 index 0000000..5b28a31 --- /dev/null +++ b/docs/Model/ScheduleClosestExecutions.md @@ -0,0 +1,11 @@ +# ScheduleClosestExecutions + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**past** | [**\Swagger\Client\Model\SchedulePast[]**](SchedulePast.md) | | [optional] +**future** | [**\Swagger\Client\Model\ScheduleFuture[]**](ScheduleFuture.md) | | [optional] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/Model/ScheduleFuture.md b/docs/Model/ScheduleFuture.md new file mode 100644 index 0000000..af29f3d --- /dev/null +++ b/docs/Model/ScheduleFuture.md @@ -0,0 +1,10 @@ +# ScheduleFuture + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**plannedTimestamp** | [**\DateTime**](\DateTime.md) | | [optional] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/Model/SchedulePast.md b/docs/Model/SchedulePast.md new file mode 100644 index 0000000..a5febe1 --- /dev/null +++ b/docs/Model/SchedulePast.md @@ -0,0 +1,13 @@ +# SchedulePast + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**plannedTimestamp** | [**\DateTime**](\DateTime.md) | | [optional] +**resultTimestamp** | [**\DateTime**](\DateTime.md) | | [optional] +**failed** | **bool** | | [optional] +**result** | [**\Swagger\Client\Model\ScheduleResult**](ScheduleResult.md) | | [optional] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/Model/ScheduleRequest.md b/docs/Model/ScheduleRequest.md new file mode 100644 index 0000000..1ff7ba6 --- /dev/null +++ b/docs/Model/ScheduleRequest.md @@ -0,0 +1,17 @@ +# ScheduleRequest + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**channelId** | **int** | | +**actionId** | **int** | | +**mode** | **string** | | +**timeExpression** | **string** | Schedule time expression in crontab notation (with some custom additions). | +**dateStart** | [**\DateTime**](\DateTime.md) | | [optional] +**dateEnd** | [**\DateTime**](\DateTime.md) | | [optional] +**caption** | **string** | | [optional] +**retry** | **bool** | | [optional] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/Model/ScheduleResult.md b/docs/Model/ScheduleResult.md new file mode 100644 index 0000000..6330dac --- /dev/null +++ b/docs/Model/ScheduleResult.md @@ -0,0 +1,10 @@ +# ScheduleResult + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**caption** | **string** | | [optional] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/Model/SchedulesEnableRequest.md b/docs/Model/SchedulesEnableRequest.md new file mode 100644 index 0000000..19a08be --- /dev/null +++ b/docs/Model/SchedulesEnableRequest.md @@ -0,0 +1,10 @@ +# SchedulesEnableRequest + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**enable** | **int[]** | Array of schedule identifiers to enable | [optional] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/Model/ServerInfo.md b/docs/Model/ServerInfo.md new file mode 100644 index 0000000..10d26c4 --- /dev/null +++ b/docs/Model/ServerInfo.md @@ -0,0 +1,17 @@ +# ServerInfo + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**address** | **string** | SUPLA Server address (to be used in smartphones) | [optional] +**time** | [**\DateTime**](\DateTime.md) | Current server time | [optional] +**timezone** | [**\Swagger\Client\Model\ServerInfoTimezone**](ServerInfoTimezone.md) | | [optional] +**authenticated** | **bool** | | [optional] +**username** | **string** | Present only if `authenticated=true` | [optional] +**cloudVersion** | **string** | | [optional] +**apiVersion** | **string** | | [optional] +**supportedApiVersions** | **string[]** | | [optional] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/Model/ServerInfoTimezone.md b/docs/Model/ServerInfoTimezone.md new file mode 100644 index 0000000..5563e63 --- /dev/null +++ b/docs/Model/ServerInfoTimezone.md @@ -0,0 +1,11 @@ +# ServerInfoTimezone + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**name** | **string** | | [optional] +**offset** | **int** | Timezone offset in minutes | [optional] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/Model/UserData.md b/docs/Model/UserData.md new file mode 100644 index 0000000..021b380 --- /dev/null +++ b/docs/Model/UserData.md @@ -0,0 +1,14 @@ +# UserData + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **int** | | [optional] +**email** | **string** | | [optional] +**timezone** | **string** | | [optional] +**clientsRegistrationEnabled** | [**\DateTime**](\DateTime.md) | | [optional] +**ioDevicesRegistrationEnabled** | [**\DateTime**](\DateTime.md) | | [optional] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/Model/UserUpdateRequest.md b/docs/Model/UserUpdateRequest.md new file mode 100644 index 0000000..159fb39 --- /dev/null +++ b/docs/Model/UserUpdateRequest.md @@ -0,0 +1,10 @@ +# UserUpdateRequest + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**action** | **string** | The `change:userTimezone` requires to provide also a `timezone` value in the request. The `change:password` requires to provide also a `newPassword` and `oldPassword` in the request. | [optional] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/lib/Api/AccessIdentifiersApi.php b/lib/Api/AccessIdentifiersApi.php new file mode 100644 index 0000000..f92d3b1 --- /dev/null +++ b/lib/Api/AccessIdentifiersApi.php @@ -0,0 +1,1401 @@ +client = $client ?: new Client(); + $this->config = $config ?: new Configuration(); + $this->headerSelector = $selector ?: new HeaderSelector(); + } + + /** + * @return Configuration + */ + public function getConfig() + { + return $this->config; + } + + /** + * Operation createAccessIdentifier + * + * Create a new Access Identifier + * + * + * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return \Swagger\Client\Model\AccessIdentifier + */ + public function createAccessIdentifier() + { + list($response) = $this->createAccessIdentifierWithHttpInfo(); + return $response; + } + + /** + * Operation createAccessIdentifierWithHttpInfo + * + * Create a new Access Identifier + * + * + * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of \Swagger\Client\Model\AccessIdentifier, HTTP status code, HTTP response headers (array of strings) + */ + public function createAccessIdentifierWithHttpInfo() + { + $returnType = '\Swagger\Client\Model\AccessIdentifier'; + $request = $this->createAccessIdentifierRequest(); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + ); + } + + $statusCode = $response->getStatusCode(); + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $response->getBody() + ); + } + + $responseBody = $response->getBody(); + if ($returnType === '\SplFileObject') { + $content = $responseBody; //stream goes to serializer + } else { + $content = $responseBody->getContents(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + case 201: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Swagger\Client\Model\AccessIdentifier', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation createAccessIdentifierAsync + * + * Create a new Access Identifier + * + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function createAccessIdentifierAsync() + { + return $this->createAccessIdentifierAsyncWithHttpInfo() + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation createAccessIdentifierAsyncWithHttpInfo + * + * Create a new Access Identifier + * + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function createAccessIdentifierAsyncWithHttpInfo() + { + $returnType = '\Swagger\Client\Model\AccessIdentifier'; + $request = $this->createAccessIdentifierRequest(); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + $responseBody = $response->getBody(); + if ($returnType === '\SplFileObject') { + $content = $responseBody; //stream goes to serializer + } else { + $content = $responseBody->getContents(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'createAccessIdentifier' + * + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + protected function createAccessIdentifierRequest() + { + + $resourcePath = '/accessids'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + // body params + $_tempBody = null; + + if ($multipart) { + $headers = $this->headerSelector->selectHeadersForMultipart( + ['application/json'] + ); + } else { + $headers = $this->headerSelector->selectHeaders( + ['application/json'], + ['application/json'] + ); + } + + // for model (json/xml) + if (isset($_tempBody)) { + // $_tempBody is the method argument, if present + $httpBody = $_tempBody; + // \stdClass has no __toString(), so we should encode it manually + if ($httpBody instanceof \stdClass && $headers['Content-Type'] === 'application/json') { + $httpBody = \GuzzleHttp\json_encode($httpBody); + } + } elseif (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValue + ]; + } + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); + + } elseif ($headers['Content-Type'] === 'application/json') { + $httpBody = \GuzzleHttp\json_encode($formParams); + + } else { + // for HTTP post (form) + $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + } + } + + // this endpoint requires OAuth (access token) + if ($this->config->getAccessToken() !== null) { + $headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken(); + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $query = \GuzzleHttp\Psr7\build_query($queryParams); + return new Request( + 'POST', + $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation deleteAccessIdentifier + * + * Delete Access Identifier + * + * @param int $id id (required) + * + * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return void + */ + public function deleteAccessIdentifier($id) + { + $this->deleteAccessIdentifierWithHttpInfo($id); + } + + /** + * Operation deleteAccessIdentifierWithHttpInfo + * + * Delete Access Identifier + * + * @param int $id (required) + * + * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of null, HTTP status code, HTTP response headers (array of strings) + */ + public function deleteAccessIdentifierWithHttpInfo($id) + { + $returnType = ''; + $request = $this->deleteAccessIdentifierRequest($id); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + ); + } + + $statusCode = $response->getStatusCode(); + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $response->getBody() + ); + } + + return [null, $statusCode, $response->getHeaders()]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + } + throw $e; + } + } + + /** + * Operation deleteAccessIdentifierAsync + * + * Delete Access Identifier + * + * @param int $id (required) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function deleteAccessIdentifierAsync($id) + { + return $this->deleteAccessIdentifierAsyncWithHttpInfo($id) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation deleteAccessIdentifierAsyncWithHttpInfo + * + * Delete Access Identifier + * + * @param int $id (required) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function deleteAccessIdentifierAsyncWithHttpInfo($id) + { + $returnType = ''; + $request = $this->deleteAccessIdentifierRequest($id); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + return [null, $response->getStatusCode(), $response->getHeaders()]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'deleteAccessIdentifier' + * + * @param int $id (required) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + protected function deleteAccessIdentifierRequest($id) + { + // verify the required parameter 'id' is set + if ($id === null || (is_array($id) && count($id) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $id when calling deleteAccessIdentifier' + ); + } + + $resourcePath = '/accessids/{id}'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + // path params + if ($id !== null) { + $resourcePath = str_replace( + '{' . 'id' . '}', + ObjectSerializer::toPathValue($id), + $resourcePath + ); + } + + // body params + $_tempBody = null; + + if ($multipart) { + $headers = $this->headerSelector->selectHeadersForMultipart( + ['application/json'] + ); + } else { + $headers = $this->headerSelector->selectHeaders( + ['application/json'], + ['application/json'] + ); + } + + // for model (json/xml) + if (isset($_tempBody)) { + // $_tempBody is the method argument, if present + $httpBody = $_tempBody; + // \stdClass has no __toString(), so we should encode it manually + if ($httpBody instanceof \stdClass && $headers['Content-Type'] === 'application/json') { + $httpBody = \GuzzleHttp\json_encode($httpBody); + } + } elseif (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValue + ]; + } + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); + + } elseif ($headers['Content-Type'] === 'application/json') { + $httpBody = \GuzzleHttp\json_encode($formParams); + + } else { + // for HTTP post (form) + $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + } + } + + // this endpoint requires OAuth (access token) + if ($this->config->getAccessToken() !== null) { + $headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken(); + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $query = \GuzzleHttp\Psr7\build_query($queryParams); + return new Request( + 'DELETE', + $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation getAccessIdentifier + * + * Get Access Identifier + * + * @param int $id id (required) + * @param string[] $include Specify what extra fields to include in the response. (optional) + * + * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return \Swagger\Client\Model\AccessIdentifier + */ + public function getAccessIdentifier($id, $include = null) + { + list($response) = $this->getAccessIdentifierWithHttpInfo($id, $include); + return $response; + } + + /** + * Operation getAccessIdentifierWithHttpInfo + * + * Get Access Identifier + * + * @param int $id (required) + * @param string[] $include Specify what extra fields to include in the response. (optional) + * + * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of \Swagger\Client\Model\AccessIdentifier, HTTP status code, HTTP response headers (array of strings) + */ + public function getAccessIdentifierWithHttpInfo($id, $include = null) + { + $returnType = '\Swagger\Client\Model\AccessIdentifier'; + $request = $this->getAccessIdentifierRequest($id, $include); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + ); + } + + $statusCode = $response->getStatusCode(); + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $response->getBody() + ); + } + + $responseBody = $response->getBody(); + if ($returnType === '\SplFileObject') { + $content = $responseBody; //stream goes to serializer + } else { + $content = $responseBody->getContents(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Swagger\Client\Model\AccessIdentifier', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation getAccessIdentifierAsync + * + * Get Access Identifier + * + * @param int $id (required) + * @param string[] $include Specify what extra fields to include in the response. (optional) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function getAccessIdentifierAsync($id, $include = null) + { + return $this->getAccessIdentifierAsyncWithHttpInfo($id, $include) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation getAccessIdentifierAsyncWithHttpInfo + * + * Get Access Identifier + * + * @param int $id (required) + * @param string[] $include Specify what extra fields to include in the response. (optional) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function getAccessIdentifierAsyncWithHttpInfo($id, $include = null) + { + $returnType = '\Swagger\Client\Model\AccessIdentifier'; + $request = $this->getAccessIdentifierRequest($id, $include); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + $responseBody = $response->getBody(); + if ($returnType === '\SplFileObject') { + $content = $responseBody; //stream goes to serializer + } else { + $content = $responseBody->getContents(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'getAccessIdentifier' + * + * @param int $id (required) + * @param string[] $include Specify what extra fields to include in the response. (optional) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + protected function getAccessIdentifierRequest($id, $include = null) + { + // verify the required parameter 'id' is set + if ($id === null || (is_array($id) && count($id) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $id when calling getAccessIdentifier' + ); + } + + $resourcePath = '/accessids/{id}'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + // query params + if (is_array($include)) { + $include = ObjectSerializer::serializeCollection($include, 'csv', true); + } + if ($include !== null) { + $queryParams['include'] = ObjectSerializer::toQueryValue($include); + } + + // path params + if ($id !== null) { + $resourcePath = str_replace( + '{' . 'id' . '}', + ObjectSerializer::toPathValue($id), + $resourcePath + ); + } + + // body params + $_tempBody = null; + + if ($multipart) { + $headers = $this->headerSelector->selectHeadersForMultipart( + ['application/json'] + ); + } else { + $headers = $this->headerSelector->selectHeaders( + ['application/json'], + ['application/json'] + ); + } + + // for model (json/xml) + if (isset($_tempBody)) { + // $_tempBody is the method argument, if present + $httpBody = $_tempBody; + // \stdClass has no __toString(), so we should encode it manually + if ($httpBody instanceof \stdClass && $headers['Content-Type'] === 'application/json') { + $httpBody = \GuzzleHttp\json_encode($httpBody); + } + } elseif (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValue + ]; + } + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); + + } elseif ($headers['Content-Type'] === 'application/json') { + $httpBody = \GuzzleHttp\json_encode($formParams); + + } else { + // for HTTP post (form) + $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + } + } + + // this endpoint requires OAuth (access token) + if ($this->config->getAccessToken() !== null) { + $headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken(); + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $query = \GuzzleHttp\Psr7\build_query($queryParams); + return new Request( + 'GET', + $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation getAccessIdentifiers + * + * Get Access Identifiers list + * + * @param string[] $include Specify what extra fields to include in the response. (optional) + * + * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return \Swagger\Client\Model\AccessIdentifier[] + */ + public function getAccessIdentifiers($include = null) + { + list($response) = $this->getAccessIdentifiersWithHttpInfo($include); + return $response; + } + + /** + * Operation getAccessIdentifiersWithHttpInfo + * + * Get Access Identifiers list + * + * @param string[] $include Specify what extra fields to include in the response. (optional) + * + * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of \Swagger\Client\Model\AccessIdentifier[], HTTP status code, HTTP response headers (array of strings) + */ + public function getAccessIdentifiersWithHttpInfo($include = null) + { + $returnType = '\Swagger\Client\Model\AccessIdentifier[]'; + $request = $this->getAccessIdentifiersRequest($include); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + ); + } + + $statusCode = $response->getStatusCode(); + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $response->getBody() + ); + } + + $responseBody = $response->getBody(); + if ($returnType === '\SplFileObject') { + $content = $responseBody; //stream goes to serializer + } else { + $content = $responseBody->getContents(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Swagger\Client\Model\AccessIdentifier[]', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation getAccessIdentifiersAsync + * + * Get Access Identifiers list + * + * @param string[] $include Specify what extra fields to include in the response. (optional) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function getAccessIdentifiersAsync($include = null) + { + return $this->getAccessIdentifiersAsyncWithHttpInfo($include) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation getAccessIdentifiersAsyncWithHttpInfo + * + * Get Access Identifiers list + * + * @param string[] $include Specify what extra fields to include in the response. (optional) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function getAccessIdentifiersAsyncWithHttpInfo($include = null) + { + $returnType = '\Swagger\Client\Model\AccessIdentifier[]'; + $request = $this->getAccessIdentifiersRequest($include); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + $responseBody = $response->getBody(); + if ($returnType === '\SplFileObject') { + $content = $responseBody; //stream goes to serializer + } else { + $content = $responseBody->getContents(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'getAccessIdentifiers' + * + * @param string[] $include Specify what extra fields to include in the response. (optional) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + protected function getAccessIdentifiersRequest($include = null) + { + + $resourcePath = '/accessids'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + // query params + if (is_array($include)) { + $include = ObjectSerializer::serializeCollection($include, 'csv', true); + } + if ($include !== null) { + $queryParams['include'] = ObjectSerializer::toQueryValue($include); + } + + + // body params + $_tempBody = null; + + if ($multipart) { + $headers = $this->headerSelector->selectHeadersForMultipart( + ['application/json'] + ); + } else { + $headers = $this->headerSelector->selectHeaders( + ['application/json'], + ['application/json'] + ); + } + + // for model (json/xml) + if (isset($_tempBody)) { + // $_tempBody is the method argument, if present + $httpBody = $_tempBody; + // \stdClass has no __toString(), so we should encode it manually + if ($httpBody instanceof \stdClass && $headers['Content-Type'] === 'application/json') { + $httpBody = \GuzzleHttp\json_encode($httpBody); + } + } elseif (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValue + ]; + } + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); + + } elseif ($headers['Content-Type'] === 'application/json') { + $httpBody = \GuzzleHttp\json_encode($formParams); + + } else { + // for HTTP post (form) + $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + } + } + + // this endpoint requires OAuth (access token) + if ($this->config->getAccessToken() !== null) { + $headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken(); + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $query = \GuzzleHttp\Psr7\build_query($queryParams); + return new Request( + 'GET', + $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation updateAccessIdentifier + * + * Update Access Identifier + * + * @param int $id id (required) + * @param \Swagger\Client\Model\AccessIdentifierUpdateRequest $body body (required) + * + * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return \Swagger\Client\Model\AccessIdentifier + */ + public function updateAccessIdentifier($id, $body) + { + list($response) = $this->updateAccessIdentifierWithHttpInfo($id, $body); + return $response; + } + + /** + * Operation updateAccessIdentifierWithHttpInfo + * + * Update Access Identifier + * + * @param int $id (required) + * @param \Swagger\Client\Model\AccessIdentifierUpdateRequest $body (required) + * + * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of \Swagger\Client\Model\AccessIdentifier, HTTP status code, HTTP response headers (array of strings) + */ + public function updateAccessIdentifierWithHttpInfo($id, $body) + { + $returnType = '\Swagger\Client\Model\AccessIdentifier'; + $request = $this->updateAccessIdentifierRequest($id, $body); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + ); + } + + $statusCode = $response->getStatusCode(); + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $response->getBody() + ); + } + + $responseBody = $response->getBody(); + if ($returnType === '\SplFileObject') { + $content = $responseBody; //stream goes to serializer + } else { + $content = $responseBody->getContents(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Swagger\Client\Model\AccessIdentifier', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation updateAccessIdentifierAsync + * + * Update Access Identifier + * + * @param int $id (required) + * @param \Swagger\Client\Model\AccessIdentifierUpdateRequest $body (required) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function updateAccessIdentifierAsync($id, $body) + { + return $this->updateAccessIdentifierAsyncWithHttpInfo($id, $body) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation updateAccessIdentifierAsyncWithHttpInfo + * + * Update Access Identifier + * + * @param int $id (required) + * @param \Swagger\Client\Model\AccessIdentifierUpdateRequest $body (required) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function updateAccessIdentifierAsyncWithHttpInfo($id, $body) + { + $returnType = '\Swagger\Client\Model\AccessIdentifier'; + $request = $this->updateAccessIdentifierRequest($id, $body); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + $responseBody = $response->getBody(); + if ($returnType === '\SplFileObject') { + $content = $responseBody; //stream goes to serializer + } else { + $content = $responseBody->getContents(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'updateAccessIdentifier' + * + * @param int $id (required) + * @param \Swagger\Client\Model\AccessIdentifierUpdateRequest $body (required) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + protected function updateAccessIdentifierRequest($id, $body) + { + // verify the required parameter 'id' is set + if ($id === null || (is_array($id) && count($id) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $id when calling updateAccessIdentifier' + ); + } + // verify the required parameter 'body' is set + if ($body === null || (is_array($body) && count($body) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $body when calling updateAccessIdentifier' + ); + } + + $resourcePath = '/accessids/{id}'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + // path params + if ($id !== null) { + $resourcePath = str_replace( + '{' . 'id' . '}', + ObjectSerializer::toPathValue($id), + $resourcePath + ); + } + + // body params + $_tempBody = null; + if (isset($body)) { + $_tempBody = $body; + } + + if ($multipart) { + $headers = $this->headerSelector->selectHeadersForMultipart( + ['application/json'] + ); + } else { + $headers = $this->headerSelector->selectHeaders( + ['application/json'], + ['application/json'] + ); + } + + // for model (json/xml) + if (isset($_tempBody)) { + // $_tempBody is the method argument, if present + $httpBody = $_tempBody; + // \stdClass has no __toString(), so we should encode it manually + if ($httpBody instanceof \stdClass && $headers['Content-Type'] === 'application/json') { + $httpBody = \GuzzleHttp\json_encode($httpBody); + } + } elseif (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValue + ]; + } + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); + + } elseif ($headers['Content-Type'] === 'application/json') { + $httpBody = \GuzzleHttp\json_encode($formParams); + + } else { + // for HTTP post (form) + $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + } + } + + // this endpoint requires OAuth (access token) + if ($this->config->getAccessToken() !== null) { + $headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken(); + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $query = \GuzzleHttp\Psr7\build_query($queryParams); + return new Request( + 'PUT', + $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Create http client option + * + * @throws \RuntimeException on file opening failure + * @return array of http client options + */ + protected function createHttpClientOption() + { + $options = []; + if ($this->config->getDebug()) { + $options[RequestOptions::DEBUG] = fopen($this->config->getDebugFile(), 'a'); + if (!$options[RequestOptions::DEBUG]) { + throw new \RuntimeException('Failed to open the debug file: ' . $this->config->getDebugFile()); + } + } + + return $options; + } +} diff --git a/lib/Api/ChannelGroupsApi.php b/lib/Api/ChannelGroupsApi.php new file mode 100644 index 0000000..74d341b --- /dev/null +++ b/lib/Api/ChannelGroupsApi.php @@ -0,0 +1,1666 @@ +client = $client ?: new Client(); + $this->config = $config ?: new Configuration(); + $this->headerSelector = $selector ?: new HeaderSelector(); + } + + /** + * @return Configuration + */ + public function getConfig() + { + return $this->config; + } + + /** + * Operation createChannelGroup + * + * Create a new channel group + * + * @param \Swagger\Client\Model\ChannelGroupRequest $body body (required) + * + * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return \Swagger\Client\Model\ChannelGroup + */ + public function createChannelGroup($body) + { + list($response) = $this->createChannelGroupWithHttpInfo($body); + return $response; + } + + /** + * Operation createChannelGroupWithHttpInfo + * + * Create a new channel group + * + * @param \Swagger\Client\Model\ChannelGroupRequest $body (required) + * + * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of \Swagger\Client\Model\ChannelGroup, HTTP status code, HTTP response headers (array of strings) + */ + public function createChannelGroupWithHttpInfo($body) + { + $returnType = '\Swagger\Client\Model\ChannelGroup'; + $request = $this->createChannelGroupRequest($body); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + ); + } + + $statusCode = $response->getStatusCode(); + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $response->getBody() + ); + } + + $responseBody = $response->getBody(); + if ($returnType === '\SplFileObject') { + $content = $responseBody; //stream goes to serializer + } else { + $content = $responseBody->getContents(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + case 201: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Swagger\Client\Model\ChannelGroup', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation createChannelGroupAsync + * + * Create a new channel group + * + * @param \Swagger\Client\Model\ChannelGroupRequest $body (required) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function createChannelGroupAsync($body) + { + return $this->createChannelGroupAsyncWithHttpInfo($body) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation createChannelGroupAsyncWithHttpInfo + * + * Create a new channel group + * + * @param \Swagger\Client\Model\ChannelGroupRequest $body (required) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function createChannelGroupAsyncWithHttpInfo($body) + { + $returnType = '\Swagger\Client\Model\ChannelGroup'; + $request = $this->createChannelGroupRequest($body); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + $responseBody = $response->getBody(); + if ($returnType === '\SplFileObject') { + $content = $responseBody; //stream goes to serializer + } else { + $content = $responseBody->getContents(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'createChannelGroup' + * + * @param \Swagger\Client\Model\ChannelGroupRequest $body (required) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + protected function createChannelGroupRequest($body) + { + // verify the required parameter 'body' is set + if ($body === null || (is_array($body) && count($body) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $body when calling createChannelGroup' + ); + } + + $resourcePath = '/channel-groups'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + // body params + $_tempBody = null; + if (isset($body)) { + $_tempBody = $body; + } + + if ($multipart) { + $headers = $this->headerSelector->selectHeadersForMultipart( + ['application/json'] + ); + } else { + $headers = $this->headerSelector->selectHeaders( + ['application/json'], + ['application/json'] + ); + } + + // for model (json/xml) + if (isset($_tempBody)) { + // $_tempBody is the method argument, if present + $httpBody = $_tempBody; + // \stdClass has no __toString(), so we should encode it manually + if ($httpBody instanceof \stdClass && $headers['Content-Type'] === 'application/json') { + $httpBody = \GuzzleHttp\json_encode($httpBody); + } + } elseif (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValue + ]; + } + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); + + } elseif ($headers['Content-Type'] === 'application/json') { + $httpBody = \GuzzleHttp\json_encode($formParams); + + } else { + // for HTTP post (form) + $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + } + } + + // this endpoint requires OAuth (access token) + if ($this->config->getAccessToken() !== null) { + $headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken(); + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $query = \GuzzleHttp\Psr7\build_query($queryParams); + return new Request( + 'POST', + $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation deleteChannelGroup + * + * Delete Channel Group + * + * @param int $id id (required) + * + * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return void + */ + public function deleteChannelGroup($id) + { + $this->deleteChannelGroupWithHttpInfo($id); + } + + /** + * Operation deleteChannelGroupWithHttpInfo + * + * Delete Channel Group + * + * @param int $id (required) + * + * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of null, HTTP status code, HTTP response headers (array of strings) + */ + public function deleteChannelGroupWithHttpInfo($id) + { + $returnType = ''; + $request = $this->deleteChannelGroupRequest($id); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + ); + } + + $statusCode = $response->getStatusCode(); + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $response->getBody() + ); + } + + return [null, $statusCode, $response->getHeaders()]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + } + throw $e; + } + } + + /** + * Operation deleteChannelGroupAsync + * + * Delete Channel Group + * + * @param int $id (required) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function deleteChannelGroupAsync($id) + { + return $this->deleteChannelGroupAsyncWithHttpInfo($id) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation deleteChannelGroupAsyncWithHttpInfo + * + * Delete Channel Group + * + * @param int $id (required) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function deleteChannelGroupAsyncWithHttpInfo($id) + { + $returnType = ''; + $request = $this->deleteChannelGroupRequest($id); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + return [null, $response->getStatusCode(), $response->getHeaders()]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'deleteChannelGroup' + * + * @param int $id (required) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + protected function deleteChannelGroupRequest($id) + { + // verify the required parameter 'id' is set + if ($id === null || (is_array($id) && count($id) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $id when calling deleteChannelGroup' + ); + } + + $resourcePath = '/channel-groups/{id}'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + // path params + if ($id !== null) { + $resourcePath = str_replace( + '{' . 'id' . '}', + ObjectSerializer::toPathValue($id), + $resourcePath + ); + } + + // body params + $_tempBody = null; + + if ($multipart) { + $headers = $this->headerSelector->selectHeadersForMultipart( + ['application/json'] + ); + } else { + $headers = $this->headerSelector->selectHeaders( + ['application/json'], + ['application/json'] + ); + } + + // for model (json/xml) + if (isset($_tempBody)) { + // $_tempBody is the method argument, if present + $httpBody = $_tempBody; + // \stdClass has no __toString(), so we should encode it manually + if ($httpBody instanceof \stdClass && $headers['Content-Type'] === 'application/json') { + $httpBody = \GuzzleHttp\json_encode($httpBody); + } + } elseif (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValue + ]; + } + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); + + } elseif ($headers['Content-Type'] === 'application/json') { + $httpBody = \GuzzleHttp\json_encode($formParams); + + } else { + // for HTTP post (form) + $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + } + } + + // this endpoint requires OAuth (access token) + if ($this->config->getAccessToken() !== null) { + $headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken(); + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $query = \GuzzleHttp\Psr7\build_query($queryParams); + return new Request( + 'DELETE', + $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation executeChannelGroupAction + * + * Execute action on the channel group + * + * @param int $id id (required) + * @param \Swagger\Client\Model\ChannelExecuteActionRequest $body Defines an action to execute on channel group. The `action` key is always required. The rest of the keys are params depending on the chosen action. Read more on [Github Wiki](https://github.com/SUPLA/supla-cloud/wiki/Channel-Actions). (required) + * + * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return void + */ + public function executeChannelGroupAction($id, $body) + { + $this->executeChannelGroupActionWithHttpInfo($id, $body); + } + + /** + * Operation executeChannelGroupActionWithHttpInfo + * + * Execute action on the channel group + * + * @param int $id (required) + * @param \Swagger\Client\Model\ChannelExecuteActionRequest $body Defines an action to execute on channel group. The `action` key is always required. The rest of the keys are params depending on the chosen action. Read more on [Github Wiki](https://github.com/SUPLA/supla-cloud/wiki/Channel-Actions). (required) + * + * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of null, HTTP status code, HTTP response headers (array of strings) + */ + public function executeChannelGroupActionWithHttpInfo($id, $body) + { + $returnType = ''; + $request = $this->executeChannelGroupActionRequest($id, $body); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + ); + } + + $statusCode = $response->getStatusCode(); + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $response->getBody() + ); + } + + return [null, $statusCode, $response->getHeaders()]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + case 400: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Swagger\Client\Model\ChannelActionExecutionFailedResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation executeChannelGroupActionAsync + * + * Execute action on the channel group + * + * @param int $id (required) + * @param \Swagger\Client\Model\ChannelExecuteActionRequest $body Defines an action to execute on channel group. The `action` key is always required. The rest of the keys are params depending on the chosen action. Read more on [Github Wiki](https://github.com/SUPLA/supla-cloud/wiki/Channel-Actions). (required) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function executeChannelGroupActionAsync($id, $body) + { + return $this->executeChannelGroupActionAsyncWithHttpInfo($id, $body) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation executeChannelGroupActionAsyncWithHttpInfo + * + * Execute action on the channel group + * + * @param int $id (required) + * @param \Swagger\Client\Model\ChannelExecuteActionRequest $body Defines an action to execute on channel group. The `action` key is always required. The rest of the keys are params depending on the chosen action. Read more on [Github Wiki](https://github.com/SUPLA/supla-cloud/wiki/Channel-Actions). (required) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function executeChannelGroupActionAsyncWithHttpInfo($id, $body) + { + $returnType = ''; + $request = $this->executeChannelGroupActionRequest($id, $body); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + return [null, $response->getStatusCode(), $response->getHeaders()]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'executeChannelGroupAction' + * + * @param int $id (required) + * @param \Swagger\Client\Model\ChannelExecuteActionRequest $body Defines an action to execute on channel group. The `action` key is always required. The rest of the keys are params depending on the chosen action. Read more on [Github Wiki](https://github.com/SUPLA/supla-cloud/wiki/Channel-Actions). (required) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + protected function executeChannelGroupActionRequest($id, $body) + { + // verify the required parameter 'id' is set + if ($id === null || (is_array($id) && count($id) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $id when calling executeChannelGroupAction' + ); + } + // verify the required parameter 'body' is set + if ($body === null || (is_array($body) && count($body) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $body when calling executeChannelGroupAction' + ); + } + + $resourcePath = '/channel-groups/{id}'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + // path params + if ($id !== null) { + $resourcePath = str_replace( + '{' . 'id' . '}', + ObjectSerializer::toPathValue($id), + $resourcePath + ); + } + + // body params + $_tempBody = null; + if (isset($body)) { + $_tempBody = $body; + } + + if ($multipart) { + $headers = $this->headerSelector->selectHeadersForMultipart( + ['application/json'] + ); + } else { + $headers = $this->headerSelector->selectHeaders( + ['application/json'], + ['application/json'] + ); + } + + // for model (json/xml) + if (isset($_tempBody)) { + // $_tempBody is the method argument, if present + $httpBody = $_tempBody; + // \stdClass has no __toString(), so we should encode it manually + if ($httpBody instanceof \stdClass && $headers['Content-Type'] === 'application/json') { + $httpBody = \GuzzleHttp\json_encode($httpBody); + } + } elseif (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValue + ]; + } + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); + + } elseif ($headers['Content-Type'] === 'application/json') { + $httpBody = \GuzzleHttp\json_encode($formParams); + + } else { + // for HTTP post (form) + $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + } + } + + // this endpoint requires OAuth (access token) + if ($this->config->getAccessToken() !== null) { + $headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken(); + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $query = \GuzzleHttp\Psr7\build_query($queryParams); + return new Request( + 'PATCH', + $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation getChannelGroup + * + * Get channel group by ID + * + * @param int $id id (required) + * @param string[] $include Specify what extra fields to include in the response. (optional) + * + * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return \Swagger\Client\Model\ChannelGroup + */ + public function getChannelGroup($id, $include = null) + { + list($response) = $this->getChannelGroupWithHttpInfo($id, $include); + return $response; + } + + /** + * Operation getChannelGroupWithHttpInfo + * + * Get channel group by ID + * + * @param int $id (required) + * @param string[] $include Specify what extra fields to include in the response. (optional) + * + * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of \Swagger\Client\Model\ChannelGroup, HTTP status code, HTTP response headers (array of strings) + */ + public function getChannelGroupWithHttpInfo($id, $include = null) + { + $returnType = '\Swagger\Client\Model\ChannelGroup'; + $request = $this->getChannelGroupRequest($id, $include); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + ); + } + + $statusCode = $response->getStatusCode(); + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $response->getBody() + ); + } + + $responseBody = $response->getBody(); + if ($returnType === '\SplFileObject') { + $content = $responseBody; //stream goes to serializer + } else { + $content = $responseBody->getContents(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Swagger\Client\Model\ChannelGroup', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation getChannelGroupAsync + * + * Get channel group by ID + * + * @param int $id (required) + * @param string[] $include Specify what extra fields to include in the response. (optional) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function getChannelGroupAsync($id, $include = null) + { + return $this->getChannelGroupAsyncWithHttpInfo($id, $include) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation getChannelGroupAsyncWithHttpInfo + * + * Get channel group by ID + * + * @param int $id (required) + * @param string[] $include Specify what extra fields to include in the response. (optional) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function getChannelGroupAsyncWithHttpInfo($id, $include = null) + { + $returnType = '\Swagger\Client\Model\ChannelGroup'; + $request = $this->getChannelGroupRequest($id, $include); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + $responseBody = $response->getBody(); + if ($returnType === '\SplFileObject') { + $content = $responseBody; //stream goes to serializer + } else { + $content = $responseBody->getContents(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'getChannelGroup' + * + * @param int $id (required) + * @param string[] $include Specify what extra fields to include in the response. (optional) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + protected function getChannelGroupRequest($id, $include = null) + { + // verify the required parameter 'id' is set + if ($id === null || (is_array($id) && count($id) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $id when calling getChannelGroup' + ); + } + + $resourcePath = '/channel-groups/{id}'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + // query params + if (is_array($include)) { + $include = ObjectSerializer::serializeCollection($include, 'csv', true); + } + if ($include !== null) { + $queryParams['include'] = ObjectSerializer::toQueryValue($include); + } + + // path params + if ($id !== null) { + $resourcePath = str_replace( + '{' . 'id' . '}', + ObjectSerializer::toPathValue($id), + $resourcePath + ); + } + + // body params + $_tempBody = null; + + if ($multipart) { + $headers = $this->headerSelector->selectHeadersForMultipart( + ['application/json'] + ); + } else { + $headers = $this->headerSelector->selectHeaders( + ['application/json'], + ['application/json'] + ); + } + + // for model (json/xml) + if (isset($_tempBody)) { + // $_tempBody is the method argument, if present + $httpBody = $_tempBody; + // \stdClass has no __toString(), so we should encode it manually + if ($httpBody instanceof \stdClass && $headers['Content-Type'] === 'application/json') { + $httpBody = \GuzzleHttp\json_encode($httpBody); + } + } elseif (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValue + ]; + } + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); + + } elseif ($headers['Content-Type'] === 'application/json') { + $httpBody = \GuzzleHttp\json_encode($formParams); + + } else { + // for HTTP post (form) + $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + } + } + + // this endpoint requires OAuth (access token) + if ($this->config->getAccessToken() !== null) { + $headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken(); + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $query = \GuzzleHttp\Psr7\build_query($queryParams); + return new Request( + 'GET', + $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation getChannelGroups + * + * Get channels list + * + * @param string[] $include Specify what extra fields to include in the response. (optional) + * + * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return \Swagger\Client\Model\ChannelGroup[] + */ + public function getChannelGroups($include = null) + { + list($response) = $this->getChannelGroupsWithHttpInfo($include); + return $response; + } + + /** + * Operation getChannelGroupsWithHttpInfo + * + * Get channels list + * + * @param string[] $include Specify what extra fields to include in the response. (optional) + * + * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of \Swagger\Client\Model\ChannelGroup[], HTTP status code, HTTP response headers (array of strings) + */ + public function getChannelGroupsWithHttpInfo($include = null) + { + $returnType = '\Swagger\Client\Model\ChannelGroup[]'; + $request = $this->getChannelGroupsRequest($include); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + ); + } + + $statusCode = $response->getStatusCode(); + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $response->getBody() + ); + } + + $responseBody = $response->getBody(); + if ($returnType === '\SplFileObject') { + $content = $responseBody; //stream goes to serializer + } else { + $content = $responseBody->getContents(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Swagger\Client\Model\ChannelGroup[]', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation getChannelGroupsAsync + * + * Get channels list + * + * @param string[] $include Specify what extra fields to include in the response. (optional) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function getChannelGroupsAsync($include = null) + { + return $this->getChannelGroupsAsyncWithHttpInfo($include) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation getChannelGroupsAsyncWithHttpInfo + * + * Get channels list + * + * @param string[] $include Specify what extra fields to include in the response. (optional) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function getChannelGroupsAsyncWithHttpInfo($include = null) + { + $returnType = '\Swagger\Client\Model\ChannelGroup[]'; + $request = $this->getChannelGroupsRequest($include); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + $responseBody = $response->getBody(); + if ($returnType === '\SplFileObject') { + $content = $responseBody; //stream goes to serializer + } else { + $content = $responseBody->getContents(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'getChannelGroups' + * + * @param string[] $include Specify what extra fields to include in the response. (optional) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + protected function getChannelGroupsRequest($include = null) + { + + $resourcePath = '/channel-groups'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + // query params + if (is_array($include)) { + $include = ObjectSerializer::serializeCollection($include, 'csv', true); + } + if ($include !== null) { + $queryParams['include'] = ObjectSerializer::toQueryValue($include); + } + + + // body params + $_tempBody = null; + + if ($multipart) { + $headers = $this->headerSelector->selectHeadersForMultipart( + ['application/json'] + ); + } else { + $headers = $this->headerSelector->selectHeaders( + ['application/json'], + ['application/json'] + ); + } + + // for model (json/xml) + if (isset($_tempBody)) { + // $_tempBody is the method argument, if present + $httpBody = $_tempBody; + // \stdClass has no __toString(), so we should encode it manually + if ($httpBody instanceof \stdClass && $headers['Content-Type'] === 'application/json') { + $httpBody = \GuzzleHttp\json_encode($httpBody); + } + } elseif (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValue + ]; + } + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); + + } elseif ($headers['Content-Type'] === 'application/json') { + $httpBody = \GuzzleHttp\json_encode($formParams); + + } else { + // for HTTP post (form) + $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + } + } + + // this endpoint requires OAuth (access token) + if ($this->config->getAccessToken() !== null) { + $headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken(); + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $query = \GuzzleHttp\Psr7\build_query($queryParams); + return new Request( + 'GET', + $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation updateChannelGroup + * + * Update channel group + * + * @param int $id id (required) + * @param \Swagger\Client\Model\ChannelGroupRequest $body body (required) + * + * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return \Swagger\Client\Model\ChannelGroup + */ + public function updateChannelGroup($id, $body) + { + list($response) = $this->updateChannelGroupWithHttpInfo($id, $body); + return $response; + } + + /** + * Operation updateChannelGroupWithHttpInfo + * + * Update channel group + * + * @param int $id (required) + * @param \Swagger\Client\Model\ChannelGroupRequest $body (required) + * + * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of \Swagger\Client\Model\ChannelGroup, HTTP status code, HTTP response headers (array of strings) + */ + public function updateChannelGroupWithHttpInfo($id, $body) + { + $returnType = '\Swagger\Client\Model\ChannelGroup'; + $request = $this->updateChannelGroupRequest($id, $body); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + ); + } + + $statusCode = $response->getStatusCode(); + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $response->getBody() + ); + } + + $responseBody = $response->getBody(); + if ($returnType === '\SplFileObject') { + $content = $responseBody; //stream goes to serializer + } else { + $content = $responseBody->getContents(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Swagger\Client\Model\ChannelGroup', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation updateChannelGroupAsync + * + * Update channel group + * + * @param int $id (required) + * @param \Swagger\Client\Model\ChannelGroupRequest $body (required) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function updateChannelGroupAsync($id, $body) + { + return $this->updateChannelGroupAsyncWithHttpInfo($id, $body) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation updateChannelGroupAsyncWithHttpInfo + * + * Update channel group + * + * @param int $id (required) + * @param \Swagger\Client\Model\ChannelGroupRequest $body (required) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function updateChannelGroupAsyncWithHttpInfo($id, $body) + { + $returnType = '\Swagger\Client\Model\ChannelGroup'; + $request = $this->updateChannelGroupRequest($id, $body); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + $responseBody = $response->getBody(); + if ($returnType === '\SplFileObject') { + $content = $responseBody; //stream goes to serializer + } else { + $content = $responseBody->getContents(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'updateChannelGroup' + * + * @param int $id (required) + * @param \Swagger\Client\Model\ChannelGroupRequest $body (required) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + protected function updateChannelGroupRequest($id, $body) + { + // verify the required parameter 'id' is set + if ($id === null || (is_array($id) && count($id) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $id when calling updateChannelGroup' + ); + } + // verify the required parameter 'body' is set + if ($body === null || (is_array($body) && count($body) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $body when calling updateChannelGroup' + ); + } + + $resourcePath = '/channel-groups/{id}'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + // path params + if ($id !== null) { + $resourcePath = str_replace( + '{' . 'id' . '}', + ObjectSerializer::toPathValue($id), + $resourcePath + ); + } + + // body params + $_tempBody = null; + if (isset($body)) { + $_tempBody = $body; + } + + if ($multipart) { + $headers = $this->headerSelector->selectHeadersForMultipart( + ['application/json'] + ); + } else { + $headers = $this->headerSelector->selectHeaders( + ['application/json'], + ['application/json'] + ); + } + + // for model (json/xml) + if (isset($_tempBody)) { + // $_tempBody is the method argument, if present + $httpBody = $_tempBody; + // \stdClass has no __toString(), so we should encode it manually + if ($httpBody instanceof \stdClass && $headers['Content-Type'] === 'application/json') { + $httpBody = \GuzzleHttp\json_encode($httpBody); + } + } elseif (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValue + ]; + } + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); + + } elseif ($headers['Content-Type'] === 'application/json') { + $httpBody = \GuzzleHttp\json_encode($formParams); + + } else { + // for HTTP post (form) + $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + } + } + + // this endpoint requires OAuth (access token) + if ($this->config->getAccessToken() !== null) { + $headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken(); + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $query = \GuzzleHttp\Psr7\build_query($queryParams); + return new Request( + 'PUT', + $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Create http client option + * + * @throws \RuntimeException on file opening failure + * @return array of http client options + */ + protected function createHttpClientOption() + { + $options = []; + if ($this->config->getDebug()) { + $options[RequestOptions::DEBUG] = fopen($this->config->getDebugFile(), 'a'); + if (!$options[RequestOptions::DEBUG]) { + throw new \RuntimeException('Failed to open the debug file: ' . $this->config->getDebugFile()); + } + } + + return $options; + } +} diff --git a/lib/Api/ChannelsApi.php b/lib/Api/ChannelsApi.php new file mode 100644 index 0000000..873abe2 --- /dev/null +++ b/lib/Api/ChannelsApi.php @@ -0,0 +1,2058 @@ +client = $client ?: new Client(); + $this->config = $config ?: new Configuration(); + $this->headerSelector = $selector ?: new HeaderSelector(); + } + + /** + * @return Configuration + */ + public function getConfig() + { + return $this->config; + } + + /** + * Operation executeAction + * + * Execute action on the channel + * + * @param int $id id (required) + * @param \Swagger\Client\Model\ChannelExecuteActionRequest $body Defines an action to execute on channel. The `action` key is always required. The rest of the keys are params depending on the chosen action. Read more on [Github Wiki](https://github.com/SUPLA/supla-cloud/wiki/Channel-Actions). (required) + * + * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return void + */ + public function executeAction($id, $body) + { + $this->executeActionWithHttpInfo($id, $body); + } + + /** + * Operation executeActionWithHttpInfo + * + * Execute action on the channel + * + * @param int $id (required) + * @param \Swagger\Client\Model\ChannelExecuteActionRequest $body Defines an action to execute on channel. The `action` key is always required. The rest of the keys are params depending on the chosen action. Read more on [Github Wiki](https://github.com/SUPLA/supla-cloud/wiki/Channel-Actions). (required) + * + * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of null, HTTP status code, HTTP response headers (array of strings) + */ + public function executeActionWithHttpInfo($id, $body) + { + $returnType = ''; + $request = $this->executeActionRequest($id, $body); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + ); + } + + $statusCode = $response->getStatusCode(); + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $response->getBody() + ); + } + + return [null, $statusCode, $response->getHeaders()]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + case 400: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Swagger\Client\Model\ChannelActionExecutionFailedResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation executeActionAsync + * + * Execute action on the channel + * + * @param int $id (required) + * @param \Swagger\Client\Model\ChannelExecuteActionRequest $body Defines an action to execute on channel. The `action` key is always required. The rest of the keys are params depending on the chosen action. Read more on [Github Wiki](https://github.com/SUPLA/supla-cloud/wiki/Channel-Actions). (required) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function executeActionAsync($id, $body) + { + return $this->executeActionAsyncWithHttpInfo($id, $body) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation executeActionAsyncWithHttpInfo + * + * Execute action on the channel + * + * @param int $id (required) + * @param \Swagger\Client\Model\ChannelExecuteActionRequest $body Defines an action to execute on channel. The `action` key is always required. The rest of the keys are params depending on the chosen action. Read more on [Github Wiki](https://github.com/SUPLA/supla-cloud/wiki/Channel-Actions). (required) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function executeActionAsyncWithHttpInfo($id, $body) + { + $returnType = ''; + $request = $this->executeActionRequest($id, $body); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + return [null, $response->getStatusCode(), $response->getHeaders()]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'executeAction' + * + * @param int $id (required) + * @param \Swagger\Client\Model\ChannelExecuteActionRequest $body Defines an action to execute on channel. The `action` key is always required. The rest of the keys are params depending on the chosen action. Read more on [Github Wiki](https://github.com/SUPLA/supla-cloud/wiki/Channel-Actions). (required) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + protected function executeActionRequest($id, $body) + { + // verify the required parameter 'id' is set + if ($id === null || (is_array($id) && count($id) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $id when calling executeAction' + ); + } + // verify the required parameter 'body' is set + if ($body === null || (is_array($body) && count($body) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $body when calling executeAction' + ); + } + + $resourcePath = '/channels/{id}'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + // path params + if ($id !== null) { + $resourcePath = str_replace( + '{' . 'id' . '}', + ObjectSerializer::toPathValue($id), + $resourcePath + ); + } + + // body params + $_tempBody = null; + if (isset($body)) { + $_tempBody = $body; + } + + if ($multipart) { + $headers = $this->headerSelector->selectHeadersForMultipart( + ['application/json'] + ); + } else { + $headers = $this->headerSelector->selectHeaders( + ['application/json'], + ['application/json'] + ); + } + + // for model (json/xml) + if (isset($_tempBody)) { + // $_tempBody is the method argument, if present + $httpBody = $_tempBody; + // \stdClass has no __toString(), so we should encode it manually + if ($httpBody instanceof \stdClass && $headers['Content-Type'] === 'application/json') { + $httpBody = \GuzzleHttp\json_encode($httpBody); + } + } elseif (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValue + ]; + } + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); + + } elseif ($headers['Content-Type'] === 'application/json') { + $httpBody = \GuzzleHttp\json_encode($formParams); + + } else { + // for HTTP post (form) + $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + } + } + + // this endpoint requires OAuth (access token) + if ($this->config->getAccessToken() !== null) { + $headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken(); + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $query = \GuzzleHttp\Psr7\build_query($queryParams); + return new Request( + 'PATCH', + $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation getChannel + * + * Get channel by ID + * + * @param int $id id (required) + * @param string[] $include Specify what extra fields to include in the response. (optional) + * + * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return \Swagger\Client\Model\Channel + */ + public function getChannel($id, $include = null) + { + list($response) = $this->getChannelWithHttpInfo($id, $include); + return $response; + } + + /** + * Operation getChannelWithHttpInfo + * + * Get channel by ID + * + * @param int $id (required) + * @param string[] $include Specify what extra fields to include in the response. (optional) + * + * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of \Swagger\Client\Model\Channel, HTTP status code, HTTP response headers (array of strings) + */ + public function getChannelWithHttpInfo($id, $include = null) + { + $returnType = '\Swagger\Client\Model\Channel'; + $request = $this->getChannelRequest($id, $include); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + ); + } + + $statusCode = $response->getStatusCode(); + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $response->getBody() + ); + } + + $responseBody = $response->getBody(); + if ($returnType === '\SplFileObject') { + $content = $responseBody; //stream goes to serializer + } else { + $content = $responseBody->getContents(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Swagger\Client\Model\Channel', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation getChannelAsync + * + * Get channel by ID + * + * @param int $id (required) + * @param string[] $include Specify what extra fields to include in the response. (optional) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function getChannelAsync($id, $include = null) + { + return $this->getChannelAsyncWithHttpInfo($id, $include) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation getChannelAsyncWithHttpInfo + * + * Get channel by ID + * + * @param int $id (required) + * @param string[] $include Specify what extra fields to include in the response. (optional) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function getChannelAsyncWithHttpInfo($id, $include = null) + { + $returnType = '\Swagger\Client\Model\Channel'; + $request = $this->getChannelRequest($id, $include); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + $responseBody = $response->getBody(); + if ($returnType === '\SplFileObject') { + $content = $responseBody; //stream goes to serializer + } else { + $content = $responseBody->getContents(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'getChannel' + * + * @param int $id (required) + * @param string[] $include Specify what extra fields to include in the response. (optional) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + protected function getChannelRequest($id, $include = null) + { + // verify the required parameter 'id' is set + if ($id === null || (is_array($id) && count($id) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $id when calling getChannel' + ); + } + + $resourcePath = '/channels/{id}'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + // query params + if (is_array($include)) { + $include = ObjectSerializer::serializeCollection($include, 'csv', true); + } + if ($include !== null) { + $queryParams['include'] = ObjectSerializer::toQueryValue($include); + } + + // path params + if ($id !== null) { + $resourcePath = str_replace( + '{' . 'id' . '}', + ObjectSerializer::toPathValue($id), + $resourcePath + ); + } + + // body params + $_tempBody = null; + + if ($multipart) { + $headers = $this->headerSelector->selectHeadersForMultipart( + ['application/json'] + ); + } else { + $headers = $this->headerSelector->selectHeaders( + ['application/json'], + ['application/json'] + ); + } + + // for model (json/xml) + if (isset($_tempBody)) { + // $_tempBody is the method argument, if present + $httpBody = $_tempBody; + // \stdClass has no __toString(), so we should encode it manually + if ($httpBody instanceof \stdClass && $headers['Content-Type'] === 'application/json') { + $httpBody = \GuzzleHttp\json_encode($httpBody); + } + } elseif (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValue + ]; + } + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); + + } elseif ($headers['Content-Type'] === 'application/json') { + $httpBody = \GuzzleHttp\json_encode($formParams); + + } else { + // for HTTP post (form) + $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + } + } + + // this endpoint requires OAuth (access token) + if ($this->config->getAccessToken() !== null) { + $headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken(); + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $query = \GuzzleHttp\Psr7\build_query($queryParams); + return new Request( + 'GET', + $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation getChannelMeasurementLogs + * + * Get measurement logs. + * + * @param int $id id (required) + * @param int $limit Maximum items count in response, from 1 to 5000 (optional, default to 5000) + * @param int $offset Pagination offset (optional) + * + * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return \Swagger\Client\Model\ChannelMeasurementLog[] + */ + public function getChannelMeasurementLogs($id, $limit = '5000', $offset = null) + { + list($response) = $this->getChannelMeasurementLogsWithHttpInfo($id, $limit, $offset); + return $response; + } + + /** + * Operation getChannelMeasurementLogsWithHttpInfo + * + * Get measurement logs. + * + * @param int $id (required) + * @param int $limit Maximum items count in response, from 1 to 5000 (optional, default to 5000) + * @param int $offset Pagination offset (optional) + * + * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of \Swagger\Client\Model\ChannelMeasurementLog[], HTTP status code, HTTP response headers (array of strings) + */ + public function getChannelMeasurementLogsWithHttpInfo($id, $limit = '5000', $offset = null) + { + $returnType = '\Swagger\Client\Model\ChannelMeasurementLog[]'; + $request = $this->getChannelMeasurementLogsRequest($id, $limit, $offset); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + ); + } + + $statusCode = $response->getStatusCode(); + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $response->getBody() + ); + } + + $responseBody = $response->getBody(); + if ($returnType === '\SplFileObject') { + $content = $responseBody; //stream goes to serializer + } else { + $content = $responseBody->getContents(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Swagger\Client\Model\ChannelMeasurementLog[]', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 400: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Swagger\Client\Model\ChannelUnsupportedFunctionResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation getChannelMeasurementLogsAsync + * + * Get measurement logs. + * + * @param int $id (required) + * @param int $limit Maximum items count in response, from 1 to 5000 (optional, default to 5000) + * @param int $offset Pagination offset (optional) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function getChannelMeasurementLogsAsync($id, $limit = '5000', $offset = null) + { + return $this->getChannelMeasurementLogsAsyncWithHttpInfo($id, $limit, $offset) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation getChannelMeasurementLogsAsyncWithHttpInfo + * + * Get measurement logs. + * + * @param int $id (required) + * @param int $limit Maximum items count in response, from 1 to 5000 (optional, default to 5000) + * @param int $offset Pagination offset (optional) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function getChannelMeasurementLogsAsyncWithHttpInfo($id, $limit = '5000', $offset = null) + { + $returnType = '\Swagger\Client\Model\ChannelMeasurementLog[]'; + $request = $this->getChannelMeasurementLogsRequest($id, $limit, $offset); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + $responseBody = $response->getBody(); + if ($returnType === '\SplFileObject') { + $content = $responseBody; //stream goes to serializer + } else { + $content = $responseBody->getContents(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'getChannelMeasurementLogs' + * + * @param int $id (required) + * @param int $limit Maximum items count in response, from 1 to 5000 (optional, default to 5000) + * @param int $offset Pagination offset (optional) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + protected function getChannelMeasurementLogsRequest($id, $limit = '5000', $offset = null) + { + // verify the required parameter 'id' is set + if ($id === null || (is_array($id) && count($id) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $id when calling getChannelMeasurementLogs' + ); + } + + $resourcePath = '/channels/{id}/measurement-logs'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + // query params + if ($limit !== null) { + $queryParams['limit'] = ObjectSerializer::toQueryValue($limit); + } + // query params + if ($offset !== null) { + $queryParams['offset'] = ObjectSerializer::toQueryValue($offset); + } + + // path params + if ($id !== null) { + $resourcePath = str_replace( + '{' . 'id' . '}', + ObjectSerializer::toPathValue($id), + $resourcePath + ); + } + + // body params + $_tempBody = null; + + if ($multipart) { + $headers = $this->headerSelector->selectHeadersForMultipart( + ['application/json'] + ); + } else { + $headers = $this->headerSelector->selectHeaders( + ['application/json'], + ['application/json'] + ); + } + + // for model (json/xml) + if (isset($_tempBody)) { + // $_tempBody is the method argument, if present + $httpBody = $_tempBody; + // \stdClass has no __toString(), so we should encode it manually + if ($httpBody instanceof \stdClass && $headers['Content-Type'] === 'application/json') { + $httpBody = \GuzzleHttp\json_encode($httpBody); + } + } elseif (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValue + ]; + } + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); + + } elseif ($headers['Content-Type'] === 'application/json') { + $httpBody = \GuzzleHttp\json_encode($formParams); + + } else { + // for HTTP post (form) + $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + } + } + + // this endpoint requires OAuth (access token) + if ($this->config->getAccessToken() !== null) { + $headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken(); + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $query = \GuzzleHttp\Psr7\build_query($queryParams); + return new Request( + 'GET', + $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation getChannelMeasurementLogsCsvFile + * + * Get measurement logs as zipped CSV file. + * + * @param int $id id (required) + * + * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return \SplFileObject + */ + public function getChannelMeasurementLogsCsvFile($id) + { + list($response) = $this->getChannelMeasurementLogsCsvFileWithHttpInfo($id); + return $response; + } + + /** + * Operation getChannelMeasurementLogsCsvFileWithHttpInfo + * + * Get measurement logs as zipped CSV file. + * + * @param int $id (required) + * + * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of \SplFileObject, HTTP status code, HTTP response headers (array of strings) + */ + public function getChannelMeasurementLogsCsvFileWithHttpInfo($id) + { + $returnType = '\SplFileObject'; + $request = $this->getChannelMeasurementLogsCsvFileRequest($id); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + ); + } + + $statusCode = $response->getStatusCode(); + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $response->getBody() + ); + } + + $responseBody = $response->getBody(); + if ($returnType === '\SplFileObject') { + $content = $responseBody; //stream goes to serializer + } else { + $content = $responseBody->getContents(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\SplFileObject', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 400: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Swagger\Client\Model\ChannelUnsupportedFunctionResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation getChannelMeasurementLogsCsvFileAsync + * + * Get measurement logs as zipped CSV file. + * + * @param int $id (required) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function getChannelMeasurementLogsCsvFileAsync($id) + { + return $this->getChannelMeasurementLogsCsvFileAsyncWithHttpInfo($id) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation getChannelMeasurementLogsCsvFileAsyncWithHttpInfo + * + * Get measurement logs as zipped CSV file. + * + * @param int $id (required) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function getChannelMeasurementLogsCsvFileAsyncWithHttpInfo($id) + { + $returnType = '\SplFileObject'; + $request = $this->getChannelMeasurementLogsCsvFileRequest($id); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + $responseBody = $response->getBody(); + if ($returnType === '\SplFileObject') { + $content = $responseBody; //stream goes to serializer + } else { + $content = $responseBody->getContents(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'getChannelMeasurementLogsCsvFile' + * + * @param int $id (required) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + protected function getChannelMeasurementLogsCsvFileRequest($id) + { + // verify the required parameter 'id' is set + if ($id === null || (is_array($id) && count($id) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $id when calling getChannelMeasurementLogsCsvFile' + ); + } + + $resourcePath = '/channels/{id}/measurement-logs-csv'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + // path params + if ($id !== null) { + $resourcePath = str_replace( + '{' . 'id' . '}', + ObjectSerializer::toPathValue($id), + $resourcePath + ); + } + + // body params + $_tempBody = null; + + if ($multipart) { + $headers = $this->headerSelector->selectHeadersForMultipart( + ['application/zip'] + ); + } else { + $headers = $this->headerSelector->selectHeaders( + ['application/zip'], + ['application/json'] + ); + } + + // for model (json/xml) + if (isset($_tempBody)) { + // $_tempBody is the method argument, if present + $httpBody = $_tempBody; + // \stdClass has no __toString(), so we should encode it manually + if ($httpBody instanceof \stdClass && $headers['Content-Type'] === 'application/json') { + $httpBody = \GuzzleHttp\json_encode($httpBody); + } + } elseif (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValue + ]; + } + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); + + } elseif ($headers['Content-Type'] === 'application/json') { + $httpBody = \GuzzleHttp\json_encode($formParams); + + } else { + // for HTTP post (form) + $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + } + } + + // this endpoint requires OAuth (access token) + if ($this->config->getAccessToken() !== null) { + $headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken(); + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $query = \GuzzleHttp\Psr7\build_query($queryParams); + return new Request( + 'GET', + $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation getChannelSchedules + * + * Get schedules list of the channel + * + * @param int $id id (required) + * @param string[] $include Specify what extra fields to include in the response. (optional) + * + * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return \Swagger\Client\Model\Schedule[] + */ + public function getChannelSchedules($id, $include = null) + { + list($response) = $this->getChannelSchedulesWithHttpInfo($id, $include); + return $response; + } + + /** + * Operation getChannelSchedulesWithHttpInfo + * + * Get schedules list of the channel + * + * @param int $id (required) + * @param string[] $include Specify what extra fields to include in the response. (optional) + * + * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of \Swagger\Client\Model\Schedule[], HTTP status code, HTTP response headers (array of strings) + */ + public function getChannelSchedulesWithHttpInfo($id, $include = null) + { + $returnType = '\Swagger\Client\Model\Schedule[]'; + $request = $this->getChannelSchedulesRequest($id, $include); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + ); + } + + $statusCode = $response->getStatusCode(); + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $response->getBody() + ); + } + + $responseBody = $response->getBody(); + if ($returnType === '\SplFileObject') { + $content = $responseBody; //stream goes to serializer + } else { + $content = $responseBody->getContents(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Swagger\Client\Model\Schedule[]', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation getChannelSchedulesAsync + * + * Get schedules list of the channel + * + * @param int $id (required) + * @param string[] $include Specify what extra fields to include in the response. (optional) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function getChannelSchedulesAsync($id, $include = null) + { + return $this->getChannelSchedulesAsyncWithHttpInfo($id, $include) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation getChannelSchedulesAsyncWithHttpInfo + * + * Get schedules list of the channel + * + * @param int $id (required) + * @param string[] $include Specify what extra fields to include in the response. (optional) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function getChannelSchedulesAsyncWithHttpInfo($id, $include = null) + { + $returnType = '\Swagger\Client\Model\Schedule[]'; + $request = $this->getChannelSchedulesRequest($id, $include); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + $responseBody = $response->getBody(); + if ($returnType === '\SplFileObject') { + $content = $responseBody; //stream goes to serializer + } else { + $content = $responseBody->getContents(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'getChannelSchedules' + * + * @param int $id (required) + * @param string[] $include Specify what extra fields to include in the response. (optional) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + protected function getChannelSchedulesRequest($id, $include = null) + { + // verify the required parameter 'id' is set + if ($id === null || (is_array($id) && count($id) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $id when calling getChannelSchedules' + ); + } + + $resourcePath = '/channels/{id}/schedules'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + // query params + if (is_array($include)) { + $include = ObjectSerializer::serializeCollection($include, 'csv', true); + } + if ($include !== null) { + $queryParams['include'] = ObjectSerializer::toQueryValue($include); + } + + // path params + if ($id !== null) { + $resourcePath = str_replace( + '{' . 'id' . '}', + ObjectSerializer::toPathValue($id), + $resourcePath + ); + } + + // body params + $_tempBody = null; + + if ($multipart) { + $headers = $this->headerSelector->selectHeadersForMultipart( + ['application/json'] + ); + } else { + $headers = $this->headerSelector->selectHeaders( + ['application/json'], + ['application/json'] + ); + } + + // for model (json/xml) + if (isset($_tempBody)) { + // $_tempBody is the method argument, if present + $httpBody = $_tempBody; + // \stdClass has no __toString(), so we should encode it manually + if ($httpBody instanceof \stdClass && $headers['Content-Type'] === 'application/json') { + $httpBody = \GuzzleHttp\json_encode($httpBody); + } + } elseif (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValue + ]; + } + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); + + } elseif ($headers['Content-Type'] === 'application/json') { + $httpBody = \GuzzleHttp\json_encode($formParams); + + } else { + // for HTTP post (form) + $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + } + } + + // this endpoint requires OAuth (access token) + if ($this->config->getAccessToken() !== null) { + $headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken(); + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $query = \GuzzleHttp\Psr7\build_query($queryParams); + return new Request( + 'GET', + $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation getChannels + * + * Get channels list + * + * @param string[] $include Specify what extra fields to include in the response. (optional) + * @param string[] $function function (optional) + * @param string $io Return only `input` or `output` channels. (optional) + * @param bool $hasFunction Return only channels with (`true`) or without (`false`) chosen functions. (optional) + * + * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return \Swagger\Client\Model\Channel[] + */ + public function getChannels($include = null, $function = null, $io = null, $hasFunction = null) + { + list($response) = $this->getChannelsWithHttpInfo($include, $function, $io, $hasFunction); + return $response; + } + + /** + * Operation getChannelsWithHttpInfo + * + * Get channels list + * + * @param string[] $include Specify what extra fields to include in the response. (optional) + * @param string[] $function (optional) + * @param string $io Return only `input` or `output` channels. (optional) + * @param bool $hasFunction Return only channels with (`true`) or without (`false`) chosen functions. (optional) + * + * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of \Swagger\Client\Model\Channel[], HTTP status code, HTTP response headers (array of strings) + */ + public function getChannelsWithHttpInfo($include = null, $function = null, $io = null, $hasFunction = null) + { + $returnType = '\Swagger\Client\Model\Channel[]'; + $request = $this->getChannelsRequest($include, $function, $io, $hasFunction); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + ); + } + + $statusCode = $response->getStatusCode(); + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $response->getBody() + ); + } + + $responseBody = $response->getBody(); + if ($returnType === '\SplFileObject') { + $content = $responseBody; //stream goes to serializer + } else { + $content = $responseBody->getContents(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Swagger\Client\Model\Channel[]', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation getChannelsAsync + * + * Get channels list + * + * @param string[] $include Specify what extra fields to include in the response. (optional) + * @param string[] $function (optional) + * @param string $io Return only `input` or `output` channels. (optional) + * @param bool $hasFunction Return only channels with (`true`) or without (`false`) chosen functions. (optional) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function getChannelsAsync($include = null, $function = null, $io = null, $hasFunction = null) + { + return $this->getChannelsAsyncWithHttpInfo($include, $function, $io, $hasFunction) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation getChannelsAsyncWithHttpInfo + * + * Get channels list + * + * @param string[] $include Specify what extra fields to include in the response. (optional) + * @param string[] $function (optional) + * @param string $io Return only `input` or `output` channels. (optional) + * @param bool $hasFunction Return only channels with (`true`) or without (`false`) chosen functions. (optional) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function getChannelsAsyncWithHttpInfo($include = null, $function = null, $io = null, $hasFunction = null) + { + $returnType = '\Swagger\Client\Model\Channel[]'; + $request = $this->getChannelsRequest($include, $function, $io, $hasFunction); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + $responseBody = $response->getBody(); + if ($returnType === '\SplFileObject') { + $content = $responseBody; //stream goes to serializer + } else { + $content = $responseBody->getContents(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'getChannels' + * + * @param string[] $include Specify what extra fields to include in the response. (optional) + * @param string[] $function (optional) + * @param string $io Return only `input` or `output` channels. (optional) + * @param bool $hasFunction Return only channels with (`true`) or without (`false`) chosen functions. (optional) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + protected function getChannelsRequest($include = null, $function = null, $io = null, $hasFunction = null) + { + + $resourcePath = '/channels'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + // query params + if (is_array($include)) { + $include = ObjectSerializer::serializeCollection($include, 'csv', true); + } + if ($include !== null) { + $queryParams['include'] = ObjectSerializer::toQueryValue($include); + } + // query params + if (is_array($function)) { + $function = ObjectSerializer::serializeCollection($function, 'csv', true); + } + if ($function !== null) { + $queryParams['function'] = ObjectSerializer::toQueryValue($function); + } + // query params + if ($io !== null) { + $queryParams['io'] = ObjectSerializer::toQueryValue($io); + } + // query params + if ($hasFunction !== null) { + $queryParams['hasFunction'] = ObjectSerializer::toQueryValue($hasFunction); + } + + + // body params + $_tempBody = null; + + if ($multipart) { + $headers = $this->headerSelector->selectHeadersForMultipart( + ['application/json'] + ); + } else { + $headers = $this->headerSelector->selectHeaders( + ['application/json'], + ['application/json'] + ); + } + + // for model (json/xml) + if (isset($_tempBody)) { + // $_tempBody is the method argument, if present + $httpBody = $_tempBody; + // \stdClass has no __toString(), so we should encode it manually + if ($httpBody instanceof \stdClass && $headers['Content-Type'] === 'application/json') { + $httpBody = \GuzzleHttp\json_encode($httpBody); + } + } elseif (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValue + ]; + } + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); + + } elseif ($headers['Content-Type'] === 'application/json') { + $httpBody = \GuzzleHttp\json_encode($formParams); + + } else { + // for HTTP post (form) + $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + } + } + + // this endpoint requires OAuth (access token) + if ($this->config->getAccessToken() !== null) { + $headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken(); + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $query = \GuzzleHttp\Psr7\build_query($queryParams); + return new Request( + 'GET', + $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation updateChannel + * + * Update channel + * + * @param int $id id (required) + * @param \Swagger\Client\Model\ChannelUpdateRequest $body body (required) + * + * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return \Swagger\Client\Model\Channel + */ + public function updateChannel($id, $body) + { + list($response) = $this->updateChannelWithHttpInfo($id, $body); + return $response; + } + + /** + * Operation updateChannelWithHttpInfo + * + * Update channel + * + * @param int $id (required) + * @param \Swagger\Client\Model\ChannelUpdateRequest $body (required) + * + * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of \Swagger\Client\Model\Channel, HTTP status code, HTTP response headers (array of strings) + */ + public function updateChannelWithHttpInfo($id, $body) + { + $returnType = '\Swagger\Client\Model\Channel'; + $request = $this->updateChannelRequest($id, $body); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + ); + } + + $statusCode = $response->getStatusCode(); + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $response->getBody() + ); + } + + $responseBody = $response->getBody(); + if ($returnType === '\SplFileObject') { + $content = $responseBody; //stream goes to serializer + } else { + $content = $responseBody->getContents(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Swagger\Client\Model\Channel', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 409: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Swagger\Client\Model\ChannelUpdateConfirmationResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation updateChannelAsync + * + * Update channel + * + * @param int $id (required) + * @param \Swagger\Client\Model\ChannelUpdateRequest $body (required) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function updateChannelAsync($id, $body) + { + return $this->updateChannelAsyncWithHttpInfo($id, $body) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation updateChannelAsyncWithHttpInfo + * + * Update channel + * + * @param int $id (required) + * @param \Swagger\Client\Model\ChannelUpdateRequest $body (required) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function updateChannelAsyncWithHttpInfo($id, $body) + { + $returnType = '\Swagger\Client\Model\Channel'; + $request = $this->updateChannelRequest($id, $body); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + $responseBody = $response->getBody(); + if ($returnType === '\SplFileObject') { + $content = $responseBody; //stream goes to serializer + } else { + $content = $responseBody->getContents(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'updateChannel' + * + * @param int $id (required) + * @param \Swagger\Client\Model\ChannelUpdateRequest $body (required) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + protected function updateChannelRequest($id, $body) + { + // verify the required parameter 'id' is set + if ($id === null || (is_array($id) && count($id) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $id when calling updateChannel' + ); + } + // verify the required parameter 'body' is set + if ($body === null || (is_array($body) && count($body) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $body when calling updateChannel' + ); + } + + $resourcePath = '/channels/{id}'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + // path params + if ($id !== null) { + $resourcePath = str_replace( + '{' . 'id' . '}', + ObjectSerializer::toPathValue($id), + $resourcePath + ); + } + + // body params + $_tempBody = null; + if (isset($body)) { + $_tempBody = $body; + } + + if ($multipart) { + $headers = $this->headerSelector->selectHeadersForMultipart( + ['application/json'] + ); + } else { + $headers = $this->headerSelector->selectHeaders( + ['application/json'], + ['application/json'] + ); + } + + // for model (json/xml) + if (isset($_tempBody)) { + // $_tempBody is the method argument, if present + $httpBody = $_tempBody; + // \stdClass has no __toString(), so we should encode it manually + if ($httpBody instanceof \stdClass && $headers['Content-Type'] === 'application/json') { + $httpBody = \GuzzleHttp\json_encode($httpBody); + } + } elseif (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValue + ]; + } + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); + + } elseif ($headers['Content-Type'] === 'application/json') { + $httpBody = \GuzzleHttp\json_encode($formParams); + + } else { + // for HTTP post (form) + $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + } + } + + // this endpoint requires OAuth (access token) + if ($this->config->getAccessToken() !== null) { + $headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken(); + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $query = \GuzzleHttp\Psr7\build_query($queryParams); + return new Request( + 'PUT', + $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Create http client option + * + * @throws \RuntimeException on file opening failure + * @return array of http client options + */ + protected function createHttpClientOption() + { + $options = []; + if ($this->config->getDebug()) { + $options[RequestOptions::DEBUG] = fopen($this->config->getDebugFile(), 'a'); + if (!$options[RequestOptions::DEBUG]) { + throw new \RuntimeException('Failed to open the debug file: ' . $this->config->getDebugFile()); + } + } + + return $options; + } +} diff --git a/lib/Api/ClientAppsApi.php b/lib/Api/ClientAppsApi.php new file mode 100644 index 0000000..cbbf1b1 --- /dev/null +++ b/lib/Api/ClientAppsApi.php @@ -0,0 +1,876 @@ +client = $client ?: new Client(); + $this->config = $config ?: new Configuration(); + $this->headerSelector = $selector ?: new HeaderSelector(); + } + + /** + * @return Configuration + */ + public function getConfig() + { + return $this->config; + } + + /** + * Operation deleteClientApp + * + * Delete Client App + * + * @param int $id id (required) + * + * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return void + */ + public function deleteClientApp($id) + { + $this->deleteClientAppWithHttpInfo($id); + } + + /** + * Operation deleteClientAppWithHttpInfo + * + * Delete Client App + * + * @param int $id (required) + * + * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of null, HTTP status code, HTTP response headers (array of strings) + */ + public function deleteClientAppWithHttpInfo($id) + { + $returnType = ''; + $request = $this->deleteClientAppRequest($id); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + ); + } + + $statusCode = $response->getStatusCode(); + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $response->getBody() + ); + } + + return [null, $statusCode, $response->getHeaders()]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + } + throw $e; + } + } + + /** + * Operation deleteClientAppAsync + * + * Delete Client App + * + * @param int $id (required) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function deleteClientAppAsync($id) + { + return $this->deleteClientAppAsyncWithHttpInfo($id) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation deleteClientAppAsyncWithHttpInfo + * + * Delete Client App + * + * @param int $id (required) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function deleteClientAppAsyncWithHttpInfo($id) + { + $returnType = ''; + $request = $this->deleteClientAppRequest($id); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + return [null, $response->getStatusCode(), $response->getHeaders()]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'deleteClientApp' + * + * @param int $id (required) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + protected function deleteClientAppRequest($id) + { + // verify the required parameter 'id' is set + if ($id === null || (is_array($id) && count($id) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $id when calling deleteClientApp' + ); + } + + $resourcePath = '/client-apps/{id}'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + // path params + if ($id !== null) { + $resourcePath = str_replace( + '{' . 'id' . '}', + ObjectSerializer::toPathValue($id), + $resourcePath + ); + } + + // body params + $_tempBody = null; + + if ($multipart) { + $headers = $this->headerSelector->selectHeadersForMultipart( + ['application/json'] + ); + } else { + $headers = $this->headerSelector->selectHeaders( + ['application/json'], + ['application/json'] + ); + } + + // for model (json/xml) + if (isset($_tempBody)) { + // $_tempBody is the method argument, if present + $httpBody = $_tempBody; + // \stdClass has no __toString(), so we should encode it manually + if ($httpBody instanceof \stdClass && $headers['Content-Type'] === 'application/json') { + $httpBody = \GuzzleHttp\json_encode($httpBody); + } + } elseif (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValue + ]; + } + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); + + } elseif ($headers['Content-Type'] === 'application/json') { + $httpBody = \GuzzleHttp\json_encode($formParams); + + } else { + // for HTTP post (form) + $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + } + } + + // this endpoint requires OAuth (access token) + if ($this->config->getAccessToken() !== null) { + $headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken(); + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $query = \GuzzleHttp\Psr7\build_query($queryParams); + return new Request( + 'DELETE', + $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation getClientApps + * + * Get client apps + * + * @param string[] $include Specify what extra fields to include in the response. (optional) + * + * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return \Swagger\Client\Model\ClientApp[] + */ + public function getClientApps($include = null) + { + list($response) = $this->getClientAppsWithHttpInfo($include); + return $response; + } + + /** + * Operation getClientAppsWithHttpInfo + * + * Get client apps + * + * @param string[] $include Specify what extra fields to include in the response. (optional) + * + * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of \Swagger\Client\Model\ClientApp[], HTTP status code, HTTP response headers (array of strings) + */ + public function getClientAppsWithHttpInfo($include = null) + { + $returnType = '\Swagger\Client\Model\ClientApp[]'; + $request = $this->getClientAppsRequest($include); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + ); + } + + $statusCode = $response->getStatusCode(); + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $response->getBody() + ); + } + + $responseBody = $response->getBody(); + if ($returnType === '\SplFileObject') { + $content = $responseBody; //stream goes to serializer + } else { + $content = $responseBody->getContents(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Swagger\Client\Model\ClientApp[]', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation getClientAppsAsync + * + * Get client apps + * + * @param string[] $include Specify what extra fields to include in the response. (optional) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function getClientAppsAsync($include = null) + { + return $this->getClientAppsAsyncWithHttpInfo($include) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation getClientAppsAsyncWithHttpInfo + * + * Get client apps + * + * @param string[] $include Specify what extra fields to include in the response. (optional) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function getClientAppsAsyncWithHttpInfo($include = null) + { + $returnType = '\Swagger\Client\Model\ClientApp[]'; + $request = $this->getClientAppsRequest($include); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + $responseBody = $response->getBody(); + if ($returnType === '\SplFileObject') { + $content = $responseBody; //stream goes to serializer + } else { + $content = $responseBody->getContents(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'getClientApps' + * + * @param string[] $include Specify what extra fields to include in the response. (optional) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + protected function getClientAppsRequest($include = null) + { + + $resourcePath = '/client-apps'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + // query params + if (is_array($include)) { + $include = ObjectSerializer::serializeCollection($include, 'csv', true); + } + if ($include !== null) { + $queryParams['include'] = ObjectSerializer::toQueryValue($include); + } + + + // body params + $_tempBody = null; + + if ($multipart) { + $headers = $this->headerSelector->selectHeadersForMultipart( + ['application/json'] + ); + } else { + $headers = $this->headerSelector->selectHeaders( + ['application/json'], + ['application/json'] + ); + } + + // for model (json/xml) + if (isset($_tempBody)) { + // $_tempBody is the method argument, if present + $httpBody = $_tempBody; + // \stdClass has no __toString(), so we should encode it manually + if ($httpBody instanceof \stdClass && $headers['Content-Type'] === 'application/json') { + $httpBody = \GuzzleHttp\json_encode($httpBody); + } + } elseif (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValue + ]; + } + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); + + } elseif ($headers['Content-Type'] === 'application/json') { + $httpBody = \GuzzleHttp\json_encode($formParams); + + } else { + // for HTTP post (form) + $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + } + } + + // this endpoint requires OAuth (access token) + if ($this->config->getAccessToken() !== null) { + $headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken(); + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $query = \GuzzleHttp\Psr7\build_query($queryParams); + return new Request( + 'GET', + $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation updateClientApp + * + * Update client app + * + * @param int $id id (required) + * @param \Swagger\Client\Model\ClientAppUpdateRequest $body body (required) + * + * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return \Swagger\Client\Model\ClientApp + */ + public function updateClientApp($id, $body) + { + list($response) = $this->updateClientAppWithHttpInfo($id, $body); + return $response; + } + + /** + * Operation updateClientAppWithHttpInfo + * + * Update client app + * + * @param int $id (required) + * @param \Swagger\Client\Model\ClientAppUpdateRequest $body (required) + * + * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of \Swagger\Client\Model\ClientApp, HTTP status code, HTTP response headers (array of strings) + */ + public function updateClientAppWithHttpInfo($id, $body) + { + $returnType = '\Swagger\Client\Model\ClientApp'; + $request = $this->updateClientAppRequest($id, $body); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + ); + } + + $statusCode = $response->getStatusCode(); + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $response->getBody() + ); + } + + $responseBody = $response->getBody(); + if ($returnType === '\SplFileObject') { + $content = $responseBody; //stream goes to serializer + } else { + $content = $responseBody->getContents(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Swagger\Client\Model\ClientApp', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation updateClientAppAsync + * + * Update client app + * + * @param int $id (required) + * @param \Swagger\Client\Model\ClientAppUpdateRequest $body (required) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function updateClientAppAsync($id, $body) + { + return $this->updateClientAppAsyncWithHttpInfo($id, $body) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation updateClientAppAsyncWithHttpInfo + * + * Update client app + * + * @param int $id (required) + * @param \Swagger\Client\Model\ClientAppUpdateRequest $body (required) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function updateClientAppAsyncWithHttpInfo($id, $body) + { + $returnType = '\Swagger\Client\Model\ClientApp'; + $request = $this->updateClientAppRequest($id, $body); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + $responseBody = $response->getBody(); + if ($returnType === '\SplFileObject') { + $content = $responseBody; //stream goes to serializer + } else { + $content = $responseBody->getContents(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'updateClientApp' + * + * @param int $id (required) + * @param \Swagger\Client\Model\ClientAppUpdateRequest $body (required) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + protected function updateClientAppRequest($id, $body) + { + // verify the required parameter 'id' is set + if ($id === null || (is_array($id) && count($id) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $id when calling updateClientApp' + ); + } + // verify the required parameter 'body' is set + if ($body === null || (is_array($body) && count($body) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $body when calling updateClientApp' + ); + } + + $resourcePath = '/client-apps/{id}'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + // path params + if ($id !== null) { + $resourcePath = str_replace( + '{' . 'id' . '}', + ObjectSerializer::toPathValue($id), + $resourcePath + ); + } + + // body params + $_tempBody = null; + if (isset($body)) { + $_tempBody = $body; + } + + if ($multipart) { + $headers = $this->headerSelector->selectHeadersForMultipart( + ['application/json'] + ); + } else { + $headers = $this->headerSelector->selectHeaders( + ['application/json'], + ['application/json'] + ); + } + + // for model (json/xml) + if (isset($_tempBody)) { + // $_tempBody is the method argument, if present + $httpBody = $_tempBody; + // \stdClass has no __toString(), so we should encode it manually + if ($httpBody instanceof \stdClass && $headers['Content-Type'] === 'application/json') { + $httpBody = \GuzzleHttp\json_encode($httpBody); + } + } elseif (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValue + ]; + } + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); + + } elseif ($headers['Content-Type'] === 'application/json') { + $httpBody = \GuzzleHttp\json_encode($formParams); + + } else { + // for HTTP post (form) + $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + } + } + + // this endpoint requires OAuth (access token) + if ($this->config->getAccessToken() !== null) { + $headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken(); + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $query = \GuzzleHttp\Psr7\build_query($queryParams); + return new Request( + 'PUT', + $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Create http client option + * + * @throws \RuntimeException on file opening failure + * @return array of http client options + */ + protected function createHttpClientOption() + { + $options = []; + if ($this->config->getDebug()) { + $options[RequestOptions::DEBUG] = fopen($this->config->getDebugFile(), 'a'); + if (!$options[RequestOptions::DEBUG]) { + throw new \RuntimeException('Failed to open the debug file: ' . $this->config->getDebugFile()); + } + } + + return $options; + } +} diff --git a/lib/Api/IODevicesApi.php b/lib/Api/IODevicesApi.php new file mode 100644 index 0000000..5ba2d90 --- /dev/null +++ b/lib/Api/IODevicesApi.php @@ -0,0 +1,1432 @@ +client = $client ?: new Client(); + $this->config = $config ?: new Configuration(); + $this->headerSelector = $selector ?: new HeaderSelector(); + } + + /** + * @return Configuration + */ + public function getConfig() + { + return $this->config; + } + + /** + * Operation deleteIoDevice + * + * Delete IO Device + * + * @param int $id id (required) + * + * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return void + */ + public function deleteIoDevice($id) + { + $this->deleteIoDeviceWithHttpInfo($id); + } + + /** + * Operation deleteIoDeviceWithHttpInfo + * + * Delete IO Device + * + * @param int $id (required) + * + * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of null, HTTP status code, HTTP response headers (array of strings) + */ + public function deleteIoDeviceWithHttpInfo($id) + { + $returnType = ''; + $request = $this->deleteIoDeviceRequest($id); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + ); + } + + $statusCode = $response->getStatusCode(); + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $response->getBody() + ); + } + + return [null, $statusCode, $response->getHeaders()]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + } + throw $e; + } + } + + /** + * Operation deleteIoDeviceAsync + * + * Delete IO Device + * + * @param int $id (required) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function deleteIoDeviceAsync($id) + { + return $this->deleteIoDeviceAsyncWithHttpInfo($id) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation deleteIoDeviceAsyncWithHttpInfo + * + * Delete IO Device + * + * @param int $id (required) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function deleteIoDeviceAsyncWithHttpInfo($id) + { + $returnType = ''; + $request = $this->deleteIoDeviceRequest($id); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + return [null, $response->getStatusCode(), $response->getHeaders()]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'deleteIoDevice' + * + * @param int $id (required) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + protected function deleteIoDeviceRequest($id) + { + // verify the required parameter 'id' is set + if ($id === null || (is_array($id) && count($id) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $id when calling deleteIoDevice' + ); + } + + $resourcePath = '/iodevices/{id}'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + // path params + if ($id !== null) { + $resourcePath = str_replace( + '{' . 'id' . '}', + ObjectSerializer::toPathValue($id), + $resourcePath + ); + } + + // body params + $_tempBody = null; + + if ($multipart) { + $headers = $this->headerSelector->selectHeadersForMultipart( + ['application/json'] + ); + } else { + $headers = $this->headerSelector->selectHeaders( + ['application/json'], + ['application/json'] + ); + } + + // for model (json/xml) + if (isset($_tempBody)) { + // $_tempBody is the method argument, if present + $httpBody = $_tempBody; + // \stdClass has no __toString(), so we should encode it manually + if ($httpBody instanceof \stdClass && $headers['Content-Type'] === 'application/json') { + $httpBody = \GuzzleHttp\json_encode($httpBody); + } + } elseif (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValue + ]; + } + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); + + } elseif ($headers['Content-Type'] === 'application/json') { + $httpBody = \GuzzleHttp\json_encode($formParams); + + } else { + // for HTTP post (form) + $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + } + } + + // this endpoint requires OAuth (access token) + if ($this->config->getAccessToken() !== null) { + $headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken(); + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $query = \GuzzleHttp\Psr7\build_query($queryParams); + return new Request( + 'DELETE', + $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation getIoDevice + * + * Get IO Device + * + * @param int $id id (required) + * @param string[] $include Specify what extra fields to include in the response. (optional) + * + * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return \Swagger\Client\Model\Device + */ + public function getIoDevice($id, $include = null) + { + list($response) = $this->getIoDeviceWithHttpInfo($id, $include); + return $response; + } + + /** + * Operation getIoDeviceWithHttpInfo + * + * Get IO Device + * + * @param int $id (required) + * @param string[] $include Specify what extra fields to include in the response. (optional) + * + * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of \Swagger\Client\Model\Device, HTTP status code, HTTP response headers (array of strings) + */ + public function getIoDeviceWithHttpInfo($id, $include = null) + { + $returnType = '\Swagger\Client\Model\Device'; + $request = $this->getIoDeviceRequest($id, $include); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + ); + } + + $statusCode = $response->getStatusCode(); + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $response->getBody() + ); + } + + $responseBody = $response->getBody(); + if ($returnType === '\SplFileObject') { + $content = $responseBody; //stream goes to serializer + } else { + $content = $responseBody->getContents(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Swagger\Client\Model\Device', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation getIoDeviceAsync + * + * Get IO Device + * + * @param int $id (required) + * @param string[] $include Specify what extra fields to include in the response. (optional) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function getIoDeviceAsync($id, $include = null) + { + return $this->getIoDeviceAsyncWithHttpInfo($id, $include) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation getIoDeviceAsyncWithHttpInfo + * + * Get IO Device + * + * @param int $id (required) + * @param string[] $include Specify what extra fields to include in the response. (optional) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function getIoDeviceAsyncWithHttpInfo($id, $include = null) + { + $returnType = '\Swagger\Client\Model\Device'; + $request = $this->getIoDeviceRequest($id, $include); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + $responseBody = $response->getBody(); + if ($returnType === '\SplFileObject') { + $content = $responseBody; //stream goes to serializer + } else { + $content = $responseBody->getContents(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'getIoDevice' + * + * @param int $id (required) + * @param string[] $include Specify what extra fields to include in the response. (optional) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + protected function getIoDeviceRequest($id, $include = null) + { + // verify the required parameter 'id' is set + if ($id === null || (is_array($id) && count($id) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $id when calling getIoDevice' + ); + } + + $resourcePath = '/iodevices/{id}'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + // query params + if (is_array($include)) { + $include = ObjectSerializer::serializeCollection($include, 'csv', true); + } + if ($include !== null) { + $queryParams['include'] = ObjectSerializer::toQueryValue($include); + } + + // path params + if ($id !== null) { + $resourcePath = str_replace( + '{' . 'id' . '}', + ObjectSerializer::toPathValue($id), + $resourcePath + ); + } + + // body params + $_tempBody = null; + + if ($multipart) { + $headers = $this->headerSelector->selectHeadersForMultipart( + ['application/json'] + ); + } else { + $headers = $this->headerSelector->selectHeaders( + ['application/json'], + ['application/json'] + ); + } + + // for model (json/xml) + if (isset($_tempBody)) { + // $_tempBody is the method argument, if present + $httpBody = $_tempBody; + // \stdClass has no __toString(), so we should encode it manually + if ($httpBody instanceof \stdClass && $headers['Content-Type'] === 'application/json') { + $httpBody = \GuzzleHttp\json_encode($httpBody); + } + } elseif (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValue + ]; + } + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); + + } elseif ($headers['Content-Type'] === 'application/json') { + $httpBody = \GuzzleHttp\json_encode($formParams); + + } else { + // for HTTP post (form) + $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + } + } + + // this endpoint requires OAuth (access token) + if ($this->config->getAccessToken() !== null) { + $headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken(); + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $query = \GuzzleHttp\Psr7\build_query($queryParams); + return new Request( + 'GET', + $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation getIoDeviceChannels + * + * Get Channels that belong to IO Deice + * + * @param int $id id (required) + * @param string[] $include Specify what extra fields to include in the response. (optional) + * + * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return \Swagger\Client\Model\Channel + */ + public function getIoDeviceChannels($id, $include = null) + { + list($response) = $this->getIoDeviceChannelsWithHttpInfo($id, $include); + return $response; + } + + /** + * Operation getIoDeviceChannelsWithHttpInfo + * + * Get Channels that belong to IO Deice + * + * @param int $id (required) + * @param string[] $include Specify what extra fields to include in the response. (optional) + * + * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of \Swagger\Client\Model\Channel, HTTP status code, HTTP response headers (array of strings) + */ + public function getIoDeviceChannelsWithHttpInfo($id, $include = null) + { + $returnType = '\Swagger\Client\Model\Channel'; + $request = $this->getIoDeviceChannelsRequest($id, $include); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + ); + } + + $statusCode = $response->getStatusCode(); + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $response->getBody() + ); + } + + $responseBody = $response->getBody(); + if ($returnType === '\SplFileObject') { + $content = $responseBody; //stream goes to serializer + } else { + $content = $responseBody->getContents(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Swagger\Client\Model\Channel', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation getIoDeviceChannelsAsync + * + * Get Channels that belong to IO Deice + * + * @param int $id (required) + * @param string[] $include Specify what extra fields to include in the response. (optional) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function getIoDeviceChannelsAsync($id, $include = null) + { + return $this->getIoDeviceChannelsAsyncWithHttpInfo($id, $include) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation getIoDeviceChannelsAsyncWithHttpInfo + * + * Get Channels that belong to IO Deice + * + * @param int $id (required) + * @param string[] $include Specify what extra fields to include in the response. (optional) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function getIoDeviceChannelsAsyncWithHttpInfo($id, $include = null) + { + $returnType = '\Swagger\Client\Model\Channel'; + $request = $this->getIoDeviceChannelsRequest($id, $include); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + $responseBody = $response->getBody(); + if ($returnType === '\SplFileObject') { + $content = $responseBody; //stream goes to serializer + } else { + $content = $responseBody->getContents(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'getIoDeviceChannels' + * + * @param int $id (required) + * @param string[] $include Specify what extra fields to include in the response. (optional) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + protected function getIoDeviceChannelsRequest($id, $include = null) + { + // verify the required parameter 'id' is set + if ($id === null || (is_array($id) && count($id) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $id when calling getIoDeviceChannels' + ); + } + + $resourcePath = '/iodevices/{id}/channels'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + // query params + if (is_array($include)) { + $include = ObjectSerializer::serializeCollection($include, 'csv', true); + } + if ($include !== null) { + $queryParams['include'] = ObjectSerializer::toQueryValue($include); + } + + // path params + if ($id !== null) { + $resourcePath = str_replace( + '{' . 'id' . '}', + ObjectSerializer::toPathValue($id), + $resourcePath + ); + } + + // body params + $_tempBody = null; + + if ($multipart) { + $headers = $this->headerSelector->selectHeadersForMultipart( + ['application/json'] + ); + } else { + $headers = $this->headerSelector->selectHeaders( + ['application/json'], + ['application/json'] + ); + } + + // for model (json/xml) + if (isset($_tempBody)) { + // $_tempBody is the method argument, if present + $httpBody = $_tempBody; + // \stdClass has no __toString(), so we should encode it manually + if ($httpBody instanceof \stdClass && $headers['Content-Type'] === 'application/json') { + $httpBody = \GuzzleHttp\json_encode($httpBody); + } + } elseif (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValue + ]; + } + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); + + } elseif ($headers['Content-Type'] === 'application/json') { + $httpBody = \GuzzleHttp\json_encode($formParams); + + } else { + // for HTTP post (form) + $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + } + } + + // this endpoint requires OAuth (access token) + if ($this->config->getAccessToken() !== null) { + $headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken(); + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $query = \GuzzleHttp\Psr7\build_query($queryParams); + return new Request( + 'GET', + $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation getIoDevices + * + * Get IO Devices + * + * @param string[] $include Specify what extra fields to include in the response. (optional) + * + * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return \Swagger\Client\Model\Device[] + */ + public function getIoDevices($include = null) + { + list($response) = $this->getIoDevicesWithHttpInfo($include); + return $response; + } + + /** + * Operation getIoDevicesWithHttpInfo + * + * Get IO Devices + * + * @param string[] $include Specify what extra fields to include in the response. (optional) + * + * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of \Swagger\Client\Model\Device[], HTTP status code, HTTP response headers (array of strings) + */ + public function getIoDevicesWithHttpInfo($include = null) + { + $returnType = '\Swagger\Client\Model\Device[]'; + $request = $this->getIoDevicesRequest($include); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + ); + } + + $statusCode = $response->getStatusCode(); + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $response->getBody() + ); + } + + $responseBody = $response->getBody(); + if ($returnType === '\SplFileObject') { + $content = $responseBody; //stream goes to serializer + } else { + $content = $responseBody->getContents(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Swagger\Client\Model\Device[]', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation getIoDevicesAsync + * + * Get IO Devices + * + * @param string[] $include Specify what extra fields to include in the response. (optional) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function getIoDevicesAsync($include = null) + { + return $this->getIoDevicesAsyncWithHttpInfo($include) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation getIoDevicesAsyncWithHttpInfo + * + * Get IO Devices + * + * @param string[] $include Specify what extra fields to include in the response. (optional) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function getIoDevicesAsyncWithHttpInfo($include = null) + { + $returnType = '\Swagger\Client\Model\Device[]'; + $request = $this->getIoDevicesRequest($include); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + $responseBody = $response->getBody(); + if ($returnType === '\SplFileObject') { + $content = $responseBody; //stream goes to serializer + } else { + $content = $responseBody->getContents(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'getIoDevices' + * + * @param string[] $include Specify what extra fields to include in the response. (optional) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + protected function getIoDevicesRequest($include = null) + { + + $resourcePath = '/iodevices'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + // query params + if (is_array($include)) { + $include = ObjectSerializer::serializeCollection($include, 'csv', true); + } + if ($include !== null) { + $queryParams['include'] = ObjectSerializer::toQueryValue($include); + } + + + // body params + $_tempBody = null; + + if ($multipart) { + $headers = $this->headerSelector->selectHeadersForMultipart( + ['application/json'] + ); + } else { + $headers = $this->headerSelector->selectHeaders( + ['application/json'], + ['application/json'] + ); + } + + // for model (json/xml) + if (isset($_tempBody)) { + // $_tempBody is the method argument, if present + $httpBody = $_tempBody; + // \stdClass has no __toString(), so we should encode it manually + if ($httpBody instanceof \stdClass && $headers['Content-Type'] === 'application/json') { + $httpBody = \GuzzleHttp\json_encode($httpBody); + } + } elseif (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValue + ]; + } + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); + + } elseif ($headers['Content-Type'] === 'application/json') { + $httpBody = \GuzzleHttp\json_encode($formParams); + + } else { + // for HTTP post (form) + $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + } + } + + // this endpoint requires OAuth (access token) + if ($this->config->getAccessToken() !== null) { + $headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken(); + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $query = \GuzzleHttp\Psr7\build_query($queryParams); + return new Request( + 'GET', + $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation updateIoDevice + * + * Update IO Device + * + * @param int $id id (required) + * @param \Swagger\Client\Model\IODeviceUpdateRequest $body body (required) + * + * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return \Swagger\Client\Model\Device + */ + public function updateIoDevice($id, $body) + { + list($response) = $this->updateIoDeviceWithHttpInfo($id, $body); + return $response; + } + + /** + * Operation updateIoDeviceWithHttpInfo + * + * Update IO Device + * + * @param int $id (required) + * @param \Swagger\Client\Model\IODeviceUpdateRequest $body (required) + * + * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of \Swagger\Client\Model\Device, HTTP status code, HTTP response headers (array of strings) + */ + public function updateIoDeviceWithHttpInfo($id, $body) + { + $returnType = '\Swagger\Client\Model\Device'; + $request = $this->updateIoDeviceRequest($id, $body); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + ); + } + + $statusCode = $response->getStatusCode(); + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $response->getBody() + ); + } + + $responseBody = $response->getBody(); + if ($returnType === '\SplFileObject') { + $content = $responseBody; //stream goes to serializer + } else { + $content = $responseBody->getContents(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Swagger\Client\Model\Device', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation updateIoDeviceAsync + * + * Update IO Device + * + * @param int $id (required) + * @param \Swagger\Client\Model\IODeviceUpdateRequest $body (required) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function updateIoDeviceAsync($id, $body) + { + return $this->updateIoDeviceAsyncWithHttpInfo($id, $body) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation updateIoDeviceAsyncWithHttpInfo + * + * Update IO Device + * + * @param int $id (required) + * @param \Swagger\Client\Model\IODeviceUpdateRequest $body (required) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function updateIoDeviceAsyncWithHttpInfo($id, $body) + { + $returnType = '\Swagger\Client\Model\Device'; + $request = $this->updateIoDeviceRequest($id, $body); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + $responseBody = $response->getBody(); + if ($returnType === '\SplFileObject') { + $content = $responseBody; //stream goes to serializer + } else { + $content = $responseBody->getContents(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'updateIoDevice' + * + * @param int $id (required) + * @param \Swagger\Client\Model\IODeviceUpdateRequest $body (required) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + protected function updateIoDeviceRequest($id, $body) + { + // verify the required parameter 'id' is set + if ($id === null || (is_array($id) && count($id) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $id when calling updateIoDevice' + ); + } + // verify the required parameter 'body' is set + if ($body === null || (is_array($body) && count($body) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $body when calling updateIoDevice' + ); + } + + $resourcePath = '/iodevices/{id}'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + // path params + if ($id !== null) { + $resourcePath = str_replace( + '{' . 'id' . '}', + ObjectSerializer::toPathValue($id), + $resourcePath + ); + } + + // body params + $_tempBody = null; + if (isset($body)) { + $_tempBody = $body; + } + + if ($multipart) { + $headers = $this->headerSelector->selectHeadersForMultipart( + ['application/json'] + ); + } else { + $headers = $this->headerSelector->selectHeaders( + ['application/json'], + ['application/json'] + ); + } + + // for model (json/xml) + if (isset($_tempBody)) { + // $_tempBody is the method argument, if present + $httpBody = $_tempBody; + // \stdClass has no __toString(), so we should encode it manually + if ($httpBody instanceof \stdClass && $headers['Content-Type'] === 'application/json') { + $httpBody = \GuzzleHttp\json_encode($httpBody); + } + } elseif (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValue + ]; + } + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); + + } elseif ($headers['Content-Type'] === 'application/json') { + $httpBody = \GuzzleHttp\json_encode($formParams); + + } else { + // for HTTP post (form) + $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + } + } + + // this endpoint requires OAuth (access token) + if ($this->config->getAccessToken() !== null) { + $headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken(); + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $query = \GuzzleHttp\Psr7\build_query($queryParams); + return new Request( + 'PUT', + $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Create http client option + * + * @throws \RuntimeException on file opening failure + * @return array of http client options + */ + protected function createHttpClientOption() + { + $options = []; + if ($this->config->getDebug()) { + $options[RequestOptions::DEBUG] = fopen($this->config->getDebugFile(), 'a'); + if (!$options[RequestOptions::DEBUG]) { + throw new \RuntimeException('Failed to open the debug file: ' . $this->config->getDebugFile()); + } + } + + return $options; + } +} diff --git a/lib/Api/LocationsApi.php b/lib/Api/LocationsApi.php new file mode 100644 index 0000000..7bf94e2 --- /dev/null +++ b/lib/Api/LocationsApi.php @@ -0,0 +1,1425 @@ +client = $client ?: new Client(); + $this->config = $config ?: new Configuration(); + $this->headerSelector = $selector ?: new HeaderSelector(); + } + + /** + * @return Configuration + */ + public function getConfig() + { + return $this->config; + } + + /** + * Operation createLocation + * + * Create a new location + * + * + * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return \Swagger\Client\Model\Location + */ + public function createLocation() + { + list($response) = $this->createLocationWithHttpInfo(); + return $response; + } + + /** + * Operation createLocationWithHttpInfo + * + * Create a new location + * + * + * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of \Swagger\Client\Model\Location, HTTP status code, HTTP response headers (array of strings) + */ + public function createLocationWithHttpInfo() + { + $returnType = '\Swagger\Client\Model\Location'; + $request = $this->createLocationRequest(); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + ); + } + + $statusCode = $response->getStatusCode(); + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $response->getBody() + ); + } + + $responseBody = $response->getBody(); + if ($returnType === '\SplFileObject') { + $content = $responseBody; //stream goes to serializer + } else { + $content = $responseBody->getContents(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + case 201: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Swagger\Client\Model\Location', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation createLocationAsync + * + * Create a new location + * + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function createLocationAsync() + { + return $this->createLocationAsyncWithHttpInfo() + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation createLocationAsyncWithHttpInfo + * + * Create a new location + * + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function createLocationAsyncWithHttpInfo() + { + $returnType = '\Swagger\Client\Model\Location'; + $request = $this->createLocationRequest(); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + $responseBody = $response->getBody(); + if ($returnType === '\SplFileObject') { + $content = $responseBody; //stream goes to serializer + } else { + $content = $responseBody->getContents(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'createLocation' + * + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + protected function createLocationRequest() + { + + $resourcePath = '/locations'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + // body params + $_tempBody = null; + + if ($multipart) { + $headers = $this->headerSelector->selectHeadersForMultipart( + ['application/json'] + ); + } else { + $headers = $this->headerSelector->selectHeaders( + ['application/json'], + ['application/json'] + ); + } + + // for model (json/xml) + if (isset($_tempBody)) { + // $_tempBody is the method argument, if present + $httpBody = $_tempBody; + // \stdClass has no __toString(), so we should encode it manually + if ($httpBody instanceof \stdClass && $headers['Content-Type'] === 'application/json') { + $httpBody = \GuzzleHttp\json_encode($httpBody); + } + } elseif (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValue + ]; + } + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); + + } elseif ($headers['Content-Type'] === 'application/json') { + $httpBody = \GuzzleHttp\json_encode($formParams); + + } else { + // for HTTP post (form) + $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + } + } + + // this endpoint requires OAuth (access token) + if ($this->config->getAccessToken() !== null) { + $headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken(); + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $query = \GuzzleHttp\Psr7\build_query($queryParams); + return new Request( + 'POST', + $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation deleteLocation + * + * Delete location + * + * @param int $id id (required) + * @param string[] $include Specify what extra fields to include in the response. (optional) + * + * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return void + */ + public function deleteLocation($id, $include = null) + { + $this->deleteLocationWithHttpInfo($id, $include); + } + + /** + * Operation deleteLocationWithHttpInfo + * + * Delete location + * + * @param int $id (required) + * @param string[] $include Specify what extra fields to include in the response. (optional) + * + * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of null, HTTP status code, HTTP response headers (array of strings) + */ + public function deleteLocationWithHttpInfo($id, $include = null) + { + $returnType = ''; + $request = $this->deleteLocationRequest($id, $include); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + ); + } + + $statusCode = $response->getStatusCode(); + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $response->getBody() + ); + } + + return [null, $statusCode, $response->getHeaders()]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + } + throw $e; + } + } + + /** + * Operation deleteLocationAsync + * + * Delete location + * + * @param int $id (required) + * @param string[] $include Specify what extra fields to include in the response. (optional) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function deleteLocationAsync($id, $include = null) + { + return $this->deleteLocationAsyncWithHttpInfo($id, $include) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation deleteLocationAsyncWithHttpInfo + * + * Delete location + * + * @param int $id (required) + * @param string[] $include Specify what extra fields to include in the response. (optional) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function deleteLocationAsyncWithHttpInfo($id, $include = null) + { + $returnType = ''; + $request = $this->deleteLocationRequest($id, $include); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + return [null, $response->getStatusCode(), $response->getHeaders()]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'deleteLocation' + * + * @param int $id (required) + * @param string[] $include Specify what extra fields to include in the response. (optional) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + protected function deleteLocationRequest($id, $include = null) + { + // verify the required parameter 'id' is set + if ($id === null || (is_array($id) && count($id) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $id when calling deleteLocation' + ); + } + + $resourcePath = '/locations/{id}'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + // query params + if (is_array($include)) { + $include = ObjectSerializer::serializeCollection($include, 'csv', true); + } + if ($include !== null) { + $queryParams['include'] = ObjectSerializer::toQueryValue($include); + } + + // path params + if ($id !== null) { + $resourcePath = str_replace( + '{' . 'id' . '}', + ObjectSerializer::toPathValue($id), + $resourcePath + ); + } + + // body params + $_tempBody = null; + + if ($multipart) { + $headers = $this->headerSelector->selectHeadersForMultipart( + ['application/json'] + ); + } else { + $headers = $this->headerSelector->selectHeaders( + ['application/json'], + ['application/json'] + ); + } + + // for model (json/xml) + if (isset($_tempBody)) { + // $_tempBody is the method argument, if present + $httpBody = $_tempBody; + // \stdClass has no __toString(), so we should encode it manually + if ($httpBody instanceof \stdClass && $headers['Content-Type'] === 'application/json') { + $httpBody = \GuzzleHttp\json_encode($httpBody); + } + } elseif (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValue + ]; + } + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); + + } elseif ($headers['Content-Type'] === 'application/json') { + $httpBody = \GuzzleHttp\json_encode($formParams); + + } else { + // for HTTP post (form) + $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + } + } + + // this endpoint requires OAuth (access token) + if ($this->config->getAccessToken() !== null) { + $headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken(); + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $query = \GuzzleHttp\Psr7\build_query($queryParams); + return new Request( + 'DELETE', + $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation getLocation + * + * Get location by ID + * + * @param int $id id (required) + * @param string[] $include Specify what extra fields to include in the response. (optional) + * + * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return \Swagger\Client\Model\Location + */ + public function getLocation($id, $include = null) + { + list($response) = $this->getLocationWithHttpInfo($id, $include); + return $response; + } + + /** + * Operation getLocationWithHttpInfo + * + * Get location by ID + * + * @param int $id (required) + * @param string[] $include Specify what extra fields to include in the response. (optional) + * + * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of \Swagger\Client\Model\Location, HTTP status code, HTTP response headers (array of strings) + */ + public function getLocationWithHttpInfo($id, $include = null) + { + $returnType = '\Swagger\Client\Model\Location'; + $request = $this->getLocationRequest($id, $include); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + ); + } + + $statusCode = $response->getStatusCode(); + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $response->getBody() + ); + } + + $responseBody = $response->getBody(); + if ($returnType === '\SplFileObject') { + $content = $responseBody; //stream goes to serializer + } else { + $content = $responseBody->getContents(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Swagger\Client\Model\Location', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation getLocationAsync + * + * Get location by ID + * + * @param int $id (required) + * @param string[] $include Specify what extra fields to include in the response. (optional) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function getLocationAsync($id, $include = null) + { + return $this->getLocationAsyncWithHttpInfo($id, $include) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation getLocationAsyncWithHttpInfo + * + * Get location by ID + * + * @param int $id (required) + * @param string[] $include Specify what extra fields to include in the response. (optional) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function getLocationAsyncWithHttpInfo($id, $include = null) + { + $returnType = '\Swagger\Client\Model\Location'; + $request = $this->getLocationRequest($id, $include); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + $responseBody = $response->getBody(); + if ($returnType === '\SplFileObject') { + $content = $responseBody; //stream goes to serializer + } else { + $content = $responseBody->getContents(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'getLocation' + * + * @param int $id (required) + * @param string[] $include Specify what extra fields to include in the response. (optional) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + protected function getLocationRequest($id, $include = null) + { + // verify the required parameter 'id' is set + if ($id === null || (is_array($id) && count($id) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $id when calling getLocation' + ); + } + + $resourcePath = '/locations/{id}'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + // query params + if (is_array($include)) { + $include = ObjectSerializer::serializeCollection($include, 'csv', true); + } + if ($include !== null) { + $queryParams['include'] = ObjectSerializer::toQueryValue($include); + } + + // path params + if ($id !== null) { + $resourcePath = str_replace( + '{' . 'id' . '}', + ObjectSerializer::toPathValue($id), + $resourcePath + ); + } + + // body params + $_tempBody = null; + + if ($multipart) { + $headers = $this->headerSelector->selectHeadersForMultipart( + ['application/json'] + ); + } else { + $headers = $this->headerSelector->selectHeaders( + ['application/json'], + ['application/json'] + ); + } + + // for model (json/xml) + if (isset($_tempBody)) { + // $_tempBody is the method argument, if present + $httpBody = $_tempBody; + // \stdClass has no __toString(), so we should encode it manually + if ($httpBody instanceof \stdClass && $headers['Content-Type'] === 'application/json') { + $httpBody = \GuzzleHttp\json_encode($httpBody); + } + } elseif (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValue + ]; + } + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); + + } elseif ($headers['Content-Type'] === 'application/json') { + $httpBody = \GuzzleHttp\json_encode($formParams); + + } else { + // for HTTP post (form) + $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + } + } + + // this endpoint requires OAuth (access token) + if ($this->config->getAccessToken() !== null) { + $headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken(); + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $query = \GuzzleHttp\Psr7\build_query($queryParams); + return new Request( + 'GET', + $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation getLocations + * + * Get locations list + * + * @param string[] $include Specify what extra fields to include in the response. (optional) + * + * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return \Swagger\Client\Model\Location[] + */ + public function getLocations($include = null) + { + list($response) = $this->getLocationsWithHttpInfo($include); + return $response; + } + + /** + * Operation getLocationsWithHttpInfo + * + * Get locations list + * + * @param string[] $include Specify what extra fields to include in the response. (optional) + * + * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of \Swagger\Client\Model\Location[], HTTP status code, HTTP response headers (array of strings) + */ + public function getLocationsWithHttpInfo($include = null) + { + $returnType = '\Swagger\Client\Model\Location[]'; + $request = $this->getLocationsRequest($include); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + ); + } + + $statusCode = $response->getStatusCode(); + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $response->getBody() + ); + } + + $responseBody = $response->getBody(); + if ($returnType === '\SplFileObject') { + $content = $responseBody; //stream goes to serializer + } else { + $content = $responseBody->getContents(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Swagger\Client\Model\Location[]', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation getLocationsAsync + * + * Get locations list + * + * @param string[] $include Specify what extra fields to include in the response. (optional) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function getLocationsAsync($include = null) + { + return $this->getLocationsAsyncWithHttpInfo($include) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation getLocationsAsyncWithHttpInfo + * + * Get locations list + * + * @param string[] $include Specify what extra fields to include in the response. (optional) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function getLocationsAsyncWithHttpInfo($include = null) + { + $returnType = '\Swagger\Client\Model\Location[]'; + $request = $this->getLocationsRequest($include); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + $responseBody = $response->getBody(); + if ($returnType === '\SplFileObject') { + $content = $responseBody; //stream goes to serializer + } else { + $content = $responseBody->getContents(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'getLocations' + * + * @param string[] $include Specify what extra fields to include in the response. (optional) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + protected function getLocationsRequest($include = null) + { + + $resourcePath = '/locations'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + // query params + if (is_array($include)) { + $include = ObjectSerializer::serializeCollection($include, 'csv', true); + } + if ($include !== null) { + $queryParams['include'] = ObjectSerializer::toQueryValue($include); + } + + + // body params + $_tempBody = null; + + if ($multipart) { + $headers = $this->headerSelector->selectHeadersForMultipart( + ['application/json'] + ); + } else { + $headers = $this->headerSelector->selectHeaders( + ['application/json'], + ['application/json'] + ); + } + + // for model (json/xml) + if (isset($_tempBody)) { + // $_tempBody is the method argument, if present + $httpBody = $_tempBody; + // \stdClass has no __toString(), so we should encode it manually + if ($httpBody instanceof \stdClass && $headers['Content-Type'] === 'application/json') { + $httpBody = \GuzzleHttp\json_encode($httpBody); + } + } elseif (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValue + ]; + } + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); + + } elseif ($headers['Content-Type'] === 'application/json') { + $httpBody = \GuzzleHttp\json_encode($formParams); + + } else { + // for HTTP post (form) + $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + } + } + + // this endpoint requires OAuth (access token) + if ($this->config->getAccessToken() !== null) { + $headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken(); + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $query = \GuzzleHttp\Psr7\build_query($queryParams); + return new Request( + 'GET', + $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation updateLocation + * + * Update location + * + * @param int $id id (required) + * @param \Swagger\Client\Model\LocationUpdateRequest $body body (required) + * @param string[] $include Specify what extra fields to include in the response. (optional) + * + * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return \Swagger\Client\Model\Location + */ + public function updateLocation($id, $body, $include = null) + { + list($response) = $this->updateLocationWithHttpInfo($id, $body, $include); + return $response; + } + + /** + * Operation updateLocationWithHttpInfo + * + * Update location + * + * @param int $id (required) + * @param \Swagger\Client\Model\LocationUpdateRequest $body (required) + * @param string[] $include Specify what extra fields to include in the response. (optional) + * + * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of \Swagger\Client\Model\Location, HTTP status code, HTTP response headers (array of strings) + */ + public function updateLocationWithHttpInfo($id, $body, $include = null) + { + $returnType = '\Swagger\Client\Model\Location'; + $request = $this->updateLocationRequest($id, $body, $include); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + ); + } + + $statusCode = $response->getStatusCode(); + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $response->getBody() + ); + } + + $responseBody = $response->getBody(); + if ($returnType === '\SplFileObject') { + $content = $responseBody; //stream goes to serializer + } else { + $content = $responseBody->getContents(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Swagger\Client\Model\Location', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation updateLocationAsync + * + * Update location + * + * @param int $id (required) + * @param \Swagger\Client\Model\LocationUpdateRequest $body (required) + * @param string[] $include Specify what extra fields to include in the response. (optional) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function updateLocationAsync($id, $body, $include = null) + { + return $this->updateLocationAsyncWithHttpInfo($id, $body, $include) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation updateLocationAsyncWithHttpInfo + * + * Update location + * + * @param int $id (required) + * @param \Swagger\Client\Model\LocationUpdateRequest $body (required) + * @param string[] $include Specify what extra fields to include in the response. (optional) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function updateLocationAsyncWithHttpInfo($id, $body, $include = null) + { + $returnType = '\Swagger\Client\Model\Location'; + $request = $this->updateLocationRequest($id, $body, $include); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + $responseBody = $response->getBody(); + if ($returnType === '\SplFileObject') { + $content = $responseBody; //stream goes to serializer + } else { + $content = $responseBody->getContents(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'updateLocation' + * + * @param int $id (required) + * @param \Swagger\Client\Model\LocationUpdateRequest $body (required) + * @param string[] $include Specify what extra fields to include in the response. (optional) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + protected function updateLocationRequest($id, $body, $include = null) + { + // verify the required parameter 'id' is set + if ($id === null || (is_array($id) && count($id) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $id when calling updateLocation' + ); + } + // verify the required parameter 'body' is set + if ($body === null || (is_array($body) && count($body) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $body when calling updateLocation' + ); + } + + $resourcePath = '/locations/{id}'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + // query params + if (is_array($include)) { + $include = ObjectSerializer::serializeCollection($include, 'csv', true); + } + if ($include !== null) { + $queryParams['include'] = ObjectSerializer::toQueryValue($include); + } + + // path params + if ($id !== null) { + $resourcePath = str_replace( + '{' . 'id' . '}', + ObjectSerializer::toPathValue($id), + $resourcePath + ); + } + + // body params + $_tempBody = null; + if (isset($body)) { + $_tempBody = $body; + } + + if ($multipart) { + $headers = $this->headerSelector->selectHeadersForMultipart( + ['application/json'] + ); + } else { + $headers = $this->headerSelector->selectHeaders( + ['application/json'], + ['application/json'] + ); + } + + // for model (json/xml) + if (isset($_tempBody)) { + // $_tempBody is the method argument, if present + $httpBody = $_tempBody; + // \stdClass has no __toString(), so we should encode it manually + if ($httpBody instanceof \stdClass && $headers['Content-Type'] === 'application/json') { + $httpBody = \GuzzleHttp\json_encode($httpBody); + } + } elseif (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValue + ]; + } + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); + + } elseif ($headers['Content-Type'] === 'application/json') { + $httpBody = \GuzzleHttp\json_encode($formParams); + + } else { + // for HTTP post (form) + $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + } + } + + // this endpoint requires OAuth (access token) + if ($this->config->getAccessToken() !== null) { + $headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken(); + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $query = \GuzzleHttp\Psr7\build_query($queryParams); + return new Request( + 'PUT', + $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Create http client option + * + * @throws \RuntimeException on file opening failure + * @return array of http client options + */ + protected function createHttpClientOption() + { + $options = []; + if ($this->config->getDebug()) { + $options[RequestOptions::DEBUG] = fopen($this->config->getDebugFile(), 'a'); + if (!$options[RequestOptions::DEBUG]) { + throw new \RuntimeException('Failed to open the debug file: ' . $this->config->getDebugFile()); + } + } + + return $options; + } +} diff --git a/lib/Api/SchedulesApi.php b/lib/Api/SchedulesApi.php new file mode 100644 index 0000000..e4d00a3 --- /dev/null +++ b/lib/Api/SchedulesApi.php @@ -0,0 +1,1648 @@ +client = $client ?: new Client(); + $this->config = $config ?: new Configuration(); + $this->headerSelector = $selector ?: new HeaderSelector(); + } + + /** + * @return Configuration + */ + public function getConfig() + { + return $this->config; + } + + /** + * Operation createSchedule + * + * Create a new schedule + * + * @param \Swagger\Client\Model\ScheduleRequest $body body (required) + * + * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return \Swagger\Client\Model\Schedule + */ + public function createSchedule($body) + { + list($response) = $this->createScheduleWithHttpInfo($body); + return $response; + } + + /** + * Operation createScheduleWithHttpInfo + * + * Create a new schedule + * + * @param \Swagger\Client\Model\ScheduleRequest $body (required) + * + * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of \Swagger\Client\Model\Schedule, HTTP status code, HTTP response headers (array of strings) + */ + public function createScheduleWithHttpInfo($body) + { + $returnType = '\Swagger\Client\Model\Schedule'; + $request = $this->createScheduleRequest($body); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + ); + } + + $statusCode = $response->getStatusCode(); + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $response->getBody() + ); + } + + $responseBody = $response->getBody(); + if ($returnType === '\SplFileObject') { + $content = $responseBody; //stream goes to serializer + } else { + $content = $responseBody->getContents(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + case 201: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Swagger\Client\Model\Schedule', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation createScheduleAsync + * + * Create a new schedule + * + * @param \Swagger\Client\Model\ScheduleRequest $body (required) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function createScheduleAsync($body) + { + return $this->createScheduleAsyncWithHttpInfo($body) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation createScheduleAsyncWithHttpInfo + * + * Create a new schedule + * + * @param \Swagger\Client\Model\ScheduleRequest $body (required) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function createScheduleAsyncWithHttpInfo($body) + { + $returnType = '\Swagger\Client\Model\Schedule'; + $request = $this->createScheduleRequest($body); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + $responseBody = $response->getBody(); + if ($returnType === '\SplFileObject') { + $content = $responseBody; //stream goes to serializer + } else { + $content = $responseBody->getContents(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'createSchedule' + * + * @param \Swagger\Client\Model\ScheduleRequest $body (required) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + protected function createScheduleRequest($body) + { + // verify the required parameter 'body' is set + if ($body === null || (is_array($body) && count($body) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $body when calling createSchedule' + ); + } + + $resourcePath = '/schedules'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + // body params + $_tempBody = null; + if (isset($body)) { + $_tempBody = $body; + } + + if ($multipart) { + $headers = $this->headerSelector->selectHeadersForMultipart( + ['application/json'] + ); + } else { + $headers = $this->headerSelector->selectHeaders( + ['application/json'], + ['application/json'] + ); + } + + // for model (json/xml) + if (isset($_tempBody)) { + // $_tempBody is the method argument, if present + $httpBody = $_tempBody; + // \stdClass has no __toString(), so we should encode it manually + if ($httpBody instanceof \stdClass && $headers['Content-Type'] === 'application/json') { + $httpBody = \GuzzleHttp\json_encode($httpBody); + } + } elseif (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValue + ]; + } + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); + + } elseif ($headers['Content-Type'] === 'application/json') { + $httpBody = \GuzzleHttp\json_encode($formParams); + + } else { + // for HTTP post (form) + $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + } + } + + // this endpoint requires OAuth (access token) + if ($this->config->getAccessToken() !== null) { + $headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken(); + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $query = \GuzzleHttp\Psr7\build_query($queryParams); + return new Request( + 'POST', + $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation deleteSchedule + * + * Delete Schedule + * + * @param int $id id (required) + * + * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return void + */ + public function deleteSchedule($id) + { + $this->deleteScheduleWithHttpInfo($id); + } + + /** + * Operation deleteScheduleWithHttpInfo + * + * Delete Schedule + * + * @param int $id (required) + * + * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of null, HTTP status code, HTTP response headers (array of strings) + */ + public function deleteScheduleWithHttpInfo($id) + { + $returnType = ''; + $request = $this->deleteScheduleRequest($id); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + ); + } + + $statusCode = $response->getStatusCode(); + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $response->getBody() + ); + } + + return [null, $statusCode, $response->getHeaders()]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + } + throw $e; + } + } + + /** + * Operation deleteScheduleAsync + * + * Delete Schedule + * + * @param int $id (required) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function deleteScheduleAsync($id) + { + return $this->deleteScheduleAsyncWithHttpInfo($id) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation deleteScheduleAsyncWithHttpInfo + * + * Delete Schedule + * + * @param int $id (required) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function deleteScheduleAsyncWithHttpInfo($id) + { + $returnType = ''; + $request = $this->deleteScheduleRequest($id); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + return [null, $response->getStatusCode(), $response->getHeaders()]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'deleteSchedule' + * + * @param int $id (required) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + protected function deleteScheduleRequest($id) + { + // verify the required parameter 'id' is set + if ($id === null || (is_array($id) && count($id) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $id when calling deleteSchedule' + ); + } + + $resourcePath = '/schedules/{id}'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + // path params + if ($id !== null) { + $resourcePath = str_replace( + '{' . 'id' . '}', + ObjectSerializer::toPathValue($id), + $resourcePath + ); + } + + // body params + $_tempBody = null; + + if ($multipart) { + $headers = $this->headerSelector->selectHeadersForMultipart( + ['application/json'] + ); + } else { + $headers = $this->headerSelector->selectHeaders( + ['application/json'], + ['application/json'] + ); + } + + // for model (json/xml) + if (isset($_tempBody)) { + // $_tempBody is the method argument, if present + $httpBody = $_tempBody; + // \stdClass has no __toString(), so we should encode it manually + if ($httpBody instanceof \stdClass && $headers['Content-Type'] === 'application/json') { + $httpBody = \GuzzleHttp\json_encode($httpBody); + } + } elseif (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValue + ]; + } + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); + + } elseif ($headers['Content-Type'] === 'application/json') { + $httpBody = \GuzzleHttp\json_encode($formParams); + + } else { + // for HTTP post (form) + $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + } + } + + // this endpoint requires OAuth (access token) + if ($this->config->getAccessToken() !== null) { + $headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken(); + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $query = \GuzzleHttp\Psr7\build_query($queryParams); + return new Request( + 'DELETE', + $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation enableSchedules + * + * Enable schedules + * + * @param \Swagger\Client\Model\SchedulesEnableRequest $body body (required) + * + * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return void + */ + public function enableSchedules($body) + { + $this->enableSchedulesWithHttpInfo($body); + } + + /** + * Operation enableSchedulesWithHttpInfo + * + * Enable schedules + * + * @param \Swagger\Client\Model\SchedulesEnableRequest $body (required) + * + * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of null, HTTP status code, HTTP response headers (array of strings) + */ + public function enableSchedulesWithHttpInfo($body) + { + $returnType = ''; + $request = $this->enableSchedulesRequest($body); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + ); + } + + $statusCode = $response->getStatusCode(); + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $response->getBody() + ); + } + + return [null, $statusCode, $response->getHeaders()]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + } + throw $e; + } + } + + /** + * Operation enableSchedulesAsync + * + * Enable schedules + * + * @param \Swagger\Client\Model\SchedulesEnableRequest $body (required) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function enableSchedulesAsync($body) + { + return $this->enableSchedulesAsyncWithHttpInfo($body) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation enableSchedulesAsyncWithHttpInfo + * + * Enable schedules + * + * @param \Swagger\Client\Model\SchedulesEnableRequest $body (required) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function enableSchedulesAsyncWithHttpInfo($body) + { + $returnType = ''; + $request = $this->enableSchedulesRequest($body); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + return [null, $response->getStatusCode(), $response->getHeaders()]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'enableSchedules' + * + * @param \Swagger\Client\Model\SchedulesEnableRequest $body (required) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + protected function enableSchedulesRequest($body) + { + // verify the required parameter 'body' is set + if ($body === null || (is_array($body) && count($body) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $body when calling enableSchedules' + ); + } + + $resourcePath = '/schedules'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + // body params + $_tempBody = null; + if (isset($body)) { + $_tempBody = $body; + } + + if ($multipart) { + $headers = $this->headerSelector->selectHeadersForMultipart( + ['application/json'] + ); + } else { + $headers = $this->headerSelector->selectHeaders( + ['application/json'], + ['application/json'] + ); + } + + // for model (json/xml) + if (isset($_tempBody)) { + // $_tempBody is the method argument, if present + $httpBody = $_tempBody; + // \stdClass has no __toString(), so we should encode it manually + if ($httpBody instanceof \stdClass && $headers['Content-Type'] === 'application/json') { + $httpBody = \GuzzleHttp\json_encode($httpBody); + } + } elseif (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValue + ]; + } + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); + + } elseif ($headers['Content-Type'] === 'application/json') { + $httpBody = \GuzzleHttp\json_encode($formParams); + + } else { + // for HTTP post (form) + $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + } + } + + // this endpoint requires OAuth (access token) + if ($this->config->getAccessToken() !== null) { + $headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken(); + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $query = \GuzzleHttp\Psr7\build_query($queryParams); + return new Request( + 'PATCH', + $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation getSchedule + * + * Get Schedule + * + * @param int $id id (required) + * @param string[] $include Specify what extra fields to include in the response. (optional) + * + * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return \Swagger\Client\Model\Schedule + */ + public function getSchedule($id, $include = null) + { + list($response) = $this->getScheduleWithHttpInfo($id, $include); + return $response; + } + + /** + * Operation getScheduleWithHttpInfo + * + * Get Schedule + * + * @param int $id (required) + * @param string[] $include Specify what extra fields to include in the response. (optional) + * + * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of \Swagger\Client\Model\Schedule, HTTP status code, HTTP response headers (array of strings) + */ + public function getScheduleWithHttpInfo($id, $include = null) + { + $returnType = '\Swagger\Client\Model\Schedule'; + $request = $this->getScheduleRequest($id, $include); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + ); + } + + $statusCode = $response->getStatusCode(); + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $response->getBody() + ); + } + + $responseBody = $response->getBody(); + if ($returnType === '\SplFileObject') { + $content = $responseBody; //stream goes to serializer + } else { + $content = $responseBody->getContents(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Swagger\Client\Model\Schedule', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation getScheduleAsync + * + * Get Schedule + * + * @param int $id (required) + * @param string[] $include Specify what extra fields to include in the response. (optional) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function getScheduleAsync($id, $include = null) + { + return $this->getScheduleAsyncWithHttpInfo($id, $include) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation getScheduleAsyncWithHttpInfo + * + * Get Schedule + * + * @param int $id (required) + * @param string[] $include Specify what extra fields to include in the response. (optional) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function getScheduleAsyncWithHttpInfo($id, $include = null) + { + $returnType = '\Swagger\Client\Model\Schedule'; + $request = $this->getScheduleRequest($id, $include); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + $responseBody = $response->getBody(); + if ($returnType === '\SplFileObject') { + $content = $responseBody; //stream goes to serializer + } else { + $content = $responseBody->getContents(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'getSchedule' + * + * @param int $id (required) + * @param string[] $include Specify what extra fields to include in the response. (optional) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + protected function getScheduleRequest($id, $include = null) + { + // verify the required parameter 'id' is set + if ($id === null || (is_array($id) && count($id) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $id when calling getSchedule' + ); + } + + $resourcePath = '/schedules/{id}'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + // query params + if (is_array($include)) { + $include = ObjectSerializer::serializeCollection($include, 'csv', true); + } + if ($include !== null) { + $queryParams['include'] = ObjectSerializer::toQueryValue($include); + } + + // path params + if ($id !== null) { + $resourcePath = str_replace( + '{' . 'id' . '}', + ObjectSerializer::toPathValue($id), + $resourcePath + ); + } + + // body params + $_tempBody = null; + + if ($multipart) { + $headers = $this->headerSelector->selectHeadersForMultipart( + ['application/json'] + ); + } else { + $headers = $this->headerSelector->selectHeaders( + ['application/json'], + ['application/json'] + ); + } + + // for model (json/xml) + if (isset($_tempBody)) { + // $_tempBody is the method argument, if present + $httpBody = $_tempBody; + // \stdClass has no __toString(), so we should encode it manually + if ($httpBody instanceof \stdClass && $headers['Content-Type'] === 'application/json') { + $httpBody = \GuzzleHttp\json_encode($httpBody); + } + } elseif (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValue + ]; + } + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); + + } elseif ($headers['Content-Type'] === 'application/json') { + $httpBody = \GuzzleHttp\json_encode($formParams); + + } else { + // for HTTP post (form) + $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + } + } + + // this endpoint requires OAuth (access token) + if ($this->config->getAccessToken() !== null) { + $headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken(); + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $query = \GuzzleHttp\Psr7\build_query($queryParams); + return new Request( + 'GET', + $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation getSchedules + * + * Get schedules list + * + * @param string[] $include Specify what extra fields to include in the response. (optional) + * + * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return \Swagger\Client\Model\Schedule[] + */ + public function getSchedules($include = null) + { + list($response) = $this->getSchedulesWithHttpInfo($include); + return $response; + } + + /** + * Operation getSchedulesWithHttpInfo + * + * Get schedules list + * + * @param string[] $include Specify what extra fields to include in the response. (optional) + * + * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of \Swagger\Client\Model\Schedule[], HTTP status code, HTTP response headers (array of strings) + */ + public function getSchedulesWithHttpInfo($include = null) + { + $returnType = '\Swagger\Client\Model\Schedule[]'; + $request = $this->getSchedulesRequest($include); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + ); + } + + $statusCode = $response->getStatusCode(); + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $response->getBody() + ); + } + + $responseBody = $response->getBody(); + if ($returnType === '\SplFileObject') { + $content = $responseBody; //stream goes to serializer + } else { + $content = $responseBody->getContents(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Swagger\Client\Model\Schedule[]', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation getSchedulesAsync + * + * Get schedules list + * + * @param string[] $include Specify what extra fields to include in the response. (optional) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function getSchedulesAsync($include = null) + { + return $this->getSchedulesAsyncWithHttpInfo($include) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation getSchedulesAsyncWithHttpInfo + * + * Get schedules list + * + * @param string[] $include Specify what extra fields to include in the response. (optional) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function getSchedulesAsyncWithHttpInfo($include = null) + { + $returnType = '\Swagger\Client\Model\Schedule[]'; + $request = $this->getSchedulesRequest($include); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + $responseBody = $response->getBody(); + if ($returnType === '\SplFileObject') { + $content = $responseBody; //stream goes to serializer + } else { + $content = $responseBody->getContents(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'getSchedules' + * + * @param string[] $include Specify what extra fields to include in the response. (optional) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + protected function getSchedulesRequest($include = null) + { + + $resourcePath = '/schedules'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + // query params + if (is_array($include)) { + $include = ObjectSerializer::serializeCollection($include, 'csv', true); + } + if ($include !== null) { + $queryParams['include'] = ObjectSerializer::toQueryValue($include); + } + + + // body params + $_tempBody = null; + + if ($multipart) { + $headers = $this->headerSelector->selectHeadersForMultipart( + ['application/json'] + ); + } else { + $headers = $this->headerSelector->selectHeaders( + ['application/json'], + ['application/json'] + ); + } + + // for model (json/xml) + if (isset($_tempBody)) { + // $_tempBody is the method argument, if present + $httpBody = $_tempBody; + // \stdClass has no __toString(), so we should encode it manually + if ($httpBody instanceof \stdClass && $headers['Content-Type'] === 'application/json') { + $httpBody = \GuzzleHttp\json_encode($httpBody); + } + } elseif (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValue + ]; + } + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); + + } elseif ($headers['Content-Type'] === 'application/json') { + $httpBody = \GuzzleHttp\json_encode($formParams); + + } else { + // for HTTP post (form) + $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + } + } + + // this endpoint requires OAuth (access token) + if ($this->config->getAccessToken() !== null) { + $headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken(); + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $query = \GuzzleHttp\Psr7\build_query($queryParams); + return new Request( + 'GET', + $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation updateSchedule + * + * Update schedule + * + * @param int $id id (required) + * @param \Swagger\Client\Model\ScheduleRequest $body body (required) + * @param bool $enable Set to `true` to enable the schedule after saving. (optional) + * + * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return \Swagger\Client\Model\Schedule + */ + public function updateSchedule($id, $body, $enable = null) + { + list($response) = $this->updateScheduleWithHttpInfo($id, $body, $enable); + return $response; + } + + /** + * Operation updateScheduleWithHttpInfo + * + * Update schedule + * + * @param int $id (required) + * @param \Swagger\Client\Model\ScheduleRequest $body (required) + * @param bool $enable Set to `true` to enable the schedule after saving. (optional) + * + * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of \Swagger\Client\Model\Schedule, HTTP status code, HTTP response headers (array of strings) + */ + public function updateScheduleWithHttpInfo($id, $body, $enable = null) + { + $returnType = '\Swagger\Client\Model\Schedule'; + $request = $this->updateScheduleRequest($id, $body, $enable); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + ); + } + + $statusCode = $response->getStatusCode(); + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $response->getBody() + ); + } + + $responseBody = $response->getBody(); + if ($returnType === '\SplFileObject') { + $content = $responseBody; //stream goes to serializer + } else { + $content = $responseBody->getContents(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Swagger\Client\Model\Schedule', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation updateScheduleAsync + * + * Update schedule + * + * @param int $id (required) + * @param \Swagger\Client\Model\ScheduleRequest $body (required) + * @param bool $enable Set to `true` to enable the schedule after saving. (optional) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function updateScheduleAsync($id, $body, $enable = null) + { + return $this->updateScheduleAsyncWithHttpInfo($id, $body, $enable) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation updateScheduleAsyncWithHttpInfo + * + * Update schedule + * + * @param int $id (required) + * @param \Swagger\Client\Model\ScheduleRequest $body (required) + * @param bool $enable Set to `true` to enable the schedule after saving. (optional) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function updateScheduleAsyncWithHttpInfo($id, $body, $enable = null) + { + $returnType = '\Swagger\Client\Model\Schedule'; + $request = $this->updateScheduleRequest($id, $body, $enable); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + $responseBody = $response->getBody(); + if ($returnType === '\SplFileObject') { + $content = $responseBody; //stream goes to serializer + } else { + $content = $responseBody->getContents(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'updateSchedule' + * + * @param int $id (required) + * @param \Swagger\Client\Model\ScheduleRequest $body (required) + * @param bool $enable Set to `true` to enable the schedule after saving. (optional) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + protected function updateScheduleRequest($id, $body, $enable = null) + { + // verify the required parameter 'id' is set + if ($id === null || (is_array($id) && count($id) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $id when calling updateSchedule' + ); + } + // verify the required parameter 'body' is set + if ($body === null || (is_array($body) && count($body) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $body when calling updateSchedule' + ); + } + + $resourcePath = '/schedules/{id}'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + // query params + if ($enable !== null) { + $queryParams['enable'] = ObjectSerializer::toQueryValue($enable); + } + + // path params + if ($id !== null) { + $resourcePath = str_replace( + '{' . 'id' . '}', + ObjectSerializer::toPathValue($id), + $resourcePath + ); + } + + // body params + $_tempBody = null; + if (isset($body)) { + $_tempBody = $body; + } + + if ($multipart) { + $headers = $this->headerSelector->selectHeadersForMultipart( + ['application/json'] + ); + } else { + $headers = $this->headerSelector->selectHeaders( + ['application/json'], + ['application/json'] + ); + } + + // for model (json/xml) + if (isset($_tempBody)) { + // $_tempBody is the method argument, if present + $httpBody = $_tempBody; + // \stdClass has no __toString(), so we should encode it manually + if ($httpBody instanceof \stdClass && $headers['Content-Type'] === 'application/json') { + $httpBody = \GuzzleHttp\json_encode($httpBody); + } + } elseif (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValue + ]; + } + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); + + } elseif ($headers['Content-Type'] === 'application/json') { + $httpBody = \GuzzleHttp\json_encode($formParams); + + } else { + // for HTTP post (form) + $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + } + } + + // this endpoint requires OAuth (access token) + if ($this->config->getAccessToken() !== null) { + $headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken(); + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $query = \GuzzleHttp\Psr7\build_query($queryParams); + return new Request( + 'PUT', + $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Create http client option + * + * @throws \RuntimeException on file opening failure + * @return array of http client options + */ + protected function createHttpClientOption() + { + $options = []; + if ($this->config->getDebug()) { + $options[RequestOptions::DEBUG] = fopen($this->config->getDebugFile(), 'a'); + if (!$options[RequestOptions::DEBUG]) { + throw new \RuntimeException('Failed to open the debug file: ' . $this->config->getDebugFile()); + } + } + + return $options; + } +} diff --git a/lib/Api/ServerApi.php b/lib/Api/ServerApi.php new file mode 100644 index 0000000..54ccbe0 --- /dev/null +++ b/lib/Api/ServerApi.php @@ -0,0 +1,557 @@ +client = $client ?: new Client(); + $this->config = $config ?: new Configuration(); + $this->headerSelector = $selector ?: new HeaderSelector(); + } + + /** + * @return Configuration + */ + public function getConfig() + { + return $this->config; + } + + /** + * Operation getServerInfo + * + * Get server info + * + * + * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return \Swagger\Client\Model\ServerInfo + */ + public function getServerInfo() + { + list($response) = $this->getServerInfoWithHttpInfo(); + return $response; + } + + /** + * Operation getServerInfoWithHttpInfo + * + * Get server info + * + * + * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of \Swagger\Client\Model\ServerInfo, HTTP status code, HTTP response headers (array of strings) + */ + public function getServerInfoWithHttpInfo() + { + $returnType = '\Swagger\Client\Model\ServerInfo'; + $request = $this->getServerInfoRequest(); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + ); + } + + $statusCode = $response->getStatusCode(); + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $response->getBody() + ); + } + + $responseBody = $response->getBody(); + if ($returnType === '\SplFileObject') { + $content = $responseBody; //stream goes to serializer + } else { + $content = $responseBody->getContents(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Swagger\Client\Model\ServerInfo', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation getServerInfoAsync + * + * Get server info + * + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function getServerInfoAsync() + { + return $this->getServerInfoAsyncWithHttpInfo() + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation getServerInfoAsyncWithHttpInfo + * + * Get server info + * + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function getServerInfoAsyncWithHttpInfo() + { + $returnType = '\Swagger\Client\Model\ServerInfo'; + $request = $this->getServerInfoRequest(); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + $responseBody = $response->getBody(); + if ($returnType === '\SplFileObject') { + $content = $responseBody; //stream goes to serializer + } else { + $content = $responseBody->getContents(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'getServerInfo' + * + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + protected function getServerInfoRequest() + { + + $resourcePath = '/server-info'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + // body params + $_tempBody = null; + + if ($multipart) { + $headers = $this->headerSelector->selectHeadersForMultipart( + ['application/json'] + ); + } else { + $headers = $this->headerSelector->selectHeaders( + ['application/json'], + ['application/json'] + ); + } + + // for model (json/xml) + if (isset($_tempBody)) { + // $_tempBody is the method argument, if present + $httpBody = $_tempBody; + // \stdClass has no __toString(), so we should encode it manually + if ($httpBody instanceof \stdClass && $headers['Content-Type'] === 'application/json') { + $httpBody = \GuzzleHttp\json_encode($httpBody); + } + } elseif (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValue + ]; + } + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); + + } elseif ($headers['Content-Type'] === 'application/json') { + $httpBody = \GuzzleHttp\json_encode($formParams); + + } else { + // for HTTP post (form) + $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + } + } + + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $query = \GuzzleHttp\Psr7\build_query($queryParams); + return new Request( + 'GET', + $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation getSuplaServerStatus + * + * Get the SUPLA Server status + * + * + * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return void + */ + public function getSuplaServerStatus() + { + $this->getSuplaServerStatusWithHttpInfo(); + } + + /** + * Operation getSuplaServerStatusWithHttpInfo + * + * Get the SUPLA Server status + * + * + * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of null, HTTP status code, HTTP response headers (array of strings) + */ + public function getSuplaServerStatusWithHttpInfo() + { + $returnType = ''; + $request = $this->getSuplaServerStatusRequest(); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + ); + } + + $statusCode = $response->getStatusCode(); + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $response->getBody() + ); + } + + return [null, $statusCode, $response->getHeaders()]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + } + throw $e; + } + } + + /** + * Operation getSuplaServerStatusAsync + * + * Get the SUPLA Server status + * + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function getSuplaServerStatusAsync() + { + return $this->getSuplaServerStatusAsyncWithHttpInfo() + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation getSuplaServerStatusAsyncWithHttpInfo + * + * Get the SUPLA Server status + * + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function getSuplaServerStatusAsyncWithHttpInfo() + { + $returnType = ''; + $request = $this->getSuplaServerStatusRequest(); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + return [null, $response->getStatusCode(), $response->getHeaders()]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'getSuplaServerStatus' + * + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + protected function getSuplaServerStatusRequest() + { + + $resourcePath = '/server-status'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + // body params + $_tempBody = null; + + if ($multipart) { + $headers = $this->headerSelector->selectHeadersForMultipart( + ['application/json'] + ); + } else { + $headers = $this->headerSelector->selectHeaders( + ['application/json'], + ['application/json'] + ); + } + + // for model (json/xml) + if (isset($_tempBody)) { + // $_tempBody is the method argument, if present + $httpBody = $_tempBody; + // \stdClass has no __toString(), so we should encode it manually + if ($httpBody instanceof \stdClass && $headers['Content-Type'] === 'application/json') { + $httpBody = \GuzzleHttp\json_encode($httpBody); + } + } elseif (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValue + ]; + } + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); + + } elseif ($headers['Content-Type'] === 'application/json') { + $httpBody = \GuzzleHttp\json_encode($formParams); + + } else { + // for HTTP post (form) + $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + } + } + + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $query = \GuzzleHttp\Psr7\build_query($queryParams); + return new Request( + 'GET', + $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Create http client option + * + * @throws \RuntimeException on file opening failure + * @return array of http client options + */ + protected function createHttpClientOption() + { + $options = []; + if ($this->config->getDebug()) { + $options[RequestOptions::DEBUG] = fopen($this->config->getDebugFile(), 'a'); + if (!$options[RequestOptions::DEBUG]) { + throw new \RuntimeException('Failed to open the debug file: ' . $this->config->getDebugFile()); + } + } + + return $options; + } +} diff --git a/lib/Api/UsersApi.php b/lib/Api/UsersApi.php new file mode 100644 index 0000000..0e73413 --- /dev/null +++ b/lib/Api/UsersApi.php @@ -0,0 +1,579 @@ +client = $client ?: new Client(); + $this->config = $config ?: new Configuration(); + $this->headerSelector = $selector ?: new HeaderSelector(); + } + + /** + * @return Configuration + */ + public function getConfig() + { + return $this->config; + } + + /** + * Operation getCurrentUser + * + * Get current user + * + * + * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return \Swagger\Client\Model\UserData + */ + public function getCurrentUser() + { + list($response) = $this->getCurrentUserWithHttpInfo(); + return $response; + } + + /** + * Operation getCurrentUserWithHttpInfo + * + * Get current user + * + * + * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of \Swagger\Client\Model\UserData, HTTP status code, HTTP response headers (array of strings) + */ + public function getCurrentUserWithHttpInfo() + { + $returnType = '\Swagger\Client\Model\UserData'; + $request = $this->getCurrentUserRequest(); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + ); + } + + $statusCode = $response->getStatusCode(); + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $response->getBody() + ); + } + + $responseBody = $response->getBody(); + if ($returnType === '\SplFileObject') { + $content = $responseBody; //stream goes to serializer + } else { + $content = $responseBody->getContents(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Swagger\Client\Model\UserData', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation getCurrentUserAsync + * + * Get current user + * + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function getCurrentUserAsync() + { + return $this->getCurrentUserAsyncWithHttpInfo() + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation getCurrentUserAsyncWithHttpInfo + * + * Get current user + * + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function getCurrentUserAsyncWithHttpInfo() + { + $returnType = '\Swagger\Client\Model\UserData'; + $request = $this->getCurrentUserRequest(); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + $responseBody = $response->getBody(); + if ($returnType === '\SplFileObject') { + $content = $responseBody; //stream goes to serializer + } else { + $content = $responseBody->getContents(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'getCurrentUser' + * + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + protected function getCurrentUserRequest() + { + + $resourcePath = '/users/current'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + // body params + $_tempBody = null; + + if ($multipart) { + $headers = $this->headerSelector->selectHeadersForMultipart( + ['application/json'] + ); + } else { + $headers = $this->headerSelector->selectHeaders( + ['application/json'], + ['application/json'] + ); + } + + // for model (json/xml) + if (isset($_tempBody)) { + // $_tempBody is the method argument, if present + $httpBody = $_tempBody; + // \stdClass has no __toString(), so we should encode it manually + if ($httpBody instanceof \stdClass && $headers['Content-Type'] === 'application/json') { + $httpBody = \GuzzleHttp\json_encode($httpBody); + } + } elseif (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValue + ]; + } + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); + + } elseif ($headers['Content-Type'] === 'application/json') { + $httpBody = \GuzzleHttp\json_encode($formParams); + + } else { + // for HTTP post (form) + $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + } + } + + // this endpoint requires OAuth (access token) + if ($this->config->getAccessToken() !== null) { + $headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken(); + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $query = \GuzzleHttp\Psr7\build_query($queryParams); + return new Request( + 'GET', + $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation updateCurrentUser + * + * Update current user + * + * @param \Swagger\Client\Model\UserUpdateRequest $body body (required) + * + * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return void + */ + public function updateCurrentUser($body) + { + $this->updateCurrentUserWithHttpInfo($body); + } + + /** + * Operation updateCurrentUserWithHttpInfo + * + * Update current user + * + * @param \Swagger\Client\Model\UserUpdateRequest $body (required) + * + * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of null, HTTP status code, HTTP response headers (array of strings) + */ + public function updateCurrentUserWithHttpInfo($body) + { + $returnType = ''; + $request = $this->updateCurrentUserRequest($body); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + ); + } + + $statusCode = $response->getStatusCode(); + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $response->getBody() + ); + } + + return [null, $statusCode, $response->getHeaders()]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + } + throw $e; + } + } + + /** + * Operation updateCurrentUserAsync + * + * Update current user + * + * @param \Swagger\Client\Model\UserUpdateRequest $body (required) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function updateCurrentUserAsync($body) + { + return $this->updateCurrentUserAsyncWithHttpInfo($body) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation updateCurrentUserAsyncWithHttpInfo + * + * Update current user + * + * @param \Swagger\Client\Model\UserUpdateRequest $body (required) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function updateCurrentUserAsyncWithHttpInfo($body) + { + $returnType = ''; + $request = $this->updateCurrentUserRequest($body); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + return [null, $response->getStatusCode(), $response->getHeaders()]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'updateCurrentUser' + * + * @param \Swagger\Client\Model\UserUpdateRequest $body (required) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + protected function updateCurrentUserRequest($body) + { + // verify the required parameter 'body' is set + if ($body === null || (is_array($body) && count($body) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $body when calling updateCurrentUser' + ); + } + + $resourcePath = '/users/current'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + // body params + $_tempBody = null; + if (isset($body)) { + $_tempBody = $body; + } + + if ($multipart) { + $headers = $this->headerSelector->selectHeadersForMultipart( + ['application/json'] + ); + } else { + $headers = $this->headerSelector->selectHeaders( + ['application/json'], + ['application/json'] + ); + } + + // for model (json/xml) + if (isset($_tempBody)) { + // $_tempBody is the method argument, if present + $httpBody = $_tempBody; + // \stdClass has no __toString(), so we should encode it manually + if ($httpBody instanceof \stdClass && $headers['Content-Type'] === 'application/json') { + $httpBody = \GuzzleHttp\json_encode($httpBody); + } + } elseif (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValue + ]; + } + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); + + } elseif ($headers['Content-Type'] === 'application/json') { + $httpBody = \GuzzleHttp\json_encode($formParams); + + } else { + // for HTTP post (form) + $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + } + } + + // this endpoint requires OAuth (access token) + if ($this->config->getAccessToken() !== null) { + $headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken(); + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $query = \GuzzleHttp\Psr7\build_query($queryParams); + return new Request( + 'PATCH', + $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Create http client option + * + * @throws \RuntimeException on file opening failure + * @return array of http client options + */ + protected function createHttpClientOption() + { + $options = []; + if ($this->config->getDebug()) { + $options[RequestOptions::DEBUG] = fopen($this->config->getDebugFile(), 'a'); + if (!$options[RequestOptions::DEBUG]) { + throw new \RuntimeException('Failed to open the debug file: ' . $this->config->getDebugFile()); + } + } + + return $options; + } +} diff --git a/lib/ApiException.php b/lib/ApiException.php new file mode 100644 index 0000000..a2e4816 --- /dev/null +++ b/lib/ApiException.php @@ -0,0 +1,121 @@ +responseHeaders = $responseHeaders; + $this->responseBody = $responseBody; + } + + /** + * Gets the HTTP response header + * + * @return string[]|null HTTP response header + */ + public function getResponseHeaders() + { + return $this->responseHeaders; + } + + /** + * Gets the HTTP body of the server response either as Json or string + * + * @return mixed HTTP body of the server response either as \stdClass or string + */ + public function getResponseBody() + { + return $this->responseBody; + } + + /** + * Sets the deseralized response object (during deserialization) + * + * @param mixed $obj Deserialized response object + * + * @return void + */ + public function setResponseObject($obj) + { + $this->responseObject = $obj; + } + + /** + * Gets the deseralized response object (during deserialization) + * + * @return mixed the deserialized response object + */ + public function getResponseObject() + { + return $this->responseObject; + } +} diff --git a/lib/Configuration.php b/lib/Configuration.php new file mode 100644 index 0000000..dd575fd --- /dev/null +++ b/lib/Configuration.php @@ -0,0 +1,429 @@ +tempFolderPath = sys_get_temp_dir(); + } + + /** + * Sets API key + * + * @param string $apiKeyIdentifier API key identifier (authentication scheme) + * @param string $key API key or token + * + * @return $this + */ + public function setApiKey($apiKeyIdentifier, $key) + { + $this->apiKeys[$apiKeyIdentifier] = $key; + return $this; + } + + /** + * Gets API key + * + * @param string $apiKeyIdentifier API key identifier (authentication scheme) + * + * @return string API key or token + */ + public function getApiKey($apiKeyIdentifier) + { + return isset($this->apiKeys[$apiKeyIdentifier]) ? $this->apiKeys[$apiKeyIdentifier] : null; + } + + /** + * Sets the prefix for API key (e.g. Bearer) + * + * @param string $apiKeyIdentifier API key identifier (authentication scheme) + * @param string $prefix API key prefix, e.g. Bearer + * + * @return $this + */ + public function setApiKeyPrefix($apiKeyIdentifier, $prefix) + { + $this->apiKeyPrefixes[$apiKeyIdentifier] = $prefix; + return $this; + } + + /** + * Gets API key prefix + * + * @param string $apiKeyIdentifier API key identifier (authentication scheme) + * + * @return string + */ + public function getApiKeyPrefix($apiKeyIdentifier) + { + return isset($this->apiKeyPrefixes[$apiKeyIdentifier]) ? $this->apiKeyPrefixes[$apiKeyIdentifier] : null; + } + + /** + * Sets the access token for OAuth + * + * @param string $accessToken Token for OAuth + * + * @return $this + */ + public function setAccessToken($accessToken) + { + $this->accessToken = $accessToken; + return $this; + } + + /** + * Gets the access token for OAuth + * + * @return string Access token for OAuth + */ + public function getAccessToken() + { + return $this->accessToken; + } + + /** + * Sets the username for HTTP basic authentication + * + * @param string $username Username for HTTP basic authentication + * + * @return $this + */ + public function setUsername($username) + { + $this->username = $username; + return $this; + } + + /** + * Gets the username for HTTP basic authentication + * + * @return string Username for HTTP basic authentication + */ + public function getUsername() + { + return $this->username; + } + + /** + * Sets the password for HTTP basic authentication + * + * @param string $password Password for HTTP basic authentication + * + * @return $this + */ + public function setPassword($password) + { + $this->password = $password; + return $this; + } + + /** + * Gets the password for HTTP basic authentication + * + * @return string Password for HTTP basic authentication + */ + public function getPassword() + { + return $this->password; + } + + /** + * Sets the host + * + * @param string $host Host + * + * @return $this + */ + public function setHost($host) + { + $this->host = $host; + return $this; + } + + /** + * Gets the host + * + * @return string Host + */ + public function getHost() + { + return $this->host; + } + + /** + * Sets the user agent of the api client + * + * @param string $userAgent the user agent of the api client + * + * @throws \InvalidArgumentException + * @return $this + */ + public function setUserAgent($userAgent) + { + if (!is_string($userAgent)) { + throw new \InvalidArgumentException('User-agent must be a string.'); + } + + $this->userAgent = $userAgent; + return $this; + } + + /** + * Gets the user agent of the api client + * + * @return string user agent + */ + public function getUserAgent() + { + return $this->userAgent; + } + + /** + * Sets debug flag + * + * @param bool $debug Debug flag + * + * @return $this + */ + public function setDebug($debug) + { + $this->debug = $debug; + return $this; + } + + /** + * Gets the debug flag + * + * @return bool + */ + public function getDebug() + { + return $this->debug; + } + + /** + * Sets the debug file + * + * @param string $debugFile Debug file + * + * @return $this + */ + public function setDebugFile($debugFile) + { + $this->debugFile = $debugFile; + return $this; + } + + /** + * Gets the debug file + * + * @return string + */ + public function getDebugFile() + { + return $this->debugFile; + } + + /** + * Sets the temp folder path + * + * @param string $tempFolderPath Temp folder path + * + * @return $this + */ + public function setTempFolderPath($tempFolderPath) + { + $this->tempFolderPath = $tempFolderPath; + return $this; + } + + /** + * Gets the temp folder path + * + * @return string Temp folder path + */ + public function getTempFolderPath() + { + return $this->tempFolderPath; + } + + /** + * Gets the default configuration instance + * + * @return Configuration + */ + public static function getDefaultConfiguration() + { + if (self::$defaultConfiguration === null) { + self::$defaultConfiguration = new Configuration(); + } + + return self::$defaultConfiguration; + } + + /** + * Sets the detault configuration instance + * + * @param Configuration $config An instance of the Configuration Object + * + * @return void + */ + public static function setDefaultConfiguration(Configuration $config) + { + self::$defaultConfiguration = $config; + } + + /** + * Gets the essential information for debugging + * + * @return string The report for debugging + */ + public static function toDebugReport() + { + $report = 'PHP SDK (Swagger\Client) Debug Report:' . PHP_EOL; + $report .= ' OS: ' . php_uname() . PHP_EOL; + $report .= ' PHP Version: ' . PHP_VERSION . PHP_EOL; + $report .= ' OpenAPI Spec Version: 2.2.0' . PHP_EOL; + $report .= ' Temp Folder Path: ' . self::getDefaultConfiguration()->getTempFolderPath() . PHP_EOL; + + return $report; + } + + /** + * Get API key (with prefix if set) + * + * @param string $apiKeyIdentifier name of apikey + * + * @return string API key with the prefix + */ + public function getApiKeyWithPrefix($apiKeyIdentifier) + { + $prefix = $this->getApiKeyPrefix($apiKeyIdentifier); + $apiKey = $this->getApiKey($apiKeyIdentifier); + + if ($apiKey === null) { + return null; + } + + if ($prefix === null) { + $keyWithPrefix = $apiKey; + } else { + $keyWithPrefix = $prefix . ' ' . $apiKey; + } + + return $keyWithPrefix; + } +} diff --git a/lib/HeaderSelector.php b/lib/HeaderSelector.php new file mode 100644 index 0000000..467df41 --- /dev/null +++ b/lib/HeaderSelector.php @@ -0,0 +1,110 @@ +selectAcceptHeader($accept); + if ($accept !== null) { + $headers['Accept'] = $accept; + } + + $headers['Content-Type'] = $this->selectContentTypeHeader($contentTypes); + return $headers; + } + + /** + * @param string[] $accept + * @return array + */ + public function selectHeadersForMultipart($accept) + { + $headers = $this->selectHeaders($accept, []); + + unset($headers['Content-Type']); + return $headers; + } + + /** + * Return the header 'Accept' based on an array of Accept provided + * + * @param string[] $accept Array of header + * + * @return string Accept (e.g. application/json) + */ + private function selectAcceptHeader($accept) + { + if (count($accept) === 0 || (count($accept) === 1 && $accept[0] === '')) { + return null; + } elseif (preg_grep("/application\/json/i", $accept)) { + return 'application/json'; + } else { + return implode(',', $accept); + } + } + + /** + * Return the content type based on an array of content-type provided + * + * @param string[] $contentType Array fo content-type + * + * @return string Content-Type (e.g. application/json) + */ + private function selectContentTypeHeader($contentType) + { + if (count($contentType) === 0 || (count($contentType) === 1 && $contentType[0] === '')) { + return 'application/json'; + } elseif (preg_grep("/application\/json/i", $contentType)) { + return 'application/json'; + } else { + return implode(',', $contentType); + } + } +} + diff --git a/lib/Model/AccessIdentifier.php b/lib/Model/AccessIdentifier.php new file mode 100644 index 0000000..194d4dc --- /dev/null +++ b/lib/Model/AccessIdentifier.php @@ -0,0 +1,481 @@ + 'int', + 'caption' => 'string', + 'enabled' => 'bool', + 'locationsIds' => 'int[]', + 'clientAppsIds' => 'int[]', + 'locations' => '\Swagger\Client\Model\Location[]', + 'clientApps' => '\Swagger\Client\Model\ClientApp[]' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $swaggerFormats = [ + 'id' => null, + 'caption' => null, + 'enabled' => null, + 'locationsIds' => null, + 'clientAppsIds' => null, + 'locations' => null, + 'clientApps' => null + ]; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function swaggerTypes() + { + return self::$swaggerTypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function swaggerFormats() + { + return self::$swaggerFormats; + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'id' => 'id', + 'caption' => 'caption', + 'enabled' => 'enabled', + 'locationsIds' => 'locationsIds', + 'clientAppsIds' => 'clientAppsIds', + 'locations' => 'locations', + 'clientApps' => 'clientApps' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'id' => 'setId', + 'caption' => 'setCaption', + 'enabled' => 'setEnabled', + 'locationsIds' => 'setLocationsIds', + 'clientAppsIds' => 'setClientAppsIds', + 'locations' => 'setLocations', + 'clientApps' => 'setClientApps' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'id' => 'getId', + 'caption' => 'getCaption', + 'enabled' => 'getEnabled', + 'locationsIds' => 'getLocationsIds', + 'clientAppsIds' => 'getClientAppsIds', + 'locations' => 'getLocations', + 'clientApps' => 'getClientApps' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$swaggerModelName; + } + + + + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->container['id'] = isset($data['id']) ? $data['id'] : null; + $this->container['caption'] = isset($data['caption']) ? $data['caption'] : null; + $this->container['enabled'] = isset($data['enabled']) ? $data['enabled'] : null; + $this->container['locationsIds'] = isset($data['locationsIds']) ? $data['locationsIds'] : null; + $this->container['clientAppsIds'] = isset($data['clientAppsIds']) ? $data['clientAppsIds'] : null; + $this->container['locations'] = isset($data['locations']) ? $data['locations'] : null; + $this->container['clientApps'] = isset($data['clientApps']) ? $data['clientApps'] : null; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets id + * + * @return int + */ + public function getId() + { + return $this->container['id']; + } + + /** + * Sets id + * + * @param int $id Access Identifier identifier + * + * @return $this + */ + public function setId($id) + { + $this->container['id'] = $id; + + return $this; + } + + /** + * Gets caption + * + * @return string + */ + public function getCaption() + { + return $this->container['caption']; + } + + /** + * Sets caption + * + * @param string $caption Location caption + * + * @return $this + */ + public function setCaption($caption) + { + $this->container['caption'] = $caption; + + return $this; + } + + /** + * Gets enabled + * + * @return bool + */ + public function getEnabled() + { + return $this->container['enabled']; + } + + /** + * Sets enabled + * + * @param bool $enabled `true` if the location is enabled, `false` otherwise + * + * @return $this + */ + public function setEnabled($enabled) + { + $this->container['enabled'] = $enabled; + + return $this; + } + + /** + * Gets locationsIds + * + * @return int[] + */ + public function getLocationsIds() + { + return $this->container['locationsIds']; + } + + /** + * Sets locationsIds + * + * @param int[] $locationsIds array containing the location idenfifiers assigned to this access ID + * + * @return $this + */ + public function setLocationsIds($locationsIds) + { + $this->container['locationsIds'] = $locationsIds; + + return $this; + } + + /** + * Gets clientAppsIds + * + * @return int[] + */ + public function getClientAppsIds() + { + return $this->container['clientAppsIds']; + } + + /** + * Sets clientAppsIds + * + * @param int[] $clientAppsIds array containing the client apps idenfifiers assigned to this access ID + * + * @return $this + */ + public function setClientAppsIds($clientAppsIds) + { + $this->container['clientAppsIds'] = $clientAppsIds; + + return $this; + } + + /** + * Gets locations + * + * @return \Swagger\Client\Model\Location[] + */ + public function getLocations() + { + return $this->container['locations']; + } + + /** + * Sets locations + * + * @param \Swagger\Client\Model\Location[] $locations Returned only if requested by the `include` parameter. + * + * @return $this + */ + public function setLocations($locations) + { + $this->container['locations'] = $locations; + + return $this; + } + + /** + * Gets clientApps + * + * @return \Swagger\Client\Model\ClientApp[] + */ + public function getClientApps() + { + return $this->container['clientApps']; + } + + /** + * Sets clientApps + * + * @param \Swagger\Client\Model\ClientApp[] $clientApps Returned only if requested by the `include` parameter. + * + * @return $this + */ + public function setClientApps($clientApps) + { + $this->container['clientApps'] = $clientApps; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset) + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed + */ + public function offsetGet($offset) + { + return isset($this->container[$offset]) ? $this->container[$offset] : null; + } + + /** + * Sets value based on offset. + * + * @param integer $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value) + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset) + { + unset($this->container[$offset]); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/lib/Model/AccessIdentifierUpdateRequest.php b/lib/Model/AccessIdentifierUpdateRequest.php new file mode 100644 index 0000000..b7c17c2 --- /dev/null +++ b/lib/Model/AccessIdentifierUpdateRequest.php @@ -0,0 +1,421 @@ + 'bool', + 'caption' => 'string', + 'password' => 'string', + 'locationsIds' => 'int[]', + 'clientAppsIds' => 'int[]' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $swaggerFormats = [ + 'enabled' => null, + 'caption' => null, + 'password' => null, + 'locationsIds' => null, + 'clientAppsIds' => null + ]; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function swaggerTypes() + { + return self::$swaggerTypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function swaggerFormats() + { + return self::$swaggerFormats; + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'enabled' => 'enabled', + 'caption' => 'caption', + 'password' => 'password', + 'locationsIds' => 'locationsIds', + 'clientAppsIds' => 'clientAppsIds' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'enabled' => 'setEnabled', + 'caption' => 'setCaption', + 'password' => 'setPassword', + 'locationsIds' => 'setLocationsIds', + 'clientAppsIds' => 'setClientAppsIds' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'enabled' => 'getEnabled', + 'caption' => 'getCaption', + 'password' => 'getPassword', + 'locationsIds' => 'getLocationsIds', + 'clientAppsIds' => 'getClientAppsIds' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$swaggerModelName; + } + + + + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->container['enabled'] = isset($data['enabled']) ? $data['enabled'] : null; + $this->container['caption'] = isset($data['caption']) ? $data['caption'] : null; + $this->container['password'] = isset($data['password']) ? $data['password'] : null; + $this->container['locationsIds'] = isset($data['locationsIds']) ? $data['locationsIds'] : null; + $this->container['clientAppsIds'] = isset($data['clientAppsIds']) ? $data['clientAppsIds'] : null; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets enabled + * + * @return bool + */ + public function getEnabled() + { + return $this->container['enabled']; + } + + /** + * Sets enabled + * + * @param bool $enabled enabled + * + * @return $this + */ + public function setEnabled($enabled) + { + $this->container['enabled'] = $enabled; + + return $this; + } + + /** + * Gets caption + * + * @return string + */ + public function getCaption() + { + return $this->container['caption']; + } + + /** + * Sets caption + * + * @param string $caption caption + * + * @return $this + */ + public function setCaption($caption) + { + $this->container['caption'] = $caption; + + return $this; + } + + /** + * Gets password + * + * @return string + */ + public function getPassword() + { + return $this->container['password']; + } + + /** + * Sets password + * + * @param string $password Provide new password if you want to change it. + * + * @return $this + */ + public function setPassword($password) + { + $this->container['password'] = $password; + + return $this; + } + + /** + * Gets locationsIds + * + * @return int[] + */ + public function getLocationsIds() + { + return $this->container['locationsIds']; + } + + /** + * Sets locationsIds + * + * @param int[] $locationsIds Locations identifiers to assign to this Access Identifier. + * + * @return $this + */ + public function setLocationsIds($locationsIds) + { + $this->container['locationsIds'] = $locationsIds; + + return $this; + } + + /** + * Gets clientAppsIds + * + * @return int[] + */ + public function getClientAppsIds() + { + return $this->container['clientAppsIds']; + } + + /** + * Sets clientAppsIds + * + * @param int[] $clientAppsIds Client Apps identifiers to assign to this Access Identifier. If client app is connected to any other Client ID, it will be disconnected from the old one before assigning. + * + * @return $this + */ + public function setClientAppsIds($clientAppsIds) + { + $this->container['clientAppsIds'] = $clientAppsIds; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset) + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed + */ + public function offsetGet($offset) + { + return isset($this->container[$offset]) ? $this->container[$offset] : null; + } + + /** + * Sets value based on offset. + * + * @param integer $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value) + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset) + { + unset($this->container[$offset]); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/lib/Model/Channel.php b/lib/Model/Channel.php new file mode 100644 index 0000000..0ce3001 --- /dev/null +++ b/lib/Model/Channel.php @@ -0,0 +1,841 @@ + 'int', + 'channelNumber' => 'int', + 'caption' => 'string', + 'type' => '\Swagger\Client\Model\ChannelType', + 'function' => '\Swagger\Client\Model\ChannelFunction', + 'param1' => '\Swagger\Client\Model\ChannelParam', + 'param2' => '\Swagger\Client\Model\ChannelParam', + 'param3' => '\Swagger\Client\Model\ChannelParam', + 'altIcon' => 'int', + 'hidden' => 'bool', + 'inheritedLocation' => 'bool', + 'iodeviceId' => 'int', + 'locationId' => 'int', + 'functionId' => 'int', + 'typeId' => 'int', + 'iodevice' => '\Swagger\Client\Model\Device', + 'location' => '\Swagger\Client\Model\Location', + 'connected' => 'bool', + 'supportedFunctions' => '\Swagger\Client\Model\ChannelFunction[]' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $swaggerFormats = [ + 'id' => null, + 'channelNumber' => null, + 'caption' => null, + 'type' => null, + 'function' => null, + 'param1' => null, + 'param2' => null, + 'param3' => null, + 'altIcon' => null, + 'hidden' => null, + 'inheritedLocation' => null, + 'iodeviceId' => null, + 'locationId' => null, + 'functionId' => null, + 'typeId' => null, + 'iodevice' => null, + 'location' => null, + 'connected' => null, + 'supportedFunctions' => null + ]; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function swaggerTypes() + { + return self::$swaggerTypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function swaggerFormats() + { + return self::$swaggerFormats; + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'id' => 'id', + 'channelNumber' => 'channelNumber', + 'caption' => 'caption', + 'type' => 'type', + 'function' => 'function', + 'param1' => 'param1', + 'param2' => 'param2', + 'param3' => 'param3', + 'altIcon' => 'altIcon', + 'hidden' => 'hidden', + 'inheritedLocation' => 'inheritedLocation', + 'iodeviceId' => 'iodeviceId', + 'locationId' => 'locationId', + 'functionId' => 'functionId', + 'typeId' => 'typeId', + 'iodevice' => 'iodevice', + 'location' => 'location', + 'connected' => 'connected', + 'supportedFunctions' => 'supportedFunctions' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'id' => 'setId', + 'channelNumber' => 'setChannelNumber', + 'caption' => 'setCaption', + 'type' => 'setType', + 'function' => 'setFunction', + 'param1' => 'setParam1', + 'param2' => 'setParam2', + 'param3' => 'setParam3', + 'altIcon' => 'setAltIcon', + 'hidden' => 'setHidden', + 'inheritedLocation' => 'setInheritedLocation', + 'iodeviceId' => 'setIodeviceId', + 'locationId' => 'setLocationId', + 'functionId' => 'setFunctionId', + 'typeId' => 'setTypeId', + 'iodevice' => 'setIodevice', + 'location' => 'setLocation', + 'connected' => 'setConnected', + 'supportedFunctions' => 'setSupportedFunctions' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'id' => 'getId', + 'channelNumber' => 'getChannelNumber', + 'caption' => 'getCaption', + 'type' => 'getType', + 'function' => 'getFunction', + 'param1' => 'getParam1', + 'param2' => 'getParam2', + 'param3' => 'getParam3', + 'altIcon' => 'getAltIcon', + 'hidden' => 'getHidden', + 'inheritedLocation' => 'getInheritedLocation', + 'iodeviceId' => 'getIodeviceId', + 'locationId' => 'getLocationId', + 'functionId' => 'getFunctionId', + 'typeId' => 'getTypeId', + 'iodevice' => 'getIodevice', + 'location' => 'getLocation', + 'connected' => 'getConnected', + 'supportedFunctions' => 'getSupportedFunctions' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$swaggerModelName; + } + + + + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->container['id'] = isset($data['id']) ? $data['id'] : null; + $this->container['channelNumber'] = isset($data['channelNumber']) ? $data['channelNumber'] : null; + $this->container['caption'] = isset($data['caption']) ? $data['caption'] : null; + $this->container['type'] = isset($data['type']) ? $data['type'] : null; + $this->container['function'] = isset($data['function']) ? $data['function'] : null; + $this->container['param1'] = isset($data['param1']) ? $data['param1'] : null; + $this->container['param2'] = isset($data['param2']) ? $data['param2'] : null; + $this->container['param3'] = isset($data['param3']) ? $data['param3'] : null; + $this->container['altIcon'] = isset($data['altIcon']) ? $data['altIcon'] : null; + $this->container['hidden'] = isset($data['hidden']) ? $data['hidden'] : null; + $this->container['inheritedLocation'] = isset($data['inheritedLocation']) ? $data['inheritedLocation'] : null; + $this->container['iodeviceId'] = isset($data['iodeviceId']) ? $data['iodeviceId'] : null; + $this->container['locationId'] = isset($data['locationId']) ? $data['locationId'] : null; + $this->container['functionId'] = isset($data['functionId']) ? $data['functionId'] : null; + $this->container['typeId'] = isset($data['typeId']) ? $data['typeId'] : null; + $this->container['iodevice'] = isset($data['iodevice']) ? $data['iodevice'] : null; + $this->container['location'] = isset($data['location']) ? $data['location'] : null; + $this->container['connected'] = isset($data['connected']) ? $data['connected'] : null; + $this->container['supportedFunctions'] = isset($data['supportedFunctions']) ? $data['supportedFunctions'] : null; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets id + * + * @return int + */ + public function getId() + { + return $this->container['id']; + } + + /** + * Sets id + * + * @param int $id Channel identifier + * + * @return $this + */ + public function setId($id) + { + $this->container['id'] = $id; + + return $this; + } + + /** + * Gets channelNumber + * + * @return int + */ + public function getChannelNumber() + { + return $this->container['channelNumber']; + } + + /** + * Sets channelNumber + * + * @param int $channelNumber Channel ordinal number in its IO Device + * + * @return $this + */ + public function setChannelNumber($channelNumber) + { + $this->container['channelNumber'] = $channelNumber; + + return $this; + } + + /** + * Gets caption + * + * @return string + */ + public function getCaption() + { + return $this->container['caption']; + } + + /** + * Sets caption + * + * @param string $caption Channel caption + * + * @return $this + */ + public function setCaption($caption) + { + $this->container['caption'] = $caption; + + return $this; + } + + /** + * Gets type + * + * @return \Swagger\Client\Model\ChannelType + */ + public function getType() + { + return $this->container['type']; + } + + /** + * Sets type + * + * @param \Swagger\Client\Model\ChannelType $type type + * + * @return $this + */ + public function setType($type) + { + $this->container['type'] = $type; + + return $this; + } + + /** + * Gets function + * + * @return \Swagger\Client\Model\ChannelFunction + */ + public function getFunction() + { + return $this->container['function']; + } + + /** + * Sets function + * + * @param \Swagger\Client\Model\ChannelFunction $function function + * + * @return $this + */ + public function setFunction($function) + { + $this->container['function'] = $function; + + return $this; + } + + /** + * Gets param1 + * + * @return \Swagger\Client\Model\ChannelParam + */ + public function getParam1() + { + return $this->container['param1']; + } + + /** + * Sets param1 + * + * @param \Swagger\Client\Model\ChannelParam $param1 param1 + * + * @return $this + */ + public function setParam1($param1) + { + $this->container['param1'] = $param1; + + return $this; + } + + /** + * Gets param2 + * + * @return \Swagger\Client\Model\ChannelParam + */ + public function getParam2() + { + return $this->container['param2']; + } + + /** + * Sets param2 + * + * @param \Swagger\Client\Model\ChannelParam $param2 param2 + * + * @return $this + */ + public function setParam2($param2) + { + $this->container['param2'] = $param2; + + return $this; + } + + /** + * Gets param3 + * + * @return \Swagger\Client\Model\ChannelParam + */ + public function getParam3() + { + return $this->container['param3']; + } + + /** + * Sets param3 + * + * @param \Swagger\Client\Model\ChannelParam $param3 param3 + * + * @return $this + */ + public function setParam3($param3) + { + $this->container['param3'] = $param3; + + return $this; + } + + /** + * Gets altIcon + * + * @return int + */ + public function getAltIcon() + { + return $this->container['altIcon']; + } + + /** + * Sets altIcon + * + * @param int $altIcon Chosen alternative icon idenifier. Should not be greater than `funciton.maxAlternativeIconIndex` + * + * @return $this + */ + public function setAltIcon($altIcon) + { + $this->container['altIcon'] = $altIcon; + + return $this; + } + + /** + * Gets hidden + * + * @return bool + */ + public function getHidden() + { + return $this->container['hidden']; + } + + /** + * Sets hidden + * + * @param bool $hidden Whether this channel is shown on client apps or not + * + * @return $this + */ + public function setHidden($hidden) + { + $this->container['hidden'] = $hidden; + + return $this; + } + + /** + * Gets inheritedLocation + * + * @return bool + */ + public function getInheritedLocation() + { + return $this->container['inheritedLocation']; + } + + /** + * Sets inheritedLocation + * + * @param bool $inheritedLocation Whether this channel inherits its IO Device's location (`true`) or not (`false`) + * + * @return $this + */ + public function setInheritedLocation($inheritedLocation) + { + $this->container['inheritedLocation'] = $inheritedLocation; + + return $this; + } + + /** + * Gets iodeviceId + * + * @return int + */ + public function getIodeviceId() + { + return $this->container['iodeviceId']; + } + + /** + * Sets iodeviceId + * + * @param int $iodeviceId iodeviceId + * + * @return $this + */ + public function setIodeviceId($iodeviceId) + { + $this->container['iodeviceId'] = $iodeviceId; + + return $this; + } + + /** + * Gets locationId + * + * @return int + */ + public function getLocationId() + { + return $this->container['locationId']; + } + + /** + * Sets locationId + * + * @param int $locationId locationId + * + * @return $this + */ + public function setLocationId($locationId) + { + $this->container['locationId'] = $locationId; + + return $this; + } + + /** + * Gets functionId + * + * @return int + */ + public function getFunctionId() + { + return $this->container['functionId']; + } + + /** + * Sets functionId + * + * @param int $functionId functionId + * + * @return $this + */ + public function setFunctionId($functionId) + { + $this->container['functionId'] = $functionId; + + return $this; + } + + /** + * Gets typeId + * + * @return int + */ + public function getTypeId() + { + return $this->container['typeId']; + } + + /** + * Sets typeId + * + * @param int $typeId typeId + * + * @return $this + */ + public function setTypeId($typeId) + { + $this->container['typeId'] = $typeId; + + return $this; + } + + /** + * Gets iodevice + * + * @return \Swagger\Client\Model\Device + */ + public function getIodevice() + { + return $this->container['iodevice']; + } + + /** + * Sets iodevice + * + * @param \Swagger\Client\Model\Device $iodevice iodevice + * + * @return $this + */ + public function setIodevice($iodevice) + { + $this->container['iodevice'] = $iodevice; + + return $this; + } + + /** + * Gets location + * + * @return \Swagger\Client\Model\Location + */ + public function getLocation() + { + return $this->container['location']; + } + + /** + * Sets location + * + * @param \Swagger\Client\Model\Location $location location + * + * @return $this + */ + public function setLocation($location) + { + $this->container['location'] = $location; + + return $this; + } + + /** + * Gets connected + * + * @return bool + */ + public function getConnected() + { + return $this->container['connected']; + } + + /** + * Sets connected + * + * @param bool $connected connected + * + * @return $this + */ + public function setConnected($connected) + { + $this->container['connected'] = $connected; + + return $this; + } + + /** + * Gets supportedFunctions + * + * @return \Swagger\Client\Model\ChannelFunction[] + */ + public function getSupportedFunctions() + { + return $this->container['supportedFunctions']; + } + + /** + * Sets supportedFunctions + * + * @param \Swagger\Client\Model\ChannelFunction[] $supportedFunctions supportedFunctions + * + * @return $this + */ + public function setSupportedFunctions($supportedFunctions) + { + $this->container['supportedFunctions'] = $supportedFunctions; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset) + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed + */ + public function offsetGet($offset) + { + return isset($this->container[$offset]) ? $this->container[$offset] : null; + } + + /** + * Sets value based on offset. + * + * @param integer $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value) + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset) + { + unset($this->container[$offset]); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/lib/Model/ChannelActionExecutionFailedResponse.php b/lib/Model/ChannelActionExecutionFailedResponse.php new file mode 100644 index 0000000..2a369b3 --- /dev/null +++ b/lib/Model/ChannelActionExecutionFailedResponse.php @@ -0,0 +1,331 @@ + 'int', + 'message' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $swaggerFormats = [ + 'status' => null, + 'message' => null + ]; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function swaggerTypes() + { + return self::$swaggerTypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function swaggerFormats() + { + return self::$swaggerFormats; + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'status' => 'status', + 'message' => 'message' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'status' => 'setStatus', + 'message' => 'setMessage' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'status' => 'getStatus', + 'message' => 'getMessage' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$swaggerModelName; + } + + + + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->container['status'] = isset($data['status']) ? $data['status'] : null; + $this->container['message'] = isset($data['message']) ? $data['message'] : null; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets status + * + * @return int + */ + public function getStatus() + { + return $this->container['status']; + } + + /** + * Sets status + * + * @param int $status status + * + * @return $this + */ + public function setStatus($status) + { + $this->container['status'] = $status; + + return $this; + } + + /** + * Gets message + * + * @return string + */ + public function getMessage() + { + return $this->container['message']; + } + + /** + * Sets message + * + * @param string $message message + * + * @return $this + */ + public function setMessage($message) + { + $this->container['message'] = $message; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset) + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed + */ + public function offsetGet($offset) + { + return isset($this->container[$offset]) ? $this->container[$offset] : null; + } + + /** + * Sets value based on offset. + * + * @param integer $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value) + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset) + { + unset($this->container[$offset]); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/lib/Model/ChannelExecuteActionRequest.php b/lib/Model/ChannelExecuteActionRequest.php new file mode 100644 index 0000000..71e6f69 --- /dev/null +++ b/lib/Model/ChannelExecuteActionRequest.php @@ -0,0 +1,424 @@ + '\Swagger\Client\Model\ChannelFunctionActionEnum', + 'percentage' => 'int', + 'color' => 'string', + 'colorBrightness' => 'int', + 'brightness' => 'int' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $swaggerFormats = [ + 'action' => null, + 'percentage' => null, + 'color' => null, + 'colorBrightness' => null, + 'brightness' => null + ]; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function swaggerTypes() + { + return self::$swaggerTypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function swaggerFormats() + { + return self::$swaggerFormats; + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'action' => 'action', + 'percentage' => 'percentage', + 'color' => 'color', + 'colorBrightness' => 'color_brightness', + 'brightness' => 'brightness' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'action' => 'setAction', + 'percentage' => 'setPercentage', + 'color' => 'setColor', + 'colorBrightness' => 'setColorBrightness', + 'brightness' => 'setBrightness' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'action' => 'getAction', + 'percentage' => 'getPercentage', + 'color' => 'getColor', + 'colorBrightness' => 'getColorBrightness', + 'brightness' => 'getBrightness' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$swaggerModelName; + } + + + + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->container['action'] = isset($data['action']) ? $data['action'] : null; + $this->container['percentage'] = isset($data['percentage']) ? $data['percentage'] : null; + $this->container['color'] = isset($data['color']) ? $data['color'] : null; + $this->container['colorBrightness'] = isset($data['colorBrightness']) ? $data['colorBrightness'] : null; + $this->container['brightness'] = isset($data['brightness']) ? $data['brightness'] : null; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['action'] === null) { + $invalidProperties[] = "'action' can't be null"; + } + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets action + * + * @return \Swagger\Client\Model\ChannelFunctionActionEnum + */ + public function getAction() + { + return $this->container['action']; + } + + /** + * Sets action + * + * @param \Swagger\Client\Model\ChannelFunctionActionEnum $action action + * + * @return $this + */ + public function setAction($action) + { + $this->container['action'] = $action; + + return $this; + } + + /** + * Gets percentage + * + * @return int + */ + public function getPercentage() + { + return $this->container['percentage']; + } + + /** + * Sets percentage + * + * @param int $percentage percentage + * + * @return $this + */ + public function setPercentage($percentage) + { + $this->container['percentage'] = $percentage; + + return $this; + } + + /** + * Gets color + * + * @return string + */ + public function getColor() + { + return $this->container['color']; + } + + /** + * Sets color + * + * @param string $color color + * + * @return $this + */ + public function setColor($color) + { + $this->container['color'] = $color; + + return $this; + } + + /** + * Gets colorBrightness + * + * @return int + */ + public function getColorBrightness() + { + return $this->container['colorBrightness']; + } + + /** + * Sets colorBrightness + * + * @param int $colorBrightness colorBrightness + * + * @return $this + */ + public function setColorBrightness($colorBrightness) + { + $this->container['colorBrightness'] = $colorBrightness; + + return $this; + } + + /** + * Gets brightness + * + * @return int + */ + public function getBrightness() + { + return $this->container['brightness']; + } + + /** + * Sets brightness + * + * @param int $brightness brightness + * + * @return $this + */ + public function setBrightness($brightness) + { + $this->container['brightness'] = $brightness; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset) + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed + */ + public function offsetGet($offset) + { + return isset($this->container[$offset]) ? $this->container[$offset] : null; + } + + /** + * Sets value based on offset. + * + * @param integer $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value) + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset) + { + unset($this->container[$offset]); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/lib/Model/ChannelFunction.php b/lib/Model/ChannelFunction.php new file mode 100644 index 0000000..8a7f0f6 --- /dev/null +++ b/lib/Model/ChannelFunction.php @@ -0,0 +1,421 @@ + 'int', + 'name' => '\Swagger\Client\Model\ChannelFunctionEnumNames', + 'caption' => 'string', + 'maxAlternativeIconIndex' => 'int', + 'possibleActions' => '\Swagger\Client\Model\ChannelFunctionAction[]' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $swaggerFormats = [ + 'id' => null, + 'name' => null, + 'caption' => null, + 'maxAlternativeIconIndex' => null, + 'possibleActions' => null + ]; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function swaggerTypes() + { + return self::$swaggerTypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function swaggerFormats() + { + return self::$swaggerFormats; + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'id' => 'id', + 'name' => 'name', + 'caption' => 'caption', + 'maxAlternativeIconIndex' => 'maxAlternativeIconIndex', + 'possibleActions' => 'possibleActions' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'id' => 'setId', + 'name' => 'setName', + 'caption' => 'setCaption', + 'maxAlternativeIconIndex' => 'setMaxAlternativeIconIndex', + 'possibleActions' => 'setPossibleActions' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'id' => 'getId', + 'name' => 'getName', + 'caption' => 'getCaption', + 'maxAlternativeIconIndex' => 'getMaxAlternativeIconIndex', + 'possibleActions' => 'getPossibleActions' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$swaggerModelName; + } + + + + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->container['id'] = isset($data['id']) ? $data['id'] : null; + $this->container['name'] = isset($data['name']) ? $data['name'] : null; + $this->container['caption'] = isset($data['caption']) ? $data['caption'] : null; + $this->container['maxAlternativeIconIndex'] = isset($data['maxAlternativeIconIndex']) ? $data['maxAlternativeIconIndex'] : null; + $this->container['possibleActions'] = isset($data['possibleActions']) ? $data['possibleActions'] : null; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets id + * + * @return int + */ + public function getId() + { + return $this->container['id']; + } + + /** + * Sets id + * + * @param int $id id + * + * @return $this + */ + public function setId($id) + { + $this->container['id'] = $id; + + return $this; + } + + /** + * Gets name + * + * @return \Swagger\Client\Model\ChannelFunctionEnumNames + */ + public function getName() + { + return $this->container['name']; + } + + /** + * Sets name + * + * @param \Swagger\Client\Model\ChannelFunctionEnumNames $name name + * + * @return $this + */ + public function setName($name) + { + $this->container['name'] = $name; + + return $this; + } + + /** + * Gets caption + * + * @return string + */ + public function getCaption() + { + return $this->container['caption']; + } + + /** + * Sets caption + * + * @param string $caption caption + * + * @return $this + */ + public function setCaption($caption) + { + $this->container['caption'] = $caption; + + return $this; + } + + /** + * Gets maxAlternativeIconIndex + * + * @return int + */ + public function getMaxAlternativeIconIndex() + { + return $this->container['maxAlternativeIconIndex']; + } + + /** + * Sets maxAlternativeIconIndex + * + * @param int $maxAlternativeIconIndex maxAlternativeIconIndex + * + * @return $this + */ + public function setMaxAlternativeIconIndex($maxAlternativeIconIndex) + { + $this->container['maxAlternativeIconIndex'] = $maxAlternativeIconIndex; + + return $this; + } + + /** + * Gets possibleActions + * + * @return \Swagger\Client\Model\ChannelFunctionAction[] + */ + public function getPossibleActions() + { + return $this->container['possibleActions']; + } + + /** + * Sets possibleActions + * + * @param \Swagger\Client\Model\ChannelFunctionAction[] $possibleActions What can you with with this channel? + * + * @return $this + */ + public function setPossibleActions($possibleActions) + { + $this->container['possibleActions'] = $possibleActions; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset) + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed + */ + public function offsetGet($offset) + { + return isset($this->container[$offset]) ? $this->container[$offset] : null; + } + + /** + * Sets value based on offset. + * + * @param integer $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value) + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset) + { + unset($this->container[$offset]); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/lib/Model/ChannelFunctionAction.php b/lib/Model/ChannelFunctionAction.php new file mode 100644 index 0000000..5ebeef7 --- /dev/null +++ b/lib/Model/ChannelFunctionAction.php @@ -0,0 +1,361 @@ + 'int', + 'name' => '\Swagger\Client\Model\ChannelFunctionActionEnum', + 'caption' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $swaggerFormats = [ + 'id' => null, + 'name' => null, + 'caption' => null + ]; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function swaggerTypes() + { + return self::$swaggerTypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function swaggerFormats() + { + return self::$swaggerFormats; + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'id' => 'id', + 'name' => 'name', + 'caption' => 'caption' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'id' => 'setId', + 'name' => 'setName', + 'caption' => 'setCaption' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'id' => 'getId', + 'name' => 'getName', + 'caption' => 'getCaption' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$swaggerModelName; + } + + + + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->container['id'] = isset($data['id']) ? $data['id'] : null; + $this->container['name'] = isset($data['name']) ? $data['name'] : null; + $this->container['caption'] = isset($data['caption']) ? $data['caption'] : null; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets id + * + * @return int + */ + public function getId() + { + return $this->container['id']; + } + + /** + * Sets id + * + * @param int $id id + * + * @return $this + */ + public function setId($id) + { + $this->container['id'] = $id; + + return $this; + } + + /** + * Gets name + * + * @return \Swagger\Client\Model\ChannelFunctionActionEnum + */ + public function getName() + { + return $this->container['name']; + } + + /** + * Sets name + * + * @param \Swagger\Client\Model\ChannelFunctionActionEnum $name name + * + * @return $this + */ + public function setName($name) + { + $this->container['name'] = $name; + + return $this; + } + + /** + * Gets caption + * + * @return string + */ + public function getCaption() + { + return $this->container['caption']; + } + + /** + * Sets caption + * + * @param string $caption caption + * + * @return $this + */ + public function setCaption($caption) + { + $this->container['caption'] = $caption; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset) + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed + */ + public function offsetGet($offset) + { + return isset($this->container[$offset]) ? $this->container[$offset] : null; + } + + /** + * Sets value based on offset. + * + * @param integer $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value) + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset) + { + unset($this->container[$offset]); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/lib/Model/ChannelFunctionActionEnum.php b/lib/Model/ChannelFunctionActionEnum.php new file mode 100644 index 0000000..ad1a377 --- /dev/null +++ b/lib/Model/ChannelFunctionActionEnum.php @@ -0,0 +1,78 @@ + 'int', + 'hidden' => 'bool', + 'caption' => 'string', + 'function' => '\Swagger\Client\Model\ChannelFunction', + 'functionId' => 'int', + 'locationId' => 'int', + 'location' => '\Swagger\Client\Model\Location', + 'channelIds' => 'int[]', + 'channels' => '\Swagger\Client\Model\Channel[]', + 'altIcon' => 'int' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $swaggerFormats = [ + 'id' => null, + 'hidden' => null, + 'caption' => null, + 'function' => null, + 'functionId' => null, + 'locationId' => null, + 'location' => null, + 'channelIds' => null, + 'channels' => null, + 'altIcon' => null + ]; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function swaggerTypes() + { + return self::$swaggerTypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function swaggerFormats() + { + return self::$swaggerFormats; + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'id' => 'id', + 'hidden' => 'hidden', + 'caption' => 'caption', + 'function' => 'function', + 'functionId' => 'functionId', + 'locationId' => 'locationId', + 'location' => 'location', + 'channelIds' => 'channelIds', + 'channels' => 'channels', + 'altIcon' => 'altIcon' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'id' => 'setId', + 'hidden' => 'setHidden', + 'caption' => 'setCaption', + 'function' => 'setFunction', + 'functionId' => 'setFunctionId', + 'locationId' => 'setLocationId', + 'location' => 'setLocation', + 'channelIds' => 'setChannelIds', + 'channels' => 'setChannels', + 'altIcon' => 'setAltIcon' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'id' => 'getId', + 'hidden' => 'getHidden', + 'caption' => 'getCaption', + 'function' => 'getFunction', + 'functionId' => 'getFunctionId', + 'locationId' => 'getLocationId', + 'location' => 'getLocation', + 'channelIds' => 'getChannelIds', + 'channels' => 'getChannels', + 'altIcon' => 'getAltIcon' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$swaggerModelName; + } + + + + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->container['id'] = isset($data['id']) ? $data['id'] : null; + $this->container['hidden'] = isset($data['hidden']) ? $data['hidden'] : null; + $this->container['caption'] = isset($data['caption']) ? $data['caption'] : null; + $this->container['function'] = isset($data['function']) ? $data['function'] : null; + $this->container['functionId'] = isset($data['functionId']) ? $data['functionId'] : null; + $this->container['locationId'] = isset($data['locationId']) ? $data['locationId'] : null; + $this->container['location'] = isset($data['location']) ? $data['location'] : null; + $this->container['channelIds'] = isset($data['channelIds']) ? $data['channelIds'] : null; + $this->container['channels'] = isset($data['channels']) ? $data['channels'] : null; + $this->container['altIcon'] = isset($data['altIcon']) ? $data['altIcon'] : null; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets id + * + * @return int + */ + public function getId() + { + return $this->container['id']; + } + + /** + * Sets id + * + * @param int $id Channel group identifier + * + * @return $this + */ + public function setId($id) + { + $this->container['id'] = $id; + + return $this; + } + + /** + * Gets hidden + * + * @return bool + */ + public function getHidden() + { + return $this->container['hidden']; + } + + /** + * Sets hidden + * + * @param bool $hidden Whether this channel group is shown on client apps or not + * + * @return $this + */ + public function setHidden($hidden) + { + $this->container['hidden'] = $hidden; + + return $this; + } + + /** + * Gets caption + * + * @return string + */ + public function getCaption() + { + return $this->container['caption']; + } + + /** + * Sets caption + * + * @param string $caption Channel caption + * + * @return $this + */ + public function setCaption($caption) + { + $this->container['caption'] = $caption; + + return $this; + } + + /** + * Gets function + * + * @return \Swagger\Client\Model\ChannelFunction + */ + public function getFunction() + { + return $this->container['function']; + } + + /** + * Sets function + * + * @param \Swagger\Client\Model\ChannelFunction $function function + * + * @return $this + */ + public function setFunction($function) + { + $this->container['function'] = $function; + + return $this; + } + + /** + * Gets functionId + * + * @return int + */ + public function getFunctionId() + { + return $this->container['functionId']; + } + + /** + * Sets functionId + * + * @param int $functionId functionId + * + * @return $this + */ + public function setFunctionId($functionId) + { + $this->container['functionId'] = $functionId; + + return $this; + } + + /** + * Gets locationId + * + * @return int + */ + public function getLocationId() + { + return $this->container['locationId']; + } + + /** + * Sets locationId + * + * @param int $locationId locationId + * + * @return $this + */ + public function setLocationId($locationId) + { + $this->container['locationId'] = $locationId; + + return $this; + } + + /** + * Gets location + * + * @return \Swagger\Client\Model\Location + */ + public function getLocation() + { + return $this->container['location']; + } + + /** + * Sets location + * + * @param \Swagger\Client\Model\Location $location location + * + * @return $this + */ + public function setLocation($location) + { + $this->container['location'] = $location; + + return $this; + } + + /** + * Gets channelIds + * + * @return int[] + */ + public function getChannelIds() + { + return $this->container['channelIds']; + } + + /** + * Sets channelIds + * + * @param int[] $channelIds channelIds + * + * @return $this + */ + public function setChannelIds($channelIds) + { + $this->container['channelIds'] = $channelIds; + + return $this; + } + + /** + * Gets channels + * + * @return \Swagger\Client\Model\Channel[] + */ + public function getChannels() + { + return $this->container['channels']; + } + + /** + * Sets channels + * + * @param \Swagger\Client\Model\Channel[] $channels Returned only if requested by the `include` parameter. + * + * @return $this + */ + public function setChannels($channels) + { + $this->container['channels'] = $channels; + + return $this; + } + + /** + * Gets altIcon + * + * @return int + */ + public function getAltIcon() + { + return $this->container['altIcon']; + } + + /** + * Sets altIcon + * + * @param int $altIcon Chosen alternative icon idenifier. Should not be greater than `funciton.maxAlternativeIconIndex` + * + * @return $this + */ + public function setAltIcon($altIcon) + { + $this->container['altIcon'] = $altIcon; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset) + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed + */ + public function offsetGet($offset) + { + return isset($this->container[$offset]) ? $this->container[$offset] : null; + } + + /** + * Sets value based on offset. + * + * @param integer $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value) + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset) + { + unset($this->container[$offset]); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/lib/Model/ChannelGroupRequest.php b/lib/Model/ChannelGroupRequest.php new file mode 100644 index 0000000..d8af48d --- /dev/null +++ b/lib/Model/ChannelGroupRequest.php @@ -0,0 +1,424 @@ + 'string', + 'altIcon' => 'int', + 'hidden' => 'bool', + 'locationId' => 'int', + 'channelIds' => 'int[]' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $swaggerFormats = [ + 'caption' => null, + 'altIcon' => null, + 'hidden' => null, + 'locationId' => null, + 'channelIds' => null + ]; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function swaggerTypes() + { + return self::$swaggerTypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function swaggerFormats() + { + return self::$swaggerFormats; + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'caption' => 'caption', + 'altIcon' => 'altIcon', + 'hidden' => 'hidden', + 'locationId' => 'locationId', + 'channelIds' => 'channelIds' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'caption' => 'setCaption', + 'altIcon' => 'setAltIcon', + 'hidden' => 'setHidden', + 'locationId' => 'setLocationId', + 'channelIds' => 'setChannelIds' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'caption' => 'getCaption', + 'altIcon' => 'getAltIcon', + 'hidden' => 'getHidden', + 'locationId' => 'getLocationId', + 'channelIds' => 'getChannelIds' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$swaggerModelName; + } + + + + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->container['caption'] = isset($data['caption']) ? $data['caption'] : null; + $this->container['altIcon'] = isset($data['altIcon']) ? $data['altIcon'] : null; + $this->container['hidden'] = isset($data['hidden']) ? $data['hidden'] : null; + $this->container['locationId'] = isset($data['locationId']) ? $data['locationId'] : null; + $this->container['channelIds'] = isset($data['channelIds']) ? $data['channelIds'] : null; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['channelIds'] === null) { + $invalidProperties[] = "'channelIds' can't be null"; + } + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets caption + * + * @return string + */ + public function getCaption() + { + return $this->container['caption']; + } + + /** + * Sets caption + * + * @param string $caption caption + * + * @return $this + */ + public function setCaption($caption) + { + $this->container['caption'] = $caption; + + return $this; + } + + /** + * Gets altIcon + * + * @return int + */ + public function getAltIcon() + { + return $this->container['altIcon']; + } + + /** + * Sets altIcon + * + * @param int $altIcon altIcon + * + * @return $this + */ + public function setAltIcon($altIcon) + { + $this->container['altIcon'] = $altIcon; + + return $this; + } + + /** + * Gets hidden + * + * @return bool + */ + public function getHidden() + { + return $this->container['hidden']; + } + + /** + * Sets hidden + * + * @param bool $hidden hidden + * + * @return $this + */ + public function setHidden($hidden) + { + $this->container['hidden'] = $hidden; + + return $this; + } + + /** + * Gets locationId + * + * @return int + */ + public function getLocationId() + { + return $this->container['locationId']; + } + + /** + * Sets locationId + * + * @param int $locationId locationId + * + * @return $this + */ + public function setLocationId($locationId) + { + $this->container['locationId'] = $locationId; + + return $this; + } + + /** + * Gets channelIds + * + * @return int[] + */ + public function getChannelIds() + { + return $this->container['channelIds']; + } + + /** + * Sets channelIds + * + * @param int[] $channelIds channelIds + * + * @return $this + */ + public function setChannelIds($channelIds) + { + $this->container['channelIds'] = $channelIds; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset) + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed + */ + public function offsetGet($offset) + { + return isset($this->container[$offset]) ? $this->container[$offset] : null; + } + + /** + * Sets value based on offset. + * + * @param integer $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value) + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset) + { + unset($this->container[$offset]); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/lib/Model/ChannelMeasurementLog.php b/lib/Model/ChannelMeasurementLog.php new file mode 100644 index 0000000..fd73fba --- /dev/null +++ b/lib/Model/ChannelMeasurementLog.php @@ -0,0 +1,361 @@ + 'int', + 'temperature' => 'float', + 'humidity' => 'float' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $swaggerFormats = [ + 'dateTimestamp' => null, + 'temperature' => 'float', + 'humidity' => 'float' + ]; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function swaggerTypes() + { + return self::$swaggerTypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function swaggerFormats() + { + return self::$swaggerFormats; + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'dateTimestamp' => 'date_timestamp', + 'temperature' => 'temperature', + 'humidity' => 'humidity' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'dateTimestamp' => 'setDateTimestamp', + 'temperature' => 'setTemperature', + 'humidity' => 'setHumidity' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'dateTimestamp' => 'getDateTimestamp', + 'temperature' => 'getTemperature', + 'humidity' => 'getHumidity' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$swaggerModelName; + } + + + + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->container['dateTimestamp'] = isset($data['dateTimestamp']) ? $data['dateTimestamp'] : null; + $this->container['temperature'] = isset($data['temperature']) ? $data['temperature'] : null; + $this->container['humidity'] = isset($data['humidity']) ? $data['humidity'] : null; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets dateTimestamp + * + * @return int + */ + public function getDateTimestamp() + { + return $this->container['dateTimestamp']; + } + + /** + * Sets dateTimestamp + * + * @param int $dateTimestamp dateTimestamp + * + * @return $this + */ + public function setDateTimestamp($dateTimestamp) + { + $this->container['dateTimestamp'] = $dateTimestamp; + + return $this; + } + + /** + * Gets temperature + * + * @return float + */ + public function getTemperature() + { + return $this->container['temperature']; + } + + /** + * Sets temperature + * + * @param float $temperature Temperature in Celsius + * + * @return $this + */ + public function setTemperature($temperature) + { + $this->container['temperature'] = $temperature; + + return $this; + } + + /** + * Gets humidity + * + * @return float + */ + public function getHumidity() + { + return $this->container['humidity']; + } + + /** + * Sets humidity + * + * @param float $humidity Humidity percent. Available only if channel function is `HUMIDITYANDTEMPERATURE`. + * + * @return $this + */ + public function setHumidity($humidity) + { + $this->container['humidity'] = $humidity; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset) + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed + */ + public function offsetGet($offset) + { + return isset($this->container[$offset]) ? $this->container[$offset] : null; + } + + /** + * Sets value based on offset. + * + * @param integer $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value) + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset) + { + unset($this->container[$offset]); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/lib/Model/ChannelParam.php b/lib/Model/ChannelParam.php new file mode 100644 index 0000000..6ac1701 --- /dev/null +++ b/lib/Model/ChannelParam.php @@ -0,0 +1,277 @@ +listInvalidProperties()) === 0; + } + + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset) + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed + */ + public function offsetGet($offset) + { + return isset($this->container[$offset]) ? $this->container[$offset] : null; + } + + /** + * Sets value based on offset. + * + * @param integer $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value) + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset) + { + unset($this->container[$offset]); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/lib/Model/ChannelType.php b/lib/Model/ChannelType.php new file mode 100644 index 0000000..a50d047 --- /dev/null +++ b/lib/Model/ChannelType.php @@ -0,0 +1,469 @@ + 'int', + 'name' => 'string', + 'caption' => 'string', + 'output' => 'bool' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $swaggerFormats = [ + 'id' => null, + 'name' => null, + 'caption' => null, + 'output' => null + ]; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function swaggerTypes() + { + return self::$swaggerTypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function swaggerFormats() + { + return self::$swaggerFormats; + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'id' => 'id', + 'name' => 'name', + 'caption' => 'caption', + 'output' => 'output' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'id' => 'setId', + 'name' => 'setName', + 'caption' => 'setCaption', + 'output' => 'setOutput' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'id' => 'getId', + 'name' => 'getName', + 'caption' => 'getCaption', + 'output' => 'getOutput' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$swaggerModelName; + } + + const NAME_SENSORNO = 'SENSORNO'; + const NAME_SENSORNC = 'SENSORNC'; + const NAME_DISTANCESENSOR = 'DISTANCESENSOR'; + const NAME_CALLBUTTON = 'CALLBUTTON'; + const NAME_RELAYHFD4 = 'RELAYHFD4'; + const NAME_RELAYG5_LA1_A = 'RELAYG5LA1A'; + const NAME_RELAY2_XG5_LA1_A = 'RELAY2XG5LA1A'; + const NAME_RELAY = 'RELAY'; + const NAME_THERMOMETERDS18_B20 = 'THERMOMETERDS18B20'; + const NAME_DHT11 = 'DHT11'; + const NAME_DHT21 = 'DHT21'; + const NAME_DHT22 = 'DHT22'; + const NAME_AM2301 = 'AM2301'; + const NAME_AM2302 = 'AM2302'; + const NAME_THERMOMETER = 'THERMOMETER'; + const NAME_HUMIDITYSENSOR = 'HUMIDITYSENSOR'; + const NAME_HUMIDITYANDTEMPSENSOR = 'HUMIDITYANDTEMPSENSOR'; + const NAME_WINDSENSOR = 'WINDSENSOR'; + const NAME_PRESSURESENSOR = 'PRESSURESENSOR'; + const NAME_RAINSENSOR = 'RAINSENSOR'; + const NAME_WEIGHTSENSOR = 'WEIGHTSENSOR'; + const NAME_WEATHER_STATION = 'WEATHER_STATION'; + const NAME_DIMMER = 'DIMMER'; + const NAME_RGBLEDCONTROLLER = 'RGBLEDCONTROLLER'; + const NAME_DIMMERANDRGBLED = 'DIMMERANDRGBLED'; + + + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getNameAllowableValues() + { + return [ + self::NAME_SENSORNO, + self::NAME_SENSORNC, + self::NAME_DISTANCESENSOR, + self::NAME_CALLBUTTON, + self::NAME_RELAYHFD4, + self::NAME_RELAYG5_LA1_A, + self::NAME_RELAY2_XG5_LA1_A, + self::NAME_RELAY, + self::NAME_THERMOMETERDS18_B20, + self::NAME_DHT11, + self::NAME_DHT21, + self::NAME_DHT22, + self::NAME_AM2301, + self::NAME_AM2302, + self::NAME_THERMOMETER, + self::NAME_HUMIDITYSENSOR, + self::NAME_HUMIDITYANDTEMPSENSOR, + self::NAME_WINDSENSOR, + self::NAME_PRESSURESENSOR, + self::NAME_RAINSENSOR, + self::NAME_WEIGHTSENSOR, + self::NAME_WEATHER_STATION, + self::NAME_DIMMER, + self::NAME_RGBLEDCONTROLLER, + self::NAME_DIMMERANDRGBLED, + ]; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->container['id'] = isset($data['id']) ? $data['id'] : null; + $this->container['name'] = isset($data['name']) ? $data['name'] : null; + $this->container['caption'] = isset($data['caption']) ? $data['caption'] : null; + $this->container['output'] = isset($data['output']) ? $data['output'] : null; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + $allowedValues = $this->getNameAllowableValues(); + if (!is_null($this->container['name']) && !in_array($this->container['name'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value for 'name', must be one of '%s'", + implode("', '", $allowedValues) + ); + } + + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets id + * + * @return int + */ + public function getId() + { + return $this->container['id']; + } + + /** + * Sets id + * + * @param int $id Channel type identifier + * + * @return $this + */ + public function setId($id) + { + $this->container['id'] = $id; + + return $this; + } + + /** + * Gets name + * + * @return string + */ + public function getName() + { + return $this->container['name']; + } + + /** + * Sets name + * + * @param string $name name + * + * @return $this + */ + public function setName($name) + { + $allowedValues = $this->getNameAllowableValues(); + if (!is_null($name) && !in_array($name, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value for 'name', must be one of '%s'", + implode("', '", $allowedValues) + ) + ); + } + $this->container['name'] = $name; + + return $this; + } + + /** + * Gets caption + * + * @return string + */ + public function getCaption() + { + return $this->container['caption']; + } + + /** + * Sets caption + * + * @param string $caption caption + * + * @return $this + */ + public function setCaption($caption) + { + $this->container['caption'] = $caption; + + return $this; + } + + /** + * Gets output + * + * @return bool + */ + public function getOutput() + { + return $this->container['output']; + } + + /** + * Sets output + * + * @param bool $output Whether the channel is output type (i.e. can take action) or input (i.e. provide data) + * + * @return $this + */ + public function setOutput($output) + { + $this->container['output'] = $output; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset) + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed + */ + public function offsetGet($offset) + { + return isset($this->container[$offset]) ? $this->container[$offset] : null; + } + + /** + * Sets value based on offset. + * + * @param integer $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value) + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset) + { + unset($this->container[$offset]); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/lib/Model/ChannelUnsupportedFunctionResponse.php b/lib/Model/ChannelUnsupportedFunctionResponse.php new file mode 100644 index 0000000..b421c90 --- /dev/null +++ b/lib/Model/ChannelUnsupportedFunctionResponse.php @@ -0,0 +1,331 @@ + 'int', + 'message' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $swaggerFormats = [ + 'status' => null, + 'message' => null + ]; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function swaggerTypes() + { + return self::$swaggerTypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function swaggerFormats() + { + return self::$swaggerFormats; + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'status' => 'status', + 'message' => 'message' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'status' => 'setStatus', + 'message' => 'setMessage' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'status' => 'getStatus', + 'message' => 'getMessage' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$swaggerModelName; + } + + + + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->container['status'] = isset($data['status']) ? $data['status'] : null; + $this->container['message'] = isset($data['message']) ? $data['message'] : null; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets status + * + * @return int + */ + public function getStatus() + { + return $this->container['status']; + } + + /** + * Sets status + * + * @param int $status status + * + * @return $this + */ + public function setStatus($status) + { + $this->container['status'] = $status; + + return $this; + } + + /** + * Gets message + * + * @return string + */ + public function getMessage() + { + return $this->container['message']; + } + + /** + * Sets message + * + * @param string $message message + * + * @return $this + */ + public function setMessage($message) + { + $this->container['message'] = $message; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset) + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed + */ + public function offsetGet($offset) + { + return isset($this->container[$offset]) ? $this->container[$offset] : null; + } + + /** + * Sets value based on offset. + * + * @param integer $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value) + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset) + { + unset($this->container[$offset]); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/lib/Model/ChannelUpdateConfirmationResponse.php b/lib/Model/ChannelUpdateConfirmationResponse.php new file mode 100644 index 0000000..5c11f06 --- /dev/null +++ b/lib/Model/ChannelUpdateConfirmationResponse.php @@ -0,0 +1,331 @@ + '\Swagger\Client\Model\Schedule[]', + 'groups' => '\Swagger\Client\Model\ChannelGroup[]' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $swaggerFormats = [ + 'schedules' => null, + 'groups' => null + ]; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function swaggerTypes() + { + return self::$swaggerTypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function swaggerFormats() + { + return self::$swaggerFormats; + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'schedules' => 'schedules', + 'groups' => 'groups' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'schedules' => 'setSchedules', + 'groups' => 'setGroups' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'schedules' => 'getSchedules', + 'groups' => 'getGroups' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$swaggerModelName; + } + + + + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->container['schedules'] = isset($data['schedules']) ? $data['schedules'] : null; + $this->container['groups'] = isset($data['groups']) ? $data['groups'] : null; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets schedules + * + * @return \Swagger\Client\Model\Schedule[] + */ + public function getSchedules() + { + return $this->container['schedules']; + } + + /** + * Sets schedules + * + * @param \Swagger\Client\Model\Schedule[] $schedules Schedules that will be deleted after this request. + * + * @return $this + */ + public function setSchedules($schedules) + { + $this->container['schedules'] = $schedules; + + return $this; + } + + /** + * Gets groups + * + * @return \Swagger\Client\Model\ChannelGroup[] + */ + public function getGroups() + { + return $this->container['groups']; + } + + /** + * Sets groups + * + * @param \Swagger\Client\Model\ChannelGroup[] $groups Channel groups that this channel will be removed from after this request. + * + * @return $this + */ + public function setGroups($groups) + { + $this->container['groups'] = $groups; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset) + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed + */ + public function offsetGet($offset) + { + return isset($this->container[$offset]) ? $this->container[$offset] : null; + } + + /** + * Sets value based on offset. + * + * @param integer $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value) + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset) + { + unset($this->container[$offset]); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/lib/Model/ChannelUpdateRequest.php b/lib/Model/ChannelUpdateRequest.php new file mode 100644 index 0000000..b93ea87 --- /dev/null +++ b/lib/Model/ChannelUpdateRequest.php @@ -0,0 +1,541 @@ + 'int', + 'param1' => 'int', + 'param2' => 'int', + 'param3' => 'int', + 'caption' => 'string', + 'altIcon' => 'int', + 'hidden' => 'bool', + 'locationId' => 'int', + 'inheritedLocation' => 'bool' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $swaggerFormats = [ + 'functionId' => null, + 'param1' => null, + 'param2' => null, + 'param3' => null, + 'caption' => null, + 'altIcon' => null, + 'hidden' => null, + 'locationId' => null, + 'inheritedLocation' => null + ]; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function swaggerTypes() + { + return self::$swaggerTypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function swaggerFormats() + { + return self::$swaggerFormats; + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'functionId' => 'functionId', + 'param1' => 'param1', + 'param2' => 'param2', + 'param3' => 'param3', + 'caption' => 'caption', + 'altIcon' => 'altIcon', + 'hidden' => 'hidden', + 'locationId' => 'locationId', + 'inheritedLocation' => 'inheritedLocation' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'functionId' => 'setFunctionId', + 'param1' => 'setParam1', + 'param2' => 'setParam2', + 'param3' => 'setParam3', + 'caption' => 'setCaption', + 'altIcon' => 'setAltIcon', + 'hidden' => 'setHidden', + 'locationId' => 'setLocationId', + 'inheritedLocation' => 'setInheritedLocation' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'functionId' => 'getFunctionId', + 'param1' => 'getParam1', + 'param2' => 'getParam2', + 'param3' => 'getParam3', + 'caption' => 'getCaption', + 'altIcon' => 'getAltIcon', + 'hidden' => 'getHidden', + 'locationId' => 'getLocationId', + 'inheritedLocation' => 'getInheritedLocation' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$swaggerModelName; + } + + + + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->container['functionId'] = isset($data['functionId']) ? $data['functionId'] : null; + $this->container['param1'] = isset($data['param1']) ? $data['param1'] : null; + $this->container['param2'] = isset($data['param2']) ? $data['param2'] : null; + $this->container['param3'] = isset($data['param3']) ? $data['param3'] : null; + $this->container['caption'] = isset($data['caption']) ? $data['caption'] : null; + $this->container['altIcon'] = isset($data['altIcon']) ? $data['altIcon'] : null; + $this->container['hidden'] = isset($data['hidden']) ? $data['hidden'] : null; + $this->container['locationId'] = isset($data['locationId']) ? $data['locationId'] : null; + $this->container['inheritedLocation'] = isset($data['inheritedLocation']) ? $data['inheritedLocation'] : null; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets functionId + * + * @return int + */ + public function getFunctionId() + { + return $this->container['functionId']; + } + + /** + * Sets functionId + * + * @param int $functionId functionId + * + * @return $this + */ + public function setFunctionId($functionId) + { + $this->container['functionId'] = $functionId; + + return $this; + } + + /** + * Gets param1 + * + * @return int + */ + public function getParam1() + { + return $this->container['param1']; + } + + /** + * Sets param1 + * + * @param int $param1 param1 + * + * @return $this + */ + public function setParam1($param1) + { + $this->container['param1'] = $param1; + + return $this; + } + + /** + * Gets param2 + * + * @return int + */ + public function getParam2() + { + return $this->container['param2']; + } + + /** + * Sets param2 + * + * @param int $param2 param2 + * + * @return $this + */ + public function setParam2($param2) + { + $this->container['param2'] = $param2; + + return $this; + } + + /** + * Gets param3 + * + * @return int + */ + public function getParam3() + { + return $this->container['param3']; + } + + /** + * Sets param3 + * + * @param int $param3 param3 + * + * @return $this + */ + public function setParam3($param3) + { + $this->container['param3'] = $param3; + + return $this; + } + + /** + * Gets caption + * + * @return string + */ + public function getCaption() + { + return $this->container['caption']; + } + + /** + * Sets caption + * + * @param string $caption caption + * + * @return $this + */ + public function setCaption($caption) + { + $this->container['caption'] = $caption; + + return $this; + } + + /** + * Gets altIcon + * + * @return int + */ + public function getAltIcon() + { + return $this->container['altIcon']; + } + + /** + * Sets altIcon + * + * @param int $altIcon altIcon + * + * @return $this + */ + public function setAltIcon($altIcon) + { + $this->container['altIcon'] = $altIcon; + + return $this; + } + + /** + * Gets hidden + * + * @return bool + */ + public function getHidden() + { + return $this->container['hidden']; + } + + /** + * Sets hidden + * + * @param bool $hidden hidden + * + * @return $this + */ + public function setHidden($hidden) + { + $this->container['hidden'] = $hidden; + + return $this; + } + + /** + * Gets locationId + * + * @return int + */ + public function getLocationId() + { + return $this->container['locationId']; + } + + /** + * Sets locationId + * + * @param int $locationId locationId + * + * @return $this + */ + public function setLocationId($locationId) + { + $this->container['locationId'] = $locationId; + + return $this; + } + + /** + * Gets inheritedLocation + * + * @return bool + */ + public function getInheritedLocation() + { + return $this->container['inheritedLocation']; + } + + /** + * Sets inheritedLocation + * + * @param bool $inheritedLocation inheritedLocation + * + * @return $this + */ + public function setInheritedLocation($inheritedLocation) + { + $this->container['inheritedLocation'] = $inheritedLocation; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset) + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed + */ + public function offsetGet($offset) + { + return isset($this->container[$offset]) ? $this->container[$offset] : null; + } + + /** + * Sets value based on offset. + * + * @param integer $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value) + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset) + { + unset($this->container[$offset]); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/lib/Model/ClientApp.php b/lib/Model/ClientApp.php new file mode 100644 index 0000000..16a483f --- /dev/null +++ b/lib/Model/ClientApp.php @@ -0,0 +1,661 @@ + 'int', + 'name' => 'string', + 'caption' => 'string', + 'enabled' => 'bool', + 'regIpv4' => 'int', + 'regDate' => '\DateTime', + 'lastAccessIpv4' => 'int', + 'lastAccessDate' => '\DateTime', + 'softwareVersion' => 'string', + 'protocolVersion' => 'int', + 'accessIdId' => 'int', + 'connected' => 'bool', + 'accessId' => '\Swagger\Client\Model\AccessIdentifier' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $swaggerFormats = [ + 'id' => null, + 'name' => null, + 'caption' => null, + 'enabled' => null, + 'regIpv4' => null, + 'regDate' => 'date-time', + 'lastAccessIpv4' => null, + 'lastAccessDate' => 'date-time', + 'softwareVersion' => null, + 'protocolVersion' => null, + 'accessIdId' => null, + 'connected' => null, + 'accessId' => null + ]; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function swaggerTypes() + { + return self::$swaggerTypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function swaggerFormats() + { + return self::$swaggerFormats; + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'id' => 'id', + 'name' => 'name', + 'caption' => 'caption', + 'enabled' => 'enabled', + 'regIpv4' => 'regIpv4', + 'regDate' => 'regDate', + 'lastAccessIpv4' => 'lastAccessIpv4', + 'lastAccessDate' => 'lastAccessDate', + 'softwareVersion' => 'softwareVersion', + 'protocolVersion' => 'protocolVersion', + 'accessIdId' => 'accessIdId', + 'connected' => 'connected', + 'accessId' => 'accessId' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'id' => 'setId', + 'name' => 'setName', + 'caption' => 'setCaption', + 'enabled' => 'setEnabled', + 'regIpv4' => 'setRegIpv4', + 'regDate' => 'setRegDate', + 'lastAccessIpv4' => 'setLastAccessIpv4', + 'lastAccessDate' => 'setLastAccessDate', + 'softwareVersion' => 'setSoftwareVersion', + 'protocolVersion' => 'setProtocolVersion', + 'accessIdId' => 'setAccessIdId', + 'connected' => 'setConnected', + 'accessId' => 'setAccessId' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'id' => 'getId', + 'name' => 'getName', + 'caption' => 'getCaption', + 'enabled' => 'getEnabled', + 'regIpv4' => 'getRegIpv4', + 'regDate' => 'getRegDate', + 'lastAccessIpv4' => 'getLastAccessIpv4', + 'lastAccessDate' => 'getLastAccessDate', + 'softwareVersion' => 'getSoftwareVersion', + 'protocolVersion' => 'getProtocolVersion', + 'accessIdId' => 'getAccessIdId', + 'connected' => 'getConnected', + 'accessId' => 'getAccessId' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$swaggerModelName; + } + + + + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->container['id'] = isset($data['id']) ? $data['id'] : null; + $this->container['name'] = isset($data['name']) ? $data['name'] : null; + $this->container['caption'] = isset($data['caption']) ? $data['caption'] : null; + $this->container['enabled'] = isset($data['enabled']) ? $data['enabled'] : null; + $this->container['regIpv4'] = isset($data['regIpv4']) ? $data['regIpv4'] : null; + $this->container['regDate'] = isset($data['regDate']) ? $data['regDate'] : null; + $this->container['lastAccessIpv4'] = isset($data['lastAccessIpv4']) ? $data['lastAccessIpv4'] : null; + $this->container['lastAccessDate'] = isset($data['lastAccessDate']) ? $data['lastAccessDate'] : null; + $this->container['softwareVersion'] = isset($data['softwareVersion']) ? $data['softwareVersion'] : null; + $this->container['protocolVersion'] = isset($data['protocolVersion']) ? $data['protocolVersion'] : null; + $this->container['accessIdId'] = isset($data['accessIdId']) ? $data['accessIdId'] : null; + $this->container['connected'] = isset($data['connected']) ? $data['connected'] : null; + $this->container['accessId'] = isset($data['accessId']) ? $data['accessId'] : null; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets id + * + * @return int + */ + public function getId() + { + return $this->container['id']; + } + + /** + * Sets id + * + * @param int $id Client application identifier + * + * @return $this + */ + public function setId($id) + { + $this->container['id'] = $id; + + return $this; + } + + /** + * Gets name + * + * @return string + */ + public function getName() + { + return $this->container['name']; + } + + /** + * Sets name + * + * @param string $name name + * + * @return $this + */ + public function setName($name) + { + $this->container['name'] = $name; + + return $this; + } + + /** + * Gets caption + * + * @return string + */ + public function getCaption() + { + return $this->container['caption']; + } + + /** + * Sets caption + * + * @param string $caption caption + * + * @return $this + */ + public function setCaption($caption) + { + $this->container['caption'] = $caption; + + return $this; + } + + /** + * Gets enabled + * + * @return bool + */ + public function getEnabled() + { + return $this->container['enabled']; + } + + /** + * Sets enabled + * + * @param bool $enabled enabled + * + * @return $this + */ + public function setEnabled($enabled) + { + $this->container['enabled'] = $enabled; + + return $this; + } + + /** + * Gets regIpv4 + * + * @return int + */ + public function getRegIpv4() + { + return $this->container['regIpv4']; + } + + /** + * Sets regIpv4 + * + * @param int $regIpv4 regIpv4 + * + * @return $this + */ + public function setRegIpv4($regIpv4) + { + $this->container['regIpv4'] = $regIpv4; + + return $this; + } + + /** + * Gets regDate + * + * @return \DateTime + */ + public function getRegDate() + { + return $this->container['regDate']; + } + + /** + * Sets regDate + * + * @param \DateTime $regDate regDate + * + * @return $this + */ + public function setRegDate($regDate) + { + $this->container['regDate'] = $regDate; + + return $this; + } + + /** + * Gets lastAccessIpv4 + * + * @return int + */ + public function getLastAccessIpv4() + { + return $this->container['lastAccessIpv4']; + } + + /** + * Sets lastAccessIpv4 + * + * @param int $lastAccessIpv4 lastAccessIpv4 + * + * @return $this + */ + public function setLastAccessIpv4($lastAccessIpv4) + { + $this->container['lastAccessIpv4'] = $lastAccessIpv4; + + return $this; + } + + /** + * Gets lastAccessDate + * + * @return \DateTime + */ + public function getLastAccessDate() + { + return $this->container['lastAccessDate']; + } + + /** + * Sets lastAccessDate + * + * @param \DateTime $lastAccessDate lastAccessDate + * + * @return $this + */ + public function setLastAccessDate($lastAccessDate) + { + $this->container['lastAccessDate'] = $lastAccessDate; + + return $this; + } + + /** + * Gets softwareVersion + * + * @return string + */ + public function getSoftwareVersion() + { + return $this->container['softwareVersion']; + } + + /** + * Sets softwareVersion + * + * @param string $softwareVersion softwareVersion + * + * @return $this + */ + public function setSoftwareVersion($softwareVersion) + { + $this->container['softwareVersion'] = $softwareVersion; + + return $this; + } + + /** + * Gets protocolVersion + * + * @return int + */ + public function getProtocolVersion() + { + return $this->container['protocolVersion']; + } + + /** + * Sets protocolVersion + * + * @param int $protocolVersion protocolVersion + * + * @return $this + */ + public function setProtocolVersion($protocolVersion) + { + $this->container['protocolVersion'] = $protocolVersion; + + return $this; + } + + /** + * Gets accessIdId + * + * @return int + */ + public function getAccessIdId() + { + return $this->container['accessIdId']; + } + + /** + * Sets accessIdId + * + * @param int $accessIdId accessIdId + * + * @return $this + */ + public function setAccessIdId($accessIdId) + { + $this->container['accessIdId'] = $accessIdId; + + return $this; + } + + /** + * Gets connected + * + * @return bool + */ + public function getConnected() + { + return $this->container['connected']; + } + + /** + * Sets connected + * + * @param bool $connected connected + * + * @return $this + */ + public function setConnected($connected) + { + $this->container['connected'] = $connected; + + return $this; + } + + /** + * Gets accessId + * + * @return \Swagger\Client\Model\AccessIdentifier + */ + public function getAccessId() + { + return $this->container['accessId']; + } + + /** + * Sets accessId + * + * @param \Swagger\Client\Model\AccessIdentifier $accessId accessId + * + * @return $this + */ + public function setAccessId($accessId) + { + $this->container['accessId'] = $accessId; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset) + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed + */ + public function offsetGet($offset) + { + return isset($this->container[$offset]) ? $this->container[$offset] : null; + } + + /** + * Sets value based on offset. + * + * @param integer $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value) + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset) + { + unset($this->container[$offset]); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/lib/Model/ClientAppUpdateRequest.php b/lib/Model/ClientAppUpdateRequest.php new file mode 100644 index 0000000..50ea17c --- /dev/null +++ b/lib/Model/ClientAppUpdateRequest.php @@ -0,0 +1,361 @@ + 'string', + 'enabled' => 'bool', + 'accessIdId' => 'int' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $swaggerFormats = [ + 'caption' => null, + 'enabled' => null, + 'accessIdId' => null + ]; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function swaggerTypes() + { + return self::$swaggerTypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function swaggerFormats() + { + return self::$swaggerFormats; + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'caption' => 'caption', + 'enabled' => 'enabled', + 'accessIdId' => 'accessIdId' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'caption' => 'setCaption', + 'enabled' => 'setEnabled', + 'accessIdId' => 'setAccessIdId' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'caption' => 'getCaption', + 'enabled' => 'getEnabled', + 'accessIdId' => 'getAccessIdId' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$swaggerModelName; + } + + + + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->container['caption'] = isset($data['caption']) ? $data['caption'] : null; + $this->container['enabled'] = isset($data['enabled']) ? $data['enabled'] : null; + $this->container['accessIdId'] = isset($data['accessIdId']) ? $data['accessIdId'] : null; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets caption + * + * @return string + */ + public function getCaption() + { + return $this->container['caption']; + } + + /** + * Sets caption + * + * @param string $caption caption + * + * @return $this + */ + public function setCaption($caption) + { + $this->container['caption'] = $caption; + + return $this; + } + + /** + * Gets enabled + * + * @return bool + */ + public function getEnabled() + { + return $this->container['enabled']; + } + + /** + * Sets enabled + * + * @param bool $enabled enabled + * + * @return $this + */ + public function setEnabled($enabled) + { + $this->container['enabled'] = $enabled; + + return $this; + } + + /** + * Gets accessIdId + * + * @return int + */ + public function getAccessIdId() + { + return $this->container['accessIdId']; + } + + /** + * Sets accessIdId + * + * @param int $accessIdId accessIdId + * + * @return $this + */ + public function setAccessIdId($accessIdId) + { + $this->container['accessIdId'] = $accessIdId; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset) + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed + */ + public function offsetGet($offset) + { + return isset($this->container[$offset]) ? $this->container[$offset] : null; + } + + /** + * Sets value based on offset. + * + * @param integer $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value) + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset) + { + unset($this->container[$offset]); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/lib/Model/Device.php b/lib/Model/Device.php new file mode 100644 index 0000000..545a426 --- /dev/null +++ b/lib/Model/Device.php @@ -0,0 +1,811 @@ + 'int', + 'name' => 'string', + 'enabled' => 'bool', + 'comment' => 'string', + 'regDate' => '\DateTime', + 'regIpv4' => 'int', + 'lastConnected' => '\DateTime', + 'lastIpv4' => 'int', + 'softwareVersion' => 'string', + 'gUIDString' => 'string', + 'locationId' => 'int', + 'originalLocationId' => 'int', + 'channelsIds' => 'int[]', + 'connected' => 'bool', + 'location' => '\Swagger\Client\Model\Location', + 'originalLocation' => '\Swagger\Client\Model\Location', + 'channels' => '\Swagger\Client\Model\Channel[]', + 'schedules' => '\Swagger\Client\Model\Schedule[]' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $swaggerFormats = [ + 'id' => null, + 'name' => null, + 'enabled' => null, + 'comment' => null, + 'regDate' => 'date-time', + 'regIpv4' => null, + 'lastConnected' => 'date-time', + 'lastIpv4' => null, + 'softwareVersion' => null, + 'gUIDString' => null, + 'locationId' => null, + 'originalLocationId' => null, + 'channelsIds' => null, + 'connected' => null, + 'location' => null, + 'originalLocation' => null, + 'channels' => null, + 'schedules' => null + ]; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function swaggerTypes() + { + return self::$swaggerTypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function swaggerFormats() + { + return self::$swaggerFormats; + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'id' => 'id', + 'name' => 'name', + 'enabled' => 'enabled', + 'comment' => 'comment', + 'regDate' => 'regDate', + 'regIpv4' => 'regIpv4', + 'lastConnected' => 'lastConnected', + 'lastIpv4' => 'lastIpv4', + 'softwareVersion' => 'softwareVersion', + 'gUIDString' => 'gUIDString', + 'locationId' => 'locationId', + 'originalLocationId' => 'originalLocationId', + 'channelsIds' => 'channelsIds', + 'connected' => 'connected', + 'location' => 'location', + 'originalLocation' => 'originalLocation', + 'channels' => 'channels', + 'schedules' => 'schedules' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'id' => 'setId', + 'name' => 'setName', + 'enabled' => 'setEnabled', + 'comment' => 'setComment', + 'regDate' => 'setRegDate', + 'regIpv4' => 'setRegIpv4', + 'lastConnected' => 'setLastConnected', + 'lastIpv4' => 'setLastIpv4', + 'softwareVersion' => 'setSoftwareVersion', + 'gUIDString' => 'setGUIDString', + 'locationId' => 'setLocationId', + 'originalLocationId' => 'setOriginalLocationId', + 'channelsIds' => 'setChannelsIds', + 'connected' => 'setConnected', + 'location' => 'setLocation', + 'originalLocation' => 'setOriginalLocation', + 'channels' => 'setChannels', + 'schedules' => 'setSchedules' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'id' => 'getId', + 'name' => 'getName', + 'enabled' => 'getEnabled', + 'comment' => 'getComment', + 'regDate' => 'getRegDate', + 'regIpv4' => 'getRegIpv4', + 'lastConnected' => 'getLastConnected', + 'lastIpv4' => 'getLastIpv4', + 'softwareVersion' => 'getSoftwareVersion', + 'gUIDString' => 'getGUIDString', + 'locationId' => 'getLocationId', + 'originalLocationId' => 'getOriginalLocationId', + 'channelsIds' => 'getChannelsIds', + 'connected' => 'getConnected', + 'location' => 'getLocation', + 'originalLocation' => 'getOriginalLocation', + 'channels' => 'getChannels', + 'schedules' => 'getSchedules' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$swaggerModelName; + } + + + + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->container['id'] = isset($data['id']) ? $data['id'] : null; + $this->container['name'] = isset($data['name']) ? $data['name'] : null; + $this->container['enabled'] = isset($data['enabled']) ? $data['enabled'] : null; + $this->container['comment'] = isset($data['comment']) ? $data['comment'] : null; + $this->container['regDate'] = isset($data['regDate']) ? $data['regDate'] : null; + $this->container['regIpv4'] = isset($data['regIpv4']) ? $data['regIpv4'] : null; + $this->container['lastConnected'] = isset($data['lastConnected']) ? $data['lastConnected'] : null; + $this->container['lastIpv4'] = isset($data['lastIpv4']) ? $data['lastIpv4'] : null; + $this->container['softwareVersion'] = isset($data['softwareVersion']) ? $data['softwareVersion'] : null; + $this->container['gUIDString'] = isset($data['gUIDString']) ? $data['gUIDString'] : null; + $this->container['locationId'] = isset($data['locationId']) ? $data['locationId'] : null; + $this->container['originalLocationId'] = isset($data['originalLocationId']) ? $data['originalLocationId'] : null; + $this->container['channelsIds'] = isset($data['channelsIds']) ? $data['channelsIds'] : null; + $this->container['connected'] = isset($data['connected']) ? $data['connected'] : null; + $this->container['location'] = isset($data['location']) ? $data['location'] : null; + $this->container['originalLocation'] = isset($data['originalLocation']) ? $data['originalLocation'] : null; + $this->container['channels'] = isset($data['channels']) ? $data['channels'] : null; + $this->container['schedules'] = isset($data['schedules']) ? $data['schedules'] : null; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets id + * + * @return int + */ + public function getId() + { + return $this->container['id']; + } + + /** + * Sets id + * + * @param int $id Device identifier + * + * @return $this + */ + public function setId($id) + { + $this->container['id'] = $id; + + return $this; + } + + /** + * Gets name + * + * @return string + */ + public function getName() + { + return $this->container['name']; + } + + /** + * Sets name + * + * @param string $name name + * + * @return $this + */ + public function setName($name) + { + $this->container['name'] = $name; + + return $this; + } + + /** + * Gets enabled + * + * @return bool + */ + public function getEnabled() + { + return $this->container['enabled']; + } + + /** + * Sets enabled + * + * @param bool $enabled enabled + * + * @return $this + */ + public function setEnabled($enabled) + { + $this->container['enabled'] = $enabled; + + return $this; + } + + /** + * Gets comment + * + * @return string + */ + public function getComment() + { + return $this->container['comment']; + } + + /** + * Sets comment + * + * @param string $comment comment + * + * @return $this + */ + public function setComment($comment) + { + $this->container['comment'] = $comment; + + return $this; + } + + /** + * Gets regDate + * + * @return \DateTime + */ + public function getRegDate() + { + return $this->container['regDate']; + } + + /** + * Sets regDate + * + * @param \DateTime $regDate regDate + * + * @return $this + */ + public function setRegDate($regDate) + { + $this->container['regDate'] = $regDate; + + return $this; + } + + /** + * Gets regIpv4 + * + * @return int + */ + public function getRegIpv4() + { + return $this->container['regIpv4']; + } + + /** + * Sets regIpv4 + * + * @param int $regIpv4 regIpv4 + * + * @return $this + */ + public function setRegIpv4($regIpv4) + { + $this->container['regIpv4'] = $regIpv4; + + return $this; + } + + /** + * Gets lastConnected + * + * @return \DateTime + */ + public function getLastConnected() + { + return $this->container['lastConnected']; + } + + /** + * Sets lastConnected + * + * @param \DateTime $lastConnected lastConnected + * + * @return $this + */ + public function setLastConnected($lastConnected) + { + $this->container['lastConnected'] = $lastConnected; + + return $this; + } + + /** + * Gets lastIpv4 + * + * @return int + */ + public function getLastIpv4() + { + return $this->container['lastIpv4']; + } + + /** + * Sets lastIpv4 + * + * @param int $lastIpv4 lastIpv4 + * + * @return $this + */ + public function setLastIpv4($lastIpv4) + { + $this->container['lastIpv4'] = $lastIpv4; + + return $this; + } + + /** + * Gets softwareVersion + * + * @return string + */ + public function getSoftwareVersion() + { + return $this->container['softwareVersion']; + } + + /** + * Sets softwareVersion + * + * @param string $softwareVersion softwareVersion + * + * @return $this + */ + public function setSoftwareVersion($softwareVersion) + { + $this->container['softwareVersion'] = $softwareVersion; + + return $this; + } + + /** + * Gets gUIDString + * + * @return string + */ + public function getGUIDString() + { + return $this->container['gUIDString']; + } + + /** + * Sets gUIDString + * + * @param string $gUIDString gUIDString + * + * @return $this + */ + public function setGUIDString($gUIDString) + { + $this->container['gUIDString'] = $gUIDString; + + return $this; + } + + /** + * Gets locationId + * + * @return int + */ + public function getLocationId() + { + return $this->container['locationId']; + } + + /** + * Sets locationId + * + * @param int $locationId locationId + * + * @return $this + */ + public function setLocationId($locationId) + { + $this->container['locationId'] = $locationId; + + return $this; + } + + /** + * Gets originalLocationId + * + * @return int + */ + public function getOriginalLocationId() + { + return $this->container['originalLocationId']; + } + + /** + * Sets originalLocationId + * + * @param int $originalLocationId originalLocationId + * + * @return $this + */ + public function setOriginalLocationId($originalLocationId) + { + $this->container['originalLocationId'] = $originalLocationId; + + return $this; + } + + /** + * Gets channelsIds + * + * @return int[] + */ + public function getChannelsIds() + { + return $this->container['channelsIds']; + } + + /** + * Sets channelsIds + * + * @param int[] $channelsIds channelsIds + * + * @return $this + */ + public function setChannelsIds($channelsIds) + { + $this->container['channelsIds'] = $channelsIds; + + return $this; + } + + /** + * Gets connected + * + * @return bool + */ + public function getConnected() + { + return $this->container['connected']; + } + + /** + * Sets connected + * + * @param bool $connected connected + * + * @return $this + */ + public function setConnected($connected) + { + $this->container['connected'] = $connected; + + return $this; + } + + /** + * Gets location + * + * @return \Swagger\Client\Model\Location + */ + public function getLocation() + { + return $this->container['location']; + } + + /** + * Sets location + * + * @param \Swagger\Client\Model\Location $location location + * + * @return $this + */ + public function setLocation($location) + { + $this->container['location'] = $location; + + return $this; + } + + /** + * Gets originalLocation + * + * @return \Swagger\Client\Model\Location + */ + public function getOriginalLocation() + { + return $this->container['originalLocation']; + } + + /** + * Sets originalLocation + * + * @param \Swagger\Client\Model\Location $originalLocation originalLocation + * + * @return $this + */ + public function setOriginalLocation($originalLocation) + { + $this->container['originalLocation'] = $originalLocation; + + return $this; + } + + /** + * Gets channels + * + * @return \Swagger\Client\Model\Channel[] + */ + public function getChannels() + { + return $this->container['channels']; + } + + /** + * Sets channels + * + * @param \Swagger\Client\Model\Channel[] $channels Returned only if requested by the `include` parameter. + * + * @return $this + */ + public function setChannels($channels) + { + $this->container['channels'] = $channels; + + return $this; + } + + /** + * Gets schedules + * + * @return \Swagger\Client\Model\Schedule[] + */ + public function getSchedules() + { + return $this->container['schedules']; + } + + /** + * Sets schedules + * + * @param \Swagger\Client\Model\Schedule[] $schedules Returned only if requested by the `include` parameter. + * + * @return $this + */ + public function setSchedules($schedules) + { + $this->container['schedules'] = $schedules; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset) + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed + */ + public function offsetGet($offset) + { + return isset($this->container[$offset]) ? $this->container[$offset] : null; + } + + /** + * Sets value based on offset. + * + * @param integer $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value) + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset) + { + unset($this->container[$offset]); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/lib/Model/IODeviceUpdateRequest.php b/lib/Model/IODeviceUpdateRequest.php new file mode 100644 index 0000000..888684d --- /dev/null +++ b/lib/Model/IODeviceUpdateRequest.php @@ -0,0 +1,361 @@ + 'string', + 'enabled' => 'bool', + 'locationId' => 'int' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $swaggerFormats = [ + 'comment' => null, + 'enabled' => null, + 'locationId' => null + ]; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function swaggerTypes() + { + return self::$swaggerTypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function swaggerFormats() + { + return self::$swaggerFormats; + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'comment' => 'comment', + 'enabled' => 'enabled', + 'locationId' => 'locationId' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'comment' => 'setComment', + 'enabled' => 'setEnabled', + 'locationId' => 'setLocationId' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'comment' => 'getComment', + 'enabled' => 'getEnabled', + 'locationId' => 'getLocationId' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$swaggerModelName; + } + + + + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->container['comment'] = isset($data['comment']) ? $data['comment'] : null; + $this->container['enabled'] = isset($data['enabled']) ? $data['enabled'] : null; + $this->container['locationId'] = isset($data['locationId']) ? $data['locationId'] : null; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets comment + * + * @return string + */ + public function getComment() + { + return $this->container['comment']; + } + + /** + * Sets comment + * + * @param string $comment comment + * + * @return $this + */ + public function setComment($comment) + { + $this->container['comment'] = $comment; + + return $this; + } + + /** + * Gets enabled + * + * @return bool + */ + public function getEnabled() + { + return $this->container['enabled']; + } + + /** + * Sets enabled + * + * @param bool $enabled enabled + * + * @return $this + */ + public function setEnabled($enabled) + { + $this->container['enabled'] = $enabled; + + return $this; + } + + /** + * Gets locationId + * + * @return int + */ + public function getLocationId() + { + return $this->container['locationId']; + } + + /** + * Sets locationId + * + * @param int $locationId locationId + * + * @return $this + */ + public function setLocationId($locationId) + { + $this->container['locationId'] = $locationId; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset) + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed + */ + public function offsetGet($offset) + { + return isset($this->container[$offset]) ? $this->container[$offset] : null; + } + + /** + * Sets value based on offset. + * + * @param integer $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value) + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset) + { + unset($this->container[$offset]); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/lib/Model/Location.php b/lib/Model/Location.php new file mode 100644 index 0000000..847b451 --- /dev/null +++ b/lib/Model/Location.php @@ -0,0 +1,631 @@ + 'int', + 'caption' => 'string', + 'enabled' => 'bool', + 'iodevicesIds' => 'int[]', + 'channelGroupsIds' => 'int[]', + 'channelsIds' => 'int[]', + 'accessIdsIds' => 'int[]', + 'password' => 'string', + 'iodevices' => '\Swagger\Client\Model\Device[]', + 'channelGroups' => '\Swagger\Client\Model\ChannelGroup[]', + 'accessIds' => '\Swagger\Client\Model\AccessIdentifier[]', + 'channels' => '\Swagger\Client\Model\Channel[]' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $swaggerFormats = [ + 'id' => null, + 'caption' => null, + 'enabled' => null, + 'iodevicesIds' => null, + 'channelGroupsIds' => null, + 'channelsIds' => null, + 'accessIdsIds' => null, + 'password' => null, + 'iodevices' => null, + 'channelGroups' => null, + 'accessIds' => null, + 'channels' => null + ]; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function swaggerTypes() + { + return self::$swaggerTypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function swaggerFormats() + { + return self::$swaggerFormats; + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'id' => 'id', + 'caption' => 'caption', + 'enabled' => 'enabled', + 'iodevicesIds' => 'iodevicesIds', + 'channelGroupsIds' => 'channelGroupsIds', + 'channelsIds' => 'channelsIds', + 'accessIdsIds' => 'accessIdsIds', + 'password' => 'password', + 'iodevices' => 'iodevices', + 'channelGroups' => 'channelGroups', + 'accessIds' => 'accessIds', + 'channels' => 'channels' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'id' => 'setId', + 'caption' => 'setCaption', + 'enabled' => 'setEnabled', + 'iodevicesIds' => 'setIodevicesIds', + 'channelGroupsIds' => 'setChannelGroupsIds', + 'channelsIds' => 'setChannelsIds', + 'accessIdsIds' => 'setAccessIdsIds', + 'password' => 'setPassword', + 'iodevices' => 'setIodevices', + 'channelGroups' => 'setChannelGroups', + 'accessIds' => 'setAccessIds', + 'channels' => 'setChannels' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'id' => 'getId', + 'caption' => 'getCaption', + 'enabled' => 'getEnabled', + 'iodevicesIds' => 'getIodevicesIds', + 'channelGroupsIds' => 'getChannelGroupsIds', + 'channelsIds' => 'getChannelsIds', + 'accessIdsIds' => 'getAccessIdsIds', + 'password' => 'getPassword', + 'iodevices' => 'getIodevices', + 'channelGroups' => 'getChannelGroups', + 'accessIds' => 'getAccessIds', + 'channels' => 'getChannels' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$swaggerModelName; + } + + + + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->container['id'] = isset($data['id']) ? $data['id'] : null; + $this->container['caption'] = isset($data['caption']) ? $data['caption'] : null; + $this->container['enabled'] = isset($data['enabled']) ? $data['enabled'] : null; + $this->container['iodevicesIds'] = isset($data['iodevicesIds']) ? $data['iodevicesIds'] : null; + $this->container['channelGroupsIds'] = isset($data['channelGroupsIds']) ? $data['channelGroupsIds'] : null; + $this->container['channelsIds'] = isset($data['channelsIds']) ? $data['channelsIds'] : null; + $this->container['accessIdsIds'] = isset($data['accessIdsIds']) ? $data['accessIdsIds'] : null; + $this->container['password'] = isset($data['password']) ? $data['password'] : null; + $this->container['iodevices'] = isset($data['iodevices']) ? $data['iodevices'] : null; + $this->container['channelGroups'] = isset($data['channelGroups']) ? $data['channelGroups'] : null; + $this->container['accessIds'] = isset($data['accessIds']) ? $data['accessIds'] : null; + $this->container['channels'] = isset($data['channels']) ? $data['channels'] : null; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets id + * + * @return int + */ + public function getId() + { + return $this->container['id']; + } + + /** + * Sets id + * + * @param int $id Location identifier + * + * @return $this + */ + public function setId($id) + { + $this->container['id'] = $id; + + return $this; + } + + /** + * Gets caption + * + * @return string + */ + public function getCaption() + { + return $this->container['caption']; + } + + /** + * Sets caption + * + * @param string $caption Location caption + * + * @return $this + */ + public function setCaption($caption) + { + $this->container['caption'] = $caption; + + return $this; + } + + /** + * Gets enabled + * + * @return bool + */ + public function getEnabled() + { + return $this->container['enabled']; + } + + /** + * Sets enabled + * + * @param bool $enabled `true` if the location is enabled, `false` otherwise + * + * @return $this + */ + public function setEnabled($enabled) + { + $this->container['enabled'] = $enabled; + + return $this; + } + + /** + * Gets iodevicesIds + * + * @return int[] + */ + public function getIodevicesIds() + { + return $this->container['iodevicesIds']; + } + + /** + * Sets iodevicesIds + * + * @param int[] $iodevicesIds array containing the IO Devices identifiers assigned to this location + * + * @return $this + */ + public function setIodevicesIds($iodevicesIds) + { + $this->container['iodevicesIds'] = $iodevicesIds; + + return $this; + } + + /** + * Gets channelGroupsIds + * + * @return int[] + */ + public function getChannelGroupsIds() + { + return $this->container['channelGroupsIds']; + } + + /** + * Sets channelGroupsIds + * + * @param int[] $channelGroupsIds array containing the Channel groups identifiers assigned to this location + * + * @return $this + */ + public function setChannelGroupsIds($channelGroupsIds) + { + $this->container['channelGroupsIds'] = $channelGroupsIds; + + return $this; + } + + /** + * Gets channelsIds + * + * @return int[] + */ + public function getChannelsIds() + { + return $this->container['channelsIds']; + } + + /** + * Sets channelsIds + * + * @param int[] $channelsIds array containing the Channels identifiers expicitely assigned to this location + * + * @return $this + */ + public function setChannelsIds($channelsIds) + { + $this->container['channelsIds'] = $channelsIds; + + return $this; + } + + /** + * Gets accessIdsIds + * + * @return int[] + */ + public function getAccessIdsIds() + { + return $this->container['accessIdsIds']; + } + + /** + * Sets accessIdsIds + * + * @param int[] $accessIdsIds array containing the Access Identifiers identifiers assigned to this location + * + * @return $this + */ + public function setAccessIdsIds($accessIdsIds) + { + $this->container['accessIdsIds'] = $accessIdsIds; + + return $this; + } + + /** + * Gets password + * + * @return string + */ + public function getPassword() + { + return $this->container['password']; + } + + /** + * Sets password + * + * @param string $password Location password (plain text). Returned only if requested by the `include` parameter. + * + * @return $this + */ + public function setPassword($password) + { + $this->container['password'] = $password; + + return $this; + } + + /** + * Gets iodevices + * + * @return \Swagger\Client\Model\Device[] + */ + public function getIodevices() + { + return $this->container['iodevices']; + } + + /** + * Sets iodevices + * + * @param \Swagger\Client\Model\Device[] $iodevices Returned only if requested by the `include` parameter. + * + * @return $this + */ + public function setIodevices($iodevices) + { + $this->container['iodevices'] = $iodevices; + + return $this; + } + + /** + * Gets channelGroups + * + * @return \Swagger\Client\Model\ChannelGroup[] + */ + public function getChannelGroups() + { + return $this->container['channelGroups']; + } + + /** + * Sets channelGroups + * + * @param \Swagger\Client\Model\ChannelGroup[] $channelGroups Returned only if requested by the `include` parameter. + * + * @return $this + */ + public function setChannelGroups($channelGroups) + { + $this->container['channelGroups'] = $channelGroups; + + return $this; + } + + /** + * Gets accessIds + * + * @return \Swagger\Client\Model\AccessIdentifier[] + */ + public function getAccessIds() + { + return $this->container['accessIds']; + } + + /** + * Sets accessIds + * + * @param \Swagger\Client\Model\AccessIdentifier[] $accessIds Returned only if requested by the `include` parameter. + * + * @return $this + */ + public function setAccessIds($accessIds) + { + $this->container['accessIds'] = $accessIds; + + return $this; + } + + /** + * Gets channels + * + * @return \Swagger\Client\Model\Channel[] + */ + public function getChannels() + { + return $this->container['channels']; + } + + /** + * Sets channels + * + * @param \Swagger\Client\Model\Channel[] $channels Returned only if requested by the `include` parameter. + * + * @return $this + */ + public function setChannels($channels) + { + $this->container['channels'] = $channels; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset) + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed + */ + public function offsetGet($offset) + { + return isset($this->container[$offset]) ? $this->container[$offset] : null; + } + + /** + * Sets value based on offset. + * + * @param integer $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value) + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset) + { + unset($this->container[$offset]); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/lib/Model/LocationUpdateRequest.php b/lib/Model/LocationUpdateRequest.php new file mode 100644 index 0000000..7b2129d --- /dev/null +++ b/lib/Model/LocationUpdateRequest.php @@ -0,0 +1,391 @@ + 'bool', + 'caption' => 'string', + 'password' => 'string', + 'accessIdsIds' => 'int[]' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $swaggerFormats = [ + 'enabled' => null, + 'caption' => null, + 'password' => null, + 'accessIdsIds' => null + ]; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function swaggerTypes() + { + return self::$swaggerTypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function swaggerFormats() + { + return self::$swaggerFormats; + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'enabled' => 'enabled', + 'caption' => 'caption', + 'password' => 'password', + 'accessIdsIds' => 'accessIdsIds' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'enabled' => 'setEnabled', + 'caption' => 'setCaption', + 'password' => 'setPassword', + 'accessIdsIds' => 'setAccessIdsIds' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'enabled' => 'getEnabled', + 'caption' => 'getCaption', + 'password' => 'getPassword', + 'accessIdsIds' => 'getAccessIdsIds' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$swaggerModelName; + } + + + + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->container['enabled'] = isset($data['enabled']) ? $data['enabled'] : null; + $this->container['caption'] = isset($data['caption']) ? $data['caption'] : null; + $this->container['password'] = isset($data['password']) ? $data['password'] : null; + $this->container['accessIdsIds'] = isset($data['accessIdsIds']) ? $data['accessIdsIds'] : null; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets enabled + * + * @return bool + */ + public function getEnabled() + { + return $this->container['enabled']; + } + + /** + * Sets enabled + * + * @param bool $enabled enabled + * + * @return $this + */ + public function setEnabled($enabled) + { + $this->container['enabled'] = $enabled; + + return $this; + } + + /** + * Gets caption + * + * @return string + */ + public function getCaption() + { + return $this->container['caption']; + } + + /** + * Sets caption + * + * @param string $caption caption + * + * @return $this + */ + public function setCaption($caption) + { + $this->container['caption'] = $caption; + + return $this; + } + + /** + * Gets password + * + * @return string + */ + public function getPassword() + { + return $this->container['password']; + } + + /** + * Sets password + * + * @param string $password Provide new password if you want to change it. + * + * @return $this + */ + public function setPassword($password) + { + $this->container['password'] = $password; + + return $this; + } + + /** + * Gets accessIdsIds + * + * @return int[] + */ + public function getAccessIdsIds() + { + return $this->container['accessIdsIds']; + } + + /** + * Sets accessIdsIds + * + * @param int[] $accessIdsIds Access Identifiers identifiers to assign to this location. + * + * @return $this + */ + public function setAccessIdsIds($accessIdsIds) + { + $this->container['accessIdsIds'] = $accessIdsIds; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset) + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed + */ + public function offsetGet($offset) + { + return isset($this->container[$offset]) ? $this->container[$offset] : null; + } + + /** + * Sets value based on offset. + * + * @param integer $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value) + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset) + { + unset($this->container[$offset]); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/lib/Model/ModelInterface.php b/lib/Model/ModelInterface.php new file mode 100644 index 0000000..5d4641b --- /dev/null +++ b/lib/Model/ModelInterface.php @@ -0,0 +1,96 @@ + 'int', + 'timeExpression' => 'string', + 'action' => '\Swagger\Client\Model\ChannelFunctionAction', + 'mode' => 'string', + 'dateStart' => '\DateTime', + 'dateEnd' => '\DateTime', + 'enabled' => 'bool', + 'caption' => 'string', + 'retry' => 'bool', + 'channelId' => 'int', + 'actionId' => 'int', + 'channel' => '\Swagger\Client\Model\Channel', + 'closestExecutions' => '\Swagger\Client\Model\ScheduleClosestExecutions[]' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $swaggerFormats = [ + 'id' => null, + 'timeExpression' => null, + 'action' => null, + 'mode' => null, + 'dateStart' => 'date-time', + 'dateEnd' => 'date-time', + 'enabled' => null, + 'caption' => null, + 'retry' => null, + 'channelId' => null, + 'actionId' => null, + 'channel' => null, + 'closestExecutions' => null + ]; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function swaggerTypes() + { + return self::$swaggerTypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function swaggerFormats() + { + return self::$swaggerFormats; + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'id' => 'id', + 'timeExpression' => 'timeExpression', + 'action' => 'action', + 'mode' => 'mode', + 'dateStart' => 'dateStart', + 'dateEnd' => 'dateEnd', + 'enabled' => 'enabled', + 'caption' => 'caption', + 'retry' => 'retry', + 'channelId' => 'channelId', + 'actionId' => 'actionId', + 'channel' => 'channel', + 'closestExecutions' => 'closestExecutions' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'id' => 'setId', + 'timeExpression' => 'setTimeExpression', + 'action' => 'setAction', + 'mode' => 'setMode', + 'dateStart' => 'setDateStart', + 'dateEnd' => 'setDateEnd', + 'enabled' => 'setEnabled', + 'caption' => 'setCaption', + 'retry' => 'setRetry', + 'channelId' => 'setChannelId', + 'actionId' => 'setActionId', + 'channel' => 'setChannel', + 'closestExecutions' => 'setClosestExecutions' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'id' => 'getId', + 'timeExpression' => 'getTimeExpression', + 'action' => 'getAction', + 'mode' => 'getMode', + 'dateStart' => 'getDateStart', + 'dateEnd' => 'getDateEnd', + 'enabled' => 'getEnabled', + 'caption' => 'getCaption', + 'retry' => 'getRetry', + 'channelId' => 'getChannelId', + 'actionId' => 'getActionId', + 'channel' => 'getChannel', + 'closestExecutions' => 'getClosestExecutions' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$swaggerModelName; + } + + const MODE_MINUTELY = 'minutely'; + const MODE_HOURLY = 'hourly'; + const MODE_DAILY = 'daily'; + const MODE_ONCE = 'once'; + + + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getModeAllowableValues() + { + return [ + self::MODE_MINUTELY, + self::MODE_HOURLY, + self::MODE_DAILY, + self::MODE_ONCE, + ]; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->container['id'] = isset($data['id']) ? $data['id'] : null; + $this->container['timeExpression'] = isset($data['timeExpression']) ? $data['timeExpression'] : null; + $this->container['action'] = isset($data['action']) ? $data['action'] : null; + $this->container['mode'] = isset($data['mode']) ? $data['mode'] : null; + $this->container['dateStart'] = isset($data['dateStart']) ? $data['dateStart'] : null; + $this->container['dateEnd'] = isset($data['dateEnd']) ? $data['dateEnd'] : null; + $this->container['enabled'] = isset($data['enabled']) ? $data['enabled'] : null; + $this->container['caption'] = isset($data['caption']) ? $data['caption'] : null; + $this->container['retry'] = isset($data['retry']) ? $data['retry'] : null; + $this->container['channelId'] = isset($data['channelId']) ? $data['channelId'] : null; + $this->container['actionId'] = isset($data['actionId']) ? $data['actionId'] : null; + $this->container['channel'] = isset($data['channel']) ? $data['channel'] : null; + $this->container['closestExecutions'] = isset($data['closestExecutions']) ? $data['closestExecutions'] : null; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + $allowedValues = $this->getModeAllowableValues(); + if (!is_null($this->container['mode']) && !in_array($this->container['mode'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value for 'mode', must be one of '%s'", + implode("', '", $allowedValues) + ); + } + + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets id + * + * @return int + */ + public function getId() + { + return $this->container['id']; + } + + /** + * Sets id + * + * @param int $id Schedule identifier + * + * @return $this + */ + public function setId($id) + { + $this->container['id'] = $id; + + return $this; + } + + /** + * Gets timeExpression + * + * @return string + */ + public function getTimeExpression() + { + return $this->container['timeExpression']; + } + + /** + * Sets timeExpression + * + * @param string $timeExpression Schedule time expression in crontab notation (with some custom additions). + * + * @return $this + */ + public function setTimeExpression($timeExpression) + { + $this->container['timeExpression'] = $timeExpression; + + return $this; + } + + /** + * Gets action + * + * @return \Swagger\Client\Model\ChannelFunctionAction + */ + public function getAction() + { + return $this->container['action']; + } + + /** + * Sets action + * + * @param \Swagger\Client\Model\ChannelFunctionAction $action action + * + * @return $this + */ + public function setAction($action) + { + $this->container['action'] = $action; + + return $this; + } + + /** + * Gets mode + * + * @return string + */ + public function getMode() + { + return $this->container['mode']; + } + + /** + * Sets mode + * + * @param string $mode mode + * + * @return $this + */ + public function setMode($mode) + { + $allowedValues = $this->getModeAllowableValues(); + if (!is_null($mode) && !in_array($mode, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value for 'mode', must be one of '%s'", + implode("', '", $allowedValues) + ) + ); + } + $this->container['mode'] = $mode; + + return $this; + } + + /** + * Gets dateStart + * + * @return \DateTime + */ + public function getDateStart() + { + return $this->container['dateStart']; + } + + /** + * Sets dateStart + * + * @param \DateTime $dateStart dateStart + * + * @return $this + */ + public function setDateStart($dateStart) + { + $this->container['dateStart'] = $dateStart; + + return $this; + } + + /** + * Gets dateEnd + * + * @return \DateTime + */ + public function getDateEnd() + { + return $this->container['dateEnd']; + } + + /** + * Sets dateEnd + * + * @param \DateTime $dateEnd dateEnd + * + * @return $this + */ + public function setDateEnd($dateEnd) + { + $this->container['dateEnd'] = $dateEnd; + + return $this; + } + + /** + * Gets enabled + * + * @return bool + */ + public function getEnabled() + { + return $this->container['enabled']; + } + + /** + * Sets enabled + * + * @param bool $enabled enabled + * + * @return $this + */ + public function setEnabled($enabled) + { + $this->container['enabled'] = $enabled; + + return $this; + } + + /** + * Gets caption + * + * @return string + */ + public function getCaption() + { + return $this->container['caption']; + } + + /** + * Sets caption + * + * @param string $caption caption + * + * @return $this + */ + public function setCaption($caption) + { + $this->container['caption'] = $caption; + + return $this; + } + + /** + * Gets retry + * + * @return bool + */ + public function getRetry() + { + return $this->container['retry']; + } + + /** + * Sets retry + * + * @param bool $retry retry + * + * @return $this + */ + public function setRetry($retry) + { + $this->container['retry'] = $retry; + + return $this; + } + + /** + * Gets channelId + * + * @return int + */ + public function getChannelId() + { + return $this->container['channelId']; + } + + /** + * Sets channelId + * + * @param int $channelId channelId + * + * @return $this + */ + public function setChannelId($channelId) + { + $this->container['channelId'] = $channelId; + + return $this; + } + + /** + * Gets actionId + * + * @return int + */ + public function getActionId() + { + return $this->container['actionId']; + } + + /** + * Sets actionId + * + * @param int $actionId actionId + * + * @return $this + */ + public function setActionId($actionId) + { + $this->container['actionId'] = $actionId; + + return $this; + } + + /** + * Gets channel + * + * @return \Swagger\Client\Model\Channel + */ + public function getChannel() + { + return $this->container['channel']; + } + + /** + * Sets channel + * + * @param \Swagger\Client\Model\Channel $channel channel + * + * @return $this + */ + public function setChannel($channel) + { + $this->container['channel'] = $channel; + + return $this; + } + + /** + * Gets closestExecutions + * + * @return \Swagger\Client\Model\ScheduleClosestExecutions[] + */ + public function getClosestExecutions() + { + return $this->container['closestExecutions']; + } + + /** + * Sets closestExecutions + * + * @param \Swagger\Client\Model\ScheduleClosestExecutions[] $closestExecutions Returned only if requested by the `include` parameter. Contains two arrays of maximum 3 closest past and future executions. + * + * @return $this + */ + public function setClosestExecutions($closestExecutions) + { + $this->container['closestExecutions'] = $closestExecutions; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset) + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed + */ + public function offsetGet($offset) + { + return isset($this->container[$offset]) ? $this->container[$offset] : null; + } + + /** + * Sets value based on offset. + * + * @param integer $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value) + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset) + { + unset($this->container[$offset]); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/lib/Model/ScheduleClosestExecutions.php b/lib/Model/ScheduleClosestExecutions.php new file mode 100644 index 0000000..d30cba5 --- /dev/null +++ b/lib/Model/ScheduleClosestExecutions.php @@ -0,0 +1,331 @@ + '\Swagger\Client\Model\SchedulePast[]', + 'future' => '\Swagger\Client\Model\ScheduleFuture[]' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $swaggerFormats = [ + 'past' => null, + 'future' => null + ]; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function swaggerTypes() + { + return self::$swaggerTypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function swaggerFormats() + { + return self::$swaggerFormats; + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'past' => 'past', + 'future' => 'future' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'past' => 'setPast', + 'future' => 'setFuture' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'past' => 'getPast', + 'future' => 'getFuture' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$swaggerModelName; + } + + + + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->container['past'] = isset($data['past']) ? $data['past'] : null; + $this->container['future'] = isset($data['future']) ? $data['future'] : null; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets past + * + * @return \Swagger\Client\Model\SchedulePast[] + */ + public function getPast() + { + return $this->container['past']; + } + + /** + * Sets past + * + * @param \Swagger\Client\Model\SchedulePast[] $past past + * + * @return $this + */ + public function setPast($past) + { + $this->container['past'] = $past; + + return $this; + } + + /** + * Gets future + * + * @return \Swagger\Client\Model\ScheduleFuture[] + */ + public function getFuture() + { + return $this->container['future']; + } + + /** + * Sets future + * + * @param \Swagger\Client\Model\ScheduleFuture[] $future future + * + * @return $this + */ + public function setFuture($future) + { + $this->container['future'] = $future; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset) + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed + */ + public function offsetGet($offset) + { + return isset($this->container[$offset]) ? $this->container[$offset] : null; + } + + /** + * Sets value based on offset. + * + * @param integer $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value) + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset) + { + unset($this->container[$offset]); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/lib/Model/ScheduleFuture.php b/lib/Model/ScheduleFuture.php new file mode 100644 index 0000000..63f1e3a --- /dev/null +++ b/lib/Model/ScheduleFuture.php @@ -0,0 +1,301 @@ + '\DateTime' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $swaggerFormats = [ + 'plannedTimestamp' => 'date-time' + ]; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function swaggerTypes() + { + return self::$swaggerTypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function swaggerFormats() + { + return self::$swaggerFormats; + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'plannedTimestamp' => 'plannedTimestamp' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'plannedTimestamp' => 'setPlannedTimestamp' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'plannedTimestamp' => 'getPlannedTimestamp' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$swaggerModelName; + } + + + + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->container['plannedTimestamp'] = isset($data['plannedTimestamp']) ? $data['plannedTimestamp'] : null; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets plannedTimestamp + * + * @return \DateTime + */ + public function getPlannedTimestamp() + { + return $this->container['plannedTimestamp']; + } + + /** + * Sets plannedTimestamp + * + * @param \DateTime $plannedTimestamp plannedTimestamp + * + * @return $this + */ + public function setPlannedTimestamp($plannedTimestamp) + { + $this->container['plannedTimestamp'] = $plannedTimestamp; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset) + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed + */ + public function offsetGet($offset) + { + return isset($this->container[$offset]) ? $this->container[$offset] : null; + } + + /** + * Sets value based on offset. + * + * @param integer $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value) + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset) + { + unset($this->container[$offset]); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/lib/Model/SchedulePast.php b/lib/Model/SchedulePast.php new file mode 100644 index 0000000..990a31a --- /dev/null +++ b/lib/Model/SchedulePast.php @@ -0,0 +1,391 @@ + '\DateTime', + 'resultTimestamp' => '\DateTime', + 'failed' => 'bool', + 'result' => '\Swagger\Client\Model\ScheduleResult' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $swaggerFormats = [ + 'plannedTimestamp' => 'date-time', + 'resultTimestamp' => 'date-time', + 'failed' => null, + 'result' => null + ]; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function swaggerTypes() + { + return self::$swaggerTypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function swaggerFormats() + { + return self::$swaggerFormats; + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'plannedTimestamp' => 'plannedTimestamp', + 'resultTimestamp' => 'resultTimestamp', + 'failed' => 'failed', + 'result' => 'result' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'plannedTimestamp' => 'setPlannedTimestamp', + 'resultTimestamp' => 'setResultTimestamp', + 'failed' => 'setFailed', + 'result' => 'setResult' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'plannedTimestamp' => 'getPlannedTimestamp', + 'resultTimestamp' => 'getResultTimestamp', + 'failed' => 'getFailed', + 'result' => 'getResult' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$swaggerModelName; + } + + + + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->container['plannedTimestamp'] = isset($data['plannedTimestamp']) ? $data['plannedTimestamp'] : null; + $this->container['resultTimestamp'] = isset($data['resultTimestamp']) ? $data['resultTimestamp'] : null; + $this->container['failed'] = isset($data['failed']) ? $data['failed'] : null; + $this->container['result'] = isset($data['result']) ? $data['result'] : null; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets plannedTimestamp + * + * @return \DateTime + */ + public function getPlannedTimestamp() + { + return $this->container['plannedTimestamp']; + } + + /** + * Sets plannedTimestamp + * + * @param \DateTime $plannedTimestamp plannedTimestamp + * + * @return $this + */ + public function setPlannedTimestamp($plannedTimestamp) + { + $this->container['plannedTimestamp'] = $plannedTimestamp; + + return $this; + } + + /** + * Gets resultTimestamp + * + * @return \DateTime + */ + public function getResultTimestamp() + { + return $this->container['resultTimestamp']; + } + + /** + * Sets resultTimestamp + * + * @param \DateTime $resultTimestamp resultTimestamp + * + * @return $this + */ + public function setResultTimestamp($resultTimestamp) + { + $this->container['resultTimestamp'] = $resultTimestamp; + + return $this; + } + + /** + * Gets failed + * + * @return bool + */ + public function getFailed() + { + return $this->container['failed']; + } + + /** + * Sets failed + * + * @param bool $failed failed + * + * @return $this + */ + public function setFailed($failed) + { + $this->container['failed'] = $failed; + + return $this; + } + + /** + * Gets result + * + * @return \Swagger\Client\Model\ScheduleResult + */ + public function getResult() + { + return $this->container['result']; + } + + /** + * Sets result + * + * @param \Swagger\Client\Model\ScheduleResult $result result + * + * @return $this + */ + public function setResult($result) + { + $this->container['result'] = $result; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset) + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed + */ + public function offsetGet($offset) + { + return isset($this->container[$offset]) ? $this->container[$offset] : null; + } + + /** + * Sets value based on offset. + * + * @param integer $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value) + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset) + { + unset($this->container[$offset]); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/lib/Model/ScheduleRequest.php b/lib/Model/ScheduleRequest.php new file mode 100644 index 0000000..048178a --- /dev/null +++ b/lib/Model/ScheduleRequest.php @@ -0,0 +1,559 @@ + 'int', + 'actionId' => 'int', + 'mode' => 'string', + 'timeExpression' => 'string', + 'dateStart' => '\DateTime', + 'dateEnd' => '\DateTime', + 'caption' => 'string', + 'retry' => 'bool' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $swaggerFormats = [ + 'channelId' => null, + 'actionId' => null, + 'mode' => null, + 'timeExpression' => null, + 'dateStart' => 'date-time', + 'dateEnd' => 'date-time', + 'caption' => null, + 'retry' => null + ]; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function swaggerTypes() + { + return self::$swaggerTypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function swaggerFormats() + { + return self::$swaggerFormats; + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'channelId' => 'channelId', + 'actionId' => 'actionId', + 'mode' => 'mode', + 'timeExpression' => 'timeExpression', + 'dateStart' => 'dateStart', + 'dateEnd' => 'dateEnd', + 'caption' => 'caption', + 'retry' => 'retry' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'channelId' => 'setChannelId', + 'actionId' => 'setActionId', + 'mode' => 'setMode', + 'timeExpression' => 'setTimeExpression', + 'dateStart' => 'setDateStart', + 'dateEnd' => 'setDateEnd', + 'caption' => 'setCaption', + 'retry' => 'setRetry' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'channelId' => 'getChannelId', + 'actionId' => 'getActionId', + 'mode' => 'getMode', + 'timeExpression' => 'getTimeExpression', + 'dateStart' => 'getDateStart', + 'dateEnd' => 'getDateEnd', + 'caption' => 'getCaption', + 'retry' => 'getRetry' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$swaggerModelName; + } + + const MODE_ONCE = 'once'; + const MODE_MINUTELY = 'minutely'; + const MODE_DAILY = 'daily'; + const MODE_HOURLY = 'hourly'; + + + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getModeAllowableValues() + { + return [ + self::MODE_ONCE, + self::MODE_MINUTELY, + self::MODE_DAILY, + self::MODE_HOURLY, + ]; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->container['channelId'] = isset($data['channelId']) ? $data['channelId'] : null; + $this->container['actionId'] = isset($data['actionId']) ? $data['actionId'] : null; + $this->container['mode'] = isset($data['mode']) ? $data['mode'] : null; + $this->container['timeExpression'] = isset($data['timeExpression']) ? $data['timeExpression'] : null; + $this->container['dateStart'] = isset($data['dateStart']) ? $data['dateStart'] : null; + $this->container['dateEnd'] = isset($data['dateEnd']) ? $data['dateEnd'] : null; + $this->container['caption'] = isset($data['caption']) ? $data['caption'] : null; + $this->container['retry'] = isset($data['retry']) ? $data['retry'] : null; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['channelId'] === null) { + $invalidProperties[] = "'channelId' can't be null"; + } + if ($this->container['actionId'] === null) { + $invalidProperties[] = "'actionId' can't be null"; + } + if ($this->container['mode'] === null) { + $invalidProperties[] = "'mode' can't be null"; + } + $allowedValues = $this->getModeAllowableValues(); + if (!is_null($this->container['mode']) && !in_array($this->container['mode'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value for 'mode', must be one of '%s'", + implode("', '", $allowedValues) + ); + } + + if ($this->container['timeExpression'] === null) { + $invalidProperties[] = "'timeExpression' can't be null"; + } + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets channelId + * + * @return int + */ + public function getChannelId() + { + return $this->container['channelId']; + } + + /** + * Sets channelId + * + * @param int $channelId channelId + * + * @return $this + */ + public function setChannelId($channelId) + { + $this->container['channelId'] = $channelId; + + return $this; + } + + /** + * Gets actionId + * + * @return int + */ + public function getActionId() + { + return $this->container['actionId']; + } + + /** + * Sets actionId + * + * @param int $actionId actionId + * + * @return $this + */ + public function setActionId($actionId) + { + $this->container['actionId'] = $actionId; + + return $this; + } + + /** + * Gets mode + * + * @return string + */ + public function getMode() + { + return $this->container['mode']; + } + + /** + * Sets mode + * + * @param string $mode mode + * + * @return $this + */ + public function setMode($mode) + { + $allowedValues = $this->getModeAllowableValues(); + if (!in_array($mode, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value for 'mode', must be one of '%s'", + implode("', '", $allowedValues) + ) + ); + } + $this->container['mode'] = $mode; + + return $this; + } + + /** + * Gets timeExpression + * + * @return string + */ + public function getTimeExpression() + { + return $this->container['timeExpression']; + } + + /** + * Sets timeExpression + * + * @param string $timeExpression Schedule time expression in crontab notation (with some custom additions). + * + * @return $this + */ + public function setTimeExpression($timeExpression) + { + $this->container['timeExpression'] = $timeExpression; + + return $this; + } + + /** + * Gets dateStart + * + * @return \DateTime + */ + public function getDateStart() + { + return $this->container['dateStart']; + } + + /** + * Sets dateStart + * + * @param \DateTime $dateStart dateStart + * + * @return $this + */ + public function setDateStart($dateStart) + { + $this->container['dateStart'] = $dateStart; + + return $this; + } + + /** + * Gets dateEnd + * + * @return \DateTime + */ + public function getDateEnd() + { + return $this->container['dateEnd']; + } + + /** + * Sets dateEnd + * + * @param \DateTime $dateEnd dateEnd + * + * @return $this + */ + public function setDateEnd($dateEnd) + { + $this->container['dateEnd'] = $dateEnd; + + return $this; + } + + /** + * Gets caption + * + * @return string + */ + public function getCaption() + { + return $this->container['caption']; + } + + /** + * Sets caption + * + * @param string $caption caption + * + * @return $this + */ + public function setCaption($caption) + { + $this->container['caption'] = $caption; + + return $this; + } + + /** + * Gets retry + * + * @return bool + */ + public function getRetry() + { + return $this->container['retry']; + } + + /** + * Sets retry + * + * @param bool $retry retry + * + * @return $this + */ + public function setRetry($retry) + { + $this->container['retry'] = $retry; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset) + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed + */ + public function offsetGet($offset) + { + return isset($this->container[$offset]) ? $this->container[$offset] : null; + } + + /** + * Sets value based on offset. + * + * @param integer $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value) + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset) + { + unset($this->container[$offset]); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/lib/Model/ScheduleResult.php b/lib/Model/ScheduleResult.php new file mode 100644 index 0000000..337f7af --- /dev/null +++ b/lib/Model/ScheduleResult.php @@ -0,0 +1,301 @@ + 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $swaggerFormats = [ + 'caption' => null + ]; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function swaggerTypes() + { + return self::$swaggerTypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function swaggerFormats() + { + return self::$swaggerFormats; + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'caption' => 'caption' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'caption' => 'setCaption' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'caption' => 'getCaption' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$swaggerModelName; + } + + + + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->container['caption'] = isset($data['caption']) ? $data['caption'] : null; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets caption + * + * @return string + */ + public function getCaption() + { + return $this->container['caption']; + } + + /** + * Sets caption + * + * @param string $caption caption + * + * @return $this + */ + public function setCaption($caption) + { + $this->container['caption'] = $caption; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset) + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed + */ + public function offsetGet($offset) + { + return isset($this->container[$offset]) ? $this->container[$offset] : null; + } + + /** + * Sets value based on offset. + * + * @param integer $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value) + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset) + { + unset($this->container[$offset]); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/lib/Model/SchedulesEnableRequest.php b/lib/Model/SchedulesEnableRequest.php new file mode 100644 index 0000000..8d6c8a7 --- /dev/null +++ b/lib/Model/SchedulesEnableRequest.php @@ -0,0 +1,301 @@ + 'int[]' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $swaggerFormats = [ + 'enable' => null + ]; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function swaggerTypes() + { + return self::$swaggerTypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function swaggerFormats() + { + return self::$swaggerFormats; + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'enable' => 'enable' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'enable' => 'setEnable' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'enable' => 'getEnable' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$swaggerModelName; + } + + + + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->container['enable'] = isset($data['enable']) ? $data['enable'] : null; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets enable + * + * @return int[] + */ + public function getEnable() + { + return $this->container['enable']; + } + + /** + * Sets enable + * + * @param int[] $enable Array of schedule identifiers to enable + * + * @return $this + */ + public function setEnable($enable) + { + $this->container['enable'] = $enable; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset) + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed + */ + public function offsetGet($offset) + { + return isset($this->container[$offset]) ? $this->container[$offset] : null; + } + + /** + * Sets value based on offset. + * + * @param integer $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value) + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset) + { + unset($this->container[$offset]); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/lib/Model/ServerInfo.php b/lib/Model/ServerInfo.php new file mode 100644 index 0000000..28a2c42 --- /dev/null +++ b/lib/Model/ServerInfo.php @@ -0,0 +1,511 @@ + 'string', + 'time' => '\DateTime', + 'timezone' => '\Swagger\Client\Model\ServerInfoTimezone', + 'authenticated' => 'bool', + 'username' => 'string', + 'cloudVersion' => 'string', + 'apiVersion' => 'string', + 'supportedApiVersions' => 'string[]' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $swaggerFormats = [ + 'address' => null, + 'time' => 'date-time', + 'timezone' => null, + 'authenticated' => null, + 'username' => null, + 'cloudVersion' => null, + 'apiVersion' => null, + 'supportedApiVersions' => null + ]; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function swaggerTypes() + { + return self::$swaggerTypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function swaggerFormats() + { + return self::$swaggerFormats; + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'address' => 'address', + 'time' => 'time', + 'timezone' => 'timezone', + 'authenticated' => 'authenticated', + 'username' => 'username', + 'cloudVersion' => 'cloudVersion', + 'apiVersion' => 'apiVersion', + 'supportedApiVersions' => 'supportedApiVersions' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'address' => 'setAddress', + 'time' => 'setTime', + 'timezone' => 'setTimezone', + 'authenticated' => 'setAuthenticated', + 'username' => 'setUsername', + 'cloudVersion' => 'setCloudVersion', + 'apiVersion' => 'setApiVersion', + 'supportedApiVersions' => 'setSupportedApiVersions' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'address' => 'getAddress', + 'time' => 'getTime', + 'timezone' => 'getTimezone', + 'authenticated' => 'getAuthenticated', + 'username' => 'getUsername', + 'cloudVersion' => 'getCloudVersion', + 'apiVersion' => 'getApiVersion', + 'supportedApiVersions' => 'getSupportedApiVersions' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$swaggerModelName; + } + + + + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->container['address'] = isset($data['address']) ? $data['address'] : null; + $this->container['time'] = isset($data['time']) ? $data['time'] : null; + $this->container['timezone'] = isset($data['timezone']) ? $data['timezone'] : null; + $this->container['authenticated'] = isset($data['authenticated']) ? $data['authenticated'] : null; + $this->container['username'] = isset($data['username']) ? $data['username'] : null; + $this->container['cloudVersion'] = isset($data['cloudVersion']) ? $data['cloudVersion'] : null; + $this->container['apiVersion'] = isset($data['apiVersion']) ? $data['apiVersion'] : null; + $this->container['supportedApiVersions'] = isset($data['supportedApiVersions']) ? $data['supportedApiVersions'] : null; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets address + * + * @return string + */ + public function getAddress() + { + return $this->container['address']; + } + + /** + * Sets address + * + * @param string $address SUPLA Server address (to be used in smartphones) + * + * @return $this + */ + public function setAddress($address) + { + $this->container['address'] = $address; + + return $this; + } + + /** + * Gets time + * + * @return \DateTime + */ + public function getTime() + { + return $this->container['time']; + } + + /** + * Sets time + * + * @param \DateTime $time Current server time + * + * @return $this + */ + public function setTime($time) + { + $this->container['time'] = $time; + + return $this; + } + + /** + * Gets timezone + * + * @return \Swagger\Client\Model\ServerInfoTimezone + */ + public function getTimezone() + { + return $this->container['timezone']; + } + + /** + * Sets timezone + * + * @param \Swagger\Client\Model\ServerInfoTimezone $timezone timezone + * + * @return $this + */ + public function setTimezone($timezone) + { + $this->container['timezone'] = $timezone; + + return $this; + } + + /** + * Gets authenticated + * + * @return bool + */ + public function getAuthenticated() + { + return $this->container['authenticated']; + } + + /** + * Sets authenticated + * + * @param bool $authenticated authenticated + * + * @return $this + */ + public function setAuthenticated($authenticated) + { + $this->container['authenticated'] = $authenticated; + + return $this; + } + + /** + * Gets username + * + * @return string + */ + public function getUsername() + { + return $this->container['username']; + } + + /** + * Sets username + * + * @param string $username Present only if `authenticated=true` + * + * @return $this + */ + public function setUsername($username) + { + $this->container['username'] = $username; + + return $this; + } + + /** + * Gets cloudVersion + * + * @return string + */ + public function getCloudVersion() + { + return $this->container['cloudVersion']; + } + + /** + * Sets cloudVersion + * + * @param string $cloudVersion cloudVersion + * + * @return $this + */ + public function setCloudVersion($cloudVersion) + { + $this->container['cloudVersion'] = $cloudVersion; + + return $this; + } + + /** + * Gets apiVersion + * + * @return string + */ + public function getApiVersion() + { + return $this->container['apiVersion']; + } + + /** + * Sets apiVersion + * + * @param string $apiVersion apiVersion + * + * @return $this + */ + public function setApiVersion($apiVersion) + { + $this->container['apiVersion'] = $apiVersion; + + return $this; + } + + /** + * Gets supportedApiVersions + * + * @return string[] + */ + public function getSupportedApiVersions() + { + return $this->container['supportedApiVersions']; + } + + /** + * Sets supportedApiVersions + * + * @param string[] $supportedApiVersions supportedApiVersions + * + * @return $this + */ + public function setSupportedApiVersions($supportedApiVersions) + { + $this->container['supportedApiVersions'] = $supportedApiVersions; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset) + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed + */ + public function offsetGet($offset) + { + return isset($this->container[$offset]) ? $this->container[$offset] : null; + } + + /** + * Sets value based on offset. + * + * @param integer $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value) + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset) + { + unset($this->container[$offset]); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/lib/Model/ServerInfoTimezone.php b/lib/Model/ServerInfoTimezone.php new file mode 100644 index 0000000..ceaa316 --- /dev/null +++ b/lib/Model/ServerInfoTimezone.php @@ -0,0 +1,331 @@ + 'string', + 'offset' => 'int' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $swaggerFormats = [ + 'name' => null, + 'offset' => null + ]; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function swaggerTypes() + { + return self::$swaggerTypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function swaggerFormats() + { + return self::$swaggerFormats; + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'name' => 'name', + 'offset' => 'offset' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'name' => 'setName', + 'offset' => 'setOffset' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'name' => 'getName', + 'offset' => 'getOffset' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$swaggerModelName; + } + + + + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->container['name'] = isset($data['name']) ? $data['name'] : null; + $this->container['offset'] = isset($data['offset']) ? $data['offset'] : null; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets name + * + * @return string + */ + public function getName() + { + return $this->container['name']; + } + + /** + * Sets name + * + * @param string $name name + * + * @return $this + */ + public function setName($name) + { + $this->container['name'] = $name; + + return $this; + } + + /** + * Gets offset + * + * @return int + */ + public function getOffset() + { + return $this->container['offset']; + } + + /** + * Sets offset + * + * @param int $offset Timezone offset in minutes + * + * @return $this + */ + public function setOffset($offset) + { + $this->container['offset'] = $offset; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset) + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed + */ + public function offsetGet($offset) + { + return isset($this->container[$offset]) ? $this->container[$offset] : null; + } + + /** + * Sets value based on offset. + * + * @param integer $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value) + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset) + { + unset($this->container[$offset]); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/lib/Model/UserData.php b/lib/Model/UserData.php new file mode 100644 index 0000000..88569bd --- /dev/null +++ b/lib/Model/UserData.php @@ -0,0 +1,421 @@ + 'int', + 'email' => 'string', + 'timezone' => 'string', + 'clientsRegistrationEnabled' => '\DateTime', + 'ioDevicesRegistrationEnabled' => '\DateTime' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $swaggerFormats = [ + 'id' => null, + 'email' => 'email', + 'timezone' => null, + 'clientsRegistrationEnabled' => 'date-time', + 'ioDevicesRegistrationEnabled' => 'date-time' + ]; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function swaggerTypes() + { + return self::$swaggerTypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function swaggerFormats() + { + return self::$swaggerFormats; + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'id' => 'id', + 'email' => 'email', + 'timezone' => 'timezone', + 'clientsRegistrationEnabled' => 'clientsRegistrationEnabled', + 'ioDevicesRegistrationEnabled' => 'ioDevicesRegistrationEnabled' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'id' => 'setId', + 'email' => 'setEmail', + 'timezone' => 'setTimezone', + 'clientsRegistrationEnabled' => 'setClientsRegistrationEnabled', + 'ioDevicesRegistrationEnabled' => 'setIoDevicesRegistrationEnabled' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'id' => 'getId', + 'email' => 'getEmail', + 'timezone' => 'getTimezone', + 'clientsRegistrationEnabled' => 'getClientsRegistrationEnabled', + 'ioDevicesRegistrationEnabled' => 'getIoDevicesRegistrationEnabled' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$swaggerModelName; + } + + + + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->container['id'] = isset($data['id']) ? $data['id'] : null; + $this->container['email'] = isset($data['email']) ? $data['email'] : null; + $this->container['timezone'] = isset($data['timezone']) ? $data['timezone'] : null; + $this->container['clientsRegistrationEnabled'] = isset($data['clientsRegistrationEnabled']) ? $data['clientsRegistrationEnabled'] : null; + $this->container['ioDevicesRegistrationEnabled'] = isset($data['ioDevicesRegistrationEnabled']) ? $data['ioDevicesRegistrationEnabled'] : null; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets id + * + * @return int + */ + public function getId() + { + return $this->container['id']; + } + + /** + * Sets id + * + * @param int $id id + * + * @return $this + */ + public function setId($id) + { + $this->container['id'] = $id; + + return $this; + } + + /** + * Gets email + * + * @return string + */ + public function getEmail() + { + return $this->container['email']; + } + + /** + * Sets email + * + * @param string $email email + * + * @return $this + */ + public function setEmail($email) + { + $this->container['email'] = $email; + + return $this; + } + + /** + * Gets timezone + * + * @return string + */ + public function getTimezone() + { + return $this->container['timezone']; + } + + /** + * Sets timezone + * + * @param string $timezone timezone + * + * @return $this + */ + public function setTimezone($timezone) + { + $this->container['timezone'] = $timezone; + + return $this; + } + + /** + * Gets clientsRegistrationEnabled + * + * @return \DateTime + */ + public function getClientsRegistrationEnabled() + { + return $this->container['clientsRegistrationEnabled']; + } + + /** + * Sets clientsRegistrationEnabled + * + * @param \DateTime $clientsRegistrationEnabled clientsRegistrationEnabled + * + * @return $this + */ + public function setClientsRegistrationEnabled($clientsRegistrationEnabled) + { + $this->container['clientsRegistrationEnabled'] = $clientsRegistrationEnabled; + + return $this; + } + + /** + * Gets ioDevicesRegistrationEnabled + * + * @return \DateTime + */ + public function getIoDevicesRegistrationEnabled() + { + return $this->container['ioDevicesRegistrationEnabled']; + } + + /** + * Sets ioDevicesRegistrationEnabled + * + * @param \DateTime $ioDevicesRegistrationEnabled ioDevicesRegistrationEnabled + * + * @return $this + */ + public function setIoDevicesRegistrationEnabled($ioDevicesRegistrationEnabled) + { + $this->container['ioDevicesRegistrationEnabled'] = $ioDevicesRegistrationEnabled; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset) + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed + */ + public function offsetGet($offset) + { + return isset($this->container[$offset]) ? $this->container[$offset] : null; + } + + /** + * Sets value based on offset. + * + * @param integer $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value) + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset) + { + unset($this->container[$offset]); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/lib/Model/UserUpdateRequest.php b/lib/Model/UserUpdateRequest.php new file mode 100644 index 0000000..354cb1c --- /dev/null +++ b/lib/Model/UserUpdateRequest.php @@ -0,0 +1,341 @@ + 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $swaggerFormats = [ + 'action' => null + ]; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function swaggerTypes() + { + return self::$swaggerTypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function swaggerFormats() + { + return self::$swaggerFormats; + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'action' => 'action' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'action' => 'setAction' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'action' => 'getAction' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$swaggerModelName; + } + + const ACTION_CHANGECLIENTS_REGISTRATION_ENABLED = 'change:clientsRegistrationEnabled'; + const ACTION_CHANGEIO_DEVICES_REGISTRATION_ENABLED = 'change:ioDevicesRegistrationEnabled'; + const ACTION_CHANGEUSER_TIMEZONE = 'change:userTimezone'; + const ACTION_CHANGEPASSWORD = 'change:password'; + const ACTION_AGREERULES = 'agree:rules'; + const ACTION_AGREECOOKIES = 'agree:cookies'; + + + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getActionAllowableValues() + { + return [ + self::ACTION_CHANGECLIENTS_REGISTRATION_ENABLED, + self::ACTION_CHANGEIO_DEVICES_REGISTRATION_ENABLED, + self::ACTION_CHANGEUSER_TIMEZONE, + self::ACTION_CHANGEPASSWORD, + self::ACTION_AGREERULES, + self::ACTION_AGREECOOKIES, + ]; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->container['action'] = isset($data['action']) ? $data['action'] : null; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + $allowedValues = $this->getActionAllowableValues(); + if (!is_null($this->container['action']) && !in_array($this->container['action'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value for 'action', must be one of '%s'", + implode("', '", $allowedValues) + ); + } + + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets action + * + * @return string + */ + public function getAction() + { + return $this->container['action']; + } + + /** + * Sets action + * + * @param string $action The `change:userTimezone` requires to provide also a `timezone` value in the request. The `change:password` requires to provide also a `newPassword` and `oldPassword` in the request. + * + * @return $this + */ + public function setAction($action) + { + $allowedValues = $this->getActionAllowableValues(); + if (!is_null($action) && !in_array($action, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value for 'action', must be one of '%s'", + implode("', '", $allowedValues) + ) + ); + } + $this->container['action'] = $action; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset) + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed + */ + public function offsetGet($offset) + { + return isset($this->container[$offset]) ? $this->container[$offset] : null; + } + + /** + * Sets value based on offset. + * + * @param integer $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value) + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset) + { + unset($this->container[$offset]); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/lib/ObjectSerializer.php b/lib/ObjectSerializer.php new file mode 100644 index 0000000..37e0fdb --- /dev/null +++ b/lib/ObjectSerializer.php @@ -0,0 +1,317 @@ +format('Y-m-d') : $data->format(\DateTime::ATOM); + } elseif (is_array($data)) { + foreach ($data as $property => $value) { + $data[$property] = self::sanitizeForSerialization($value); + } + return $data; + } elseif (is_object($data)) { + $values = []; + $formats = $data::swaggerFormats(); + foreach ($data::swaggerTypes() as $property => $swaggerType) { + $getter = $data::getters()[$property]; + $value = $data->$getter(); + if ($value !== null + && !in_array($swaggerType, ['DateTime', 'bool', 'boolean', 'byte', 'double', 'float', 'int', 'integer', 'mixed', 'number', 'object', 'string', 'void'], true) + && method_exists($swaggerType, 'getAllowableEnumValues') + && !in_array($value, $swaggerType::getAllowableEnumValues())) { + $imploded = implode("', '", $swaggerType::getAllowableEnumValues()); + throw new \InvalidArgumentException("Invalid value for enum '$swaggerType', must be one of: '$imploded'"); + } + if ($value !== null) { + $values[$data::attributeMap()[$property]] = self::sanitizeForSerialization($value, $swaggerType, $formats[$property]); + } + } + return (object)$values; + } else { + return (string)$data; + } + } + + /** + * Sanitize filename by removing path. + * e.g. ../../sun.gif becomes sun.gif + * + * @param string $filename filename to be sanitized + * + * @return string the sanitized filename + */ + public static function sanitizeFilename($filename) + { + if (preg_match("/.*[\/\\\\](.*)$/", $filename, $match)) { + return $match[1]; + } else { + return $filename; + } + } + + /** + * Take value and turn it into a string suitable for inclusion in + * the path, by url-encoding. + * + * @param string $value a string which will be part of the path + * + * @return string the serialized object + */ + public static function toPathValue($value) + { + return rawurlencode(self::toString($value)); + } + + /** + * Take value and turn it into a string suitable for inclusion in + * the query, by imploding comma-separated if it's an object. + * If it's a string, pass through unchanged. It will be url-encoded + * later. + * + * @param string[]|string|\DateTime $object an object to be serialized to a string + * + * @return string the serialized object + */ + public static function toQueryValue($object) + { + if (is_array($object)) { + return implode(',', $object); + } else { + return self::toString($object); + } + } + + /** + * Take value and turn it into a string suitable for inclusion in + * the header. If it's a string, pass through unchanged + * If it's a datetime object, format it in ISO8601 + * + * @param string $value a string which will be part of the header + * + * @return string the header string + */ + public static function toHeaderValue($value) + { + return self::toString($value); + } + + /** + * Take value and turn it into a string suitable for inclusion in + * the http body (form parameter). If it's a string, pass through unchanged + * If it's a datetime object, format it in ISO8601 + * + * @param string|\SplFileObject $value the value of the form parameter + * + * @return string the form string + */ + public static function toFormValue($value) + { + if ($value instanceof \SplFileObject) { + return $value->getRealPath(); + } else { + return self::toString($value); + } + } + + /** + * Take value and turn it into a string suitable for inclusion in + * the parameter. If it's a string, pass through unchanged + * If it's a datetime object, format it in ISO8601 + * + * @param string|\DateTime $value the value of the parameter + * + * @return string the header string + */ + public static function toString($value) + { + if ($value instanceof \DateTime) { // datetime in ISO8601 format + return $value->format(\DateTime::ATOM); + } else { + return $value; + } + } + + /** + * Serialize an array to a string. + * + * @param array $collection collection to serialize to a string + * @param string $collectionFormat the format use for serialization (csv, + * ssv, tsv, pipes, multi) + * @param bool $allowCollectionFormatMulti allow collection format to be a multidimensional array + * + * @return string + */ + public static function serializeCollection(array $collection, $collectionFormat, $allowCollectionFormatMulti = false) + { + if ($allowCollectionFormatMulti && ('multi' === $collectionFormat)) { + // http_build_query() almost does the job for us. We just + // need to fix the result of multidimensional arrays. + return preg_replace('/%5B[0-9]+%5D=/', '=', http_build_query($collection, '', '&')); + } + switch ($collectionFormat) { + case 'pipes': + return implode('|', $collection); + + case 'tsv': + return implode("\t", $collection); + + case 'ssv': + return implode(' ', $collection); + + case 'csv': + // Deliberate fall through. CSV is default format. + default: + return implode(',', $collection); + } + } + + /** + * Deserialize a JSON string into an object + * + * @param mixed $data object or primitive to be deserialized + * @param string $class class name is passed as a string + * @param string[] $httpHeaders HTTP headers + * @param string $discriminator discriminator if polymorphism is used + * + * @return object|array|null an single or an array of $class instances + */ + public static function deserialize($data, $class, $httpHeaders = null) + { + if (null === $data) { + return null; + } elseif (substr($class, 0, 4) === 'map[') { // for associative array e.g. map[string,int] + $inner = substr($class, 4, -1); + $deserialized = []; + if (strrpos($inner, ",") !== false) { + $subClass_array = explode(',', $inner, 2); + $subClass = $subClass_array[1]; + foreach ($data as $key => $value) { + $deserialized[$key] = self::deserialize($value, $subClass, null); + } + } + return $deserialized; + } elseif (strcasecmp(substr($class, -2), '[]') === 0) { + $subClass = substr($class, 0, -2); + $values = []; + foreach ($data as $key => $value) { + $values[] = self::deserialize($value, $subClass, null); + } + return $values; + } elseif ($class === 'object') { + settype($data, 'array'); + return $data; + } elseif ($class === '\DateTime') { + // Some API's return an invalid, empty string as a + // date-time property. DateTime::__construct() will return + // the current time for empty input which is probably not + // what is meant. The invalid empty string is probably to + // be interpreted as a missing field/value. Let's handle + // this graceful. + if (!empty($data)) { + return new \DateTime($data); + } else { + return null; + } + } elseif (in_array($class, ['DateTime', 'bool', 'boolean', 'byte', 'double', 'float', 'int', 'integer', 'mixed', 'number', 'object', 'string', 'void'], true)) { + settype($data, $class); + return $data; + } elseif ($class === '\SplFileObject') { + /** @var \Psr\Http\Message\StreamInterface $data */ + + // determine file name + if (array_key_exists('Content-Disposition', $httpHeaders) && + preg_match('/inline; filename=[\'"]?([^\'"\s]+)[\'"]?$/i', $httpHeaders['Content-Disposition'], $match)) { + $filename = Configuration::getDefaultConfiguration()->getTempFolderPath() . DIRECTORY_SEPARATOR . self::sanitizeFilename($match[1]); + } else { + $filename = tempnam(Configuration::getDefaultConfiguration()->getTempFolderPath(), ''); + } + + $file = fopen($filename, 'w'); + while ($chunk = $data->read(200)) { + fwrite($file, $chunk); + } + fclose($file); + + return new \SplFileObject($filename, 'r'); + } elseif (method_exists($class, 'getAllowableEnumValues')) { + if (!in_array($data, $class::getAllowableEnumValues())) { + $imploded = implode("', '", $class::getAllowableEnumValues()); + throw new \InvalidArgumentException("Invalid value for enum '$class', must be one of: '$imploded'"); + } + return $data; + } else { + // If a discriminator is defined and points to a valid subclass, use it. + $discriminator = $class::DISCRIMINATOR; + if (!empty($discriminator) && isset($data->{$discriminator}) && is_string($data->{$discriminator})) { + $subclass = '\Swagger\Client\Model\\' . $data->{$discriminator}; + if (is_subclass_of($subclass, $class)) { + $class = $subclass; + } + } + $instance = new $class(); + foreach ($instance::swaggerTypes() as $property => $type) { + $propertySetter = $instance::setters()[$property]; + + if (!isset($propertySetter) || !isset($data->{$instance::attributeMap()[$property]})) { + continue; + } + + $propertyValue = $data->{$instance::attributeMap()[$property]}; + if (isset($propertyValue)) { + $instance->$propertySetter(self::deserialize($propertyValue, $type, null)); + } + } + return $instance; + } + } +} diff --git a/src/SuplaApi.php b/src/SuplaApi.php new file mode 100644 index 0000000..90dc7b5 --- /dev/null +++ b/src/SuplaApi.php @@ -0,0 +1,76 @@ +server = $server; + if (strpos($this->server, 'http') !== 0) { + $this->server = 'https://' . $server; + } + $this->tokenRequestData = [ + "client_id" => $clientId, + "client_secret" => $secret, + "grant_type" => 'password', + "username" => $username, + "password" => $password, + ]; + $this->httpClient = new Client(); + } + + private function retrieveToken() { + if ($this->token) { + return $this->token; + } + $response = $this->httpClient->post( + $this->server . '/oauth/v2/token', + [\GuzzleHttp\RequestOptions::JSON => $this->tokenRequestData] + ); + $response = json_decode($response->getBody(), true); + return $this->token = $response['access_token']; + } + + public function __call($name, $arguments) { + $apiName = ucfirst($name); + $apiClass = "Swagger\\Client\\Api\\${apiName}Api"; + if (class_exists($apiClass)) { + return new $apiClass($this->httpClient, new SuplaApiConfiguration($this->server, $this->retrieveToken())); + } else { + throw new \BadMethodCallException($name); + } + } +} diff --git a/src/SuplaApiClient.php b/src/SuplaApiClient.php deleted file mode 100644 index 2a1cc9f..0000000 --- a/src/SuplaApiClient.php +++ /dev/null @@ -1,310 +0,0 @@ -server = $server_params['server']; - $this->clientId = $server_params['clientId']; - $this->secret = $server_params['secret']; - $this->username = $server_params['username']; - $this->password = $server_params['password']; - - $this->debug = $debug; - $this->sslVerify = $sslVerify; - $this->token = null; - $this->auto_logout = $auto_logout; - } - - private function setLastError($error) { - $this->last_error = $error; - } - - private function remoteRequest($data, $path, $method = 'POST', $bearer = false) { - - $data_string = ''; - $result = false; - $access_token = null; - - if ($bearer && ($access_token = $this->getAccessToken()) == '') { - return false; - } - - if ($method == 'GET') { - $data_string = @http_build_query($data); - - if ($data_string !== false) { - $path .= '/' . $data_string; - $data_string = null; - } - } else { - $data_string = json_encode($data); - } - - $ch = curl_init('https://' . $this->server . $path); - curl_setopt($ch, CURLOPT_CUSTOMREQUEST, $method); - - if ($method != 'GET') { - curl_setopt($ch, CURLOPT_POSTFIELDS, $data_string); - } - - if ($bearer) { - curl_setopt($ch, CURLOPT_HTTPHEADER, ['Authorization: Bearer ' . $access_token]); - } else { - if (strlen(@$data_string) > 0) { - curl_setopt($ch, CURLOPT_HTTPHEADER, [ - 'Content-Type: application/json', - 'Content-Length: ' . strlen($data_string)]); - } - } - - curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); - if (!$this->sslVerify) { - curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); - curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false); - } - $cresult = curl_exec($ch); - $result = false; - - $code = curl_getinfo($ch, CURLINFO_HTTP_CODE); - - if (curl_errno($ch) == 0) { - if ($code === 200) { - $result = json_decode($cresult); - } else { - $this->setLastError("HTTP: " . $code); - } - } else { - $this->setLastError("CURL ERR: " . curl_error($ch)); - } - - if ($this->debug) { - var_dump($cresult); - var_dump($result); - echo $this->getLastError() . PHP_EOL; - } - - curl_close($ch); - return $result; - } - - private function tokenRequest() { - $params = ["client_id" => $this->clientId, - "client_secret" => $this->secret, - "grant_type" => 'password', - "username" => $this->username, - "password" => $this->password]; - $result = $this->remoteRequest($params, '/oauth/v2/token'); - if ($result !== false && @$result->token_type == 'bearer') { - $result->expires_in = time() + intval(@$result->expires_in); - $this->token = $result; - return true; - } elseif ($result === false && $this->last_error === null) { - $this->setLastError('Unknown error'); - } - $this->token = null; - return false; - } - - private function accessTokenExists() { - return $this->token !== null && $this->token->expires_in > time() + 5 && $this->token->access_token != ''; - } - - private function getAccessToken() { - if ($this->accessTokenExists() == false) { - $this->tokenRequest(); - } - return @$this->token->access_token; - } - - private function autoLogout() { - if ($this->auto_logout === true) { - $this->logout(); - } - } - - private function apiGET($path, $data = null) { - if (is_array($data)) { - foreach ($data as $value) { - $path .= '/' . urlencode($value); - } - } - $result = $this->remoteRequest(null, $path, 'GET', true); - return $result; - } - - private function apiP($path, $method, $data = null) { - $result = $this->remoteRequest($data, $path, $method, true); - if ($result !== false) { - return @$result->data; - } - return false; - } - - private function apiPUT($path, $data = null) { - return $this->apiP($path, 'PUT', $data); - } - - private function apiPATCH($path, $data = null) { - return $this->apiP($path, 'PATCH', $data); - } - - private function getResult($path) { - $result = $this->apiGET('/api' . $path); - $this->autoLogout(); - return $result; - } - - private function put($path, $data = null) { - $result = $this->apiPUT('/api' . $path, $data); - $this->autoLogout(); - return $result; - } - - private function patch($path, $data = null) { - $result = $this->apiPATCH('/api' . $path, $data); - $this->autoLogout(); - return $result; - } - - public function getLastError() { - return $this->last_error; - } - - public function setDebug($debug) { - $this->debug = $debug; - } - - public function setAutoLogout($auto_logout) { - $this->auto_logout = $auto_logout; - } - - public function getToken() { - $this->getAccessToken(); - return serialize($this->token); - } - - public function setToken($token) { - $this->token = unserialize($token); - } - - public function logout() { - if ($this->accessTokenExists()) { - $this->apiGET('/api/logout', [@$this->token->refresh_token]); - } - $this->token = null; - } - - public function getServerInfo() { - return $this->getResult('/server-info'); - } - - public function locations() { - return $this->getResult('/locations'); - } - - public function accessIDs() { - return $this->getResult('/accessids'); - } - - public function ioDevices() { - return $this->getResult('/iodevices'); - } - - public function ioDevice($devid) { - return $this->getResult('/iodevices/' . $devid); - } - - public function temperatureLogItemCount($channelid) { - return $this->getResult('/channels/' . $channelid . '/temperature-log-count'); - } - - public function temperatureLogGetItems($channelid, $offset = 0, $limit = 0) { - return $this->getResult('/channels/' . $channelid . '/temperature-log-items?offset=' . $offset . '&limit=' . $limit); - } - - public function temperatureAndHumidityLogItemCount($channelid) { - return $this->getResult('/channels/' . $channelid . '/temperature-and-humidity-count'); - } - - public function temperatureAndHumidityLogGetItems($channelid, $offset = 0, $limit = 0) { - return $this->getResult('/channels/' . $channelid . '/temperature-and-humidity-items?offset=' . $offset . '&limit=' . $limit); - } - - public function channel($channelid) { - return $this->getResult('/channels/' . $channelid); - } - - public function channelSetRGBW($channelid, $color, $color_brightness, $brightness) { - $data = ['color' => $color, - 'color_brightness' => $color_brightness, - 'brightness' => $brightness]; - return $this->put('/channels/' . $channelid, $data); - } - - public function channelSetRGB($channelid, $color, $color_brightness) { - $data = ['color' => $color, - 'color_brightness' => $color_brightness]; - return $this->put('/channels/' . $channelid, $data); - } - - public function channelSetBrightness($channelid, $brightness) { - $data = ['brightness' => $brightness]; - return $this->put('/channels/' . $channelid, $data); - } - - public function channelTurnOn($channelid) { - return $this->patch('/channels/' . $channelid, ['action' => 'turn-on']); - } - - public function channelTurnOff($channelid) { - return $this->patch('/channels/' . $channelid, ['action' => 'turn-off']); - } - - public function channelOpen($channelid) { - return $this->patch('/channels/' . $channelid, ['action' => 'open']); - } - - public function channelOpenClose($channelid) { - return $this->patch('/channels/' . $channelid, ['action' => 'open-close']); - } - - public function channelShut($channelid, $percent = 100) { - return $this->patch('/channels/' . $channelid, ['action' => 'shut', 'percent' => $percent]); - } - - public function channelReveal($channelid, $percent = 100) { - return $this->patch('/channels/' . $channelid, ['action' => 'reveal', 'percent' => $percent]); - } - - public function channelStop($channelid) { - return $this->patch('/channels/' . $channelid, ['action' => 'stop']); - } -} diff --git a/src/SuplaApiConfiguration.php b/src/SuplaApiConfiguration.php new file mode 100644 index 0000000..a164669 --- /dev/null +++ b/src/SuplaApiConfiguration.php @@ -0,0 +1,30 @@ +host = $server . '/api/v' . self::VERSION; + $this->accessToken = $token; + } +} diff --git a/src/demo.php b/src/demo.php new file mode 100644 index 0000000..45a9b10 --- /dev/null +++ b/src/demo.php @@ -0,0 +1,15 @@ +channelGroups()->getChannelGroup(1)->getCaption(); diff --git a/swagger.json b/swagger.json new file mode 100644 index 0000000..9f41ab4 --- /dev/null +++ b/swagger.json @@ -0,0 +1,6842 @@ +{ + "swagger" : "2.0", + "info" : { + "version" : "2.2.0", + "title" : "SUPLA Cloud API" + }, + "host" : "cloud.supla.org", + "basePath" : "/api/v2.2.0", + "schemes" : [ "https", "http" ], + "consumes" : [ "application/json" ], + "produces" : [ "application/json" ], + "security" : [ { + "password" : [ ] + } ], + "paths" : { + "/accessids" : { + "get" : { + "tags" : [ "Access Identifiers" ], + "summary" : "Get Access Identifiers list", + "operationId" : "getAccessIdentifiers", + "parameters" : [ { + "name" : "include", + "in" : "query", + "description" : "Specify what extra fields to include in the response.", + "required" : false, + "type" : "array", + "items" : { + "type" : "string", + "enum" : [ "locations", "clientApps", "password" ] + }, + "collectionFormat" : "csv" + } ], + "responses" : { + "200" : { + "description" : "List of Access Identifiers owned by the current user.", + "schema" : { + "type" : "array", + "items" : { + "$ref" : "#/definitions/AccessIdentifier" + } + } + } + } + }, + "post" : { + "tags" : [ "Access Identifiers" ], + "summary" : "Create a new Access Identifier", + "operationId" : "createAccessIdentifier", + "parameters" : [ ], + "responses" : { + "201" : { + "description" : "Newely created AccessIdentifier with automatic name", + "schema" : { + "$ref" : "#/definitions/AccessIdentifier" + } + } + } + } + }, + "/accessids/{id}" : { + "get" : { + "tags" : [ "Access Identifiers" ], + "summary" : "Get Access Identifier", + "operationId" : "getAccessIdentifier", + "parameters" : [ { + "name" : "id", + "in" : "path", + "required" : true, + "type" : "integer" + }, { + "name" : "include", + "in" : "query", + "description" : "Specify what extra fields to include in the response.", + "required" : false, + "type" : "array", + "items" : { + "type" : "string", + "enum" : [ "locations", "clientApps", "password" ] + }, + "collectionFormat" : "csv" + } ], + "responses" : { + "200" : { + "description" : "Get Access Identifier", + "schema" : { + "$ref" : "#/definitions/AccessIdentifier" + } + } + } + }, + "put" : { + "tags" : [ "Access Identifiers" ], + "summary" : "Update Access Identifier", + "operationId" : "updateAccessIdentifier", + "parameters" : [ { + "name" : "id", + "in" : "path", + "required" : true, + "type" : "integer" + }, { + "in" : "body", + "name" : "body", + "required" : true, + "schema" : { + "$ref" : "#/definitions/Access Identifier update request" + } + } ], + "responses" : { + "200" : { + "description" : "Definition generated from Swagger Inspector", + "schema" : { + "$ref" : "#/definitions/AccessIdentifier" + } + } + } + }, + "delete" : { + "tags" : [ "Access Identifiers" ], + "summary" : "Delete Access Identifier", + "operationId" : "deleteAccessIdentifier", + "parameters" : [ { + "name" : "id", + "in" : "path", + "required" : true, + "type" : "integer" + } ], + "responses" : { + "204" : { + "description" : "Access Identifier has been successfully deleted" + } + } + } + }, + "/channels" : { + "get" : { + "tags" : [ "Channels" ], + "summary" : "Get channels list", + "operationId" : "getChannels", + "parameters" : [ { + "name" : "include", + "in" : "query", + "description" : "Specify what extra fields to include in the response.", + "required" : false, + "type" : "array", + "items" : { + "type" : "string", + "enum" : [ "iodevice", "location" ] + }, + "collectionFormat" : "csv" + }, { + "name" : "function", + "in" : "query", + "required" : false, + "type" : "array", + "items" : { + "type" : "string", + "enum" : [ "NONE", "CONTROLLINGTHEGATEWAYLOCK", "CONTROLLINGTHEGATE", "CONTROLLINGTHEGARAGEDOOR", "THERMOMETER", "HUMIDITY", "HUMIDITYANDTEMPERATURE", "OPENINGSENSOR_GATEWAY", "OPENINGSENSOR_GATE", "OPENINGSENSOR_GARAGEDOOR", "NOLIQUIDSENSOR", "CONTROLLINGTHEDOORLOCK", "OPENINGSENSOR_DOOR", "CONTROLLINGTHEROLLERSHUTTER", "OPENINGSENSOR_ROLLERSHUTTER", "POWERSWITCH", "LIGHTSWITCH", "DIMMER", "RGBLIGHTING", "DIMMERANDRGBLIGHTING", "DEPTHSENSOR", "DISTANCESENSOR", "OPENINGSENSOR_WINDOW", "MAILSENSOR", "WINDSENSOR", "PRESSURESENSOR", "RAINSENSOR", "WEIGHTSENSOR", "WEATHER_STATION", "STAIRCASETIMER" ] + }, + "collectionFormat" : "csv" + }, { + "name" : "io", + "in" : "query", + "description" : "Return only `input` or `output` channels.", + "required" : false, + "type" : "string", + "enum" : [ "input", "output" ] + }, { + "name" : "hasFunction", + "in" : "query", + "description" : "Return only channels with (`true`) or without (`false`) chosen functions.", + "required" : false, + "type" : "boolean" + } ], + "responses" : { + "200" : { + "description" : "List of channels owned by the current user.", + "schema" : { + "type" : "array", + "items" : { + "$ref" : "#/definitions/Channel" + } + } + } + } + } + }, + "/channels/{id}" : { + "get" : { + "tags" : [ "Channels" ], + "summary" : "Get channel by ID", + "operationId" : "getChannel", + "parameters" : [ { + "name" : "id", + "in" : "path", + "required" : true, + "type" : "integer" + }, { + "name" : "include", + "in" : "query", + "description" : "Specify what extra fields to include in the response.", + "required" : false, + "type" : "array", + "items" : { + "type" : "string", + "enum" : [ "iodevice", "location", "connected", "state", "supportedFunctions" ] + }, + "collectionFormat" : "csv" + } ], + "responses" : { + "200" : { + "description" : "Get channel", + "schema" : { + "$ref" : "#/definitions/Channel" + } + } + } + }, + "put" : { + "tags" : [ "Channels" ], + "summary" : "Update channel", + "operationId" : "updateChannel", + "parameters" : [ { + "name" : "id", + "in" : "path", + "required" : true, + "type" : "integer" + }, { + "in" : "body", + "name" : "body", + "required" : true, + "schema" : { + "$ref" : "#/definitions/Channel update request" + } + } ], + "responses" : { + "200" : { + "description" : "Updated channel", + "schema" : { + "$ref" : "#/definitions/Channel" + } + }, + "409" : { + "description" : "Channel update will result in data loss. Please confirm the request with `confirm=true` GET param to force.", + "schema" : { + "$ref" : "#/definitions/Channel update confirmation response" + } + } + } + }, + "patch" : { + "tags" : [ "Channels" ], + "summary" : "Execute action on the channel", + "operationId" : "executeAction", + "parameters" : [ { + "name" : "id", + "in" : "path", + "required" : true, + "type" : "integer" + }, { + "in" : "body", + "name" : "body", + "description" : "Defines an action to execute on channel. The `action` key is always required. The rest of the keys are params depending on the chosen action. Read more on [Github Wiki](https://github.com/SUPLA/supla-cloud/wiki/Channel-Actions).", + "required" : true, + "schema" : { + "$ref" : "#/definitions/ChannelExecuteActionRequest" + } + } ], + "responses" : { + "204" : { + "description" : "Action has been executed." + }, + "400" : { + "description" : "Invalid request.", + "schema" : { + "$ref" : "#/definitions/Channel action execution failed response" + } + } + } + } + }, + "/channels/{id}/schedules" : { + "get" : { + "tags" : [ "Channels" ], + "summary" : "Get schedules list of the channel", + "operationId" : "getChannelSchedules", + "parameters" : [ { + "name" : "id", + "in" : "path", + "required" : true, + "type" : "integer" + }, { + "name" : "include", + "in" : "query", + "description" : "Specify what extra fields to include in the response.", + "required" : false, + "type" : "array", + "items" : { + "type" : "string", + "enum" : [ "channel", "iodevice", "location", "closestExecutions" ] + }, + "collectionFormat" : "csv" + } ], + "responses" : { + "200" : { + "description" : "Success", + "schema" : { + "type" : "array", + "items" : { + "$ref" : "#/definitions/Schedule" + } + } + } + } + } + }, + "/channels/{id}/measurement-logs-csv" : { + "get" : { + "tags" : [ "Channels" ], + "summary" : "Get measurement logs as zipped CSV file.", + "description" : "Supported channel functions: `THERMOMETER` and `HUMIDITYANDTEMPERATURE`. Logs ordered by date, descending.", + "operationId" : "getChannelMeasurementLogsCsvFile", + "produces" : [ "application/zip" ], + "parameters" : [ { + "name" : "id", + "in" : "path", + "required" : true, + "type" : "integer" + } ], + "responses" : { + "200" : { + "description" : "Success", + "schema" : { + "type" : "file" + } + }, + "400" : { + "description" : "Unsupported channel", + "schema" : { + "$ref" : "#/definitions/Channel unsupported function response" + } + } + } + } + }, + "/channels/{id}/measurement-logs" : { + "get" : { + "tags" : [ "Channels" ], + "summary" : "Get measurement logs.", + "description" : "Supported channel functions: `THERMOMETER` and `HUMIDITYANDTEMPERATURE`. Logs ordered by date, descending.", + "operationId" : "getChannelMeasurementLogs", + "parameters" : [ { + "name" : "id", + "in" : "path", + "required" : true, + "type" : "integer" + }, { + "name" : "limit", + "in" : "query", + "description" : "Maximum items count in response, from 1 to 5000", + "required" : false, + "type" : "integer", + "default" : 5000 + }, { + "name" : "offset", + "in" : "query", + "description" : "Pagination offset", + "required" : false, + "type" : "integer" + } ], + "responses" : { + "200" : { + "description" : "Success", + "schema" : { + "type" : "array", + "items" : { + "$ref" : "#/definitions/Channel measurement log" + } + }, + "headers" : { + "X-Total-Count" : { + "type" : "integer", + "description" : "Total count of logs for this channel." + } + } + }, + "400" : { + "description" : "Unsupoorted channel", + "schema" : { + "$ref" : "#/definitions/Channel unsupported function response" + } + } + } + } + }, + "/channel-groups" : { + "get" : { + "tags" : [ "Channel Groups" ], + "summary" : "Get channels list", + "operationId" : "getChannelGroups", + "parameters" : [ { + "name" : "include", + "in" : "query", + "description" : "Specify what extra fields to include in the response.", + "required" : false, + "type" : "array", + "items" : { + "type" : "string", + "enum" : [ "channels" ] + }, + "collectionFormat" : "csv" + } ], + "responses" : { + "200" : { + "description" : "List of channels oroups owned by the current user.", + "schema" : { + "type" : "array", + "items" : { + "$ref" : "#/definitions/ChannelGroup" + } + } + } + } + }, + "post" : { + "tags" : [ "Channel Groups" ], + "summary" : "Create a new channel group", + "operationId" : "createChannelGroup", + "parameters" : [ { + "in" : "body", + "name" : "body", + "required" : true, + "schema" : { + "$ref" : "#/definitions/ChannelGroupRequest" + } + } ], + "responses" : { + "201" : { + "description" : "Newely created channel group", + "schema" : { + "$ref" : "#/definitions/ChannelGroup" + } + } + } + } + }, + "/channel-groups/{id}" : { + "get" : { + "tags" : [ "Channel Groups" ], + "summary" : "Get channel group by ID", + "operationId" : "getChannelGroup", + "parameters" : [ { + "name" : "id", + "in" : "path", + "required" : true, + "type" : "integer" + }, { + "name" : "include", + "in" : "query", + "description" : "Specify what extra fields to include in the response.", + "required" : false, + "type" : "array", + "items" : { + "type" : "string", + "enum" : [ "channels", "iodevice", "location" ] + }, + "collectionFormat" : "csv" + } ], + "responses" : { + "200" : { + "description" : "Success", + "schema" : { + "$ref" : "#/definitions/ChannelGroup" + } + } + } + }, + "put" : { + "tags" : [ "Channel Groups" ], + "summary" : "Update channel group", + "operationId" : "updateChannelGroup", + "parameters" : [ { + "name" : "id", + "in" : "path", + "required" : true, + "type" : "integer" + }, { + "in" : "body", + "name" : "body", + "required" : true, + "schema" : { + "$ref" : "#/definitions/ChannelGroupRequest" + } + } ], + "responses" : { + "200" : { + "description" : "Success", + "schema" : { + "$ref" : "#/definitions/ChannelGroup" + } + } + } + }, + "delete" : { + "tags" : [ "Channel Groups" ], + "summary" : "Delete Channel Group", + "operationId" : "deleteChannelGroup", + "parameters" : [ { + "name" : "id", + "in" : "path", + "required" : true, + "type" : "integer" + } ], + "responses" : { + "204" : { + "description" : "Channel Group has been successfully deleted" + } + } + }, + "patch" : { + "tags" : [ "Channel Groups" ], + "summary" : "Execute action on the channel group", + "operationId" : "executeChannelGroupAction", + "parameters" : [ { + "name" : "id", + "in" : "path", + "required" : true, + "type" : "integer" + }, { + "in" : "body", + "name" : "body", + "description" : "Defines an action to execute on channel group. The `action` key is always required. The rest of the keys are params depending on the chosen action. Read more on [Github Wiki](https://github.com/SUPLA/supla-cloud/wiki/Channel-Actions).", + "required" : true, + "schema" : { + "$ref" : "#/definitions/ChannelExecuteActionRequest" + } + } ], + "responses" : { + "204" : { + "description" : "Action has been executed." + }, + "400" : { + "description" : "Invalid request.", + "schema" : { + "$ref" : "#/definitions/Channel action execution failed response" + } + } + } + } + }, + "/client-apps" : { + "get" : { + "tags" : [ "Client Apps" ], + "summary" : "Get client apps", + "operationId" : "getClientApps", + "parameters" : [ { + "name" : "include", + "in" : "query", + "description" : "Specify what extra fields to include in the response.", + "required" : false, + "type" : "array", + "items" : { + "type" : "string", + "enum" : [ "accessId", "connected" ] + }, + "collectionFormat" : "csv" + } ], + "responses" : { + "200" : { + "description" : "Success", + "schema" : { + "type" : "array", + "items" : { + "$ref" : "#/definitions/ClientApp" + } + } + } + } + } + }, + "/client-apps/{id}" : { + "put" : { + "tags" : [ "Client Apps" ], + "summary" : "Update client app", + "operationId" : "updateClientApp", + "parameters" : [ { + "name" : "id", + "in" : "path", + "required" : true, + "type" : "integer" + }, { + "in" : "body", + "name" : "body", + "required" : true, + "schema" : { + "$ref" : "#/definitions/Client App update request" + } + } ], + "responses" : { + "200" : { + "description" : "Success", + "schema" : { + "$ref" : "#/definitions/ClientApp" + } + } + } + }, + "delete" : { + "tags" : [ "Client Apps" ], + "summary" : "Delete Client App", + "operationId" : "deleteClientApp", + "parameters" : [ { + "name" : "id", + "in" : "path", + "required" : true, + "type" : "integer" + } ], + "responses" : { + "204" : { + "description" : "Success" + } + } + } + }, + "/iodevices" : { + "get" : { + "tags" : [ "IO Devices" ], + "summary" : "Get IO Devices", + "operationId" : "getIoDevices", + "parameters" : [ { + "name" : "include", + "in" : "query", + "description" : "Specify what extra fields to include in the response.", + "required" : false, + "type" : "array", + "items" : { + "type" : "string", + "enum" : [ "channels", "location", "originalLocation", "connected", "schedules" ] + }, + "collectionFormat" : "csv" + } ], + "responses" : { + "200" : { + "description" : "Success", + "schema" : { + "type" : "array", + "items" : { + "$ref" : "#/definitions/Device" + } + } + } + } + } + }, + "/iodevices/{id}" : { + "get" : { + "tags" : [ "IO Devices" ], + "summary" : "Get IO Device", + "operationId" : "getIoDevice", + "parameters" : [ { + "name" : "id", + "in" : "path", + "required" : true, + "type" : "integer" + }, { + "name" : "include", + "in" : "query", + "description" : "Specify what extra fields to include in the response.", + "required" : false, + "type" : "array", + "items" : { + "type" : "string", + "enum" : [ "channels", "location", "originalLocation", "connected", "schedules", "accessids" ] + }, + "collectionFormat" : "csv" + } ], + "responses" : { + "200" : { + "description" : "Success", + "schema" : { + "$ref" : "#/definitions/Device" + } + } + } + }, + "put" : { + "tags" : [ "IO Devices" ], + "summary" : "Update IO Device", + "operationId" : "updateIoDevice", + "parameters" : [ { + "name" : "id", + "in" : "path", + "required" : true, + "type" : "integer" + }, { + "in" : "body", + "name" : "body", + "required" : true, + "schema" : { + "$ref" : "#/definitions/IO Device update request" + } + } ], + "responses" : { + "200" : { + "description" : "Success", + "schema" : { + "$ref" : "#/definitions/Device" + } + } + } + }, + "delete" : { + "tags" : [ "IO Devices" ], + "summary" : "Delete IO Device", + "operationId" : "deleteIoDevice", + "parameters" : [ { + "name" : "id", + "in" : "path", + "required" : true, + "type" : "integer" + } ], + "responses" : { + "204" : { + "description" : "Success" + } + } + } + }, + "/iodevices/{id}/channels" : { + "get" : { + "tags" : [ "IO Devices" ], + "summary" : "Get Channels that belong to IO Deice", + "operationId" : "getIoDeviceChannels", + "parameters" : [ { + "name" : "id", + "in" : "path", + "required" : true, + "type" : "integer" + }, { + "name" : "include", + "in" : "query", + "description" : "Specify what extra fields to include in the response.", + "required" : false, + "type" : "array", + "items" : { + "type" : "string", + "enum" : [ "iodevice", "location" ] + }, + "collectionFormat" : "csv" + } ], + "responses" : { + "200" : { + "description" : "Success", + "schema" : { + "$ref" : "#/definitions/Channel" + } + } + } + } + }, + "/locations" : { + "get" : { + "tags" : [ "Locations" ], + "summary" : "Get locations list", + "operationId" : "getLocations", + "parameters" : [ { + "name" : "include", + "in" : "query", + "description" : "Specify what extra fields to include in the response.", + "required" : false, + "type" : "array", + "items" : { + "type" : "string", + "enum" : [ "channels", "iodevices", "accessids", "channelGroups", "password" ] + }, + "collectionFormat" : "csv" + } ], + "responses" : { + "200" : { + "description" : "List of locations owned by the current user.", + "schema" : { + "type" : "array", + "items" : { + "$ref" : "#/definitions/Location" + } + } + } + } + }, + "post" : { + "tags" : [ "Locations" ], + "summary" : "Create a new location", + "operationId" : "createLocation", + "parameters" : [ ], + "responses" : { + "201" : { + "description" : "Newely created location with automatic name", + "schema" : { + "$ref" : "#/definitions/Location" + } + } + } + } + }, + "/locations/{id}" : { + "get" : { + "tags" : [ "Locations" ], + "summary" : "Get location by ID", + "operationId" : "getLocation", + "parameters" : [ { + "name" : "id", + "in" : "path", + "required" : true, + "type" : "integer" + }, { + "name" : "include", + "in" : "query", + "description" : "Specify what extra fields to include in the response.", + "required" : false, + "type" : "array", + "items" : { + "type" : "string", + "enum" : [ "channels", "iodevices", "accessids", "channelGroups", "password" ] + }, + "collectionFormat" : "csv" + } ], + "responses" : { + "200" : { + "description" : "Get location", + "schema" : { + "$ref" : "#/definitions/Location" + } + } + } + }, + "put" : { + "tags" : [ "Locations" ], + "summary" : "Update location", + "operationId" : "updateLocation", + "parameters" : [ { + "name" : "id", + "in" : "path", + "required" : true, + "type" : "integer" + }, { + "name" : "include", + "in" : "query", + "description" : "Specify what extra fields to include in the response.", + "required" : false, + "type" : "array", + "items" : { + "type" : "string", + "enum" : [ "channels", "iodevices", "accessids", "channelGroups", "password" ] + }, + "collectionFormat" : "csv" + }, { + "in" : "body", + "name" : "body", + "required" : true, + "schema" : { + "$ref" : "#/definitions/Location update request" + } + } ], + "responses" : { + "200" : { + "description" : "Definition generated from Swagger Inspector", + "schema" : { + "$ref" : "#/definitions/Location" + } + } + } + }, + "delete" : { + "tags" : [ "Locations" ], + "summary" : "Delete location", + "operationId" : "deleteLocation", + "parameters" : [ { + "name" : "id", + "in" : "path", + "required" : true, + "type" : "integer" + }, { + "name" : "include", + "in" : "query", + "description" : "Specify what extra fields to include in the response.", + "required" : false, + "type" : "array", + "items" : { + "type" : "string", + "enum" : [ "channels", "iodevices", "accessids", "channelGroups", "password" ] + }, + "collectionFormat" : "csv" + } ], + "responses" : { + "204" : { + "description" : "Location has been successfully deleted" + } + } + } + }, + "/server-status" : { + "get" : { + "tags" : [ "Server" ], + "summary" : "Get the SUPLA Server status", + "operationId" : "getSuplaServerStatus", + "parameters" : [ ], + "responses" : { + "200" : { + "description" : "Supla Server is alive" + }, + "503" : { + "description" : "SUPLA Server is down" + } + }, + "security" : [ ] + } + }, + "/server-info" : { + "get" : { + "tags" : [ "Server" ], + "summary" : "Get server info", + "operationId" : "getServerInfo", + "parameters" : [ ], + "responses" : { + "200" : { + "description" : "Success", + "schema" : { + "$ref" : "#/definitions/Server Info" + } + } + }, + "security" : [ ] + } + }, + "/schedules" : { + "get" : { + "tags" : [ "Schedules" ], + "summary" : "Get schedules list", + "operationId" : "getSchedules", + "parameters" : [ { + "name" : "include", + "in" : "query", + "description" : "Specify what extra fields to include in the response.", + "required" : false, + "type" : "array", + "items" : { + "type" : "string", + "enum" : [ "channel", "iodevice", "location", "closestExecutions" ] + }, + "collectionFormat" : "csv" + } ], + "responses" : { + "200" : { + "description" : "Success", + "schema" : { + "type" : "array", + "items" : { + "$ref" : "#/definitions/Schedule" + } + } + } + } + }, + "post" : { + "tags" : [ "Schedules" ], + "summary" : "Create a new schedule", + "operationId" : "createSchedule", + "parameters" : [ { + "in" : "body", + "name" : "body", + "required" : true, + "schema" : { + "$ref" : "#/definitions/ScheduleRequest" + } + } ], + "responses" : { + "201" : { + "description" : "Success", + "schema" : { + "$ref" : "#/definitions/Schedule" + } + } + } + }, + "patch" : { + "tags" : [ "Schedules" ], + "summary" : "Enable schedules", + "operationId" : "enableSchedules", + "parameters" : [ { + "in" : "body", + "name" : "body", + "required" : true, + "schema" : { + "$ref" : "#/definitions/Schedules enable request" + } + } ], + "responses" : { + "204" : { + "description" : "Success" + } + } + } + }, + "/schedules/{id}" : { + "get" : { + "tags" : [ "Schedules" ], + "summary" : "Get Schedule", + "operationId" : "getSchedule", + "parameters" : [ { + "name" : "id", + "in" : "path", + "required" : true, + "type" : "integer" + }, { + "name" : "include", + "in" : "query", + "description" : "Specify what extra fields to include in the response.", + "required" : false, + "type" : "array", + "items" : { + "type" : "string", + "enum" : [ "channel", "iodevice", "location", "closestExecutions" ] + }, + "collectionFormat" : "csv" + } ], + "responses" : { + "200" : { + "description" : "Success", + "schema" : { + "$ref" : "#/definitions/Schedule" + } + } + } + }, + "put" : { + "tags" : [ "Schedules" ], + "summary" : "Update schedule", + "operationId" : "updateSchedule", + "parameters" : [ { + "name" : "id", + "in" : "path", + "required" : true, + "type" : "integer" + }, { + "in" : "body", + "name" : "body", + "required" : true, + "schema" : { + "$ref" : "#/definitions/ScheduleRequest" + } + }, { + "name" : "enable", + "in" : "query", + "description" : "Set to `true` to enable the schedule after saving.", + "required" : false, + "type" : "boolean", + "enum" : [ "true" ] + } ], + "responses" : { + "200" : { + "description" : "Success", + "schema" : { + "$ref" : "#/definitions/Schedule" + } + } + } + }, + "delete" : { + "tags" : [ "Schedules" ], + "summary" : "Delete Schedule", + "operationId" : "deleteSchedule", + "parameters" : [ { + "name" : "id", + "in" : "path", + "required" : true, + "type" : "integer" + } ], + "responses" : { + "204" : { + "description" : "Success" + } + } + } + }, + "/users/current" : { + "get" : { + "tags" : [ "Users" ], + "summary" : "Get current user", + "operationId" : "getCurrentUser", + "parameters" : [ ], + "responses" : { + "200" : { + "description" : "Success", + "schema" : { + "$ref" : "#/definitions/User data" + } + } + } + }, + "patch" : { + "tags" : [ "Users" ], + "summary" : "Update current user", + "operationId" : "updateCurrentUser", + "parameters" : [ { + "in" : "body", + "name" : "body", + "required" : true, + "schema" : { + "$ref" : "#/definitions/User update request" + } + } ], + "responses" : { + "200" : { + "description" : "Success" + } + } + } + } + }, + "securityDefinitions" : { + "password" : { + "type" : "oauth2", + "tokenUrl" : "https://beta-cloud.supla.org/oauth/v2/token", + "flow" : "password", + "scopes" : { + "restapi" : "full API access" + } + } + }, + "definitions" : { + "AccessIdentifier" : { + "properties" : { + "id" : { + "type" : "integer", + "description" : "Access Identifier identifier" + }, + "caption" : { + "type" : "string", + "description" : "Location caption" + }, + "enabled" : { + "type" : "boolean", + "description" : "`true` if the location is enabled, `false` otherwise" + }, + "locationsIds" : { + "type" : "array", + "description" : "array containing the location idenfifiers assigned to this access ID", + "items" : { + "type" : "integer" + } + }, + "clientAppsIds" : { + "type" : "array", + "description" : "array containing the client apps idenfifiers assigned to this access ID", + "items" : { + "type" : "integer" + } + }, + "locations" : { + "type" : "array", + "description" : "Returned only if requested by the `include` parameter.", + "items" : { + "$ref" : "#/definitions/Location" + } + }, + "clientApps" : { + "type" : "array", + "description" : "Returned only if requested by the `include` parameter.", + "items" : { + "$ref" : "#/definitions/ClientApp" + } + } + }, + "example" : { + "clientApps" : [ { + "lastAccessIpv4" : 6, + "caption" : "caption", + "regDate" : "2000-01-23T04:56:07.000+00:00", + "enabled" : true, + "connected" : true, + "accessId" : null, + "accessIdId" : 2, + "lastAccessDate" : "2000-01-23T04:56:07.000+00:00", + "regIpv4" : 3, + "name" : "name", + "protocolVersion" : 1, + "id" : 6, + "softwareVersion" : "softwareVersion" + }, { + "lastAccessIpv4" : 6, + "caption" : "caption", + "regDate" : "2000-01-23T04:56:07.000+00:00", + "enabled" : true, + "connected" : true, + "accessId" : null, + "accessIdId" : 2, + "lastAccessDate" : "2000-01-23T04:56:07.000+00:00", + "regIpv4" : 3, + "name" : "name", + "protocolVersion" : 1, + "id" : 6, + "softwareVersion" : "softwareVersion" + } ], + "caption" : "caption", + "locations" : [ { + "iodevicesIds" : [ 5, 5 ], + "password" : "password", + "channels" : [ { + "hidden" : true, + "channelNumber" : 6, + "iodevice" : null, + "caption" : "caption", + "type" : { + "output" : false, + "name" : "SENSORNO", + "caption" : "Sensor (normal open)", + "id" : 7 + }, + "param3" : null, + "param1" : { }, + "param2" : null, + "altIcon" : 5, + "connected" : true, + "functionId" : 60, + "supportedFunctions" : [ { + "maxAlternativeIconIndex" : 1, + "possibleActions" : [ { + "name" : { }, + "caption" : "caption", + "id" : 4 + }, { + "name" : { }, + "caption" : "caption", + "id" : 4 + } ], + "name" : "OPENINGSENSOR_GATE", + "caption" : "Gate opening sensor", + "id" : 60 + }, { + "maxAlternativeIconIndex" : 1, + "possibleActions" : [ { + "name" : { }, + "caption" : "caption", + "id" : 4 + }, { + "name" : { }, + "caption" : "caption", + "id" : 4 + } ], + "name" : "OPENINGSENSOR_GATE", + "caption" : "Gate opening sensor", + "id" : 60 + } ], + "locationId" : 9, + "function" : { + "maxAlternativeIconIndex" : 1, + "possibleActions" : [ { + "name" : { }, + "caption" : "caption", + "id" : 4 + }, { + "name" : { }, + "caption" : "caption", + "id" : 4 + } ], + "name" : "OPENINGSENSOR_GATE", + "caption" : "Gate opening sensor", + "id" : 60 + }, + "typeId" : 1000, + "location" : null, + "id" : 1, + "inheritedLocation" : true, + "iodeviceId" : 9 + }, { + "hidden" : true, + "channelNumber" : 6, + "iodevice" : null, + "caption" : "caption", + "type" : { + "output" : false, + "name" : "SENSORNO", + "caption" : "Sensor (normal open)", + "id" : 7 + }, + "param3" : null, + "param1" : { }, + "param2" : null, + "altIcon" : 5, + "connected" : true, + "functionId" : 60, + "supportedFunctions" : [ { + "maxAlternativeIconIndex" : 1, + "possibleActions" : [ { + "name" : { }, + "caption" : "caption", + "id" : 4 + }, { + "name" : { }, + "caption" : "caption", + "id" : 4 + } ], + "name" : "OPENINGSENSOR_GATE", + "caption" : "Gate opening sensor", + "id" : 60 + }, { + "maxAlternativeIconIndex" : 1, + "possibleActions" : [ { + "name" : { }, + "caption" : "caption", + "id" : 4 + }, { + "name" : { }, + "caption" : "caption", + "id" : 4 + } ], + "name" : "OPENINGSENSOR_GATE", + "caption" : "Gate opening sensor", + "id" : 60 + } ], + "locationId" : 9, + "function" : { + "maxAlternativeIconIndex" : 1, + "possibleActions" : [ { + "name" : { }, + "caption" : "caption", + "id" : 4 + }, { + "name" : { }, + "caption" : "caption", + "id" : 4 + } ], + "name" : "OPENINGSENSOR_GATE", + "caption" : "Gate opening sensor", + "id" : 60 + }, + "typeId" : 1000, + "location" : null, + "id" : 1, + "inheritedLocation" : true, + "iodeviceId" : 9 + } ], + "accessIdsIds" : [ 9, 9 ], + "channelGroups" : [ ], + "caption" : "caption", + "channelGroupsIds" : [ 2, 2 ], + "accessIds" : [ null, null ], + "id" : 5, + "iodevices" : [ { + "originalLocation" : null, + "lastIpv4" : 4, + "gUIDString" : "gUIDString", + "originalLocationId" : 1, + "regDate" : "2000-01-23T04:56:07.000+00:00", + "channelsIds" : [ 1, 1 ], + "enabled" : true, + "connected" : true, + "channels" : [ { + "hidden" : true, + "channelNumber" : 6, + "iodevice" : null, + "caption" : "caption", + "type" : { + "output" : false, + "name" : "SENSORNO", + "caption" : "Sensor (normal open)", + "id" : 7 + }, + "param3" : null, + "param1" : { }, + "param2" : null, + "altIcon" : 5, + "connected" : true, + "functionId" : 60, + "supportedFunctions" : [ { + "maxAlternativeIconIndex" : 1, + "possibleActions" : [ { + "name" : { }, + "caption" : "caption", + "id" : 4 + }, { + "name" : { }, + "caption" : "caption", + "id" : 4 + } ], + "name" : "OPENINGSENSOR_GATE", + "caption" : "Gate opening sensor", + "id" : 60 + }, { + "maxAlternativeIconIndex" : 1, + "possibleActions" : [ { + "name" : { }, + "caption" : "caption", + "id" : 4 + }, { + "name" : { }, + "caption" : "caption", + "id" : 4 + } ], + "name" : "OPENINGSENSOR_GATE", + "caption" : "Gate opening sensor", + "id" : 60 + } ], + "locationId" : 9, + "function" : { + "maxAlternativeIconIndex" : 1, + "possibleActions" : [ { + "name" : { }, + "caption" : "caption", + "id" : 4 + }, { + "name" : { }, + "caption" : "caption", + "id" : 4 + } ], + "name" : "OPENINGSENSOR_GATE", + "caption" : "Gate opening sensor", + "id" : 60 + }, + "typeId" : 1000, + "location" : null, + "id" : 1, + "inheritedLocation" : true, + "iodeviceId" : 9 + }, { + "hidden" : true, + "channelNumber" : 6, + "iodevice" : null, + "caption" : "caption", + "type" : { + "output" : false, + "name" : "SENSORNO", + "caption" : "Sensor (normal open)", + "id" : 7 + }, + "param3" : null, + "param1" : { }, + "param2" : null, + "altIcon" : 5, + "connected" : true, + "functionId" : 60, + "supportedFunctions" : [ { + "maxAlternativeIconIndex" : 1, + "possibleActions" : [ { + "name" : { }, + "caption" : "caption", + "id" : 4 + }, { + "name" : { }, + "caption" : "caption", + "id" : 4 + } ], + "name" : "OPENINGSENSOR_GATE", + "caption" : "Gate opening sensor", + "id" : 60 + }, { + "maxAlternativeIconIndex" : 1, + "possibleActions" : [ { + "name" : { }, + "caption" : "caption", + "id" : 4 + }, { + "name" : { }, + "caption" : "caption", + "id" : 4 + } ], + "name" : "OPENINGSENSOR_GATE", + "caption" : "Gate opening sensor", + "id" : 60 + } ], + "locationId" : 9, + "function" : { + "maxAlternativeIconIndex" : 1, + "possibleActions" : [ { + "name" : { }, + "caption" : "caption", + "id" : 4 + }, { + "name" : { }, + "caption" : "caption", + "id" : 4 + } ], + "name" : "OPENINGSENSOR_GATE", + "caption" : "Gate opening sensor", + "id" : 60 + }, + "typeId" : 1000, + "location" : null, + "id" : 1, + "inheritedLocation" : true, + "iodeviceId" : 9 + } ], + "lastConnected" : "2000-01-23T04:56:07.000+00:00", + "locationId" : 7, + "regIpv4" : 2, + "schedules" : [ { + "channel" : { + "hidden" : true, + "channelNumber" : 6, + "iodevice" : null, + "caption" : "caption", + "type" : { + "output" : false, + "name" : "SENSORNO", + "caption" : "Sensor (normal open)", + "id" : 7 + }, + "param3" : null, + "param1" : { }, + "param2" : null, + "altIcon" : 5, + "connected" : true, + "functionId" : 60, + "supportedFunctions" : [ { + "maxAlternativeIconIndex" : 1, + "possibleActions" : [ { + "name" : { }, + "caption" : "caption", + "id" : 4 + }, { + "name" : { }, + "caption" : "caption", + "id" : 4 + } ], + "name" : "OPENINGSENSOR_GATE", + "caption" : "Gate opening sensor", + "id" : 60 + }, { + "maxAlternativeIconIndex" : 1, + "possibleActions" : [ { + "name" : { }, + "caption" : "caption", + "id" : 4 + }, { + "name" : { }, + "caption" : "caption", + "id" : 4 + } ], + "name" : "OPENINGSENSOR_GATE", + "caption" : "Gate opening sensor", + "id" : 60 + } ], + "locationId" : 9, + "function" : { + "maxAlternativeIconIndex" : 1, + "possibleActions" : [ { + "name" : { }, + "caption" : "caption", + "id" : 4 + }, { + "name" : { }, + "caption" : "caption", + "id" : 4 + } ], + "name" : "OPENINGSENSOR_GATE", + "caption" : "Gate opening sensor", + "id" : 60 + }, + "typeId" : 1000, + "location" : null, + "id" : 1, + "inheritedLocation" : true, + "iodeviceId" : 9 + }, + "caption" : "caption", + "dateEnd" : "2000-01-23T04:56:07.000+00:00", + "timeExpression" : "*/5 * * * *", + "closestExecutions" : [ { + "past" : [ { + "result" : { + "caption" : "Successful" + }, + "plannedTimestamp" : "2000-01-23T04:56:07.000+00:00", + "resultTimestamp" : "2000-01-23T04:56:07.000+00:00", + "failed" : false + }, { + "result" : { + "caption" : "Successful" + }, + "plannedTimestamp" : "2000-01-23T04:56:07.000+00:00", + "resultTimestamp" : "2000-01-23T04:56:07.000+00:00", + "failed" : false + } ], + "future" : [ { + "plannedTimestamp" : "2000-01-23T04:56:07.000+00:00" + }, { + "plannedTimestamp" : "2000-01-23T04:56:07.000+00:00" + } ] + }, { + "past" : [ { + "result" : { + "caption" : "Successful" + }, + "plannedTimestamp" : "2000-01-23T04:56:07.000+00:00", + "resultTimestamp" : "2000-01-23T04:56:07.000+00:00", + "failed" : false + }, { + "result" : { + "caption" : "Successful" + }, + "plannedTimestamp" : "2000-01-23T04:56:07.000+00:00", + "resultTimestamp" : "2000-01-23T04:56:07.000+00:00", + "failed" : false + } ], + "future" : [ { + "plannedTimestamp" : "2000-01-23T04:56:07.000+00:00" + }, { + "plannedTimestamp" : "2000-01-23T04:56:07.000+00:00" + } ] + } ], + "enabled" : true, + "mode" : "minutely", + "dateStart" : "2000-01-23T04:56:07.000+00:00", + "action" : { + "name" : { }, + "caption" : "caption", + "id" : 4 + }, + "actionId" : 9, + "id" : 6, + "retry" : true, + "channelId" : 8 + }, { + "channel" : { + "hidden" : true, + "channelNumber" : 6, + "iodevice" : null, + "caption" : "caption", + "type" : { + "output" : false, + "name" : "SENSORNO", + "caption" : "Sensor (normal open)", + "id" : 7 + }, + "param3" : null, + "param1" : { }, + "param2" : null, + "altIcon" : 5, + "connected" : true, + "functionId" : 60, + "supportedFunctions" : [ { + "maxAlternativeIconIndex" : 1, + "possibleActions" : [ { + "name" : { }, + "caption" : "caption", + "id" : 4 + }, { + "name" : { }, + "caption" : "caption", + "id" : 4 + } ], + "name" : "OPENINGSENSOR_GATE", + "caption" : "Gate opening sensor", + "id" : 60 + }, { + "maxAlternativeIconIndex" : 1, + "possibleActions" : [ { + "name" : { }, + "caption" : "caption", + "id" : 4 + }, { + "name" : { }, + "caption" : "caption", + "id" : 4 + } ], + "name" : "OPENINGSENSOR_GATE", + "caption" : "Gate opening sensor", + "id" : 60 + } ], + "locationId" : 9, + "function" : { + "maxAlternativeIconIndex" : 1, + "possibleActions" : [ { + "name" : { }, + "caption" : "caption", + "id" : 4 + }, { + "name" : { }, + "caption" : "caption", + "id" : 4 + } ], + "name" : "OPENINGSENSOR_GATE", + "caption" : "Gate opening sensor", + "id" : 60 + }, + "typeId" : 1000, + "location" : null, + "id" : 1, + "inheritedLocation" : true, + "iodeviceId" : 9 + }, + "caption" : "caption", + "dateEnd" : "2000-01-23T04:56:07.000+00:00", + "timeExpression" : "*/5 * * * *", + "closestExecutions" : [ { + "past" : [ { + "result" : { + "caption" : "Successful" + }, + "plannedTimestamp" : "2000-01-23T04:56:07.000+00:00", + "resultTimestamp" : "2000-01-23T04:56:07.000+00:00", + "failed" : false + }, { + "result" : { + "caption" : "Successful" + }, + "plannedTimestamp" : "2000-01-23T04:56:07.000+00:00", + "resultTimestamp" : "2000-01-23T04:56:07.000+00:00", + "failed" : false + } ], + "future" : [ { + "plannedTimestamp" : "2000-01-23T04:56:07.000+00:00" + }, { + "plannedTimestamp" : "2000-01-23T04:56:07.000+00:00" + } ] + }, { + "past" : [ { + "result" : { + "caption" : "Successful" + }, + "plannedTimestamp" : "2000-01-23T04:56:07.000+00:00", + "resultTimestamp" : "2000-01-23T04:56:07.000+00:00", + "failed" : false + }, { + "result" : { + "caption" : "Successful" + }, + "plannedTimestamp" : "2000-01-23T04:56:07.000+00:00", + "resultTimestamp" : "2000-01-23T04:56:07.000+00:00", + "failed" : false + } ], + "future" : [ { + "plannedTimestamp" : "2000-01-23T04:56:07.000+00:00" + }, { + "plannedTimestamp" : "2000-01-23T04:56:07.000+00:00" + } ] + } ], + "enabled" : true, + "mode" : "minutely", + "dateStart" : "2000-01-23T04:56:07.000+00:00", + "action" : { + "name" : { }, + "caption" : "caption", + "id" : 4 + }, + "actionId" : 9, + "id" : 6, + "retry" : true, + "channelId" : 8 + } ], + "name" : "name", + "comment" : "comment", + "location" : null, + "id" : 3, + "softwareVersion" : "softwareVersion" + }, { + "originalLocation" : null, + "lastIpv4" : 4, + "gUIDString" : "gUIDString", + "originalLocationId" : 1, + "regDate" : "2000-01-23T04:56:07.000+00:00", + "channelsIds" : [ 1, 1 ], + "enabled" : true, + "connected" : true, + "channels" : [ { + "hidden" : true, + "channelNumber" : 6, + "iodevice" : null, + "caption" : "caption", + "type" : { + "output" : false, + "name" : "SENSORNO", + "caption" : "Sensor (normal open)", + "id" : 7 + }, + "param3" : null, + "param1" : { }, + "param2" : null, + "altIcon" : 5, + "connected" : true, + "functionId" : 60, + "supportedFunctions" : [ { + "maxAlternativeIconIndex" : 1, + "possibleActions" : [ { + "name" : { }, + "caption" : "caption", + "id" : 4 + }, { + "name" : { }, + "caption" : "caption", + "id" : 4 + } ], + "name" : "OPENINGSENSOR_GATE", + "caption" : "Gate opening sensor", + "id" : 60 + }, { + "maxAlternativeIconIndex" : 1, + "possibleActions" : [ { + "name" : { }, + "caption" : "caption", + "id" : 4 + }, { + "name" : { }, + "caption" : "caption", + "id" : 4 + } ], + "name" : "OPENINGSENSOR_GATE", + "caption" : "Gate opening sensor", + "id" : 60 + } ], + "locationId" : 9, + "function" : { + "maxAlternativeIconIndex" : 1, + "possibleActions" : [ { + "name" : { }, + "caption" : "caption", + "id" : 4 + }, { + "name" : { }, + "caption" : "caption", + "id" : 4 + } ], + "name" : "OPENINGSENSOR_GATE", + "caption" : "Gate opening sensor", + "id" : 60 + }, + "typeId" : 1000, + "location" : null, + "id" : 1, + "inheritedLocation" : true, + "iodeviceId" : 9 + }, { + "hidden" : true, + "channelNumber" : 6, + "iodevice" : null, + "caption" : "caption", + "type" : { + "output" : false, + "name" : "SENSORNO", + "caption" : "Sensor (normal open)", + "id" : 7 + }, + "param3" : null, + "param1" : { }, + "param2" : null, + "altIcon" : 5, + "connected" : true, + "functionId" : 60, + "supportedFunctions" : [ { + "maxAlternativeIconIndex" : 1, + "possibleActions" : [ { + "name" : { }, + "caption" : "caption", + "id" : 4 + }, { + "name" : { }, + "caption" : "caption", + "id" : 4 + } ], + "name" : "OPENINGSENSOR_GATE", + "caption" : "Gate opening sensor", + "id" : 60 + }, { + "maxAlternativeIconIndex" : 1, + "possibleActions" : [ { + "name" : { }, + "caption" : "caption", + "id" : 4 + }, { + "name" : { }, + "caption" : "caption", + "id" : 4 + } ], + "name" : "OPENINGSENSOR_GATE", + "caption" : "Gate opening sensor", + "id" : 60 + } ], + "locationId" : 9, + "function" : { + "maxAlternativeIconIndex" : 1, + "possibleActions" : [ { + "name" : { }, + "caption" : "caption", + "id" : 4 + }, { + "name" : { }, + "caption" : "caption", + "id" : 4 + } ], + "name" : "OPENINGSENSOR_GATE", + "caption" : "Gate opening sensor", + "id" : 60 + }, + "typeId" : 1000, + "location" : null, + "id" : 1, + "inheritedLocation" : true, + "iodeviceId" : 9 + } ], + "lastConnected" : "2000-01-23T04:56:07.000+00:00", + "locationId" : 7, + "regIpv4" : 2, + "schedules" : [ { + "channel" : { + "hidden" : true, + "channelNumber" : 6, + "iodevice" : null, + "caption" : "caption", + "type" : { + "output" : false, + "name" : "SENSORNO", + "caption" : "Sensor (normal open)", + "id" : 7 + }, + "param3" : null, + "param1" : { }, + "param2" : null, + "altIcon" : 5, + "connected" : true, + "functionId" : 60, + "supportedFunctions" : [ { + "maxAlternativeIconIndex" : 1, + "possibleActions" : [ { + "name" : { }, + "caption" : "caption", + "id" : 4 + }, { + "name" : { }, + "caption" : "caption", + "id" : 4 + } ], + "name" : "OPENINGSENSOR_GATE", + "caption" : "Gate opening sensor", + "id" : 60 + }, { + "maxAlternativeIconIndex" : 1, + "possibleActions" : [ { + "name" : { }, + "caption" : "caption", + "id" : 4 + }, { + "name" : { }, + "caption" : "caption", + "id" : 4 + } ], + "name" : "OPENINGSENSOR_GATE", + "caption" : "Gate opening sensor", + "id" : 60 + } ], + "locationId" : 9, + "function" : { + "maxAlternativeIconIndex" : 1, + "possibleActions" : [ { + "name" : { }, + "caption" : "caption", + "id" : 4 + }, { + "name" : { }, + "caption" : "caption", + "id" : 4 + } ], + "name" : "OPENINGSENSOR_GATE", + "caption" : "Gate opening sensor", + "id" : 60 + }, + "typeId" : 1000, + "location" : null, + "id" : 1, + "inheritedLocation" : true, + "iodeviceId" : 9 + }, + "caption" : "caption", + "dateEnd" : "2000-01-23T04:56:07.000+00:00", + "timeExpression" : "*/5 * * * *", + "closestExecutions" : [ { + "past" : [ { + "result" : { + "caption" : "Successful" + }, + "plannedTimestamp" : "2000-01-23T04:56:07.000+00:00", + "resultTimestamp" : "2000-01-23T04:56:07.000+00:00", + "failed" : false + }, { + "result" : { + "caption" : "Successful" + }, + "plannedTimestamp" : "2000-01-23T04:56:07.000+00:00", + "resultTimestamp" : "2000-01-23T04:56:07.000+00:00", + "failed" : false + } ], + "future" : [ { + "plannedTimestamp" : "2000-01-23T04:56:07.000+00:00" + }, { + "plannedTimestamp" : "2000-01-23T04:56:07.000+00:00" + } ] + }, { + "past" : [ { + "result" : { + "caption" : "Successful" + }, + "plannedTimestamp" : "2000-01-23T04:56:07.000+00:00", + "resultTimestamp" : "2000-01-23T04:56:07.000+00:00", + "failed" : false + }, { + "result" : { + "caption" : "Successful" + }, + "plannedTimestamp" : "2000-01-23T04:56:07.000+00:00", + "resultTimestamp" : "2000-01-23T04:56:07.000+00:00", + "failed" : false + } ], + "future" : [ { + "plannedTimestamp" : "2000-01-23T04:56:07.000+00:00" + }, { + "plannedTimestamp" : "2000-01-23T04:56:07.000+00:00" + } ] + } ], + "enabled" : true, + "mode" : "minutely", + "dateStart" : "2000-01-23T04:56:07.000+00:00", + "action" : { + "name" : { }, + "caption" : "caption", + "id" : 4 + }, + "actionId" : 9, + "id" : 6, + "retry" : true, + "channelId" : 8 + }, { + "channel" : { + "hidden" : true, + "channelNumber" : 6, + "iodevice" : null, + "caption" : "caption", + "type" : { + "output" : false, + "name" : "SENSORNO", + "caption" : "Sensor (normal open)", + "id" : 7 + }, + "param3" : null, + "param1" : { }, + "param2" : null, + "altIcon" : 5, + "connected" : true, + "functionId" : 60, + "supportedFunctions" : [ { + "maxAlternativeIconIndex" : 1, + "possibleActions" : [ { + "name" : { }, + "caption" : "caption", + "id" : 4 + }, { + "name" : { }, + "caption" : "caption", + "id" : 4 + } ], + "name" : "OPENINGSENSOR_GATE", + "caption" : "Gate opening sensor", + "id" : 60 + }, { + "maxAlternativeIconIndex" : 1, + "possibleActions" : [ { + "name" : { }, + "caption" : "caption", + "id" : 4 + }, { + "name" : { }, + "caption" : "caption", + "id" : 4 + } ], + "name" : "OPENINGSENSOR_GATE", + "caption" : "Gate opening sensor", + "id" : 60 + } ], + "locationId" : 9, + "function" : { + "maxAlternativeIconIndex" : 1, + "possibleActions" : [ { + "name" : { }, + "caption" : "caption", + "id" : 4 + }, { + "name" : { }, + "caption" : "caption", + "id" : 4 + } ], + "name" : "OPENINGSENSOR_GATE", + "caption" : "Gate opening sensor", + "id" : 60 + }, + "typeId" : 1000, + "location" : null, + "id" : 1, + "inheritedLocation" : true, + "iodeviceId" : 9 + }, + "caption" : "caption", + "dateEnd" : "2000-01-23T04:56:07.000+00:00", + "timeExpression" : "*/5 * * * *", + "closestExecutions" : [ { + "past" : [ { + "result" : { + "caption" : "Successful" + }, + "plannedTimestamp" : "2000-01-23T04:56:07.000+00:00", + "resultTimestamp" : "2000-01-23T04:56:07.000+00:00", + "failed" : false + }, { + "result" : { + "caption" : "Successful" + }, + "plannedTimestamp" : "2000-01-23T04:56:07.000+00:00", + "resultTimestamp" : "2000-01-23T04:56:07.000+00:00", + "failed" : false + } ], + "future" : [ { + "plannedTimestamp" : "2000-01-23T04:56:07.000+00:00" + }, { + "plannedTimestamp" : "2000-01-23T04:56:07.000+00:00" + } ] + }, { + "past" : [ { + "result" : { + "caption" : "Successful" + }, + "plannedTimestamp" : "2000-01-23T04:56:07.000+00:00", + "resultTimestamp" : "2000-01-23T04:56:07.000+00:00", + "failed" : false + }, { + "result" : { + "caption" : "Successful" + }, + "plannedTimestamp" : "2000-01-23T04:56:07.000+00:00", + "resultTimestamp" : "2000-01-23T04:56:07.000+00:00", + "failed" : false + } ], + "future" : [ { + "plannedTimestamp" : "2000-01-23T04:56:07.000+00:00" + }, { + "plannedTimestamp" : "2000-01-23T04:56:07.000+00:00" + } ] + } ], + "enabled" : true, + "mode" : "minutely", + "dateStart" : "2000-01-23T04:56:07.000+00:00", + "action" : { + "name" : { }, + "caption" : "caption", + "id" : 4 + }, + "actionId" : 9, + "id" : 6, + "retry" : true, + "channelId" : 8 + } ], + "name" : "name", + "comment" : "comment", + "location" : null, + "id" : 3, + "softwareVersion" : "softwareVersion" + } ], + "channelsIds" : [ 7, 7 ], + "enabled" : true + }, { + "iodevicesIds" : [ 5, 5 ], + "password" : "password", + "channels" : [ { + "hidden" : true, + "channelNumber" : 6, + "iodevice" : null, + "caption" : "caption", + "type" : { + "output" : false, + "name" : "SENSORNO", + "caption" : "Sensor (normal open)", + "id" : 7 + }, + "param3" : null, + "param1" : { }, + "param2" : null, + "altIcon" : 5, + "connected" : true, + "functionId" : 60, + "supportedFunctions" : [ { + "maxAlternativeIconIndex" : 1, + "possibleActions" : [ { + "name" : { }, + "caption" : "caption", + "id" : 4 + }, { + "name" : { }, + "caption" : "caption", + "id" : 4 + } ], + "name" : "OPENINGSENSOR_GATE", + "caption" : "Gate opening sensor", + "id" : 60 + }, { + "maxAlternativeIconIndex" : 1, + "possibleActions" : [ { + "name" : { }, + "caption" : "caption", + "id" : 4 + }, { + "name" : { }, + "caption" : "caption", + "id" : 4 + } ], + "name" : "OPENINGSENSOR_GATE", + "caption" : "Gate opening sensor", + "id" : 60 + } ], + "locationId" : 9, + "function" : { + "maxAlternativeIconIndex" : 1, + "possibleActions" : [ { + "name" : { }, + "caption" : "caption", + "id" : 4 + }, { + "name" : { }, + "caption" : "caption", + "id" : 4 + } ], + "name" : "OPENINGSENSOR_GATE", + "caption" : "Gate opening sensor", + "id" : 60 + }, + "typeId" : 1000, + "location" : null, + "id" : 1, + "inheritedLocation" : true, + "iodeviceId" : 9 + }, { + "hidden" : true, + "channelNumber" : 6, + "iodevice" : null, + "caption" : "caption", + "type" : { + "output" : false, + "name" : "SENSORNO", + "caption" : "Sensor (normal open)", + "id" : 7 + }, + "param3" : null, + "param1" : { }, + "param2" : null, + "altIcon" : 5, + "connected" : true, + "functionId" : 60, + "supportedFunctions" : [ { + "maxAlternativeIconIndex" : 1, + "possibleActions" : [ { + "name" : { }, + "caption" : "caption", + "id" : 4 + }, { + "name" : { }, + "caption" : "caption", + "id" : 4 + } ], + "name" : "OPENINGSENSOR_GATE", + "caption" : "Gate opening sensor", + "id" : 60 + }, { + "maxAlternativeIconIndex" : 1, + "possibleActions" : [ { + "name" : { }, + "caption" : "caption", + "id" : 4 + }, { + "name" : { }, + "caption" : "caption", + "id" : 4 + } ], + "name" : "OPENINGSENSOR_GATE", + "caption" : "Gate opening sensor", + "id" : 60 + } ], + "locationId" : 9, + "function" : { + "maxAlternativeIconIndex" : 1, + "possibleActions" : [ { + "name" : { }, + "caption" : "caption", + "id" : 4 + }, { + "name" : { }, + "caption" : "caption", + "id" : 4 + } ], + "name" : "OPENINGSENSOR_GATE", + "caption" : "Gate opening sensor", + "id" : 60 + }, + "typeId" : 1000, + "location" : null, + "id" : 1, + "inheritedLocation" : true, + "iodeviceId" : 9 + } ], + "accessIdsIds" : [ 9, 9 ], + "channelGroups" : [ ], + "caption" : "caption", + "channelGroupsIds" : [ 2, 2 ], + "accessIds" : [ null, null ], + "id" : 5, + "iodevices" : [ { + "originalLocation" : null, + "lastIpv4" : 4, + "gUIDString" : "gUIDString", + "originalLocationId" : 1, + "regDate" : "2000-01-23T04:56:07.000+00:00", + "channelsIds" : [ 1, 1 ], + "enabled" : true, + "connected" : true, + "channels" : [ { + "hidden" : true, + "channelNumber" : 6, + "iodevice" : null, + "caption" : "caption", + "type" : { + "output" : false, + "name" : "SENSORNO", + "caption" : "Sensor (normal open)", + "id" : 7 + }, + "param3" : null, + "param1" : { }, + "param2" : null, + "altIcon" : 5, + "connected" : true, + "functionId" : 60, + "supportedFunctions" : [ { + "maxAlternativeIconIndex" : 1, + "possibleActions" : [ { + "name" : { }, + "caption" : "caption", + "id" : 4 + }, { + "name" : { }, + "caption" : "caption", + "id" : 4 + } ], + "name" : "OPENINGSENSOR_GATE", + "caption" : "Gate opening sensor", + "id" : 60 + }, { + "maxAlternativeIconIndex" : 1, + "possibleActions" : [ { + "name" : { }, + "caption" : "caption", + "id" : 4 + }, { + "name" : { }, + "caption" : "caption", + "id" : 4 + } ], + "name" : "OPENINGSENSOR_GATE", + "caption" : "Gate opening sensor", + "id" : 60 + } ], + "locationId" : 9, + "function" : { + "maxAlternativeIconIndex" : 1, + "possibleActions" : [ { + "name" : { }, + "caption" : "caption", + "id" : 4 + }, { + "name" : { }, + "caption" : "caption", + "id" : 4 + } ], + "name" : "OPENINGSENSOR_GATE", + "caption" : "Gate opening sensor", + "id" : 60 + }, + "typeId" : 1000, + "location" : null, + "id" : 1, + "inheritedLocation" : true, + "iodeviceId" : 9 + }, { + "hidden" : true, + "channelNumber" : 6, + "iodevice" : null, + "caption" : "caption", + "type" : { + "output" : false, + "name" : "SENSORNO", + "caption" : "Sensor (normal open)", + "id" : 7 + }, + "param3" : null, + "param1" : { }, + "param2" : null, + "altIcon" : 5, + "connected" : true, + "functionId" : 60, + "supportedFunctions" : [ { + "maxAlternativeIconIndex" : 1, + "possibleActions" : [ { + "name" : { }, + "caption" : "caption", + "id" : 4 + }, { + "name" : { }, + "caption" : "caption", + "id" : 4 + } ], + "name" : "OPENINGSENSOR_GATE", + "caption" : "Gate opening sensor", + "id" : 60 + }, { + "maxAlternativeIconIndex" : 1, + "possibleActions" : [ { + "name" : { }, + "caption" : "caption", + "id" : 4 + }, { + "name" : { }, + "caption" : "caption", + "id" : 4 + } ], + "name" : "OPENINGSENSOR_GATE", + "caption" : "Gate opening sensor", + "id" : 60 + } ], + "locationId" : 9, + "function" : { + "maxAlternativeIconIndex" : 1, + "possibleActions" : [ { + "name" : { }, + "caption" : "caption", + "id" : 4 + }, { + "name" : { }, + "caption" : "caption", + "id" : 4 + } ], + "name" : "OPENINGSENSOR_GATE", + "caption" : "Gate opening sensor", + "id" : 60 + }, + "typeId" : 1000, + "location" : null, + "id" : 1, + "inheritedLocation" : true, + "iodeviceId" : 9 + } ], + "lastConnected" : "2000-01-23T04:56:07.000+00:00", + "locationId" : 7, + "regIpv4" : 2, + "schedules" : [ { + "channel" : { + "hidden" : true, + "channelNumber" : 6, + "iodevice" : null, + "caption" : "caption", + "type" : { + "output" : false, + "name" : "SENSORNO", + "caption" : "Sensor (normal open)", + "id" : 7 + }, + "param3" : null, + "param1" : { }, + "param2" : null, + "altIcon" : 5, + "connected" : true, + "functionId" : 60, + "supportedFunctions" : [ { + "maxAlternativeIconIndex" : 1, + "possibleActions" : [ { + "name" : { }, + "caption" : "caption", + "id" : 4 + }, { + "name" : { }, + "caption" : "caption", + "id" : 4 + } ], + "name" : "OPENINGSENSOR_GATE", + "caption" : "Gate opening sensor", + "id" : 60 + }, { + "maxAlternativeIconIndex" : 1, + "possibleActions" : [ { + "name" : { }, + "caption" : "caption", + "id" : 4 + }, { + "name" : { }, + "caption" : "caption", + "id" : 4 + } ], + "name" : "OPENINGSENSOR_GATE", + "caption" : "Gate opening sensor", + "id" : 60 + } ], + "locationId" : 9, + "function" : { + "maxAlternativeIconIndex" : 1, + "possibleActions" : [ { + "name" : { }, + "caption" : "caption", + "id" : 4 + }, { + "name" : { }, + "caption" : "caption", + "id" : 4 + } ], + "name" : "OPENINGSENSOR_GATE", + "caption" : "Gate opening sensor", + "id" : 60 + }, + "typeId" : 1000, + "location" : null, + "id" : 1, + "inheritedLocation" : true, + "iodeviceId" : 9 + }, + "caption" : "caption", + "dateEnd" : "2000-01-23T04:56:07.000+00:00", + "timeExpression" : "*/5 * * * *", + "closestExecutions" : [ { + "past" : [ { + "result" : { + "caption" : "Successful" + }, + "plannedTimestamp" : "2000-01-23T04:56:07.000+00:00", + "resultTimestamp" : "2000-01-23T04:56:07.000+00:00", + "failed" : false + }, { + "result" : { + "caption" : "Successful" + }, + "plannedTimestamp" : "2000-01-23T04:56:07.000+00:00", + "resultTimestamp" : "2000-01-23T04:56:07.000+00:00", + "failed" : false + } ], + "future" : [ { + "plannedTimestamp" : "2000-01-23T04:56:07.000+00:00" + }, { + "plannedTimestamp" : "2000-01-23T04:56:07.000+00:00" + } ] + }, { + "past" : [ { + "result" : { + "caption" : "Successful" + }, + "plannedTimestamp" : "2000-01-23T04:56:07.000+00:00", + "resultTimestamp" : "2000-01-23T04:56:07.000+00:00", + "failed" : false + }, { + "result" : { + "caption" : "Successful" + }, + "plannedTimestamp" : "2000-01-23T04:56:07.000+00:00", + "resultTimestamp" : "2000-01-23T04:56:07.000+00:00", + "failed" : false + } ], + "future" : [ { + "plannedTimestamp" : "2000-01-23T04:56:07.000+00:00" + }, { + "plannedTimestamp" : "2000-01-23T04:56:07.000+00:00" + } ] + } ], + "enabled" : true, + "mode" : "minutely", + "dateStart" : "2000-01-23T04:56:07.000+00:00", + "action" : { + "name" : { }, + "caption" : "caption", + "id" : 4 + }, + "actionId" : 9, + "id" : 6, + "retry" : true, + "channelId" : 8 + }, { + "channel" : { + "hidden" : true, + "channelNumber" : 6, + "iodevice" : null, + "caption" : "caption", + "type" : { + "output" : false, + "name" : "SENSORNO", + "caption" : "Sensor (normal open)", + "id" : 7 + }, + "param3" : null, + "param1" : { }, + "param2" : null, + "altIcon" : 5, + "connected" : true, + "functionId" : 60, + "supportedFunctions" : [ { + "maxAlternativeIconIndex" : 1, + "possibleActions" : [ { + "name" : { }, + "caption" : "caption", + "id" : 4 + }, { + "name" : { }, + "caption" : "caption", + "id" : 4 + } ], + "name" : "OPENINGSENSOR_GATE", + "caption" : "Gate opening sensor", + "id" : 60 + }, { + "maxAlternativeIconIndex" : 1, + "possibleActions" : [ { + "name" : { }, + "caption" : "caption", + "id" : 4 + }, { + "name" : { }, + "caption" : "caption", + "id" : 4 + } ], + "name" : "OPENINGSENSOR_GATE", + "caption" : "Gate opening sensor", + "id" : 60 + } ], + "locationId" : 9, + "function" : { + "maxAlternativeIconIndex" : 1, + "possibleActions" : [ { + "name" : { }, + "caption" : "caption", + "id" : 4 + }, { + "name" : { }, + "caption" : "caption", + "id" : 4 + } ], + "name" : "OPENINGSENSOR_GATE", + "caption" : "Gate opening sensor", + "id" : 60 + }, + "typeId" : 1000, + "location" : null, + "id" : 1, + "inheritedLocation" : true, + "iodeviceId" : 9 + }, + "caption" : "caption", + "dateEnd" : "2000-01-23T04:56:07.000+00:00", + "timeExpression" : "*/5 * * * *", + "closestExecutions" : [ { + "past" : [ { + "result" : { + "caption" : "Successful" + }, + "plannedTimestamp" : "2000-01-23T04:56:07.000+00:00", + "resultTimestamp" : "2000-01-23T04:56:07.000+00:00", + "failed" : false + }, { + "result" : { + "caption" : "Successful" + }, + "plannedTimestamp" : "2000-01-23T04:56:07.000+00:00", + "resultTimestamp" : "2000-01-23T04:56:07.000+00:00", + "failed" : false + } ], + "future" : [ { + "plannedTimestamp" : "2000-01-23T04:56:07.000+00:00" + }, { + "plannedTimestamp" : "2000-01-23T04:56:07.000+00:00" + } ] + }, { + "past" : [ { + "result" : { + "caption" : "Successful" + }, + "plannedTimestamp" : "2000-01-23T04:56:07.000+00:00", + "resultTimestamp" : "2000-01-23T04:56:07.000+00:00", + "failed" : false + }, { + "result" : { + "caption" : "Successful" + }, + "plannedTimestamp" : "2000-01-23T04:56:07.000+00:00", + "resultTimestamp" : "2000-01-23T04:56:07.000+00:00", + "failed" : false + } ], + "future" : [ { + "plannedTimestamp" : "2000-01-23T04:56:07.000+00:00" + }, { + "plannedTimestamp" : "2000-01-23T04:56:07.000+00:00" + } ] + } ], + "enabled" : true, + "mode" : "minutely", + "dateStart" : "2000-01-23T04:56:07.000+00:00", + "action" : { + "name" : { }, + "caption" : "caption", + "id" : 4 + }, + "actionId" : 9, + "id" : 6, + "retry" : true, + "channelId" : 8 + } ], + "name" : "name", + "comment" : "comment", + "location" : null, + "id" : 3, + "softwareVersion" : "softwareVersion" + }, { + "originalLocation" : null, + "lastIpv4" : 4, + "gUIDString" : "gUIDString", + "originalLocationId" : 1, + "regDate" : "2000-01-23T04:56:07.000+00:00", + "channelsIds" : [ 1, 1 ], + "enabled" : true, + "connected" : true, + "channels" : [ { + "hidden" : true, + "channelNumber" : 6, + "iodevice" : null, + "caption" : "caption", + "type" : { + "output" : false, + "name" : "SENSORNO", + "caption" : "Sensor (normal open)", + "id" : 7 + }, + "param3" : null, + "param1" : { }, + "param2" : null, + "altIcon" : 5, + "connected" : true, + "functionId" : 60, + "supportedFunctions" : [ { + "maxAlternativeIconIndex" : 1, + "possibleActions" : [ { + "name" : { }, + "caption" : "caption", + "id" : 4 + }, { + "name" : { }, + "caption" : "caption", + "id" : 4 + } ], + "name" : "OPENINGSENSOR_GATE", + "caption" : "Gate opening sensor", + "id" : 60 + }, { + "maxAlternativeIconIndex" : 1, + "possibleActions" : [ { + "name" : { }, + "caption" : "caption", + "id" : 4 + }, { + "name" : { }, + "caption" : "caption", + "id" : 4 + } ], + "name" : "OPENINGSENSOR_GATE", + "caption" : "Gate opening sensor", + "id" : 60 + } ], + "locationId" : 9, + "function" : { + "maxAlternativeIconIndex" : 1, + "possibleActions" : [ { + "name" : { }, + "caption" : "caption", + "id" : 4 + }, { + "name" : { }, + "caption" : "caption", + "id" : 4 + } ], + "name" : "OPENINGSENSOR_GATE", + "caption" : "Gate opening sensor", + "id" : 60 + }, + "typeId" : 1000, + "location" : null, + "id" : 1, + "inheritedLocation" : true, + "iodeviceId" : 9 + }, { + "hidden" : true, + "channelNumber" : 6, + "iodevice" : null, + "caption" : "caption", + "type" : { + "output" : false, + "name" : "SENSORNO", + "caption" : "Sensor (normal open)", + "id" : 7 + }, + "param3" : null, + "param1" : { }, + "param2" : null, + "altIcon" : 5, + "connected" : true, + "functionId" : 60, + "supportedFunctions" : [ { + "maxAlternativeIconIndex" : 1, + "possibleActions" : [ { + "name" : { }, + "caption" : "caption", + "id" : 4 + }, { + "name" : { }, + "caption" : "caption", + "id" : 4 + } ], + "name" : "OPENINGSENSOR_GATE", + "caption" : "Gate opening sensor", + "id" : 60 + }, { + "maxAlternativeIconIndex" : 1, + "possibleActions" : [ { + "name" : { }, + "caption" : "caption", + "id" : 4 + }, { + "name" : { }, + "caption" : "caption", + "id" : 4 + } ], + "name" : "OPENINGSENSOR_GATE", + "caption" : "Gate opening sensor", + "id" : 60 + } ], + "locationId" : 9, + "function" : { + "maxAlternativeIconIndex" : 1, + "possibleActions" : [ { + "name" : { }, + "caption" : "caption", + "id" : 4 + }, { + "name" : { }, + "caption" : "caption", + "id" : 4 + } ], + "name" : "OPENINGSENSOR_GATE", + "caption" : "Gate opening sensor", + "id" : 60 + }, + "typeId" : 1000, + "location" : null, + "id" : 1, + "inheritedLocation" : true, + "iodeviceId" : 9 + } ], + "lastConnected" : "2000-01-23T04:56:07.000+00:00", + "locationId" : 7, + "regIpv4" : 2, + "schedules" : [ { + "channel" : { + "hidden" : true, + "channelNumber" : 6, + "iodevice" : null, + "caption" : "caption", + "type" : { + "output" : false, + "name" : "SENSORNO", + "caption" : "Sensor (normal open)", + "id" : 7 + }, + "param3" : null, + "param1" : { }, + "param2" : null, + "altIcon" : 5, + "connected" : true, + "functionId" : 60, + "supportedFunctions" : [ { + "maxAlternativeIconIndex" : 1, + "possibleActions" : [ { + "name" : { }, + "caption" : "caption", + "id" : 4 + }, { + "name" : { }, + "caption" : "caption", + "id" : 4 + } ], + "name" : "OPENINGSENSOR_GATE", + "caption" : "Gate opening sensor", + "id" : 60 + }, { + "maxAlternativeIconIndex" : 1, + "possibleActions" : [ { + "name" : { }, + "caption" : "caption", + "id" : 4 + }, { + "name" : { }, + "caption" : "caption", + "id" : 4 + } ], + "name" : "OPENINGSENSOR_GATE", + "caption" : "Gate opening sensor", + "id" : 60 + } ], + "locationId" : 9, + "function" : { + "maxAlternativeIconIndex" : 1, + "possibleActions" : [ { + "name" : { }, + "caption" : "caption", + "id" : 4 + }, { + "name" : { }, + "caption" : "caption", + "id" : 4 + } ], + "name" : "OPENINGSENSOR_GATE", + "caption" : "Gate opening sensor", + "id" : 60 + }, + "typeId" : 1000, + "location" : null, + "id" : 1, + "inheritedLocation" : true, + "iodeviceId" : 9 + }, + "caption" : "caption", + "dateEnd" : "2000-01-23T04:56:07.000+00:00", + "timeExpression" : "*/5 * * * *", + "closestExecutions" : [ { + "past" : [ { + "result" : { + "caption" : "Successful" + }, + "plannedTimestamp" : "2000-01-23T04:56:07.000+00:00", + "resultTimestamp" : "2000-01-23T04:56:07.000+00:00", + "failed" : false + }, { + "result" : { + "caption" : "Successful" + }, + "plannedTimestamp" : "2000-01-23T04:56:07.000+00:00", + "resultTimestamp" : "2000-01-23T04:56:07.000+00:00", + "failed" : false + } ], + "future" : [ { + "plannedTimestamp" : "2000-01-23T04:56:07.000+00:00" + }, { + "plannedTimestamp" : "2000-01-23T04:56:07.000+00:00" + } ] + }, { + "past" : [ { + "result" : { + "caption" : "Successful" + }, + "plannedTimestamp" : "2000-01-23T04:56:07.000+00:00", + "resultTimestamp" : "2000-01-23T04:56:07.000+00:00", + "failed" : false + }, { + "result" : { + "caption" : "Successful" + }, + "plannedTimestamp" : "2000-01-23T04:56:07.000+00:00", + "resultTimestamp" : "2000-01-23T04:56:07.000+00:00", + "failed" : false + } ], + "future" : [ { + "plannedTimestamp" : "2000-01-23T04:56:07.000+00:00" + }, { + "plannedTimestamp" : "2000-01-23T04:56:07.000+00:00" + } ] + } ], + "enabled" : true, + "mode" : "minutely", + "dateStart" : "2000-01-23T04:56:07.000+00:00", + "action" : { + "name" : { }, + "caption" : "caption", + "id" : 4 + }, + "actionId" : 9, + "id" : 6, + "retry" : true, + "channelId" : 8 + }, { + "channel" : { + "hidden" : true, + "channelNumber" : 6, + "iodevice" : null, + "caption" : "caption", + "type" : { + "output" : false, + "name" : "SENSORNO", + "caption" : "Sensor (normal open)", + "id" : 7 + }, + "param3" : null, + "param1" : { }, + "param2" : null, + "altIcon" : 5, + "connected" : true, + "functionId" : 60, + "supportedFunctions" : [ { + "maxAlternativeIconIndex" : 1, + "possibleActions" : [ { + "name" : { }, + "caption" : "caption", + "id" : 4 + }, { + "name" : { }, + "caption" : "caption", + "id" : 4 + } ], + "name" : "OPENINGSENSOR_GATE", + "caption" : "Gate opening sensor", + "id" : 60 + }, { + "maxAlternativeIconIndex" : 1, + "possibleActions" : [ { + "name" : { }, + "caption" : "caption", + "id" : 4 + }, { + "name" : { }, + "caption" : "caption", + "id" : 4 + } ], + "name" : "OPENINGSENSOR_GATE", + "caption" : "Gate opening sensor", + "id" : 60 + } ], + "locationId" : 9, + "function" : { + "maxAlternativeIconIndex" : 1, + "possibleActions" : [ { + "name" : { }, + "caption" : "caption", + "id" : 4 + }, { + "name" : { }, + "caption" : "caption", + "id" : 4 + } ], + "name" : "OPENINGSENSOR_GATE", + "caption" : "Gate opening sensor", + "id" : 60 + }, + "typeId" : 1000, + "location" : null, + "id" : 1, + "inheritedLocation" : true, + "iodeviceId" : 9 + }, + "caption" : "caption", + "dateEnd" : "2000-01-23T04:56:07.000+00:00", + "timeExpression" : "*/5 * * * *", + "closestExecutions" : [ { + "past" : [ { + "result" : { + "caption" : "Successful" + }, + "plannedTimestamp" : "2000-01-23T04:56:07.000+00:00", + "resultTimestamp" : "2000-01-23T04:56:07.000+00:00", + "failed" : false + }, { + "result" : { + "caption" : "Successful" + }, + "plannedTimestamp" : "2000-01-23T04:56:07.000+00:00", + "resultTimestamp" : "2000-01-23T04:56:07.000+00:00", + "failed" : false + } ], + "future" : [ { + "plannedTimestamp" : "2000-01-23T04:56:07.000+00:00" + }, { + "plannedTimestamp" : "2000-01-23T04:56:07.000+00:00" + } ] + }, { + "past" : [ { + "result" : { + "caption" : "Successful" + }, + "plannedTimestamp" : "2000-01-23T04:56:07.000+00:00", + "resultTimestamp" : "2000-01-23T04:56:07.000+00:00", + "failed" : false + }, { + "result" : { + "caption" : "Successful" + }, + "plannedTimestamp" : "2000-01-23T04:56:07.000+00:00", + "resultTimestamp" : "2000-01-23T04:56:07.000+00:00", + "failed" : false + } ], + "future" : [ { + "plannedTimestamp" : "2000-01-23T04:56:07.000+00:00" + }, { + "plannedTimestamp" : "2000-01-23T04:56:07.000+00:00" + } ] + } ], + "enabled" : true, + "mode" : "minutely", + "dateStart" : "2000-01-23T04:56:07.000+00:00", + "action" : { + "name" : { }, + "caption" : "caption", + "id" : 4 + }, + "actionId" : 9, + "id" : 6, + "retry" : true, + "channelId" : 8 + } ], + "name" : "name", + "comment" : "comment", + "location" : null, + "id" : 3, + "softwareVersion" : "softwareVersion" + } ], + "channelsIds" : [ 7, 7 ], + "enabled" : true + } ], + "id" : 0, + "clientAppsIds" : [ 1, 1 ], + "enabled" : true, + "locationsIds" : [ 6, 6 ] + } + }, + "ClientApp" : { + "properties" : { + "id" : { + "type" : "integer", + "description" : "Client application identifier" + }, + "name" : { + "type" : "string" + }, + "caption" : { + "type" : "string" + }, + "enabled" : { + "type" : "boolean" + }, + "regIpv4" : { + "type" : "integer" + }, + "regDate" : { + "type" : "string", + "format" : "date-time" + }, + "lastAccessIpv4" : { + "type" : "integer" + }, + "lastAccessDate" : { + "type" : "string", + "format" : "date-time" + }, + "softwareVersion" : { + "type" : "string" + }, + "protocolVersion" : { + "type" : "integer" + }, + "accessIdId" : { + "type" : "integer" + }, + "connected" : { + "type" : "boolean" + }, + "accessId" : { + "$ref" : "#/definitions/AccessIdentifier" + } + }, + "example" : { + "lastAccessIpv4" : 6, + "caption" : "caption", + "regDate" : "2000-01-23T04:56:07.000+00:00", + "enabled" : true, + "connected" : true, + "accessId" : null, + "accessIdId" : 2, + "lastAccessDate" : "2000-01-23T04:56:07.000+00:00", + "regIpv4" : 3, + "name" : "name", + "protocolVersion" : 1, + "id" : 6, + "softwareVersion" : "softwareVersion" + } + }, + "Channel" : { + "properties" : { + "id" : { + "type" : "integer", + "description" : "Channel identifier" + }, + "channelNumber" : { + "type" : "integer", + "description" : "Channel ordinal number in its IO Device" + }, + "caption" : { + "type" : "string", + "description" : "Channel caption" + }, + "type" : { + "$ref" : "#/definitions/ChannelType" + }, + "function" : { + "$ref" : "#/definitions/ChannelFunction" + }, + "param1" : { + "$ref" : "#/definitions/ChannelParam" + }, + "param2" : { + "$ref" : "#/definitions/ChannelParam" + }, + "param3" : { + "$ref" : "#/definitions/ChannelParam" + }, + "altIcon" : { + "type" : "integer", + "description" : "Chosen alternative icon idenifier. Should not be greater than `funciton.maxAlternativeIconIndex`" + }, + "hidden" : { + "type" : "boolean", + "description" : "Whether this channel is shown on client apps or not" + }, + "inheritedLocation" : { + "type" : "boolean", + "description" : "Whether this channel inherits its IO Device's location (`true`) or not (`false`)" + }, + "iodeviceId" : { + "type" : "integer" + }, + "locationId" : { + "type" : "integer" + }, + "functionId" : { + "type" : "integer", + "example" : 60 + }, + "typeId" : { + "type" : "integer", + "example" : 1000 + }, + "iodevice" : { + "$ref" : "#/definitions/Device" + }, + "location" : { + "$ref" : "#/definitions/Location" + }, + "connected" : { + "type" : "boolean" + }, + "supportedFunctions" : { + "type" : "array", + "items" : { + "$ref" : "#/definitions/ChannelFunction" + } + } + }, + "example" : { + "hidden" : true, + "channelNumber" : 6, + "iodevice" : null, + "caption" : "caption", + "type" : { + "output" : false, + "name" : "SENSORNO", + "caption" : "Sensor (normal open)", + "id" : 7 + }, + "param3" : null, + "param1" : { }, + "param2" : null, + "altIcon" : 5, + "connected" : true, + "functionId" : 60, + "supportedFunctions" : [ { + "maxAlternativeIconIndex" : 1, + "possibleActions" : [ { + "name" : { }, + "caption" : "caption", + "id" : 4 + }, { + "name" : { }, + "caption" : "caption", + "id" : 4 + } ], + "name" : "OPENINGSENSOR_GATE", + "caption" : "Gate opening sensor", + "id" : 60 + }, { + "maxAlternativeIconIndex" : 1, + "possibleActions" : [ { + "name" : { }, + "caption" : "caption", + "id" : 4 + }, { + "name" : { }, + "caption" : "caption", + "id" : 4 + } ], + "name" : "OPENINGSENSOR_GATE", + "caption" : "Gate opening sensor", + "id" : 60 + } ], + "locationId" : 9, + "function" : { + "maxAlternativeIconIndex" : 1, + "possibleActions" : [ { + "name" : { }, + "caption" : "caption", + "id" : 4 + }, { + "name" : { }, + "caption" : "caption", + "id" : 4 + } ], + "name" : "OPENINGSENSOR_GATE", + "caption" : "Gate opening sensor", + "id" : 60 + }, + "typeId" : 1000, + "location" : null, + "id" : 1, + "inheritedLocation" : true, + "iodeviceId" : 9 + } + }, + "ChannelGroup" : { + "properties" : { + "id" : { + "type" : "integer", + "example" : 1, + "description" : "Channel group identifier" + }, + "hidden" : { + "type" : "boolean", + "description" : "Whether this channel group is shown on client apps or not" + }, + "caption" : { + "type" : "string", + "description" : "Channel caption" + }, + "function" : { + "$ref" : "#/definitions/ChannelFunction" + }, + "functionId" : { + "type" : "integer", + "example" : 60 + }, + "locationId" : { + "type" : "integer" + }, + "location" : { + "$ref" : "#/definitions/Location" + }, + "channelIds" : { + "type" : "array", + "items" : { + "type" : "integer" + } + }, + "channels" : { + "type" : "array", + "description" : "Returned only if requested by the `include` parameter.", + "items" : { + "$ref" : "#/definitions/Channel" + } + }, + "altIcon" : { + "type" : "integer", + "description" : "Chosen alternative icon idenifier. Should not be greater than `funciton.maxAlternativeIconIndex`" + } + }, + "example" : { + "functionId" : 60, + "hidden" : true, + "channels" : [ { + "hidden" : true, + "channelNumber" : 6, + "iodevice" : null, + "caption" : "caption", + "type" : { + "output" : false, + "name" : "SENSORNO", + "caption" : "Sensor (normal open)", + "id" : 7 + }, + "param3" : null, + "param1" : { }, + "param2" : null, + "altIcon" : 5, + "connected" : true, + "functionId" : 60, + "supportedFunctions" : [ { + "maxAlternativeIconIndex" : 1, + "possibleActions" : [ { + "name" : { }, + "caption" : "caption", + "id" : 4 + }, { + "name" : { }, + "caption" : "caption", + "id" : 4 + } ], + "name" : "OPENINGSENSOR_GATE", + "caption" : "Gate opening sensor", + "id" : 60 + }, { + "maxAlternativeIconIndex" : 1, + "possibleActions" : [ { + "name" : { }, + "caption" : "caption", + "id" : 4 + }, { + "name" : { }, + "caption" : "caption", + "id" : 4 + } ], + "name" : "OPENINGSENSOR_GATE", + "caption" : "Gate opening sensor", + "id" : 60 + } ], + "locationId" : 9, + "function" : { + "maxAlternativeIconIndex" : 1, + "possibleActions" : [ { + "name" : { }, + "caption" : "caption", + "id" : 4 + }, { + "name" : { }, + "caption" : "caption", + "id" : 4 + } ], + "name" : "OPENINGSENSOR_GATE", + "caption" : "Gate opening sensor", + "id" : 60 + }, + "typeId" : 1000, + "location" : null, + "id" : 1, + "inheritedLocation" : true, + "iodeviceId" : 9 + }, { + "hidden" : true, + "channelNumber" : 6, + "iodevice" : null, + "caption" : "caption", + "type" : { + "output" : false, + "name" : "SENSORNO", + "caption" : "Sensor (normal open)", + "id" : 7 + }, + "param3" : null, + "param1" : { }, + "param2" : null, + "altIcon" : 5, + "connected" : true, + "functionId" : 60, + "supportedFunctions" : [ { + "maxAlternativeIconIndex" : 1, + "possibleActions" : [ { + "name" : { }, + "caption" : "caption", + "id" : 4 + }, { + "name" : { }, + "caption" : "caption", + "id" : 4 + } ], + "name" : "OPENINGSENSOR_GATE", + "caption" : "Gate opening sensor", + "id" : 60 + }, { + "maxAlternativeIconIndex" : 1, + "possibleActions" : [ { + "name" : { }, + "caption" : "caption", + "id" : 4 + }, { + "name" : { }, + "caption" : "caption", + "id" : 4 + } ], + "name" : "OPENINGSENSOR_GATE", + "caption" : "Gate opening sensor", + "id" : 60 + } ], + "locationId" : 9, + "function" : { + "maxAlternativeIconIndex" : 1, + "possibleActions" : [ { + "name" : { }, + "caption" : "caption", + "id" : 4 + }, { + "name" : { }, + "caption" : "caption", + "id" : 4 + } ], + "name" : "OPENINGSENSOR_GATE", + "caption" : "Gate opening sensor", + "id" : 60 + }, + "typeId" : 1000, + "location" : null, + "id" : 1, + "inheritedLocation" : true, + "iodeviceId" : 9 + } ], + "locationId" : 0, + "function" : { + "maxAlternativeIconIndex" : 1, + "possibleActions" : [ { + "name" : { }, + "caption" : "caption", + "id" : 4 + }, { + "name" : { }, + "caption" : "caption", + "id" : 4 + } ], + "name" : "OPENINGSENSOR_GATE", + "caption" : "Gate opening sensor", + "id" : 60 + }, + "caption" : "caption", + "location" : { + "iodevicesIds" : [ 5, 5 ], + "password" : "password", + "channels" : [ { + "hidden" : true, + "channelNumber" : 6, + "iodevice" : null, + "caption" : "caption", + "type" : { + "output" : false, + "name" : "SENSORNO", + "caption" : "Sensor (normal open)", + "id" : 7 + }, + "param3" : null, + "param1" : { }, + "param2" : null, + "altIcon" : 5, + "connected" : true, + "functionId" : 60, + "supportedFunctions" : [ { + "maxAlternativeIconIndex" : 1, + "possibleActions" : [ { + "name" : { }, + "caption" : "caption", + "id" : 4 + }, { + "name" : { }, + "caption" : "caption", + "id" : 4 + } ], + "name" : "OPENINGSENSOR_GATE", + "caption" : "Gate opening sensor", + "id" : 60 + }, { + "maxAlternativeIconIndex" : 1, + "possibleActions" : [ { + "name" : { }, + "caption" : "caption", + "id" : 4 + }, { + "name" : { }, + "caption" : "caption", + "id" : 4 + } ], + "name" : "OPENINGSENSOR_GATE", + "caption" : "Gate opening sensor", + "id" : 60 + } ], + "locationId" : 9, + "function" : { + "maxAlternativeIconIndex" : 1, + "possibleActions" : [ { + "name" : { }, + "caption" : "caption", + "id" : 4 + }, { + "name" : { }, + "caption" : "caption", + "id" : 4 + } ], + "name" : "OPENINGSENSOR_GATE", + "caption" : "Gate opening sensor", + "id" : 60 + }, + "typeId" : 1000, + "location" : null, + "id" : 1, + "inheritedLocation" : true, + "iodeviceId" : 9 + }, { + "hidden" : true, + "channelNumber" : 6, + "iodevice" : null, + "caption" : "caption", + "type" : { + "output" : false, + "name" : "SENSORNO", + "caption" : "Sensor (normal open)", + "id" : 7 + }, + "param3" : null, + "param1" : { }, + "param2" : null, + "altIcon" : 5, + "connected" : true, + "functionId" : 60, + "supportedFunctions" : [ { + "maxAlternativeIconIndex" : 1, + "possibleActions" : [ { + "name" : { }, + "caption" : "caption", + "id" : 4 + }, { + "name" : { }, + "caption" : "caption", + "id" : 4 + } ], + "name" : "OPENINGSENSOR_GATE", + "caption" : "Gate opening sensor", + "id" : 60 + }, { + "maxAlternativeIconIndex" : 1, + "possibleActions" : [ { + "name" : { }, + "caption" : "caption", + "id" : 4 + }, { + "name" : { }, + "caption" : "caption", + "id" : 4 + } ], + "name" : "OPENINGSENSOR_GATE", + "caption" : "Gate opening sensor", + "id" : 60 + } ], + "locationId" : 9, + "function" : { + "maxAlternativeIconIndex" : 1, + "possibleActions" : [ { + "name" : { }, + "caption" : "caption", + "id" : 4 + }, { + "name" : { }, + "caption" : "caption", + "id" : 4 + } ], + "name" : "OPENINGSENSOR_GATE", + "caption" : "Gate opening sensor", + "id" : 60 + }, + "typeId" : 1000, + "location" : null, + "id" : 1, + "inheritedLocation" : true, + "iodeviceId" : 9 + } ], + "accessIdsIds" : [ 9, 9 ], + "channelGroups" : [ ], + "caption" : "caption", + "channelGroupsIds" : [ 2, 2 ], + "accessIds" : [ null, null ], + "id" : 5, + "iodevices" : [ { + "originalLocation" : null, + "lastIpv4" : 4, + "gUIDString" : "gUIDString", + "originalLocationId" : 1, + "regDate" : "2000-01-23T04:56:07.000+00:00", + "channelsIds" : [ 1, 1 ], + "enabled" : true, + "connected" : true, + "channels" : [ { + "hidden" : true, + "channelNumber" : 6, + "iodevice" : null, + "caption" : "caption", + "type" : { + "output" : false, + "name" : "SENSORNO", + "caption" : "Sensor (normal open)", + "id" : 7 + }, + "param3" : null, + "param1" : { }, + "param2" : null, + "altIcon" : 5, + "connected" : true, + "functionId" : 60, + "supportedFunctions" : [ { + "maxAlternativeIconIndex" : 1, + "possibleActions" : [ { + "name" : { }, + "caption" : "caption", + "id" : 4 + }, { + "name" : { }, + "caption" : "caption", + "id" : 4 + } ], + "name" : "OPENINGSENSOR_GATE", + "caption" : "Gate opening sensor", + "id" : 60 + }, { + "maxAlternativeIconIndex" : 1, + "possibleActions" : [ { + "name" : { }, + "caption" : "caption", + "id" : 4 + }, { + "name" : { }, + "caption" : "caption", + "id" : 4 + } ], + "name" : "OPENINGSENSOR_GATE", + "caption" : "Gate opening sensor", + "id" : 60 + } ], + "locationId" : 9, + "function" : { + "maxAlternativeIconIndex" : 1, + "possibleActions" : [ { + "name" : { }, + "caption" : "caption", + "id" : 4 + }, { + "name" : { }, + "caption" : "caption", + "id" : 4 + } ], + "name" : "OPENINGSENSOR_GATE", + "caption" : "Gate opening sensor", + "id" : 60 + }, + "typeId" : 1000, + "location" : null, + "id" : 1, + "inheritedLocation" : true, + "iodeviceId" : 9 + }, { + "hidden" : true, + "channelNumber" : 6, + "iodevice" : null, + "caption" : "caption", + "type" : { + "output" : false, + "name" : "SENSORNO", + "caption" : "Sensor (normal open)", + "id" : 7 + }, + "param3" : null, + "param1" : { }, + "param2" : null, + "altIcon" : 5, + "connected" : true, + "functionId" : 60, + "supportedFunctions" : [ { + "maxAlternativeIconIndex" : 1, + "possibleActions" : [ { + "name" : { }, + "caption" : "caption", + "id" : 4 + }, { + "name" : { }, + "caption" : "caption", + "id" : 4 + } ], + "name" : "OPENINGSENSOR_GATE", + "caption" : "Gate opening sensor", + "id" : 60 + }, { + "maxAlternativeIconIndex" : 1, + "possibleActions" : [ { + "name" : { }, + "caption" : "caption", + "id" : 4 + }, { + "name" : { }, + "caption" : "caption", + "id" : 4 + } ], + "name" : "OPENINGSENSOR_GATE", + "caption" : "Gate opening sensor", + "id" : 60 + } ], + "locationId" : 9, + "function" : { + "maxAlternativeIconIndex" : 1, + "possibleActions" : [ { + "name" : { }, + "caption" : "caption", + "id" : 4 + }, { + "name" : { }, + "caption" : "caption", + "id" : 4 + } ], + "name" : "OPENINGSENSOR_GATE", + "caption" : "Gate opening sensor", + "id" : 60 + }, + "typeId" : 1000, + "location" : null, + "id" : 1, + "inheritedLocation" : true, + "iodeviceId" : 9 + } ], + "lastConnected" : "2000-01-23T04:56:07.000+00:00", + "locationId" : 7, + "regIpv4" : 2, + "schedules" : [ { + "channel" : { + "hidden" : true, + "channelNumber" : 6, + "iodevice" : null, + "caption" : "caption", + "type" : { + "output" : false, + "name" : "SENSORNO", + "caption" : "Sensor (normal open)", + "id" : 7 + }, + "param3" : null, + "param1" : { }, + "param2" : null, + "altIcon" : 5, + "connected" : true, + "functionId" : 60, + "supportedFunctions" : [ { + "maxAlternativeIconIndex" : 1, + "possibleActions" : [ { + "name" : { }, + "caption" : "caption", + "id" : 4 + }, { + "name" : { }, + "caption" : "caption", + "id" : 4 + } ], + "name" : "OPENINGSENSOR_GATE", + "caption" : "Gate opening sensor", + "id" : 60 + }, { + "maxAlternativeIconIndex" : 1, + "possibleActions" : [ { + "name" : { }, + "caption" : "caption", + "id" : 4 + }, { + "name" : { }, + "caption" : "caption", + "id" : 4 + } ], + "name" : "OPENINGSENSOR_GATE", + "caption" : "Gate opening sensor", + "id" : 60 + } ], + "locationId" : 9, + "function" : { + "maxAlternativeIconIndex" : 1, + "possibleActions" : [ { + "name" : { }, + "caption" : "caption", + "id" : 4 + }, { + "name" : { }, + "caption" : "caption", + "id" : 4 + } ], + "name" : "OPENINGSENSOR_GATE", + "caption" : "Gate opening sensor", + "id" : 60 + }, + "typeId" : 1000, + "location" : null, + "id" : 1, + "inheritedLocation" : true, + "iodeviceId" : 9 + }, + "caption" : "caption", + "dateEnd" : "2000-01-23T04:56:07.000+00:00", + "timeExpression" : "*/5 * * * *", + "closestExecutions" : [ { + "past" : [ { + "result" : { + "caption" : "Successful" + }, + "plannedTimestamp" : "2000-01-23T04:56:07.000+00:00", + "resultTimestamp" : "2000-01-23T04:56:07.000+00:00", + "failed" : false + }, { + "result" : { + "caption" : "Successful" + }, + "plannedTimestamp" : "2000-01-23T04:56:07.000+00:00", + "resultTimestamp" : "2000-01-23T04:56:07.000+00:00", + "failed" : false + } ], + "future" : [ { + "plannedTimestamp" : "2000-01-23T04:56:07.000+00:00" + }, { + "plannedTimestamp" : "2000-01-23T04:56:07.000+00:00" + } ] + }, { + "past" : [ { + "result" : { + "caption" : "Successful" + }, + "plannedTimestamp" : "2000-01-23T04:56:07.000+00:00", + "resultTimestamp" : "2000-01-23T04:56:07.000+00:00", + "failed" : false + }, { + "result" : { + "caption" : "Successful" + }, + "plannedTimestamp" : "2000-01-23T04:56:07.000+00:00", + "resultTimestamp" : "2000-01-23T04:56:07.000+00:00", + "failed" : false + } ], + "future" : [ { + "plannedTimestamp" : "2000-01-23T04:56:07.000+00:00" + }, { + "plannedTimestamp" : "2000-01-23T04:56:07.000+00:00" + } ] + } ], + "enabled" : true, + "mode" : "minutely", + "dateStart" : "2000-01-23T04:56:07.000+00:00", + "action" : { + "name" : { }, + "caption" : "caption", + "id" : 4 + }, + "actionId" : 9, + "id" : 6, + "retry" : true, + "channelId" : 8 + }, { + "channel" : { + "hidden" : true, + "channelNumber" : 6, + "iodevice" : null, + "caption" : "caption", + "type" : { + "output" : false, + "name" : "SENSORNO", + "caption" : "Sensor (normal open)", + "id" : 7 + }, + "param3" : null, + "param1" : { }, + "param2" : null, + "altIcon" : 5, + "connected" : true, + "functionId" : 60, + "supportedFunctions" : [ { + "maxAlternativeIconIndex" : 1, + "possibleActions" : [ { + "name" : { }, + "caption" : "caption", + "id" : 4 + }, { + "name" : { }, + "caption" : "caption", + "id" : 4 + } ], + "name" : "OPENINGSENSOR_GATE", + "caption" : "Gate opening sensor", + "id" : 60 + }, { + "maxAlternativeIconIndex" : 1, + "possibleActions" : [ { + "name" : { }, + "caption" : "caption", + "id" : 4 + }, { + "name" : { }, + "caption" : "caption", + "id" : 4 + } ], + "name" : "OPENINGSENSOR_GATE", + "caption" : "Gate opening sensor", + "id" : 60 + } ], + "locationId" : 9, + "function" : { + "maxAlternativeIconIndex" : 1, + "possibleActions" : [ { + "name" : { }, + "caption" : "caption", + "id" : 4 + }, { + "name" : { }, + "caption" : "caption", + "id" : 4 + } ], + "name" : "OPENINGSENSOR_GATE", + "caption" : "Gate opening sensor", + "id" : 60 + }, + "typeId" : 1000, + "location" : null, + "id" : 1, + "inheritedLocation" : true, + "iodeviceId" : 9 + }, + "caption" : "caption", + "dateEnd" : "2000-01-23T04:56:07.000+00:00", + "timeExpression" : "*/5 * * * *", + "closestExecutions" : [ { + "past" : [ { + "result" : { + "caption" : "Successful" + }, + "plannedTimestamp" : "2000-01-23T04:56:07.000+00:00", + "resultTimestamp" : "2000-01-23T04:56:07.000+00:00", + "failed" : false + }, { + "result" : { + "caption" : "Successful" + }, + "plannedTimestamp" : "2000-01-23T04:56:07.000+00:00", + "resultTimestamp" : "2000-01-23T04:56:07.000+00:00", + "failed" : false + } ], + "future" : [ { + "plannedTimestamp" : "2000-01-23T04:56:07.000+00:00" + }, { + "plannedTimestamp" : "2000-01-23T04:56:07.000+00:00" + } ] + }, { + "past" : [ { + "result" : { + "caption" : "Successful" + }, + "plannedTimestamp" : "2000-01-23T04:56:07.000+00:00", + "resultTimestamp" : "2000-01-23T04:56:07.000+00:00", + "failed" : false + }, { + "result" : { + "caption" : "Successful" + }, + "plannedTimestamp" : "2000-01-23T04:56:07.000+00:00", + "resultTimestamp" : "2000-01-23T04:56:07.000+00:00", + "failed" : false + } ], + "future" : [ { + "plannedTimestamp" : "2000-01-23T04:56:07.000+00:00" + }, { + "plannedTimestamp" : "2000-01-23T04:56:07.000+00:00" + } ] + } ], + "enabled" : true, + "mode" : "minutely", + "dateStart" : "2000-01-23T04:56:07.000+00:00", + "action" : { + "name" : { }, + "caption" : "caption", + "id" : 4 + }, + "actionId" : 9, + "id" : 6, + "retry" : true, + "channelId" : 8 + } ], + "name" : "name", + "comment" : "comment", + "location" : null, + "id" : 3, + "softwareVersion" : "softwareVersion" + }, { + "originalLocation" : null, + "lastIpv4" : 4, + "gUIDString" : "gUIDString", + "originalLocationId" : 1, + "regDate" : "2000-01-23T04:56:07.000+00:00", + "channelsIds" : [ 1, 1 ], + "enabled" : true, + "connected" : true, + "channels" : [ { + "hidden" : true, + "channelNumber" : 6, + "iodevice" : null, + "caption" : "caption", + "type" : { + "output" : false, + "name" : "SENSORNO", + "caption" : "Sensor (normal open)", + "id" : 7 + }, + "param3" : null, + "param1" : { }, + "param2" : null, + "altIcon" : 5, + "connected" : true, + "functionId" : 60, + "supportedFunctions" : [ { + "maxAlternativeIconIndex" : 1, + "possibleActions" : [ { + "name" : { }, + "caption" : "caption", + "id" : 4 + }, { + "name" : { }, + "caption" : "caption", + "id" : 4 + } ], + "name" : "OPENINGSENSOR_GATE", + "caption" : "Gate opening sensor", + "id" : 60 + }, { + "maxAlternativeIconIndex" : 1, + "possibleActions" : [ { + "name" : { }, + "caption" : "caption", + "id" : 4 + }, { + "name" : { }, + "caption" : "caption", + "id" : 4 + } ], + "name" : "OPENINGSENSOR_GATE", + "caption" : "Gate opening sensor", + "id" : 60 + } ], + "locationId" : 9, + "function" : { + "maxAlternativeIconIndex" : 1, + "possibleActions" : [ { + "name" : { }, + "caption" : "caption", + "id" : 4 + }, { + "name" : { }, + "caption" : "caption", + "id" : 4 + } ], + "name" : "OPENINGSENSOR_GATE", + "caption" : "Gate opening sensor", + "id" : 60 + }, + "typeId" : 1000, + "location" : null, + "id" : 1, + "inheritedLocation" : true, + "iodeviceId" : 9 + }, { + "hidden" : true, + "channelNumber" : 6, + "iodevice" : null, + "caption" : "caption", + "type" : { + "output" : false, + "name" : "SENSORNO", + "caption" : "Sensor (normal open)", + "id" : 7 + }, + "param3" : null, + "param1" : { }, + "param2" : null, + "altIcon" : 5, + "connected" : true, + "functionId" : 60, + "supportedFunctions" : [ { + "maxAlternativeIconIndex" : 1, + "possibleActions" : [ { + "name" : { }, + "caption" : "caption", + "id" : 4 + }, { + "name" : { }, + "caption" : "caption", + "id" : 4 + } ], + "name" : "OPENINGSENSOR_GATE", + "caption" : "Gate opening sensor", + "id" : 60 + }, { + "maxAlternativeIconIndex" : 1, + "possibleActions" : [ { + "name" : { }, + "caption" : "caption", + "id" : 4 + }, { + "name" : { }, + "caption" : "caption", + "id" : 4 + } ], + "name" : "OPENINGSENSOR_GATE", + "caption" : "Gate opening sensor", + "id" : 60 + } ], + "locationId" : 9, + "function" : { + "maxAlternativeIconIndex" : 1, + "possibleActions" : [ { + "name" : { }, + "caption" : "caption", + "id" : 4 + }, { + "name" : { }, + "caption" : "caption", + "id" : 4 + } ], + "name" : "OPENINGSENSOR_GATE", + "caption" : "Gate opening sensor", + "id" : 60 + }, + "typeId" : 1000, + "location" : null, + "id" : 1, + "inheritedLocation" : true, + "iodeviceId" : 9 + } ], + "lastConnected" : "2000-01-23T04:56:07.000+00:00", + "locationId" : 7, + "regIpv4" : 2, + "schedules" : [ { + "channel" : { + "hidden" : true, + "channelNumber" : 6, + "iodevice" : null, + "caption" : "caption", + "type" : { + "output" : false, + "name" : "SENSORNO", + "caption" : "Sensor (normal open)", + "id" : 7 + }, + "param3" : null, + "param1" : { }, + "param2" : null, + "altIcon" : 5, + "connected" : true, + "functionId" : 60, + "supportedFunctions" : [ { + "maxAlternativeIconIndex" : 1, + "possibleActions" : [ { + "name" : { }, + "caption" : "caption", + "id" : 4 + }, { + "name" : { }, + "caption" : "caption", + "id" : 4 + } ], + "name" : "OPENINGSENSOR_GATE", + "caption" : "Gate opening sensor", + "id" : 60 + }, { + "maxAlternativeIconIndex" : 1, + "possibleActions" : [ { + "name" : { }, + "caption" : "caption", + "id" : 4 + }, { + "name" : { }, + "caption" : "caption", + "id" : 4 + } ], + "name" : "OPENINGSENSOR_GATE", + "caption" : "Gate opening sensor", + "id" : 60 + } ], + "locationId" : 9, + "function" : { + "maxAlternativeIconIndex" : 1, + "possibleActions" : [ { + "name" : { }, + "caption" : "caption", + "id" : 4 + }, { + "name" : { }, + "caption" : "caption", + "id" : 4 + } ], + "name" : "OPENINGSENSOR_GATE", + "caption" : "Gate opening sensor", + "id" : 60 + }, + "typeId" : 1000, + "location" : null, + "id" : 1, + "inheritedLocation" : true, + "iodeviceId" : 9 + }, + "caption" : "caption", + "dateEnd" : "2000-01-23T04:56:07.000+00:00", + "timeExpression" : "*/5 * * * *", + "closestExecutions" : [ { + "past" : [ { + "result" : { + "caption" : "Successful" + }, + "plannedTimestamp" : "2000-01-23T04:56:07.000+00:00", + "resultTimestamp" : "2000-01-23T04:56:07.000+00:00", + "failed" : false + }, { + "result" : { + "caption" : "Successful" + }, + "plannedTimestamp" : "2000-01-23T04:56:07.000+00:00", + "resultTimestamp" : "2000-01-23T04:56:07.000+00:00", + "failed" : false + } ], + "future" : [ { + "plannedTimestamp" : "2000-01-23T04:56:07.000+00:00" + }, { + "plannedTimestamp" : "2000-01-23T04:56:07.000+00:00" + } ] + }, { + "past" : [ { + "result" : { + "caption" : "Successful" + }, + "plannedTimestamp" : "2000-01-23T04:56:07.000+00:00", + "resultTimestamp" : "2000-01-23T04:56:07.000+00:00", + "failed" : false + }, { + "result" : { + "caption" : "Successful" + }, + "plannedTimestamp" : "2000-01-23T04:56:07.000+00:00", + "resultTimestamp" : "2000-01-23T04:56:07.000+00:00", + "failed" : false + } ], + "future" : [ { + "plannedTimestamp" : "2000-01-23T04:56:07.000+00:00" + }, { + "plannedTimestamp" : "2000-01-23T04:56:07.000+00:00" + } ] + } ], + "enabled" : true, + "mode" : "minutely", + "dateStart" : "2000-01-23T04:56:07.000+00:00", + "action" : { + "name" : { }, + "caption" : "caption", + "id" : 4 + }, + "actionId" : 9, + "id" : 6, + "retry" : true, + "channelId" : 8 + }, { + "channel" : { + "hidden" : true, + "channelNumber" : 6, + "iodevice" : null, + "caption" : "caption", + "type" : { + "output" : false, + "name" : "SENSORNO", + "caption" : "Sensor (normal open)", + "id" : 7 + }, + "param3" : null, + "param1" : { }, + "param2" : null, + "altIcon" : 5, + "connected" : true, + "functionId" : 60, + "supportedFunctions" : [ { + "maxAlternativeIconIndex" : 1, + "possibleActions" : [ { + "name" : { }, + "caption" : "caption", + "id" : 4 + }, { + "name" : { }, + "caption" : "caption", + "id" : 4 + } ], + "name" : "OPENINGSENSOR_GATE", + "caption" : "Gate opening sensor", + "id" : 60 + }, { + "maxAlternativeIconIndex" : 1, + "possibleActions" : [ { + "name" : { }, + "caption" : "caption", + "id" : 4 + }, { + "name" : { }, + "caption" : "caption", + "id" : 4 + } ], + "name" : "OPENINGSENSOR_GATE", + "caption" : "Gate opening sensor", + "id" : 60 + } ], + "locationId" : 9, + "function" : { + "maxAlternativeIconIndex" : 1, + "possibleActions" : [ { + "name" : { }, + "caption" : "caption", + "id" : 4 + }, { + "name" : { }, + "caption" : "caption", + "id" : 4 + } ], + "name" : "OPENINGSENSOR_GATE", + "caption" : "Gate opening sensor", + "id" : 60 + }, + "typeId" : 1000, + "location" : null, + "id" : 1, + "inheritedLocation" : true, + "iodeviceId" : 9 + }, + "caption" : "caption", + "dateEnd" : "2000-01-23T04:56:07.000+00:00", + "timeExpression" : "*/5 * * * *", + "closestExecutions" : [ { + "past" : [ { + "result" : { + "caption" : "Successful" + }, + "plannedTimestamp" : "2000-01-23T04:56:07.000+00:00", + "resultTimestamp" : "2000-01-23T04:56:07.000+00:00", + "failed" : false + }, { + "result" : { + "caption" : "Successful" + }, + "plannedTimestamp" : "2000-01-23T04:56:07.000+00:00", + "resultTimestamp" : "2000-01-23T04:56:07.000+00:00", + "failed" : false + } ], + "future" : [ { + "plannedTimestamp" : "2000-01-23T04:56:07.000+00:00" + }, { + "plannedTimestamp" : "2000-01-23T04:56:07.000+00:00" + } ] + }, { + "past" : [ { + "result" : { + "caption" : "Successful" + }, + "plannedTimestamp" : "2000-01-23T04:56:07.000+00:00", + "resultTimestamp" : "2000-01-23T04:56:07.000+00:00", + "failed" : false + }, { + "result" : { + "caption" : "Successful" + }, + "plannedTimestamp" : "2000-01-23T04:56:07.000+00:00", + "resultTimestamp" : "2000-01-23T04:56:07.000+00:00", + "failed" : false + } ], + "future" : [ { + "plannedTimestamp" : "2000-01-23T04:56:07.000+00:00" + }, { + "plannedTimestamp" : "2000-01-23T04:56:07.000+00:00" + } ] + } ], + "enabled" : true, + "mode" : "minutely", + "dateStart" : "2000-01-23T04:56:07.000+00:00", + "action" : { + "name" : { }, + "caption" : "caption", + "id" : 4 + }, + "actionId" : 9, + "id" : 6, + "retry" : true, + "channelId" : 8 + } ], + "name" : "name", + "comment" : "comment", + "location" : null, + "id" : 3, + "softwareVersion" : "softwareVersion" + } ], + "channelsIds" : [ 7, 7 ], + "enabled" : true + }, + "id" : 1, + "channelIds" : [ 6, 6 ], + "altIcon" : 1 + } + }, + "ChannelGroupRequest" : { + "required" : [ "channelIds" ], + "properties" : { + "caption" : { + "type" : "string" + }, + "altIcon" : { + "type" : "integer" + }, + "hidden" : { + "type" : "boolean" + }, + "locationId" : { + "type" : "integer" + }, + "channelIds" : { + "type" : "array", + "items" : { + "type" : "integer" + } + } + }, + "example" : { + "hidden" : true, + "locationId" : 6, + "caption" : "caption", + "channelIds" : [ 1, 1 ], + "altIcon" : 0 + } + }, + "ChannelType" : { + "properties" : { + "id" : { + "type" : "integer", + "description" : "Channel type identifier" + }, + "name" : { + "type" : "string", + "enum" : [ "SENSORNO", "SENSORNC", "DISTANCESENSOR", "CALLBUTTON", "RELAYHFD4", "RELAYG5LA1A", "RELAY2XG5LA1A", "RELAY", "THERMOMETERDS18B20", "DHT11", "DHT21", "DHT22", "AM2301", "AM2302", "THERMOMETER", "HUMIDITYSENSOR", "HUMIDITYANDTEMPSENSOR", "WINDSENSOR", "PRESSURESENSOR", "RAINSENSOR", "WEIGHTSENSOR", "WEATHER_STATION", "DIMMER", "RGBLEDCONTROLLER", "DIMMERANDRGBLED" ] + }, + "caption" : { + "type" : "string", + "example" : "Sensor (normal open)" + }, + "output" : { + "type" : "boolean", + "example" : false, + "description" : "Whether the channel is output type (i.e. can take action) or input (i.e. provide data)" + } + }, + "example" : { + "output" : false, + "name" : "SENSORNO", + "caption" : "Sensor (normal open)", + "id" : 7 + } + }, + "ChannelFunction" : { + "properties" : { + "id" : { + "type" : "integer", + "example" : 60 + }, + "name" : { + "$ref" : "#/definitions/ChannelFunctionEnumNames" + }, + "caption" : { + "type" : "string", + "example" : "Gate opening sensor" + }, + "maxAlternativeIconIndex" : { + "type" : "integer" + }, + "possibleActions" : { + "type" : "array", + "description" : "What can you with with this channel?", + "items" : { + "$ref" : "#/definitions/ChannelFunctionAction" + } + } + }, + "example" : { + "maxAlternativeIconIndex" : 1, + "possibleActions" : [ { + "name" : { }, + "caption" : "caption", + "id" : 4 + }, { + "name" : { }, + "caption" : "caption", + "id" : 4 + } ], + "name" : "OPENINGSENSOR_GATE", + "caption" : "Gate opening sensor", + "id" : 60 + } + }, + "ChannelFunctionEnumNames" : { + "type" : "string", + "example" : "OPENINGSENSOR_GATE", + "enum" : [ "NONE", "CONTROLLINGTHEGATEWAYLOCK", "CONTROLLINGTHEGATE", "CONTROLLINGTHEGARAGEDOOR", "THERMOMETER", "HUMIDITY", "HUMIDITYANDTEMPERATURE", "OPENINGSENSOR_GATEWAY", "OPENINGSENSOR_GATE", "OPENINGSENSOR_GARAGEDOOR", "NOLIQUIDSENSOR", "CONTROLLINGTHEDOORLOCK", "OPENINGSENSOR_DOOR", "CONTROLLINGTHEROLLERSHUTTER", "OPENINGSENSOR_ROLLERSHUTTER", "POWERSWITCH", "LIGHTSWITCH", "DIMMER", "RGBLIGHTING", "DIMMERANDRGBLIGHTING", "DEPTHSENSOR", "DISTANCESENSOR", "OPENINGSENSOR_WINDOW", "MAILSENSOR", "WINDSENSOR", "PRESSURESENSOR", "RAINSENSOR", "WEIGHTSENSOR", "WEATHER_STATION", "STAIRCASETIMER" ] + }, + "ChannelFunctionAction" : { + "properties" : { + "id" : { + "type" : "integer" + }, + "name" : { + "$ref" : "#/definitions/ChannelFunctionActionEnum" + }, + "caption" : { + "type" : "string" + } + }, + "example" : { + "name" : { }, + "caption" : "caption", + "id" : 4 + } + }, + "ChannelFunctionActionEnum" : { + "type" : "string", + "enum" : [ "OPEN", "CLOSE", "SHUT", "REVEAL", "REVEAL_PARTIALLY", "TURN_ON", "TURN_OFF", "SET_RGBW_PARAMETERS", "OPEN_CLOSE", "STOP" ] + }, + "ChannelExecuteActionRequest" : { + "required" : [ "action" ], + "properties" : { + "action" : { + "$ref" : "#/definitions/ChannelFunctionActionEnum" + }, + "percentage" : { + "type" : "integer", + "example" : 40 + }, + "color" : { + "type" : "string", + "example" : "0x00FF00" + }, + "color_brightness" : { + "type" : "integer" + }, + "brightness" : { + "type" : "integer" + } + }, + "example" : { + "brightness" : 6, + "color" : "0x00FF00", + "color_brightness" : 0, + "percentage" : 40, + "action" : { } + } + }, + "ChannelParam" : { + "type" : "integer", + "description" : "Configuration of the channel behavior. Value meaning depends on the chosen channel function. See more details on [Github Wiki](https://github.com/SUPLA/supla-cloud/wiki/Channel-Functions-parameters)." + }, + "Device" : { + "properties" : { + "id" : { + "type" : "integer", + "description" : "Device identifier" + }, + "name" : { + "type" : "string" + }, + "enabled" : { + "type" : "boolean" + }, + "comment" : { + "type" : "string" + }, + "regDate" : { + "type" : "string", + "format" : "date-time" + }, + "regIpv4" : { + "type" : "integer" + }, + "lastConnected" : { + "type" : "string", + "format" : "date-time" + }, + "lastIpv4" : { + "type" : "integer" + }, + "softwareVersion" : { + "type" : "string" + }, + "gUIDString" : { + "type" : "string" + }, + "locationId" : { + "type" : "integer" + }, + "originalLocationId" : { + "type" : "integer" + }, + "channelsIds" : { + "type" : "array", + "items" : { + "type" : "integer" + } + }, + "connected" : { + "type" : "boolean" + }, + "location" : { + "$ref" : "#/definitions/Location" + }, + "originalLocation" : { + "$ref" : "#/definitions/Location" + }, + "channels" : { + "type" : "array", + "description" : "Returned only if requested by the `include` parameter.", + "items" : { + "$ref" : "#/definitions/Channel" + } + }, + "schedules" : { + "type" : "array", + "description" : "Returned only if requested by the `include` parameter.", + "items" : { + "$ref" : "#/definitions/Schedule" + } + } + }, + "example" : { + "originalLocation" : null, + "lastIpv4" : 4, + "gUIDString" : "gUIDString", + "originalLocationId" : 1, + "regDate" : "2000-01-23T04:56:07.000+00:00", + "channelsIds" : [ 1, 1 ], + "enabled" : true, + "connected" : true, + "channels" : [ { + "hidden" : true, + "channelNumber" : 6, + "iodevice" : null, + "caption" : "caption", + "type" : { + "output" : false, + "name" : "SENSORNO", + "caption" : "Sensor (normal open)", + "id" : 7 + }, + "param3" : null, + "param1" : { }, + "param2" : null, + "altIcon" : 5, + "connected" : true, + "functionId" : 60, + "supportedFunctions" : [ { + "maxAlternativeIconIndex" : 1, + "possibleActions" : [ { + "name" : { }, + "caption" : "caption", + "id" : 4 + }, { + "name" : { }, + "caption" : "caption", + "id" : 4 + } ], + "name" : "OPENINGSENSOR_GATE", + "caption" : "Gate opening sensor", + "id" : 60 + }, { + "maxAlternativeIconIndex" : 1, + "possibleActions" : [ { + "name" : { }, + "caption" : "caption", + "id" : 4 + }, { + "name" : { }, + "caption" : "caption", + "id" : 4 + } ], + "name" : "OPENINGSENSOR_GATE", + "caption" : "Gate opening sensor", + "id" : 60 + } ], + "locationId" : 9, + "function" : { + "maxAlternativeIconIndex" : 1, + "possibleActions" : [ { + "name" : { }, + "caption" : "caption", + "id" : 4 + }, { + "name" : { }, + "caption" : "caption", + "id" : 4 + } ], + "name" : "OPENINGSENSOR_GATE", + "caption" : "Gate opening sensor", + "id" : 60 + }, + "typeId" : 1000, + "location" : null, + "id" : 1, + "inheritedLocation" : true, + "iodeviceId" : 9 + }, { + "hidden" : true, + "channelNumber" : 6, + "iodevice" : null, + "caption" : "caption", + "type" : { + "output" : false, + "name" : "SENSORNO", + "caption" : "Sensor (normal open)", + "id" : 7 + }, + "param3" : null, + "param1" : { }, + "param2" : null, + "altIcon" : 5, + "connected" : true, + "functionId" : 60, + "supportedFunctions" : [ { + "maxAlternativeIconIndex" : 1, + "possibleActions" : [ { + "name" : { }, + "caption" : "caption", + "id" : 4 + }, { + "name" : { }, + "caption" : "caption", + "id" : 4 + } ], + "name" : "OPENINGSENSOR_GATE", + "caption" : "Gate opening sensor", + "id" : 60 + }, { + "maxAlternativeIconIndex" : 1, + "possibleActions" : [ { + "name" : { }, + "caption" : "caption", + "id" : 4 + }, { + "name" : { }, + "caption" : "caption", + "id" : 4 + } ], + "name" : "OPENINGSENSOR_GATE", + "caption" : "Gate opening sensor", + "id" : 60 + } ], + "locationId" : 9, + "function" : { + "maxAlternativeIconIndex" : 1, + "possibleActions" : [ { + "name" : { }, + "caption" : "caption", + "id" : 4 + }, { + "name" : { }, + "caption" : "caption", + "id" : 4 + } ], + "name" : "OPENINGSENSOR_GATE", + "caption" : "Gate opening sensor", + "id" : 60 + }, + "typeId" : 1000, + "location" : null, + "id" : 1, + "inheritedLocation" : true, + "iodeviceId" : 9 + } ], + "lastConnected" : "2000-01-23T04:56:07.000+00:00", + "locationId" : 7, + "regIpv4" : 2, + "schedules" : [ { + "channel" : { + "hidden" : true, + "channelNumber" : 6, + "iodevice" : null, + "caption" : "caption", + "type" : { + "output" : false, + "name" : "SENSORNO", + "caption" : "Sensor (normal open)", + "id" : 7 + }, + "param3" : null, + "param1" : { }, + "param2" : null, + "altIcon" : 5, + "connected" : true, + "functionId" : 60, + "supportedFunctions" : [ { + "maxAlternativeIconIndex" : 1, + "possibleActions" : [ { + "name" : { }, + "caption" : "caption", + "id" : 4 + }, { + "name" : { }, + "caption" : "caption", + "id" : 4 + } ], + "name" : "OPENINGSENSOR_GATE", + "caption" : "Gate opening sensor", + "id" : 60 + }, { + "maxAlternativeIconIndex" : 1, + "possibleActions" : [ { + "name" : { }, + "caption" : "caption", + "id" : 4 + }, { + "name" : { }, + "caption" : "caption", + "id" : 4 + } ], + "name" : "OPENINGSENSOR_GATE", + "caption" : "Gate opening sensor", + "id" : 60 + } ], + "locationId" : 9, + "function" : { + "maxAlternativeIconIndex" : 1, + "possibleActions" : [ { + "name" : { }, + "caption" : "caption", + "id" : 4 + }, { + "name" : { }, + "caption" : "caption", + "id" : 4 + } ], + "name" : "OPENINGSENSOR_GATE", + "caption" : "Gate opening sensor", + "id" : 60 + }, + "typeId" : 1000, + "location" : null, + "id" : 1, + "inheritedLocation" : true, + "iodeviceId" : 9 + }, + "caption" : "caption", + "dateEnd" : "2000-01-23T04:56:07.000+00:00", + "timeExpression" : "*/5 * * * *", + "closestExecutions" : [ { + "past" : [ { + "result" : { + "caption" : "Successful" + }, + "plannedTimestamp" : "2000-01-23T04:56:07.000+00:00", + "resultTimestamp" : "2000-01-23T04:56:07.000+00:00", + "failed" : false + }, { + "result" : { + "caption" : "Successful" + }, + "plannedTimestamp" : "2000-01-23T04:56:07.000+00:00", + "resultTimestamp" : "2000-01-23T04:56:07.000+00:00", + "failed" : false + } ], + "future" : [ { + "plannedTimestamp" : "2000-01-23T04:56:07.000+00:00" + }, { + "plannedTimestamp" : "2000-01-23T04:56:07.000+00:00" + } ] + }, { + "past" : [ { + "result" : { + "caption" : "Successful" + }, + "plannedTimestamp" : "2000-01-23T04:56:07.000+00:00", + "resultTimestamp" : "2000-01-23T04:56:07.000+00:00", + "failed" : false + }, { + "result" : { + "caption" : "Successful" + }, + "plannedTimestamp" : "2000-01-23T04:56:07.000+00:00", + "resultTimestamp" : "2000-01-23T04:56:07.000+00:00", + "failed" : false + } ], + "future" : [ { + "plannedTimestamp" : "2000-01-23T04:56:07.000+00:00" + }, { + "plannedTimestamp" : "2000-01-23T04:56:07.000+00:00" + } ] + } ], + "enabled" : true, + "mode" : "minutely", + "dateStart" : "2000-01-23T04:56:07.000+00:00", + "action" : { + "name" : { }, + "caption" : "caption", + "id" : 4 + }, + "actionId" : 9, + "id" : 6, + "retry" : true, + "channelId" : 8 + }, { + "channel" : { + "hidden" : true, + "channelNumber" : 6, + "iodevice" : null, + "caption" : "caption", + "type" : { + "output" : false, + "name" : "SENSORNO", + "caption" : "Sensor (normal open)", + "id" : 7 + }, + "param3" : null, + "param1" : { }, + "param2" : null, + "altIcon" : 5, + "connected" : true, + "functionId" : 60, + "supportedFunctions" : [ { + "maxAlternativeIconIndex" : 1, + "possibleActions" : [ { + "name" : { }, + "caption" : "caption", + "id" : 4 + }, { + "name" : { }, + "caption" : "caption", + "id" : 4 + } ], + "name" : "OPENINGSENSOR_GATE", + "caption" : "Gate opening sensor", + "id" : 60 + }, { + "maxAlternativeIconIndex" : 1, + "possibleActions" : [ { + "name" : { }, + "caption" : "caption", + "id" : 4 + }, { + "name" : { }, + "caption" : "caption", + "id" : 4 + } ], + "name" : "OPENINGSENSOR_GATE", + "caption" : "Gate opening sensor", + "id" : 60 + } ], + "locationId" : 9, + "function" : { + "maxAlternativeIconIndex" : 1, + "possibleActions" : [ { + "name" : { }, + "caption" : "caption", + "id" : 4 + }, { + "name" : { }, + "caption" : "caption", + "id" : 4 + } ], + "name" : "OPENINGSENSOR_GATE", + "caption" : "Gate opening sensor", + "id" : 60 + }, + "typeId" : 1000, + "location" : null, + "id" : 1, + "inheritedLocation" : true, + "iodeviceId" : 9 + }, + "caption" : "caption", + "dateEnd" : "2000-01-23T04:56:07.000+00:00", + "timeExpression" : "*/5 * * * *", + "closestExecutions" : [ { + "past" : [ { + "result" : { + "caption" : "Successful" + }, + "plannedTimestamp" : "2000-01-23T04:56:07.000+00:00", + "resultTimestamp" : "2000-01-23T04:56:07.000+00:00", + "failed" : false + }, { + "result" : { + "caption" : "Successful" + }, + "plannedTimestamp" : "2000-01-23T04:56:07.000+00:00", + "resultTimestamp" : "2000-01-23T04:56:07.000+00:00", + "failed" : false + } ], + "future" : [ { + "plannedTimestamp" : "2000-01-23T04:56:07.000+00:00" + }, { + "plannedTimestamp" : "2000-01-23T04:56:07.000+00:00" + } ] + }, { + "past" : [ { + "result" : { + "caption" : "Successful" + }, + "plannedTimestamp" : "2000-01-23T04:56:07.000+00:00", + "resultTimestamp" : "2000-01-23T04:56:07.000+00:00", + "failed" : false + }, { + "result" : { + "caption" : "Successful" + }, + "plannedTimestamp" : "2000-01-23T04:56:07.000+00:00", + "resultTimestamp" : "2000-01-23T04:56:07.000+00:00", + "failed" : false + } ], + "future" : [ { + "plannedTimestamp" : "2000-01-23T04:56:07.000+00:00" + }, { + "plannedTimestamp" : "2000-01-23T04:56:07.000+00:00" + } ] + } ], + "enabled" : true, + "mode" : "minutely", + "dateStart" : "2000-01-23T04:56:07.000+00:00", + "action" : { + "name" : { }, + "caption" : "caption", + "id" : 4 + }, + "actionId" : 9, + "id" : 6, + "retry" : true, + "channelId" : 8 + } ], + "name" : "name", + "comment" : "comment", + "location" : null, + "id" : 3, + "softwareVersion" : "softwareVersion" + } + }, + "Location" : { + "properties" : { + "id" : { + "type" : "integer", + "description" : "Location identifier" + }, + "caption" : { + "type" : "string", + "description" : "Location caption" + }, + "enabled" : { + "type" : "boolean", + "description" : "`true` if the location is enabled, `false` otherwise" + }, + "iodevicesIds" : { + "type" : "array", + "description" : "array containing the IO Devices identifiers assigned to this location", + "items" : { + "type" : "integer" + } + }, + "channelGroupsIds" : { + "type" : "array", + "description" : "array containing the Channel groups identifiers assigned to this location", + "items" : { + "type" : "integer" + } + }, + "channelsIds" : { + "type" : "array", + "description" : "array containing the Channels identifiers expicitely assigned to this location", + "items" : { + "type" : "integer" + } + }, + "accessIdsIds" : { + "type" : "array", + "description" : "array containing the Access Identifiers identifiers assigned to this location", + "items" : { + "type" : "integer" + } + }, + "password" : { + "type" : "string", + "description" : "Location password (plain text). Returned only if requested by the `include` parameter." + }, + "iodevices" : { + "type" : "array", + "description" : "Returned only if requested by the `include` parameter.", + "items" : { + "$ref" : "#/definitions/Device" + } + }, + "channelGroups" : { + "type" : "array", + "example" : [ ], + "description" : "Returned only if requested by the `include` parameter.", + "items" : { + "$ref" : "#/definitions/ChannelGroup" + } + }, + "accessIds" : { + "type" : "array", + "description" : "Returned only if requested by the `include` parameter.", + "items" : { + "$ref" : "#/definitions/AccessIdentifier" + } + }, + "channels" : { + "type" : "array", + "description" : "Returned only if requested by the `include` parameter.", + "items" : { + "$ref" : "#/definitions/Channel" + } + } + }, + "example" : { + "iodevicesIds" : [ 5, 5 ], + "password" : "password", + "channels" : [ { + "hidden" : true, + "channelNumber" : 6, + "iodevice" : null, + "caption" : "caption", + "type" : { + "output" : false, + "name" : "SENSORNO", + "caption" : "Sensor (normal open)", + "id" : 7 + }, + "param3" : null, + "param1" : { }, + "param2" : null, + "altIcon" : 5, + "connected" : true, + "functionId" : 60, + "supportedFunctions" : [ { + "maxAlternativeIconIndex" : 1, + "possibleActions" : [ { + "name" : { }, + "caption" : "caption", + "id" : 4 + }, { + "name" : { }, + "caption" : "caption", + "id" : 4 + } ], + "name" : "OPENINGSENSOR_GATE", + "caption" : "Gate opening sensor", + "id" : 60 + }, { + "maxAlternativeIconIndex" : 1, + "possibleActions" : [ { + "name" : { }, + "caption" : "caption", + "id" : 4 + }, { + "name" : { }, + "caption" : "caption", + "id" : 4 + } ], + "name" : "OPENINGSENSOR_GATE", + "caption" : "Gate opening sensor", + "id" : 60 + } ], + "locationId" : 9, + "function" : { + "maxAlternativeIconIndex" : 1, + "possibleActions" : [ { + "name" : { }, + "caption" : "caption", + "id" : 4 + }, { + "name" : { }, + "caption" : "caption", + "id" : 4 + } ], + "name" : "OPENINGSENSOR_GATE", + "caption" : "Gate opening sensor", + "id" : 60 + }, + "typeId" : 1000, + "location" : null, + "id" : 1, + "inheritedLocation" : true, + "iodeviceId" : 9 + }, { + "hidden" : true, + "channelNumber" : 6, + "iodevice" : null, + "caption" : "caption", + "type" : { + "output" : false, + "name" : "SENSORNO", + "caption" : "Sensor (normal open)", + "id" : 7 + }, + "param3" : null, + "param1" : { }, + "param2" : null, + "altIcon" : 5, + "connected" : true, + "functionId" : 60, + "supportedFunctions" : [ { + "maxAlternativeIconIndex" : 1, + "possibleActions" : [ { + "name" : { }, + "caption" : "caption", + "id" : 4 + }, { + "name" : { }, + "caption" : "caption", + "id" : 4 + } ], + "name" : "OPENINGSENSOR_GATE", + "caption" : "Gate opening sensor", + "id" : 60 + }, { + "maxAlternativeIconIndex" : 1, + "possibleActions" : [ { + "name" : { }, + "caption" : "caption", + "id" : 4 + }, { + "name" : { }, + "caption" : "caption", + "id" : 4 + } ], + "name" : "OPENINGSENSOR_GATE", + "caption" : "Gate opening sensor", + "id" : 60 + } ], + "locationId" : 9, + "function" : { + "maxAlternativeIconIndex" : 1, + "possibleActions" : [ { + "name" : { }, + "caption" : "caption", + "id" : 4 + }, { + "name" : { }, + "caption" : "caption", + "id" : 4 + } ], + "name" : "OPENINGSENSOR_GATE", + "caption" : "Gate opening sensor", + "id" : 60 + }, + "typeId" : 1000, + "location" : null, + "id" : 1, + "inheritedLocation" : true, + "iodeviceId" : 9 + } ], + "accessIdsIds" : [ 9, 9 ], + "channelGroups" : [ ], + "caption" : "caption", + "channelGroupsIds" : [ 2, 2 ], + "accessIds" : [ null, null ], + "id" : 5, + "iodevices" : [ { + "originalLocation" : null, + "lastIpv4" : 4, + "gUIDString" : "gUIDString", + "originalLocationId" : 1, + "regDate" : "2000-01-23T04:56:07.000+00:00", + "channelsIds" : [ 1, 1 ], + "enabled" : true, + "connected" : true, + "channels" : [ { + "hidden" : true, + "channelNumber" : 6, + "iodevice" : null, + "caption" : "caption", + "type" : { + "output" : false, + "name" : "SENSORNO", + "caption" : "Sensor (normal open)", + "id" : 7 + }, + "param3" : null, + "param1" : { }, + "param2" : null, + "altIcon" : 5, + "connected" : true, + "functionId" : 60, + "supportedFunctions" : [ { + "maxAlternativeIconIndex" : 1, + "possibleActions" : [ { + "name" : { }, + "caption" : "caption", + "id" : 4 + }, { + "name" : { }, + "caption" : "caption", + "id" : 4 + } ], + "name" : "OPENINGSENSOR_GATE", + "caption" : "Gate opening sensor", + "id" : 60 + }, { + "maxAlternativeIconIndex" : 1, + "possibleActions" : [ { + "name" : { }, + "caption" : "caption", + "id" : 4 + }, { + "name" : { }, + "caption" : "caption", + "id" : 4 + } ], + "name" : "OPENINGSENSOR_GATE", + "caption" : "Gate opening sensor", + "id" : 60 + } ], + "locationId" : 9, + "function" : { + "maxAlternativeIconIndex" : 1, + "possibleActions" : [ { + "name" : { }, + "caption" : "caption", + "id" : 4 + }, { + "name" : { }, + "caption" : "caption", + "id" : 4 + } ], + "name" : "OPENINGSENSOR_GATE", + "caption" : "Gate opening sensor", + "id" : 60 + }, + "typeId" : 1000, + "location" : null, + "id" : 1, + "inheritedLocation" : true, + "iodeviceId" : 9 + }, { + "hidden" : true, + "channelNumber" : 6, + "iodevice" : null, + "caption" : "caption", + "type" : { + "output" : false, + "name" : "SENSORNO", + "caption" : "Sensor (normal open)", + "id" : 7 + }, + "param3" : null, + "param1" : { }, + "param2" : null, + "altIcon" : 5, + "connected" : true, + "functionId" : 60, + "supportedFunctions" : [ { + "maxAlternativeIconIndex" : 1, + "possibleActions" : [ { + "name" : { }, + "caption" : "caption", + "id" : 4 + }, { + "name" : { }, + "caption" : "caption", + "id" : 4 + } ], + "name" : "OPENINGSENSOR_GATE", + "caption" : "Gate opening sensor", + "id" : 60 + }, { + "maxAlternativeIconIndex" : 1, + "possibleActions" : [ { + "name" : { }, + "caption" : "caption", + "id" : 4 + }, { + "name" : { }, + "caption" : "caption", + "id" : 4 + } ], + "name" : "OPENINGSENSOR_GATE", + "caption" : "Gate opening sensor", + "id" : 60 + } ], + "locationId" : 9, + "function" : { + "maxAlternativeIconIndex" : 1, + "possibleActions" : [ { + "name" : { }, + "caption" : "caption", + "id" : 4 + }, { + "name" : { }, + "caption" : "caption", + "id" : 4 + } ], + "name" : "OPENINGSENSOR_GATE", + "caption" : "Gate opening sensor", + "id" : 60 + }, + "typeId" : 1000, + "location" : null, + "id" : 1, + "inheritedLocation" : true, + "iodeviceId" : 9 + } ], + "lastConnected" : "2000-01-23T04:56:07.000+00:00", + "locationId" : 7, + "regIpv4" : 2, + "schedules" : [ { + "channel" : { + "hidden" : true, + "channelNumber" : 6, + "iodevice" : null, + "caption" : "caption", + "type" : { + "output" : false, + "name" : "SENSORNO", + "caption" : "Sensor (normal open)", + "id" : 7 + }, + "param3" : null, + "param1" : { }, + "param2" : null, + "altIcon" : 5, + "connected" : true, + "functionId" : 60, + "supportedFunctions" : [ { + "maxAlternativeIconIndex" : 1, + "possibleActions" : [ { + "name" : { }, + "caption" : "caption", + "id" : 4 + }, { + "name" : { }, + "caption" : "caption", + "id" : 4 + } ], + "name" : "OPENINGSENSOR_GATE", + "caption" : "Gate opening sensor", + "id" : 60 + }, { + "maxAlternativeIconIndex" : 1, + "possibleActions" : [ { + "name" : { }, + "caption" : "caption", + "id" : 4 + }, { + "name" : { }, + "caption" : "caption", + "id" : 4 + } ], + "name" : "OPENINGSENSOR_GATE", + "caption" : "Gate opening sensor", + "id" : 60 + } ], + "locationId" : 9, + "function" : { + "maxAlternativeIconIndex" : 1, + "possibleActions" : [ { + "name" : { }, + "caption" : "caption", + "id" : 4 + }, { + "name" : { }, + "caption" : "caption", + "id" : 4 + } ], + "name" : "OPENINGSENSOR_GATE", + "caption" : "Gate opening sensor", + "id" : 60 + }, + "typeId" : 1000, + "location" : null, + "id" : 1, + "inheritedLocation" : true, + "iodeviceId" : 9 + }, + "caption" : "caption", + "dateEnd" : "2000-01-23T04:56:07.000+00:00", + "timeExpression" : "*/5 * * * *", + "closestExecutions" : [ { + "past" : [ { + "result" : { + "caption" : "Successful" + }, + "plannedTimestamp" : "2000-01-23T04:56:07.000+00:00", + "resultTimestamp" : "2000-01-23T04:56:07.000+00:00", + "failed" : false + }, { + "result" : { + "caption" : "Successful" + }, + "plannedTimestamp" : "2000-01-23T04:56:07.000+00:00", + "resultTimestamp" : "2000-01-23T04:56:07.000+00:00", + "failed" : false + } ], + "future" : [ { + "plannedTimestamp" : "2000-01-23T04:56:07.000+00:00" + }, { + "plannedTimestamp" : "2000-01-23T04:56:07.000+00:00" + } ] + }, { + "past" : [ { + "result" : { + "caption" : "Successful" + }, + "plannedTimestamp" : "2000-01-23T04:56:07.000+00:00", + "resultTimestamp" : "2000-01-23T04:56:07.000+00:00", + "failed" : false + }, { + "result" : { + "caption" : "Successful" + }, + "plannedTimestamp" : "2000-01-23T04:56:07.000+00:00", + "resultTimestamp" : "2000-01-23T04:56:07.000+00:00", + "failed" : false + } ], + "future" : [ { + "plannedTimestamp" : "2000-01-23T04:56:07.000+00:00" + }, { + "plannedTimestamp" : "2000-01-23T04:56:07.000+00:00" + } ] + } ], + "enabled" : true, + "mode" : "minutely", + "dateStart" : "2000-01-23T04:56:07.000+00:00", + "action" : { + "name" : { }, + "caption" : "caption", + "id" : 4 + }, + "actionId" : 9, + "id" : 6, + "retry" : true, + "channelId" : 8 + }, { + "channel" : { + "hidden" : true, + "channelNumber" : 6, + "iodevice" : null, + "caption" : "caption", + "type" : { + "output" : false, + "name" : "SENSORNO", + "caption" : "Sensor (normal open)", + "id" : 7 + }, + "param3" : null, + "param1" : { }, + "param2" : null, + "altIcon" : 5, + "connected" : true, + "functionId" : 60, + "supportedFunctions" : [ { + "maxAlternativeIconIndex" : 1, + "possibleActions" : [ { + "name" : { }, + "caption" : "caption", + "id" : 4 + }, { + "name" : { }, + "caption" : "caption", + "id" : 4 + } ], + "name" : "OPENINGSENSOR_GATE", + "caption" : "Gate opening sensor", + "id" : 60 + }, { + "maxAlternativeIconIndex" : 1, + "possibleActions" : [ { + "name" : { }, + "caption" : "caption", + "id" : 4 + }, { + "name" : { }, + "caption" : "caption", + "id" : 4 + } ], + "name" : "OPENINGSENSOR_GATE", + "caption" : "Gate opening sensor", + "id" : 60 + } ], + "locationId" : 9, + "function" : { + "maxAlternativeIconIndex" : 1, + "possibleActions" : [ { + "name" : { }, + "caption" : "caption", + "id" : 4 + }, { + "name" : { }, + "caption" : "caption", + "id" : 4 + } ], + "name" : "OPENINGSENSOR_GATE", + "caption" : "Gate opening sensor", + "id" : 60 + }, + "typeId" : 1000, + "location" : null, + "id" : 1, + "inheritedLocation" : true, + "iodeviceId" : 9 + }, + "caption" : "caption", + "dateEnd" : "2000-01-23T04:56:07.000+00:00", + "timeExpression" : "*/5 * * * *", + "closestExecutions" : [ { + "past" : [ { + "result" : { + "caption" : "Successful" + }, + "plannedTimestamp" : "2000-01-23T04:56:07.000+00:00", + "resultTimestamp" : "2000-01-23T04:56:07.000+00:00", + "failed" : false + }, { + "result" : { + "caption" : "Successful" + }, + "plannedTimestamp" : "2000-01-23T04:56:07.000+00:00", + "resultTimestamp" : "2000-01-23T04:56:07.000+00:00", + "failed" : false + } ], + "future" : [ { + "plannedTimestamp" : "2000-01-23T04:56:07.000+00:00" + }, { + "plannedTimestamp" : "2000-01-23T04:56:07.000+00:00" + } ] + }, { + "past" : [ { + "result" : { + "caption" : "Successful" + }, + "plannedTimestamp" : "2000-01-23T04:56:07.000+00:00", + "resultTimestamp" : "2000-01-23T04:56:07.000+00:00", + "failed" : false + }, { + "result" : { + "caption" : "Successful" + }, + "plannedTimestamp" : "2000-01-23T04:56:07.000+00:00", + "resultTimestamp" : "2000-01-23T04:56:07.000+00:00", + "failed" : false + } ], + "future" : [ { + "plannedTimestamp" : "2000-01-23T04:56:07.000+00:00" + }, { + "plannedTimestamp" : "2000-01-23T04:56:07.000+00:00" + } ] + } ], + "enabled" : true, + "mode" : "minutely", + "dateStart" : "2000-01-23T04:56:07.000+00:00", + "action" : { + "name" : { }, + "caption" : "caption", + "id" : 4 + }, + "actionId" : 9, + "id" : 6, + "retry" : true, + "channelId" : 8 + } ], + "name" : "name", + "comment" : "comment", + "location" : null, + "id" : 3, + "softwareVersion" : "softwareVersion" + }, { + "originalLocation" : null, + "lastIpv4" : 4, + "gUIDString" : "gUIDString", + "originalLocationId" : 1, + "regDate" : "2000-01-23T04:56:07.000+00:00", + "channelsIds" : [ 1, 1 ], + "enabled" : true, + "connected" : true, + "channels" : [ { + "hidden" : true, + "channelNumber" : 6, + "iodevice" : null, + "caption" : "caption", + "type" : { + "output" : false, + "name" : "SENSORNO", + "caption" : "Sensor (normal open)", + "id" : 7 + }, + "param3" : null, + "param1" : { }, + "param2" : null, + "altIcon" : 5, + "connected" : true, + "functionId" : 60, + "supportedFunctions" : [ { + "maxAlternativeIconIndex" : 1, + "possibleActions" : [ { + "name" : { }, + "caption" : "caption", + "id" : 4 + }, { + "name" : { }, + "caption" : "caption", + "id" : 4 + } ], + "name" : "OPENINGSENSOR_GATE", + "caption" : "Gate opening sensor", + "id" : 60 + }, { + "maxAlternativeIconIndex" : 1, + "possibleActions" : [ { + "name" : { }, + "caption" : "caption", + "id" : 4 + }, { + "name" : { }, + "caption" : "caption", + "id" : 4 + } ], + "name" : "OPENINGSENSOR_GATE", + "caption" : "Gate opening sensor", + "id" : 60 + } ], + "locationId" : 9, + "function" : { + "maxAlternativeIconIndex" : 1, + "possibleActions" : [ { + "name" : { }, + "caption" : "caption", + "id" : 4 + }, { + "name" : { }, + "caption" : "caption", + "id" : 4 + } ], + "name" : "OPENINGSENSOR_GATE", + "caption" : "Gate opening sensor", + "id" : 60 + }, + "typeId" : 1000, + "location" : null, + "id" : 1, + "inheritedLocation" : true, + "iodeviceId" : 9 + }, { + "hidden" : true, + "channelNumber" : 6, + "iodevice" : null, + "caption" : "caption", + "type" : { + "output" : false, + "name" : "SENSORNO", + "caption" : "Sensor (normal open)", + "id" : 7 + }, + "param3" : null, + "param1" : { }, + "param2" : null, + "altIcon" : 5, + "connected" : true, + "functionId" : 60, + "supportedFunctions" : [ { + "maxAlternativeIconIndex" : 1, + "possibleActions" : [ { + "name" : { }, + "caption" : "caption", + "id" : 4 + }, { + "name" : { }, + "caption" : "caption", + "id" : 4 + } ], + "name" : "OPENINGSENSOR_GATE", + "caption" : "Gate opening sensor", + "id" : 60 + }, { + "maxAlternativeIconIndex" : 1, + "possibleActions" : [ { + "name" : { }, + "caption" : "caption", + "id" : 4 + }, { + "name" : { }, + "caption" : "caption", + "id" : 4 + } ], + "name" : "OPENINGSENSOR_GATE", + "caption" : "Gate opening sensor", + "id" : 60 + } ], + "locationId" : 9, + "function" : { + "maxAlternativeIconIndex" : 1, + "possibleActions" : [ { + "name" : { }, + "caption" : "caption", + "id" : 4 + }, { + "name" : { }, + "caption" : "caption", + "id" : 4 + } ], + "name" : "OPENINGSENSOR_GATE", + "caption" : "Gate opening sensor", + "id" : 60 + }, + "typeId" : 1000, + "location" : null, + "id" : 1, + "inheritedLocation" : true, + "iodeviceId" : 9 + } ], + "lastConnected" : "2000-01-23T04:56:07.000+00:00", + "locationId" : 7, + "regIpv4" : 2, + "schedules" : [ { + "channel" : { + "hidden" : true, + "channelNumber" : 6, + "iodevice" : null, + "caption" : "caption", + "type" : { + "output" : false, + "name" : "SENSORNO", + "caption" : "Sensor (normal open)", + "id" : 7 + }, + "param3" : null, + "param1" : { }, + "param2" : null, + "altIcon" : 5, + "connected" : true, + "functionId" : 60, + "supportedFunctions" : [ { + "maxAlternativeIconIndex" : 1, + "possibleActions" : [ { + "name" : { }, + "caption" : "caption", + "id" : 4 + }, { + "name" : { }, + "caption" : "caption", + "id" : 4 + } ], + "name" : "OPENINGSENSOR_GATE", + "caption" : "Gate opening sensor", + "id" : 60 + }, { + "maxAlternativeIconIndex" : 1, + "possibleActions" : [ { + "name" : { }, + "caption" : "caption", + "id" : 4 + }, { + "name" : { }, + "caption" : "caption", + "id" : 4 + } ], + "name" : "OPENINGSENSOR_GATE", + "caption" : "Gate opening sensor", + "id" : 60 + } ], + "locationId" : 9, + "function" : { + "maxAlternativeIconIndex" : 1, + "possibleActions" : [ { + "name" : { }, + "caption" : "caption", + "id" : 4 + }, { + "name" : { }, + "caption" : "caption", + "id" : 4 + } ], + "name" : "OPENINGSENSOR_GATE", + "caption" : "Gate opening sensor", + "id" : 60 + }, + "typeId" : 1000, + "location" : null, + "id" : 1, + "inheritedLocation" : true, + "iodeviceId" : 9 + }, + "caption" : "caption", + "dateEnd" : "2000-01-23T04:56:07.000+00:00", + "timeExpression" : "*/5 * * * *", + "closestExecutions" : [ { + "past" : [ { + "result" : { + "caption" : "Successful" + }, + "plannedTimestamp" : "2000-01-23T04:56:07.000+00:00", + "resultTimestamp" : "2000-01-23T04:56:07.000+00:00", + "failed" : false + }, { + "result" : { + "caption" : "Successful" + }, + "plannedTimestamp" : "2000-01-23T04:56:07.000+00:00", + "resultTimestamp" : "2000-01-23T04:56:07.000+00:00", + "failed" : false + } ], + "future" : [ { + "plannedTimestamp" : "2000-01-23T04:56:07.000+00:00" + }, { + "plannedTimestamp" : "2000-01-23T04:56:07.000+00:00" + } ] + }, { + "past" : [ { + "result" : { + "caption" : "Successful" + }, + "plannedTimestamp" : "2000-01-23T04:56:07.000+00:00", + "resultTimestamp" : "2000-01-23T04:56:07.000+00:00", + "failed" : false + }, { + "result" : { + "caption" : "Successful" + }, + "plannedTimestamp" : "2000-01-23T04:56:07.000+00:00", + "resultTimestamp" : "2000-01-23T04:56:07.000+00:00", + "failed" : false + } ], + "future" : [ { + "plannedTimestamp" : "2000-01-23T04:56:07.000+00:00" + }, { + "plannedTimestamp" : "2000-01-23T04:56:07.000+00:00" + } ] + } ], + "enabled" : true, + "mode" : "minutely", + "dateStart" : "2000-01-23T04:56:07.000+00:00", + "action" : { + "name" : { }, + "caption" : "caption", + "id" : 4 + }, + "actionId" : 9, + "id" : 6, + "retry" : true, + "channelId" : 8 + }, { + "channel" : { + "hidden" : true, + "channelNumber" : 6, + "iodevice" : null, + "caption" : "caption", + "type" : { + "output" : false, + "name" : "SENSORNO", + "caption" : "Sensor (normal open)", + "id" : 7 + }, + "param3" : null, + "param1" : { }, + "param2" : null, + "altIcon" : 5, + "connected" : true, + "functionId" : 60, + "supportedFunctions" : [ { + "maxAlternativeIconIndex" : 1, + "possibleActions" : [ { + "name" : { }, + "caption" : "caption", + "id" : 4 + }, { + "name" : { }, + "caption" : "caption", + "id" : 4 + } ], + "name" : "OPENINGSENSOR_GATE", + "caption" : "Gate opening sensor", + "id" : 60 + }, { + "maxAlternativeIconIndex" : 1, + "possibleActions" : [ { + "name" : { }, + "caption" : "caption", + "id" : 4 + }, { + "name" : { }, + "caption" : "caption", + "id" : 4 + } ], + "name" : "OPENINGSENSOR_GATE", + "caption" : "Gate opening sensor", + "id" : 60 + } ], + "locationId" : 9, + "function" : { + "maxAlternativeIconIndex" : 1, + "possibleActions" : [ { + "name" : { }, + "caption" : "caption", + "id" : 4 + }, { + "name" : { }, + "caption" : "caption", + "id" : 4 + } ], + "name" : "OPENINGSENSOR_GATE", + "caption" : "Gate opening sensor", + "id" : 60 + }, + "typeId" : 1000, + "location" : null, + "id" : 1, + "inheritedLocation" : true, + "iodeviceId" : 9 + }, + "caption" : "caption", + "dateEnd" : "2000-01-23T04:56:07.000+00:00", + "timeExpression" : "*/5 * * * *", + "closestExecutions" : [ { + "past" : [ { + "result" : { + "caption" : "Successful" + }, + "plannedTimestamp" : "2000-01-23T04:56:07.000+00:00", + "resultTimestamp" : "2000-01-23T04:56:07.000+00:00", + "failed" : false + }, { + "result" : { + "caption" : "Successful" + }, + "plannedTimestamp" : "2000-01-23T04:56:07.000+00:00", + "resultTimestamp" : "2000-01-23T04:56:07.000+00:00", + "failed" : false + } ], + "future" : [ { + "plannedTimestamp" : "2000-01-23T04:56:07.000+00:00" + }, { + "plannedTimestamp" : "2000-01-23T04:56:07.000+00:00" + } ] + }, { + "past" : [ { + "result" : { + "caption" : "Successful" + }, + "plannedTimestamp" : "2000-01-23T04:56:07.000+00:00", + "resultTimestamp" : "2000-01-23T04:56:07.000+00:00", + "failed" : false + }, { + "result" : { + "caption" : "Successful" + }, + "plannedTimestamp" : "2000-01-23T04:56:07.000+00:00", + "resultTimestamp" : "2000-01-23T04:56:07.000+00:00", + "failed" : false + } ], + "future" : [ { + "plannedTimestamp" : "2000-01-23T04:56:07.000+00:00" + }, { + "plannedTimestamp" : "2000-01-23T04:56:07.000+00:00" + } ] + } ], + "enabled" : true, + "mode" : "minutely", + "dateStart" : "2000-01-23T04:56:07.000+00:00", + "action" : { + "name" : { }, + "caption" : "caption", + "id" : 4 + }, + "actionId" : 9, + "id" : 6, + "retry" : true, + "channelId" : 8 + } ], + "name" : "name", + "comment" : "comment", + "location" : null, + "id" : 3, + "softwareVersion" : "softwareVersion" + } ], + "channelsIds" : [ 7, 7 ], + "enabled" : true + } + }, + "Schedule" : { + "properties" : { + "id" : { + "type" : "integer", + "description" : "Schedule identifier" + }, + "timeExpression" : { + "type" : "string", + "example" : "*/5 * * * *", + "description" : "Schedule time expression in crontab notation (with some custom additions)." + }, + "action" : { + "$ref" : "#/definitions/ChannelFunctionAction" + }, + "mode" : { + "type" : "string", + "enum" : [ "minutely", "hourly", "daily", "once" ] + }, + "dateStart" : { + "type" : "string", + "format" : "date-time" + }, + "dateEnd" : { + "type" : "string", + "format" : "date-time" + }, + "enabled" : { + "type" : "boolean" + }, + "caption" : { + "type" : "string" + }, + "retry" : { + "type" : "boolean" + }, + "channelId" : { + "type" : "integer" + }, + "actionId" : { + "type" : "integer" + }, + "channel" : { + "$ref" : "#/definitions/Channel" + }, + "closestExecutions" : { + "type" : "array", + "description" : "Returned only if requested by the `include` parameter. Contains two arrays of maximum 3 closest past and future executions.", + "items" : { + "$ref" : "#/definitions/Schedule_closestExecutions" + } + } + }, + "example" : { + "channel" : { + "hidden" : true, + "channelNumber" : 6, + "iodevice" : null, + "caption" : "caption", + "type" : { + "output" : false, + "name" : "SENSORNO", + "caption" : "Sensor (normal open)", + "id" : 7 + }, + "param3" : null, + "param1" : { }, + "param2" : null, + "altIcon" : 5, + "connected" : true, + "functionId" : 60, + "supportedFunctions" : [ { + "maxAlternativeIconIndex" : 1, + "possibleActions" : [ { + "name" : { }, + "caption" : "caption", + "id" : 4 + }, { + "name" : { }, + "caption" : "caption", + "id" : 4 + } ], + "name" : "OPENINGSENSOR_GATE", + "caption" : "Gate opening sensor", + "id" : 60 + }, { + "maxAlternativeIconIndex" : 1, + "possibleActions" : [ { + "name" : { }, + "caption" : "caption", + "id" : 4 + }, { + "name" : { }, + "caption" : "caption", + "id" : 4 + } ], + "name" : "OPENINGSENSOR_GATE", + "caption" : "Gate opening sensor", + "id" : 60 + } ], + "locationId" : 9, + "function" : { + "maxAlternativeIconIndex" : 1, + "possibleActions" : [ { + "name" : { }, + "caption" : "caption", + "id" : 4 + }, { + "name" : { }, + "caption" : "caption", + "id" : 4 + } ], + "name" : "OPENINGSENSOR_GATE", + "caption" : "Gate opening sensor", + "id" : 60 + }, + "typeId" : 1000, + "location" : null, + "id" : 1, + "inheritedLocation" : true, + "iodeviceId" : 9 + }, + "caption" : "caption", + "dateEnd" : "2000-01-23T04:56:07.000+00:00", + "timeExpression" : "*/5 * * * *", + "closestExecutions" : [ { + "past" : [ { + "result" : { + "caption" : "Successful" + }, + "plannedTimestamp" : "2000-01-23T04:56:07.000+00:00", + "resultTimestamp" : "2000-01-23T04:56:07.000+00:00", + "failed" : false + }, { + "result" : { + "caption" : "Successful" + }, + "plannedTimestamp" : "2000-01-23T04:56:07.000+00:00", + "resultTimestamp" : "2000-01-23T04:56:07.000+00:00", + "failed" : false + } ], + "future" : [ { + "plannedTimestamp" : "2000-01-23T04:56:07.000+00:00" + }, { + "plannedTimestamp" : "2000-01-23T04:56:07.000+00:00" + } ] + }, { + "past" : [ { + "result" : { + "caption" : "Successful" + }, + "plannedTimestamp" : "2000-01-23T04:56:07.000+00:00", + "resultTimestamp" : "2000-01-23T04:56:07.000+00:00", + "failed" : false + }, { + "result" : { + "caption" : "Successful" + }, + "plannedTimestamp" : "2000-01-23T04:56:07.000+00:00", + "resultTimestamp" : "2000-01-23T04:56:07.000+00:00", + "failed" : false + } ], + "future" : [ { + "plannedTimestamp" : "2000-01-23T04:56:07.000+00:00" + }, { + "plannedTimestamp" : "2000-01-23T04:56:07.000+00:00" + } ] + } ], + "enabled" : true, + "mode" : "minutely", + "dateStart" : "2000-01-23T04:56:07.000+00:00", + "action" : { + "name" : { }, + "caption" : "caption", + "id" : 4 + }, + "actionId" : 9, + "id" : 6, + "retry" : true, + "channelId" : 8 + } + }, + "ScheduleRequest" : { + "required" : [ "actionId", "channelId", "mode", "timeExpression" ], + "properties" : { + "channelId" : { + "type" : "integer" + }, + "actionId" : { + "type" : "integer" + }, + "mode" : { + "type" : "string", + "enum" : [ "once", "minutely", "daily", "hourly" ] + }, + "timeExpression" : { + "type" : "string", + "description" : "Schedule time expression in crontab notation (with some custom additions)." + }, + "dateStart" : { + "type" : "string", + "format" : "date-time" + }, + "dateEnd" : { + "type" : "string", + "format" : "date-time" + }, + "caption" : { + "type" : "string" + }, + "retry" : { + "type" : "boolean" + } + }, + "example" : { + "mode" : "once", + "dateStart" : "2000-01-23T04:56:07.000+00:00", + "actionId" : 6, + "caption" : "caption", + "dateEnd" : "2000-01-23T04:56:07.000+00:00", + "timeExpression" : "timeExpression", + "channelId" : 0, + "retry" : true + } + }, + "Access Identifier update request" : { + "properties" : { + "enabled" : { + "type" : "boolean" + }, + "caption" : { + "type" : "string" + }, + "password" : { + "type" : "string", + "description" : "Provide new password if you want to change it." + }, + "locationsIds" : { + "type" : "array", + "description" : "Locations identifiers to assign to this Access Identifier.", + "items" : { + "type" : "integer" + } + }, + "clientAppsIds" : { + "type" : "array", + "description" : "Client Apps identifiers to assign to this Access Identifier. If client app is connected to any other Client ID, it will be disconnected from the old one before assigning.", + "items" : { + "type" : "integer" + } + } + }, + "title" : "Access Identifier update request", + "example" : { + "password" : "password", + "caption" : "caption", + "clientAppsIds" : [ 6, 6 ], + "enabled" : true, + "locationsIds" : [ 0, 0 ] + } + }, + "Channel update request" : { + "properties" : { + "functionId" : { + "type" : "integer" + }, + "param1" : { + "type" : "integer" + }, + "param2" : { + "type" : "integer" + }, + "param3" : { + "type" : "integer" + }, + "caption" : { + "type" : "string" + }, + "altIcon" : { + "type" : "integer" + }, + "hidden" : { + "type" : "boolean" + }, + "locationId" : { + "type" : "integer" + }, + "inheritedLocation" : { + "type" : "boolean" + } + }, + "title" : "Channel update request", + "example" : { + "functionId" : 0, + "hidden" : true, + "locationId" : 2, + "caption" : "caption", + "param3" : 5, + "inheritedLocation" : true, + "param1" : 6, + "param2" : 1, + "altIcon" : 5 + } + }, + "Channel update confirmation response" : { + "properties" : { + "schedules" : { + "type" : "array", + "description" : "Schedules that will be deleted after this request.", + "items" : { + "$ref" : "#/definitions/Schedule" + } + }, + "groups" : { + "type" : "array", + "description" : "Channel groups that this channel will be removed from after this request.", + "items" : { + "$ref" : "#/definitions/ChannelGroup" + } + } + } + }, + "Channel action execution failed response" : { + "properties" : { + "status" : { + "type" : "integer", + "example" : 400 + }, + "message" : { + "type" : "string", + "example" : "Cannot execute requested action on this channel." + } + } + }, + "Channel unsupported function response" : { + "properties" : { + "status" : { + "type" : "integer", + "example" : 400 + }, + "message" : { + "type" : "string", + "example" : "The requested function is not available on this channel" + } + } + }, + "Channel measurement log" : { + "properties" : { + "date_timestamp" : { + "type" : "integer" + }, + "temperature" : { + "type" : "number", + "format" : "float", + "example" : 21.56, + "description" : "Temperature in Celsius" + }, + "humidity" : { + "type" : "number", + "format" : "float", + "example" : 48.8, + "description" : "Humidity percent. Available only if channel function is `HUMIDITYANDTEMPERATURE`." + } + }, + "example" : { + "temperature" : 21.56, + "humidity" : 48.8, + "date_timestamp" : 0 + } + }, + "Client App update request" : { + "properties" : { + "caption" : { + "type" : "string" + }, + "enabled" : { + "type" : "boolean" + }, + "accessIdId" : { + "type" : "integer" + } + }, + "title" : "Client App update request", + "example" : { + "accessIdId" : 0, + "caption" : "caption", + "enabled" : true + } + }, + "IO Device update request" : { + "properties" : { + "comment" : { + "type" : "string" + }, + "enabled" : { + "type" : "boolean" + }, + "locationId" : { + "type" : "integer" + } + }, + "title" : "IO Device update request", + "example" : { + "locationId" : 0, + "comment" : "comment", + "enabled" : true + } + }, + "Location update request" : { + "properties" : { + "enabled" : { + "type" : "boolean" + }, + "caption" : { + "type" : "string" + }, + "password" : { + "type" : "string", + "description" : "Provide new password if you want to change it." + }, + "accessIdsIds" : { + "type" : "array", + "description" : "Access Identifiers identifiers to assign to this location.", + "items" : { + "type" : "integer" + } + } + }, + "title" : "Location update request", + "example" : { + "password" : "password", + "accessIdsIds" : [ 0, 0 ], + "caption" : "caption", + "enabled" : true + } + }, + "Server Info_timezone" : { + "properties" : { + "name" : { + "type" : "string", + "example" : "UTC" + }, + "offset" : { + "type" : "integer", + "description" : "Timezone offset in minutes" + } + }, + "example" : { + "offset" : 0, + "name" : "UTC" + } + }, + "Server Info" : { + "properties" : { + "address" : { + "type" : "string", + "example" : "svr1.supla.org", + "description" : "SUPLA Server address (to be used in smartphones)" + }, + "time" : { + "type" : "string", + "format" : "date-time", + "description" : "Current server time" + }, + "timezone" : { + "$ref" : "#/definitions/Server Info_timezone" + }, + "authenticated" : { + "type" : "boolean" + }, + "username" : { + "type" : "string", + "example" : "supler@supla.org", + "description" : "Present only if `authenticated=true`" + }, + "cloudVersion" : { + "type" : "string", + "example" : "2.2.0" + }, + "apiVersion" : { + "type" : "string", + "example" : "2.2.0" + }, + "supportedApiVersions" : { + "type" : "array", + "example" : [ "2.0.0", "2.1.0", "2.2.0" ], + "items" : { + "type" : "string" + } + } + }, + "example" : { + "authenticated" : true, + "address" : "svr1.supla.org", + "cloudVersion" : "2.2.0", + "apiVersion" : "2.2.0", + "timezone" : { + "offset" : 0, + "name" : "UTC" + }, + "supportedApiVersions" : [ "2.0.0", "2.1.0", "2.2.0" ], + "time" : "2000-01-23T04:56:07.000+00:00", + "username" : "supler@supla.org" + } + }, + "Schedules enable request" : { + "properties" : { + "enable" : { + "type" : "array", + "description" : "Array of schedule identifiers to enable", + "items" : { + "type" : "integer" + } + } + }, + "title" : "Schedules enable request", + "example" : { + "enable" : [ 0, 0 ] + } + }, + "User data" : { + "properties" : { + "id" : { + "type" : "integer" + }, + "email" : { + "type" : "string", + "format" : "email" + }, + "timezone" : { + "type" : "string", + "example" : "Europe/Warsaw" + }, + "clientsRegistrationEnabled" : { + "type" : "string", + "format" : "date-time" + }, + "ioDevicesRegistrationEnabled" : { + "type" : "string", + "format" : "date-time" + } + }, + "example" : { + "clientsRegistrationEnabled" : "2000-01-23T04:56:07.000+00:00", + "timezone" : "Europe/Warsaw", + "id" : 0, + "ioDevicesRegistrationEnabled" : "2000-01-23T04:56:07.000+00:00", + "email" : "email" + } + }, + "User update request" : { + "properties" : { + "action" : { + "type" : "string", + "description" : "The `change:userTimezone` requires to provide also a `timezone` value in the request. The `change:password` requires to provide also a `newPassword` and `oldPassword` in the request.", + "enum" : [ "change:clientsRegistrationEnabled", "change:ioDevicesRegistrationEnabled", "change:userTimezone", "change:password", "agree:rules", "agree:cookies" ] + } + }, + "title" : "User update request", + "example" : { + "action" : "change:clientsRegistrationEnabled" + } + }, + "Schedule_result" : { + "properties" : { + "caption" : { + "type" : "string", + "example" : "Successful" + } + }, + "example" : { + "caption" : "Successful" + } + }, + "Schedule_past" : { + "properties" : { + "plannedTimestamp" : { + "type" : "string", + "format" : "date-time" + }, + "resultTimestamp" : { + "type" : "string", + "format" : "date-time" + }, + "failed" : { + "type" : "boolean", + "example" : false + }, + "result" : { + "$ref" : "#/definitions/Schedule_result" + } + }, + "example" : { + "result" : { + "caption" : "Successful" + }, + "plannedTimestamp" : "2000-01-23T04:56:07.000+00:00", + "resultTimestamp" : "2000-01-23T04:56:07.000+00:00", + "failed" : false + } + }, + "Schedule_future" : { + "properties" : { + "plannedTimestamp" : { + "type" : "string", + "format" : "date-time" + } + }, + "example" : { + "plannedTimestamp" : "2000-01-23T04:56:07.000+00:00" + } + }, + "Schedule_closestExecutions" : { + "properties" : { + "past" : { + "type" : "array", + "items" : { + "$ref" : "#/definitions/Schedule_past" + } + }, + "future" : { + "type" : "array", + "items" : { + "$ref" : "#/definitions/Schedule_future" + } + } + }, + "example" : { + "past" : [ { + "result" : { + "caption" : "Successful" + }, + "plannedTimestamp" : "2000-01-23T04:56:07.000+00:00", + "resultTimestamp" : "2000-01-23T04:56:07.000+00:00", + "failed" : false + }, { + "result" : { + "caption" : "Successful" + }, + "plannedTimestamp" : "2000-01-23T04:56:07.000+00:00", + "resultTimestamp" : "2000-01-23T04:56:07.000+00:00", + "failed" : false + } ], + "future" : [ { + "plannedTimestamp" : "2000-01-23T04:56:07.000+00:00" + }, { + "plannedTimestamp" : "2000-01-23T04:56:07.000+00:00" + } ] + } + } + }, + "parameters" : { + "AccessIdIncludes" : { + "name" : "include", + "in" : "query", + "description" : "Specify what extra fields to include in the response.", + "required" : false, + "type" : "array", + "items" : { + "type" : "string", + "enum" : [ "locations", "clientApps", "password" ] + }, + "collectionFormat" : "csv" + } + } +} \ No newline at end of file