public function testApiClient()
 {
     // test selectHeaderAccept
     $api_client = new ApiClient();
     $this->assertSame('application/json', $api_client->selectHeaderAccept(array('application/xml', 'application/json')));
     $this->assertSame(null, $api_client->selectHeaderAccept(array()));
     $this->assertSame('application/yaml,application/xml', $api_client->selectHeaderAccept(array('application/yaml', 'application/xml')));
     // test selectHeaderContentType
     $this->assertSame('application/json', $api_client->selectHeaderContentType(array('application/xml', 'application/json')));
     $this->assertSame('application/json', $api_client->selectHeaderContentType(array()));
     $this->assertSame('application/yaml,application/xml', $api_client->selectHeaderContentType(array('application/yaml', 'application/xml')));
     // test addDefaultHeader and getDefaultHeader
     $api_client->getConfig()->addDefaultHeader('test1', 'value1');
     $api_client->getConfig()->addDefaultHeader('test2', 200);
     $defaultHeader = $api_client->getConfig()->getDefaultHeaders();
     $this->assertSame('value1', $defaultHeader['test1']);
     $this->assertSame(200, $defaultHeader['test2']);
     // test deleteDefaultHeader
     $api_client->getConfig()->deleteDefaultHeader('test2');
     $defaultHeader = $api_client->getConfig()->getDefaultHeaders();
     $this->assertFalse(isset($defaultHeader['test2']));
     $pet_api2 = new Api\PetApi();
     $config3 = new Configuration();
     $apiClient3 = new ApiClient($config3);
     $apiClient3->getConfig()->setUserAgent('api client 3');
     $config4 = new Configuration();
     $apiClient4 = new ApiClient($config4);
     $apiClient4->getConfig()->setUserAgent('api client 4');
     $pet_api3 = new Api\PetApi($apiClient3);
     // 2 different api clients are not the same
     $this->assertNotEquals($apiClient3, $apiClient4);
     // customied pet api not using the old pet api's api client
     $this->assertNotEquals($pet_api2->getApiClient(), $pet_api3->getApiClient());
     // test access token
     $api_client->getConfig()->setAccessToken("testing_only");
     $this->assertSame('testing_only', $api_client->getConfig()->getAccessToken());
 }
Ejemplo n.º 2
0
 /**
  * syncschedule
  *
  * 
  *
  * @param string $device_id The relay id (required)
  * @param string $module_id The thermostat id (required)
  * @param \Swagger\Client\Model\NAThermProgram $therm_program The thermostat program (zones, timetable and name) (required)
  * @return \Swagger\Client\Model\NAOkResponse
  * @throws \Swagger\Client\ApiException on non-2xx response
  */
 public function syncschedule($device_id, $module_id, $therm_program)
 {
     // verify the required parameter 'device_id' is set
     if ($device_id === null) {
         throw new \InvalidArgumentException('Missing the required parameter $device_id when calling syncschedule');
     }
     // verify the required parameter 'module_id' is set
     if ($module_id === null) {
         throw new \InvalidArgumentException('Missing the required parameter $module_id when calling syncschedule');
     }
     // verify the required parameter 'therm_program' is set
     if ($therm_program === null) {
         throw new \InvalidArgumentException('Missing the required parameter $therm_program when calling syncschedule');
     }
     // parse inputs
     $resourcePath = "/syncschedule";
     $resourcePath = str_replace("{format}", "json", $resourcePath);
     $method = "POST";
     $httpBody = '';
     $queryParams = array();
     $headerParams = array();
     $formParams = array();
     $_header_accept = ApiClient::selectHeaderAccept(array());
     if (!is_null($_header_accept)) {
         $headerParams['Accept'] = $_header_accept;
     }
     $headerParams['Content-Type'] = ApiClient::selectHeaderContentType(array());
     // query params
     if ($device_id !== null) {
         $queryParams['device_id'] = $this->apiClient->getSerializer()->toQueryValue($device_id);
     }
     // query params
     if ($module_id !== null) {
         $queryParams['module_id'] = $this->apiClient->getSerializer()->toQueryValue($module_id);
     }
     // body params
     $_tempBody = null;
     if (isset($therm_program)) {
         $_tempBody = $therm_program;
     }
     // for model (json/xml)
     if (isset($_tempBody)) {
         $httpBody = $_tempBody;
         // $_tempBody is the method argument, if present
     } else {
         if (count($formParams) > 0) {
             $httpBody = $formParams;
             // for HTTP post (form)
         }
     }
     //TODO support oauth
     //TODO support oauth
     // make the API Call
     try {
         list($response, $httpHeader) = $this->apiClient->callApi($resourcePath, $method, $queryParams, $httpBody, $headerParams, '\\Swagger\\Client\\Model\\NAOkResponse');
     } catch (ApiException $e) {
         switch ($e->getCode()) {
             case 200:
                 $data = $this->apiClient->getSerializer()->deserialize($e->getResponseBody(), '\\Swagger\\Client\\Model\\NAOkResponse', $httpHeader);
                 $e->setResponseObject($data);
                 break;
         }
         throw $e;
     }
     if (!$response) {
         return null;
     }
     return $this->apiClient->getSerializer()->deserialize($response, '\\Swagger\\Client\\Model\\NAOkResponse');
 }
Ejemplo n.º 3
0
 /**
  * deliveryCreate
  *
  * Create a delivery
  *
  * @param string $order_id Order to create delivery for (required)
  * @param string $delivery_id Unique ID of the delivery (required)
  * @param string[] $products  (required)
  * @param \DateTime $delivered  (required)
  * @param bool $send_mail Whether to send email to customer or not for this shipment (optional)
  * @return \Swagger\Client\Model\Delivery
  * @throws \Swagger\Client\ApiException on non-2xx response
  */
 public function deliveryCreate($order_id, $delivery_id, $products, $delivered, $send_mail = null)
 {
     // verify the required parameter 'order_id' is set
     if ($order_id === null) {
         throw new \InvalidArgumentException('Missing the required parameter $order_id when calling deliveryCreate');
     }
     // verify the required parameter 'delivery_id' is set
     if ($delivery_id === null) {
         throw new \InvalidArgumentException('Missing the required parameter $delivery_id when calling deliveryCreate');
     }
     // verify the required parameter 'products' is set
     if ($products === null) {
         throw new \InvalidArgumentException('Missing the required parameter $products when calling deliveryCreate');
     }
     // verify the required parameter 'delivered' is set
     if ($delivered === null) {
         throw new \InvalidArgumentException('Missing the required parameter $delivered when calling deliveryCreate');
     }
     // parse inputs
     $resourcePath = "/api/orders/{order_id}/deliveries/";
     $resourcePath = str_replace("{format}", "json", $resourcePath);
     $method = "POST";
     $httpBody = '';
     $queryParams = array();
     $headerParams = array();
     $formParams = array();
     $_header_accept = ApiClient::selectHeaderAccept(array());
     if (!is_null($_header_accept)) {
         $headerParams['Accept'] = $_header_accept;
     }
     $headerParams['Content-Type'] = ApiClient::selectHeaderContentType(array());
     // path params
     if ($order_id !== null) {
         $resourcePath = str_replace("{" . "order_id" . "}", $this->apiClient->getSerializer()->toPathValue($order_id), $resourcePath);
     }
     // form params
     if ($delivery_id !== null) {
         $formParams['delivery_id'] = $this->apiClient->getSerializer()->toFormValue($delivery_id);
     }
     // form params
     if ($products !== null) {
         $formParams['products'] = $this->apiClient->getSerializer()->toFormValue($products);
     }
     // form params
     if ($delivered !== null) {
         $formParams['delivered'] = $this->apiClient->getSerializer()->toFormValue($delivered);
     }
     // form params
     if ($send_mail !== null) {
         $formParams['send_mail'] = $this->apiClient->getSerializer()->toFormValue($send_mail);
     }
     // for model (json/xml)
     if (isset($_tempBody)) {
         $httpBody = $_tempBody;
         // $_tempBody is the method argument, if present
     } else {
         if (count($formParams) > 0) {
             // for HTTP post (form)
             $httpBody = $formParams;
         }
     }
     $apiKey = $this->apiClient->getApiKeyWithPrefix('Authorization');
     if (isset($apiKey)) {
         $headerParams['Authorization'] = $apiKey;
     }
     // make the API Call
     try {
         $response = $this->apiClient->callAPI($resourcePath, $method, $queryParams, $httpBody, $headerParams);
     } catch (ApiException $e) {
         switch ($e->getCode()) {
             case 0:
                 $data = $this->apiClient->getSerializer()->deserialize($e->getResponseBody(), '\\Swagger\\Client\\Model\\Delivery');
                 $e->setResponseObject($data);
                 break;
         }
         throw $e;
     }
     if (!$response) {
         return null;
     }
     $responseObject = $this->apiClient->getSerializer()->deserialize($response, '\\Swagger\\Client\\Model\\Delivery');
     return $responseObject;
 }
