當前位置: 首頁>>代碼示例>>PHP>>正文


PHP ObjectSerializer::deserialize方法代碼示例

本文整理匯總了PHP中Swagger\Client\ObjectSerializer::deserialize方法的典型用法代碼示例。如果您正苦於以下問題:PHP ObjectSerializer::deserialize方法的具體用法?PHP ObjectSerializer::deserialize怎麽用?PHP ObjectSerializer::deserialize使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Swagger\Client\ObjectSerializer的用法示例。


在下文中一共展示了ObjectSerializer::deserialize方法的8個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: updateWithHttpInfo

 /**
  * 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;
     }
 }
開發者ID:profitbricks,項目名稱:profitbricks-sdk-php,代碼行數:94,代碼來源:LanApi.php

示例2: complaintsComplaintsWithHttpInfo

 /**
  * 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;
     }
 }
開發者ID:CallControl,項目名稱:CallControlClient,代碼行數:57,代碼來源:ComplaintsApi.php

示例3: getOrderByIdWithHttpInfo

 /**
  * 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;
     }
 }
開發者ID:SocialSuperstore,項目名稱:swagger-codegen,代碼行數:67,代碼來源:StoreApi.php

示例4: getPetsWithHttpInfo

 /**
  * 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;
     }
 }
開發者ID:wing328,項目名稱:petstore-php,代碼行數:48,代碼來源:PetsApi.php

示例5: signUpWithHttpInfo

 /**
  * 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;
     }
 }
開發者ID:CloudBoost,項目名稱:swagger,代碼行數:67,代碼來源:CloudUserApi.php

示例6: testDeserializationOfMapOfMapOfOrder

    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());
    }
開發者ID:mateuszmackowiak,項目名稱:swagger-codegen,代碼行數:28,代碼來源:OrderTest.php

示例7: loginUserWithHttpInfo

 /**
  * 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;
     }
 }
開發者ID:MarekMatejak,項目名稱:swagger-codegen,代碼行數:58,代碼來源:UserApi.php

示例8: placeOrderWithHttpInfo

 /**
  * 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;
     }
 }
開發者ID:MarekMatejak,項目名稱:swagger-codegen,代碼行數:64,代碼來源:StoreApi.php


注:本文中的Swagger\Client\ObjectSerializer::deserialize方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。