当前位置: 首页>>代码示例>>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;未经允许,请勿转载。