Ejemplo n.º 4
0
 /**
  * signUpWithHttpInfo
  *
  * create a new user
  *
  * @param string $app_id ID of app (required)
  * @param \Swagger\Client\Model\UserBody $body request body (required)
  * @return Array of \Swagger\Client\Model\CloudUser, HTTP status code, HTTP response headers (array of strings)
  * @throws \Swagger\Client\ApiException on non-2xx response
  */
 public function signUpWithHttpInfo($app_id, $body)
 {
     // verify the required parameter 'app_id' is set
     if ($app_id === null) {
         throw new \InvalidArgumentException('Missing the required parameter $app_id when calling signUp');
     }
     // verify the required parameter 'body' is set
     if ($body === null) {
         throw new \InvalidArgumentException('Missing the required parameter $body when calling signUp');
     }
     // parse inputs
     $resourcePath = "user/{app_id}/signup";
     $httpBody = '';
     $queryParams = array();
     $headerParams = array();
     $formParams = array();
     $_header_accept = ApiClient::selectHeaderAccept(array('application/json'));
     if (!is_null($_header_accept)) {
         $headerParams['Accept'] = $_header_accept;
     }
     $headerParams['Content-Type'] = ApiClient::selectHeaderContentType(array('application/json'));
     // path params
     if ($app_id !== null) {
         $resourcePath = str_replace("{" . "app_id" . "}", $this->apiClient->getSerializer()->toPathValue($app_id), $resourcePath);
     }
     // default format to json
     $resourcePath = str_replace("{format}", "json", $resourcePath);
     // body params
     $_tempBody = null;
     if (isset($body)) {
         $_tempBody = $body;
     }
     // for model (json/xml)
     if (isset($_tempBody)) {
         $httpBody = $_tempBody;
         // $_tempBody is the method argument, if present
     } elseif (count($formParams) > 0) {
         $httpBody = $formParams;
         // for HTTP post (form)
     }
     // make the API Call
     try {
         list($response, $statusCode, $httpHeader) = $this->apiClient->callApi($resourcePath, 'POST', $queryParams, $httpBody, $headerParams, '\\Swagger\\Client\\Model\\CloudUser');
         if (!$response) {
             return array(null, $statusCode, $httpHeader);
         }
         return array(\Swagger\Client\ObjectSerializer::deserialize($response, '\\Swagger\\Client\\Model\\CloudUser', $httpHeader), $statusCode, $httpHeader);
     } catch (ApiException $e) {
         switch ($e->getCode()) {
             case 200:
                 $data = \Swagger\Client\ObjectSerializer::deserialize($e->getResponseBody(), '\\Swagger\\Client\\Model\\CloudUser', $e->getResponseHeaders());
                 $e->setResponseObject($data);
                 break;
         }
         throw $e;
     }
 }
Ejemplo n.º 5
0
 /**
  * getmeasure
  *
  * 
  *
  * @param string $access_token Your access token (required)
  * @param string $device_id Id of the device whose module's measurements you want to retrieve. This _id can be found in the user's devices field. (required)
  * @param string $scale Defines the time interval between two measurements.\nPossible values :\nmax -> every value stored will be returned\n30min -> 1 value every 30 minutes\n1hour -> 1 value every hour\n3hours -> 1 value every 3 hours\n1day -> 1 value per day\n1week -> 1 value per week\n1month -> 1 value per month (required)
  * @param string[] $type Sets the type of measurement you want to retrieve.\nThe different types of measurements must be given in a comma separated list of strings.\nExample: type=\"Temperature,Humidity\"\nDepending on the device's type and the scale, different measurements are available:\nFor Weather Station :\n\n  max -> Temperature, CO2, Humidity, Pressure, Noise, Rain (if\nmodule_id is a rain sensor)\n\n  30min, 1hour, 3hours -> Temperature, CO2, Humidity, Pressure,\nNoise, min_temp, max_temp, min_hum, max_hum, min_pressure, max_pressure, min_noise, max_noise, sum_rain (if module_id is a rain sensor)\n\n  1day, 1week, 1month -> Temperature, Co2, Humidity, Pressure, Noise,\nmin_temp, date_min_temp, max_temp, date_max_temp, min_hum, date_min_hum, max_hum, date_max_hum, min_pressure, date_min_pressure, max_pressure, date_max_pressure, min_noise, date_min_noise, max_noise, date_max_noise, date_min_co2, date_max_co2, sum_rain (if module_id is a rain sensor)\nPlease note, the measurements sent in the response will be in the same order as in this list.\nAll measurements are expressed in metric units:\n\n  Temperature: Celsius\n\n  Humidity: %\n\n  Co2: ppm\n\n  Pressure: mbar\n\n  Noise: db\n\n  Rain: mm\n\nFor Thermostat:\n\n  max -> Temperature, Sp_Temperature, BoilerOn, BoilerOff\n\n  30min, 1hour, 3hours -> Temperature, Sp_Temperature, min_temp,\nmax_temp, sum_boiler_on, sum_boiler_off\n\n  1day, 1week, 1month -> Temperature, min_temp, date_min_temp,\nmax_temp, sum_boiler_on, sum_boiler_off\n\n  where\n\nTemperature: Celsius\n\n  Sp_Temperature (temperature setpoint): Celsius\n\n  BoilerOn: Duration, since the previous data point, during which the\nboiler has been on (in seconds)\n\n  BoilerOff : Duration, since the previous data point, during which\nthe boiler has been off (in seconds).\n\n  sum_boiler_on: Total duration during which the boiler has been on,\nat a specific scale (in seconds).\n\n  sum_boiler_off: Total duration during which the boiler has been\noff, at a specific scale (in seconds). (required)
  * @param string $module_id If you don't specify any module_id you will retrieve the device's measurements. If you specify a module_id you will retrieve the module's measurements. (optional)
  * @param int $date_begin Starting timestamp (utc) of the requested measurements.\nPlease note measurement retrieving is limited to 1024 measurements. (optional)
  * @param int $date_end Ending timestamp (utc) of the request measurements.\nIf you want only the last measurement, do not provide date_begin, and set date_end to \"last\". (optional)
  * @param int $limit Limits the number of measurements returned (default & max is 1024) (optional)
  * @param bool $optimize Allows you to choose the format of the answer.\nIf you build a mobile app and bandwith usage is an issue, use optimize = true.\nUse optimize = false, for an easier parse. In this case, values are indexed by sorted timestamp.\nExample of un-optimized response :\n{\"status\": \"ok\", \n  \"body\": {\n    \"1347575400\": [18.3,39],\n    \"1347586200\": [20.6,48]\n  },\n\"time_exec\": 0.012136936187744}\nIf optimize is set true, measurements are returned as an array of series of regularly spaced measurements. Each series is defined by a beginning time beg_time and a step between measurements, step_time:\n{\"status\": \"ok\",\n  \"body\": [\n    {\"beg_time\": 1347575400,\n     \"step_time\": 10800,\n     \"value\": \n        [[18.3,39],\n        [ 20.6,48]]\n    }],\n\"time_exec\": 0.014238119125366}\nDefault value is true. (optional)
  * @param bool $real_time In scales higher than max, since the data is aggregated, the timestamps returned are by default offset by +(scale/2).\nFor instance, if you ask for measurements at a daily scale, you will receive data timestamped at 12:00 if real_time is set to false (default case), and timestamped at 00:00 if real_time is set to true.\nNB : The servers always store data with real_time set to true and data are offset by this parameter AFTER having being time-filtered, thus you could have data after date_end if real_time is set to false. (optional)
  * @return \Swagger\Client\Model\NAMeasureResponse
  * @throws \Swagger\Client\ApiException on non-2xx response
  */
 public function getmeasure($access_token, $device_id, $scale, $type, $module_id = null, $date_begin = null, $date_end = null, $limit = null, $optimize = null, $real_time = null)
 {
     // verify the required parameter 'access_token' is set
     if ($access_token === null) {
         throw new \InvalidArgumentException('Missing the required parameter $access_token when calling getmeasure');
     }
     // verify the required parameter 'device_id' is set
     if ($device_id === null) {
         throw new \InvalidArgumentException('Missing the required parameter $device_id when calling getmeasure');
     }
     // verify the required parameter 'scale' is set
     if ($scale === null) {
         throw new \InvalidArgumentException('Missing the required parameter $scale when calling getmeasure');
     }
     // verify the required parameter 'type' is set
     if ($type === null) {
         throw new \InvalidArgumentException('Missing the required parameter $type when calling getmeasure');
     }
     // parse inputs
     $resourcePath = "/api/getmeasure";
     $resourcePath = str_replace("{format}", "json", $resourcePath);
     $method = "GET";
     $httpBody = '';
     $queryParams = array();
     $headerParams = array();
     $formParams = array();
     $_header_accept = ApiClient::selectHeaderAccept(array());
     if (!is_null($_header_accept)) {
         $headerParams['Accept'] = $_header_accept;
     }
     $headerParams['Content-Type'] = ApiClient::selectHeaderContentType(array());
     // query params
     if ($access_token !== null) {
         $queryParams['access_token'] = $this->apiClient->getSerializer()->toQueryValue($access_token);
     }
     // query params
     if ($device_id !== null) {
         $queryParams['device_id'] = $this->apiClient->getSerializer()->toQueryValue($device_id);
     }
     // query params
     if ($module_id !== null) {
         $queryParams['module_id'] = $this->apiClient->getSerializer()->toQueryValue($module_id);
     }
     // query params
     if ($scale !== null) {
         $queryParams['scale'] = $this->apiClient->getSerializer()->toQueryValue($scale);
     }
     // query params
     if ($type !== null) {
         $queryParams['type'] = $this->apiClient->getSerializer()->toQueryValue($type);
     }
     // query params
     if ($date_begin !== null) {
         $queryParams['date_begin'] = $this->apiClient->getSerializer()->toQueryValue($date_begin);
     }
     // query params
     if ($date_end !== null) {
         $queryParams['date_end'] = $this->apiClient->getSerializer()->toQueryValue($date_end);
     }
     // query params
     if ($limit !== null) {
         $queryParams['limit'] = $this->apiClient->getSerializer()->toQueryValue($limit);
     }
     // query params
     if ($optimize !== null) {
         $queryParams['optimize'] = $this->apiClient->getSerializer()->toQueryValue($optimize);
     }
     // query params
     if ($real_time !== null) {
         $queryParams['real_time'] = $this->apiClient->getSerializer()->toQueryValue($real_time);
     }
     // for model (json/xml)
     if (isset($_tempBody)) {
         $httpBody = $_tempBody;
         // $_tempBody is the method argument, if present
     } else {
         if (count($formParams) > 0) {
             $httpBody = $formParams;
             // for HTTP post (form)
         }
     }
     // make the API Call
     try {
         list($response, $httpHeader) = $this->apiClient->callApi($resourcePath, $method, $queryParams, $httpBody, $headerParams, '\\Swagger\\Client\\Model\\NAMeasureResponse');
         if (!$response) {
             return null;
         }
         return $this->apiClient->getSerializer()->deserialize($response, '\\Swagger\\Client\\Model\\NAMeasureResponse', $httpHeader);
     } catch (ApiException $e) {
         switch ($e->getCode()) {
             case 200:
                 $data = $this->apiClient->getSerializer()->deserialize($e->getResponseBody(), '\\Swagger\\Client\\Model\\NAMeasureResponse', $e->getResponseHeaders());
                 $e->setResponseObject($data);
                 break;
         }
         throw $e;
     }
     return null;
 }
