Exemplo n.º 1
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;
     }
 }
 /**
  * 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;
     }
 }
Exemplo n.º 3
0
 /**
  * getOrderByIdWithHttpInfo
  *
  * Find purchase order by ID
  *
  * @param string $order_id ID of pet that needs to be fetched (required)
  * @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 getOrderByIdWithHttpInfo($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 getOrderById');
     }
     // parse inputs
     $resourcePath = "/store/order/{orderId}";
     $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);
     }
     // 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)
     }
     // this endpoint requires API key authentication
     $apiKey = $this->apiClient->getApiKeyWithPrefix('test_api_key_header');
     if (strlen($apiKey) !== 0) {
         $headerParams['test_api_key_header'] = $apiKey;
     }
     // this endpoint requires API key authentication
     $apiKey = $this->apiClient->getApiKeyWithPrefix('test_api_key_query');
     if (strlen($apiKey) !== 0) {
         $queryParams['test_api_key_query'] = $apiKey;
     }
     // make the API Call
     try {
         list($response, $statusCode, $httpHeader) = $this->apiClient->callApi($resourcePath, 'GET', $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;
     }
 }
Exemplo n.º 4
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;
     }
 }
Exemplo n.º 5
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;
     }
 }
    public function testDeserializationOfMapOfMapOfOrder()
    {
        $order_json = <<<ORDER
{
  "test": {
    "test2": {
      "id": 10,
      "petId": 20,
      "quantity": 30,
      "shipDate": "2015-08-22T07:13:36.613Z",
      "status": "placed",
      "complete": false
    }
  }
}
ORDER;
        $order = \Swagger\Client\ObjectSerializer::deserialize(json_decode($order_json), 'map[string,map[string,\\Swagger\\Client\\Model\\Order]]');
        $this->assertArrayHasKey('test', $order);
        $this->assertArrayHasKey('test2', $order['test']);
        $_order = $order['test']['test2'];
        $this->assertInstanceOf('Swagger\\Client\\Model\\Order', $_order);
        $this->assertSame(10, $_order->getId());
        $this->assertSame(20, $_order->getPetId());
        $this->assertSame(30, $_order->getQuantity());
        $this->assertTrue(new \DateTime("2015-08-22T07:13:36.613Z") == $_order->getShipDate());
        $this->assertSame("placed", $_order->getStatus());
        $this->assertSame(false, $_order->getComplete());
    }
Exemplo n.º 7
0
 /**
  * loginUserWithHttpInfo
  *
  * Logs user into the system
  *
  * @param string $username The user name for login (optional)
  * @param string $password The password for login in clear text (optional)
  * @return Array of string, HTTP status code, HTTP response headers (array of strings)
  * @throws \Swagger\Client\ApiException on non-2xx response
  */
 public function loginUserWithHttpInfo($username = null, $password = null)
 {
     // parse inputs
     $resourcePath = "/user/login";
     $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());
     // query params
     if ($username !== null) {
         $queryParams['username'] = $this->apiClient->getSerializer()->toQueryValue($username);
     }
     // query params
     if ($password !== null) {
         $queryParams['password'] = $this->apiClient->getSerializer()->toQueryValue($password);
     }
     // 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, 'string');
         if (!$response) {
             return array(null, $statusCode, $httpHeader);
         }
         return array(\Swagger\Client\ObjectSerializer::deserialize($response, 'string', $httpHeader), $statusCode, $httpHeader);
     } catch (ApiException $e) {
         switch ($e->getCode()) {
             case 200:
                 $data = \Swagger\Client\ObjectSerializer::deserialize($e->getResponseBody(), 'string', $e->getResponseHeaders());
                 $e->setResponseObject($data);
                 break;
         }
         throw $e;
     }
 }
Exemplo n.º 8
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;
     }
 }