forked from loafle/openapi-generator-original
temporary folder setting
This commit is contained in:
parent
7f31da734d
commit
259b31ccd4
@ -19,206 +19,206 @@ namespace {{invokerPackage}};
|
|||||||
|
|
||||||
class ApiClient {
|
class ApiClient {
|
||||||
|
|
||||||
public static $PATCH = "PATCH";
|
public static $PATCH = "PATCH";
|
||||||
public static $POST = "POST";
|
public static $POST = "POST";
|
||||||
public static $GET = "GET";
|
public static $GET = "GET";
|
||||||
public static $PUT = "PUT";
|
public static $PUT = "PUT";
|
||||||
public static $DELETE = "DELETE";
|
public static $DELETE = "DELETE";
|
||||||
|
|
||||||
/** @var Configuration */
|
/** @var Configuration */
|
||||||
protected $config;
|
protected $config;
|
||||||
|
|
||||||
/** @var ObjectSerializer */
|
/** @var ObjectSerializer */
|
||||||
protected $serializer;
|
protected $serializer;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param Configuration $config config for this ApiClient
|
* @param Configuration $config config for this ApiClient
|
||||||
*/
|
*/
|
||||||
function __construct(Configuration $config = null) {
|
function __construct(Configuration $config = null) {
|
||||||
if ($config == null) {
|
if ($config == null) {
|
||||||
$config = Configuration::getDefaultConfiguration();
|
$config = Configuration::getDefaultConfiguration();
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->config = $config;
|
||||||
|
$this->serializer = new ObjectSerializer();
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->config = $config;
|
/**
|
||||||
$this->serializer = new ObjectSerializer();
|
* get the config
|
||||||
}
|
* @return Configuration
|
||||||
|
*/
|
||||||
/**
|
public function getConfig() {
|
||||||
* get the config
|
return $this->config;
|
||||||
* @return Configuration
|
|
||||||
*/
|
|
||||||
public function getConfig() {
|
|
||||||
return $this->config;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* get the serializer
|
|
||||||
* @return ObjectSerializer
|
|
||||||
*/
|
|
||||||
public function getSerializer() {
|
|
||||||
return $this->serializer;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get API key (with prefix if set)
|
|
||||||
* @param string $apiKey name of apikey
|
|
||||||
* @return string API key with the prefix
|
|
||||||
*/
|
|
||||||
public function getApiKeyWithPrefix($apiKey) {
|
|
||||||
$prefix = $this->config->getApiKeyPrefix($apiKey);
|
|
||||||
$apiKey = $this->config->getApiKey($apiKey);
|
|
||||||
|
|
||||||
if (!isset($apiKey)) {
|
|
||||||
return null;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isset($prefix)) {
|
/**
|
||||||
$keyWithPrefix = $prefix." ".$apiKey;
|
* get the serializer
|
||||||
} else {
|
* @return ObjectSerializer
|
||||||
$keyWithPrefix = $apiKey;
|
*/
|
||||||
|
public function getSerializer() {
|
||||||
|
return $this->serializer;
|
||||||
}
|
}
|
||||||
|
|
||||||
return $keyWithPrefix;
|
/**
|
||||||
}
|
* Get API key (with prefix if set)
|
||||||
|
* @param string $apiKey name of apikey
|
||||||
|
* @return string API key with the prefix
|
||||||
|
*/
|
||||||
|
public function getApiKeyWithPrefix($apiKeyIdentifier) {
|
||||||
|
$prefix = $this->config->getApiKeyPrefix($apiKeyIdentifier);
|
||||||
|
$apiKey = $this->config->getApiKey($apiKeyIdentifier);
|
||||||
|
|
||||||
/**
|
if (!isset($apiKey)) {
|
||||||
* @param string $resourcePath path to method endpoint
|
return null;
|
||||||
* @param string $method method to call
|
}
|
||||||
* @param array $queryParams parameters to be place in query URL
|
|
||||||
* @param array $postData parameters to be placed in POST body
|
|
||||||
* @param array $headerParams parameters to be place in request header
|
|
||||||
* @throws \{{invokerPackage}}\ApiException on a non 2xx response
|
|
||||||
* @return mixed
|
|
||||||
*/
|
|
||||||
public function callApi($resourcePath, $method, $queryParams, $postData, $headerParams, $responseType=null) {
|
|
||||||
|
|
||||||
$headers = array();
|
if (isset($prefix)) {
|
||||||
|
$keyWithPrefix = $prefix." ".$apiKey;
|
||||||
|
} else {
|
||||||
|
$keyWithPrefix = $apiKey;
|
||||||
|
}
|
||||||
|
|
||||||
# construct the http header
|
return $keyWithPrefix;
|
||||||
$headerParams = array_merge((array)$this->config->getDefaultHeaders(), (array)$headerParams);
|
|
||||||
|
|
||||||
foreach ($headerParams as $key => $val) {
|
|
||||||
$headers[] = "$key: $val";
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// form data
|
/**
|
||||||
if ($postData and in_array('Content-Type: application/x-www-form-urlencoded', $headers)) {
|
* @param string $resourcePath path to method endpoint
|
||||||
$postData = http_build_query($postData);
|
* @param string $method method to call
|
||||||
}
|
* @param array $queryParams parameters to be place in query URL
|
||||||
else if ((is_object($postData) or is_array($postData)) and !in_array('Content-Type: multipart/form-data', $headers)) { // json model
|
* @param array $postData parameters to be placed in POST body
|
||||||
$postData = json_encode($this->serializer->sanitizeForSerialization($postData));
|
* @param array $headerParams parameters to be place in request header
|
||||||
|
* @throws \{{invokerPackage}}\ApiException on a non 2xx response
|
||||||
|
* @return mixed
|
||||||
|
*/
|
||||||
|
public function callApi($resourcePath, $method, $queryParams, $postData, $headerParams, $responseType=null) {
|
||||||
|
|
||||||
|
$headers = array();
|
||||||
|
|
||||||
|
# construct the http header
|
||||||
|
$headerParams = array_merge((array)$this->config->getDefaultHeaders(), (array)$headerParams);
|
||||||
|
|
||||||
|
foreach ($headerParams as $key => $val) {
|
||||||
|
$headers[] = "$key: $val";
|
||||||
|
}
|
||||||
|
|
||||||
|
// form data
|
||||||
|
if ($postData and in_array('Content-Type: application/x-www-form-urlencoded', $headers)) {
|
||||||
|
$postData = http_build_query($postData);
|
||||||
|
}
|
||||||
|
else if ((is_object($postData) or is_array($postData)) and !in_array('Content-Type: multipart/form-data', $headers)) { // json model
|
||||||
|
$postData = json_encode($this->serializer->sanitizeForSerialization($postData));
|
||||||
|
}
|
||||||
|
|
||||||
|
$url = $this->config->getHost() . $resourcePath;
|
||||||
|
|
||||||
|
$curl = curl_init();
|
||||||
|
// set timeout, if needed
|
||||||
|
if ($this->config->getCurlTimeout() != 0) {
|
||||||
|
curl_setopt($curl, CURLOPT_TIMEOUT, $this->config->getCurlTimeout());
|
||||||
|
}
|
||||||
|
// return the result on success, rather than just TRUE
|
||||||
|
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
|
||||||
|
|
||||||
|
curl_setopt($curl, CURLOPT_HTTPHEADER, $headers);
|
||||||
|
|
||||||
|
if (! empty($queryParams)) {
|
||||||
|
$url = ($url . '?' . http_build_query($queryParams));
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($method == self::$POST) {
|
||||||
|
curl_setopt($curl, CURLOPT_POST, true);
|
||||||
|
curl_setopt($curl, CURLOPT_POSTFIELDS, $postData);
|
||||||
|
} else if ($method == self::$PATCH) {
|
||||||
|
curl_setopt($curl, CURLOPT_CUSTOMREQUEST, "PATCH");
|
||||||
|
curl_setopt($curl, CURLOPT_POSTFIELDS, $postData);
|
||||||
|
} else if ($method == self::$PUT) {
|
||||||
|
curl_setopt($curl, CURLOPT_CUSTOMREQUEST, "PUT");
|
||||||
|
curl_setopt($curl, CURLOPT_POSTFIELDS, $postData);
|
||||||
|
} else if ($method == self::$DELETE) {
|
||||||
|
curl_setopt($curl, CURLOPT_CUSTOMREQUEST, "DELETE");
|
||||||
|
curl_setopt($curl, CURLOPT_POSTFIELDS, $postData);
|
||||||
|
} else if ($method != self::$GET) {
|
||||||
|
throw new ApiException('Method ' . $method . ' is not recognized.');
|
||||||
|
}
|
||||||
|
curl_setopt($curl, CURLOPT_URL, $url);
|
||||||
|
|
||||||
|
// Set user agent
|
||||||
|
curl_setopt($curl, CURLOPT_USERAGENT, $this->config->getUserAgent());
|
||||||
|
|
||||||
|
// debugging for curl
|
||||||
|
if ($this->config->getDebug()) {
|
||||||
|
error_log("[DEBUG] HTTP Request body ~BEGIN~\n".print_r($postData, true)."\n~END~\n", 3, $this->config->getDebugFile());
|
||||||
|
|
||||||
|
curl_setopt($curl, CURLOPT_VERBOSE, 1);
|
||||||
|
curl_setopt($curl, CURLOPT_STDERR, fopen($this->config->getDebugFile(), 'a'));
|
||||||
|
} else {
|
||||||
|
curl_setopt($curl, CURLOPT_VERBOSE, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
// obtain the HTTP response headers
|
||||||
|
curl_setopt($curl, CURLOPT_HEADER, 1);
|
||||||
|
|
||||||
|
// Make the request
|
||||||
|
$response = curl_exec($curl);
|
||||||
|
$http_header_size = curl_getinfo($curl, CURLINFO_HEADER_SIZE);
|
||||||
|
$http_header = substr($response, 0, $http_header_size);
|
||||||
|
$http_body = substr($response, $http_header_size);
|
||||||
|
$response_info = curl_getinfo($curl);
|
||||||
|
|
||||||
|
// debug HTTP response body
|
||||||
|
if ($this->config->getDebug()) {
|
||||||
|
error_log("[DEBUG] HTTP Response body ~BEGIN~\n".print_r($http_body, true)."\n~END~\n", 3, $this->config->getDebugFile());
|
||||||
|
}
|
||||||
|
|
||||||
|
// Handle the response
|
||||||
|
if ($response_info['http_code'] == 0) {
|
||||||
|
throw new ApiException("API call to $url timed out: ".serialize($response_info), 0, null, null);
|
||||||
|
} else if ($response_info['http_code'] >= 200 && $response_info['http_code'] <= 299 ) {
|
||||||
|
// return raw body if response is a file
|
||||||
|
if ($responseType == '\SplFileObject') {
|
||||||
|
return array($http_body, $http_header);
|
||||||
|
}
|
||||||
|
|
||||||
|
$data = json_decode($http_body);
|
||||||
|
if (json_last_error() > 0) { // if response is a string
|
||||||
|
$data = $http_body;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
throw new ApiException("[".$response_info['http_code']."] Error connecting to the API ($url)",
|
||||||
|
$response_info['http_code'], $http_header, $http_body);
|
||||||
|
}
|
||||||
|
return array($data, $http_header);
|
||||||
}
|
}
|
||||||
|
|
||||||
$url = $this->config->getHost() . $resourcePath;
|
/*
|
||||||
|
* return the header 'Accept' based on an array of Accept provided
|
||||||
$curl = curl_init();
|
*
|
||||||
// set timeout, if needed
|
* @param string[] $accept Array of header
|
||||||
if ($this->config->getCurlTimeout() != 0) {
|
* @return string Accept (e.g. application/json)
|
||||||
curl_setopt($curl, CURLOPT_TIMEOUT, $this->config->getCurlTimeout());
|
*/
|
||||||
}
|
public static function selectHeaderAccept($accept) {
|
||||||
// return the result on success, rather than just TRUE
|
if (count($accept) === 0 or (count($accept) === 1 and $accept[0] === '')) {
|
||||||
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
|
return NULL;
|
||||||
|
} elseif (preg_grep("/application\/json/i", $accept)) {
|
||||||
curl_setopt($curl, CURLOPT_HTTPHEADER, $headers);
|
return 'application/json';
|
||||||
|
} else {
|
||||||
if (! empty($queryParams)) {
|
return implode(',', $accept);
|
||||||
$url = ($url . '?' . http_build_query($queryParams));
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($method == self::$POST) {
|
/*
|
||||||
curl_setopt($curl, CURLOPT_POST, true);
|
* return the content type based on an array of content-type provided
|
||||||
curl_setopt($curl, CURLOPT_POSTFIELDS, $postData);
|
*
|
||||||
} else if ($method == self::$PATCH) {
|
* @param string[] content_type_array Array fo content-type
|
||||||
curl_setopt($curl, CURLOPT_CUSTOMREQUEST, "PATCH");
|
* @return string Content-Type (e.g. application/json)
|
||||||
curl_setopt($curl, CURLOPT_POSTFIELDS, $postData);
|
*/
|
||||||
} else if ($method == self::$PUT) {
|
public static function selectHeaderContentType($content_type) {
|
||||||
curl_setopt($curl, CURLOPT_CUSTOMREQUEST, "PUT");
|
if (count($content_type) === 0 or (count($content_type) === 1 and $content_type[0] === '')) {
|
||||||
curl_setopt($curl, CURLOPT_POSTFIELDS, $postData);
|
return 'application/json';
|
||||||
} else if ($method == self::$DELETE) {
|
} elseif (preg_grep("/application\/json/i", $content_type)) {
|
||||||
curl_setopt($curl, CURLOPT_CUSTOMREQUEST, "DELETE");
|
return 'application/json';
|
||||||
curl_setopt($curl, CURLOPT_POSTFIELDS, $postData);
|
} else {
|
||||||
} else if ($method != self::$GET) {
|
return implode(',', $content_type);
|
||||||
throw new ApiException('Method ' . $method . ' is not recognized.');
|
}
|
||||||
}
|
}
|
||||||
curl_setopt($curl, CURLOPT_URL, $url);
|
|
||||||
|
|
||||||
// Set user agent
|
|
||||||
curl_setopt($curl, CURLOPT_USERAGENT, $this->config->getUserAgent());
|
|
||||||
|
|
||||||
// debugging for curl
|
|
||||||
if ($this->config->getDebug()) {
|
|
||||||
error_log("[DEBUG] HTTP Request body ~BEGIN~\n".print_r($postData, true)."\n~END~\n", 3, $this->config->getDebugFile());
|
|
||||||
|
|
||||||
curl_setopt($curl, CURLOPT_VERBOSE, 1);
|
|
||||||
curl_setopt($curl, CURLOPT_STDERR, fopen($this->config->getDebugFile(), 'a'));
|
|
||||||
} else {
|
|
||||||
curl_setopt($curl, CURLOPT_VERBOSE, 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
// obtain the HTTP response headers
|
|
||||||
curl_setopt($curl, CURLOPT_HEADER, 1);
|
|
||||||
|
|
||||||
// Make the request
|
|
||||||
$response = curl_exec($curl);
|
|
||||||
$http_header_size = curl_getinfo($curl, CURLINFO_HEADER_SIZE);
|
|
||||||
$http_header = substr($response, 0, $http_header_size);
|
|
||||||
$http_body = substr($response, $http_header_size);
|
|
||||||
$response_info = curl_getinfo($curl);
|
|
||||||
|
|
||||||
// debug HTTP response body
|
|
||||||
if ($this->config->getDebug()) {
|
|
||||||
error_log("[DEBUG] HTTP Response body ~BEGIN~\n".print_r($http_body, true)."\n~END~\n", 3, $this->config->getDebugFile());
|
|
||||||
}
|
|
||||||
|
|
||||||
// Handle the response
|
|
||||||
if ($response_info['http_code'] == 0) {
|
|
||||||
throw new ApiException("API call to $url timed out: ".serialize($response_info), 0, null, null);
|
|
||||||
} else if ($response_info['http_code'] >= 200 && $response_info['http_code'] <= 299 ) {
|
|
||||||
// return raw body if response is a file
|
|
||||||
if ($responseType == '\SplFileObject') {
|
|
||||||
return array($http_body, $http_header);
|
|
||||||
}
|
|
||||||
|
|
||||||
$data = json_decode($http_body);
|
|
||||||
if (json_last_error() > 0) { // if response is a string
|
|
||||||
$data = $http_body;
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
throw new ApiException("[".$response_info['http_code']."] Error connecting to the API ($url)",
|
|
||||||
$response_info['http_code'], $http_header, $http_body);
|
|
||||||
}
|
|
||||||
return array($data, $http_header);
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* return the header 'Accept' based on an array of Accept provided
|
|
||||||
*
|
|
||||||
* @param string[] $accept Array of header
|
|
||||||
* @return string Accept (e.g. application/json)
|
|
||||||
*/
|
|
||||||
public static function selectHeaderAccept($accept) {
|
|
||||||
if (count($accept) === 0 or (count($accept) === 1 and $accept[0] === '')) {
|
|
||||||
return NULL;
|
|
||||||
} elseif (preg_grep("/application\/json/i", $accept)) {
|
|
||||||
return 'application/json';
|
|
||||||
} else {
|
|
||||||
return implode(',', $accept);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* return the content type based on an array of content-type provided
|
|
||||||
*
|
|
||||||
* @param string[] content_type_array Array fo content-type
|
|
||||||
* @return string Content-Type (e.g. application/json)
|
|
||||||
*/
|
|
||||||
public static function selectHeaderContentType($content_type) {
|
|
||||||
if (count($content_type) === 0 or (count($content_type) === 1 and $content_type[0] === '')) {
|
|
||||||
return 'application/json';
|
|
||||||
} elseif (preg_grep("/application\/json/i", $content_type)) {
|
|
||||||
return 'application/json';
|
|
||||||
} else {
|
|
||||||
return implode(',', $content_type);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@ -21,50 +21,50 @@ use \Exception;
|
|||||||
|
|
||||||
class ApiException extends Exception {
|
class ApiException extends Exception {
|
||||||
|
|
||||||
/** @var string The HTTP body of the server response. */
|
/** @var string The HTTP body of the server response. */
|
||||||
protected $responseBody;
|
protected $responseBody;
|
||||||
|
|
||||||
/** @var string[] The HTTP header of the server response. */
|
/** @var string[] The HTTP header of the server response. */
|
||||||
protected $responseHeaders;
|
protected $responseHeaders;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The deserialized response object
|
* The deserialized response object
|
||||||
*/
|
*/
|
||||||
protected $responseObject;
|
protected $responseObject;
|
||||||
|
|
||||||
public function __construct($message="", $code=0, $responseHeaders=null, $responseBody=null) {
|
public function __construct($message="", $code=0, $responseHeaders=null, $responseBody=null) {
|
||||||
parent::__construct($message, $code);
|
parent::__construct($message, $code);
|
||||||
$this->responseHeaders = $responseHeaders;
|
$this->responseHeaders = $responseHeaders;
|
||||||
$this->responseBody = $responseBody;
|
$this->responseBody = $responseBody;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the HTTP response header
|
* Get the HTTP response header
|
||||||
*
|
*
|
||||||
* @return string HTTP response header
|
* @return string HTTP response header
|
||||||
*/
|
*/
|
||||||
public function getResponseHeaders() {
|
public function getResponseHeaders() {
|
||||||
return $this->responseHeaders;
|
return $this->responseHeaders;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the HTTP response body
|
* Get the HTTP response body
|
||||||
*
|
*
|
||||||
* @return string HTTP response body
|
* @return string HTTP response body
|
||||||
*/
|
*/
|
||||||
public function getResponseBody() {
|
public function getResponseBody() {
|
||||||
return $this->responseBody;
|
return $this->responseBody;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* sets the deseralized response object (during deserialization)
|
* sets the deseralized response object (during deserialization)
|
||||||
* @param mixed $obj
|
* @param mixed $obj
|
||||||
*/
|
*/
|
||||||
public function setResponseObject($obj) {
|
public function setResponseObject($obj) {
|
||||||
$this->responseObject = $obj;
|
$this->responseObject = $obj;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getResponseObject() {
|
public function getResponseObject() {
|
||||||
return $this->responseObject;
|
return $this->responseObject;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -9,29 +9,29 @@ class ObjectSerializer {
|
|||||||
* @return string serialized form of $data
|
* @return string serialized form of $data
|
||||||
*/
|
*/
|
||||||
public function sanitizeForSerialization($data) {
|
public function sanitizeForSerialization($data) {
|
||||||
if (is_scalar($data) || null === $data) {
|
if (is_scalar($data) || null === $data) {
|
||||||
$sanitized = $data;
|
$sanitized = $data;
|
||||||
} else if ($data instanceof \DateTime) {
|
} else if ($data instanceof \DateTime) {
|
||||||
$sanitized = $data->format(\DateTime::ISO8601);
|
$sanitized = $data->format(\DateTime::ISO8601);
|
||||||
} else if (is_array($data)) {
|
} else if (is_array($data)) {
|
||||||
foreach ($data as $property => $value) {
|
foreach ($data as $property => $value) {
|
||||||
$data[$property] = $this->sanitizeForSerialization($value);
|
$data[$property] = $this->sanitizeForSerialization($value);
|
||||||
|
}
|
||||||
|
$sanitized = $data;
|
||||||
|
} else if (is_object($data)) {
|
||||||
|
$values = array();
|
||||||
|
foreach (array_keys($data::$swaggerTypes) as $property) {
|
||||||
|
$getter = $data::$getters[$property];
|
||||||
|
if ($data->$getter() !== null) {
|
||||||
|
$values[$data::$attributeMap[$property]] = $this->sanitizeForSerialization($data->$getter());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$sanitized = $values;
|
||||||
|
} else {
|
||||||
|
$sanitized = (string)$data;
|
||||||
}
|
}
|
||||||
$sanitized = $data;
|
|
||||||
} else if (is_object($data)) {
|
|
||||||
$values = array();
|
|
||||||
foreach (array_keys($data::$swaggerTypes) as $property) {
|
|
||||||
$getter = $data::$getters[$property];
|
|
||||||
if ($data->$getter() !== null) {
|
|
||||||
$values[$data::$attributeMap[$property]] = $this->sanitizeForSerialization($data->$getter());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
$sanitized = $values;
|
|
||||||
} else {
|
|
||||||
$sanitized = (string)$data;
|
|
||||||
}
|
|
||||||
|
|
||||||
return $sanitized;
|
return $sanitized;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -41,7 +41,7 @@ class ObjectSerializer {
|
|||||||
* @return string the serialized object
|
* @return string the serialized object
|
||||||
*/
|
*/
|
||||||
public function toPathValue($value) {
|
public function toPathValue($value) {
|
||||||
return rawurlencode($this->toString($value));
|
return rawurlencode($this->toString($value));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -53,11 +53,11 @@ class ObjectSerializer {
|
|||||||
* @return string the serialized object
|
* @return string the serialized object
|
||||||
*/
|
*/
|
||||||
public function toQueryValue($object) {
|
public function toQueryValue($object) {
|
||||||
if (is_array($object)) {
|
if (is_array($object)) {
|
||||||
return implode(',', $object);
|
return implode(',', $object);
|
||||||
} else {
|
} else {
|
||||||
return $this->toString($object);
|
return $this->toString($object);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -68,7 +68,7 @@ class ObjectSerializer {
|
|||||||
* @return string the header string
|
* @return string the header string
|
||||||
*/
|
*/
|
||||||
public function toHeaderValue($value) {
|
public function toHeaderValue($value) {
|
||||||
return $this->toString($value);
|
return $this->toString($value);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -79,11 +79,11 @@ class ObjectSerializer {
|
|||||||
* @return string the form string
|
* @return string the form string
|
||||||
*/
|
*/
|
||||||
public function toFormValue($value) {
|
public function toFormValue($value) {
|
||||||
if ($value instanceof SplFileObject) {
|
if ($value instanceof SplFileObject) {
|
||||||
return $value->getRealPath();
|
return $value->getRealPath();
|
||||||
} else {
|
} else {
|
||||||
return $this->toString($value);
|
return $this->toString($value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -94,11 +94,11 @@ class ObjectSerializer {
|
|||||||
* @return string the header string
|
* @return string the header string
|
||||||
*/
|
*/
|
||||||
public function toString($value) {
|
public function toString($value) {
|
||||||
if ($value instanceof \DateTime) { // datetime in ISO8601 format
|
if ($value instanceof \DateTime) { // datetime in ISO8601 format
|
||||||
return $value->format(\DateTime::ISO8601);
|
return $value->format(\DateTime::ISO8601);
|
||||||
} else {
|
} else {
|
||||||
return $value;
|
return $value;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -109,65 +109,65 @@ class ObjectSerializer {
|
|||||||
* @return object an instance of $class
|
* @return object an instance of $class
|
||||||
*/
|
*/
|
||||||
public function deserialize($data, $class, $httpHeader=null) {
|
public function deserialize($data, $class, $httpHeader=null) {
|
||||||
if (null === $data) {
|
if (null === $data) {
|
||||||
$deserialized = null;
|
$deserialized = null;
|
||||||
} elseif (substr($class, 0, 4) == 'map[') { # for associative array e.g. map[string,int]
|
} elseif (substr($class, 0, 4) == 'map[') { # for associative array e.g. map[string,int]
|
||||||
$inner = substr($class, 4, -1);
|
$inner = substr($class, 4, -1);
|
||||||
$deserialized = array();
|
$deserialized = array();
|
||||||
if(strrpos($inner, ",") !== false) {
|
if(strrpos($inner, ",") !== false) {
|
||||||
$subClass_array = explode(',', $inner, 2);
|
$subClass_array = explode(',', $inner, 2);
|
||||||
$subClass = $subClass_array[1];
|
$subClass = $subClass_array[1];
|
||||||
foreach ($data as $key => $value) {
|
foreach ($data as $key => $value) {
|
||||||
$deserialized[$key] = $this->deserialize($value, $subClass);
|
$deserialized[$key] = $this->deserialize($value, $subClass);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
} elseif (strcasecmp(substr($class, -2),'[]') == 0) {
|
||||||
|
$subClass = substr($class, 0, -2);
|
||||||
|
$values = array();
|
||||||
|
foreach ($data as $key => $value) {
|
||||||
|
$values[] = $this->deserialize($value, $subClass);
|
||||||
|
}
|
||||||
|
$deserialized = $values;
|
||||||
|
} elseif ($class == 'DateTime') {
|
||||||
|
$deserialized = new \DateTime($data);
|
||||||
|
} elseif (in_array($class, array('string', 'int', 'float', 'double', 'bool', 'object'))) {
|
||||||
|
settype($data, $class);
|
||||||
|
$deserialized = $data;
|
||||||
|
} elseif ($class === '\SplFileObject') {
|
||||||
|
# determine temp folder path
|
||||||
|
if (!isset(Configuration::getDefaultConfig->$tempFolderPath) || '' === Configuration::$tempFolderPath) {
|
||||||
|
$tmpFolderPath = sys_get_temp_dir();
|
||||||
|
} else {
|
||||||
|
$tmpFolderPath = Configuration::tempFolderPath;
|
||||||
|
}
|
||||||
|
|
||||||
|
# determine file name
|
||||||
|
if (preg_match('/Content-Disposition: inline; filename=(.*)/i', $httpHeader, $match)) {
|
||||||
|
$filename = $tmpFolderPath.$match[1];
|
||||||
|
} else {
|
||||||
|
$filename = tempnam($tmpFolderPath, '');
|
||||||
|
}
|
||||||
|
$deserialized = new \SplFileObject($filename, "w");
|
||||||
|
$byte_written = $deserialized->fwrite($data);
|
||||||
|
error_log("[INFO] Written $byte_written byte to $filename. Please move the file to a proper folder or delete the temp file afterwards", 3, Configuration::getDefaultConfiguration()->getDebugFile());
|
||||||
|
|
||||||
|
} else {
|
||||||
|
$instance = new $class();
|
||||||
|
foreach ($instance::$swaggerTypes as $property => $type) {
|
||||||
|
$propertySetter = $instance::$setters[$property];
|
||||||
|
|
||||||
|
if (!isset($propertySetter) || !isset($data->{$instance::$attributeMap[$property]})) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
$propertyValue = $data->{$instance::$attributeMap[$property]};
|
||||||
|
if (isset($propertyValue)) {
|
||||||
|
$instance->$propertySetter($this->deserialize($propertyValue, $type));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$deserialized = $instance;
|
||||||
}
|
}
|
||||||
} elseif (strcasecmp(substr($class, -2),'[]') == 0) {
|
|
||||||
$subClass = substr($class, 0, -2);
|
|
||||||
$values = array();
|
|
||||||
foreach ($data as $key => $value) {
|
|
||||||
$values[] = $this->deserialize($value, $subClass);
|
|
||||||
}
|
|
||||||
$deserialized = $values;
|
|
||||||
} elseif ($class == 'DateTime') {
|
|
||||||
$deserialized = new \DateTime($data);
|
|
||||||
} elseif (in_array($class, array('string', 'int', 'float', 'double', 'bool', 'object'))) {
|
|
||||||
settype($data, $class);
|
|
||||||
$deserialized = $data;
|
|
||||||
} elseif ($class === '\SplFileObject') {
|
|
||||||
# determine temp folder path
|
|
||||||
if (!isset(Configuration::$tempFolderPath) || '' === Configuration::$tempFolderPath) {
|
|
||||||
$tmpFolderPath = sys_get_temp_dir();
|
|
||||||
} else {
|
|
||||||
$tmpFolderPath = Configuration::tempFolderPath;
|
|
||||||
}
|
|
||||||
|
|
||||||
# determine file name
|
return $deserialized;
|
||||||
if (preg_match('/Content-Disposition: inline; filename=(.*)/i', $httpHeader, $match)) {
|
|
||||||
$filename = $tmpFolderPath.$match[1];
|
|
||||||
} else {
|
|
||||||
$filename = tempnam($tmpFolderPath, '');
|
|
||||||
}
|
|
||||||
$deserialized = new \SplFileObject($filename, "w");
|
|
||||||
$byte_written = $deserialized->fwrite($data);
|
|
||||||
error_log("[INFO] Written $byte_written byte to $filename. Please move the file to a proper folder or delete the temp file afterwards", 3, Configuration::getDefaultConfiguration()->getDebugFile());
|
|
||||||
|
|
||||||
} else {
|
|
||||||
$instance = new $class();
|
|
||||||
foreach ($instance::$swaggerTypes as $property => $type) {
|
|
||||||
$propertySetter = $instance::$setters[$property];
|
|
||||||
|
|
||||||
if (!isset($propertySetter) || !isset($data->{$instance::$attributeMap[$property]})) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
$propertyValue = $data->{$instance::$attributeMap[$property]};
|
|
||||||
if (isset($propertyValue)) {
|
|
||||||
$instance->$propertySetter($this->deserialize($propertyValue, $type));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
$deserialized = $instance;
|
|
||||||
}
|
|
||||||
|
|
||||||
return $deserialized;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -30,132 +30,132 @@ use \{{invokerPackage}}\ObjectSerializer;
|
|||||||
{{#operations}}
|
{{#operations}}
|
||||||
class {{classname}} {
|
class {{classname}} {
|
||||||
|
|
||||||
/** @var \{{invokerPackage}}\ApiClient instance of the ApiClient */
|
/** @var \{{invokerPackage}}\ApiClient instance of the ApiClient */
|
||||||
private $apiClient;
|
private $apiClient;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param \{{invokerPackage}}\ApiClient|null $apiClient The api client to use
|
* @param \{{invokerPackage}}\ApiClient|null $apiClient The api client to use
|
||||||
*/
|
*/
|
||||||
function __construct($apiClient = null) {
|
function __construct($apiClient = null) {
|
||||||
if ($apiClient == null) {
|
if ($apiClient == null) {
|
||||||
$apiClient = new ApiClient();
|
$apiClient = new ApiClient();
|
||||||
$apiClient->getConfig()->setHost('{{basePath}}');
|
$apiClient->getConfig()->setHost('{{basePath}}');
|
||||||
}
|
|
||||||
|
|
||||||
$this->apiClient = $apiClient;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @return \{{invokerPackage}}\ApiClient get the API client
|
|
||||||
*/
|
|
||||||
public function getApiClient() {
|
|
||||||
return $this->apiClient;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param \{{invokerPackage}}\ApiClient $apiClient set the API client
|
|
||||||
* @return {{classname}}
|
|
||||||
*/
|
|
||||||
public function setApiClient(ApiClient $apiClient) {
|
|
||||||
$this->apiClient = $apiClient;
|
|
||||||
return $this;
|
|
||||||
}
|
|
||||||
|
|
||||||
{{#operation}}
|
|
||||||
/**
|
|
||||||
* {{{nickname}}}
|
|
||||||
*
|
|
||||||
* {{{summary}}}
|
|
||||||
*
|
|
||||||
{{#allParams}} * @param {{dataType}} ${{paramName}} {{description}} {{#required}}(required){{/required}}{{^required}}(optional){{/required}}
|
|
||||||
{{/allParams}} * @return {{#returnType}}{{{returnType}}}{{/returnType}}{{^returnType}}void{{/returnType}}
|
|
||||||
* @throws \{{invokerPackage}}\ApiException on non-2xx response
|
|
||||||
*/
|
|
||||||
public function {{nickname}}({{#allParams}}${{paramName}}{{^required}}=null{{/required}}{{#hasMore}}, {{/hasMore}}{{/allParams}}) {
|
|
||||||
{{#allParams}}{{#required}}
|
|
||||||
// verify the required parameter '{{paramName}}' is set
|
|
||||||
if (${{paramName}} === null) {
|
|
||||||
throw new \InvalidArgumentException('Missing the required parameter ${{paramName}} when calling {{nickname}}');
|
|
||||||
}
|
|
||||||
{{/required}}{{/allParams}}
|
|
||||||
|
|
||||||
// parse inputs
|
|
||||||
$resourcePath = "{{path}}";
|
|
||||||
$resourcePath = str_replace("{format}", "json", $resourcePath);
|
|
||||||
$method = "{{httpMethod}}";
|
|
||||||
$httpBody = '';
|
|
||||||
$queryParams = array();
|
|
||||||
$headerParams = array();
|
|
||||||
$formParams = array();
|
|
||||||
$_header_accept = ApiClient::selectHeaderAccept(array({{#produces}}'{{mediaType}}'{{#hasMore}}, {{/hasMore}}{{/produces}}));
|
|
||||||
if (!is_null($_header_accept)) {
|
|
||||||
$headerParams['Accept'] = $_header_accept;
|
|
||||||
}
|
|
||||||
$headerParams['Content-Type'] = ApiClient::selectHeaderContentType(array({{#consumes}}'{{mediaType}}'{{#hasMore}},{{/hasMore}}{{/consumes}}));
|
|
||||||
|
|
||||||
{{#queryParams}}// query params
|
|
||||||
if(${{paramName}} !== null) {
|
|
||||||
$queryParams['{{baseName}}'] = $this->apiClient->getSerializer()->toQueryValue(${{paramName}});
|
|
||||||
}{{/queryParams}}
|
|
||||||
{{#headerParams}}// header params
|
|
||||||
if(${{paramName}} !== null) {
|
|
||||||
$headerParams['{{baseName}}'] = $this->apiClient->getSerializer()->toHeaderValue(${{paramName}});
|
|
||||||
}{{/headerParams}}
|
|
||||||
{{#pathParams}}// path params
|
|
||||||
if(${{paramName}} !== null) {
|
|
||||||
$resourcePath = str_replace("{" . "{{baseName}}" . "}",
|
|
||||||
$this->apiClient->getSerializer()->toPathValue(${{paramName}}),
|
|
||||||
$resourcePath);
|
|
||||||
}{{/pathParams}}
|
|
||||||
{{#formParams}}// form params
|
|
||||||
if (${{paramName}} !== null) {
|
|
||||||
$formParams['{{baseName}}'] = {{#isFile}}'@' . {{/isFile}}$this->apiClient->getSerializer()->toFormValue(${{paramName}});
|
|
||||||
}{{/formParams}}
|
|
||||||
{{#bodyParams}}// body params
|
|
||||||
$_tempBody = null;
|
|
||||||
if (isset(${{paramName}})) {
|
|
||||||
$_tempBody = ${{paramName}};
|
|
||||||
}{{/bodyParams}}
|
|
||||||
|
|
||||||
// for model (json/xml)
|
|
||||||
if (isset($_tempBody)) {
|
|
||||||
$httpBody = $_tempBody; // $_tempBody is the method argument, if present
|
|
||||||
} else if (count($formParams) > 0) {
|
|
||||||
// for HTTP post (form)
|
|
||||||
$httpBody = $formParams;
|
|
||||||
}
|
|
||||||
{{#authMethods}}{{#isApiKey}}
|
|
||||||
$apiKey = $this->apiClient->getApiKeyWithPrefix('{{keyParamName}}');
|
|
||||||
if (isset($apiKey)) {
|
|
||||||
{{#isKeyInHeader}}$headerParams['{{keyParamName}}'] = $apiKey;{{/isKeyInHeader}}{{#isKeyInQuery}}$queryParams['{{keyParamName}}'] = $apiKey;{{/isKeyInQuery}}
|
|
||||||
}{{/isApiKey}}
|
|
||||||
{{#isBasic}}$headerParams['Authorization'] = 'Basic '.base64_encode($this->apiClient->getConfig()->getUsername().":".$this->apiClient->getConfig()->getPassword());{{/isBasic}}
|
|
||||||
{{#isOAuth}}//TODO support oauth{{/isOAuth}}
|
|
||||||
{{/authMethods}}
|
|
||||||
// make the API Call
|
|
||||||
try {
|
|
||||||
list($response, $httpHeader) = $this->apiClient->callApi($resourcePath, $method,
|
|
||||||
$queryParams, $httpBody,
|
|
||||||
$headerParams{{#returnType}}, '{{returnType}}'{{/returnType}});
|
|
||||||
} catch (ApiException $e) {
|
|
||||||
switch ($e->getCode()) { {{#responses}}{{#dataType}}
|
|
||||||
case {{code}}:
|
|
||||||
$data = $this->apiClient->getSerializer()->deserialize($e->getResponseBody(), '{{dataType}}', $httpHeader);
|
|
||||||
$e->setResponseObject($data);
|
|
||||||
break;{{/dataType}}{{/responses}}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
throw $e;
|
$this->apiClient = $apiClient;
|
||||||
}
|
}
|
||||||
{{#returnType}}
|
|
||||||
if (!$response) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
$responseObject = $this->apiClient->getSerializer()->deserialize($response,'{{returnType}}');
|
/**
|
||||||
return $responseObject;
|
* @return \{{invokerPackage}}\ApiClient get the API client
|
||||||
{{/returnType}}
|
*/
|
||||||
}
|
public function getApiClient() {
|
||||||
{{/operation}}
|
return $this->apiClient;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param \{{invokerPackage}}\ApiClient $apiClient set the API client
|
||||||
|
* @return {{classname}}
|
||||||
|
*/
|
||||||
|
public function setApiClient(ApiClient $apiClient) {
|
||||||
|
$this->apiClient = $apiClient;
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
{{#operation}}
|
||||||
|
/**
|
||||||
|
* {{{nickname}}}
|
||||||
|
*
|
||||||
|
* {{{summary}}}
|
||||||
|
*
|
||||||
|
{{#allParams}} * @param {{dataType}} ${{paramName}} {{description}} {{#required}}(required){{/required}}{{^required}}(optional){{/required}}
|
||||||
|
{{/allParams}} * @return {{#returnType}}{{{returnType}}}{{/returnType}}{{^returnType}}void{{/returnType}}
|
||||||
|
* @throws \{{invokerPackage}}\ApiException on non-2xx response
|
||||||
|
*/
|
||||||
|
public function {{nickname}}({{#allParams}}${{paramName}}{{^required}}=null{{/required}}{{#hasMore}}, {{/hasMore}}{{/allParams}}) {
|
||||||
|
{{#allParams}}{{#required}}
|
||||||
|
// verify the required parameter '{{paramName}}' is set
|
||||||
|
if (${{paramName}} === null) {
|
||||||
|
throw new \InvalidArgumentException('Missing the required parameter ${{paramName}} when calling {{nickname}}');
|
||||||
|
>>>>>>> temporary folder setting
|
||||||
|
}
|
||||||
|
{{/required}}{{/allParams}}
|
||||||
|
|
||||||
|
// parse inputs
|
||||||
|
$resourcePath = "{{path}}";
|
||||||
|
$resourcePath = str_replace("{format}", "json", $resourcePath);
|
||||||
|
$method = "{{httpMethod}}";
|
||||||
|
$httpBody = '';
|
||||||
|
$queryParams = array();
|
||||||
|
$headerParams = array();
|
||||||
|
$formParams = array();
|
||||||
|
$_header_accept = ApiClient::selectHeaderAccept(array({{#produces}}'{{mediaType}}'{{#hasMore}}, {{/hasMore}}{{/produces}}));
|
||||||
|
if (!is_null($_header_accept)) {
|
||||||
|
$headerParams['Accept'] = $_header_accept;
|
||||||
|
}
|
||||||
|
$headerParams['Content-Type'] = ApiClient::selectHeaderContentType(array({{#consumes}}'{{mediaType}}'{{#hasMore}},{{/hasMore}}{{/consumes}}));
|
||||||
|
|
||||||
|
{{#queryParams}}// query params
|
||||||
|
if(${{paramName}} !== null) {
|
||||||
|
$queryParams['{{baseName}}'] = $this->apiClient->getSerializer()->toQueryValue(${{paramName}});
|
||||||
|
}{{/queryParams}}
|
||||||
|
{{#headerParams}}// header params
|
||||||
|
if(${{paramName}} !== null) {
|
||||||
|
$headerParams['{{baseName}}'] = $this->apiClient->getSerializer()->toHeaderValue(${{paramName}});
|
||||||
|
}{{/headerParams}}
|
||||||
|
{{#pathParams}}// path params
|
||||||
|
if(${{paramName}} !== null) {
|
||||||
|
$resourcePath = str_replace("{" . "{{baseName}}" . "}",
|
||||||
|
$this->apiClient->getSerializer()->toPathValue(${{paramName}}),
|
||||||
|
$resourcePath);
|
||||||
|
}{{/pathParams}}
|
||||||
|
{{#formParams}}// form params
|
||||||
|
if (${{paramName}} !== null) {
|
||||||
|
$formParams['{{baseName}}'] = {{#isFile}}'@' . {{/isFile}}$this->apiClient->getSerializer()->toFormValue(${{paramName}});
|
||||||
|
}{{/formParams}}
|
||||||
|
{{#bodyParams}}// body params
|
||||||
|
$_tempBody = null;
|
||||||
|
if (isset(${{paramName}})) {
|
||||||
|
$_tempBody = ${{paramName}};
|
||||||
|
}{{/bodyParams}}
|
||||||
|
|
||||||
|
// for model (json/xml)
|
||||||
|
if (isset($_tempBody)) {
|
||||||
|
$httpBody = $_tempBody; // $_tempBody is the method argument, if present
|
||||||
|
} else if (count($formParams) > 0) {
|
||||||
|
// for HTTP post (form)
|
||||||
|
$httpBody = $formParams;
|
||||||
|
}
|
||||||
|
{{#authMethods}}{{#isApiKey}}
|
||||||
|
$apiKey = $this->apiClient->getApiKeyWithPrefix('{{keyParamName}}');
|
||||||
|
if (isset($apiKey)) {
|
||||||
|
{{#isKeyInHeader}}$headerParams['{{keyParamName}}'] = $apiKey;{{/isKeyInHeader}}{{#isKeyInQuery}}$queryParams['{{keyParamName}}'] = $apiKey;{{/isKeyInQuery}}
|
||||||
|
}{{/isApiKey}}
|
||||||
|
{{#isBasic}}$headerParams['Authorization'] = 'Basic '.base64_encode($this->apiClient->getConfig()->getUsername().":".$this->apiClient->getConfig()->getPassword());{{/isBasic}}
|
||||||
|
{{#isOAuth}}//TODO support oauth{{/isOAuth}}
|
||||||
|
{{/authMethods}}
|
||||||
|
// make the API Call
|
||||||
|
try {
|
||||||
|
list($response, $httpHeader) = $this->apiClient->callApi($resourcePath, $method,
|
||||||
|
$queryParams, $httpBody,
|
||||||
|
$headerParams{{#returnType}}, '{{returnType}}'{{/returnType}});
|
||||||
|
} catch (ApiException $e) {
|
||||||
|
switch ($e->getCode()) { {{#responses}}{{#dataType}}
|
||||||
|
case {{code}}:
|
||||||
|
$data = $this->apiClient->getSerializer()->deserialize($e->getResponseBody(), '{{dataType}}', $httpHeader);
|
||||||
|
$e->setResponseObject($data);
|
||||||
|
break;{{/dataType}}{{/responses}}
|
||||||
|
}
|
||||||
|
|
||||||
|
throw $e;
|
||||||
|
}
|
||||||
|
{{#returnType}}
|
||||||
|
if (!$response) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
return $this->apiClient->getSerializer()->deserialize($response,'{{returnType}}');
|
||||||
|
{{/returnType}}
|
||||||
|
}
|
||||||
|
{{/operation}}
|
||||||
}
|
}
|
||||||
{{/operations}}
|
{{/operations}}
|
||||||
|
@ -1,33 +1,33 @@
|
|||||||
{
|
{
|
||||||
"name": "{{groupId}}/{{artifactId}}",{{#artifactVersion}}
|
"name": "{{groupId}}/{{artifactId}}",{{#artifactVersion}}
|
||||||
"version": "{{artifactVersion}}",{{/artifactVersion}}
|
"version": "{{artifactVersion}}",{{/artifactVersion}}
|
||||||
"description": "{{description}}",
|
"description": "{{description}}",
|
||||||
"keywords": [
|
"keywords": [
|
||||||
"swagger",
|
"swagger",
|
||||||
"php",
|
"php",
|
||||||
"sdk",
|
"sdk",
|
||||||
"api"
|
"api"
|
||||||
],
|
],
|
||||||
"homepage": "http://swagger.io",
|
"homepage": "http://swagger.io",
|
||||||
"license": "Apache v2",
|
"license": "Apache v2",
|
||||||
"authors": [
|
"authors": [
|
||||||
{
|
{
|
||||||
"name": "Swagger and contributors",
|
"name": "Swagger and contributors",
|
||||||
"homepage": "https://github.com/swagger-api/swagger-codegen"
|
"homepage": "https://github.com/swagger-api/swagger-codegen"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"require": {
|
||||||
|
"php": ">=5.3.3",
|
||||||
|
"ext-curl": "*",
|
||||||
|
"ext-json": "*",
|
||||||
|
"ext-mbstring": "*"
|
||||||
|
},
|
||||||
|
"require-dev": {
|
||||||
|
"phpunit/phpunit": "~4.0",
|
||||||
|
"satooshi/php-coveralls": "~0.6.1",
|
||||||
|
"squizlabs/php_codesniffer": "~2.0"
|
||||||
|
},
|
||||||
|
"autoload": {
|
||||||
|
"psr-4": { "{{escapedInvokerPackage}}\\" : "{{srcBasePath}}/" }
|
||||||
}
|
}
|
||||||
],
|
|
||||||
"require": {
|
|
||||||
"php": ">=5.3.3",
|
|
||||||
"ext-curl": "*",
|
|
||||||
"ext-json": "*",
|
|
||||||
"ext-mbstring": "*"
|
|
||||||
},
|
|
||||||
"require-dev": {
|
|
||||||
"phpunit/phpunit": "~4.0",
|
|
||||||
"satooshi/php-coveralls": "~0.6.1",
|
|
||||||
"squizlabs/php_codesniffer": "~2.0"
|
|
||||||
},
|
|
||||||
"autoload": {
|
|
||||||
"psr-4": { "{{escapedInvokerPackage}}\\" : "{{srcBasePath}}/" }
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@ -19,262 +19,265 @@ namespace {{invokerPackage}};
|
|||||||
|
|
||||||
class Configuration {
|
class Configuration {
|
||||||
|
|
||||||
private static $defaultConfiguration = null;
|
private static $defaultConfiguration = null;
|
||||||
|
|
||||||
/** @var string[] Associate array to store API key(s) */
|
/** @var string[] Associate array to store API key(s) */
|
||||||
protected $apiKeys = array();
|
protected $apiKeys = array();
|
||||||
|
|
||||||
/** string[] Associate array to store API prefix (e.g. Bearer) */
|
/** string[] Associate array to store API prefix (e.g. Bearer) */
|
||||||
protected $apiKeyPrefixes = array();
|
protected $apiKeyPrefixes = array();
|
||||||
|
|
||||||
/** @var string Username for HTTP basic authentication */
|
/** @var string Username for HTTP basic authentication */
|
||||||
protected $username = '';
|
protected $username = '';
|
||||||
|
|
||||||
/** @var string Password for HTTP basic authentication */
|
/** @var string Password for HTTP basic authentication */
|
||||||
protected $password = '';
|
protected $password = '';
|
||||||
|
|
||||||
/** @var \{{invokerPackage}}\ApiClient The default instance of ApiClient */
|
/** @var \{{invokerPackage}}\ApiClient The default instance of ApiClient */
|
||||||
protected $defaultHeaders = array();
|
protected $defaultHeaders = array();
|
||||||
|
|
||||||
/** @var string The host */
|
/** @var string The host */
|
||||||
protected $host = 'http://localhost';
|
protected $host = 'http://localhost';
|
||||||
|
|
||||||
/** @var string timeout (second) of the HTTP request, by default set to 0, no timeout */
|
/** @var string timeout (second) of the HTTP request, by default set to 0, no timeout */
|
||||||
protected $curlTimeout = 0;
|
protected $curlTimeout = 0;
|
||||||
|
|
||||||
/** @var string user agent of the HTTP request, set to "PHP-Swagger" by default */
|
/** @var string user agent of the HTTP request, set to "PHP-Swagger" by default */
|
||||||
protected $userAgent = "PHP-Swagger";
|
protected $userAgent = "PHP-Swagger";
|
||||||
|
|
||||||
/** @var bool Debug switch (default set to false) */
|
/** @var bool Debug switch (default set to false) */
|
||||||
protected $debug = false;
|
protected $debug = false;
|
||||||
|
|
||||||
/** @var string Debug file location (log to STDOUT by default) */
|
/** @var string Debug file location (log to STDOUT by default) */
|
||||||
protected $debugFile = 'php://output';
|
protected $debugFile = 'php://output';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param string $key
|
* @param string $key
|
||||||
* @param string $value
|
* @param string $value
|
||||||
* @return Configuration
|
* @return Configuration
|
||||||
*/
|
*/
|
||||||
public function setApiKey($key, $value) {
|
public function setApiKey($key, $value) {
|
||||||
$this->apiKeys[$key] = $value;
|
$this->apiKeys[$key] = $value;
|
||||||
return $this;
|
return $this;
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param $key
|
|
||||||
* @return string
|
|
||||||
*/
|
|
||||||
public function getApiKey($key) {
|
|
||||||
return isset($this->apiKeys[$key]) ? $this->apiKeys[$key] : null;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param string $key
|
|
||||||
* @param string $value
|
|
||||||
* @return Configuration
|
|
||||||
*/
|
|
||||||
public function setApiKeyPrefix($key, $value) {
|
|
||||||
$this->apiKeyPrefixes[$key] = $value;
|
|
||||||
return $this;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param $key
|
|
||||||
* @return string
|
|
||||||
*/
|
|
||||||
public function getApiKeyPrefix($key) {
|
|
||||||
return isset($this->apiKeyPrefixes[$key]) ? $this->apiKeyPrefixes[$key] : null;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param string $username
|
|
||||||
* @return Configuration
|
|
||||||
*/
|
|
||||||
public function setUsername($username) {
|
|
||||||
$this->username = $username;
|
|
||||||
return $this;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @return string
|
|
||||||
*/
|
|
||||||
public function getUsername() {
|
|
||||||
return $this->username;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param string $password
|
|
||||||
* @return Configuration
|
|
||||||
*/
|
|
||||||
public function setPassword($password) {
|
|
||||||
$this->password = $password;
|
|
||||||
return $this;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @return string
|
|
||||||
*/
|
|
||||||
public function getPassword() {
|
|
||||||
return $this->password;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* add default header
|
|
||||||
*
|
|
||||||
* @param string $headerName header name (e.g. Token)
|
|
||||||
* @param string $headerValue header value (e.g. 1z8wp3)
|
|
||||||
* @return ApiClient
|
|
||||||
*/
|
|
||||||
public function addDefaultHeader($headerName, $headerValue) {
|
|
||||||
if (!is_string($headerName)) {
|
|
||||||
throw new \InvalidArgumentException('Header name must be a string.');
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->defaultHeaders[$headerName] = $headerValue;
|
/**
|
||||||
return $this;
|
* @param $key
|
||||||
}
|
* @return string
|
||||||
|
*/
|
||||||
/**
|
public function getApiKey($key) {
|
||||||
* get the default header
|
return isset($this->apiKeys[$key]) ? $this->apiKeys[$key] : null;
|
||||||
*
|
|
||||||
* @return array default header
|
|
||||||
*/
|
|
||||||
public function getDefaultHeaders() {
|
|
||||||
return $this->defaultHeaders;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* delete a default header
|
|
||||||
* @param string $headerName the header to delete
|
|
||||||
* @return Configuration
|
|
||||||
*/
|
|
||||||
public function deleteDefaultHeader($headerName) {
|
|
||||||
unset($this->defaultHeaders[$headerName]);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param string $host
|
|
||||||
* @return Configuration
|
|
||||||
*/
|
|
||||||
public function setHost($host) {
|
|
||||||
$this->host = $host;
|
|
||||||
return $this;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @return string
|
|
||||||
*/
|
|
||||||
public function getHost() {
|
|
||||||
return $this->host;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* set the user agent of the api client
|
|
||||||
*
|
|
||||||
* @param string $userAgent the user agent of the api client
|
|
||||||
* @return ApiClient
|
|
||||||
*/
|
|
||||||
public function setUserAgent($userAgent) {
|
|
||||||
if (!is_string($userAgent)) {
|
|
||||||
throw new \InvalidArgumentException('User-agent must be a string.');
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->userAgent = $userAgent;
|
/**
|
||||||
return $this;
|
* @param string $key
|
||||||
}
|
* @param string $value
|
||||||
|
* @return Configuration
|
||||||
/**
|
*/
|
||||||
* get the user agent of the api client
|
public function setApiKeyPrefix($key, $value) {
|
||||||
*
|
$this->apiKeyPrefixes[$key] = $value;
|
||||||
* @return string user agent
|
return $this;
|
||||||
*/
|
|
||||||
public function getUserAgent() {
|
|
||||||
return $this->userAgent;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* set the HTTP timeout value
|
|
||||||
*
|
|
||||||
* @param integer $seconds Number of seconds before timing out [set to 0 for no timeout]
|
|
||||||
* @return ApiClient
|
|
||||||
*/
|
|
||||||
public function setCurlTimeout($seconds) {
|
|
||||||
if (!is_numeric($seconds) || $seconds < 0) {
|
|
||||||
throw new \InvalidArgumentException('Timeout value must be numeric and a non-negative number.');
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->curlTimeout = $seconds;
|
/**
|
||||||
return $this;
|
* @param $key
|
||||||
}
|
* @return string
|
||||||
|
*/
|
||||||
/**
|
public function getApiKeyPrefix($key) {
|
||||||
* get the HTTP timeout value
|
return isset($this->apiKeyPrefixes[$key]) ? $this->apiKeyPrefixes[$key] : null;
|
||||||
*
|
|
||||||
* @return string HTTP timeout value
|
|
||||||
*/
|
|
||||||
public function getCurlTimeout() {
|
|
||||||
return $this->curlTimeout;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param bool $debug
|
|
||||||
* @return Configuration
|
|
||||||
*/
|
|
||||||
public function setDebug($debug) {
|
|
||||||
$this->debug = $debug;
|
|
||||||
return $this;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @return bool
|
|
||||||
*/
|
|
||||||
public function getDebug() {
|
|
||||||
return $this->debug;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param string $debugFile
|
|
||||||
* @return Configuration
|
|
||||||
*/
|
|
||||||
public function setDebugFile($debugFile) {
|
|
||||||
$this->debugFile = $debugFile;
|
|
||||||
return $this;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @return string
|
|
||||||
*/
|
|
||||||
public function getDebugFile() {
|
|
||||||
return $this->debugFile;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @return Configuration
|
|
||||||
*/
|
|
||||||
public static function getDefaultConfiguration() {
|
|
||||||
if (self::$defaultConfiguration == null) {
|
|
||||||
return new Configuration();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return self::$defaultConfiguration;
|
/**
|
||||||
}
|
* @param string $username
|
||||||
|
* @return Configuration
|
||||||
|
*/
|
||||||
|
public function setUsername($username) {
|
||||||
|
$this->username = $username;
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
public static function setDefaultConfiguration(Configuration $config) {
|
/**
|
||||||
self::$defaultConfiguration = $config;
|
* @return string
|
||||||
}
|
*/
|
||||||
|
public function getUsername() {
|
||||||
|
return $this->username;
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/**
|
||||||
* return the report for debuggin
|
* @param string $password
|
||||||
*/
|
* @return Configuration
|
||||||
public static function toDebugReport() {
|
*/
|
||||||
$report = "PHP SDK ({{invokerPackage}}) Debug Report:\n";
|
public function setPassword($password) {
|
||||||
$report .= " OS: ".php_uname()."\n";
|
$this->password = $password;
|
||||||
$report .= " PHP Version: ".phpversion()."\n";
|
return $this;
|
||||||
$report .= " Swagger Spec Version: {{version}}\n";
|
}
|
||||||
$report .= " SDK Package Version: {{version}}\n";
|
|
||||||
|
|
||||||
return $report;
|
/**
|
||||||
}
|
* @return string
|
||||||
|
*/
|
||||||
|
public function getPassword() {
|
||||||
|
return $this->password;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* add default header
|
||||||
|
*
|
||||||
|
* @param string $headerName header name (e.g. Token)
|
||||||
|
* @param string $headerValue header value (e.g. 1z8wp3)
|
||||||
|
* @return ApiClient
|
||||||
|
*/
|
||||||
|
public function addDefaultHeader($headerName, $headerValue) {
|
||||||
|
if (!is_string($headerName)) {
|
||||||
|
throw new \InvalidArgumentException('Header name must be a string.');
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->defaultHeaders[$headerName] = $headerValue;
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* get the default header
|
||||||
|
*
|
||||||
|
* @return array default header
|
||||||
|
*/
|
||||||
|
public function getDefaultHeaders() {
|
||||||
|
return $this->defaultHeaders;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* delete a default header
|
||||||
|
* @param string $headerName the header to delete
|
||||||
|
* @return Configuration
|
||||||
|
*/
|
||||||
|
public function deleteDefaultHeader($headerName) {
|
||||||
|
unset($this->defaultHeaders[$headerName]);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param string $host
|
||||||
|
* @return Configuration
|
||||||
|
*/
|
||||||
|
public function setHost($host) {
|
||||||
|
$this->host = $host;
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
public function getHost() {
|
||||||
|
return $this->host;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* set the user agent of the api client
|
||||||
|
*
|
||||||
|
* @param string $userAgent the user agent of the api client
|
||||||
|
* @return ApiClient
|
||||||
|
*/
|
||||||
|
public function setUserAgent($userAgent) {
|
||||||
|
if (!is_string($userAgent)) {
|
||||||
|
throw new \InvalidArgumentException('User-agent must be a string.');
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->userAgent = $userAgent;
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* get the user agent of the api client
|
||||||
|
*
|
||||||
|
* @return string user agent
|
||||||
|
*/
|
||||||
|
public function getUserAgent() {
|
||||||
|
return $this->userAgent;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* set the HTTP timeout value
|
||||||
|
*
|
||||||
|
* @param integer $seconds Number of seconds before timing out [set to 0 for no timeout]
|
||||||
|
* @return ApiClient
|
||||||
|
*/
|
||||||
|
public function setCurlTimeout($seconds) {
|
||||||
|
if (!is_numeric($seconds) || $seconds < 0) {
|
||||||
|
throw new \InvalidArgumentException('Timeout value must be numeric and a non-negative number.');
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->curlTimeout = $seconds;
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* get the HTTP timeout value
|
||||||
|
*
|
||||||
|
* @return string HTTP timeout value
|
||||||
|
*/
|
||||||
|
public function getCurlTimeout() {
|
||||||
|
return $this->curlTimeout;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param bool $debug
|
||||||
|
* @return Configuration
|
||||||
|
*/
|
||||||
|
public function setDebug($debug) {
|
||||||
|
$this->debug = $debug;
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return bool
|
||||||
|
*/
|
||||||
|
public function getDebug() {
|
||||||
|
return $this->debug;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param string $debugFile
|
||||||
|
* @return Configuration
|
||||||
|
*/
|
||||||
|
public function setDebugFile($debugFile) {
|
||||||
|
$this->debugFile = $debugFile;
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
public function getDebugFile() {
|
||||||
|
return $this->debugFile;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return Configuration
|
||||||
|
*/
|
||||||
|
public static function getDefaultConfiguration() {
|
||||||
|
if (self::$defaultConfiguration == null) {
|
||||||
|
return new Configuration();
|
||||||
|
}
|
||||||
|
|
||||||
|
return self::$defaultConfiguration;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param Configuration $config
|
||||||
|
*/
|
||||||
|
public static function setDefaultConfiguration(Configuration $config) {
|
||||||
|
self::$defaultConfiguration = $config;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* return the report for debugging
|
||||||
|
*/
|
||||||
|
public static function toDebugReport() {
|
||||||
|
$report = "PHP SDK ({{invokerPackage}}) Debug Report:\n";
|
||||||
|
$report .= " OS: ".php_uname()."\n";
|
||||||
|
$report .= " PHP Version: ".phpversion()."\n";
|
||||||
|
$report .= " Swagger Spec Version: {{version}}\n";
|
||||||
|
$report .= " SDK Package Version: {{version}}\n";
|
||||||
|
|
||||||
|
return $report;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -29,82 +29,82 @@ namespace {{modelPackage}};
|
|||||||
use \ArrayAccess;
|
use \ArrayAccess;
|
||||||
|
|
||||||
class {{classname}} implements ArrayAccess {
|
class {{classname}} implements ArrayAccess {
|
||||||
/** @var string[] Array of property to type mappings. Used for (de)serialization */
|
/** @var string[] Array of property to type mappings. Used for (de)serialization */
|
||||||
static $swaggerTypes = array(
|
static $swaggerTypes = array(
|
||||||
{{#vars}}'{{name}}' => '{{{datatype}}}'{{#hasMore}},
|
{{#vars}}'{{name}}' => '{{{datatype}}}'{{#hasMore}},
|
||||||
{{/hasMore}}{{/vars}}
|
{{/hasMore}}{{/vars}}
|
||||||
);
|
);
|
||||||
|
|
||||||
/** @var string[] Array of attributes where the key is the local name, and the value is the original name */
|
/** @var string[] Array of attributes where the key is the local name, and the value is the original name */
|
||||||
static $attributeMap = array(
|
static $attributeMap = array(
|
||||||
{{#vars}}'{{name}}' => '{{baseName}}'{{#hasMore}},
|
{{#vars}}'{{name}}' => '{{baseName}}'{{#hasMore}},
|
||||||
{{/hasMore}}{{/vars}}
|
{{/hasMore}}{{/vars}}
|
||||||
);
|
);
|
||||||
|
|
||||||
/** @var string[] Array of attributes to setter functions (for deserialization of responses) */
|
/** @var string[] Array of attributes to setter functions (for deserialization of responses) */
|
||||||
static $setters = array(
|
static $setters = array(
|
||||||
{{#vars}}'{{name}}' => '{{setter}}'{{#hasMore}},
|
{{#vars}}'{{name}}' => '{{setter}}'{{#hasMore}},
|
||||||
{{/hasMore}}{{/vars}}
|
{{/hasMore}}{{/vars}}
|
||||||
);
|
);
|
||||||
|
|
||||||
/** @var string[] Array of attributes to getter functions (for serialization of requests) */
|
/** @var string[] Array of attributes to getter functions (for serialization of requests) */
|
||||||
static $getters = array(
|
static $getters = array(
|
||||||
{{#vars}}'{{name}}' => '{{getter}}'{{#hasMore}},
|
{{#vars}}'{{name}}' => '{{getter}}'{{#hasMore}},
|
||||||
{{/hasMore}}{{/vars}}
|
{{/hasMore}}{{/vars}}
|
||||||
);
|
);
|
||||||
|
|
||||||
{{#vars}}
|
{{#vars}}
|
||||||
/** @var {{datatype}} ${{name}} {{#description}}{{{description}}} {{/description}}*/
|
/** @var {{datatype}} ${{name}} {{#description}}{{{description}}} {{/description}}*/
|
||||||
protected ${{name}};
|
protected ${{name}};
|
||||||
{{/vars}}
|
{{/vars}}
|
||||||
public function __construct(array $data = null) {
|
public function __construct(array $data = null) {
|
||||||
if ($data != null) {
|
if ($data != null) {
|
||||||
{{#vars}}$this->{{name}} = $data["{{name}}"];{{#hasMore}}
|
{{#vars}}$this->{{name}} = $data["{{name}}"];{{#hasMore}}
|
||||||
{{/hasMore}}{{/vars}}
|
{{/hasMore}}{{/vars}}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
{{#vars}}
|
||||||
{{#vars}}
|
/**
|
||||||
/**
|
* get {{name}}
|
||||||
* get {{name}}
|
* @return {{datatype}}
|
||||||
* @return {{datatype}}
|
*/
|
||||||
*/
|
public function {{getter}}() {
|
||||||
public function {{getter}}() {
|
return $this->{{name}};
|
||||||
return $this->{{name}};
|
}
|
||||||
}
|
|
||||||
|
/**
|
||||||
/**
|
* set {{name}}
|
||||||
* set {{name}}
|
* @param {{datatype}} ${{name}}
|
||||||
* @param {{datatype}} ${{name}}
|
* @return $this
|
||||||
* @return $this
|
*/
|
||||||
*/
|
public function {{setter}}(${{name}}) {
|
||||||
public function {{setter}}(${{name}}) {
|
$this->{{name}} = ${{name}};
|
||||||
$this->{{name}} = ${{name}};
|
return $this;
|
||||||
return $this;
|
}
|
||||||
}
|
{{/vars}}
|
||||||
{{/vars}}
|
public function offsetExists($offset) {
|
||||||
public function offsetExists($offset) {
|
return isset($this->$offset);
|
||||||
return isset($this->$offset);
|
}
|
||||||
}
|
|
||||||
|
public function offsetGet($offset) {
|
||||||
public function offsetGet($offset) {
|
return $this->$offset;
|
||||||
return $this->$offset;
|
}
|
||||||
}
|
|
||||||
|
public function offsetSet($offset, $value) {
|
||||||
public function offsetSet($offset, $value) {
|
$this->$offset = $value;
|
||||||
$this->$offset = $value;
|
}
|
||||||
}
|
|
||||||
|
public function offsetUnset($offset) {
|
||||||
public function offsetUnset($offset) {
|
unset($this->$offset);
|
||||||
unset($this->$offset);
|
}
|
||||||
}
|
|
||||||
|
public function __toString() {
|
||||||
public function __toString() {
|
if (defined('JSON_PRETTY_PRINT')) {
|
||||||
if (defined('JSON_PRETTY_PRINT')) {
|
return json_encode(get_object_vars($this), JSON_PRETTY_PRINT);
|
||||||
return json_encode(get_object_vars($this), JSON_PRETTY_PRINT);
|
} else {
|
||||||
} else {
|
return json_encode(get_object_vars($this));
|
||||||
return json_encode(get_object_vars($this));
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
{{/model}}
|
{{/model}}
|
||||||
{{/models}}
|
{{/models}}
|
||||||
|
@ -235,7 +235,7 @@
|
|||||||
"200": {
|
"200": {
|
||||||
"description": "successful operation",
|
"description": "successful operation",
|
||||||
"schema": {
|
"schema": {
|
||||||
"$ref": "#/definitions/Pet"
|
"type": "file"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"400": {
|
"400": {
|
||||||
|
@ -1,32 +1,32 @@
|
|||||||
{
|
{
|
||||||
"name": "swagger/swagger-client",
|
"name": "swagger/swagger-client",
|
||||||
"description": "",
|
"description": "",
|
||||||
"keywords": [
|
"keywords": [
|
||||||
"swagger",
|
"swagger",
|
||||||
"php",
|
"php",
|
||||||
"sdk",
|
"sdk",
|
||||||
"api"
|
"api"
|
||||||
],
|
],
|
||||||
"homepage": "http://swagger.io",
|
"homepage": "http://swagger.io",
|
||||||
"license": "Apache v2",
|
"license": "Apache v2",
|
||||||
"authors": [
|
"authors": [
|
||||||
{
|
{
|
||||||
"name": "Swagger and contributors",
|
"name": "Swagger and contributors",
|
||||||
"homepage": "https://github.com/swagger-api/swagger-codegen"
|
"homepage": "https://github.com/swagger-api/swagger-codegen"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"require": {
|
||||||
|
"php": ">=5.3.3",
|
||||||
|
"ext-curl": "*",
|
||||||
|
"ext-json": "*",
|
||||||
|
"ext-mbstring": "*"
|
||||||
|
},
|
||||||
|
"require-dev": {
|
||||||
|
"phpunit/phpunit": "~4.0",
|
||||||
|
"satooshi/php-coveralls": "~0.6.1",
|
||||||
|
"squizlabs/php_codesniffer": "~2.0"
|
||||||
|
},
|
||||||
|
"autoload": {
|
||||||
|
"psr-4": { "Swagger\\Client\\" : "lib/" }
|
||||||
}
|
}
|
||||||
],
|
|
||||||
"require": {
|
|
||||||
"php": ">=5.3.3",
|
|
||||||
"ext-curl": "*",
|
|
||||||
"ext-json": "*",
|
|
||||||
"ext-mbstring": "*"
|
|
||||||
},
|
|
||||||
"require-dev": {
|
|
||||||
"phpunit/phpunit": "~4.0",
|
|
||||||
"satooshi/php-coveralls": "~0.6.1",
|
|
||||||
"squizlabs/php_codesniffer": "~2.0"
|
|
||||||
},
|
|
||||||
"autoload": {
|
|
||||||
"psr-4": { "Swagger\\Client\\" : "lib/" }
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
File diff suppressed because it is too large
Load Diff
@ -29,62 +29,62 @@ use \Swagger\Client\ObjectSerializer;
|
|||||||
|
|
||||||
class StoreApi {
|
class StoreApi {
|
||||||
|
|
||||||
/** @var \Swagger\Client\ApiClient instance of the ApiClient */
|
/** @var \Swagger\Client\ApiClient instance of the ApiClient */
|
||||||
private $apiClient;
|
private $apiClient;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param \Swagger\Client\ApiClient|null $apiClient The api client to use
|
* @param \Swagger\Client\ApiClient|null $apiClient The api client to use
|
||||||
*/
|
*/
|
||||||
function __construct($apiClient = null) {
|
function __construct($apiClient = null) {
|
||||||
if ($apiClient == null) {
|
if ($apiClient == null) {
|
||||||
$apiClient = new ApiClient();
|
$apiClient = new ApiClient();
|
||||||
$apiClient->getConfig()->setHost('http://petstore.swagger.io/v2');
|
$apiClient->getConfig()->setHost('http://petstore.swagger.io/v2');
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->apiClient = $apiClient;
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->apiClient = $apiClient;
|
/**
|
||||||
}
|
* @return \Swagger\Client\ApiClient get the API client
|
||||||
|
*/
|
||||||
|
public function getApiClient() {
|
||||||
|
return $this->apiClient;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return \Swagger\Client\ApiClient get the API client
|
* @param \Swagger\Client\ApiClient $apiClient set the API client
|
||||||
*/
|
* @return StoreApi
|
||||||
public function getApiClient() {
|
*/
|
||||||
return $this->apiClient;
|
public function setApiClient(ApiClient $apiClient) {
|
||||||
}
|
$this->apiClient = $apiClient;
|
||||||
|
return $this;
|
||||||
/**
|
}
|
||||||
* @param \Swagger\Client\ApiClient $apiClient set the API client
|
|
||||||
* @return StoreApi
|
|
||||||
*/
|
|
||||||
public function setApiClient(ApiClient $apiClient) {
|
|
||||||
$this->apiClient = $apiClient;
|
|
||||||
return $this;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* getInventory
|
* getInventory
|
||||||
*
|
*
|
||||||
* Returns pet inventories by status
|
* Returns pet inventories by status
|
||||||
*
|
*
|
||||||
* @return map[string,int]
|
* @return map[string,int]
|
||||||
* @throws \Swagger\Client\ApiException on non-2xx response
|
* @throws \Swagger\Client\ApiException on non-2xx response
|
||||||
*/
|
*/
|
||||||
public function getInventory() {
|
public function getInventory() {
|
||||||
|
|
||||||
|
|
||||||
// parse inputs
|
// parse inputs
|
||||||
$resourcePath = "/store/inventory";
|
$resourcePath = "/store/inventory";
|
||||||
$resourcePath = str_replace("{format}", "json", $resourcePath);
|
$resourcePath = str_replace("{format}", "json", $resourcePath);
|
||||||
$method = "GET";
|
$method = "GET";
|
||||||
$httpBody = '';
|
$httpBody = '';
|
||||||
$queryParams = array();
|
$queryParams = array();
|
||||||
$headerParams = array();
|
$headerParams = array();
|
||||||
$formParams = array();
|
$formParams = array();
|
||||||
$_header_accept = ApiClient::selectHeaderAccept(array('application/json', 'application/xml'));
|
$_header_accept = ApiClient::selectHeaderAccept(array('application/json', 'application/xml'));
|
||||||
if (!is_null($_header_accept)) {
|
if (!is_null($_header_accept)) {
|
||||||
$headerParams['Accept'] = $_header_accept;
|
$headerParams['Accept'] = $_header_accept;
|
||||||
}
|
}
|
||||||
$headerParams['Content-Type'] = ApiClient::selectHeaderContentType(array());
|
$headerParams['Content-Type'] = ApiClient::selectHeaderContentType(array());
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -92,252 +92,249 @@ class StoreApi {
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
// for model (json/xml)
|
// for model (json/xml)
|
||||||
if (isset($_tempBody)) {
|
if (isset($_tempBody)) {
|
||||||
$httpBody = $_tempBody; // $_tempBody is the method argument, if present
|
$httpBody = $_tempBody; // $_tempBody is the method argument, if present
|
||||||
} else if (count($formParams) > 0) {
|
} else if (count($formParams) > 0) {
|
||||||
// for HTTP post (form)
|
// for HTTP post (form)
|
||||||
$httpBody = $formParams;
|
$httpBody = $formParams;
|
||||||
}
|
|
||||||
|
|
||||||
$apiKey = $this->apiClient->getApiKeyWithPrefix('api_key');
|
|
||||||
if (isset($apiKey)) {
|
|
||||||
$headerParams['api_key'] = $apiKey;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// make the API Call
|
|
||||||
try {
|
|
||||||
list($response, $httpHeader) = $this->apiClient->callApi($resourcePath, $method,
|
|
||||||
$queryParams, $httpBody,
|
|
||||||
$headerParams, 'map[string,int]');
|
|
||||||
} catch (ApiException $e) {
|
|
||||||
switch ($e->getCode()) {
|
|
||||||
case 200:
|
|
||||||
$data = $this->apiClient->getSerializer()->deserialize($e->getResponseBody(), 'map[string,int]', $httpHeader);
|
|
||||||
$e->setResponseObject($data);
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
throw $e;
|
$apiKey = $this->apiClient->getApiKeyWithPrefix('api_key');
|
||||||
}
|
if (isset($apiKey)) {
|
||||||
|
$headerParams['api_key'] = $apiKey;
|
||||||
if (!$response) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
$responseObject = $this->apiClient->getSerializer()->deserialize($response,'map[string,int]');
|
|
||||||
return $responseObject;
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* placeOrder
|
|
||||||
*
|
|
||||||
* Place an order for a pet
|
|
||||||
*
|
|
||||||
* @param \Swagger\Client\Model\Order $body order placed for purchasing the pet (required)
|
|
||||||
* @return \Swagger\Client\Model\Order
|
|
||||||
* @throws \Swagger\Client\ApiException on non-2xx response
|
|
||||||
*/
|
|
||||||
public function placeOrder($body) {
|
|
||||||
|
|
||||||
|
|
||||||
// parse inputs
|
|
||||||
$resourcePath = "/store/order";
|
|
||||||
$resourcePath = str_replace("{format}", "json", $resourcePath);
|
|
||||||
$method = "POST";
|
|
||||||
$httpBody = '';
|
|
||||||
$queryParams = array();
|
|
||||||
$headerParams = array();
|
|
||||||
$formParams = array();
|
|
||||||
$_header_accept = ApiClient::selectHeaderAccept(array('application/json', 'application/xml'));
|
|
||||||
if (!is_null($_header_accept)) {
|
|
||||||
$headerParams['Accept'] = $_header_accept;
|
|
||||||
}
|
|
||||||
$headerParams['Content-Type'] = ApiClient::selectHeaderContentType(array());
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// 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
|
|
||||||
} else if (count($formParams) > 0) {
|
|
||||||
// for HTTP post (form)
|
|
||||||
$httpBody = $formParams;
|
|
||||||
}
|
|
||||||
|
|
||||||
// make the API Call
|
|
||||||
try {
|
|
||||||
list($response, $httpHeader) = $this->apiClient->callApi($resourcePath, $method,
|
|
||||||
$queryParams, $httpBody,
|
|
||||||
$headerParams, '\Swagger\Client\Model\Order');
|
|
||||||
} catch (ApiException $e) {
|
|
||||||
switch ($e->getCode()) {
|
|
||||||
case 200:
|
|
||||||
$data = $this->apiClient->getSerializer()->deserialize($e->getResponseBody(), '\Swagger\Client\Model\Order', $httpHeader);
|
|
||||||
$e->setResponseObject($data);
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
throw $e;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!$response) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
$responseObject = $this->apiClient->getSerializer()->deserialize($response,'\Swagger\Client\Model\Order');
|
|
||||||
return $responseObject;
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* getOrderById
|
|
||||||
*
|
|
||||||
* Find purchase order by ID
|
|
||||||
*
|
|
||||||
* @param string $order_id ID of pet that needs to be fetched (required)
|
|
||||||
* @return \Swagger\Client\Model\Order
|
|
||||||
* @throws \Swagger\Client\ApiException on non-2xx response
|
|
||||||
*/
|
|
||||||
public function getOrderById($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
|
// make the API Call
|
||||||
$resourcePath = "/store/order/{orderId}";
|
try {
|
||||||
$resourcePath = str_replace("{format}", "json", $resourcePath);
|
list($response, $httpHeader) = $this->apiClient->callApi($resourcePath, $method,
|
||||||
$method = "GET";
|
$queryParams, $httpBody,
|
||||||
$httpBody = '';
|
$headerParams, 'map[string,int]');
|
||||||
$queryParams = array();
|
} catch (ApiException $e) {
|
||||||
$headerParams = array();
|
switch ($e->getCode()) {
|
||||||
$formParams = array();
|
case 200:
|
||||||
$_header_accept = ApiClient::selectHeaderAccept(array('application/json', 'application/xml'));
|
$data = $this->apiClient->getSerializer()->deserialize($e->getResponseBody(), 'map[string,int]', $httpHeader);
|
||||||
if (!is_null($_header_accept)) {
|
$e->setResponseObject($data);
|
||||||
$headerParams['Accept'] = $_header_accept;
|
break;
|
||||||
}
|
}
|
||||||
$headerParams['Content-Type'] = ApiClient::selectHeaderContentType(array());
|
|
||||||
|
|
||||||
|
throw $e;
|
||||||
|
|
||||||
// path params
|
|
||||||
if($order_id !== null) {
|
|
||||||
$resourcePath = str_replace("{" . "orderId" . "}",
|
|
||||||
$this->apiClient->getSerializer()->toPathValue($order_id),
|
|
||||||
$resourcePath);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// for model (json/xml)
|
|
||||||
if (isset($_tempBody)) {
|
|
||||||
$httpBody = $_tempBody; // $_tempBody is the method argument, if present
|
|
||||||
} else if (count($formParams) > 0) {
|
|
||||||
// for HTTP post (form)
|
|
||||||
$httpBody = $formParams;
|
|
||||||
}
|
|
||||||
|
|
||||||
// make the API Call
|
|
||||||
try {
|
|
||||||
list($response, $httpHeader) = $this->apiClient->callApi($resourcePath, $method,
|
|
||||||
$queryParams, $httpBody,
|
|
||||||
$headerParams, '\Swagger\Client\Model\Order');
|
|
||||||
} catch (ApiException $e) {
|
|
||||||
switch ($e->getCode()) {
|
|
||||||
case 200:
|
|
||||||
$data = $this->apiClient->getSerializer()->deserialize($e->getResponseBody(), '\Swagger\Client\Model\Order', $httpHeader);
|
|
||||||
$e->setResponseObject($data);
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
throw $e;
|
if (!$response) {
|
||||||
}
|
return null;
|
||||||
|
|
||||||
if (!$response) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
$responseObject = $this->apiClient->getSerializer()->deserialize($response,'\Swagger\Client\Model\Order');
|
|
||||||
return $responseObject;
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* deleteOrder
|
|
||||||
*
|
|
||||||
* Delete purchase order by ID
|
|
||||||
*
|
|
||||||
* @param string $order_id ID of the order that needs to be deleted (required)
|
|
||||||
* @return void
|
|
||||||
* @throws \Swagger\Client\ApiException on non-2xx response
|
|
||||||
*/
|
|
||||||
public function deleteOrder($order_id) {
|
|
||||||
|
|
||||||
// verify the required parameter 'order_id' is set
|
|
||||||
if ($order_id === null) {
|
|
||||||
throw new \InvalidArgumentException('Missing the required parameter $order_id when calling deleteOrder');
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// parse inputs
|
|
||||||
$resourcePath = "/store/order/{orderId}";
|
|
||||||
$resourcePath = str_replace("{format}", "json", $resourcePath);
|
|
||||||
$method = "DELETE";
|
|
||||||
$httpBody = '';
|
|
||||||
$queryParams = array();
|
|
||||||
$headerParams = array();
|
|
||||||
$formParams = array();
|
|
||||||
$_header_accept = ApiClient::selectHeaderAccept(array('application/json', 'application/xml'));
|
|
||||||
if (!is_null($_header_accept)) {
|
|
||||||
$headerParams['Accept'] = $_header_accept;
|
|
||||||
}
|
|
||||||
$headerParams['Content-Type'] = ApiClient::selectHeaderContentType(array());
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// path params
|
|
||||||
if($order_id !== null) {
|
|
||||||
$resourcePath = str_replace("{" . "orderId" . "}",
|
|
||||||
$this->apiClient->getSerializer()->toPathValue($order_id),
|
|
||||||
$resourcePath);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// for model (json/xml)
|
|
||||||
if (isset($_tempBody)) {
|
|
||||||
$httpBody = $_tempBody; // $_tempBody is the method argument, if present
|
|
||||||
} else if (count($formParams) > 0) {
|
|
||||||
// for HTTP post (form)
|
|
||||||
$httpBody = $formParams;
|
|
||||||
}
|
|
||||||
|
|
||||||
// make the API Call
|
|
||||||
try {
|
|
||||||
list($response, $httpHeader) = $this->apiClient->callApi($resourcePath, $method,
|
|
||||||
$queryParams, $httpBody,
|
|
||||||
$headerParams);
|
|
||||||
} catch (ApiException $e) {
|
|
||||||
switch ($e->getCode()) {
|
|
||||||
}
|
}
|
||||||
|
|
||||||
throw $e;
|
return $this->apiClient->getSerializer()->deserialize($response,'map[string,int]');
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* placeOrder
|
||||||
|
*
|
||||||
|
* Place an order for a pet
|
||||||
|
*
|
||||||
|
* @param \Swagger\Client\Model\Order $body order placed for purchasing the pet (required)
|
||||||
|
* @return \Swagger\Client\Model\Order
|
||||||
|
* @throws \Swagger\Client\ApiException on non-2xx response
|
||||||
|
*/
|
||||||
|
public function placeOrder($body) {
|
||||||
|
|
||||||
|
|
||||||
|
// parse inputs
|
||||||
|
$resourcePath = "/store/order";
|
||||||
|
$resourcePath = str_replace("{format}", "json", $resourcePath);
|
||||||
|
$method = "POST";
|
||||||
|
$httpBody = '';
|
||||||
|
$queryParams = array();
|
||||||
|
$headerParams = array();
|
||||||
|
$formParams = array();
|
||||||
|
$_header_accept = ApiClient::selectHeaderAccept(array('application/json', 'application/xml'));
|
||||||
|
if (!is_null($_header_accept)) {
|
||||||
|
$headerParams['Accept'] = $_header_accept;
|
||||||
|
}
|
||||||
|
$headerParams['Content-Type'] = ApiClient::selectHeaderContentType(array());
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
// 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
|
||||||
|
} else if (count($formParams) > 0) {
|
||||||
|
// for HTTP post (form)
|
||||||
|
$httpBody = $formParams;
|
||||||
|
}
|
||||||
|
|
||||||
|
// make the API Call
|
||||||
|
try {
|
||||||
|
list($response, $httpHeader) = $this->apiClient->callApi($resourcePath, $method,
|
||||||
|
$queryParams, $httpBody,
|
||||||
|
$headerParams, '\Swagger\Client\Model\Order');
|
||||||
|
} catch (ApiException $e) {
|
||||||
|
switch ($e->getCode()) {
|
||||||
|
case 200:
|
||||||
|
$data = $this->apiClient->getSerializer()->deserialize($e->getResponseBody(), '\Swagger\Client\Model\Order', $httpHeader);
|
||||||
|
$e->setResponseObject($data);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
throw $e;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!$response) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
return $this->apiClient->getSerializer()->deserialize($response,'\Swagger\Client\Model\Order');
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* getOrderById
|
||||||
|
*
|
||||||
|
* Find purchase order by ID
|
||||||
|
*
|
||||||
|
* @param string $order_id ID of pet that needs to be fetched (required)
|
||||||
|
* @return \Swagger\Client\Model\Order
|
||||||
|
* @throws \Swagger\Client\ApiException on non-2xx response
|
||||||
|
*/
|
||||||
|
public function getOrderById($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}";
|
||||||
|
$resourcePath = str_replace("{format}", "json", $resourcePath);
|
||||||
|
$method = "GET";
|
||||||
|
$httpBody = '';
|
||||||
|
$queryParams = array();
|
||||||
|
$headerParams = array();
|
||||||
|
$formParams = array();
|
||||||
|
$_header_accept = ApiClient::selectHeaderAccept(array('application/json', 'application/xml'));
|
||||||
|
if (!is_null($_header_accept)) {
|
||||||
|
$headerParams['Accept'] = $_header_accept;
|
||||||
|
}
|
||||||
|
$headerParams['Content-Type'] = ApiClient::selectHeaderContentType(array());
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
// path params
|
||||||
|
if($order_id !== null) {
|
||||||
|
$resourcePath = str_replace("{" . "orderId" . "}",
|
||||||
|
$this->apiClient->getSerializer()->toPathValue($order_id),
|
||||||
|
$resourcePath);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
// for model (json/xml)
|
||||||
|
if (isset($_tempBody)) {
|
||||||
|
$httpBody = $_tempBody; // $_tempBody is the method argument, if present
|
||||||
|
} else if (count($formParams) > 0) {
|
||||||
|
// for HTTP post (form)
|
||||||
|
$httpBody = $formParams;
|
||||||
|
}
|
||||||
|
|
||||||
|
// make the API Call
|
||||||
|
try {
|
||||||
|
list($response, $httpHeader) = $this->apiClient->callApi($resourcePath, $method,
|
||||||
|
$queryParams, $httpBody,
|
||||||
|
$headerParams, '\Swagger\Client\Model\Order');
|
||||||
|
} catch (ApiException $e) {
|
||||||
|
switch ($e->getCode()) {
|
||||||
|
case 200:
|
||||||
|
$data = $this->apiClient->getSerializer()->deserialize($e->getResponseBody(), '\Swagger\Client\Model\Order', $httpHeader);
|
||||||
|
$e->setResponseObject($data);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
throw $e;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!$response) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
return $this->apiClient->getSerializer()->deserialize($response,'\Swagger\Client\Model\Order');
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* deleteOrder
|
||||||
|
*
|
||||||
|
* Delete purchase order by ID
|
||||||
|
*
|
||||||
|
* @param string $order_id ID of the order that needs to be deleted (required)
|
||||||
|
* @return void
|
||||||
|
* @throws \Swagger\Client\ApiException on non-2xx response
|
||||||
|
*/
|
||||||
|
public function deleteOrder($order_id) {
|
||||||
|
|
||||||
|
// verify the required parameter 'order_id' is set
|
||||||
|
if ($order_id === null) {
|
||||||
|
throw new \InvalidArgumentException('Missing the required parameter $order_id when calling deleteOrder');
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// parse inputs
|
||||||
|
$resourcePath = "/store/order/{orderId}";
|
||||||
|
$resourcePath = str_replace("{format}", "json", $resourcePath);
|
||||||
|
$method = "DELETE";
|
||||||
|
$httpBody = '';
|
||||||
|
$queryParams = array();
|
||||||
|
$headerParams = array();
|
||||||
|
$formParams = array();
|
||||||
|
$_header_accept = ApiClient::selectHeaderAccept(array('application/json', 'application/xml'));
|
||||||
|
if (!is_null($_header_accept)) {
|
||||||
|
$headerParams['Accept'] = $_header_accept;
|
||||||
|
}
|
||||||
|
$headerParams['Content-Type'] = ApiClient::selectHeaderContentType(array());
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
// path params
|
||||||
|
if($order_id !== null) {
|
||||||
|
$resourcePath = str_replace("{" . "orderId" . "}",
|
||||||
|
$this->apiClient->getSerializer()->toPathValue($order_id),
|
||||||
|
$resourcePath);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
// for model (json/xml)
|
||||||
|
if (isset($_tempBody)) {
|
||||||
|
$httpBody = $_tempBody; // $_tempBody is the method argument, if present
|
||||||
|
} else if (count($formParams) > 0) {
|
||||||
|
// for HTTP post (form)
|
||||||
|
$httpBody = $formParams;
|
||||||
|
}
|
||||||
|
|
||||||
|
// make the API Call
|
||||||
|
try {
|
||||||
|
list($response, $httpHeader) = $this->apiClient->callApi($resourcePath, $method,
|
||||||
|
$queryParams, $httpBody,
|
||||||
|
$headerParams);
|
||||||
|
} catch (ApiException $e) {
|
||||||
|
switch ($e->getCode()) {
|
||||||
|
}
|
||||||
|
|
||||||
|
throw $e;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
File diff suppressed because it is too large
Load Diff
@ -19,206 +19,206 @@ namespace Swagger\Client;
|
|||||||
|
|
||||||
class ApiClient {
|
class ApiClient {
|
||||||
|
|
||||||
public static $PATCH = "PATCH";
|
public static $PATCH = "PATCH";
|
||||||
public static $POST = "POST";
|
public static $POST = "POST";
|
||||||
public static $GET = "GET";
|
public static $GET = "GET";
|
||||||
public static $PUT = "PUT";
|
public static $PUT = "PUT";
|
||||||
public static $DELETE = "DELETE";
|
public static $DELETE = "DELETE";
|
||||||
|
|
||||||
/** @var Configuration */
|
/** @var Configuration */
|
||||||
protected $config;
|
protected $config;
|
||||||
|
|
||||||
/** @var ObjectSerializer */
|
/** @var ObjectSerializer */
|
||||||
protected $serializer;
|
protected $serializer;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param Configuration $config config for this ApiClient
|
* @param Configuration $config config for this ApiClient
|
||||||
*/
|
*/
|
||||||
function __construct(Configuration $config = null) {
|
function __construct(Configuration $config = null) {
|
||||||
if ($config == null) {
|
if ($config == null) {
|
||||||
$config = Configuration::getDefaultConfiguration();
|
$config = Configuration::getDefaultConfiguration();
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->config = $config;
|
||||||
|
$this->serializer = new ObjectSerializer();
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->config = $config;
|
/**
|
||||||
$this->serializer = new ObjectSerializer();
|
* get the config
|
||||||
}
|
* @return Configuration
|
||||||
|
*/
|
||||||
/**
|
public function getConfig() {
|
||||||
* get the config
|
return $this->config;
|
||||||
* @return Configuration
|
|
||||||
*/
|
|
||||||
public function getConfig() {
|
|
||||||
return $this->config;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* get the serializer
|
|
||||||
* @return ObjectSerializer
|
|
||||||
*/
|
|
||||||
public function getSerializer() {
|
|
||||||
return $this->serializer;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get API key (with prefix if set)
|
|
||||||
* @param string $apiKey name of apikey
|
|
||||||
* @return string API key with the prefix
|
|
||||||
*/
|
|
||||||
public function getApiKeyWithPrefix($apiKey) {
|
|
||||||
$prefix = $this->config->getApiKeyPrefix($apiKey);
|
|
||||||
$apiKey = $this->config->getApiKey($apiKey);
|
|
||||||
|
|
||||||
if (!isset($apiKey)) {
|
|
||||||
return null;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isset($prefix)) {
|
/**
|
||||||
$keyWithPrefix = $prefix." ".$apiKey;
|
* get the serializer
|
||||||
} else {
|
* @return ObjectSerializer
|
||||||
$keyWithPrefix = $apiKey;
|
*/
|
||||||
|
public function getSerializer() {
|
||||||
|
return $this->serializer;
|
||||||
}
|
}
|
||||||
|
|
||||||
return $keyWithPrefix;
|
/**
|
||||||
}
|
* Get API key (with prefix if set)
|
||||||
|
* @param string $apiKey name of apikey
|
||||||
|
* @return string API key with the prefix
|
||||||
|
*/
|
||||||
|
public function getApiKeyWithPrefix($apiKeyIdentifier) {
|
||||||
|
$prefix = $this->config->getApiKeyPrefix($apiKeyIdentifier);
|
||||||
|
$apiKey = $this->config->getApiKey($apiKeyIdentifier);
|
||||||
|
|
||||||
/**
|
if (!isset($apiKey)) {
|
||||||
* @param string $resourcePath path to method endpoint
|
return null;
|
||||||
* @param string $method method to call
|
}
|
||||||
* @param array $queryParams parameters to be place in query URL
|
|
||||||
* @param array $postData parameters to be placed in POST body
|
|
||||||
* @param array $headerParams parameters to be place in request header
|
|
||||||
* @throws \Swagger\Client\ApiException on a non 2xx response
|
|
||||||
* @return mixed
|
|
||||||
*/
|
|
||||||
public function callApi($resourcePath, $method, $queryParams, $postData, $headerParams, $responseType=null) {
|
|
||||||
|
|
||||||
$headers = array();
|
if (isset($prefix)) {
|
||||||
|
$keyWithPrefix = $prefix." ".$apiKey;
|
||||||
|
} else {
|
||||||
|
$keyWithPrefix = $apiKey;
|
||||||
|
}
|
||||||
|
|
||||||
# construct the http header
|
return $keyWithPrefix;
|
||||||
$headerParams = array_merge((array)$this->config->getDefaultHeaders(), (array)$headerParams);
|
|
||||||
|
|
||||||
foreach ($headerParams as $key => $val) {
|
|
||||||
$headers[] = "$key: $val";
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// form data
|
/**
|
||||||
if ($postData and in_array('Content-Type: application/x-www-form-urlencoded', $headers)) {
|
* @param string $resourcePath path to method endpoint
|
||||||
$postData = http_build_query($postData);
|
* @param string $method method to call
|
||||||
}
|
* @param array $queryParams parameters to be place in query URL
|
||||||
else if ((is_object($postData) or is_array($postData)) and !in_array('Content-Type: multipart/form-data', $headers)) { // json model
|
* @param array $postData parameters to be placed in POST body
|
||||||
$postData = json_encode($this->serializer->sanitizeForSerialization($postData));
|
* @param array $headerParams parameters to be place in request header
|
||||||
|
* @throws \Swagger\Client\ApiException on a non 2xx response
|
||||||
|
* @return mixed
|
||||||
|
*/
|
||||||
|
public function callApi($resourcePath, $method, $queryParams, $postData, $headerParams, $responseType=null) {
|
||||||
|
|
||||||
|
$headers = array();
|
||||||
|
|
||||||
|
# construct the http header
|
||||||
|
$headerParams = array_merge((array)$this->config->getDefaultHeaders(), (array)$headerParams);
|
||||||
|
|
||||||
|
foreach ($headerParams as $key => $val) {
|
||||||
|
$headers[] = "$key: $val";
|
||||||
|
}
|
||||||
|
|
||||||
|
// form data
|
||||||
|
if ($postData and in_array('Content-Type: application/x-www-form-urlencoded', $headers)) {
|
||||||
|
$postData = http_build_query($postData);
|
||||||
|
}
|
||||||
|
else if ((is_object($postData) or is_array($postData)) and !in_array('Content-Type: multipart/form-data', $headers)) { // json model
|
||||||
|
$postData = json_encode($this->serializer->sanitizeForSerialization($postData));
|
||||||
|
}
|
||||||
|
|
||||||
|
$url = $this->config->getHost() . $resourcePath;
|
||||||
|
|
||||||
|
$curl = curl_init();
|
||||||
|
// set timeout, if needed
|
||||||
|
if ($this->config->getCurlTimeout() != 0) {
|
||||||
|
curl_setopt($curl, CURLOPT_TIMEOUT, $this->config->getCurlTimeout());
|
||||||
|
}
|
||||||
|
// return the result on success, rather than just TRUE
|
||||||
|
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
|
||||||
|
|
||||||
|
curl_setopt($curl, CURLOPT_HTTPHEADER, $headers);
|
||||||
|
|
||||||
|
if (! empty($queryParams)) {
|
||||||
|
$url = ($url . '?' . http_build_query($queryParams));
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($method == self::$POST) {
|
||||||
|
curl_setopt($curl, CURLOPT_POST, true);
|
||||||
|
curl_setopt($curl, CURLOPT_POSTFIELDS, $postData);
|
||||||
|
} else if ($method == self::$PATCH) {
|
||||||
|
curl_setopt($curl, CURLOPT_CUSTOMREQUEST, "PATCH");
|
||||||
|
curl_setopt($curl, CURLOPT_POSTFIELDS, $postData);
|
||||||
|
} else if ($method == self::$PUT) {
|
||||||
|
curl_setopt($curl, CURLOPT_CUSTOMREQUEST, "PUT");
|
||||||
|
curl_setopt($curl, CURLOPT_POSTFIELDS, $postData);
|
||||||
|
} else if ($method == self::$DELETE) {
|
||||||
|
curl_setopt($curl, CURLOPT_CUSTOMREQUEST, "DELETE");
|
||||||
|
curl_setopt($curl, CURLOPT_POSTFIELDS, $postData);
|
||||||
|
} else if ($method != self::$GET) {
|
||||||
|
throw new ApiException('Method ' . $method . ' is not recognized.');
|
||||||
|
}
|
||||||
|
curl_setopt($curl, CURLOPT_URL, $url);
|
||||||
|
|
||||||
|
// Set user agent
|
||||||
|
curl_setopt($curl, CURLOPT_USERAGENT, $this->config->getUserAgent());
|
||||||
|
|
||||||
|
// debugging for curl
|
||||||
|
if ($this->config->getDebug()) {
|
||||||
|
error_log("[DEBUG] HTTP Request body ~BEGIN~\n".print_r($postData, true)."\n~END~\n", 3, $this->config->getDebugFile());
|
||||||
|
|
||||||
|
curl_setopt($curl, CURLOPT_VERBOSE, 1);
|
||||||
|
curl_setopt($curl, CURLOPT_STDERR, fopen($this->config->getDebugFile(), 'a'));
|
||||||
|
} else {
|
||||||
|
curl_setopt($curl, CURLOPT_VERBOSE, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
// obtain the HTTP response headers
|
||||||
|
curl_setopt($curl, CURLOPT_HEADER, 1);
|
||||||
|
|
||||||
|
// Make the request
|
||||||
|
$response = curl_exec($curl);
|
||||||
|
$http_header_size = curl_getinfo($curl, CURLINFO_HEADER_SIZE);
|
||||||
|
$http_header = substr($response, 0, $http_header_size);
|
||||||
|
$http_body = substr($response, $http_header_size);
|
||||||
|
$response_info = curl_getinfo($curl);
|
||||||
|
|
||||||
|
// debug HTTP response body
|
||||||
|
if ($this->config->getDebug()) {
|
||||||
|
error_log("[DEBUG] HTTP Response body ~BEGIN~\n".print_r($http_body, true)."\n~END~\n", 3, $this->config->getDebugFile());
|
||||||
|
}
|
||||||
|
|
||||||
|
// Handle the response
|
||||||
|
if ($response_info['http_code'] == 0) {
|
||||||
|
throw new ApiException("API call to $url timed out: ".serialize($response_info), 0, null, null);
|
||||||
|
} else if ($response_info['http_code'] >= 200 && $response_info['http_code'] <= 299 ) {
|
||||||
|
// return raw body if response is a file
|
||||||
|
if ($responseType == '\SplFileObject') {
|
||||||
|
return array($http_body, $http_header);
|
||||||
|
}
|
||||||
|
|
||||||
|
$data = json_decode($http_body);
|
||||||
|
if (json_last_error() > 0) { // if response is a string
|
||||||
|
$data = $http_body;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
throw new ApiException("[".$response_info['http_code']."] Error connecting to the API ($url)",
|
||||||
|
$response_info['http_code'], $http_header, $http_body);
|
||||||
|
}
|
||||||
|
return array($data, $http_header);
|
||||||
}
|
}
|
||||||
|
|
||||||
$url = $this->config->getHost() . $resourcePath;
|
/*
|
||||||
|
* return the header 'Accept' based on an array of Accept provided
|
||||||
$curl = curl_init();
|
*
|
||||||
// set timeout, if needed
|
* @param string[] $accept Array of header
|
||||||
if ($this->config->getCurlTimeout() != 0) {
|
* @return string Accept (e.g. application/json)
|
||||||
curl_setopt($curl, CURLOPT_TIMEOUT, $this->config->getCurlTimeout());
|
*/
|
||||||
}
|
public static function selectHeaderAccept($accept) {
|
||||||
// return the result on success, rather than just TRUE
|
if (count($accept) === 0 or (count($accept) === 1 and $accept[0] === '')) {
|
||||||
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
|
return NULL;
|
||||||
|
} elseif (preg_grep("/application\/json/i", $accept)) {
|
||||||
curl_setopt($curl, CURLOPT_HTTPHEADER, $headers);
|
return 'application/json';
|
||||||
|
} else {
|
||||||
if (! empty($queryParams)) {
|
return implode(',', $accept);
|
||||||
$url = ($url . '?' . http_build_query($queryParams));
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($method == self::$POST) {
|
/*
|
||||||
curl_setopt($curl, CURLOPT_POST, true);
|
* return the content type based on an array of content-type provided
|
||||||
curl_setopt($curl, CURLOPT_POSTFIELDS, $postData);
|
*
|
||||||
} else if ($method == self::$PATCH) {
|
* @param string[] content_type_array Array fo content-type
|
||||||
curl_setopt($curl, CURLOPT_CUSTOMREQUEST, "PATCH");
|
* @return string Content-Type (e.g. application/json)
|
||||||
curl_setopt($curl, CURLOPT_POSTFIELDS, $postData);
|
*/
|
||||||
} else if ($method == self::$PUT) {
|
public static function selectHeaderContentType($content_type) {
|
||||||
curl_setopt($curl, CURLOPT_CUSTOMREQUEST, "PUT");
|
if (count($content_type) === 0 or (count($content_type) === 1 and $content_type[0] === '')) {
|
||||||
curl_setopt($curl, CURLOPT_POSTFIELDS, $postData);
|
return 'application/json';
|
||||||
} else if ($method == self::$DELETE) {
|
} elseif (preg_grep("/application\/json/i", $content_type)) {
|
||||||
curl_setopt($curl, CURLOPT_CUSTOMREQUEST, "DELETE");
|
return 'application/json';
|
||||||
curl_setopt($curl, CURLOPT_POSTFIELDS, $postData);
|
} else {
|
||||||
} else if ($method != self::$GET) {
|
return implode(',', $content_type);
|
||||||
throw new ApiException('Method ' . $method . ' is not recognized.');
|
}
|
||||||
}
|
}
|
||||||
curl_setopt($curl, CURLOPT_URL, $url);
|
|
||||||
|
|
||||||
// Set user agent
|
|
||||||
curl_setopt($curl, CURLOPT_USERAGENT, $this->config->getUserAgent());
|
|
||||||
|
|
||||||
// debugging for curl
|
|
||||||
if ($this->config->getDebug()) {
|
|
||||||
error_log("[DEBUG] HTTP Request body ~BEGIN~\n".print_r($postData, true)."\n~END~\n", 3, $this->config->getDebugFile());
|
|
||||||
|
|
||||||
curl_setopt($curl, CURLOPT_VERBOSE, 1);
|
|
||||||
curl_setopt($curl, CURLOPT_STDERR, fopen($this->config->getDebugFile(), 'a'));
|
|
||||||
} else {
|
|
||||||
curl_setopt($curl, CURLOPT_VERBOSE, 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
// obtain the HTTP response headers
|
|
||||||
curl_setopt($curl, CURLOPT_HEADER, 1);
|
|
||||||
|
|
||||||
// Make the request
|
|
||||||
$response = curl_exec($curl);
|
|
||||||
$http_header_size = curl_getinfo($curl, CURLINFO_HEADER_SIZE);
|
|
||||||
$http_header = substr($response, 0, $http_header_size);
|
|
||||||
$http_body = substr($response, $http_header_size);
|
|
||||||
$response_info = curl_getinfo($curl);
|
|
||||||
|
|
||||||
// debug HTTP response body
|
|
||||||
if ($this->config->getDebug()) {
|
|
||||||
error_log("[DEBUG] HTTP Response body ~BEGIN~\n".print_r($http_body, true)."\n~END~\n", 3, $this->config->getDebugFile());
|
|
||||||
}
|
|
||||||
|
|
||||||
// Handle the response
|
|
||||||
if ($response_info['http_code'] == 0) {
|
|
||||||
throw new ApiException("API call to $url timed out: ".serialize($response_info), 0, null, null);
|
|
||||||
} else if ($response_info['http_code'] >= 200 && $response_info['http_code'] <= 299 ) {
|
|
||||||
// return raw body if response is a file
|
|
||||||
if ($responseType == '\SplFileObject') {
|
|
||||||
return array($http_body, $http_header);
|
|
||||||
}
|
|
||||||
|
|
||||||
$data = json_decode($http_body);
|
|
||||||
if (json_last_error() > 0) { // if response is a string
|
|
||||||
$data = $http_body;
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
throw new ApiException("[".$response_info['http_code']."] Error connecting to the API ($url)",
|
|
||||||
$response_info['http_code'], $http_header, $http_body);
|
|
||||||
}
|
|
||||||
return array($data, $http_header);
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* return the header 'Accept' based on an array of Accept provided
|
|
||||||
*
|
|
||||||
* @param string[] $accept Array of header
|
|
||||||
* @return string Accept (e.g. application/json)
|
|
||||||
*/
|
|
||||||
public static function selectHeaderAccept($accept) {
|
|
||||||
if (count($accept) === 0 or (count($accept) === 1 and $accept[0] === '')) {
|
|
||||||
return NULL;
|
|
||||||
} elseif (preg_grep("/application\/json/i", $accept)) {
|
|
||||||
return 'application/json';
|
|
||||||
} else {
|
|
||||||
return implode(',', $accept);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* return the content type based on an array of content-type provided
|
|
||||||
*
|
|
||||||
* @param string[] content_type_array Array fo content-type
|
|
||||||
* @return string Content-Type (e.g. application/json)
|
|
||||||
*/
|
|
||||||
public static function selectHeaderContentType($content_type) {
|
|
||||||
if (count($content_type) === 0 or (count($content_type) === 1 and $content_type[0] === '')) {
|
|
||||||
return 'application/json';
|
|
||||||
} elseif (preg_grep("/application\/json/i", $content_type)) {
|
|
||||||
return 'application/json';
|
|
||||||
} else {
|
|
||||||
return implode(',', $content_type);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@ -21,50 +21,50 @@ use \Exception;
|
|||||||
|
|
||||||
class ApiException extends Exception {
|
class ApiException extends Exception {
|
||||||
|
|
||||||
/** @var string The HTTP body of the server response. */
|
/** @var string The HTTP body of the server response. */
|
||||||
protected $responseBody;
|
protected $responseBody;
|
||||||
|
|
||||||
/** @var string[] The HTTP header of the server response. */
|
/** @var string[] The HTTP header of the server response. */
|
||||||
protected $responseHeaders;
|
protected $responseHeaders;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The deserialized response object
|
* The deserialized response object
|
||||||
*/
|
*/
|
||||||
protected $responseObject;
|
protected $responseObject;
|
||||||
|
|
||||||
public function __construct($message="", $code=0, $responseHeaders=null, $responseBody=null) {
|
public function __construct($message="", $code=0, $responseHeaders=null, $responseBody=null) {
|
||||||
parent::__construct($message, $code);
|
parent::__construct($message, $code);
|
||||||
$this->responseHeaders = $responseHeaders;
|
$this->responseHeaders = $responseHeaders;
|
||||||
$this->responseBody = $responseBody;
|
$this->responseBody = $responseBody;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the HTTP response header
|
* Get the HTTP response header
|
||||||
*
|
*
|
||||||
* @return string HTTP response header
|
* @return string HTTP response header
|
||||||
*/
|
*/
|
||||||
public function getResponseHeaders() {
|
public function getResponseHeaders() {
|
||||||
return $this->responseHeaders;
|
return $this->responseHeaders;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the HTTP response body
|
* Get the HTTP response body
|
||||||
*
|
*
|
||||||
* @return string HTTP response body
|
* @return string HTTP response body
|
||||||
*/
|
*/
|
||||||
public function getResponseBody() {
|
public function getResponseBody() {
|
||||||
return $this->responseBody;
|
return $this->responseBody;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* sets the deseralized response object (during deserialization)
|
* sets the deseralized response object (during deserialization)
|
||||||
* @param mixed $obj
|
* @param mixed $obj
|
||||||
*/
|
*/
|
||||||
public function setResponseObject($obj) {
|
public function setResponseObject($obj) {
|
||||||
$this->responseObject = $obj;
|
$this->responseObject = $obj;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getResponseObject() {
|
public function getResponseObject() {
|
||||||
return $this->responseObject;
|
return $this->responseObject;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -19,262 +19,292 @@ namespace Swagger\Client;
|
|||||||
|
|
||||||
class Configuration {
|
class Configuration {
|
||||||
|
|
||||||
private static $defaultConfiguration = null;
|
private static $defaultConfiguration = null;
|
||||||
|
|
||||||
/** @var string[] Associate array to store API key(s) */
|
/** @var string[] Associate array to store API key(s) */
|
||||||
protected $apiKeys = array();
|
protected $apiKeys = array();
|
||||||
|
|
||||||
/** string[] Associate array to store API prefix (e.g. Bearer) */
|
/** string[] Associate array to store API prefix (e.g. Bearer) */
|
||||||
protected $apiKeyPrefixes = array();
|
protected $apiKeyPrefixes = array();
|
||||||
|
|
||||||
/** @var string Username for HTTP basic authentication */
|
/** @var string Username for HTTP basic authentication */
|
||||||
protected $username = '';
|
protected $username = '';
|
||||||
|
|
||||||
/** @var string Password for HTTP basic authentication */
|
/** @var string Password for HTTP basic authentication */
|
||||||
protected $password = '';
|
protected $password = '';
|
||||||
|
|
||||||
/** @var \Swagger\Client\ApiClient The default instance of ApiClient */
|
/** @var \Swagger\Client\ApiClient The default instance of ApiClient */
|
||||||
protected $defaultHeaders = array();
|
protected $defaultHeaders = array();
|
||||||
|
|
||||||
/** @var string The host */
|
/** @var string The host */
|
||||||
protected $host = 'http://localhost';
|
protected $host = 'http://localhost';
|
||||||
|
|
||||||
/** @var string timeout (second) of the HTTP request, by default set to 0, no timeout */
|
/** @var string timeout (second) of the HTTP request, by default set to 0, no timeout */
|
||||||
protected $curlTimeout = 0;
|
protected $curlTimeout = 0;
|
||||||
|
|
||||||
/** @var string user agent of the HTTP request, set to "PHP-Swagger" by default */
|
/** @var string user agent of the HTTP request, set to "PHP-Swagger" by default */
|
||||||
protected $userAgent = "PHP-Swagger";
|
protected $userAgent = "PHP-Swagger";
|
||||||
|
|
||||||
/** @var bool Debug switch (default set to false) */
|
/** @var bool Debug switch (default set to false) */
|
||||||
protected $debug = false;
|
protected $debug = false;
|
||||||
|
|
||||||
/** @var string Debug file location (log to STDOUT by default) */
|
/** @var string Debug file location (log to STDOUT by default) */
|
||||||
protected $debugFile = 'php://output';
|
protected $debugFile = 'php://output';
|
||||||
|
|
||||||
/**
|
/** @var string Debug file location (log to STDOUT by default) */
|
||||||
* @param string $key
|
protected $tempFolderPath;
|
||||||
* @param string $value
|
|
||||||
* @return Configuration
|
|
||||||
*/
|
|
||||||
public function setApiKey($key, $value) {
|
|
||||||
$this->apiKeys[$key] = $value;
|
|
||||||
return $this;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param $key
|
* @param string $tempFolderPath
|
||||||
* @return string
|
*/
|
||||||
*/
|
public function __construct() {
|
||||||
public function getApiKey($key) {
|
$this->tempFolderPath = sys_get_temp_dir();
|
||||||
return isset($this->apiKeys[$key]) ? $this->apiKeys[$key] : null;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param string $key
|
|
||||||
* @param string $value
|
|
||||||
* @return Configuration
|
|
||||||
*/
|
|
||||||
public function setApiKeyPrefix($key, $value) {
|
|
||||||
$this->apiKeyPrefixes[$key] = $value;
|
|
||||||
return $this;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param $key
|
|
||||||
* @return string
|
|
||||||
*/
|
|
||||||
public function getApiKeyPrefix($key) {
|
|
||||||
return isset($this->apiKeyPrefixes[$key]) ? $this->apiKeyPrefixes[$key] : null;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param string $username
|
|
||||||
* @return Configuration
|
|
||||||
*/
|
|
||||||
public function setUsername($username) {
|
|
||||||
$this->username = $username;
|
|
||||||
return $this;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @return string
|
|
||||||
*/
|
|
||||||
public function getUsername() {
|
|
||||||
return $this->username;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param string $password
|
|
||||||
* @return Configuration
|
|
||||||
*/
|
|
||||||
public function setPassword($password) {
|
|
||||||
$this->password = $password;
|
|
||||||
return $this;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @return string
|
|
||||||
*/
|
|
||||||
public function getPassword() {
|
|
||||||
return $this->password;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* add default header
|
|
||||||
*
|
|
||||||
* @param string $headerName header name (e.g. Token)
|
|
||||||
* @param string $headerValue header value (e.g. 1z8wp3)
|
|
||||||
* @return ApiClient
|
|
||||||
*/
|
|
||||||
public function addDefaultHeader($headerName, $headerValue) {
|
|
||||||
if (!is_string($headerName)) {
|
|
||||||
throw new \InvalidArgumentException('Header name must be a string.');
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->defaultHeaders[$headerName] = $headerValue;
|
|
||||||
return $this;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* get the default header
|
* @param string $key
|
||||||
*
|
* @param string $value
|
||||||
* @return array default header
|
* @return Configuration
|
||||||
*/
|
*/
|
||||||
public function getDefaultHeaders() {
|
public function setApiKey($key, $value) {
|
||||||
return $this->defaultHeaders;
|
$this->apiKeys[$key] = $value;
|
||||||
}
|
return $this;
|
||||||
|
|
||||||
/**
|
|
||||||
* delete a default header
|
|
||||||
* @param string $headerName the header to delete
|
|
||||||
* @return Configuration
|
|
||||||
*/
|
|
||||||
public function deleteDefaultHeader($headerName) {
|
|
||||||
unset($this->defaultHeaders[$headerName]);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param string $host
|
|
||||||
* @return Configuration
|
|
||||||
*/
|
|
||||||
public function setHost($host) {
|
|
||||||
$this->host = $host;
|
|
||||||
return $this;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @return string
|
|
||||||
*/
|
|
||||||
public function getHost() {
|
|
||||||
return $this->host;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* set the user agent of the api client
|
|
||||||
*
|
|
||||||
* @param string $userAgent the user agent of the api client
|
|
||||||
* @return ApiClient
|
|
||||||
*/
|
|
||||||
public function setUserAgent($userAgent) {
|
|
||||||
if (!is_string($userAgent)) {
|
|
||||||
throw new \InvalidArgumentException('User-agent must be a string.');
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->userAgent = $userAgent;
|
/**
|
||||||
return $this;
|
* @param $key
|
||||||
}
|
* @return string
|
||||||
|
*/
|
||||||
/**
|
public function getApiKey($key) {
|
||||||
* get the user agent of the api client
|
return isset($this->apiKeys[$key]) ? $this->apiKeys[$key] : null;
|
||||||
*
|
|
||||||
* @return string user agent
|
|
||||||
*/
|
|
||||||
public function getUserAgent() {
|
|
||||||
return $this->userAgent;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* set the HTTP timeout value
|
|
||||||
*
|
|
||||||
* @param integer $seconds Number of seconds before timing out [set to 0 for no timeout]
|
|
||||||
* @return ApiClient
|
|
||||||
*/
|
|
||||||
public function setCurlTimeout($seconds) {
|
|
||||||
if (!is_numeric($seconds) || $seconds < 0) {
|
|
||||||
throw new \InvalidArgumentException('Timeout value must be numeric and a non-negative number.');
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->curlTimeout = $seconds;
|
/**
|
||||||
return $this;
|
* @param string $key
|
||||||
}
|
* @param string $value
|
||||||
|
* @return Configuration
|
||||||
/**
|
*/
|
||||||
* get the HTTP timeout value
|
public function setApiKeyPrefix($key, $value) {
|
||||||
*
|
$this->apiKeyPrefixes[$key] = $value;
|
||||||
* @return string HTTP timeout value
|
return $this;
|
||||||
*/
|
|
||||||
public function getCurlTimeout() {
|
|
||||||
return $this->curlTimeout;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param bool $debug
|
|
||||||
* @return Configuration
|
|
||||||
*/
|
|
||||||
public function setDebug($debug) {
|
|
||||||
$this->debug = $debug;
|
|
||||||
return $this;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @return bool
|
|
||||||
*/
|
|
||||||
public function getDebug() {
|
|
||||||
return $this->debug;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param string $debugFile
|
|
||||||
* @return Configuration
|
|
||||||
*/
|
|
||||||
public function setDebugFile($debugFile) {
|
|
||||||
$this->debugFile = $debugFile;
|
|
||||||
return $this;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @return string
|
|
||||||
*/
|
|
||||||
public function getDebugFile() {
|
|
||||||
return $this->debugFile;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @return Configuration
|
|
||||||
*/
|
|
||||||
public static function getDefaultConfiguration() {
|
|
||||||
if (self::$defaultConfiguration == null) {
|
|
||||||
return new Configuration();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return self::$defaultConfiguration;
|
/**
|
||||||
}
|
* @param $key
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
public function getApiKeyPrefix($key) {
|
||||||
|
return isset($this->apiKeyPrefixes[$key]) ? $this->apiKeyPrefixes[$key] : null;
|
||||||
|
}
|
||||||
|
|
||||||
public static function setDefaultConfiguration(Configuration $config) {
|
/**
|
||||||
self::$defaultConfiguration = $config;
|
* @param string $username
|
||||||
}
|
* @return Configuration
|
||||||
|
*/
|
||||||
|
public function setUsername($username) {
|
||||||
|
$this->username = $username;
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/**
|
||||||
* return the report for debuggin
|
* @return string
|
||||||
*/
|
*/
|
||||||
public static function toDebugReport() {
|
public function getUsername() {
|
||||||
$report = "PHP SDK (Swagger\Client) Debug Report:\n";
|
return $this->username;
|
||||||
$report .= " OS: ".php_uname()."\n";
|
}
|
||||||
$report .= " PHP Version: ".phpversion()."\n";
|
|
||||||
$report .= " Swagger Spec Version: 1.0.0\n";
|
|
||||||
$report .= " SDK Package Version: 1.0.0\n";
|
|
||||||
|
|
||||||
return $report;
|
/**
|
||||||
}
|
* @param string $password
|
||||||
|
* @return Configuration
|
||||||
|
*/
|
||||||
|
public function setPassword($password) {
|
||||||
|
$this->password = $password;
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
public function getPassword() {
|
||||||
|
return $this->password;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* add default header
|
||||||
|
*
|
||||||
|
* @param string $headerName header name (e.g. Token)
|
||||||
|
* @param string $headerValue header value (e.g. 1z8wp3)
|
||||||
|
* @return ApiClient
|
||||||
|
*/
|
||||||
|
public function addDefaultHeader($headerName, $headerValue) {
|
||||||
|
if (!is_string($headerName)) {
|
||||||
|
throw new \InvalidArgumentException('Header name must be a string.');
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->defaultHeaders[$headerName] = $headerValue;
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* get the default header
|
||||||
|
*
|
||||||
|
* @return array default header
|
||||||
|
*/
|
||||||
|
public function getDefaultHeaders() {
|
||||||
|
return $this->defaultHeaders;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* delete a default header
|
||||||
|
* @param string $headerName the header to delete
|
||||||
|
* @return Configuration
|
||||||
|
*/
|
||||||
|
public function deleteDefaultHeader($headerName) {
|
||||||
|
unset($this->defaultHeaders[$headerName]);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param string $host
|
||||||
|
* @return Configuration
|
||||||
|
*/
|
||||||
|
public function setHost($host) {
|
||||||
|
$this->host = $host;
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
public function getHost() {
|
||||||
|
return $this->host;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* set the user agent of the api client
|
||||||
|
*
|
||||||
|
* @param string $userAgent the user agent of the api client
|
||||||
|
* @return ApiClient
|
||||||
|
*/
|
||||||
|
public function setUserAgent($userAgent) {
|
||||||
|
if (!is_string($userAgent)) {
|
||||||
|
throw new \InvalidArgumentException('User-agent must be a string.');
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->userAgent = $userAgent;
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* get the user agent of the api client
|
||||||
|
*
|
||||||
|
* @return string user agent
|
||||||
|
*/
|
||||||
|
public function getUserAgent() {
|
||||||
|
return $this->userAgent;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* set the HTTP timeout value
|
||||||
|
*
|
||||||
|
* @param integer $seconds Number of seconds before timing out [set to 0 for no timeout]
|
||||||
|
* @return ApiClient
|
||||||
|
*/
|
||||||
|
public function setCurlTimeout($seconds) {
|
||||||
|
if (!is_numeric($seconds) || $seconds < 0) {
|
||||||
|
throw new \InvalidArgumentException('Timeout value must be numeric and a non-negative number.');
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->curlTimeout = $seconds;
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* get the HTTP timeout value
|
||||||
|
*
|
||||||
|
* @return string HTTP timeout value
|
||||||
|
*/
|
||||||
|
public function getCurlTimeout() {
|
||||||
|
return $this->curlTimeout;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param bool $debug
|
||||||
|
* @return Configuration
|
||||||
|
*/
|
||||||
|
public function setDebug($debug) {
|
||||||
|
$this->debug = $debug;
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return bool
|
||||||
|
*/
|
||||||
|
public function getDebug() {
|
||||||
|
return $this->debug;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param string $debugFile
|
||||||
|
* @return Configuration
|
||||||
|
*/
|
||||||
|
public function setDebugFile($debugFile) {
|
||||||
|
$this->debugFile = $debugFile;
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
public function getDebugFile() {
|
||||||
|
return $this->debugFile;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param string $debugFile
|
||||||
|
* @return Configuration
|
||||||
|
*/
|
||||||
|
public function setTempFolderPath($tempFolderPath) {
|
||||||
|
$this->tempFolderPath = $tempFolderPath;
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
public function getTempFolderPath() {
|
||||||
|
return $this->tempFolderPath;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return Configuration
|
||||||
|
*/
|
||||||
|
public static function getDefaultConfiguration() {
|
||||||
|
if (self::$defaultConfiguration == null) {
|
||||||
|
return new Configuration();
|
||||||
|
}
|
||||||
|
|
||||||
|
return self::$defaultConfiguration;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param Configuration $config
|
||||||
|
*/
|
||||||
|
public static function setDefaultConfiguration(Configuration $config) {
|
||||||
|
self::$defaultConfiguration = $config;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* return the report for debugging
|
||||||
|
*/
|
||||||
|
public static function toDebugReport() {
|
||||||
|
$report = "PHP SDK (Swagger\Client) Debug Report:\n";
|
||||||
|
$report .= " OS: ".php_uname()."\n";
|
||||||
|
$report .= " PHP Version: ".phpversion()."\n";
|
||||||
|
$report .= " Swagger Spec Version: 1.0.0\n";
|
||||||
|
$report .= " SDK Package Version: 1.0.0\n";
|
||||||
|
|
||||||
|
return $report;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -27,101 +27,101 @@ namespace Swagger\Client\Model;
|
|||||||
use \ArrayAccess;
|
use \ArrayAccess;
|
||||||
|
|
||||||
class Category implements ArrayAccess {
|
class Category implements ArrayAccess {
|
||||||
/** @var string[] Array of property to type mappings. Used for (de)serialization */
|
/** @var string[] Array of property to type mappings. Used for (de)serialization */
|
||||||
static $swaggerTypes = array(
|
static $swaggerTypes = array(
|
||||||
'id' => 'int',
|
'id' => 'int',
|
||||||
'name' => 'string'
|
'name' => 'string'
|
||||||
);
|
);
|
||||||
|
|
||||||
/** @var string[] Array of attributes where the key is the local name, and the value is the original name */
|
/** @var string[] Array of attributes where the key is the local name, and the value is the original name */
|
||||||
static $attributeMap = array(
|
static $attributeMap = array(
|
||||||
'id' => 'id',
|
'id' => 'id',
|
||||||
'name' => 'name'
|
'name' => 'name'
|
||||||
);
|
);
|
||||||
|
|
||||||
/** @var string[] Array of attributes to setter functions (for deserialization of responses) */
|
/** @var string[] Array of attributes to setter functions (for deserialization of responses) */
|
||||||
static $setters = array(
|
static $setters = array(
|
||||||
'id' => 'setId',
|
'id' => 'setId',
|
||||||
'name' => 'setName'
|
'name' => 'setName'
|
||||||
);
|
);
|
||||||
|
|
||||||
/** @var string[] Array of attributes to getter functions (for serialization of requests) */
|
/** @var string[] Array of attributes to getter functions (for serialization of requests) */
|
||||||
static $getters = array(
|
static $getters = array(
|
||||||
'id' => 'getId',
|
'id' => 'getId',
|
||||||
'name' => 'getName'
|
'name' => 'getName'
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
/** @var int $id */
|
/** @var int $id */
|
||||||
protected $id;
|
protected $id;
|
||||||
|
|
||||||
/** @var string $name */
|
/** @var string $name */
|
||||||
protected $name;
|
protected $name;
|
||||||
|
|
||||||
public function __construct(array $data = null) {
|
public function __construct(array $data = null) {
|
||||||
if ($data != null) {
|
if ($data != null) {
|
||||||
$this->id = $data["id"];
|
$this->id = $data["id"];
|
||||||
$this->name = $data["name"];
|
$this->name = $data["name"];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* get id
|
* get id
|
||||||
* @return int
|
* @return int
|
||||||
*/
|
*/
|
||||||
public function getId() {
|
public function getId() {
|
||||||
return $this->id;
|
return $this->id;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* set id
|
* set id
|
||||||
* @param int $id
|
* @param int $id
|
||||||
* @return $this
|
* @return $this
|
||||||
*/
|
*/
|
||||||
public function setId($id) {
|
public function setId($id) {
|
||||||
$this->id = $id;
|
$this->id = $id;
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* get name
|
* get name
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
public function getName() {
|
public function getName() {
|
||||||
return $this->name;
|
return $this->name;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* set name
|
* set name
|
||||||
* @param string $name
|
* @param string $name
|
||||||
* @return $this
|
* @return $this
|
||||||
*/
|
*/
|
||||||
public function setName($name) {
|
public function setName($name) {
|
||||||
$this->name = $name;
|
$this->name = $name;
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function offsetExists($offset) {
|
public function offsetExists($offset) {
|
||||||
return isset($this->$offset);
|
return isset($this->$offset);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function offsetGet($offset) {
|
public function offsetGet($offset) {
|
||||||
return $this->$offset;
|
return $this->$offset;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function offsetSet($offset, $value) {
|
public function offsetSet($offset, $value) {
|
||||||
$this->$offset = $value;
|
$this->$offset = $value;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function offsetUnset($offset) {
|
public function offsetUnset($offset) {
|
||||||
unset($this->$offset);
|
unset($this->$offset);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function __toString() {
|
public function __toString() {
|
||||||
if (defined('JSON_PRETTY_PRINT')) {
|
if (defined('JSON_PRETTY_PRINT')) {
|
||||||
return json_encode(get_object_vars($this), JSON_PRETTY_PRINT);
|
return json_encode(get_object_vars($this), JSON_PRETTY_PRINT);
|
||||||
} else {
|
} else {
|
||||||
return json_encode(get_object_vars($this));
|
return json_encode(get_object_vars($this));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@ -27,205 +27,205 @@ namespace Swagger\Client\Model;
|
|||||||
use \ArrayAccess;
|
use \ArrayAccess;
|
||||||
|
|
||||||
class Order implements ArrayAccess {
|
class Order implements ArrayAccess {
|
||||||
/** @var string[] Array of property to type mappings. Used for (de)serialization */
|
/** @var string[] Array of property to type mappings. Used for (de)serialization */
|
||||||
static $swaggerTypes = array(
|
static $swaggerTypes = array(
|
||||||
'id' => 'int',
|
'id' => 'int',
|
||||||
'pet_id' => 'int',
|
'pet_id' => 'int',
|
||||||
'quantity' => 'int',
|
'quantity' => 'int',
|
||||||
'ship_date' => '\DateTime',
|
'ship_date' => '\DateTime',
|
||||||
'status' => 'string',
|
'status' => 'string',
|
||||||
'complete' => 'bool'
|
'complete' => 'bool'
|
||||||
);
|
);
|
||||||
|
|
||||||
/** @var string[] Array of attributes where the key is the local name, and the value is the original name */
|
/** @var string[] Array of attributes where the key is the local name, and the value is the original name */
|
||||||
static $attributeMap = array(
|
static $attributeMap = array(
|
||||||
'id' => 'id',
|
'id' => 'id',
|
||||||
'pet_id' => 'petId',
|
'pet_id' => 'petId',
|
||||||
'quantity' => 'quantity',
|
'quantity' => 'quantity',
|
||||||
'ship_date' => 'shipDate',
|
'ship_date' => 'shipDate',
|
||||||
'status' => 'status',
|
'status' => 'status',
|
||||||
'complete' => 'complete'
|
'complete' => 'complete'
|
||||||
);
|
);
|
||||||
|
|
||||||
/** @var string[] Array of attributes to setter functions (for deserialization of responses) */
|
/** @var string[] Array of attributes to setter functions (for deserialization of responses) */
|
||||||
static $setters = array(
|
static $setters = array(
|
||||||
'id' => 'setId',
|
'id' => 'setId',
|
||||||
'pet_id' => 'setPetId',
|
'pet_id' => 'setPetId',
|
||||||
'quantity' => 'setQuantity',
|
'quantity' => 'setQuantity',
|
||||||
'ship_date' => 'setShipDate',
|
'ship_date' => 'setShipDate',
|
||||||
'status' => 'setStatus',
|
'status' => 'setStatus',
|
||||||
'complete' => 'setComplete'
|
'complete' => 'setComplete'
|
||||||
);
|
);
|
||||||
|
|
||||||
/** @var string[] Array of attributes to getter functions (for serialization of requests) */
|
/** @var string[] Array of attributes to getter functions (for serialization of requests) */
|
||||||
static $getters = array(
|
static $getters = array(
|
||||||
'id' => 'getId',
|
'id' => 'getId',
|
||||||
'pet_id' => 'getPetId',
|
'pet_id' => 'getPetId',
|
||||||
'quantity' => 'getQuantity',
|
'quantity' => 'getQuantity',
|
||||||
'ship_date' => 'getShipDate',
|
'ship_date' => 'getShipDate',
|
||||||
'status' => 'getStatus',
|
'status' => 'getStatus',
|
||||||
'complete' => 'getComplete'
|
'complete' => 'getComplete'
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
/** @var int $id */
|
/** @var int $id */
|
||||||
protected $id;
|
protected $id;
|
||||||
|
|
||||||
/** @var int $pet_id */
|
/** @var int $pet_id */
|
||||||
protected $pet_id;
|
protected $pet_id;
|
||||||
|
|
||||||
/** @var int $quantity */
|
/** @var int $quantity */
|
||||||
protected $quantity;
|
protected $quantity;
|
||||||
|
|
||||||
/** @var \DateTime $ship_date */
|
/** @var \DateTime $ship_date */
|
||||||
protected $ship_date;
|
protected $ship_date;
|
||||||
|
|
||||||
/** @var string $status Order Status */
|
/** @var string $status Order Status */
|
||||||
protected $status;
|
protected $status;
|
||||||
|
|
||||||
/** @var bool $complete */
|
/** @var bool $complete */
|
||||||
protected $complete;
|
protected $complete;
|
||||||
|
|
||||||
public function __construct(array $data = null) {
|
public function __construct(array $data = null) {
|
||||||
if ($data != null) {
|
if ($data != null) {
|
||||||
$this->id = $data["id"];
|
$this->id = $data["id"];
|
||||||
$this->pet_id = $data["pet_id"];
|
$this->pet_id = $data["pet_id"];
|
||||||
$this->quantity = $data["quantity"];
|
$this->quantity = $data["quantity"];
|
||||||
$this->ship_date = $data["ship_date"];
|
$this->ship_date = $data["ship_date"];
|
||||||
$this->status = $data["status"];
|
$this->status = $data["status"];
|
||||||
$this->complete = $data["complete"];
|
$this->complete = $data["complete"];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* get id
|
* get id
|
||||||
* @return int
|
* @return int
|
||||||
*/
|
*/
|
||||||
public function getId() {
|
public function getId() {
|
||||||
return $this->id;
|
return $this->id;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* set id
|
* set id
|
||||||
* @param int $id
|
* @param int $id
|
||||||
* @return $this
|
* @return $this
|
||||||
*/
|
*/
|
||||||
public function setId($id) {
|
public function setId($id) {
|
||||||
$this->id = $id;
|
$this->id = $id;
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* get pet_id
|
* get pet_id
|
||||||
* @return int
|
* @return int
|
||||||
*/
|
*/
|
||||||
public function getPetId() {
|
public function getPetId() {
|
||||||
return $this->pet_id;
|
return $this->pet_id;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* set pet_id
|
* set pet_id
|
||||||
* @param int $pet_id
|
* @param int $pet_id
|
||||||
* @return $this
|
* @return $this
|
||||||
*/
|
*/
|
||||||
public function setPetId($pet_id) {
|
public function setPetId($pet_id) {
|
||||||
$this->pet_id = $pet_id;
|
$this->pet_id = $pet_id;
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* get quantity
|
* get quantity
|
||||||
* @return int
|
* @return int
|
||||||
*/
|
*/
|
||||||
public function getQuantity() {
|
public function getQuantity() {
|
||||||
return $this->quantity;
|
return $this->quantity;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* set quantity
|
* set quantity
|
||||||
* @param int $quantity
|
* @param int $quantity
|
||||||
* @return $this
|
* @return $this
|
||||||
*/
|
*/
|
||||||
public function setQuantity($quantity) {
|
public function setQuantity($quantity) {
|
||||||
$this->quantity = $quantity;
|
$this->quantity = $quantity;
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* get ship_date
|
* get ship_date
|
||||||
* @return \DateTime
|
* @return \DateTime
|
||||||
*/
|
*/
|
||||||
public function getShipDate() {
|
public function getShipDate() {
|
||||||
return $this->ship_date;
|
return $this->ship_date;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* set ship_date
|
* set ship_date
|
||||||
* @param \DateTime $ship_date
|
* @param \DateTime $ship_date
|
||||||
* @return $this
|
* @return $this
|
||||||
*/
|
*/
|
||||||
public function setShipDate($ship_date) {
|
public function setShipDate($ship_date) {
|
||||||
$this->ship_date = $ship_date;
|
$this->ship_date = $ship_date;
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* get status
|
* get status
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
public function getStatus() {
|
public function getStatus() {
|
||||||
return $this->status;
|
return $this->status;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* set status
|
* set status
|
||||||
* @param string $status
|
* @param string $status
|
||||||
* @return $this
|
* @return $this
|
||||||
*/
|
*/
|
||||||
public function setStatus($status) {
|
public function setStatus($status) {
|
||||||
$this->status = $status;
|
$this->status = $status;
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* get complete
|
* get complete
|
||||||
* @return bool
|
* @return bool
|
||||||
*/
|
*/
|
||||||
public function getComplete() {
|
public function getComplete() {
|
||||||
return $this->complete;
|
return $this->complete;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* set complete
|
* set complete
|
||||||
* @param bool $complete
|
* @param bool $complete
|
||||||
* @return $this
|
* @return $this
|
||||||
*/
|
*/
|
||||||
public function setComplete($complete) {
|
public function setComplete($complete) {
|
||||||
$this->complete = $complete;
|
$this->complete = $complete;
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function offsetExists($offset) {
|
public function offsetExists($offset) {
|
||||||
return isset($this->$offset);
|
return isset($this->$offset);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function offsetGet($offset) {
|
public function offsetGet($offset) {
|
||||||
return $this->$offset;
|
return $this->$offset;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function offsetSet($offset, $value) {
|
public function offsetSet($offset, $value) {
|
||||||
$this->$offset = $value;
|
$this->$offset = $value;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function offsetUnset($offset) {
|
public function offsetUnset($offset) {
|
||||||
unset($this->$offset);
|
unset($this->$offset);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function __toString() {
|
public function __toString() {
|
||||||
if (defined('JSON_PRETTY_PRINT')) {
|
if (defined('JSON_PRETTY_PRINT')) {
|
||||||
return json_encode(get_object_vars($this), JSON_PRETTY_PRINT);
|
return json_encode(get_object_vars($this), JSON_PRETTY_PRINT);
|
||||||
} else {
|
} else {
|
||||||
return json_encode(get_object_vars($this));
|
return json_encode(get_object_vars($this));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@ -27,205 +27,205 @@ namespace Swagger\Client\Model;
|
|||||||
use \ArrayAccess;
|
use \ArrayAccess;
|
||||||
|
|
||||||
class Pet implements ArrayAccess {
|
class Pet implements ArrayAccess {
|
||||||
/** @var string[] Array of property to type mappings. Used for (de)serialization */
|
/** @var string[] Array of property to type mappings. Used for (de)serialization */
|
||||||
static $swaggerTypes = array(
|
static $swaggerTypes = array(
|
||||||
'id' => 'int',
|
'id' => 'int',
|
||||||
'category' => '\Swagger\Client\Model\Category',
|
'category' => '\Swagger\Client\Model\Category',
|
||||||
'name' => 'string',
|
'name' => 'string',
|
||||||
'photo_urls' => 'string[]',
|
'photo_urls' => 'string[]',
|
||||||
'tags' => '\Swagger\Client\Model\Tag[]',
|
'tags' => '\Swagger\Client\Model\Tag[]',
|
||||||
'status' => 'string'
|
'status' => 'string'
|
||||||
);
|
);
|
||||||
|
|
||||||
/** @var string[] Array of attributes where the key is the local name, and the value is the original name */
|
/** @var string[] Array of attributes where the key is the local name, and the value is the original name */
|
||||||
static $attributeMap = array(
|
static $attributeMap = array(
|
||||||
'id' => 'id',
|
'id' => 'id',
|
||||||
'category' => 'category',
|
'category' => 'category',
|
||||||
'name' => 'name',
|
'name' => 'name',
|
||||||
'photo_urls' => 'photoUrls',
|
'photo_urls' => 'photoUrls',
|
||||||
'tags' => 'tags',
|
'tags' => 'tags',
|
||||||
'status' => 'status'
|
'status' => 'status'
|
||||||
);
|
);
|
||||||
|
|
||||||
/** @var string[] Array of attributes to setter functions (for deserialization of responses) */
|
/** @var string[] Array of attributes to setter functions (for deserialization of responses) */
|
||||||
static $setters = array(
|
static $setters = array(
|
||||||
'id' => 'setId',
|
'id' => 'setId',
|
||||||
'category' => 'setCategory',
|
'category' => 'setCategory',
|
||||||
'name' => 'setName',
|
'name' => 'setName',
|
||||||
'photo_urls' => 'setPhotoUrls',
|
'photo_urls' => 'setPhotoUrls',
|
||||||
'tags' => 'setTags',
|
'tags' => 'setTags',
|
||||||
'status' => 'setStatus'
|
'status' => 'setStatus'
|
||||||
);
|
);
|
||||||
|
|
||||||
/** @var string[] Array of attributes to getter functions (for serialization of requests) */
|
/** @var string[] Array of attributes to getter functions (for serialization of requests) */
|
||||||
static $getters = array(
|
static $getters = array(
|
||||||
'id' => 'getId',
|
'id' => 'getId',
|
||||||
'category' => 'getCategory',
|
'category' => 'getCategory',
|
||||||
'name' => 'getName',
|
'name' => 'getName',
|
||||||
'photo_urls' => 'getPhotoUrls',
|
'photo_urls' => 'getPhotoUrls',
|
||||||
'tags' => 'getTags',
|
'tags' => 'getTags',
|
||||||
'status' => 'getStatus'
|
'status' => 'getStatus'
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
/** @var int $id */
|
/** @var int $id */
|
||||||
protected $id;
|
protected $id;
|
||||||
|
|
||||||
/** @var \Swagger\Client\Model\Category $category */
|
/** @var \Swagger\Client\Model\Category $category */
|
||||||
protected $category;
|
protected $category;
|
||||||
|
|
||||||
/** @var string $name */
|
/** @var string $name */
|
||||||
protected $name;
|
protected $name;
|
||||||
|
|
||||||
/** @var string[] $photo_urls */
|
/** @var string[] $photo_urls */
|
||||||
protected $photo_urls;
|
protected $photo_urls;
|
||||||
|
|
||||||
/** @var \Swagger\Client\Model\Tag[] $tags */
|
/** @var \Swagger\Client\Model\Tag[] $tags */
|
||||||
protected $tags;
|
protected $tags;
|
||||||
|
|
||||||
/** @var string $status pet status in the store */
|
/** @var string $status pet status in the store */
|
||||||
protected $status;
|
protected $status;
|
||||||
|
|
||||||
public function __construct(array $data = null) {
|
public function __construct(array $data = null) {
|
||||||
if ($data != null) {
|
if ($data != null) {
|
||||||
$this->id = $data["id"];
|
$this->id = $data["id"];
|
||||||
$this->category = $data["category"];
|
$this->category = $data["category"];
|
||||||
$this->name = $data["name"];
|
$this->name = $data["name"];
|
||||||
$this->photo_urls = $data["photo_urls"];
|
$this->photo_urls = $data["photo_urls"];
|
||||||
$this->tags = $data["tags"];
|
$this->tags = $data["tags"];
|
||||||
$this->status = $data["status"];
|
$this->status = $data["status"];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* get id
|
* get id
|
||||||
* @return int
|
* @return int
|
||||||
*/
|
*/
|
||||||
public function getId() {
|
public function getId() {
|
||||||
return $this->id;
|
return $this->id;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* set id
|
* set id
|
||||||
* @param int $id
|
* @param int $id
|
||||||
* @return $this
|
* @return $this
|
||||||
*/
|
*/
|
||||||
public function setId($id) {
|
public function setId($id) {
|
||||||
$this->id = $id;
|
$this->id = $id;
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* get category
|
* get category
|
||||||
* @return \Swagger\Client\Model\Category
|
* @return \Swagger\Client\Model\Category
|
||||||
*/
|
*/
|
||||||
public function getCategory() {
|
public function getCategory() {
|
||||||
return $this->category;
|
return $this->category;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* set category
|
* set category
|
||||||
* @param \Swagger\Client\Model\Category $category
|
* @param \Swagger\Client\Model\Category $category
|
||||||
* @return $this
|
* @return $this
|
||||||
*/
|
*/
|
||||||
public function setCategory($category) {
|
public function setCategory($category) {
|
||||||
$this->category = $category;
|
$this->category = $category;
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* get name
|
* get name
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
public function getName() {
|
public function getName() {
|
||||||
return $this->name;
|
return $this->name;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* set name
|
* set name
|
||||||
* @param string $name
|
* @param string $name
|
||||||
* @return $this
|
* @return $this
|
||||||
*/
|
*/
|
||||||
public function setName($name) {
|
public function setName($name) {
|
||||||
$this->name = $name;
|
$this->name = $name;
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* get photo_urls
|
* get photo_urls
|
||||||
* @return string[]
|
* @return string[]
|
||||||
*/
|
*/
|
||||||
public function getPhotoUrls() {
|
public function getPhotoUrls() {
|
||||||
return $this->photo_urls;
|
return $this->photo_urls;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* set photo_urls
|
* set photo_urls
|
||||||
* @param string[] $photo_urls
|
* @param string[] $photo_urls
|
||||||
* @return $this
|
* @return $this
|
||||||
*/
|
*/
|
||||||
public function setPhotoUrls($photo_urls) {
|
public function setPhotoUrls($photo_urls) {
|
||||||
$this->photo_urls = $photo_urls;
|
$this->photo_urls = $photo_urls;
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* get tags
|
* get tags
|
||||||
* @return \Swagger\Client\Model\Tag[]
|
* @return \Swagger\Client\Model\Tag[]
|
||||||
*/
|
*/
|
||||||
public function getTags() {
|
public function getTags() {
|
||||||
return $this->tags;
|
return $this->tags;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* set tags
|
* set tags
|
||||||
* @param \Swagger\Client\Model\Tag[] $tags
|
* @param \Swagger\Client\Model\Tag[] $tags
|
||||||
* @return $this
|
* @return $this
|
||||||
*/
|
*/
|
||||||
public function setTags($tags) {
|
public function setTags($tags) {
|
||||||
$this->tags = $tags;
|
$this->tags = $tags;
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* get status
|
* get status
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
public function getStatus() {
|
public function getStatus() {
|
||||||
return $this->status;
|
return $this->status;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* set status
|
* set status
|
||||||
* @param string $status
|
* @param string $status
|
||||||
* @return $this
|
* @return $this
|
||||||
*/
|
*/
|
||||||
public function setStatus($status) {
|
public function setStatus($status) {
|
||||||
$this->status = $status;
|
$this->status = $status;
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function offsetExists($offset) {
|
public function offsetExists($offset) {
|
||||||
return isset($this->$offset);
|
return isset($this->$offset);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function offsetGet($offset) {
|
public function offsetGet($offset) {
|
||||||
return $this->$offset;
|
return $this->$offset;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function offsetSet($offset, $value) {
|
public function offsetSet($offset, $value) {
|
||||||
$this->$offset = $value;
|
$this->$offset = $value;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function offsetUnset($offset) {
|
public function offsetUnset($offset) {
|
||||||
unset($this->$offset);
|
unset($this->$offset);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function __toString() {
|
public function __toString() {
|
||||||
if (defined('JSON_PRETTY_PRINT')) {
|
if (defined('JSON_PRETTY_PRINT')) {
|
||||||
return json_encode(get_object_vars($this), JSON_PRETTY_PRINT);
|
return json_encode(get_object_vars($this), JSON_PRETTY_PRINT);
|
||||||
} else {
|
} else {
|
||||||
return json_encode(get_object_vars($this));
|
return json_encode(get_object_vars($this));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@ -27,101 +27,101 @@ namespace Swagger\Client\Model;
|
|||||||
use \ArrayAccess;
|
use \ArrayAccess;
|
||||||
|
|
||||||
class Tag implements ArrayAccess {
|
class Tag implements ArrayAccess {
|
||||||
/** @var string[] Array of property to type mappings. Used for (de)serialization */
|
/** @var string[] Array of property to type mappings. Used for (de)serialization */
|
||||||
static $swaggerTypes = array(
|
static $swaggerTypes = array(
|
||||||
'id' => 'int',
|
'id' => 'int',
|
||||||
'name' => 'string'
|
'name' => 'string'
|
||||||
);
|
);
|
||||||
|
|
||||||
/** @var string[] Array of attributes where the key is the local name, and the value is the original name */
|
/** @var string[] Array of attributes where the key is the local name, and the value is the original name */
|
||||||
static $attributeMap = array(
|
static $attributeMap = array(
|
||||||
'id' => 'id',
|
'id' => 'id',
|
||||||
'name' => 'name'
|
'name' => 'name'
|
||||||
);
|
);
|
||||||
|
|
||||||
/** @var string[] Array of attributes to setter functions (for deserialization of responses) */
|
/** @var string[] Array of attributes to setter functions (for deserialization of responses) */
|
||||||
static $setters = array(
|
static $setters = array(
|
||||||
'id' => 'setId',
|
'id' => 'setId',
|
||||||
'name' => 'setName'
|
'name' => 'setName'
|
||||||
);
|
);
|
||||||
|
|
||||||
/** @var string[] Array of attributes to getter functions (for serialization of requests) */
|
/** @var string[] Array of attributes to getter functions (for serialization of requests) */
|
||||||
static $getters = array(
|
static $getters = array(
|
||||||
'id' => 'getId',
|
'id' => 'getId',
|
||||||
'name' => 'getName'
|
'name' => 'getName'
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
/** @var int $id */
|
/** @var int $id */
|
||||||
protected $id;
|
protected $id;
|
||||||
|
|
||||||
/** @var string $name */
|
/** @var string $name */
|
||||||
protected $name;
|
protected $name;
|
||||||
|
|
||||||
public function __construct(array $data = null) {
|
public function __construct(array $data = null) {
|
||||||
if ($data != null) {
|
if ($data != null) {
|
||||||
$this->id = $data["id"];
|
$this->id = $data["id"];
|
||||||
$this->name = $data["name"];
|
$this->name = $data["name"];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* get id
|
* get id
|
||||||
* @return int
|
* @return int
|
||||||
*/
|
*/
|
||||||
public function getId() {
|
public function getId() {
|
||||||
return $this->id;
|
return $this->id;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* set id
|
* set id
|
||||||
* @param int $id
|
* @param int $id
|
||||||
* @return $this
|
* @return $this
|
||||||
*/
|
*/
|
||||||
public function setId($id) {
|
public function setId($id) {
|
||||||
$this->id = $id;
|
$this->id = $id;
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* get name
|
* get name
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
public function getName() {
|
public function getName() {
|
||||||
return $this->name;
|
return $this->name;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* set name
|
* set name
|
||||||
* @param string $name
|
* @param string $name
|
||||||
* @return $this
|
* @return $this
|
||||||
*/
|
*/
|
||||||
public function setName($name) {
|
public function setName($name) {
|
||||||
$this->name = $name;
|
$this->name = $name;
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function offsetExists($offset) {
|
public function offsetExists($offset) {
|
||||||
return isset($this->$offset);
|
return isset($this->$offset);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function offsetGet($offset) {
|
public function offsetGet($offset) {
|
||||||
return $this->$offset;
|
return $this->$offset;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function offsetSet($offset, $value) {
|
public function offsetSet($offset, $value) {
|
||||||
$this->$offset = $value;
|
$this->$offset = $value;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function offsetUnset($offset) {
|
public function offsetUnset($offset) {
|
||||||
unset($this->$offset);
|
unset($this->$offset);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function __toString() {
|
public function __toString() {
|
||||||
if (defined('JSON_PRETTY_PRINT')) {
|
if (defined('JSON_PRETTY_PRINT')) {
|
||||||
return json_encode(get_object_vars($this), JSON_PRETTY_PRINT);
|
return json_encode(get_object_vars($this), JSON_PRETTY_PRINT);
|
||||||
} else {
|
} else {
|
||||||
return json_encode(get_object_vars($this));
|
return json_encode(get_object_vars($this));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@ -27,257 +27,257 @@ namespace Swagger\Client\Model;
|
|||||||
use \ArrayAccess;
|
use \ArrayAccess;
|
||||||
|
|
||||||
class User implements ArrayAccess {
|
class User implements ArrayAccess {
|
||||||
/** @var string[] Array of property to type mappings. Used for (de)serialization */
|
/** @var string[] Array of property to type mappings. Used for (de)serialization */
|
||||||
static $swaggerTypes = array(
|
static $swaggerTypes = array(
|
||||||
'id' => 'int',
|
'id' => 'int',
|
||||||
'username' => 'string',
|
'username' => 'string',
|
||||||
'first_name' => 'string',
|
'first_name' => 'string',
|
||||||
'last_name' => 'string',
|
'last_name' => 'string',
|
||||||
'email' => 'string',
|
'email' => 'string',
|
||||||
'password' => 'string',
|
'password' => 'string',
|
||||||
'phone' => 'string',
|
'phone' => 'string',
|
||||||
'user_status' => 'int'
|
'user_status' => 'int'
|
||||||
);
|
);
|
||||||
|
|
||||||
/** @var string[] Array of attributes where the key is the local name, and the value is the original name */
|
/** @var string[] Array of attributes where the key is the local name, and the value is the original name */
|
||||||
static $attributeMap = array(
|
static $attributeMap = array(
|
||||||
'id' => 'id',
|
'id' => 'id',
|
||||||
'username' => 'username',
|
'username' => 'username',
|
||||||
'first_name' => 'firstName',
|
'first_name' => 'firstName',
|
||||||
'last_name' => 'lastName',
|
'last_name' => 'lastName',
|
||||||
'email' => 'email',
|
'email' => 'email',
|
||||||
'password' => 'password',
|
'password' => 'password',
|
||||||
'phone' => 'phone',
|
'phone' => 'phone',
|
||||||
'user_status' => 'userStatus'
|
'user_status' => 'userStatus'
|
||||||
);
|
);
|
||||||
|
|
||||||
/** @var string[] Array of attributes to setter functions (for deserialization of responses) */
|
/** @var string[] Array of attributes to setter functions (for deserialization of responses) */
|
||||||
static $setters = array(
|
static $setters = array(
|
||||||
'id' => 'setId',
|
'id' => 'setId',
|
||||||
'username' => 'setUsername',
|
'username' => 'setUsername',
|
||||||
'first_name' => 'setFirstName',
|
'first_name' => 'setFirstName',
|
||||||
'last_name' => 'setLastName',
|
'last_name' => 'setLastName',
|
||||||
'email' => 'setEmail',
|
'email' => 'setEmail',
|
||||||
'password' => 'setPassword',
|
'password' => 'setPassword',
|
||||||
'phone' => 'setPhone',
|
'phone' => 'setPhone',
|
||||||
'user_status' => 'setUserStatus'
|
'user_status' => 'setUserStatus'
|
||||||
);
|
);
|
||||||
|
|
||||||
/** @var string[] Array of attributes to getter functions (for serialization of requests) */
|
/** @var string[] Array of attributes to getter functions (for serialization of requests) */
|
||||||
static $getters = array(
|
static $getters = array(
|
||||||
'id' => 'getId',
|
'id' => 'getId',
|
||||||
'username' => 'getUsername',
|
'username' => 'getUsername',
|
||||||
'first_name' => 'getFirstName',
|
'first_name' => 'getFirstName',
|
||||||
'last_name' => 'getLastName',
|
'last_name' => 'getLastName',
|
||||||
'email' => 'getEmail',
|
'email' => 'getEmail',
|
||||||
'password' => 'getPassword',
|
'password' => 'getPassword',
|
||||||
'phone' => 'getPhone',
|
'phone' => 'getPhone',
|
||||||
'user_status' => 'getUserStatus'
|
'user_status' => 'getUserStatus'
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
/** @var int $id */
|
/** @var int $id */
|
||||||
protected $id;
|
protected $id;
|
||||||
|
|
||||||
/** @var string $username */
|
/** @var string $username */
|
||||||
protected $username;
|
protected $username;
|
||||||
|
|
||||||
/** @var string $first_name */
|
/** @var string $first_name */
|
||||||
protected $first_name;
|
protected $first_name;
|
||||||
|
|
||||||
/** @var string $last_name */
|
/** @var string $last_name */
|
||||||
protected $last_name;
|
protected $last_name;
|
||||||
|
|
||||||
/** @var string $email */
|
/** @var string $email */
|
||||||
protected $email;
|
protected $email;
|
||||||
|
|
||||||
/** @var string $password */
|
/** @var string $password */
|
||||||
protected $password;
|
protected $password;
|
||||||
|
|
||||||
/** @var string $phone */
|
/** @var string $phone */
|
||||||
protected $phone;
|
protected $phone;
|
||||||
|
|
||||||
/** @var int $user_status User Status */
|
/** @var int $user_status User Status */
|
||||||
protected $user_status;
|
protected $user_status;
|
||||||
|
|
||||||
public function __construct(array $data = null) {
|
public function __construct(array $data = null) {
|
||||||
if ($data != null) {
|
if ($data != null) {
|
||||||
$this->id = $data["id"];
|
$this->id = $data["id"];
|
||||||
$this->username = $data["username"];
|
$this->username = $data["username"];
|
||||||
$this->first_name = $data["first_name"];
|
$this->first_name = $data["first_name"];
|
||||||
$this->last_name = $data["last_name"];
|
$this->last_name = $data["last_name"];
|
||||||
$this->email = $data["email"];
|
$this->email = $data["email"];
|
||||||
$this->password = $data["password"];
|
$this->password = $data["password"];
|
||||||
$this->phone = $data["phone"];
|
$this->phone = $data["phone"];
|
||||||
$this->user_status = $data["user_status"];
|
$this->user_status = $data["user_status"];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* get id
|
* get id
|
||||||
* @return int
|
* @return int
|
||||||
*/
|
*/
|
||||||
public function getId() {
|
public function getId() {
|
||||||
return $this->id;
|
return $this->id;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* set id
|
* set id
|
||||||
* @param int $id
|
* @param int $id
|
||||||
* @return $this
|
* @return $this
|
||||||
*/
|
*/
|
||||||
public function setId($id) {
|
public function setId($id) {
|
||||||
$this->id = $id;
|
$this->id = $id;
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* get username
|
* get username
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
public function getUsername() {
|
public function getUsername() {
|
||||||
return $this->username;
|
return $this->username;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* set username
|
* set username
|
||||||
* @param string $username
|
* @param string $username
|
||||||
* @return $this
|
* @return $this
|
||||||
*/
|
*/
|
||||||
public function setUsername($username) {
|
public function setUsername($username) {
|
||||||
$this->username = $username;
|
$this->username = $username;
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* get first_name
|
* get first_name
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
public function getFirstName() {
|
public function getFirstName() {
|
||||||
return $this->first_name;
|
return $this->first_name;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* set first_name
|
* set first_name
|
||||||
* @param string $first_name
|
* @param string $first_name
|
||||||
* @return $this
|
* @return $this
|
||||||
*/
|
*/
|
||||||
public function setFirstName($first_name) {
|
public function setFirstName($first_name) {
|
||||||
$this->first_name = $first_name;
|
$this->first_name = $first_name;
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* get last_name
|
* get last_name
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
public function getLastName() {
|
public function getLastName() {
|
||||||
return $this->last_name;
|
return $this->last_name;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* set last_name
|
* set last_name
|
||||||
* @param string $last_name
|
* @param string $last_name
|
||||||
* @return $this
|
* @return $this
|
||||||
*/
|
*/
|
||||||
public function setLastName($last_name) {
|
public function setLastName($last_name) {
|
||||||
$this->last_name = $last_name;
|
$this->last_name = $last_name;
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* get email
|
* get email
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
public function getEmail() {
|
public function getEmail() {
|
||||||
return $this->email;
|
return $this->email;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* set email
|
* set email
|
||||||
* @param string $email
|
* @param string $email
|
||||||
* @return $this
|
* @return $this
|
||||||
*/
|
*/
|
||||||
public function setEmail($email) {
|
public function setEmail($email) {
|
||||||
$this->email = $email;
|
$this->email = $email;
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* get password
|
* get password
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
public function getPassword() {
|
public function getPassword() {
|
||||||
return $this->password;
|
return $this->password;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* set password
|
* set password
|
||||||
* @param string $password
|
* @param string $password
|
||||||
* @return $this
|
* @return $this
|
||||||
*/
|
*/
|
||||||
public function setPassword($password) {
|
public function setPassword($password) {
|
||||||
$this->password = $password;
|
$this->password = $password;
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* get phone
|
* get phone
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
public function getPhone() {
|
public function getPhone() {
|
||||||
return $this->phone;
|
return $this->phone;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* set phone
|
* set phone
|
||||||
* @param string $phone
|
* @param string $phone
|
||||||
* @return $this
|
* @return $this
|
||||||
*/
|
*/
|
||||||
public function setPhone($phone) {
|
public function setPhone($phone) {
|
||||||
$this->phone = $phone;
|
$this->phone = $phone;
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* get user_status
|
* get user_status
|
||||||
* @return int
|
* @return int
|
||||||
*/
|
*/
|
||||||
public function getUserStatus() {
|
public function getUserStatus() {
|
||||||
return $this->user_status;
|
return $this->user_status;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* set user_status
|
* set user_status
|
||||||
* @param int $user_status
|
* @param int $user_status
|
||||||
* @return $this
|
* @return $this
|
||||||
*/
|
*/
|
||||||
public function setUserStatus($user_status) {
|
public function setUserStatus($user_status) {
|
||||||
$this->user_status = $user_status;
|
$this->user_status = $user_status;
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function offsetExists($offset) {
|
public function offsetExists($offset) {
|
||||||
return isset($this->$offset);
|
return isset($this->$offset);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function offsetGet($offset) {
|
public function offsetGet($offset) {
|
||||||
return $this->$offset;
|
return $this->$offset;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function offsetSet($offset, $value) {
|
public function offsetSet($offset, $value) {
|
||||||
$this->$offset = $value;
|
$this->$offset = $value;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function offsetUnset($offset) {
|
public function offsetUnset($offset) {
|
||||||
unset($this->$offset);
|
unset($this->$offset);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function __toString() {
|
public function __toString() {
|
||||||
if (defined('JSON_PRETTY_PRINT')) {
|
if (defined('JSON_PRETTY_PRINT')) {
|
||||||
return json_encode(get_object_vars($this), JSON_PRETTY_PRINT);
|
return json_encode(get_object_vars($this), JSON_PRETTY_PRINT);
|
||||||
} else {
|
} else {
|
||||||
return json_encode(get_object_vars($this));
|
return json_encode(get_object_vars($this));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@ -9,29 +9,29 @@ class ObjectSerializer {
|
|||||||
* @return string serialized form of $data
|
* @return string serialized form of $data
|
||||||
*/
|
*/
|
||||||
public function sanitizeForSerialization($data) {
|
public function sanitizeForSerialization($data) {
|
||||||
if (is_scalar($data) || null === $data) {
|
if (is_scalar($data) || null === $data) {
|
||||||
$sanitized = $data;
|
$sanitized = $data;
|
||||||
} else if ($data instanceof \DateTime) {
|
} else if ($data instanceof \DateTime) {
|
||||||
$sanitized = $data->format(\DateTime::ISO8601);
|
$sanitized = $data->format(\DateTime::ISO8601);
|
||||||
} else if (is_array($data)) {
|
} else if (is_array($data)) {
|
||||||
foreach ($data as $property => $value) {
|
foreach ($data as $property => $value) {
|
||||||
$data[$property] = $this->sanitizeForSerialization($value);
|
$data[$property] = $this->sanitizeForSerialization($value);
|
||||||
|
}
|
||||||
|
$sanitized = $data;
|
||||||
|
} else if (is_object($data)) {
|
||||||
|
$values = array();
|
||||||
|
foreach (array_keys($data::$swaggerTypes) as $property) {
|
||||||
|
$getter = $data::$getters[$property];
|
||||||
|
if ($data->$getter() !== null) {
|
||||||
|
$values[$data::$attributeMap[$property]] = $this->sanitizeForSerialization($data->$getter());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$sanitized = $values;
|
||||||
|
} else {
|
||||||
|
$sanitized = (string)$data;
|
||||||
}
|
}
|
||||||
$sanitized = $data;
|
|
||||||
} else if (is_object($data)) {
|
|
||||||
$values = array();
|
|
||||||
foreach (array_keys($data::$swaggerTypes) as $property) {
|
|
||||||
$getter = $data::$getters[$property];
|
|
||||||
if ($data->$getter() !== null) {
|
|
||||||
$values[$data::$attributeMap[$property]] = $this->sanitizeForSerialization($data->$getter());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
$sanitized = $values;
|
|
||||||
} else {
|
|
||||||
$sanitized = (string)$data;
|
|
||||||
}
|
|
||||||
|
|
||||||
return $sanitized;
|
return $sanitized;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -41,7 +41,7 @@ class ObjectSerializer {
|
|||||||
* @return string the serialized object
|
* @return string the serialized object
|
||||||
*/
|
*/
|
||||||
public function toPathValue($value) {
|
public function toPathValue($value) {
|
||||||
return rawurlencode($this->toString($value));
|
return rawurlencode($this->toString($value));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -53,11 +53,11 @@ class ObjectSerializer {
|
|||||||
* @return string the serialized object
|
* @return string the serialized object
|
||||||
*/
|
*/
|
||||||
public function toQueryValue($object) {
|
public function toQueryValue($object) {
|
||||||
if (is_array($object)) {
|
if (is_array($object)) {
|
||||||
return implode(',', $object);
|
return implode(',', $object);
|
||||||
} else {
|
} else {
|
||||||
return $this->toString($object);
|
return $this->toString($object);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -68,7 +68,7 @@ class ObjectSerializer {
|
|||||||
* @return string the header string
|
* @return string the header string
|
||||||
*/
|
*/
|
||||||
public function toHeaderValue($value) {
|
public function toHeaderValue($value) {
|
||||||
return $this->toString($value);
|
return $this->toString($value);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -79,11 +79,11 @@ class ObjectSerializer {
|
|||||||
* @return string the form string
|
* @return string the form string
|
||||||
*/
|
*/
|
||||||
public function toFormValue($value) {
|
public function toFormValue($value) {
|
||||||
if ($value instanceof SplFileObject) {
|
if ($value instanceof SplFileObject) {
|
||||||
return $value->getRealPath();
|
return $value->getRealPath();
|
||||||
} else {
|
} else {
|
||||||
return $this->toString($value);
|
return $this->toString($value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -94,11 +94,11 @@ class ObjectSerializer {
|
|||||||
* @return string the header string
|
* @return string the header string
|
||||||
*/
|
*/
|
||||||
public function toString($value) {
|
public function toString($value) {
|
||||||
if ($value instanceof \DateTime) { // datetime in ISO8601 format
|
if ($value instanceof \DateTime) { // datetime in ISO8601 format
|
||||||
return $value->format(\DateTime::ISO8601);
|
return $value->format(\DateTime::ISO8601);
|
||||||
} else {
|
} else {
|
||||||
return $value;
|
return $value;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -109,65 +109,63 @@ class ObjectSerializer {
|
|||||||
* @return object an instance of $class
|
* @return object an instance of $class
|
||||||
*/
|
*/
|
||||||
public function deserialize($data, $class, $httpHeader=null) {
|
public function deserialize($data, $class, $httpHeader=null) {
|
||||||
if (null === $data) {
|
if (null === $data) {
|
||||||
$deserialized = null;
|
$deserialized = null;
|
||||||
} elseif (substr($class, 0, 4) == 'map[') { # for associative array e.g. map[string,int]
|
} elseif (substr($class, 0, 4) == 'map[') { # for associative array e.g. map[string,int]
|
||||||
$inner = substr($class, 4, -1);
|
$inner = substr($class, 4, -1);
|
||||||
$deserialized = array();
|
$deserialized = array();
|
||||||
if(strrpos($inner, ",") !== false) {
|
if(strrpos($inner, ",") !== false) {
|
||||||
$subClass_array = explode(',', $inner, 2);
|
$subClass_array = explode(',', $inner, 2);
|
||||||
$subClass = $subClass_array[1];
|
$subClass = $subClass_array[1];
|
||||||
foreach ($data as $key => $value) {
|
foreach ($data as $key => $value) {
|
||||||
$deserialized[$key] = $this->deserialize($value, $subClass);
|
$deserialized[$key] = $this->deserialize($value, $subClass);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
} elseif (strcasecmp(substr($class, -2),'[]') == 0) {
|
||||||
|
$subClass = substr($class, 0, -2);
|
||||||
|
$values = array();
|
||||||
|
foreach ($data as $key => $value) {
|
||||||
|
$values[] = $this->deserialize($value, $subClass);
|
||||||
|
}
|
||||||
|
$deserialized = $values;
|
||||||
|
} elseif ($class == 'DateTime') {
|
||||||
|
$deserialized = new \DateTime($data);
|
||||||
|
} elseif (in_array($class, array('string', 'int', 'float', 'double', 'bool', 'object'))) {
|
||||||
|
settype($data, $class);
|
||||||
|
$deserialized = $data;
|
||||||
|
} elseif ($class === '\SplFileObject') {
|
||||||
|
# determine temp folder path
|
||||||
|
$tmpFolderPath = Configuration::getDefaultConfiguration()->getTempFolderPath();
|
||||||
|
print_r($tmpFolderPath);
|
||||||
|
|
||||||
|
# determine file name
|
||||||
|
if (preg_match('/Content-Disposition: inline; filename=(.*)$/i', $httpHeader, $match)) {
|
||||||
|
$filename = $tmpFolderPath.$match[1];
|
||||||
|
} else {
|
||||||
|
print_r($tmpFolderPath);
|
||||||
|
$filename = tempnam($tmpFolderPath, '');
|
||||||
|
}
|
||||||
|
$deserialized = new \SplFileObject($filename, "w");
|
||||||
|
$byte_written = $deserialized->fwrite($data);
|
||||||
|
error_log("[INFO] Written $byte_written byte to $filename. Please move the file to a proper folder or delete the temp file afterwards", 3, Configuration::getDefaultConfiguration()->getDebugFile());
|
||||||
|
|
||||||
|
} else {
|
||||||
|
$instance = new $class();
|
||||||
|
foreach ($instance::$swaggerTypes as $property => $type) {
|
||||||
|
$propertySetter = $instance::$setters[$property];
|
||||||
|
|
||||||
|
if (!isset($propertySetter) || !isset($data->{$instance::$attributeMap[$property]})) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
$propertyValue = $data->{$instance::$attributeMap[$property]};
|
||||||
|
if (isset($propertyValue)) {
|
||||||
|
$instance->$propertySetter($this->deserialize($propertyValue, $type));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$deserialized = $instance;
|
||||||
}
|
}
|
||||||
} elseif (strcasecmp(substr($class, -2),'[]') == 0) {
|
|
||||||
$subClass = substr($class, 0, -2);
|
|
||||||
$values = array();
|
|
||||||
foreach ($data as $key => $value) {
|
|
||||||
$values[] = $this->deserialize($value, $subClass);
|
|
||||||
}
|
|
||||||
$deserialized = $values;
|
|
||||||
} elseif ($class == 'DateTime') {
|
|
||||||
$deserialized = new \DateTime($data);
|
|
||||||
} elseif (in_array($class, array('string', 'int', 'float', 'double', 'bool', 'object'))) {
|
|
||||||
settype($data, $class);
|
|
||||||
$deserialized = $data;
|
|
||||||
} elseif ($class === '\SplFileObject') {
|
|
||||||
# determine temp folder path
|
|
||||||
if (!isset(Configuration::$tempFolderPath) || '' === Configuration::$tempFolderPath) {
|
|
||||||
$tmpFolderPath = sys_get_temp_dir();
|
|
||||||
} else {
|
|
||||||
$tmpFolderPath = Configuration::tempFolderPath;
|
|
||||||
}
|
|
||||||
|
|
||||||
# determine file name
|
return $deserialized;
|
||||||
if (preg_match('/Content-Disposition: inline; filename=(.*)/i', $httpHeader, $match)) {
|
|
||||||
$filename = $tmpFolderPath.$match[1];
|
|
||||||
} else {
|
|
||||||
$filename = tempnam($tmpFolderPath, '');
|
|
||||||
}
|
|
||||||
$deserialized = new \SplFileObject($filename, "w");
|
|
||||||
$byte_written = $deserialized->fwrite($data);
|
|
||||||
error_log("[INFO] Written $byte_written byte to $filename. Please move the file to a proper folder or delete the temp file afterwards", 3, Configuration::getDefaultConfiguration()->getDebugFile());
|
|
||||||
|
|
||||||
} else {
|
|
||||||
$instance = new $class();
|
|
||||||
foreach ($instance::$swaggerTypes as $property => $type) {
|
|
||||||
$propertySetter = $instance::$setters[$property];
|
|
||||||
|
|
||||||
if (!isset($propertySetter) || !isset($data->{$instance::$attributeMap[$property]})) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
$propertyValue = $data->{$instance::$attributeMap[$property]};
|
|
||||||
if (isset($propertyValue)) {
|
|
||||||
$instance->$propertySetter($this->deserialize($propertyValue, $type));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
$deserialized = $instance;
|
|
||||||
}
|
|
||||||
|
|
||||||
return $deserialized;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -12,12 +12,15 @@ require_once(__DIR__ . '/SwaggerClient-php/autoload.php');
|
|||||||
// to enable logging
|
// to enable logging
|
||||||
//SwaggerClient\Configuration::$debug = true;
|
//SwaggerClient\Configuration::$debug = true;
|
||||||
//SwaggerClient\Configuration::$debug_file = '/var/tmp/php_debug.log';
|
//SwaggerClient\Configuration::$debug_file = '/var/tmp/php_debug.log';
|
||||||
|
Swagger\Client\Configuration::getDefaultConfiguration()->setTempFolderPath('/var/tmp/php/');
|
||||||
|
|
||||||
$petId = 10005; // ID of pet that needs to be fetched
|
$petId = 10005; // ID of pet that needs to be fetched
|
||||||
try {
|
try {
|
||||||
// get pet by id
|
// get pet by id
|
||||||
//$pet_api = new SwaggerClient\PetAPI($api_client);
|
//$pet_api = new SwaggerClient\PetAPI($api_client);
|
||||||
$pet_api = new Swagger\Client\Api\PetAPI();
|
$pet_api = new Swagger\Client\Api\PetAPI();
|
||||||
|
$pet_api->getApiClient()->getConfig()->setTempFolderPath('/var/tmp/php/');
|
||||||
|
print_r($pet_api->getApiClient()->getConfig()->getTempFolderPath());
|
||||||
// test default header
|
// test default header
|
||||||
//$pet_api->getApiClient()->addDefaultHeader("TEST_API_KEY", "09182sdkanafndsl903");
|
//$pet_api->getApiClient()->addDefaultHeader("TEST_API_KEY", "09182sdkanafndsl903");
|
||||||
// return Pet (model)
|
// return Pet (model)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user