Ejemplo n.º 6
0
 /**
  * uploadFileWithHttpInfo
  *
  * uploads an image
  *
  * @param int $pet_id ID of pet to update (required)
  * @param string $additional_metadata Additional data to pass to server (optional)
  * @param \SplFileObject $file file to upload (optional)
  * @return Array of null, HTTP status code, HTTP response headers (array of strings)
  * @throws \Swagger\Client\ApiException on non-2xx response
  */
 public function uploadFileWithHttpInfo($pet_id, $additional_metadata = null, $file = null)
 {
     // verify the required parameter 'pet_id' is set
     if ($pet_id === null) {
         throw new \InvalidArgumentException('Missing the required parameter $pet_id when calling uploadFile');
     }
     // parse inputs
     $resourcePath = "/pet/{petId}/uploadImage";
     $resourcePath = str_replace("{format}", "json", $resourcePath);
     $method = "POST";
     $httpBody = '';
     $queryParams = array();
     $headerParams = array();
     $formParams = array();
     $_header_accept = ApiClient::selectHeaderAccept(array('application/json', 'application/xml'));
     if (!is_null($_header_accept)) {
         $headerParams['Accept'] = $_header_accept;
     }
     $headerParams['Content-Type'] = ApiClient::selectHeaderContentType(array('multipart/form-data'));
     // path params
     if ($pet_id !== null) {
         $resourcePath = str_replace("{" . "petId" . "}", $this->apiClient->getSerializer()->toPathValue($pet_id), $resourcePath);
     }
     // form params
     if ($additional_metadata !== null) {
         $formParams['additionalMetadata'] = $this->apiClient->getSerializer()->toFormValue($additional_metadata);
     }
     // form params
     if ($file !== null) {
         // PHP 5.5 introduced a CurlFile object that deprecates the old @filename syntax
         // See: https://wiki.php.net/rfc/curl-file-upload
         if (function_exists('curl_file_create')) {
             $formParams['file'] = curl_file_create($this->apiClient->getSerializer()->toFormValue($file));
         } else {
             $formParams['file'] = '@' . $this->apiClient->getSerializer()->toFormValue($file);
         }
     }
     // for model (json/xml)
     if (isset($_tempBody)) {
         $httpBody = $_tempBody;
         // $_tempBody is the method argument, if present
     } elseif (count($formParams) > 0) {
         $httpBody = $formParams;
         // for HTTP post (form)
     }
     // this endpoint requires OAuth (access token)
     if ($this->apiClient->getConfig()->getAccessToken() !== null) {
         $headerParams['Authorization'] = 'Bearer ' . $this->apiClient->getConfig()->getAccessToken();
     }
     // make the API Call
     try {
         list($response, $statusCode, $httpHeader) = $this->apiClient->callApi($resourcePath, $method, $queryParams, $httpBody, $headerParams);
         return array(null, $statusCode, $httpHeader);
     } catch (ApiException $e) {
         switch ($e->getCode()) {
         }
         throw $e;
     }
 }
Ejemplo n.º 7
0
 /**
  * updateWithHttpInfo
  *
  * Modify a Lan
  *
  * @param string $datacenter_id  (required)
  * @param map[string,string] $lan_id  (required)
  * @param \Swagger\Client\Model\Lan $lan Modified Lan (required)
  * @param bool $pretty_print_query_parameter Controls whether response is pretty-printed (with indentation and new lines) (optional, default to true)
  * @param int $depth Controls the details depth of response objects. \nEg. GET /datacenters/[ID]\n\t- depth=0: only direct properties are included. Children (servers etc.) are not included\n\t- depth=1: direct properties and children references are included\n\t- depth=2: direct properties and children properties are included\n\t- depth=3: direct properties and children properties and children's children are included\n\t- depth=... and so on (optional, default to 0)
  * @return Array of \Swagger\Client\Model\Lan, HTTP status code, HTTP response headers (array of strings)
  * @throws \Swagger\Client\ApiException on non-2xx response
  */
 public function updateWithHttpInfo($datacenter_id, $lan_id, $lan, $pretty_print_query_parameter = null, $depth = null)
 {
     // verify the required parameter 'datacenter_id' is set
     if ($datacenter_id === null) {
         throw new \InvalidArgumentException('Missing the required parameter $datacenter_id when calling update');
     }
     // verify the required parameter 'lan_id' is set
     if ($lan_id === null) {
         throw new \InvalidArgumentException('Missing the required parameter $lan_id when calling update');
     }
     // verify the required parameter 'lan' is set
     if ($lan === null) {
         throw new \InvalidArgumentException('Missing the required parameter $lan when calling update');
     }
     // parse inputs
     $resourcePath = "/datacenters/{datacenterId}/lans/{lanId}";
     $httpBody = '';
     $queryParams = array();
     $headerParams = array();
     $formParams = array();
     $_header_accept = ApiClient::selectHeaderAccept(array('application/json'));
     if (!is_null($_header_accept)) {
         $headerParams['Accept'] = $_header_accept;
     }
     $headerParams['Content-Type'] = ApiClient::selectHeaderContentType(array('application/json'));
     // query params
     if ($pretty_print_query_parameter !== null) {
         $queryParams['Pretty print query parameter'] = $this->apiClient->getSerializer()->toQueryValue($pretty_print_query_parameter);
     }
     // query params
     if ($depth !== null) {
         $queryParams['depth'] = $this->apiClient->getSerializer()->toQueryValue($depth);
     }
     // path params
     if ($datacenter_id !== null) {
         $resourcePath = str_replace("{" . "datacenterId" . "}", $this->apiClient->getSerializer()->toPathValue($datacenter_id), $resourcePath);
     }
     // path params
     if ($lan_id !== null) {
         $resourcePath = str_replace("{" . "lanId" . "}", $this->apiClient->getSerializer()->toPathValue($lan_id), $resourcePath);
     }
     // default format to json
     $resourcePath = str_replace("{format}", "json", $resourcePath);
     // body params
     $_tempBody = null;
     if (isset($lan)) {
         $_tempBody = $lan;
     }
     // for model (json/xml)
     if (isset($_tempBody)) {
         $httpBody = $_tempBody;
         // $_tempBody is the method argument, if present
     } elseif (count($formParams) > 0) {
         $httpBody = $formParams;
         // for HTTP post (form)
     }
     // this endpoint requires HTTP basic authentication
     if (strlen($this->apiClient->getConfig()->getUsername()) !== 0 or strlen($this->apiClient->getConfig()->getPassword()) !== 0) {
         $headerParams['Authorization'] = 'Basic ' . base64_encode($this->apiClient->getConfig()->getUsername() . ":" . $this->apiClient->getConfig()->getPassword());
     }
     // make the API Call
     try {
         list($response, $statusCode, $httpHeader) = $this->apiClient->callApi($resourcePath, 'PUT', $queryParams, $httpBody, $headerParams, '\\Swagger\\Client\\Model\\Lan');
         if (!$response) {
             return array(null, $statusCode, $httpHeader);
         }
         return array(\Swagger\Client\ObjectSerializer::deserialize($response, '\\Swagger\\Client\\Model\\Lan', $httpHeader), $statusCode, $httpHeader);
     } catch (ApiException $e) {
         switch ($e->getCode()) {
             case 202:
                 $data = \Swagger\Client\ObjectSerializer::deserialize($e->getResponseBody(), '\\Swagger\\Client\\Model\\Lan', $e->getResponseHeaders());
                 $e->setResponseObject($data);
                 break;
             default:
                 $data = \Swagger\Client\ObjectSerializer::deserialize($e->getResponseBody(), '\\Swagger\\Client\\Model\\Error', $e->getResponseHeaders());
                 $e->setResponseObject($data);
                 break;
         }
         throw $e;
     }
 }
