Merge pull request #604 from wing328/php_fix_warning

Fixed PHP5.3 warning
This commit is contained in:
Tony Tam 2015-04-08 05:01:54 -06:00
commit eb2ec92b66
7 changed files with 201 additions and 103 deletions

View File

@ -25,6 +25,16 @@ class APIClient {
public static $PUT = "PUT"; public static $PUT = "PUT";
public static $DELETE = "DELETE"; public static $DELETE = "DELETE";
/*
* @var string timeout (second) of the HTTP request, by default set to 0, no timeout
*/
protected $curl_timeout = 0;
/*
* @var string user agent of the HTTP request, set to "PHP-Swagger" by default
*/
protected $user_agent = "PHP-Swagger";
/** /**
* @param string $host the address of the API server * @param string $host the address of the API server
* @param string $headerName a header to pass on requests * @param string $headerName a header to pass on requests
@ -54,7 +64,7 @@ class APIClient {
if (!is_numeric($seconds)) { if (!is_numeric($seconds)) {
throw new Exception('Timeout variable must be numeric.'); throw new Exception('Timeout variable must be numeric.');
} }
$this->curl_timout = $seconds; $this->curl_timeout = $seconds;
} }
/** /**
@ -84,15 +94,16 @@ class APIClient {
$headers[] = $this->headerName . ": " . $this->headerValue; $headers[] = $this->headerName . ": " . $this->headerValue;
} }
if (strpos($headers['Content-Type'], "multipart/form-data") < 0 and (is_object($postData) or is_array($postData))) { if ((isset($headers['Content-Type']) and strpos($headers['Content-Type'], "multipart/form-data") < 0) and (is_object($postData) or is_array($postData))) {
$postData = json_encode($this->sanitizeForSerialization($postData)); $postData = json_encode($this->sanitizeForSerialization($postData));
} }
$url = $this->host . $resourcePath; $url = $this->host . $resourcePath;
$curl = curl_init(); $curl = curl_init();
if ($this->curl_timout) { // set timeout, if needed
curl_setopt($curl, CURLOPT_TIMEOUT, $this->curl_timout); if ($this->curl_timeout != 0) {
curl_setopt($curl, CURLOPT_TIMEOUT, $this->curl_timeout);
} }
// return the result on success, rather than just TRUE // return the result on success, rather than just TRUE
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true); curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
@ -120,11 +131,7 @@ class APIClient {
curl_setopt($curl, CURLOPT_URL, $url); curl_setopt($curl, CURLOPT_URL, $url);
// Set user agent // Set user agent
if ($this->user_agent) { curl_setopt($curl, CURLOPT_USERAGENT, $this->user_agent);
curl_setopt($curl, CURLOPT_USERAGENT, $this->user_agent);
} else { // use PHP-Swagger as the default user agent
curl_setopt($curl, CURLOPT_USERAGENT, 'PHP-Swagger');
}
// Make the request // Make the request
$response = curl_exec($curl); $response = curl_exec($curl);

View File

@ -44,6 +44,7 @@ class {{classname}} {
$resourcePath = "{{path}}"; $resourcePath = "{{path}}";
$resourcePath = str_replace("{format}", "json", $resourcePath); $resourcePath = str_replace("{format}", "json", $resourcePath);
$method = "{{httpMethod}}"; $method = "{{httpMethod}}";
$httpBody = '';
$queryParams = array(); $queryParams = array();
$headerParams = array(); $headerParams = array();
$formParams = array(); $formParams = array();
@ -77,16 +78,19 @@ class {{classname}} {
$body = ${{paramName}}; $body = ${{paramName}};
}{{/bodyParams}} }{{/bodyParams}}
// for model (json/xml)
if (isset($body)) {
$httpBody = $body; // $body is the method argument, if present
}
// for HTTP post (form) // for HTTP post (form)
$body = $body ?: $formParams;
if (strpos($headerParams['Content-Type'], "application/x-www-form-urlencoded") > -1) { if (strpos($headerParams['Content-Type'], "application/x-www-form-urlencoded") > -1) {
$body = http_build_query($body); $httpBody = http_build_query($formParams);
} }
// make the API Call // make the API Call
$response = $this->apiClient->callAPI($resourcePath, $method, $response = $this->apiClient->callAPI($resourcePath, $method,
$queryParams, $body, $queryParams, $httpBody,
$headerParams); $headerParams);
{{#returnType}}if(! $response) { {{#returnType}}if(! $response) {

View File

@ -25,6 +25,16 @@ class APIClient {
public static $PUT = "PUT"; public static $PUT = "PUT";
public static $DELETE = "DELETE"; public static $DELETE = "DELETE";
/*
* @var string timeout (second) of the HTTP request, by default set to 0, no timeout
*/
protected $curl_timeout = 0;
/*
* @var string user agent of the HTTP request, set to "PHP-Swagger" by default
*/
protected $user_agent = "PHP-Swagger";
/** /**
* @param string $host the address of the API server * @param string $host the address of the API server
* @param string $headerName a header to pass on requests * @param string $headerName a header to pass on requests
@ -54,7 +64,7 @@ class APIClient {
if (!is_numeric($seconds)) { if (!is_numeric($seconds)) {
throw new Exception('Timeout variable must be numeric.'); throw new Exception('Timeout variable must be numeric.');
} }
$this->curl_timout = $seconds; $this->curl_timeout = $seconds;
} }
/** /**
@ -84,15 +94,16 @@ class APIClient {
$headers[] = $this->headerName . ": " . $this->headerValue; $headers[] = $this->headerName . ": " . $this->headerValue;
} }
if (strpos($headers['Content-Type'], "multipart/form-data") < 0 and (is_object($postData) or is_array($postData))) { if ((isset($headers['Content-Type']) and strpos($headers['Content-Type'], "multipart/form-data") < 0) and (is_object($postData) or is_array($postData))) {
$postData = json_encode($this->sanitizeForSerialization($postData)); $postData = json_encode($this->sanitizeForSerialization($postData));
} }
$url = $this->host . $resourcePath; $url = $this->host . $resourcePath;
$curl = curl_init(); $curl = curl_init();
if ($this->curl_timout) { // set timeout, if needed
curl_setopt($curl, CURLOPT_TIMEOUT, $this->curl_timout); if ($this->curl_timeout != 0) {
curl_setopt($curl, CURLOPT_TIMEOUT, $this->curl_timeout);
} }
// return the result on success, rather than just TRUE // return the result on success, rather than just TRUE
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true); curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
@ -120,11 +131,7 @@ class APIClient {
curl_setopt($curl, CURLOPT_URL, $url); curl_setopt($curl, CURLOPT_URL, $url);
// Set user agent // Set user agent
if ($this->user_agent) { curl_setopt($curl, CURLOPT_USERAGENT, $this->user_agent);
curl_setopt($curl, CURLOPT_USERAGENT, $this->user_agent);
} else { // use PHP-Swagger as the default user agent
curl_setopt($curl, CURLOPT_USERAGENT, 'PHP-Swagger');
}
// Make the request // Make the request
$response = curl_exec($curl); $response = curl_exec($curl);

View File

@ -43,6 +43,7 @@ class PetApi {
$resourcePath = "/pet"; $resourcePath = "/pet";
$resourcePath = str_replace("{format}", "json", $resourcePath); $resourcePath = str_replace("{format}", "json", $resourcePath);
$method = "PUT"; $method = "PUT";
$httpBody = '';
$queryParams = array(); $queryParams = array();
$headerParams = array(); $headerParams = array();
$formParams = array(); $formParams = array();
@ -63,16 +64,19 @@ class PetApi {
$body = $body; $body = $body;
} }
// for model (json/xml)
if (isset($body)) {
$httpBody = $body; // $body is the method argument, if present
}
// for HTTP post (form) // for HTTP post (form)
$body = $body ?: $formParams;
if (strpos($headerParams['Content-Type'], "application/x-www-form-urlencoded") > -1) { if (strpos($headerParams['Content-Type'], "application/x-www-form-urlencoded") > -1) {
$body = http_build_query($body); $httpBody = http_build_query($formParams);
} }
// make the API Call // make the API Call
$response = $this->apiClient->callAPI($resourcePath, $method, $response = $this->apiClient->callAPI($resourcePath, $method,
$queryParams, $body, $queryParams, $httpBody,
$headerParams); $headerParams);
@ -92,6 +96,7 @@ class PetApi {
$resourcePath = "/pet"; $resourcePath = "/pet";
$resourcePath = str_replace("{format}", "json", $resourcePath); $resourcePath = str_replace("{format}", "json", $resourcePath);
$method = "POST"; $method = "POST";
$httpBody = '';
$queryParams = array(); $queryParams = array();
$headerParams = array(); $headerParams = array();
$formParams = array(); $formParams = array();
@ -112,16 +117,19 @@ class PetApi {
$body = $body; $body = $body;
} }
// for model (json/xml)
if (isset($body)) {
$httpBody = $body; // $body is the method argument, if present
}
// for HTTP post (form) // for HTTP post (form)
$body = $body ?: $formParams;
if (strpos($headerParams['Content-Type'], "application/x-www-form-urlencoded") > -1) { if (strpos($headerParams['Content-Type'], "application/x-www-form-urlencoded") > -1) {
$body = http_build_query($body); $httpBody = http_build_query($formParams);
} }
// make the API Call // make the API Call
$response = $this->apiClient->callAPI($resourcePath, $method, $response = $this->apiClient->callAPI($resourcePath, $method,
$queryParams, $body, $queryParams, $httpBody,
$headerParams); $headerParams);
@ -141,6 +149,7 @@ class PetApi {
$resourcePath = "/pet/findByStatus"; $resourcePath = "/pet/findByStatus";
$resourcePath = str_replace("{format}", "json", $resourcePath); $resourcePath = str_replace("{format}", "json", $resourcePath);
$method = "GET"; $method = "GET";
$httpBody = '';
$queryParams = array(); $queryParams = array();
$headerParams = array(); $headerParams = array();
$formParams = array(); $formParams = array();
@ -160,16 +169,19 @@ class PetApi {
// for model (json/xml)
if (isset($body)) {
$httpBody = $body; // $body is the method argument, if present
}
// for HTTP post (form) // for HTTP post (form)
$body = $body ?: $formParams;
if (strpos($headerParams['Content-Type'], "application/x-www-form-urlencoded") > -1) { if (strpos($headerParams['Content-Type'], "application/x-www-form-urlencoded") > -1) {
$body = http_build_query($body); $httpBody = http_build_query($formParams);
} }
// make the API Call // make the API Call
$response = $this->apiClient->callAPI($resourcePath, $method, $response = $this->apiClient->callAPI($resourcePath, $method,
$queryParams, $body, $queryParams, $httpBody,
$headerParams); $headerParams);
if(! $response) { if(! $response) {
@ -195,6 +207,7 @@ class PetApi {
$resourcePath = "/pet/findByTags"; $resourcePath = "/pet/findByTags";
$resourcePath = str_replace("{format}", "json", $resourcePath); $resourcePath = str_replace("{format}", "json", $resourcePath);
$method = "GET"; $method = "GET";
$httpBody = '';
$queryParams = array(); $queryParams = array();
$headerParams = array(); $headerParams = array();
$formParams = array(); $formParams = array();
@ -214,16 +227,19 @@ class PetApi {
// for model (json/xml)
if (isset($body)) {
$httpBody = $body; // $body is the method argument, if present
}
// for HTTP post (form) // for HTTP post (form)
$body = $body ?: $formParams;
if (strpos($headerParams['Content-Type'], "application/x-www-form-urlencoded") > -1) { if (strpos($headerParams['Content-Type'], "application/x-www-form-urlencoded") > -1) {
$body = http_build_query($body); $httpBody = http_build_query($formParams);
} }
// make the API Call // make the API Call
$response = $this->apiClient->callAPI($resourcePath, $method, $response = $this->apiClient->callAPI($resourcePath, $method,
$queryParams, $body, $queryParams, $httpBody,
$headerParams); $headerParams);
if(! $response) { if(! $response) {
@ -249,6 +265,7 @@ class PetApi {
$resourcePath = "/pet/{petId}"; $resourcePath = "/pet/{petId}";
$resourcePath = str_replace("{format}", "json", $resourcePath); $resourcePath = str_replace("{format}", "json", $resourcePath);
$method = "GET"; $method = "GET";
$httpBody = '';
$queryParams = array(); $queryParams = array();
$headerParams = array(); $headerParams = array();
$formParams = array(); $formParams = array();
@ -269,16 +286,19 @@ class PetApi {
// for model (json/xml)
if (isset($body)) {
$httpBody = $body; // $body is the method argument, if present
}
// for HTTP post (form) // for HTTP post (form)
$body = $body ?: $formParams;
if (strpos($headerParams['Content-Type'], "application/x-www-form-urlencoded") > -1) { if (strpos($headerParams['Content-Type'], "application/x-www-form-urlencoded") > -1) {
$body = http_build_query($body); $httpBody = http_build_query($formParams);
} }
// make the API Call // make the API Call
$response = $this->apiClient->callAPI($resourcePath, $method, $response = $this->apiClient->callAPI($resourcePath, $method,
$queryParams, $body, $queryParams, $httpBody,
$headerParams); $headerParams);
if(! $response) { if(! $response) {
@ -306,6 +326,7 @@ class PetApi {
$resourcePath = "/pet/{petId}"; $resourcePath = "/pet/{petId}";
$resourcePath = str_replace("{format}", "json", $resourcePath); $resourcePath = str_replace("{format}", "json", $resourcePath);
$method = "POST"; $method = "POST";
$httpBody = '';
$queryParams = array(); $queryParams = array();
$headerParams = array(); $headerParams = array();
$formParams = array(); $formParams = array();
@ -332,16 +353,19 @@ class PetApi {
} }
// for model (json/xml)
if (isset($body)) {
$httpBody = $body; // $body is the method argument, if present
}
// for HTTP post (form) // for HTTP post (form)
$body = $body ?: $formParams;
if (strpos($headerParams['Content-Type'], "application/x-www-form-urlencoded") > -1) { if (strpos($headerParams['Content-Type'], "application/x-www-form-urlencoded") > -1) {
$body = http_build_query($body); $httpBody = http_build_query($formParams);
} }
// make the API Call // make the API Call
$response = $this->apiClient->callAPI($resourcePath, $method, $response = $this->apiClient->callAPI($resourcePath, $method,
$queryParams, $body, $queryParams, $httpBody,
$headerParams); $headerParams);
@ -362,6 +386,7 @@ class PetApi {
$resourcePath = "/pet/{petId}"; $resourcePath = "/pet/{petId}";
$resourcePath = str_replace("{format}", "json", $resourcePath); $resourcePath = str_replace("{format}", "json", $resourcePath);
$method = "DELETE"; $method = "DELETE";
$httpBody = '';
$queryParams = array(); $queryParams = array();
$headerParams = array(); $headerParams = array();
$formParams = array(); $formParams = array();
@ -385,16 +410,19 @@ class PetApi {
// for model (json/xml)
if (isset($body)) {
$httpBody = $body; // $body is the method argument, if present
}
// for HTTP post (form) // for HTTP post (form)
$body = $body ?: $formParams;
if (strpos($headerParams['Content-Type'], "application/x-www-form-urlencoded") > -1) { if (strpos($headerParams['Content-Type'], "application/x-www-form-urlencoded") > -1) {
$body = http_build_query($body); $httpBody = http_build_query($formParams);
} }
// make the API Call // make the API Call
$response = $this->apiClient->callAPI($resourcePath, $method, $response = $this->apiClient->callAPI($resourcePath, $method,
$queryParams, $body, $queryParams, $httpBody,
$headerParams); $headerParams);
@ -416,6 +444,7 @@ class PetApi {
$resourcePath = "/pet/{petId}/uploadImage"; $resourcePath = "/pet/{petId}/uploadImage";
$resourcePath = str_replace("{format}", "json", $resourcePath); $resourcePath = str_replace("{format}", "json", $resourcePath);
$method = "POST"; $method = "POST";
$httpBody = '';
$queryParams = array(); $queryParams = array();
$headerParams = array(); $headerParams = array();
$formParams = array(); $formParams = array();
@ -442,16 +471,19 @@ class PetApi {
} }
// for model (json/xml)
if (isset($body)) {
$httpBody = $body; // $body is the method argument, if present
}
// for HTTP post (form) // for HTTP post (form)
$body = $body ?: $formParams;
if (strpos($headerParams['Content-Type'], "application/x-www-form-urlencoded") > -1) { if (strpos($headerParams['Content-Type'], "application/x-www-form-urlencoded") > -1) {
$body = http_build_query($body); $httpBody = http_build_query($formParams);
} }
// make the API Call // make the API Call
$response = $this->apiClient->callAPI($resourcePath, $method, $response = $this->apiClient->callAPI($resourcePath, $method,
$queryParams, $body, $queryParams, $httpBody,
$headerParams); $headerParams);

View File

@ -42,6 +42,7 @@ class StoreApi {
$resourcePath = "/store/inventory"; $resourcePath = "/store/inventory";
$resourcePath = str_replace("{format}", "json", $resourcePath); $resourcePath = str_replace("{format}", "json", $resourcePath);
$method = "GET"; $method = "GET";
$httpBody = '';
$queryParams = array(); $queryParams = array();
$headerParams = array(); $headerParams = array();
$formParams = array(); $formParams = array();
@ -58,16 +59,19 @@ class StoreApi {
// for model (json/xml)
if (isset($body)) {
$httpBody = $body; // $body is the method argument, if present
}
// for HTTP post (form) // for HTTP post (form)
$body = $body ?: $formParams;
if (strpos($headerParams['Content-Type'], "application/x-www-form-urlencoded") > -1) { if (strpos($headerParams['Content-Type'], "application/x-www-form-urlencoded") > -1) {
$body = http_build_query($body); $httpBody = http_build_query($formParams);
} }
// make the API Call // make the API Call
$response = $this->apiClient->callAPI($resourcePath, $method, $response = $this->apiClient->callAPI($resourcePath, $method,
$queryParams, $body, $queryParams, $httpBody,
$headerParams); $headerParams);
if(! $response) { if(! $response) {
@ -93,6 +97,7 @@ class StoreApi {
$resourcePath = "/store/order"; $resourcePath = "/store/order";
$resourcePath = str_replace("{format}", "json", $resourcePath); $resourcePath = str_replace("{format}", "json", $resourcePath);
$method = "POST"; $method = "POST";
$httpBody = '';
$queryParams = array(); $queryParams = array();
$headerParams = array(); $headerParams = array();
$formParams = array(); $formParams = array();
@ -113,16 +118,19 @@ class StoreApi {
$body = $body; $body = $body;
} }
// for model (json/xml)
if (isset($body)) {
$httpBody = $body; // $body is the method argument, if present
}
// for HTTP post (form) // for HTTP post (form)
$body = $body ?: $formParams;
if (strpos($headerParams['Content-Type'], "application/x-www-form-urlencoded") > -1) { if (strpos($headerParams['Content-Type'], "application/x-www-form-urlencoded") > -1) {
$body = http_build_query($body); $httpBody = http_build_query($formParams);
} }
// make the API Call // make the API Call
$response = $this->apiClient->callAPI($resourcePath, $method, $response = $this->apiClient->callAPI($resourcePath, $method,
$queryParams, $body, $queryParams, $httpBody,
$headerParams); $headerParams);
if(! $response) { if(! $response) {
@ -148,6 +156,7 @@ class StoreApi {
$resourcePath = "/store/order/{orderId}"; $resourcePath = "/store/order/{orderId}";
$resourcePath = str_replace("{format}", "json", $resourcePath); $resourcePath = str_replace("{format}", "json", $resourcePath);
$method = "GET"; $method = "GET";
$httpBody = '';
$queryParams = array(); $queryParams = array();
$headerParams = array(); $headerParams = array();
$formParams = array(); $formParams = array();
@ -168,16 +177,19 @@ class StoreApi {
// for model (json/xml)
if (isset($body)) {
$httpBody = $body; // $body is the method argument, if present
}
// for HTTP post (form) // for HTTP post (form)
$body = $body ?: $formParams;
if (strpos($headerParams['Content-Type'], "application/x-www-form-urlencoded") > -1) { if (strpos($headerParams['Content-Type'], "application/x-www-form-urlencoded") > -1) {
$body = http_build_query($body); $httpBody = http_build_query($formParams);
} }
// make the API Call // make the API Call
$response = $this->apiClient->callAPI($resourcePath, $method, $response = $this->apiClient->callAPI($resourcePath, $method,
$queryParams, $body, $queryParams, $httpBody,
$headerParams); $headerParams);
if(! $response) { if(! $response) {
@ -203,6 +215,7 @@ class StoreApi {
$resourcePath = "/store/order/{orderId}"; $resourcePath = "/store/order/{orderId}";
$resourcePath = str_replace("{format}", "json", $resourcePath); $resourcePath = str_replace("{format}", "json", $resourcePath);
$method = "DELETE"; $method = "DELETE";
$httpBody = '';
$queryParams = array(); $queryParams = array();
$headerParams = array(); $headerParams = array();
$formParams = array(); $formParams = array();
@ -223,16 +236,19 @@ class StoreApi {
// for model (json/xml)
if (isset($body)) {
$httpBody = $body; // $body is the method argument, if present
}
// for HTTP post (form) // for HTTP post (form)
$body = $body ?: $formParams;
if (strpos($headerParams['Content-Type'], "application/x-www-form-urlencoded") > -1) { if (strpos($headerParams['Content-Type'], "application/x-www-form-urlencoded") > -1) {
$body = http_build_query($body); $httpBody = http_build_query($formParams);
} }
// make the API Call // make the API Call
$response = $this->apiClient->callAPI($resourcePath, $method, $response = $this->apiClient->callAPI($resourcePath, $method,
$queryParams, $body, $queryParams, $httpBody,
$headerParams); $headerParams);

View File

@ -43,6 +43,7 @@ class UserApi {
$resourcePath = "/user"; $resourcePath = "/user";
$resourcePath = str_replace("{format}", "json", $resourcePath); $resourcePath = str_replace("{format}", "json", $resourcePath);
$method = "POST"; $method = "POST";
$httpBody = '';
$queryParams = array(); $queryParams = array();
$headerParams = array(); $headerParams = array();
$formParams = array(); $formParams = array();
@ -63,16 +64,19 @@ class UserApi {
$body = $body; $body = $body;
} }
// for model (json/xml)
if (isset($body)) {
$httpBody = $body; // $body is the method argument, if present
}
// for HTTP post (form) // for HTTP post (form)
$body = $body ?: $formParams;
if (strpos($headerParams['Content-Type'], "application/x-www-form-urlencoded") > -1) { if (strpos($headerParams['Content-Type'], "application/x-www-form-urlencoded") > -1) {
$body = http_build_query($body); $httpBody = http_build_query($formParams);
} }
// make the API Call // make the API Call
$response = $this->apiClient->callAPI($resourcePath, $method, $response = $this->apiClient->callAPI($resourcePath, $method,
$queryParams, $body, $queryParams, $httpBody,
$headerParams); $headerParams);
@ -92,6 +96,7 @@ class UserApi {
$resourcePath = "/user/createWithArray"; $resourcePath = "/user/createWithArray";
$resourcePath = str_replace("{format}", "json", $resourcePath); $resourcePath = str_replace("{format}", "json", $resourcePath);
$method = "POST"; $method = "POST";
$httpBody = '';
$queryParams = array(); $queryParams = array();
$headerParams = array(); $headerParams = array();
$formParams = array(); $formParams = array();
@ -112,16 +117,19 @@ class UserApi {
$body = $body; $body = $body;
} }
// for model (json/xml)
if (isset($body)) {
$httpBody = $body; // $body is the method argument, if present
}
// for HTTP post (form) // for HTTP post (form)
$body = $body ?: $formParams;
if (strpos($headerParams['Content-Type'], "application/x-www-form-urlencoded") > -1) { if (strpos($headerParams['Content-Type'], "application/x-www-form-urlencoded") > -1) {
$body = http_build_query($body); $httpBody = http_build_query($formParams);
} }
// make the API Call // make the API Call
$response = $this->apiClient->callAPI($resourcePath, $method, $response = $this->apiClient->callAPI($resourcePath, $method,
$queryParams, $body, $queryParams, $httpBody,
$headerParams); $headerParams);
@ -141,6 +149,7 @@ class UserApi {
$resourcePath = "/user/createWithList"; $resourcePath = "/user/createWithList";
$resourcePath = str_replace("{format}", "json", $resourcePath); $resourcePath = str_replace("{format}", "json", $resourcePath);
$method = "POST"; $method = "POST";
$httpBody = '';
$queryParams = array(); $queryParams = array();
$headerParams = array(); $headerParams = array();
$formParams = array(); $formParams = array();
@ -161,16 +170,19 @@ class UserApi {
$body = $body; $body = $body;
} }
// for model (json/xml)
if (isset($body)) {
$httpBody = $body; // $body is the method argument, if present
}
// for HTTP post (form) // for HTTP post (form)
$body = $body ?: $formParams;
if (strpos($headerParams['Content-Type'], "application/x-www-form-urlencoded") > -1) { if (strpos($headerParams['Content-Type'], "application/x-www-form-urlencoded") > -1) {
$body = http_build_query($body); $httpBody = http_build_query($formParams);
} }
// make the API Call // make the API Call
$response = $this->apiClient->callAPI($resourcePath, $method, $response = $this->apiClient->callAPI($resourcePath, $method,
$queryParams, $body, $queryParams, $httpBody,
$headerParams); $headerParams);
@ -191,6 +203,7 @@ class UserApi {
$resourcePath = "/user/login"; $resourcePath = "/user/login";
$resourcePath = str_replace("{format}", "json", $resourcePath); $resourcePath = str_replace("{format}", "json", $resourcePath);
$method = "GET"; $method = "GET";
$httpBody = '';
$queryParams = array(); $queryParams = array();
$headerParams = array(); $headerParams = array();
$formParams = array(); $formParams = array();
@ -213,16 +226,19 @@ class UserApi {
// for model (json/xml)
if (isset($body)) {
$httpBody = $body; // $body is the method argument, if present
}
// for HTTP post (form) // for HTTP post (form)
$body = $body ?: $formParams;
if (strpos($headerParams['Content-Type'], "application/x-www-form-urlencoded") > -1) { if (strpos($headerParams['Content-Type'], "application/x-www-form-urlencoded") > -1) {
$body = http_build_query($body); $httpBody = http_build_query($formParams);
} }
// make the API Call // make the API Call
$response = $this->apiClient->callAPI($resourcePath, $method, $response = $this->apiClient->callAPI($resourcePath, $method,
$queryParams, $body, $queryParams, $httpBody,
$headerParams); $headerParams);
if(! $response) { if(! $response) {
@ -247,6 +263,7 @@ class UserApi {
$resourcePath = "/user/logout"; $resourcePath = "/user/logout";
$resourcePath = str_replace("{format}", "json", $resourcePath); $resourcePath = str_replace("{format}", "json", $resourcePath);
$method = "GET"; $method = "GET";
$httpBody = '';
$queryParams = array(); $queryParams = array();
$headerParams = array(); $headerParams = array();
$formParams = array(); $formParams = array();
@ -263,16 +280,19 @@ class UserApi {
// for model (json/xml)
if (isset($body)) {
$httpBody = $body; // $body is the method argument, if present
}
// for HTTP post (form) // for HTTP post (form)
$body = $body ?: $formParams;
if (strpos($headerParams['Content-Type'], "application/x-www-form-urlencoded") > -1) { if (strpos($headerParams['Content-Type'], "application/x-www-form-urlencoded") > -1) {
$body = http_build_query($body); $httpBody = http_build_query($formParams);
} }
// make the API Call // make the API Call
$response = $this->apiClient->callAPI($resourcePath, $method, $response = $this->apiClient->callAPI($resourcePath, $method,
$queryParams, $body, $queryParams, $httpBody,
$headerParams); $headerParams);
@ -292,6 +312,7 @@ class UserApi {
$resourcePath = "/user/{username}"; $resourcePath = "/user/{username}";
$resourcePath = str_replace("{format}", "json", $resourcePath); $resourcePath = str_replace("{format}", "json", $resourcePath);
$method = "GET"; $method = "GET";
$httpBody = '';
$queryParams = array(); $queryParams = array();
$headerParams = array(); $headerParams = array();
$formParams = array(); $formParams = array();
@ -312,16 +333,19 @@ class UserApi {
// for model (json/xml)
if (isset($body)) {
$httpBody = $body; // $body is the method argument, if present
}
// for HTTP post (form) // for HTTP post (form)
$body = $body ?: $formParams;
if (strpos($headerParams['Content-Type'], "application/x-www-form-urlencoded") > -1) { if (strpos($headerParams['Content-Type'], "application/x-www-form-urlencoded") > -1) {
$body = http_build_query($body); $httpBody = http_build_query($formParams);
} }
// make the API Call // make the API Call
$response = $this->apiClient->callAPI($resourcePath, $method, $response = $this->apiClient->callAPI($resourcePath, $method,
$queryParams, $body, $queryParams, $httpBody,
$headerParams); $headerParams);
if(! $response) { if(! $response) {
@ -348,6 +372,7 @@ class UserApi {
$resourcePath = "/user/{username}"; $resourcePath = "/user/{username}";
$resourcePath = str_replace("{format}", "json", $resourcePath); $resourcePath = str_replace("{format}", "json", $resourcePath);
$method = "PUT"; $method = "PUT";
$httpBody = '';
$queryParams = array(); $queryParams = array();
$headerParams = array(); $headerParams = array();
$formParams = array(); $formParams = array();
@ -372,16 +397,19 @@ class UserApi {
$body = $body; $body = $body;
} }
// for model (json/xml)
if (isset($body)) {
$httpBody = $body; // $body is the method argument, if present
}
// for HTTP post (form) // for HTTP post (form)
$body = $body ?: $formParams;
if (strpos($headerParams['Content-Type'], "application/x-www-form-urlencoded") > -1) { if (strpos($headerParams['Content-Type'], "application/x-www-form-urlencoded") > -1) {
$body = http_build_query($body); $httpBody = http_build_query($formParams);
} }
// make the API Call // make the API Call
$response = $this->apiClient->callAPI($resourcePath, $method, $response = $this->apiClient->callAPI($resourcePath, $method,
$queryParams, $body, $queryParams, $httpBody,
$headerParams); $headerParams);
@ -401,6 +429,7 @@ class UserApi {
$resourcePath = "/user/{username}"; $resourcePath = "/user/{username}";
$resourcePath = str_replace("{format}", "json", $resourcePath); $resourcePath = str_replace("{format}", "json", $resourcePath);
$method = "DELETE"; $method = "DELETE";
$httpBody = '';
$queryParams = array(); $queryParams = array();
$headerParams = array(); $headerParams = array();
$formParams = array(); $formParams = array();
@ -421,16 +450,19 @@ class UserApi {
// for model (json/xml)
if (isset($body)) {
$httpBody = $body; // $body is the method argument, if present
}
// for HTTP post (form) // for HTTP post (form)
$body = $body ?: $formParams;
if (strpos($headerParams['Content-Type'], "application/x-www-form-urlencoded") > -1) { if (strpos($headerParams['Content-Type'], "application/x-www-form-urlencoded") > -1) {
$body = http_build_query($body); $httpBody = http_build_query($formParams);
} }
// make the API Call // make the API Call
$response = $this->apiClient->callAPI($resourcePath, $method, $response = $this->apiClient->callAPI($resourcePath, $method,
$queryParams, $body, $queryParams, $httpBody,
$headerParams); $headerParams);

View File

@ -16,7 +16,7 @@
*/ */
/** /**
* testing category description *
* *
* NOTE: This class is auto generated by the swagger code generator program. Do not edit the class manually. * NOTE: This class is auto generated by the swagger code generator program. Do not edit the class manually.
* *