Ejemplo n.º 8
0
 /**
  * addPetUsingByteArrayWithHttpInfo
  *
  * Fake endpoint to test byte array in body parameter for adding a new pet to the store
  *
  * @param string $body Pet object in the form of byte array (optional)
  * @return Array of null, HTTP status code, HTTP response headers (array of strings)
  * @throws \Swagger\Client\ApiException on non-2xx response
  */
 public function addPetUsingByteArrayWithHttpInfo($body = null)
 {
     // parse inputs
     $resourcePath = "/pet?testing_byte_array=true";
     $httpBody = '';
     $queryParams = array();
     $headerParams = array();
     $formParams = array();
     $_header_accept = ApiClient::selectHeaderAccept(array('application/json', 'application/xml'));
     if (!is_null($_header_accept)) {
         $headerParams['Accept'] = $_header_accept;
     }
     $headerParams['Content-Type'] = ApiClient::selectHeaderContentType(array('application/json', 'application/xml'));
     // default format to json
     $resourcePath = str_replace("{format}", "json", $resourcePath);
     // body params
     $_tempBody = null;
     if (isset($body)) {
         $_tempBody = $body;
     }
     // for model (json/xml)
     if (isset($_tempBody)) {
         $httpBody = $_tempBody;
         // $_tempBody is the method argument, if present
     } elseif (count($formParams) > 0) {
         $httpBody = $formParams;
         // for HTTP post (form)
     }
     // this endpoint requires OAuth (access token)
     if (strlen($this->apiClient->getConfig()->getAccessToken()) !== 0) {
         $headerParams['Authorization'] = 'Bearer ' . $this->apiClient->getConfig()->getAccessToken();
     }
     // make the API Call
     try {
         list($response, $statusCode, $httpHeader) = $this->apiClient->callApi($resourcePath, 'POST', $queryParams, $httpBody, $headerParams);
         return array(null, $statusCode, $httpHeader);
     } catch (ApiException $e) {
         switch ($e->getCode()) {
         }
         throw $e;
     }
 }
Ejemplo n.º 9
0
 /**
  * getToken
  *
  * 
  *
  * @param string $grant_type Oauth2 grant type (required)
  * @param string $client_id Application client ID (required)
  * @param string $client_secret Application client secret (required)
  * @param string $scope Scopes to use, separated by a space (optional)
  * @param string $username User name if grant_type is password (optional)
  * @param string $password User password if grant_type is password (optional)
  * @param string $code Authorization code if grant_type is authorization_code (optional)
  * @param string $redirect_uri Redirect URI if grant_type is authorization_code (optional)
  * @param string $refresh_token Refresh token if grant_type is refresh_token (optional)
  * @return \Swagger\Client\Model\AccessToken
  * @throws \Swagger\Client\ApiException on non-2xx response
  */
 public function getToken($grant_type, $client_id, $client_secret, $scope = null, $username = null, $password = null, $code = null, $redirect_uri = null, $refresh_token = null)
 {
     // verify the required parameter 'grant_type' is set
     if ($grant_type === null) {
         throw new \InvalidArgumentException('Missing the required parameter $grant_type when calling getToken');
     }
     // verify the required parameter 'client_id' is set
     if ($client_id === null) {
         throw new \InvalidArgumentException('Missing the required parameter $client_id when calling getToken');
     }
     // verify the required parameter 'client_secret' is set
     if ($client_secret === null) {
         throw new \InvalidArgumentException('Missing the required parameter $client_secret when calling getToken');
     }
     // parse inputs
     $resourcePath = "/oauth2/token";
     $resourcePath = str_replace("{format}", "json", $resourcePath);
     $method = "POST";
     $httpBody = '';
     $queryParams = array();
     $headerParams = array();
     $formParams = array();
     $_header_accept = ApiClient::selectHeaderAccept(array('application/json'));
     if (!is_null($_header_accept)) {
         $headerParams['Accept'] = $_header_accept;
     }
     $headerParams['Content-Type'] = ApiClient::selectHeaderContentType(array('application/x-www-form-urlencoded'));
     // form params
     if ($grant_type !== null) {
         $formParams['grant_type'] = $this->apiClient->getSerializer()->toFormValue($grant_type);
     }
     // form params
     if ($client_id !== null) {
         $formParams['client_id'] = $this->apiClient->getSerializer()->toFormValue($client_id);
     }
     // form params
     if ($client_secret !== null) {
         $formParams['client_secret'] = $this->apiClient->getSerializer()->toFormValue($client_secret);
     }
     // form params
     if ($scope !== null) {
         $formParams['scope'] = $this->apiClient->getSerializer()->toFormValue($scope);
     }
     // form params
     if ($username !== null) {
         $formParams['username'] = $this->apiClient->getSerializer()->toFormValue($username);
     }
     // form params
     if ($password !== null) {
         $formParams['password'] = $this->apiClient->getSerializer()->toFormValue($password);
     }
     // form params
     if ($code !== null) {
         $formParams['code'] = $this->apiClient->getSerializer()->toFormValue($code);
     }
     // form params
     if ($redirect_uri !== null) {
         $formParams['redirect_uri'] = $this->apiClient->getSerializer()->toFormValue($redirect_uri);
     }
     // form params
     if ($refresh_token !== null) {
         $formParams['refresh_token'] = $this->apiClient->getSerializer()->toFormValue($refresh_token);
     }
     // for model (json/xml)
     if (isset($_tempBody)) {
         $httpBody = $_tempBody;
         // $_tempBody is the method argument, if present
     } else {
         if (count($formParams) > 0) {
             $httpBody = $formParams;
             // for HTTP post (form)
         }
     }
     // make the API Call
     try {
         list($response, $httpHeader) = $this->apiClient->callApi($resourcePath, $method, $queryParams, $httpBody, $headerParams, '\\Swagger\\Client\\Model\\AccessToken');
         if (!$response) {
             return null;
         }
         return $this->apiClient->getSerializer()->deserialize($response, '\\Swagger\\Client\\Model\\AccessToken', $httpHeader);
     } catch (ApiException $e) {
         switch ($e->getCode()) {
             case 200:
                 $data = $this->apiClient->getSerializer()->deserialize($e->getResponseBody(), '\\Swagger\\Client\\Model\\AccessToken', $e->getResponseHeaders());
                 $e->setResponseObject($data);
                 break;
         }
         throw $e;
     }
     return null;
 }
Ejemplo n.º 10
0
 /**
  * partnerdevices
  *
  * 
  *
  * @param string $access_token Your access token (required)
  * @return \Swagger\Client\Model\NAPartnerDevicesResponse
  * @throws \Swagger\Client\ApiException on non-2xx response
  */
 public function partnerdevices($access_token)
 {
     // verify the required parameter 'access_token' is set
     if ($access_token === null) {
         throw new \InvalidArgumentException('Missing the required parameter $access_token when calling partnerdevices');
     }
     // parse inputs
     $resourcePath = "/api/partnerdevices";
     $resourcePath = str_replace("{format}", "json", $resourcePath);
     $method = "GET";
     $httpBody = '';
     $queryParams = array();
     $headerParams = array();
     $formParams = array();
     $_header_accept = ApiClient::selectHeaderAccept(array());
     if (!is_null($_header_accept)) {
         $headerParams['Accept'] = $_header_accept;
     }
     $headerParams['Content-Type'] = ApiClient::selectHeaderContentType(array());
     // query params
     if ($access_token !== null) {
         $queryParams['access_token'] = $this->apiClient->getSerializer()->toQueryValue($access_token);
     }
     // for model (json/xml)
     if (isset($_tempBody)) {
         $httpBody = $_tempBody;
         // $_tempBody is the method argument, if present
     } else {
         if (count($formParams) > 0) {
             $httpBody = $formParams;
             // for HTTP post (form)
         }
     }
     // make the API Call
     try {
         list($response, $httpHeader) = $this->apiClient->callApi($resourcePath, $method, $queryParams, $httpBody, $headerParams, '\\Swagger\\Client\\Model\\NAPartnerDevicesResponse');
         if (!$response) {
             return null;
         }
         return $this->apiClient->getSerializer()->deserialize($response, '\\Swagger\\Client\\Model\\NAPartnerDevicesResponse', $httpHeader);
     } catch (ApiException $e) {
         switch ($e->getCode()) {
             case 200:
                 $data = $this->apiClient->getSerializer()->deserialize($e->getResponseBody(), '\\Swagger\\Client\\Model\\NAPartnerDevicesResponse', $e->getResponseHeaders());
                 $e->setResponseObject($data);
                 break;
         }
         throw $e;
     }
     return null;
 }
Ejemplo n.º 11
0
 /**
  * articulosGet
  *
  * Articulos
  *
  * @param string $order_by Campo de ordenamiento. (optional)
  * @param string $order_type Tipo de orden. (optional)
  * @param Number $page Número de página. (optional)
  * @param Number $page_size Número de página. (optional)
  * @return \Swagger\Client\Model\Articulo[]
  * @throws \Swagger\Client\ApiException on non-2xx response
  */
 public function articulosGet($order_by = null, $order_type = null, $page = null, $page_size = null)
 {
     // parse inputs
     $resourcePath = "/articulos";
     $resourcePath = str_replace("{format}", "json", $resourcePath);
     $method = "GET";
     $httpBody = '';
     $queryParams = array();
     $headerParams = array();
     $formParams = array();
     $_header_accept = ApiClient::selectHeaderAccept(array('application/json'));
     if (!is_null($_header_accept)) {
         $headerParams['Accept'] = $_header_accept;
     }
     $headerParams['Content-Type'] = ApiClient::selectHeaderContentType(array());
     // query params
     if ($order_by !== null) {
         $queryParams['orderBy'] = $this->apiClient->getSerializer()->toQueryValue($order_by);
     }
     // query params
     if ($order_type !== null) {
         $queryParams['orderType'] = $this->apiClient->getSerializer()->toQueryValue($order_type);
     }
     // query params
     if ($page !== null) {
         $queryParams['page'] = $this->apiClient->getSerializer()->toQueryValue($page);
     }
     // query params
     if ($page_size !== null) {
         $queryParams['pageSize'] = $this->apiClient->getSerializer()->toQueryValue($page_size);
     }
     // for model (json/xml)
     if (isset($_tempBody)) {
         $httpBody = $_tempBody;
         // $_tempBody is the method argument, if present
     } else {
         if (count($formParams) > 0) {
             $httpBody = $formParams;
             // for HTTP post (form)
         }
     }
     // make the API Call
     try {
         list($response, $httpHeader) = $this->apiClient->callApi($resourcePath, $method, $queryParams, $httpBody, $headerParams, '\\Swagger\\Client\\Model\\Articulo[]');
         if (!$response) {
             return null;
         }
         return $this->apiClient->getSerializer()->deserialize($response, '\\Swagger\\Client\\Model\\Articulo[]', $httpHeader);
     } catch (ApiException $e) {
         switch ($e->getCode()) {
             case 200:
                 $data = $this->apiClient->getSerializer()->deserialize($e->getResponseBody(), '\\Swagger\\Client\\Model\\Articulo[]', $e->getResponseHeaders());
                 $e->setResponseObject($data);
                 break;
             case 0:
                 $data = $this->apiClient->getSerializer()->deserialize($e->getResponseBody(), '\\Swagger\\Client\\Model\\Error', $e->getResponseHeaders());
                 $e->setResponseObject($data);
                 break;
         }
         throw $e;
     }
     return null;
 }
 /**
  * printInfoWithHttpInfo
  *
  * Display API information
  *
  * @param bool $pretty_print_query_parameter Controls whether response is pretty-printed (with indentation and new lines) (optional, default to true)
  * @param int $depth Controls the details depth of response objects. \nEg. GET /datacenters/[ID]\n\t- depth=0: only direct properties are included. Children (servers etc.) are not included\n\t- depth=1: direct properties and children references are included\n\t- depth=2: direct properties and children properties are included\n\t- depth=3: direct properties and children properties and children's children are included\n\t- depth=... and so on (optional, default to 0)
  * @return Array of \Swagger\Client\Model\Info, HTTP status code, HTTP response headers (array of strings)
  * @throws \Swagger\Client\ApiException on non-2xx response
  */
 public function printInfoWithHttpInfo($pretty_print_query_parameter = null, $depth = null)
 {
     // parse inputs
     $resourcePath = "/";
     $httpBody = '';
     $queryParams = array();
     $headerParams = array();
     $formParams = array();
     $_header_accept = ApiClient::selectHeaderAccept(array('application/json'));
     if (!is_null($_header_accept)) {
         $headerParams['Accept'] = $_header_accept;
     }
     $headerParams['Content-Type'] = ApiClient::selectHeaderContentType(array('*/*'));
     // query params
     if ($pretty_print_query_parameter !== null) {
         $queryParams['Pretty print query parameter'] = $this->apiClient->getSerializer()->toQueryValue($pretty_print_query_parameter);
     }
     // query params
     if ($depth !== null) {
         $queryParams['depth'] = $this->apiClient->getSerializer()->toQueryValue($depth);
     }
     // default format to json
     $resourcePath = str_replace("{format}", "json", $resourcePath);
     // for model (json/xml)
     if (isset($_tempBody)) {
         $httpBody = $_tempBody;
         // $_tempBody is the method argument, if present
     } elseif (count($formParams) > 0) {
         $httpBody = $formParams;
         // for HTTP post (form)
     }
     // make the API Call
     try {
         list($response, $statusCode, $httpHeader) = $this->apiClient->callApi($resourcePath, 'GET', $queryParams, $httpBody, $headerParams, '\\Swagger\\Client\\Model\\Info');
         if (!$response) {
             return array(null, $statusCode, $httpHeader);
         }
         return array(\Swagger\Client\ObjectSerializer::deserialize($response, '\\Swagger\\Client\\Model\\Info', $httpHeader), $statusCode, $httpHeader);
     } catch (ApiException $e) {
         switch ($e->getCode()) {
             case 200:
                 $data = \Swagger\Client\ObjectSerializer::deserialize($e->getResponseBody(), '\\Swagger\\Client\\Model\\Info', $e->getResponseHeaders());
                 $e->setResponseObject($data);
                 break;
             default:
                 $data = \Swagger\Client\ObjectSerializer::deserialize($e->getResponseBody(), '\\Swagger\\Client\\Model\\Error', $e->getResponseHeaders());
                 $e->setResponseObject($data);
                 break;
         }
         throw $e;
     }
 }
Ejemplo n.º 13
0
 /**
  * updateUserPreference
  *
  * Update one user preference
  *
  * @param int $user_id The id of the user whose preference is to be updated/created (required)
  * @param string $preference_name The preference name to update/create (required)
  * @param string $updated_value the preference value (required)
  * @return void
  * @throws \Swagger\Client\ApiException on non-2xx response
  */
 public function updateUserPreference($user_id, $preference_name, $updated_value)
 {
     // verify the required parameter 'user_id' is set
     if ($user_id === null) {
         throw new \InvalidArgumentException('Missing the required parameter $user_id when calling updateUserPreference');
     }
     // verify the required parameter 'preference_name' is set
     if ($preference_name === null) {
         throw new \InvalidArgumentException('Missing the required parameter $preference_name when calling updateUserPreference');
     }
     // parse inputs
     $resourcePath = "/{userId}/{preferenceName}";
     $resourcePath = str_replace("{format}", "json", $resourcePath);
     $method = "PUT";
     $httpBody = '';
     $queryParams = array();
     $headerParams = array();
     $formParams = array();
     $_header_accept = ApiClient::selectHeaderAccept(array('application/json'));
     if (!is_null($_header_accept)) {
         $headerParams['Accept'] = $_header_accept;
     }
     $headerParams['Content-Type'] = ApiClient::selectHeaderContentType(array());
     // path params
     if ($user_id !== null) {
         $resourcePath = str_replace("{" . "userId" . "}", $this->apiClient->getSerializer()->toPathValue($user_id), $resourcePath);
     }
     // path params
     if ($preference_name !== null) {
         $resourcePath = str_replace("{" . "preferenceName" . "}", $this->apiClient->getSerializer()->toPathValue($preference_name), $resourcePath);
     }
     // body params
     $_tempBody = null;
     if (isset($updated_value)) {
         $_tempBody = $updated_value;
     }
     // for model (json/xml)
     if (isset($_tempBody)) {
         $httpBody = $_tempBody;
         // $_tempBody is the method argument, if present
     } else {
         if (count($formParams) > 0) {
             // for HTTP post (form)
             $httpBody = $formParams;
         }
     }
     $apiKey = $this->apiClient->getApiKeyWithPrefix('X-Wikia-AccessToken');
     if (isset($apiKey)) {
         $headerParams['X-Wikia-AccessToken'] = $apiKey;
     }
     $apiKey = $this->apiClient->getApiKeyWithPrefix('X-Wikia-UserId');
     if (isset($apiKey)) {
         $headerParams['X-Wikia-UserId'] = $apiKey;
     }
     // make the API Call
     try {
         $response = $this->apiClient->callAPI($resourcePath, $method, $queryParams, $httpBody, $headerParams);
     } catch (ApiException $e) {
         switch ($e->getCode()) {
             case 400:
                 $data = $this->apiClient->getSerializer()->deserialize($e->getResponseBody(), '\\Swagger\\Client\\User\\Preferences\\Models\\Problem');
                 $e->setResponseObject($data);
                 break;
         }
         throw $e;
     }
 }
Ejemplo n.º 14
0
 /**
  * getPetsWithHttpInfo
  *
  * Get your pets
  *
  * @return Array of \Swagger\Client\Model\Animal, HTTP status code, HTTP response headers (array of strings)
  * @throws \Swagger\Client\ApiException on non-2xx response
  */
 public function getPetsWithHttpInfo()
 {
     // parse inputs
     $resourcePath = "/pets";
     $httpBody = '';
     $queryParams = array();
     $headerParams = array();
     $formParams = array();
     $_header_accept = ApiClient::selectHeaderAccept(array('application/json'));
     if (!is_null($_header_accept)) {
         $headerParams['Accept'] = $_header_accept;
     }
     $headerParams['Content-Type'] = ApiClient::selectHeaderContentType(array('application/x-www-form-urlencoded'));
     // default format to json
     $resourcePath = str_replace("{format}", "json", $resourcePath);
     // for model (json/xml)
     if (isset($_tempBody)) {
         $httpBody = $_tempBody;
         // $_tempBody is the method argument, if present
     } elseif (count($formParams) > 0) {
         $httpBody = $formParams;
         // for HTTP post (form)
     }
     // make the API Call
     try {
         list($response, $statusCode, $httpHeader) = $this->apiClient->callApi($resourcePath, 'GET', $queryParams, $httpBody, $headerParams, '\\Swagger\\Client\\Model\\Animal');
         if (!$response) {
             return array(null, $statusCode, $httpHeader);
         }
         return array(\Swagger\Client\ObjectSerializer::deserialize($response, '\\Swagger\\Client\\Model\\Animal', $httpHeader, 'className'), $statusCode, $httpHeader);
     } catch (ApiException $e) {
         switch ($e->getCode()) {
             case 200:
                 $data = \Swagger\Client\ObjectSerializer::deserialize($e->getResponseBody(), '\\Swagger\\Client\\Model\\Animal', $e->getResponseHeaders());
                 $e->setResponseObject($data);
                 break;
         }
         throw $e;
     }
 }
Ejemplo n.º 15
0
 /**
  * deleteUserWithHttpInfo
  *
  * Delete user
  *
  * @param string $username The name that needs to be deleted (required)
  * @return Array of null, HTTP status code, HTTP response headers (array of strings)
  * @throws \Swagger\Client\ApiException on non-2xx response
  */
 public function deleteUserWithHttpInfo($username)
 {
     // verify the required parameter 'username' is set
     if ($username === null) {
         throw new \InvalidArgumentException('Missing the required parameter $username when calling deleteUser');
     }
     // parse inputs
     $resourcePath = "/user/{username}";
     $httpBody = '';
     $queryParams = array();
     $headerParams = array();
     $formParams = array();
     $_header_accept = ApiClient::selectHeaderAccept(array('application/json', 'application/xml'));
     if (!is_null($_header_accept)) {
         $headerParams['Accept'] = $_header_accept;
     }
     $headerParams['Content-Type'] = ApiClient::selectHeaderContentType(array());
     // path params
     if ($username !== null) {
         $resourcePath = str_replace("{" . "username" . "}", $this->apiClient->getSerializer()->toPathValue($username), $resourcePath);
     }
     // default format to json
     $resourcePath = str_replace("{format}", "json", $resourcePath);
     // for model (json/xml)
     if (isset($_tempBody)) {
         $httpBody = $_tempBody;
         // $_tempBody is the method argument, if present
     } elseif (count($formParams) > 0) {
         $httpBody = $formParams;
         // for HTTP post (form)
     }
     // make the API Call
     try {
         list($response, $statusCode, $httpHeader) = $this->apiClient->callApi($resourcePath, 'DELETE', $queryParams, $httpBody, $headerParams);
         return array(null, $statusCode, $httpHeader);
     } catch (ApiException $e) {
         switch ($e->getCode()) {
         }
         throw $e;
     }
 }
Ejemplo n.º 16
0
 /**
  * complaintsComplaintsWithHttpInfo
  *
  * Complaints: Free service (with registration), providing community and government complaint lookup by phone number for up to 2,000 queries per month.  Details include number complaint rates from (FTC, FCC, IRS, Indiana Attorney  General) and key entity tag extractions from complaints.
  *
  * @param string $phone_number phone number to search (required)
  * @return Array of \Swagger\Client\Model\Complaints, HTTP status code, HTTP response headers (array of strings)
  * @throws \Swagger\Client\ApiException on non-2xx response
  */
 public function complaintsComplaintsWithHttpInfo($phone_number)
 {
     // verify the required parameter 'phone_number' is set
     if ($phone_number === null) {
         throw new \InvalidArgumentException('Missing the required parameter $phone_number when calling complaintsComplaints');
     }
     // parse inputs
     $resourcePath = "/api/2015-11-01/Complaints/{phoneNumber}";
     $httpBody = '';
     $queryParams = array();
     $headerParams = array();
     $formParams = array();
     $_header_accept = ApiClient::selectHeaderAccept(array('application/json', 'text/json', 'application/xml', 'text/xml'));
     if (!is_null($_header_accept)) {
         $headerParams['Accept'] = $_header_accept;
     }
     $headerParams['Content-Type'] = ApiClient::selectHeaderContentType(array());
     // path params
     if ($phone_number !== null) {
         $resourcePath = str_replace("{" . "phoneNumber" . "}", $this->apiClient->getSerializer()->toPathValue($phone_number), $resourcePath);
     }
     // default format to json
     $resourcePath = str_replace("{format}", "json", $resourcePath);
     // for model (json/xml)
     if (isset($_tempBody)) {
         $httpBody = $_tempBody;
         // $_tempBody is the method argument, if present
     } elseif (count($formParams) > 0) {
         $httpBody = $formParams;
         // for HTTP post (form)
     }
     // make the API Call
     try {
         list($response, $statusCode, $httpHeader) = $this->apiClient->callApi($resourcePath, 'GET', $queryParams, $httpBody, $headerParams, '\\Swagger\\Client\\Model\\Complaints');
         if (!$response) {
             return array(null, $statusCode, $httpHeader);
         }
         return array(\Swagger\Client\ObjectSerializer::deserialize($response, '\\Swagger\\Client\\Model\\Complaints', $httpHeader), $statusCode, $httpHeader);
     } catch (ApiException $e) {
         switch ($e->getCode()) {
             case 200:
                 $data = \Swagger\Client\ObjectSerializer::deserialize($e->getResponseBody(), '\\Swagger\\Client\\Model\\Complaints', $e->getResponseHeaders());
                 $e->setResponseObject($data);
                 break;
         }
         throw $e;
     }
 }
Ejemplo n.º 17
0
 /**
  * orderBookGetOrderBook
  *
  * Get current orderbook.
  *
  * @param string $symbol Instrument symbol. Send a series (e.g. XBT) to get data for the nearest contract in that series. (required)
  * @param Number $depth Orderbook depth. (optional)
  * @return \Swagger\Client\Model\OrderBook[]
  * @throws \Swagger\Client\ApiException on non-2xx response
  */
 public function orderBookGetOrderBook($symbol, $depth = null)
 {
     // verify the required parameter 'symbol' is set
     if ($symbol === null) {
         throw new \InvalidArgumentException('Missing the required parameter $symbol when calling orderBookGetOrderBook');
     }
     // parse inputs
     $resourcePath = "/orderBook";
     $resourcePath = str_replace("{format}", "json", $resourcePath);
     $method = "GET";
     $httpBody = '';
     $queryParams = array();
     $headerParams = array();
     $formParams = array();
     $_header_accept = ApiClient::selectHeaderAccept(array('application/json', 'application/xml', 'text/xml', 'application/javascript', 'text/javascript'));
     if (!is_null($_header_accept)) {
         $headerParams['Accept'] = $_header_accept;
     }
     $headerParams['Content-Type'] = ApiClient::selectHeaderContentType(array('application/json', 'application/x-www-form-urlencoded'));
     // query params
     if ($symbol !== null) {
         $queryParams['symbol'] = $this->apiClient->getSerializer()->toQueryValue($symbol);
     }
     // query params
     if ($depth !== null) {
         $queryParams['depth'] = $this->apiClient->getSerializer()->toQueryValue($depth);
     }
     // for model (json/xml)
     if (isset($_tempBody)) {
         $httpBody = $_tempBody;
         // $_tempBody is the method argument, if present
     } else {
         if (count($formParams) > 0) {
             $httpBody = $formParams;
             // for HTTP post (form)
         }
     }
     // make the API Call
     try {
         list($response, $httpHeader) = $this->apiClient->callApi($resourcePath, $method, $queryParams, $httpBody, $headerParams, '\\Swagger\\Client\\Model\\OrderBook[]');
         if (!$response) {
             return null;
         }
         return $this->apiClient->getSerializer()->deserialize($response, '\\Swagger\\Client\\Model\\OrderBook[]', $httpHeader);
     } catch (ApiException $e) {
         switch ($e->getCode()) {
             case 200:
                 $data = $this->apiClient->getSerializer()->deserialize($e->getResponseBody(), '\\Swagger\\Client\\Model\\OrderBook[]', $e->getResponseHeaders());
                 $e->setResponseObject($data);
                 break;
             case 400:
                 $data = $this->apiClient->getSerializer()->deserialize($e->getResponseBody(), '\\Swagger\\Client\\Model\\Error', $e->getResponseHeaders());
                 $e->setResponseObject($data);
                 break;
             case 401:
                 $data = $this->apiClient->getSerializer()->deserialize($e->getResponseBody(), '\\Swagger\\Client\\Model\\Error', $e->getResponseHeaders());
                 $e->setResponseObject($data);
                 break;
             case 404:
                 $data = $this->apiClient->getSerializer()->deserialize($e->getResponseBody(), '\\Swagger\\Client\\Model\\Error', $e->getResponseHeaders());
                 $e->setResponseObject($data);
                 break;
         }
         throw $e;
     }
     return null;
 }
Ejemplo n.º 18
0
 /**
  * statsHistory
  *
  * Get historical exchange-wide and per-series turnover and volume statistics.
  *
  * @return \Swagger\Client\Model\StatsHistory[]
  * @throws \Swagger\Client\ApiException on non-2xx response
  */
 public function statsHistory()
 {
     // parse inputs
     $resourcePath = "/stats/history";
     $resourcePath = str_replace("{format}", "json", $resourcePath);
     $method = "GET";
     $httpBody = '';
     $queryParams = array();
     $headerParams = array();
     $formParams = array();
     $_header_accept = ApiClient::selectHeaderAccept(array('application/json', 'application/xml', 'text/xml', 'application/javascript', 'text/javascript'));
     if (!is_null($_header_accept)) {
         $headerParams['Accept'] = $_header_accept;
     }
     $headerParams['Content-Type'] = ApiClient::selectHeaderContentType(array('application/json', 'application/x-www-form-urlencoded'));
     // for model (json/xml)
     if (isset($_tempBody)) {
         $httpBody = $_tempBody;
         // $_tempBody is the method argument, if present
     } else {
         if (count($formParams) > 0) {
             $httpBody = $formParams;
             // for HTTP post (form)
         }
     }
     // make the API Call
     try {
         list($response, $httpHeader) = $this->apiClient->callApi($resourcePath, $method, $queryParams, $httpBody, $headerParams, '\\Swagger\\Client\\Model\\StatsHistory[]');
         if (!$response) {
             return null;
         }
         return $this->apiClient->getSerializer()->deserialize($response, '\\Swagger\\Client\\Model\\StatsHistory[]', $httpHeader);
     } catch (ApiException $e) {
         switch ($e->getCode()) {
             case 200:
                 $data = $this->apiClient->getSerializer()->deserialize($e->getResponseBody(), '\\Swagger\\Client\\Model\\StatsHistory[]', $e->getResponseHeaders());
                 $e->setResponseObject($data);
                 break;
             case 400:
                 $data = $this->apiClient->getSerializer()->deserialize($e->getResponseBody(), '\\Swagger\\Client\\Model\\Error', $e->getResponseHeaders());
                 $e->setResponseObject($data);
                 break;
             case 401:
                 $data = $this->apiClient->getSerializer()->deserialize($e->getResponseBody(), '\\Swagger\\Client\\Model\\Error', $e->getResponseHeaders());
                 $e->setResponseObject($data);
                 break;
             case 404:
                 $data = $this->apiClient->getSerializer()->deserialize($e->getResponseBody(), '\\Swagger\\Client\\Model\\Error', $e->getResponseHeaders());
                 $e->setResponseObject($data);
                 break;
         }
         throw $e;
     }
     return null;
 }
Ejemplo n.º 19
0
 /**
  * clienresBranchGet
  *
  * Clientes por Sucursal
  *
  * @param double $start_latitude Latitude component of start location. (required)
  * @param double $start_longitude Longitude component of start location. (required)
  * @param double $end_latitude Latitude component of end location. (required)
  * @param double $end_longitude Longitude component of end location. (required)
  * @return \Swagger\Client\Model\Cliente[]
  * @throws \Swagger\Client\ApiException on non-2xx response
  */
 public function clienresBranchGet($start_latitude, $start_longitude, $end_latitude, $end_longitude)
 {
     // verify the required parameter 'start_latitude' is set
     if ($start_latitude === null) {
         throw new \InvalidArgumentException('Missing the required parameter $start_latitude when calling clienresBranchGet');
     }
     // verify the required parameter 'start_longitude' is set
     if ($start_longitude === null) {
         throw new \InvalidArgumentException('Missing the required parameter $start_longitude when calling clienresBranchGet');
     }
     // verify the required parameter 'end_latitude' is set
     if ($end_latitude === null) {
         throw new \InvalidArgumentException('Missing the required parameter $end_latitude when calling clienresBranchGet');
     }
     // verify the required parameter 'end_longitude' is set
     if ($end_longitude === null) {
         throw new \InvalidArgumentException('Missing the required parameter $end_longitude when calling clienresBranchGet');
     }
     // parse inputs
     $resourcePath = "/clienres/branch";
     $resourcePath = str_replace("{format}", "json", $resourcePath);
     $method = "GET";
     $httpBody = '';
     $queryParams = array();
     $headerParams = array();
     $formParams = array();
     $_header_accept = ApiClient::selectHeaderAccept(array('application/json'));
     if (!is_null($_header_accept)) {
         $headerParams['Accept'] = $_header_accept;
     }
     $headerParams['Content-Type'] = ApiClient::selectHeaderContentType(array());
     // query params
     if ($start_latitude !== null) {
         $queryParams['start_latitude'] = $this->apiClient->getSerializer()->toQueryValue($start_latitude);
     }
     // query params
     if ($start_longitude !== null) {
         $queryParams['start_longitude'] = $this->apiClient->getSerializer()->toQueryValue($start_longitude);
     }
     // query params
     if ($end_latitude !== null) {
         $queryParams['end_latitude'] = $this->apiClient->getSerializer()->toQueryValue($end_latitude);
     }
     // query params
     if ($end_longitude !== null) {
         $queryParams['end_longitude'] = $this->apiClient->getSerializer()->toQueryValue($end_longitude);
     }
     // for model (json/xml)
     if (isset($_tempBody)) {
         $httpBody = $_tempBody;
         // $_tempBody is the method argument, if present
     } else {
         if (count($formParams) > 0) {
             $httpBody = $formParams;
             // for HTTP post (form)
         }
     }
     // make the API Call
     try {
         list($response, $httpHeader) = $this->apiClient->callApi($resourcePath, $method, $queryParams, $httpBody, $headerParams, '\\Swagger\\Client\\Model\\Cliente[]');
         if (!$response) {
             return null;
         }
         return $this->apiClient->getSerializer()->deserialize($response, '\\Swagger\\Client\\Model\\Cliente[]', $httpHeader);
     } catch (ApiException $e) {
         switch ($e->getCode()) {
             case 200:
                 $data = $this->apiClient->getSerializer()->deserialize($e->getResponseBody(), '\\Swagger\\Client\\Model\\Cliente[]', $e->getResponseHeaders());
                 $e->setResponseObject($data);
                 break;
             case 0:
                 $data = $this->apiClient->getSerializer()->deserialize($e->getResponseBody(), '\\Swagger\\Client\\Model\\Error', $e->getResponseHeaders());
                 $e->setResponseObject($data);
                 break;
         }
         throw $e;
     }
     return null;
 }
Ejemplo n.º 20
0
 /**
  * uploadFile
  *
  * uploads an image
  *
  * @param int $pet_id ID of pet to update (required)
  * @param string $additional_metadata Additional data to pass to server (optional)
  * @param \SplFileObject $file file to upload (optional)
  * @return void
  * @throws \Swagger\Client\ApiException on non-2xx response
  */
 public function uploadFile($pet_id, $additional_metadata = null, $file = null)
 {
     // verify the required parameter 'pet_id' is set
     if ($pet_id === null) {
         throw new \InvalidArgumentException('Missing the required parameter $pet_id when calling uploadFile');
     }
     // parse inputs
     $resourcePath = "/pet/{petId}/uploadImage";
     $resourcePath = str_replace("{format}", "json", $resourcePath);
     $method = "POST";
     $httpBody = '';
     $queryParams = array();
     $headerParams = array();
     $formParams = array();
     $_header_accept = ApiClient::selectHeaderAccept(array('application/json', 'application/xml'));
     if (!is_null($_header_accept)) {
         $headerParams['Accept'] = $_header_accept;
     }
     $headerParams['Content-Type'] = ApiClient::selectHeaderContentType(array('multipart/form-data'));
     // path params
     if ($pet_id !== null) {
         $resourcePath = str_replace("{" . "petId" . "}", $this->apiClient->getSerializer()->toPathValue($pet_id), $resourcePath);
     }
     // form params
     if ($additional_metadata !== null) {
         $formParams['additionalMetadata'] = $this->apiClient->getSerializer()->toFormValue($additional_metadata);
     }
     // form params
     if ($file !== null) {
         $formParams['file'] = '@' . $this->apiClient->getSerializer()->toFormValue($file);
     }
     // for model (json/xml)
     if (isset($_tempBody)) {
         $httpBody = $_tempBody;
         // $_tempBody is the method argument, if present
     } else {
         if (count($formParams) > 0) {
             $httpBody = $formParams;
             // for HTTP post (form)
         }
     }
     //TODO support oauth
     // make the API Call
     try {
         list($response, $httpHeader) = $this->apiClient->callApi($resourcePath, $method, $queryParams, $httpBody, $headerParams);
     } catch (ApiException $e) {
         switch ($e->getCode()) {
         }
         throw $e;
     }
 }
Ejemplo n.º 21
0
 /**
  * settlementGet
  *
  * Get settlement history.
  *
  * @param string $symbol Instrument symbol. Send a bare series (e.g. XBU) to get data for the nearest expiring contract in that series.\n\nYou can also send a timeframe, e.g. 'XBU:monthly'. Timeframes are 'daily', 'weekly', 'monthly', 'quarterly', and 'biquarterly'. (optional)
  * @param string $filter Generic table filter. Send JSON key/value pairs, such as {\"key\": \"value\"}. You can key on individual fields, and do more advanced querying on timestamps. See <a href=\"http://localhost:2001/app/restAPI#timestamp-filters\">http://localhost:2001/app/restAPI#timestamp-filters</a> for more details. (optional)
  * @param string $columns Array of column names to fetch. If omitted, will return all columns.\n\nNote that this method will always return item keys, even when not specified, so you may receive more columns that you expect. (optional)
  * @param Number $count Number of results to fetch. (optional)
  * @param Number $start Starting point for results. (optional)
  * @param bool $reverse If true, will sort results newest first. (optional)
  * @param \DateTime $start_time Starting date filter for results. (optional)
  * @param \DateTime $end_time Ending date filter for results. (optional)
  * @return \Swagger\Client\Model\Settlement[]
  * @throws \Swagger\Client\ApiException on non-2xx response
  */
 public function settlementGet($symbol = null, $filter = null, $columns = null, $count = null, $start = null, $reverse = null, $start_time = null, $end_time = null)
 {
     // parse inputs
     $resourcePath = "/settlement";
     $resourcePath = str_replace("{format}", "json", $resourcePath);
     $method = "GET";
     $httpBody = '';
     $queryParams = array();
     $headerParams = array();
     $formParams = array();
     $_header_accept = ApiClient::selectHeaderAccept(array('application/json', 'application/xml', 'text/xml', 'application/javascript', 'text/javascript'));
     if (!is_null($_header_accept)) {
         $headerParams['Accept'] = $_header_accept;
     }
     $headerParams['Content-Type'] = ApiClient::selectHeaderContentType(array('application/json', 'application/x-www-form-urlencoded'));
     // query params
     if ($symbol !== null) {
         $queryParams['symbol'] = $this->apiClient->getSerializer()->toQueryValue($symbol);
     }
     // query params
     if ($filter !== null) {
         $queryParams['filter'] = $this->apiClient->getSerializer()->toQueryValue($filter);
     }
     // query params
     if ($columns !== null) {
         $queryParams['columns'] = $this->apiClient->getSerializer()->toQueryValue($columns);
     }
     // query params
     if ($count !== null) {
         $queryParams['count'] = $this->apiClient->getSerializer()->toQueryValue($count);
     }
     // query params
     if ($start !== null) {
         $queryParams['start'] = $this->apiClient->getSerializer()->toQueryValue($start);
     }
     // query params
     if ($reverse !== null) {
         $queryParams['reverse'] = $this->apiClient->getSerializer()->toQueryValue($reverse);
     }
     // query params
     if ($start_time !== null) {
         $queryParams['startTime'] = $this->apiClient->getSerializer()->toQueryValue($start_time);
     }
     // query params
     if ($end_time !== null) {
         $queryParams['endTime'] = $this->apiClient->getSerializer()->toQueryValue($end_time);
     }
     // for model (json/xml)
     if (isset($_tempBody)) {
         $httpBody = $_tempBody;
         // $_tempBody is the method argument, if present
     } else {
         if (count($formParams) > 0) {
             $httpBody = $formParams;
             // for HTTP post (form)
         }
     }
     // make the API Call
     try {
         list($response, $httpHeader) = $this->apiClient->callApi($resourcePath, $method, $queryParams, $httpBody, $headerParams, '\\Swagger\\Client\\Model\\Settlement[]');
         if (!$response) {
             return null;
         }
         return $this->apiClient->getSerializer()->deserialize($response, '\\Swagger\\Client\\Model\\Settlement[]', $httpHeader);
     } catch (ApiException $e) {
         switch ($e->getCode()) {
             case 200:
                 $data = $this->apiClient->getSerializer()->deserialize($e->getResponseBody(), '\\Swagger\\Client\\Model\\Settlement[]', $e->getResponseHeaders());
                 $e->setResponseObject($data);
                 break;
             case 400:
                 $data = $this->apiClient->getSerializer()->deserialize($e->getResponseBody(), '\\Swagger\\Client\\Model\\Error', $e->getResponseHeaders());
                 $e->setResponseObject($data);
                 break;
             case 401:
                 $data = $this->apiClient->getSerializer()->deserialize($e->getResponseBody(), '\\Swagger\\Client\\Model\\Error', $e->getResponseHeaders());
                 $e->setResponseObject($data);
                 break;
             case 404:
                 $data = $this->apiClient->getSerializer()->deserialize($e->getResponseBody(), '\\Swagger\\Client\\Model\\Error', $e->getResponseHeaders());
                 $e->setResponseObject($data);
                 break;
         }
         throw $e;
     }
     return null;
 }
Ejemplo n.º 22
0
 /**
  * deleteOrder
  *
  * Delete purchase order by ID
  *
  * @param string $order_id ID of the order that needs to be deleted (required)
  * @return void
  * @throws \Swagger\Client\ApiException on non-2xx response
  */
 public function deleteOrder($order_id)
 {
     // verify the required parameter 'order_id' is set
     if ($order_id === null) {
         throw new \InvalidArgumentException('Missing the required parameter $order_id when calling deleteOrder');
     }
     // parse inputs
     $resourcePath = "/store/order/{orderId}";
     $resourcePath = str_replace("{format}", "json", $resourcePath);
     $method = "DELETE";
     $httpBody = '';
     $queryParams = array();
     $headerParams = array();
     $formParams = array();
     $_header_accept = ApiClient::selectHeaderAccept(array('application/json', 'application/xml'));
     if (!is_null($_header_accept)) {
         $headerParams['Accept'] = $_header_accept;
     }
     $headerParams['Content-Type'] = ApiClient::selectHeaderContentType(array());
     // path params
     if ($order_id !== null) {
         $resourcePath = str_replace("{" . "orderId" . "}", $this->apiClient->getSerializer()->toPathValue($order_id), $resourcePath);
     }
     // for model (json/xml)
     if (isset($_tempBody)) {
         $httpBody = $_tempBody;
         // $_tempBody is the method argument, if present
     } else {
         if (count($formParams) > 0) {
             $httpBody = $formParams;
             // for HTTP post (form)
         }
     }
     // make the API Call
     try {
         list($response, $httpHeader) = $this->apiClient->callApi($resourcePath, $method, $queryParams, $httpBody, $headerParams);
     } catch (ApiException $e) {
         switch ($e->getCode()) {
         }
         throw $e;
     }
 }
Ejemplo n.º 23
0
 /**
  * placeOrderWithHttpInfo
  *
  * Place an order for a pet
  *
  * @param \Swagger\Client\Model\Order $body order placed for purchasing the pet (optional)
  * @return Array of \Swagger\Client\Model\Order, HTTP status code, HTTP response headers (array of strings)
  * @throws \Swagger\Client\ApiException on non-2xx response
  */
 public function placeOrderWithHttpInfo($body = null)
 {
     // parse inputs
     $resourcePath = "/store/order";
     $httpBody = '';
     $queryParams = array();
     $headerParams = array();
     $formParams = array();
     $_header_accept = ApiClient::selectHeaderAccept(array('application/json', 'application/xml'));
     if (!is_null($_header_accept)) {
         $headerParams['Accept'] = $_header_accept;
     }
     $headerParams['Content-Type'] = ApiClient::selectHeaderContentType(array());
     // default format to json
     $resourcePath = str_replace("{format}", "json", $resourcePath);
     // body params
     $_tempBody = null;
     if (isset($body)) {
         $_tempBody = $body;
     }
     // for model (json/xml)
     if (isset($_tempBody)) {
         $httpBody = $_tempBody;
         // $_tempBody is the method argument, if present
     } elseif (count($formParams) > 0) {
         $httpBody = $formParams;
         // for HTTP post (form)
     }
     // this endpoint requires API key authentication
     $apiKey = $this->apiClient->getApiKeyWithPrefix('x-test_api_client_id');
     if (strlen($apiKey) !== 0) {
         $headerParams['x-test_api_client_id'] = $apiKey;
     }
     // this endpoint requires API key authentication
     $apiKey = $this->apiClient->getApiKeyWithPrefix('x-test_api_client_secret');
     if (strlen($apiKey) !== 0) {
         $headerParams['x-test_api_client_secret'] = $apiKey;
     }
     // make the API Call
     try {
         list($response, $statusCode, $httpHeader) = $this->apiClient->callApi($resourcePath, 'POST', $queryParams, $httpBody, $headerParams, '\\Swagger\\Client\\Model\\Order');
         if (!$response) {
             return array(null, $statusCode, $httpHeader);
         }
         return array(\Swagger\Client\ObjectSerializer::deserialize($response, '\\Swagger\\Client\\Model\\Order', $httpHeader), $statusCode, $httpHeader);
     } catch (ApiException $e) {
         switch ($e->getCode()) {
             case 200:
                 $data = \Swagger\Client\ObjectSerializer::deserialize($e->getResponseBody(), '\\Swagger\\Client\\Model\\Order', $e->getResponseHeaders());
                 $e->setResponseObject($data);
                 break;
         }
         throw $e;
     }
 }