forked from loafle/openapi-generator-original
update test.php, remove old SwaggerPetstore-php
This commit is contained in:
parent
8512259d02
commit
4c717829b3
@ -1,52 +0,0 @@
|
||||
## Requirements
|
||||
|
||||
PHP 5.3.3 and later.
|
||||
|
||||
## Composer
|
||||
|
||||
You can install the bindings via [Composer](http://getcomposer.org/). Add this to your `composer.json`:
|
||||
|
||||
{
|
||||
"repositories": [
|
||||
{
|
||||
"type": "git",
|
||||
"url": "https://github.com/wing328/SwaggerPetstore-php.git"
|
||||
}
|
||||
],
|
||||
"require": {
|
||||
"SwaggerPetstore/SwaggerPetstore-php": "*@dev"
|
||||
}
|
||||
}
|
||||
|
||||
Then install via:
|
||||
|
||||
composer install
|
||||
|
||||
To use the bindings, use Composer's [autoload](https://getcomposer.org/doc/00-intro.md#autoloading):
|
||||
|
||||
require_once('vendor/autoload.php');
|
||||
|
||||
## Manual Installation
|
||||
|
||||
If you do not wish to use Composer, you can download the latest release. Then, to use the bindings, include the `SwaggerPetstore.php` file.
|
||||
|
||||
require_once('/path/to/SwaggerPetstore-php/SwaggerPetstore.php');
|
||||
|
||||
## Getting Started
|
||||
|
||||
php test.php
|
||||
|
||||
## Documentation
|
||||
|
||||
TODO
|
||||
|
||||
## Tests
|
||||
|
||||
In order to run tests first install [PHPUnit](http://packagist.org/packages/phpunit/phpunit) via [Composer](http://getcomposer.org/):
|
||||
|
||||
composer update
|
||||
|
||||
To run the test suite:
|
||||
|
||||
./vendor/bin/phpunit tests
|
||||
|
@ -1,16 +0,0 @@
|
||||
<?php
|
||||
// source code generated by http://restunited.com
|
||||
// for any feedback/issue, please send to feedback{at}restunited.com
|
||||
|
||||
// load models defined for endpoints
|
||||
foreach (glob(dirname(__FILE__)."/lib/models/*.php") as $filename)
|
||||
{
|
||||
require_once $filename;
|
||||
}
|
||||
|
||||
// load classes for accessing the endpoints
|
||||
foreach (glob(dirname(__FILE__)."/lib/*.php") as $filename)
|
||||
{
|
||||
require_once $filename;
|
||||
}
|
||||
?>
|
@ -1,32 +0,0 @@
|
||||
{
|
||||
"name": "SwaggerPetstore/SwaggerPetstore-php",
|
||||
"description": "",
|
||||
"keywords": [
|
||||
"swagger",
|
||||
"php",
|
||||
"sdk",
|
||||
"api"
|
||||
],
|
||||
"homepage": "http://swagger.io",
|
||||
"license": "Apache v2",
|
||||
"authors": [
|
||||
{
|
||||
"name": "Swagger and contributors",
|
||||
"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": { "SwaggerPetstore\\" : "lib/" }
|
||||
}
|
||||
}
|
@ -1,304 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* Copyright 2015 Reverb Technologies, Inc.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
namespace SwaggerPetstore;
|
||||
|
||||
class APIClient {
|
||||
|
||||
public static $PATCH = "PATCH";
|
||||
public static $POST = "POST";
|
||||
public static $GET = "GET";
|
||||
public static $PUT = "PUT";
|
||||
public static $DELETE = "DELETE";
|
||||
|
||||
/*
|
||||
* @var string timeout (second) of the HTTP request, by default set to 0, no timeout
|
||||
*/
|
||||
protected $curl_timeout = 0;
|
||||
|
||||
/*
|
||||
* @var string user agent of the HTTP request, set to "PHP-Swagger" by default
|
||||
*/
|
||||
protected $user_agent = "PHP-Swagger";
|
||||
|
||||
/**
|
||||
* @param string $host the address of the API server
|
||||
* @param string $headerName a header to pass on requests
|
||||
*/
|
||||
function __construct($host, $headerName = null, $headerValue = null) {
|
||||
$this->host = $host;
|
||||
$this->headerName = $headerName;
|
||||
$this->headerValue = $headerValue;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the user agent of the API client
|
||||
*
|
||||
* @param string $user_agent The user agent of the API client
|
||||
*/
|
||||
public function setUserAgent($user_agent) {
|
||||
if (!is_string($user_agent)) {
|
||||
throw new Exception('User-agent must be a string.');
|
||||
}
|
||||
$this->user_agent= $user_agent;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param integer $seconds Number of seconds before timing out [set to 0 for no timeout]
|
||||
*/
|
||||
public function setTimeout($seconds) {
|
||||
if (!is_numeric($seconds)) {
|
||||
throw new Exception('Timeout variable must be numeric.');
|
||||
}
|
||||
$this->curl_timeout = $seconds;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $resourcePath path to method endpoint
|
||||
* @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
|
||||
* @return mixed
|
||||
*/
|
||||
public function callAPI($resourcePath, $method, $queryParams, $postData,
|
||||
$headerParams) {
|
||||
|
||||
$headers = array();
|
||||
|
||||
# Allow API key from $headerParams to override default
|
||||
$added_api_key = False;
|
||||
if ($headerParams != null) {
|
||||
foreach ($headerParams as $key => $val) {
|
||||
$headers[] = "$key: $val";
|
||||
if ($key == $this->headerName) {
|
||||
$added_api_key = True;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (! $added_api_key && $this->headerName != null) {
|
||||
$headers[] = $this->headerName . ": " . $this->headerValue;
|
||||
}
|
||||
|
||||
if ((isset($headers['Content-Type']) and strpos($headers['Content-Type'], "multipart/form-data") < 0) and (is_object($postData) or is_array($postData))) {
|
||||
$postData = json_encode($this->sanitizeForSerialization($postData));
|
||||
}
|
||||
|
||||
$url = $this->host . $resourcePath;
|
||||
|
||||
$curl = curl_init();
|
||||
// set timeout, if needed
|
||||
if ($this->curl_timeout != 0) {
|
||||
curl_setopt($curl, CURLOPT_TIMEOUT, $this->curl_timeout);
|
||||
}
|
||||
// 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 Exception('Method ' . $method . ' is not recognized.');
|
||||
}
|
||||
curl_setopt($curl, CURLOPT_URL, $url);
|
||||
|
||||
// Set user agent
|
||||
curl_setopt($curl, CURLOPT_USERAGENT, $this->user_agent);
|
||||
|
||||
// Make the request
|
||||
$response = curl_exec($curl);
|
||||
$response_info = curl_getinfo($curl);
|
||||
|
||||
// Handle the response
|
||||
if ($response_info['http_code'] == 0) {
|
||||
throw new APIClientException("TIMEOUT: api call to " . $url .
|
||||
" took more than 5s to return", 0, $response_info, $response);
|
||||
} else if ($response_info['http_code'] >= 200 && $response_info['http_code'] <= 299 ) {
|
||||
$data = json_decode($response);
|
||||
if (json_last_error() > 0) { // if response is a string
|
||||
$data = $response;
|
||||
}
|
||||
} else if ($response_info['http_code'] == 401) {
|
||||
throw new APIClientException("Unauthorized API request to " . $url .
|
||||
": " . serialize($response), 0, $response_info, $response);
|
||||
} else if ($response_info['http_code'] == 404) {
|
||||
$data = null;
|
||||
} else {
|
||||
throw new APIClientException("Can't connect to the api: " . $url .
|
||||
" response code: " .
|
||||
$response_info['http_code'], 0, $response_info, $response);
|
||||
}
|
||||
return $data;
|
||||
}
|
||||
|
||||
/**
|
||||
* Build a JSON POST object
|
||||
*/
|
||||
protected function sanitizeForSerialization($data)
|
||||
{
|
||||
if (is_scalar($data) || null === $data) {
|
||||
$sanitized = $data;
|
||||
} else if ($data instanceof \DateTime) {
|
||||
$sanitized = $data->format(\DateTime::ISO8601);
|
||||
} else if (is_array($data)) {
|
||||
foreach ($data as $property => $value) {
|
||||
$data[$property] = $this->sanitizeForSerialization($value);
|
||||
}
|
||||
$sanitized = $data;
|
||||
} else if (is_object($data)) {
|
||||
$values = array();
|
||||
foreach (array_keys($data::$swaggerTypes) as $property) {
|
||||
$values[$data::$attributeMap[$property]] = $this->sanitizeForSerialization($data->$property);
|
||||
}
|
||||
$sanitized = $values;
|
||||
} else {
|
||||
$sanitized = (string)$data;
|
||||
}
|
||||
|
||||
return $sanitized;
|
||||
}
|
||||
|
||||
/**
|
||||
* Take value and turn it into a string suitable for inclusion in
|
||||
* the path, by url-encoding.
|
||||
* @param string $value a string which will be part of the path
|
||||
* @return string the serialized object
|
||||
*/
|
||||
public static function toPathValue($value) {
|
||||
return rawurlencode(self::toString($value));
|
||||
}
|
||||
|
||||
/**
|
||||
* Take value and turn it into a string suitable for inclusion in
|
||||
* the query, by imploding comma-separated if it's an object.
|
||||
* If it's a string, pass through unchanged. It will be url-encoded
|
||||
* later.
|
||||
* @param object $object an object to be serialized to a string
|
||||
* @return string the serialized object
|
||||
*/
|
||||
public static function toQueryValue($object) {
|
||||
if (is_array($object)) {
|
||||
return implode(',', $object);
|
||||
} else {
|
||||
return self::toString($object);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Take value and turn it into a string suitable for inclusion in
|
||||
* the header. If it's a string, pass through unchanged
|
||||
* If it's a datetime object, format it in ISO8601
|
||||
* @param string $value a string which will be part of the header
|
||||
* @return string the header string
|
||||
*/
|
||||
public static function toHeaderValue($value) {
|
||||
return self::toString($value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Take value and turn it into a string suitable for inclusion in
|
||||
* the http body (form parameter). If it's a string, pass through unchanged
|
||||
* If it's a datetime object, format it in ISO8601
|
||||
* @param string $value the value of the form parameter
|
||||
* @return string the form string
|
||||
*/
|
||||
public static function toFormValue($value) {
|
||||
return self::toString($value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Take value and turn it into a string suitable for inclusion in
|
||||
* the parameter. If it's a string, pass through unchanged
|
||||
* If it's a datetime object, format it in ISO8601
|
||||
* @param string $value the value of the parameter
|
||||
* @return string the header string
|
||||
*/
|
||||
public static function toString($value) {
|
||||
if ($value instanceof \DateTime) { // datetime in ISO8601 format
|
||||
return $value->format(\DateTime::ISO8601);
|
||||
}
|
||||
else {
|
||||
return $value;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Deserialize a JSON string into an object
|
||||
*
|
||||
* @param object $object object or primitive to be deserialized
|
||||
* @param string $class class name is passed as a string
|
||||
* @return object an instance of $class
|
||||
*/
|
||||
|
||||
public static function deserialize($data, $class)
|
||||
{
|
||||
if (null === $data) {
|
||||
$deserialized = null;
|
||||
} elseif (substr($class, 0, 4) == 'map[') {
|
||||
$inner = substr($class, 4, -1);
|
||||
$values = array();
|
||||
if(strrpos($inner, ",") !== false) {
|
||||
$subClass_array = explode(',', $inner, 2);
|
||||
$subClass = $subClass_array[1];
|
||||
foreach ($data as $key => $value) {
|
||||
$values[] = array($key => self::deserialize($value, $subClass));
|
||||
}
|
||||
}
|
||||
$deserialized = $values;
|
||||
} elseif (strcasecmp(substr($class, 0, 6),'array[') == 0) {
|
||||
$subClass = substr($class, 6, -1);
|
||||
$values = array();
|
||||
foreach ($data as $key => $value) {
|
||||
$values[] = self::deserialize($value, $subClass);
|
||||
}
|
||||
$deserialized = $values;
|
||||
} elseif ($class == 'DateTime') {
|
||||
$deserialized = new \DateTime($data);
|
||||
} elseif (in_array($class, array('string', 'int', 'float', 'double', 'bool'))) {
|
||||
settype($data, $class);
|
||||
$deserialized = $data;
|
||||
} else {
|
||||
$class = "SwaggerPetstore\\models\\".$class;
|
||||
$instance = new $class();
|
||||
foreach ($instance::$swaggerTypes as $property => $type) {
|
||||
if (isset($data->$property)) {
|
||||
$original_property_name = $instance::$attributeMap[$property];
|
||||
$instance->$property = self::deserialize($data->$original_property_name, $type);
|
||||
}
|
||||
}
|
||||
$deserialized = $instance;
|
||||
}
|
||||
|
||||
return $deserialized;
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -1,38 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* Copyright 2015 Reverb Technologies, Inc.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
namespace SwaggerPetstore;
|
||||
|
||||
use \Exception;
|
||||
|
||||
class APIClientException extends Exception {
|
||||
protected $response, $response_info;
|
||||
|
||||
public function __construct($message="", $code=0, $response_info=null, $response=null) {
|
||||
parent::__construct($message, $code);
|
||||
$this->response_info = $response_info;
|
||||
$this->response = $response;
|
||||
}
|
||||
|
||||
public function getResponse() {
|
||||
return $this->response;
|
||||
}
|
||||
|
||||
public function getResponseInfo() {
|
||||
return $this->response_info;
|
||||
}
|
||||
}
|
@ -1,493 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* Copyright 2015 Reverb Technologies, Inc.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
/**
|
||||
*
|
||||
* NOTE: This class is auto generated by the swagger code generator program. Do not edit the class manually.
|
||||
*/
|
||||
|
||||
namespace SwaggerPetstore;
|
||||
|
||||
class PetApi {
|
||||
|
||||
function __construct($apiClient) {
|
||||
$this->apiClient = $apiClient;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* updatePet
|
||||
*
|
||||
* Update an existing pet
|
||||
*
|
||||
* @param Pet $body Pet object that needs to be added to the store (required)
|
||||
* @return void
|
||||
*/
|
||||
public function updatePet($body) {
|
||||
|
||||
// parse inputs
|
||||
$resourcePath = "/pet";
|
||||
$resourcePath = str_replace("{format}", "json", $resourcePath);
|
||||
$method = "PUT";
|
||||
$httpBody = '';
|
||||
$queryParams = array();
|
||||
$headerParams = array();
|
||||
$formParams = array();
|
||||
$_header_accept = 'application/json, application/xml';
|
||||
if ($_header_accept !== '') {
|
||||
$headerParams['Accept'] = $_header_accept;
|
||||
}
|
||||
$_header_content_type = array('application/json','application/xml',);
|
||||
$headerParams['Content-Type'] = count($_header_content_type) > 0 ? $_header_content_type[0] : 'application/json';
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// body params
|
||||
$body = null;
|
||||
if (isset($body)) {
|
||||
$body = $body;
|
||||
}
|
||||
|
||||
// for model (json/xml)
|
||||
if (isset($body)) {
|
||||
$httpBody = $body; // $body is the method argument, if present
|
||||
}
|
||||
|
||||
// for HTTP post (form)
|
||||
if (strpos($headerParams['Content-Type'], "application/x-www-form-urlencoded") > -1) {
|
||||
$httpBody = http_build_query($formParams);
|
||||
}
|
||||
|
||||
// make the API Call
|
||||
$response = $this->apiClient->callAPI($resourcePath, $method,
|
||||
$queryParams, $httpBody,
|
||||
$headerParams);
|
||||
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* addPet
|
||||
*
|
||||
* Add a new pet to the store
|
||||
*
|
||||
* @param Pet $body Pet object that needs to be added to the store (required)
|
||||
* @return void
|
||||
*/
|
||||
public function addPet($body) {
|
||||
|
||||
// parse inputs
|
||||
$resourcePath = "/pet";
|
||||
$resourcePath = str_replace("{format}", "json", $resourcePath);
|
||||
$method = "POST";
|
||||
$httpBody = '';
|
||||
$queryParams = array();
|
||||
$headerParams = array();
|
||||
$formParams = array();
|
||||
$_header_accept = 'application/json, application/xml';
|
||||
if ($_header_accept !== '') {
|
||||
$headerParams['Accept'] = $_header_accept;
|
||||
}
|
||||
$_header_content_type = array('application/json','application/xml',);
|
||||
$headerParams['Content-Type'] = count($_header_content_type) > 0 ? $_header_content_type[0] : 'application/json';
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// body params
|
||||
$body = null;
|
||||
if (isset($body)) {
|
||||
$body = $body;
|
||||
}
|
||||
|
||||
// for model (json/xml)
|
||||
if (isset($body)) {
|
||||
$httpBody = $body; // $body is the method argument, if present
|
||||
}
|
||||
|
||||
// for HTTP post (form)
|
||||
if (strpos($headerParams['Content-Type'], "application/x-www-form-urlencoded") > -1) {
|
||||
$httpBody = http_build_query($formParams);
|
||||
}
|
||||
|
||||
// make the API Call
|
||||
$response = $this->apiClient->callAPI($resourcePath, $method,
|
||||
$queryParams, $httpBody,
|
||||
$headerParams);
|
||||
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* findPetsByStatus
|
||||
*
|
||||
* Finds Pets by status
|
||||
*
|
||||
* @param array[string] $status Status values that need to be considered for filter (required)
|
||||
* @return array[Pet]
|
||||
*/
|
||||
public function findPetsByStatus($status) {
|
||||
|
||||
// parse inputs
|
||||
$resourcePath = "/pet/findByStatus";
|
||||
$resourcePath = str_replace("{format}", "json", $resourcePath);
|
||||
$method = "GET";
|
||||
$httpBody = '';
|
||||
$queryParams = array();
|
||||
$headerParams = array();
|
||||
$formParams = array();
|
||||
$_header_accept = 'application/json, application/xml';
|
||||
if ($_header_accept !== '') {
|
||||
$headerParams['Accept'] = $_header_accept;
|
||||
}
|
||||
$_header_content_type = array();
|
||||
$headerParams['Content-Type'] = count($_header_content_type) > 0 ? $_header_content_type[0] : 'application/json';
|
||||
|
||||
// query params
|
||||
if($status !== null) {
|
||||
$queryParams['status'] = $this->apiClient->toQueryValue($status);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// for model (json/xml)
|
||||
if (isset($body)) {
|
||||
$httpBody = $body; // $body is the method argument, if present
|
||||
}
|
||||
|
||||
// for HTTP post (form)
|
||||
if (strpos($headerParams['Content-Type'], "application/x-www-form-urlencoded") > -1) {
|
||||
$httpBody = http_build_query($formParams);
|
||||
}
|
||||
|
||||
// make the API Call
|
||||
$response = $this->apiClient->callAPI($resourcePath, $method,
|
||||
$queryParams, $httpBody,
|
||||
$headerParams);
|
||||
|
||||
if(! $response) {
|
||||
return null;
|
||||
}
|
||||
|
||||
$responseObject = $this->apiClient->deserialize($response,
|
||||
'array[Pet]');
|
||||
return $responseObject;
|
||||
}
|
||||
|
||||
/**
|
||||
* findPetsByTags
|
||||
*
|
||||
* Finds Pets by tags
|
||||
*
|
||||
* @param array[string] $tags Tags to filter by (required)
|
||||
* @return array[Pet]
|
||||
*/
|
||||
public function findPetsByTags($tags) {
|
||||
|
||||
// parse inputs
|
||||
$resourcePath = "/pet/findByTags";
|
||||
$resourcePath = str_replace("{format}", "json", $resourcePath);
|
||||
$method = "GET";
|
||||
$httpBody = '';
|
||||
$queryParams = array();
|
||||
$headerParams = array();
|
||||
$formParams = array();
|
||||
$_header_accept = 'application/json, application/xml';
|
||||
if ($_header_accept !== '') {
|
||||
$headerParams['Accept'] = $_header_accept;
|
||||
}
|
||||
$_header_content_type = array();
|
||||
$headerParams['Content-Type'] = count($_header_content_type) > 0 ? $_header_content_type[0] : 'application/json';
|
||||
|
||||
// query params
|
||||
if($tags !== null) {
|
||||
$queryParams['tags'] = $this->apiClient->toQueryValue($tags);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// for model (json/xml)
|
||||
if (isset($body)) {
|
||||
$httpBody = $body; // $body is the method argument, if present
|
||||
}
|
||||
|
||||
// for HTTP post (form)
|
||||
if (strpos($headerParams['Content-Type'], "application/x-www-form-urlencoded") > -1) {
|
||||
$httpBody = http_build_query($formParams);
|
||||
}
|
||||
|
||||
// make the API Call
|
||||
$response = $this->apiClient->callAPI($resourcePath, $method,
|
||||
$queryParams, $httpBody,
|
||||
$headerParams);
|
||||
|
||||
if(! $response) {
|
||||
return null;
|
||||
}
|
||||
|
||||
$responseObject = $this->apiClient->deserialize($response,
|
||||
'array[Pet]');
|
||||
return $responseObject;
|
||||
}
|
||||
|
||||
/**
|
||||
* getPetById
|
||||
*
|
||||
* Find pet by ID
|
||||
*
|
||||
* @param int $pet_id ID of pet that needs to be fetched (required)
|
||||
* @return Pet
|
||||
*/
|
||||
public function getPetById($pet_id) {
|
||||
|
||||
// parse inputs
|
||||
$resourcePath = "/pet/{petId}";
|
||||
$resourcePath = str_replace("{format}", "json", $resourcePath);
|
||||
$method = "GET";
|
||||
$httpBody = '';
|
||||
$queryParams = array();
|
||||
$headerParams = array();
|
||||
$formParams = array();
|
||||
$_header_accept = 'application/json, application/xml';
|
||||
if ($_header_accept !== '') {
|
||||
$headerParams['Accept'] = $_header_accept;
|
||||
}
|
||||
$_header_content_type = array();
|
||||
$headerParams['Content-Type'] = count($_header_content_type) > 0 ? $_header_content_type[0] : 'application/json';
|
||||
|
||||
|
||||
|
||||
// path params
|
||||
if($pet_id !== null) {
|
||||
$resourcePath = str_replace("{" . "petId" . "}",
|
||||
$this->apiClient->toPathValue($pet_id), $resourcePath);
|
||||
}
|
||||
|
||||
|
||||
|
||||
// for model (json/xml)
|
||||
if (isset($body)) {
|
||||
$httpBody = $body; // $body is the method argument, if present
|
||||
}
|
||||
|
||||
// for HTTP post (form)
|
||||
if (strpos($headerParams['Content-Type'], "application/x-www-form-urlencoded") > -1) {
|
||||
$httpBody = http_build_query($formParams);
|
||||
}
|
||||
|
||||
// make the API Call
|
||||
$response = $this->apiClient->callAPI($resourcePath, $method,
|
||||
$queryParams, $httpBody,
|
||||
$headerParams);
|
||||
|
||||
if(! $response) {
|
||||
return null;
|
||||
}
|
||||
|
||||
$responseObject = $this->apiClient->deserialize($response,
|
||||
'Pet');
|
||||
return $responseObject;
|
||||
}
|
||||
|
||||
/**
|
||||
* updatePetWithForm
|
||||
*
|
||||
* Updates a pet in the store with form data
|
||||
*
|
||||
* @param string $pet_id ID of pet that needs to be updated (required)
|
||||
* @param string $name Updated name of the pet (required)
|
||||
* @param string $status Updated status of the pet (required)
|
||||
* @return void
|
||||
*/
|
||||
public function updatePetWithForm($pet_id, $name, $status) {
|
||||
|
||||
// parse inputs
|
||||
$resourcePath = "/pet/{petId}";
|
||||
$resourcePath = str_replace("{format}", "json", $resourcePath);
|
||||
$method = "POST";
|
||||
$httpBody = '';
|
||||
$queryParams = array();
|
||||
$headerParams = array();
|
||||
$formParams = array();
|
||||
$_header_accept = 'application/json, application/xml';
|
||||
if ($_header_accept !== '') {
|
||||
$headerParams['Accept'] = $_header_accept;
|
||||
}
|
||||
$_header_content_type = array('application/x-www-form-urlencoded',);
|
||||
$headerParams['Content-Type'] = count($_header_content_type) > 0 ? $_header_content_type[0] : 'application/json';
|
||||
|
||||
|
||||
|
||||
// path params
|
||||
if($pet_id !== null) {
|
||||
$resourcePath = str_replace("{" . "petId" . "}",
|
||||
$this->apiClient->toPathValue($pet_id), $resourcePath);
|
||||
}
|
||||
// form params
|
||||
if ($name !== null) {
|
||||
$formParams['name'] = $this->apiClient->toFormValue($name);
|
||||
}// form params
|
||||
if ($status !== null) {
|
||||
$formParams['status'] = $this->apiClient->toFormValue($status);
|
||||
}
|
||||
|
||||
|
||||
// for model (json/xml)
|
||||
if (isset($body)) {
|
||||
$httpBody = $body; // $body is the method argument, if present
|
||||
}
|
||||
|
||||
// for HTTP post (form)
|
||||
if (strpos($headerParams['Content-Type'], "application/x-www-form-urlencoded") > -1) {
|
||||
$httpBody = http_build_query($formParams);
|
||||
}
|
||||
|
||||
// make the API Call
|
||||
$response = $this->apiClient->callAPI($resourcePath, $method,
|
||||
$queryParams, $httpBody,
|
||||
$headerParams);
|
||||
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* deletePet
|
||||
*
|
||||
* Deletes a pet
|
||||
*
|
||||
* @param string $api_key (required)
|
||||
* @param int $pet_id Pet id to delete (required)
|
||||
* @return void
|
||||
*/
|
||||
public function deletePet($api_key, $pet_id) {
|
||||
|
||||
// parse inputs
|
||||
$resourcePath = "/pet/{petId}";
|
||||
$resourcePath = str_replace("{format}", "json", $resourcePath);
|
||||
$method = "DELETE";
|
||||
$httpBody = '';
|
||||
$queryParams = array();
|
||||
$headerParams = array();
|
||||
$formParams = array();
|
||||
$_header_accept = 'application/json, application/xml';
|
||||
if ($_header_accept !== '') {
|
||||
$headerParams['Accept'] = $_header_accept;
|
||||
}
|
||||
$_header_content_type = array();
|
||||
$headerParams['Content-Type'] = count($_header_content_type) > 0 ? $_header_content_type[0] : 'application/json';
|
||||
|
||||
|
||||
// header params
|
||||
if($api_key !== null) {
|
||||
$headerParams['api_key'] = $this->apiClient->toHeaderValue($api_key);
|
||||
}
|
||||
// path params
|
||||
if($pet_id !== null) {
|
||||
$resourcePath = str_replace("{" . "petId" . "}",
|
||||
$this->apiClient->toPathValue($pet_id), $resourcePath);
|
||||
}
|
||||
|
||||
|
||||
|
||||
// for model (json/xml)
|
||||
if (isset($body)) {
|
||||
$httpBody = $body; // $body is the method argument, if present
|
||||
}
|
||||
|
||||
// for HTTP post (form)
|
||||
if (strpos($headerParams['Content-Type'], "application/x-www-form-urlencoded") > -1) {
|
||||
$httpBody = http_build_query($formParams);
|
||||
}
|
||||
|
||||
// make the API Call
|
||||
$response = $this->apiClient->callAPI($resourcePath, $method,
|
||||
$queryParams, $httpBody,
|
||||
$headerParams);
|
||||
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* uploadFile
|
||||
*
|
||||
* uploads an image
|
||||
*
|
||||
* @param int $pet_id ID of pet to update (required)
|
||||
* @param string $additional_metadata Additional data to pass to server (required)
|
||||
* @param file $file file to upload (required)
|
||||
* @return void
|
||||
*/
|
||||
public function uploadFile($pet_id, $additional_metadata, $file) {
|
||||
|
||||
// parse inputs
|
||||
$resourcePath = "/pet/{petId}/uploadImage";
|
||||
$resourcePath = str_replace("{format}", "json", $resourcePath);
|
||||
$method = "POST";
|
||||
$httpBody = '';
|
||||
$queryParams = array();
|
||||
$headerParams = array();
|
||||
$formParams = array();
|
||||
$_header_accept = 'application/json, application/xml';
|
||||
if ($_header_accept !== '') {
|
||||
$headerParams['Accept'] = $_header_accept;
|
||||
}
|
||||
$_header_content_type = array('multipart/form-data',);
|
||||
$headerParams['Content-Type'] = count($_header_content_type) > 0 ? $_header_content_type[0] : 'application/json';
|
||||
|
||||
|
||||
|
||||
// path params
|
||||
if($pet_id !== null) {
|
||||
$resourcePath = str_replace("{" . "petId" . "}",
|
||||
$this->apiClient->toPathValue($pet_id), $resourcePath);
|
||||
}
|
||||
// form params
|
||||
if ($additional_metadata !== null) {
|
||||
$formParams['additionalMetadata'] = $this->apiClient->toFormValue($additional_metadata);
|
||||
}// form params
|
||||
if ($file !== null) {
|
||||
$formParams['file'] = '@' . $this->apiClient->toFormValue($file);
|
||||
}
|
||||
|
||||
|
||||
// for model (json/xml)
|
||||
if (isset($body)) {
|
||||
$httpBody = $body; // $body is the method argument, if present
|
||||
}
|
||||
|
||||
// for HTTP post (form)
|
||||
if (strpos($headerParams['Content-Type'], "application/x-www-form-urlencoded") > -1) {
|
||||
$httpBody = http_build_query($formParams);
|
||||
}
|
||||
|
||||
// make the API Call
|
||||
$response = $this->apiClient->callAPI($resourcePath, $method,
|
||||
$queryParams, $httpBody,
|
||||
$headerParams);
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
@ -1,258 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* Copyright 2015 Reverb Technologies, Inc.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
/**
|
||||
*
|
||||
* NOTE: This class is auto generated by the swagger code generator program. Do not edit the class manually.
|
||||
*/
|
||||
|
||||
namespace SwaggerPetstore;
|
||||
|
||||
class StoreApi {
|
||||
|
||||
function __construct($apiClient) {
|
||||
$this->apiClient = $apiClient;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* getInventory
|
||||
*
|
||||
* Returns pet inventories by status
|
||||
*
|
||||
* @return map[string,int]
|
||||
*/
|
||||
public function getInventory() {
|
||||
|
||||
// parse inputs
|
||||
$resourcePath = "/store/inventory";
|
||||
$resourcePath = str_replace("{format}", "json", $resourcePath);
|
||||
$method = "GET";
|
||||
$httpBody = '';
|
||||
$queryParams = array();
|
||||
$headerParams = array();
|
||||
$formParams = array();
|
||||
$_header_accept = 'application/json, application/xml';
|
||||
if ($_header_accept !== '') {
|
||||
$headerParams['Accept'] = $_header_accept;
|
||||
}
|
||||
$_header_content_type = array();
|
||||
$headerParams['Content-Type'] = count($_header_content_type) > 0 ? $_header_content_type[0] : 'application/json';
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// for model (json/xml)
|
||||
if (isset($body)) {
|
||||
$httpBody = $body; // $body is the method argument, if present
|
||||
}
|
||||
|
||||
// for HTTP post (form)
|
||||
if (strpos($headerParams['Content-Type'], "application/x-www-form-urlencoded") > -1) {
|
||||
$httpBody = http_build_query($formParams);
|
||||
}
|
||||
|
||||
// make the API Call
|
||||
$response = $this->apiClient->callAPI($resourcePath, $method,
|
||||
$queryParams, $httpBody,
|
||||
$headerParams);
|
||||
|
||||
if(! $response) {
|
||||
return null;
|
||||
}
|
||||
|
||||
$responseObject = $this->apiClient->deserialize($response,
|
||||
'map[string,int]');
|
||||
return $responseObject;
|
||||
}
|
||||
|
||||
/**
|
||||
* placeOrder
|
||||
*
|
||||
* Place an order for a pet
|
||||
*
|
||||
* @param Order $body order placed for purchasing the pet (required)
|
||||
* @return Order
|
||||
*/
|
||||
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 = 'application/json, application/xml';
|
||||
if ($_header_accept !== '') {
|
||||
$headerParams['Accept'] = $_header_accept;
|
||||
}
|
||||
$_header_content_type = array();
|
||||
$headerParams['Content-Type'] = count($_header_content_type) > 0 ? $_header_content_type[0] : 'application/json';
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// body params
|
||||
$body = null;
|
||||
if (isset($body)) {
|
||||
$body = $body;
|
||||
}
|
||||
|
||||
// for model (json/xml)
|
||||
if (isset($body)) {
|
||||
$httpBody = $body; // $body is the method argument, if present
|
||||
}
|
||||
|
||||
// for HTTP post (form)
|
||||
if (strpos($headerParams['Content-Type'], "application/x-www-form-urlencoded") > -1) {
|
||||
$httpBody = http_build_query($formParams);
|
||||
}
|
||||
|
||||
// make the API Call
|
||||
$response = $this->apiClient->callAPI($resourcePath, $method,
|
||||
$queryParams, $httpBody,
|
||||
$headerParams);
|
||||
|
||||
if(! $response) {
|
||||
return null;
|
||||
}
|
||||
|
||||
$responseObject = $this->apiClient->deserialize($response,
|
||||
'Order');
|
||||
return $responseObject;
|
||||
}
|
||||
|
||||
/**
|
||||
* getOrderById
|
||||
*
|
||||
* Find purchase order by ID
|
||||
*
|
||||
* @param string $order_id ID of pet that needs to be fetched (required)
|
||||
* @return Order
|
||||
*/
|
||||
public function getOrderById($order_id) {
|
||||
|
||||
// parse inputs
|
||||
$resourcePath = "/store/order/{orderId}";
|
||||
$resourcePath = str_replace("{format}", "json", $resourcePath);
|
||||
$method = "GET";
|
||||
$httpBody = '';
|
||||
$queryParams = array();
|
||||
$headerParams = array();
|
||||
$formParams = array();
|
||||
$_header_accept = 'application/json, application/xml';
|
||||
if ($_header_accept !== '') {
|
||||
$headerParams['Accept'] = $_header_accept;
|
||||
}
|
||||
$_header_content_type = array();
|
||||
$headerParams['Content-Type'] = count($_header_content_type) > 0 ? $_header_content_type[0] : 'application/json';
|
||||
|
||||
|
||||
|
||||
// path params
|
||||
if($order_id !== null) {
|
||||
$resourcePath = str_replace("{" . "orderId" . "}",
|
||||
$this->apiClient->toPathValue($order_id), $resourcePath);
|
||||
}
|
||||
|
||||
|
||||
|
||||
// for model (json/xml)
|
||||
if (isset($body)) {
|
||||
$httpBody = $body; // $body is the method argument, if present
|
||||
}
|
||||
|
||||
// for HTTP post (form)
|
||||
if (strpos($headerParams['Content-Type'], "application/x-www-form-urlencoded") > -1) {
|
||||
$httpBody = http_build_query($formParams);
|
||||
}
|
||||
|
||||
// make the API Call
|
||||
$response = $this->apiClient->callAPI($resourcePath, $method,
|
||||
$queryParams, $httpBody,
|
||||
$headerParams);
|
||||
|
||||
if(! $response) {
|
||||
return null;
|
||||
}
|
||||
|
||||
$responseObject = $this->apiClient->deserialize($response,
|
||||
'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
|
||||
*/
|
||||
public function deleteOrder($order_id) {
|
||||
|
||||
// parse inputs
|
||||
$resourcePath = "/store/order/{orderId}";
|
||||
$resourcePath = str_replace("{format}", "json", $resourcePath);
|
||||
$method = "DELETE";
|
||||
$httpBody = '';
|
||||
$queryParams = array();
|
||||
$headerParams = array();
|
||||
$formParams = array();
|
||||
$_header_accept = 'application/json, application/xml';
|
||||
if ($_header_accept !== '') {
|
||||
$headerParams['Accept'] = $_header_accept;
|
||||
}
|
||||
$_header_content_type = array();
|
||||
$headerParams['Content-Type'] = count($_header_content_type) > 0 ? $_header_content_type[0] : 'application/json';
|
||||
|
||||
|
||||
|
||||
// path params
|
||||
if($order_id !== null) {
|
||||
$resourcePath = str_replace("{" . "orderId" . "}",
|
||||
$this->apiClient->toPathValue($order_id), $resourcePath);
|
||||
}
|
||||
|
||||
|
||||
|
||||
// for model (json/xml)
|
||||
if (isset($body)) {
|
||||
$httpBody = $body; // $body is the method argument, if present
|
||||
}
|
||||
|
||||
// for HTTP post (form)
|
||||
if (strpos($headerParams['Content-Type'], "application/x-www-form-urlencoded") > -1) {
|
||||
$httpBody = http_build_query($formParams);
|
||||
}
|
||||
|
||||
// make the API Call
|
||||
$response = $this->apiClient->callAPI($resourcePath, $method,
|
||||
$queryParams, $httpBody,
|
||||
$headerParams);
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
@ -1,472 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* Copyright 2015 Reverb Technologies, Inc.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
/**
|
||||
*
|
||||
* NOTE: This class is auto generated by the swagger code generator program. Do not edit the class manually.
|
||||
*/
|
||||
|
||||
namespace SwaggerPetstore;
|
||||
|
||||
class UserApi {
|
||||
|
||||
function __construct($apiClient) {
|
||||
$this->apiClient = $apiClient;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* createUser
|
||||
*
|
||||
* Create user
|
||||
*
|
||||
* @param User $body Created user object (required)
|
||||
* @return void
|
||||
*/
|
||||
public function createUser($body) {
|
||||
|
||||
// parse inputs
|
||||
$resourcePath = "/user";
|
||||
$resourcePath = str_replace("{format}", "json", $resourcePath);
|
||||
$method = "POST";
|
||||
$httpBody = '';
|
||||
$queryParams = array();
|
||||
$headerParams = array();
|
||||
$formParams = array();
|
||||
$_header_accept = 'application/json, application/xml';
|
||||
if ($_header_accept !== '') {
|
||||
$headerParams['Accept'] = $_header_accept;
|
||||
}
|
||||
$_header_content_type = array();
|
||||
$headerParams['Content-Type'] = count($_header_content_type) > 0 ? $_header_content_type[0] : 'application/json';
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// body params
|
||||
$body = null;
|
||||
if (isset($body)) {
|
||||
$body = $body;
|
||||
}
|
||||
|
||||
// for model (json/xml)
|
||||
if (isset($body)) {
|
||||
$httpBody = $body; // $body is the method argument, if present
|
||||
}
|
||||
|
||||
// for HTTP post (form)
|
||||
if (strpos($headerParams['Content-Type'], "application/x-www-form-urlencoded") > -1) {
|
||||
$httpBody = http_build_query($formParams);
|
||||
}
|
||||
|
||||
// make the API Call
|
||||
$response = $this->apiClient->callAPI($resourcePath, $method,
|
||||
$queryParams, $httpBody,
|
||||
$headerParams);
|
||||
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* createUsersWithArrayInput
|
||||
*
|
||||
* Creates list of users with given input array
|
||||
*
|
||||
* @param array[User] $body List of user object (required)
|
||||
* @return void
|
||||
*/
|
||||
public function createUsersWithArrayInput($body) {
|
||||
|
||||
// parse inputs
|
||||
$resourcePath = "/user/createWithArray";
|
||||
$resourcePath = str_replace("{format}", "json", $resourcePath);
|
||||
$method = "POST";
|
||||
$httpBody = '';
|
||||
$queryParams = array();
|
||||
$headerParams = array();
|
||||
$formParams = array();
|
||||
$_header_accept = 'application/json, application/xml';
|
||||
if ($_header_accept !== '') {
|
||||
$headerParams['Accept'] = $_header_accept;
|
||||
}
|
||||
$_header_content_type = array();
|
||||
$headerParams['Content-Type'] = count($_header_content_type) > 0 ? $_header_content_type[0] : 'application/json';
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// body params
|
||||
$body = null;
|
||||
if (isset($body)) {
|
||||
$body = $body;
|
||||
}
|
||||
|
||||
// for model (json/xml)
|
||||
if (isset($body)) {
|
||||
$httpBody = $body; // $body is the method argument, if present
|
||||
}
|
||||
|
||||
// for HTTP post (form)
|
||||
if (strpos($headerParams['Content-Type'], "application/x-www-form-urlencoded") > -1) {
|
||||
$httpBody = http_build_query($formParams);
|
||||
}
|
||||
|
||||
// make the API Call
|
||||
$response = $this->apiClient->callAPI($resourcePath, $method,
|
||||
$queryParams, $httpBody,
|
||||
$headerParams);
|
||||
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* createUsersWithListInput
|
||||
*
|
||||
* Creates list of users with given input array
|
||||
*
|
||||
* @param array[User] $body List of user object (required)
|
||||
* @return void
|
||||
*/
|
||||
public function createUsersWithListInput($body) {
|
||||
|
||||
// parse inputs
|
||||
$resourcePath = "/user/createWithList";
|
||||
$resourcePath = str_replace("{format}", "json", $resourcePath);
|
||||
$method = "POST";
|
||||
$httpBody = '';
|
||||
$queryParams = array();
|
||||
$headerParams = array();
|
||||
$formParams = array();
|
||||
$_header_accept = 'application/json, application/xml';
|
||||
if ($_header_accept !== '') {
|
||||
$headerParams['Accept'] = $_header_accept;
|
||||
}
|
||||
$_header_content_type = array();
|
||||
$headerParams['Content-Type'] = count($_header_content_type) > 0 ? $_header_content_type[0] : 'application/json';
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// body params
|
||||
$body = null;
|
||||
if (isset($body)) {
|
||||
$body = $body;
|
||||
}
|
||||
|
||||
// for model (json/xml)
|
||||
if (isset($body)) {
|
||||
$httpBody = $body; // $body is the method argument, if present
|
||||
}
|
||||
|
||||
// for HTTP post (form)
|
||||
if (strpos($headerParams['Content-Type'], "application/x-www-form-urlencoded") > -1) {
|
||||
$httpBody = http_build_query($formParams);
|
||||
}
|
||||
|
||||
// make the API Call
|
||||
$response = $this->apiClient->callAPI($resourcePath, $method,
|
||||
$queryParams, $httpBody,
|
||||
$headerParams);
|
||||
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* loginUser
|
||||
*
|
||||
* Logs user into the system
|
||||
*
|
||||
* @param string $username The user name for login (required)
|
||||
* @param string $password The password for login in clear text (required)
|
||||
* @return string
|
||||
*/
|
||||
public function loginUser($username, $password) {
|
||||
|
||||
// parse inputs
|
||||
$resourcePath = "/user/login";
|
||||
$resourcePath = str_replace("{format}", "json", $resourcePath);
|
||||
$method = "GET";
|
||||
$httpBody = '';
|
||||
$queryParams = array();
|
||||
$headerParams = array();
|
||||
$formParams = array();
|
||||
$_header_accept = 'application/json, application/xml';
|
||||
if ($_header_accept !== '') {
|
||||
$headerParams['Accept'] = $_header_accept;
|
||||
}
|
||||
$_header_content_type = array();
|
||||
$headerParams['Content-Type'] = count($_header_content_type) > 0 ? $_header_content_type[0] : 'application/json';
|
||||
|
||||
// query params
|
||||
if($username !== null) {
|
||||
$queryParams['username'] = $this->apiClient->toQueryValue($username);
|
||||
}// query params
|
||||
if($password !== null) {
|
||||
$queryParams['password'] = $this->apiClient->toQueryValue($password);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// for model (json/xml)
|
||||
if (isset($body)) {
|
||||
$httpBody = $body; // $body is the method argument, if present
|
||||
}
|
||||
|
||||
// for HTTP post (form)
|
||||
if (strpos($headerParams['Content-Type'], "application/x-www-form-urlencoded") > -1) {
|
||||
$httpBody = http_build_query($formParams);
|
||||
}
|
||||
|
||||
// make the API Call
|
||||
$response = $this->apiClient->callAPI($resourcePath, $method,
|
||||
$queryParams, $httpBody,
|
||||
$headerParams);
|
||||
|
||||
if(! $response) {
|
||||
return null;
|
||||
}
|
||||
|
||||
$responseObject = $this->apiClient->deserialize($response,
|
||||
'string');
|
||||
return $responseObject;
|
||||
}
|
||||
|
||||
/**
|
||||
* logoutUser
|
||||
*
|
||||
* Logs out current logged in user session
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function logoutUser() {
|
||||
|
||||
// parse inputs
|
||||
$resourcePath = "/user/logout";
|
||||
$resourcePath = str_replace("{format}", "json", $resourcePath);
|
||||
$method = "GET";
|
||||
$httpBody = '';
|
||||
$queryParams = array();
|
||||
$headerParams = array();
|
||||
$formParams = array();
|
||||
$_header_accept = 'application/json, application/xml';
|
||||
if ($_header_accept !== '') {
|
||||
$headerParams['Accept'] = $_header_accept;
|
||||
}
|
||||
$_header_content_type = array();
|
||||
$headerParams['Content-Type'] = count($_header_content_type) > 0 ? $_header_content_type[0] : 'application/json';
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// for model (json/xml)
|
||||
if (isset($body)) {
|
||||
$httpBody = $body; // $body is the method argument, if present
|
||||
}
|
||||
|
||||
// for HTTP post (form)
|
||||
if (strpos($headerParams['Content-Type'], "application/x-www-form-urlencoded") > -1) {
|
||||
$httpBody = http_build_query($formParams);
|
||||
}
|
||||
|
||||
// make the API Call
|
||||
$response = $this->apiClient->callAPI($resourcePath, $method,
|
||||
$queryParams, $httpBody,
|
||||
$headerParams);
|
||||
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* getUserByName
|
||||
*
|
||||
* Get user by user name
|
||||
*
|
||||
* @param string $username The name that needs to be fetched. Use user1 for testing. (required)
|
||||
* @return User
|
||||
*/
|
||||
public function getUserByName($username) {
|
||||
|
||||
// parse inputs
|
||||
$resourcePath = "/user/{username}";
|
||||
$resourcePath = str_replace("{format}", "json", $resourcePath);
|
||||
$method = "GET";
|
||||
$httpBody = '';
|
||||
$queryParams = array();
|
||||
$headerParams = array();
|
||||
$formParams = array();
|
||||
$_header_accept = 'application/json, application/xml';
|
||||
if ($_header_accept !== '') {
|
||||
$headerParams['Accept'] = $_header_accept;
|
||||
}
|
||||
$_header_content_type = array();
|
||||
$headerParams['Content-Type'] = count($_header_content_type) > 0 ? $_header_content_type[0] : 'application/json';
|
||||
|
||||
|
||||
|
||||
// path params
|
||||
if($username !== null) {
|
||||
$resourcePath = str_replace("{" . "username" . "}",
|
||||
$this->apiClient->toPathValue($username), $resourcePath);
|
||||
}
|
||||
|
||||
|
||||
|
||||
// for model (json/xml)
|
||||
if (isset($body)) {
|
||||
$httpBody = $body; // $body is the method argument, if present
|
||||
}
|
||||
|
||||
// for HTTP post (form)
|
||||
if (strpos($headerParams['Content-Type'], "application/x-www-form-urlencoded") > -1) {
|
||||
$httpBody = http_build_query($formParams);
|
||||
}
|
||||
|
||||
// make the API Call
|
||||
$response = $this->apiClient->callAPI($resourcePath, $method,
|
||||
$queryParams, $httpBody,
|
||||
$headerParams);
|
||||
|
||||
if(! $response) {
|
||||
return null;
|
||||
}
|
||||
|
||||
$responseObject = $this->apiClient->deserialize($response,
|
||||
'User');
|
||||
return $responseObject;
|
||||
}
|
||||
|
||||
/**
|
||||
* updateUser
|
||||
*
|
||||
* Updated user
|
||||
*
|
||||
* @param string $username name that need to be deleted (required)
|
||||
* @param User $body Updated user object (required)
|
||||
* @return void
|
||||
*/
|
||||
public function updateUser($username, $body) {
|
||||
|
||||
// parse inputs
|
||||
$resourcePath = "/user/{username}";
|
||||
$resourcePath = str_replace("{format}", "json", $resourcePath);
|
||||
$method = "PUT";
|
||||
$httpBody = '';
|
||||
$queryParams = array();
|
||||
$headerParams = array();
|
||||
$formParams = array();
|
||||
$_header_accept = 'application/json, application/xml';
|
||||
if ($_header_accept !== '') {
|
||||
$headerParams['Accept'] = $_header_accept;
|
||||
}
|
||||
$_header_content_type = array();
|
||||
$headerParams['Content-Type'] = count($_header_content_type) > 0 ? $_header_content_type[0] : 'application/json';
|
||||
|
||||
|
||||
|
||||
// path params
|
||||
if($username !== null) {
|
||||
$resourcePath = str_replace("{" . "username" . "}",
|
||||
$this->apiClient->toPathValue($username), $resourcePath);
|
||||
}
|
||||
|
||||
// body params
|
||||
$body = null;
|
||||
if (isset($body)) {
|
||||
$body = $body;
|
||||
}
|
||||
|
||||
// for model (json/xml)
|
||||
if (isset($body)) {
|
||||
$httpBody = $body; // $body is the method argument, if present
|
||||
}
|
||||
|
||||
// for HTTP post (form)
|
||||
if (strpos($headerParams['Content-Type'], "application/x-www-form-urlencoded") > -1) {
|
||||
$httpBody = http_build_query($formParams);
|
||||
}
|
||||
|
||||
// make the API Call
|
||||
$response = $this->apiClient->callAPI($resourcePath, $method,
|
||||
$queryParams, $httpBody,
|
||||
$headerParams);
|
||||
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* deleteUser
|
||||
*
|
||||
* Delete user
|
||||
*
|
||||
* @param string $username The name that needs to be deleted (required)
|
||||
* @return void
|
||||
*/
|
||||
public function deleteUser($username) {
|
||||
|
||||
// parse inputs
|
||||
$resourcePath = "/user/{username}";
|
||||
$resourcePath = str_replace("{format}", "json", $resourcePath);
|
||||
$method = "DELETE";
|
||||
$httpBody = '';
|
||||
$queryParams = array();
|
||||
$headerParams = array();
|
||||
$formParams = array();
|
||||
$_header_accept = 'application/json, application/xml';
|
||||
if ($_header_accept !== '') {
|
||||
$headerParams['Accept'] = $_header_accept;
|
||||
}
|
||||
$_header_content_type = array();
|
||||
$headerParams['Content-Type'] = count($_header_content_type) > 0 ? $_header_content_type[0] : 'application/json';
|
||||
|
||||
|
||||
|
||||
// path params
|
||||
if($username !== null) {
|
||||
$resourcePath = str_replace("{" . "username" . "}",
|
||||
$this->apiClient->toPathValue($username), $resourcePath);
|
||||
}
|
||||
|
||||
|
||||
|
||||
// for model (json/xml)
|
||||
if (isset($body)) {
|
||||
$httpBody = $body; // $body is the method argument, if present
|
||||
}
|
||||
|
||||
// for HTTP post (form)
|
||||
if (strpos($headerParams['Content-Type'], "application/x-www-form-urlencoded") > -1) {
|
||||
$httpBody = http_build_query($formParams);
|
||||
}
|
||||
|
||||
// make the API Call
|
||||
$response = $this->apiClient->callAPI($resourcePath, $method,
|
||||
$queryParams, $httpBody,
|
||||
$headerParams);
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
@ -1,64 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* Copyright 2015 Reverb Technologies, Inc.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
* NOTE: This class is auto generated by the swagger code generator program. Do not edit the class manually.
|
||||
*
|
||||
*/
|
||||
|
||||
namespace SwaggerPetstore\models;
|
||||
|
||||
use \ArrayAccess;
|
||||
|
||||
class Category implements ArrayAccess {
|
||||
static $swaggerTypes = array(
|
||||
'id' => 'int',
|
||||
'name' => 'string'
|
||||
);
|
||||
|
||||
static $attributeMap = array(
|
||||
'id' => 'id',
|
||||
'name' => 'name'
|
||||
);
|
||||
|
||||
|
||||
public $id; /* int */
|
||||
public $name; /* string */
|
||||
|
||||
public function __construct(array $data = null) {
|
||||
$this->id = $data["id"];
|
||||
$this->name = $data["name"];
|
||||
}
|
||||
|
||||
public function offsetExists($offset) {
|
||||
return isset($this->$offset);
|
||||
}
|
||||
|
||||
public function offsetGet($offset) {
|
||||
return $this->$offset;
|
||||
}
|
||||
|
||||
public function offsetSet($offset, $value) {
|
||||
$this->$offset = $value;
|
||||
}
|
||||
|
||||
public function offsetUnset($offset) {
|
||||
unset($this->$offset);
|
||||
}
|
||||
}
|
@ -1,83 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* Copyright 2015 Reverb Technologies, Inc.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
* NOTE: This class is auto generated by the swagger code generator program. Do not edit the class manually.
|
||||
*
|
||||
*/
|
||||
|
||||
namespace SwaggerPetstore\models;
|
||||
|
||||
use \ArrayAccess;
|
||||
|
||||
class Order implements ArrayAccess {
|
||||
static $swaggerTypes = array(
|
||||
'id' => 'int',
|
||||
'pet_id' => 'int',
|
||||
'quantity' => 'int',
|
||||
'ship_date' => 'DateTime',
|
||||
'status' => 'string',
|
||||
'complete' => 'boolean'
|
||||
);
|
||||
|
||||
static $attributeMap = array(
|
||||
'id' => 'id',
|
||||
'pet_id' => 'petId',
|
||||
'quantity' => 'quantity',
|
||||
'ship_date' => 'shipDate',
|
||||
'status' => 'status',
|
||||
'complete' => 'complete'
|
||||
);
|
||||
|
||||
|
||||
public $id; /* int */
|
||||
public $pet_id; /* int */
|
||||
public $quantity; /* int */
|
||||
public $ship_date; /* DateTime */
|
||||
/**
|
||||
* Order Status
|
||||
*/
|
||||
public $status; /* string */
|
||||
public $complete; /* boolean */
|
||||
|
||||
public function __construct(array $data = null) {
|
||||
$this->id = $data["id"];
|
||||
$this->pet_id = $data["pet_id"];
|
||||
$this->quantity = $data["quantity"];
|
||||
$this->ship_date = $data["ship_date"];
|
||||
$this->status = $data["status"];
|
||||
$this->complete = $data["complete"];
|
||||
}
|
||||
|
||||
public function offsetExists($offset) {
|
||||
return isset($this->$offset);
|
||||
}
|
||||
|
||||
public function offsetGet($offset) {
|
||||
return $this->$offset;
|
||||
}
|
||||
|
||||
public function offsetSet($offset, $value) {
|
||||
$this->$offset = $value;
|
||||
}
|
||||
|
||||
public function offsetUnset($offset) {
|
||||
unset($this->$offset);
|
||||
}
|
||||
}
|
@ -1,83 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* Copyright 2015 Reverb Technologies, Inc.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
* NOTE: This class is auto generated by the swagger code generator program. Do not edit the class manually.
|
||||
*
|
||||
*/
|
||||
|
||||
namespace SwaggerPetstore\models;
|
||||
|
||||
use \ArrayAccess;
|
||||
|
||||
class Pet implements ArrayAccess {
|
||||
static $swaggerTypes = array(
|
||||
'id' => 'int',
|
||||
'category' => 'Category',
|
||||
'name' => 'string',
|
||||
'photo_urls' => 'array[string]',
|
||||
'tags' => 'array[Tag]',
|
||||
'status' => 'string'
|
||||
);
|
||||
|
||||
static $attributeMap = array(
|
||||
'id' => 'id',
|
||||
'category' => 'category',
|
||||
'name' => 'name',
|
||||
'photo_urls' => 'photoUrls',
|
||||
'tags' => 'tags',
|
||||
'status' => 'status'
|
||||
);
|
||||
|
||||
|
||||
public $id; /* int */
|
||||
public $category; /* Category */
|
||||
public $name; /* string */
|
||||
public $photo_urls; /* array[string] */
|
||||
public $tags; /* array[Tag] */
|
||||
/**
|
||||
* pet status in the store
|
||||
*/
|
||||
public $status; /* string */
|
||||
|
||||
public function __construct(array $data = null) {
|
||||
$this->id = $data["id"];
|
||||
$this->category = $data["category"];
|
||||
$this->name = $data["name"];
|
||||
$this->photo_urls = $data["photo_urls"];
|
||||
$this->tags = $data["tags"];
|
||||
$this->status = $data["status"];
|
||||
}
|
||||
|
||||
public function offsetExists($offset) {
|
||||
return isset($this->$offset);
|
||||
}
|
||||
|
||||
public function offsetGet($offset) {
|
||||
return $this->$offset;
|
||||
}
|
||||
|
||||
public function offsetSet($offset, $value) {
|
||||
$this->$offset = $value;
|
||||
}
|
||||
|
||||
public function offsetUnset($offset) {
|
||||
unset($this->$offset);
|
||||
}
|
||||
}
|
@ -1,64 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* Copyright 2015 Reverb Technologies, Inc.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
* NOTE: This class is auto generated by the swagger code generator program. Do not edit the class manually.
|
||||
*
|
||||
*/
|
||||
|
||||
namespace SwaggerPetstore\models;
|
||||
|
||||
use \ArrayAccess;
|
||||
|
||||
class Tag implements ArrayAccess {
|
||||
static $swaggerTypes = array(
|
||||
'id' => 'int',
|
||||
'name' => 'string'
|
||||
);
|
||||
|
||||
static $attributeMap = array(
|
||||
'id' => 'id',
|
||||
'name' => 'name'
|
||||
);
|
||||
|
||||
|
||||
public $id; /* int */
|
||||
public $name; /* string */
|
||||
|
||||
public function __construct(array $data = null) {
|
||||
$this->id = $data["id"];
|
||||
$this->name = $data["name"];
|
||||
}
|
||||
|
||||
public function offsetExists($offset) {
|
||||
return isset($this->$offset);
|
||||
}
|
||||
|
||||
public function offsetGet($offset) {
|
||||
return $this->$offset;
|
||||
}
|
||||
|
||||
public function offsetSet($offset, $value) {
|
||||
$this->$offset = $value;
|
||||
}
|
||||
|
||||
public function offsetUnset($offset) {
|
||||
unset($this->$offset);
|
||||
}
|
||||
}
|
@ -1,91 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* Copyright 2015 Reverb Technologies, Inc.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
* NOTE: This class is auto generated by the swagger code generator program. Do not edit the class manually.
|
||||
*
|
||||
*/
|
||||
|
||||
namespace SwaggerPetstore\models;
|
||||
|
||||
use \ArrayAccess;
|
||||
|
||||
class User implements ArrayAccess {
|
||||
static $swaggerTypes = array(
|
||||
'id' => 'int',
|
||||
'username' => 'string',
|
||||
'first_name' => 'string',
|
||||
'last_name' => 'string',
|
||||
'email' => 'string',
|
||||
'password' => 'string',
|
||||
'phone' => 'string',
|
||||
'user_status' => 'int'
|
||||
);
|
||||
|
||||
static $attributeMap = array(
|
||||
'id' => 'id',
|
||||
'username' => 'username',
|
||||
'first_name' => 'firstName',
|
||||
'last_name' => 'lastName',
|
||||
'email' => 'email',
|
||||
'password' => 'password',
|
||||
'phone' => 'phone',
|
||||
'user_status' => 'userStatus'
|
||||
);
|
||||
|
||||
|
||||
public $id; /* int */
|
||||
public $username; /* string */
|
||||
public $first_name; /* string */
|
||||
public $last_name; /* string */
|
||||
public $email; /* string */
|
||||
public $password; /* string */
|
||||
public $phone; /* string */
|
||||
/**
|
||||
* User Status
|
||||
*/
|
||||
public $user_status; /* int */
|
||||
|
||||
public function __construct(array $data = null) {
|
||||
$this->id = $data["id"];
|
||||
$this->username = $data["username"];
|
||||
$this->first_name = $data["first_name"];
|
||||
$this->last_name = $data["last_name"];
|
||||
$this->email = $data["email"];
|
||||
$this->password = $data["password"];
|
||||
$this->phone = $data["phone"];
|
||||
$this->user_status = $data["user_status"];
|
||||
}
|
||||
|
||||
public function offsetExists($offset) {
|
||||
return isset($this->$offset);
|
||||
}
|
||||
|
||||
public function offsetGet($offset) {
|
||||
return $this->$offset;
|
||||
}
|
||||
|
||||
public function offsetSet($offset, $value) {
|
||||
$this->$offset = $value;
|
||||
}
|
||||
|
||||
public function offsetUnset($offset) {
|
||||
unset($this->$offset);
|
||||
}
|
||||
}
|
@ -1,19 +0,0 @@
|
||||
<?php
|
||||
|
||||
require_once('SwaggerPetstore.php');
|
||||
|
||||
class PetApiTest extends \PHPUnit_Framework_TestCase
|
||||
{
|
||||
public function testGetPetById()
|
||||
{
|
||||
// initialize the API client
|
||||
$api_client = new SwaggerPetstore\APIClient('http://petstore.swagger.io/v2');
|
||||
$petId = 5; // ID of pet that needs to be fetched
|
||||
$pet_api = new SwaggerPetstore\PetAPI($api_client);
|
||||
// return Pet (model)
|
||||
$response = $pet_api->getPetById($petId);
|
||||
$this->assertSame($response->id, $petId);
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
@ -1,52 +0,0 @@
|
||||
## Requirements
|
||||
|
||||
PHP 5.3.3 and later.
|
||||
|
||||
## Composer
|
||||
|
||||
You can install the bindings via [Composer](http://getcomposer.org/). Add this to your `composer.json`:
|
||||
|
||||
{
|
||||
"repositories": [
|
||||
{
|
||||
"type": "git",
|
||||
"url": "https://github.com/wing328/SwaggerPetstore-php.git"
|
||||
}
|
||||
],
|
||||
"require": {
|
||||
"SwaggerPetstore/SwaggerPetstore-php": "*@dev"
|
||||
}
|
||||
}
|
||||
|
||||
Then install via:
|
||||
|
||||
composer install
|
||||
|
||||
To use the bindings, use Composer's [autoload](https://getcomposer.org/doc/00-intro.md#autoloading):
|
||||
|
||||
require_once('vendor/autoload.php');
|
||||
|
||||
## Manual Installation
|
||||
|
||||
If you do not wish to use Composer, you can download the latest release. Then, to use the bindings, include the `SwaggerPetstore.php` file.
|
||||
|
||||
require_once('/path/to/SwaggerPetstore-php/SwaggerPetstore.php');
|
||||
|
||||
## Getting Started
|
||||
|
||||
php test.php
|
||||
|
||||
## Documentation
|
||||
|
||||
TODO
|
||||
|
||||
## Tests
|
||||
|
||||
In order to run tests first install [PHPUnit](http://packagist.org/packages/phpunit/phpunit) via [Composer](http://getcomposer.org/):
|
||||
|
||||
composer update
|
||||
|
||||
To run the test suite:
|
||||
|
||||
./vendor/bin/phpunit tests
|
||||
|
@ -1,16 +0,0 @@
|
||||
<?php
|
||||
// source code generated by http://restunited.com
|
||||
// for any feedback/issue, please send to feedback{at}restunited.com
|
||||
|
||||
// load models defined for endpoints
|
||||
foreach (glob(dirname(__FILE__)."/lib/models/*.php") as $filename)
|
||||
{
|
||||
require_once $filename;
|
||||
}
|
||||
|
||||
// load classes for accessing the endpoints
|
||||
foreach (glob(dirname(__FILE__)."/lib/*.php") as $filename)
|
||||
{
|
||||
require_once $filename;
|
||||
}
|
||||
?>
|
@ -1,32 +0,0 @@
|
||||
{
|
||||
"name": "SwaggerPetstore/SwaggerPetstore-php",
|
||||
"description": "",
|
||||
"keywords": [
|
||||
"swagger",
|
||||
"php",
|
||||
"sdk",
|
||||
"api"
|
||||
],
|
||||
"homepage": "http://swagger.io",
|
||||
"license": "Apache v2",
|
||||
"authors": [
|
||||
{
|
||||
"name": "Swagger and contributors",
|
||||
"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": { "SwaggerPetstore\\" : "lib/" }
|
||||
}
|
||||
}
|
@ -1,304 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* Copyright 2015 Reverb Technologies, Inc.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
namespace SwaggerPetstore;
|
||||
|
||||
class APIClient {
|
||||
|
||||
public static $PATCH = "PATCH";
|
||||
public static $POST = "POST";
|
||||
public static $GET = "GET";
|
||||
public static $PUT = "PUT";
|
||||
public static $DELETE = "DELETE";
|
||||
|
||||
/*
|
||||
* @var string timeout (second) of the HTTP request, by default set to 0, no timeout
|
||||
*/
|
||||
protected $curl_timeout = 0;
|
||||
|
||||
/*
|
||||
* @var string user agent of the HTTP request, set to "PHP-Swagger" by default
|
||||
*/
|
||||
protected $user_agent = "PHP-Swagger";
|
||||
|
||||
/**
|
||||
* @param string $host the address of the API server
|
||||
* @param string $headerName a header to pass on requests
|
||||
*/
|
||||
function __construct($host, $headerName = null, $headerValue = null) {
|
||||
$this->host = $host;
|
||||
$this->headerName = $headerName;
|
||||
$this->headerValue = $headerValue;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the user agent of the API client
|
||||
*
|
||||
* @param string $user_agent The user agent of the API client
|
||||
*/
|
||||
public function setUserAgent($user_agent) {
|
||||
if (!is_string($user_agent)) {
|
||||
throw new Exception('User-agent must be a string.');
|
||||
}
|
||||
$this->user_agent= $user_agent;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param integer $seconds Number of seconds before timing out [set to 0 for no timeout]
|
||||
*/
|
||||
public function setTimeout($seconds) {
|
||||
if (!is_numeric($seconds)) {
|
||||
throw new Exception('Timeout variable must be numeric.');
|
||||
}
|
||||
$this->curl_timeout = $seconds;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $resourcePath path to method endpoint
|
||||
* @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
|
||||
* @return mixed
|
||||
*/
|
||||
public function callAPI($resourcePath, $method, $queryParams, $postData,
|
||||
$headerParams) {
|
||||
|
||||
$headers = array();
|
||||
|
||||
# Allow API key from $headerParams to override default
|
||||
$added_api_key = False;
|
||||
if ($headerParams != null) {
|
||||
foreach ($headerParams as $key => $val) {
|
||||
$headers[] = "$key: $val";
|
||||
if ($key == $this->headerName) {
|
||||
$added_api_key = True;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (! $added_api_key && $this->headerName != null) {
|
||||
$headers[] = $this->headerName . ": " . $this->headerValue;
|
||||
}
|
||||
|
||||
if ((isset($headers['Content-Type']) and strpos($headers['Content-Type'], "multipart/form-data") < 0) and (is_object($postData) or is_array($postData))) {
|
||||
$postData = json_encode($this->sanitizeForSerialization($postData));
|
||||
}
|
||||
|
||||
$url = $this->host . $resourcePath;
|
||||
|
||||
$curl = curl_init();
|
||||
// set timeout, if needed
|
||||
if ($this->curl_timeout != 0) {
|
||||
curl_setopt($curl, CURLOPT_TIMEOUT, $this->curl_timeout);
|
||||
}
|
||||
// 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 Exception('Method ' . $method . ' is not recognized.');
|
||||
}
|
||||
curl_setopt($curl, CURLOPT_URL, $url);
|
||||
|
||||
// Set user agent
|
||||
curl_setopt($curl, CURLOPT_USERAGENT, $this->user_agent);
|
||||
|
||||
// Make the request
|
||||
$response = curl_exec($curl);
|
||||
$response_info = curl_getinfo($curl);
|
||||
|
||||
// Handle the response
|
||||
if ($response_info['http_code'] == 0) {
|
||||
throw new APIClientException("TIMEOUT: api call to " . $url .
|
||||
" took more than 5s to return", 0, $response_info, $response);
|
||||
} else if ($response_info['http_code'] >= 200 && $response_info['http_code'] <= 299 ) {
|
||||
$data = json_decode($response);
|
||||
if (json_last_error() > 0) { // if response is a string
|
||||
$data = $response;
|
||||
}
|
||||
} else if ($response_info['http_code'] == 401) {
|
||||
throw new APIClientException("Unauthorized API request to " . $url .
|
||||
": " . serialize($response), 0, $response_info, $response);
|
||||
} else if ($response_info['http_code'] == 404) {
|
||||
$data = null;
|
||||
} else {
|
||||
throw new APIClientException("Can't connect to the api: " . $url .
|
||||
" response code: " .
|
||||
$response_info['http_code'], 0, $response_info, $response);
|
||||
}
|
||||
return $data;
|
||||
}
|
||||
|
||||
/**
|
||||
* Build a JSON POST object
|
||||
*/
|
||||
protected function sanitizeForSerialization($data)
|
||||
{
|
||||
if (is_scalar($data) || null === $data) {
|
||||
$sanitized = $data;
|
||||
} else if ($data instanceof \DateTime) {
|
||||
$sanitized = $data->format(\DateTime::ISO8601);
|
||||
} else if (is_array($data)) {
|
||||
foreach ($data as $property => $value) {
|
||||
$data[$property] = $this->sanitizeForSerialization($value);
|
||||
}
|
||||
$sanitized = $data;
|
||||
} else if (is_object($data)) {
|
||||
$values = array();
|
||||
foreach (array_keys($data::$swaggerTypes) as $property) {
|
||||
$values[$data::$attributeMap[$property]] = $this->sanitizeForSerialization($data->$property);
|
||||
}
|
||||
$sanitized = $values;
|
||||
} else {
|
||||
$sanitized = (string)$data;
|
||||
}
|
||||
|
||||
return $sanitized;
|
||||
}
|
||||
|
||||
/**
|
||||
* Take value and turn it into a string suitable for inclusion in
|
||||
* the path, by url-encoding.
|
||||
* @param string $value a string which will be part of the path
|
||||
* @return string the serialized object
|
||||
*/
|
||||
public static function toPathValue($value) {
|
||||
return rawurlencode(self::toString($value));
|
||||
}
|
||||
|
||||
/**
|
||||
* Take value and turn it into a string suitable for inclusion in
|
||||
* the query, by imploding comma-separated if it's an object.
|
||||
* If it's a string, pass through unchanged. It will be url-encoded
|
||||
* later.
|
||||
* @param object $object an object to be serialized to a string
|
||||
* @return string the serialized object
|
||||
*/
|
||||
public static function toQueryValue($object) {
|
||||
if (is_array($object)) {
|
||||
return implode(',', $object);
|
||||
} else {
|
||||
return self::toString($object);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Take value and turn it into a string suitable for inclusion in
|
||||
* the header. If it's a string, pass through unchanged
|
||||
* If it's a datetime object, format it in ISO8601
|
||||
* @param string $value a string which will be part of the header
|
||||
* @return string the header string
|
||||
*/
|
||||
public static function toHeaderValue($value) {
|
||||
return self::toString($value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Take value and turn it into a string suitable for inclusion in
|
||||
* the http body (form parameter). If it's a string, pass through unchanged
|
||||
* If it's a datetime object, format it in ISO8601
|
||||
* @param string $value the value of the form parameter
|
||||
* @return string the form string
|
||||
*/
|
||||
public static function toFormValue($value) {
|
||||
return self::toString($value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Take value and turn it into a string suitable for inclusion in
|
||||
* the parameter. If it's a string, pass through unchanged
|
||||
* If it's a datetime object, format it in ISO8601
|
||||
* @param string $value the value of the parameter
|
||||
* @return string the header string
|
||||
*/
|
||||
public static function toString($value) {
|
||||
if ($value instanceof \DateTime) { // datetime in ISO8601 format
|
||||
return $value->format(\DateTime::ISO8601);
|
||||
}
|
||||
else {
|
||||
return $value;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Deserialize a JSON string into an object
|
||||
*
|
||||
* @param object $object object or primitive to be deserialized
|
||||
* @param string $class class name is passed as a string
|
||||
* @return object an instance of $class
|
||||
*/
|
||||
|
||||
public static function deserialize($data, $class)
|
||||
{
|
||||
if (null === $data) {
|
||||
$deserialized = null;
|
||||
} elseif (substr($class, 0, 4) == 'map[') {
|
||||
$inner = substr($class, 4, -1);
|
||||
$values = array();
|
||||
if(strrpos($inner, ",") !== false) {
|
||||
$subClass_array = explode(',', $inner, 2);
|
||||
$subClass = $subClass_array[1];
|
||||
foreach ($data as $key => $value) {
|
||||
$values[] = array($key => self::deserialize($value, $subClass));
|
||||
}
|
||||
}
|
||||
$deserialized = $values;
|
||||
} elseif (strcasecmp(substr($class, 0, 6),'array[') == 0) {
|
||||
$subClass = substr($class, 6, -1);
|
||||
$values = array();
|
||||
foreach ($data as $key => $value) {
|
||||
$values[] = self::deserialize($value, $subClass);
|
||||
}
|
||||
$deserialized = $values;
|
||||
} elseif ($class == 'DateTime') {
|
||||
$deserialized = new \DateTime($data);
|
||||
} elseif (in_array($class, array('string', 'int', 'float', 'double', 'bool'))) {
|
||||
settype($data, $class);
|
||||
$deserialized = $data;
|
||||
} else {
|
||||
$class = "SwaggerPetstore\\models\\".$class;
|
||||
$instance = new $class();
|
||||
foreach ($instance::$swaggerTypes as $property => $type) {
|
||||
if (isset($data->$property)) {
|
||||
$original_property_name = $instance::$attributeMap[$property];
|
||||
$instance->$property = self::deserialize($data->$original_property_name, $type);
|
||||
}
|
||||
}
|
||||
$deserialized = $instance;
|
||||
}
|
||||
|
||||
return $deserialized;
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -1,38 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* Copyright 2015 Reverb Technologies, Inc.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
namespace SwaggerPetstore;
|
||||
|
||||
use \Exception;
|
||||
|
||||
class APIClientException extends Exception {
|
||||
protected $response, $response_info;
|
||||
|
||||
public function __construct($message="", $code=0, $response_info=null, $response=null) {
|
||||
parent::__construct($message, $code);
|
||||
$this->response_info = $response_info;
|
||||
$this->response = $response;
|
||||
}
|
||||
|
||||
public function getResponse() {
|
||||
return $this->response;
|
||||
}
|
||||
|
||||
public function getResponseInfo() {
|
||||
return $this->response_info;
|
||||
}
|
||||
}
|
@ -1,493 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* Copyright 2015 Reverb Technologies, Inc.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
/**
|
||||
*
|
||||
* NOTE: This class is auto generated by the swagger code generator program. Do not edit the class manually.
|
||||
*/
|
||||
|
||||
namespace SwaggerPetstore;
|
||||
|
||||
class PetApi {
|
||||
|
||||
function __construct($apiClient) {
|
||||
$this->apiClient = $apiClient;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* updatePet
|
||||
*
|
||||
* Update an existing pet
|
||||
*
|
||||
* @param Pet $body Pet object that needs to be added to the store (required)
|
||||
* @return void
|
||||
*/
|
||||
public function updatePet($body) {
|
||||
|
||||
// parse inputs
|
||||
$resourcePath = "/pet";
|
||||
$resourcePath = str_replace("{format}", "json", $resourcePath);
|
||||
$method = "PUT";
|
||||
$httpBody = '';
|
||||
$queryParams = array();
|
||||
$headerParams = array();
|
||||
$formParams = array();
|
||||
$_header_accept = 'application/json, application/xml';
|
||||
if ($_header_accept !== '') {
|
||||
$headerParams['Accept'] = $_header_accept;
|
||||
}
|
||||
$_header_content_type = array('application/json','application/xml',);
|
||||
$headerParams['Content-Type'] = count($_header_content_type) > 0 ? $_header_content_type[0] : 'application/json';
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// body params
|
||||
$body = null;
|
||||
if (isset($body)) {
|
||||
$body = $body;
|
||||
}
|
||||
|
||||
// for model (json/xml)
|
||||
if (isset($body)) {
|
||||
$httpBody = $body; // $body is the method argument, if present
|
||||
}
|
||||
|
||||
// for HTTP post (form)
|
||||
if (strpos($headerParams['Content-Type'], "application/x-www-form-urlencoded") > -1) {
|
||||
$httpBody = http_build_query($formParams);
|
||||
}
|
||||
|
||||
// make the API Call
|
||||
$response = $this->apiClient->callAPI($resourcePath, $method,
|
||||
$queryParams, $httpBody,
|
||||
$headerParams);
|
||||
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* addPet
|
||||
*
|
||||
* Add a new pet to the store
|
||||
*
|
||||
* @param Pet $body Pet object that needs to be added to the store (required)
|
||||
* @return void
|
||||
*/
|
||||
public function addPet($body) {
|
||||
|
||||
// parse inputs
|
||||
$resourcePath = "/pet";
|
||||
$resourcePath = str_replace("{format}", "json", $resourcePath);
|
||||
$method = "POST";
|
||||
$httpBody = '';
|
||||
$queryParams = array();
|
||||
$headerParams = array();
|
||||
$formParams = array();
|
||||
$_header_accept = 'application/json, application/xml';
|
||||
if ($_header_accept !== '') {
|
||||
$headerParams['Accept'] = $_header_accept;
|
||||
}
|
||||
$_header_content_type = array('application/json','application/xml',);
|
||||
$headerParams['Content-Type'] = count($_header_content_type) > 0 ? $_header_content_type[0] : 'application/json';
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// body params
|
||||
$body = null;
|
||||
if (isset($body)) {
|
||||
$body = $body;
|
||||
}
|
||||
|
||||
// for model (json/xml)
|
||||
if (isset($body)) {
|
||||
$httpBody = $body; // $body is the method argument, if present
|
||||
}
|
||||
|
||||
// for HTTP post (form)
|
||||
if (strpos($headerParams['Content-Type'], "application/x-www-form-urlencoded") > -1) {
|
||||
$httpBody = http_build_query($formParams);
|
||||
}
|
||||
|
||||
// make the API Call
|
||||
$response = $this->apiClient->callAPI($resourcePath, $method,
|
||||
$queryParams, $httpBody,
|
||||
$headerParams);
|
||||
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* findPetsByStatus
|
||||
*
|
||||
* Finds Pets by status
|
||||
*
|
||||
* @param array[string] $status Status values that need to be considered for filter (required)
|
||||
* @return array[Pet]
|
||||
*/
|
||||
public function findPetsByStatus($status) {
|
||||
|
||||
// parse inputs
|
||||
$resourcePath = "/pet/findByStatus";
|
||||
$resourcePath = str_replace("{format}", "json", $resourcePath);
|
||||
$method = "GET";
|
||||
$httpBody = '';
|
||||
$queryParams = array();
|
||||
$headerParams = array();
|
||||
$formParams = array();
|
||||
$_header_accept = 'application/json, application/xml';
|
||||
if ($_header_accept !== '') {
|
||||
$headerParams['Accept'] = $_header_accept;
|
||||
}
|
||||
$_header_content_type = array();
|
||||
$headerParams['Content-Type'] = count($_header_content_type) > 0 ? $_header_content_type[0] : 'application/json';
|
||||
|
||||
// query params
|
||||
if($status !== null) {
|
||||
$queryParams['status'] = $this->apiClient->toQueryValue($status);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// for model (json/xml)
|
||||
if (isset($body)) {
|
||||
$httpBody = $body; // $body is the method argument, if present
|
||||
}
|
||||
|
||||
// for HTTP post (form)
|
||||
if (strpos($headerParams['Content-Type'], "application/x-www-form-urlencoded") > -1) {
|
||||
$httpBody = http_build_query($formParams);
|
||||
}
|
||||
|
||||
// make the API Call
|
||||
$response = $this->apiClient->callAPI($resourcePath, $method,
|
||||
$queryParams, $httpBody,
|
||||
$headerParams);
|
||||
|
||||
if(! $response) {
|
||||
return null;
|
||||
}
|
||||
|
||||
$responseObject = $this->apiClient->deserialize($response,
|
||||
'array[Pet]');
|
||||
return $responseObject;
|
||||
}
|
||||
|
||||
/**
|
||||
* findPetsByTags
|
||||
*
|
||||
* Finds Pets by tags
|
||||
*
|
||||
* @param array[string] $tags Tags to filter by (required)
|
||||
* @return array[Pet]
|
||||
*/
|
||||
public function findPetsByTags($tags) {
|
||||
|
||||
// parse inputs
|
||||
$resourcePath = "/pet/findByTags";
|
||||
$resourcePath = str_replace("{format}", "json", $resourcePath);
|
||||
$method = "GET";
|
||||
$httpBody = '';
|
||||
$queryParams = array();
|
||||
$headerParams = array();
|
||||
$formParams = array();
|
||||
$_header_accept = 'application/json, application/xml';
|
||||
if ($_header_accept !== '') {
|
||||
$headerParams['Accept'] = $_header_accept;
|
||||
}
|
||||
$_header_content_type = array();
|
||||
$headerParams['Content-Type'] = count($_header_content_type) > 0 ? $_header_content_type[0] : 'application/json';
|
||||
|
||||
// query params
|
||||
if($tags !== null) {
|
||||
$queryParams['tags'] = $this->apiClient->toQueryValue($tags);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// for model (json/xml)
|
||||
if (isset($body)) {
|
||||
$httpBody = $body; // $body is the method argument, if present
|
||||
}
|
||||
|
||||
// for HTTP post (form)
|
||||
if (strpos($headerParams['Content-Type'], "application/x-www-form-urlencoded") > -1) {
|
||||
$httpBody = http_build_query($formParams);
|
||||
}
|
||||
|
||||
// make the API Call
|
||||
$response = $this->apiClient->callAPI($resourcePath, $method,
|
||||
$queryParams, $httpBody,
|
||||
$headerParams);
|
||||
|
||||
if(! $response) {
|
||||
return null;
|
||||
}
|
||||
|
||||
$responseObject = $this->apiClient->deserialize($response,
|
||||
'array[Pet]');
|
||||
return $responseObject;
|
||||
}
|
||||
|
||||
/**
|
||||
* getPetById
|
||||
*
|
||||
* Find pet by ID
|
||||
*
|
||||
* @param int $pet_id ID of pet that needs to be fetched (required)
|
||||
* @return Pet
|
||||
*/
|
||||
public function getPetById($pet_id) {
|
||||
|
||||
// parse inputs
|
||||
$resourcePath = "/pet/{petId}";
|
||||
$resourcePath = str_replace("{format}", "json", $resourcePath);
|
||||
$method = "GET";
|
||||
$httpBody = '';
|
||||
$queryParams = array();
|
||||
$headerParams = array();
|
||||
$formParams = array();
|
||||
$_header_accept = 'application/json, application/xml';
|
||||
if ($_header_accept !== '') {
|
||||
$headerParams['Accept'] = $_header_accept;
|
||||
}
|
||||
$_header_content_type = array();
|
||||
$headerParams['Content-Type'] = count($_header_content_type) > 0 ? $_header_content_type[0] : 'application/json';
|
||||
|
||||
|
||||
|
||||
// path params
|
||||
if($pet_id !== null) {
|
||||
$resourcePath = str_replace("{" . "petId" . "}",
|
||||
$this->apiClient->toPathValue($pet_id), $resourcePath);
|
||||
}
|
||||
|
||||
|
||||
|
||||
// for model (json/xml)
|
||||
if (isset($body)) {
|
||||
$httpBody = $body; // $body is the method argument, if present
|
||||
}
|
||||
|
||||
// for HTTP post (form)
|
||||
if (strpos($headerParams['Content-Type'], "application/x-www-form-urlencoded") > -1) {
|
||||
$httpBody = http_build_query($formParams);
|
||||
}
|
||||
|
||||
// make the API Call
|
||||
$response = $this->apiClient->callAPI($resourcePath, $method,
|
||||
$queryParams, $httpBody,
|
||||
$headerParams);
|
||||
|
||||
if(! $response) {
|
||||
return null;
|
||||
}
|
||||
|
||||
$responseObject = $this->apiClient->deserialize($response,
|
||||
'Pet');
|
||||
return $responseObject;
|
||||
}
|
||||
|
||||
/**
|
||||
* updatePetWithForm
|
||||
*
|
||||
* Updates a pet in the store with form data
|
||||
*
|
||||
* @param string $pet_id ID of pet that needs to be updated (required)
|
||||
* @param string $name Updated name of the pet (required)
|
||||
* @param string $status Updated status of the pet (required)
|
||||
* @return void
|
||||
*/
|
||||
public function updatePetWithForm($pet_id, $name, $status) {
|
||||
|
||||
// parse inputs
|
||||
$resourcePath = "/pet/{petId}";
|
||||
$resourcePath = str_replace("{format}", "json", $resourcePath);
|
||||
$method = "POST";
|
||||
$httpBody = '';
|
||||
$queryParams = array();
|
||||
$headerParams = array();
|
||||
$formParams = array();
|
||||
$_header_accept = 'application/json, application/xml';
|
||||
if ($_header_accept !== '') {
|
||||
$headerParams['Accept'] = $_header_accept;
|
||||
}
|
||||
$_header_content_type = array('application/x-www-form-urlencoded',);
|
||||
$headerParams['Content-Type'] = count($_header_content_type) > 0 ? $_header_content_type[0] : 'application/json';
|
||||
|
||||
|
||||
|
||||
// path params
|
||||
if($pet_id !== null) {
|
||||
$resourcePath = str_replace("{" . "petId" . "}",
|
||||
$this->apiClient->toPathValue($pet_id), $resourcePath);
|
||||
}
|
||||
// form params
|
||||
if ($name !== null) {
|
||||
$formParams['name'] = $this->apiClient->toFormValue($name);
|
||||
}// form params
|
||||
if ($status !== null) {
|
||||
$formParams['status'] = $this->apiClient->toFormValue($status);
|
||||
}
|
||||
|
||||
|
||||
// for model (json/xml)
|
||||
if (isset($body)) {
|
||||
$httpBody = $body; // $body is the method argument, if present
|
||||
}
|
||||
|
||||
// for HTTP post (form)
|
||||
if (strpos($headerParams['Content-Type'], "application/x-www-form-urlencoded") > -1) {
|
||||
$httpBody = http_build_query($formParams);
|
||||
}
|
||||
|
||||
// make the API Call
|
||||
$response = $this->apiClient->callAPI($resourcePath, $method,
|
||||
$queryParams, $httpBody,
|
||||
$headerParams);
|
||||
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* deletePet
|
||||
*
|
||||
* Deletes a pet
|
||||
*
|
||||
* @param string $api_key (required)
|
||||
* @param int $pet_id Pet id to delete (required)
|
||||
* @return void
|
||||
*/
|
||||
public function deletePet($api_key, $pet_id) {
|
||||
|
||||
// parse inputs
|
||||
$resourcePath = "/pet/{petId}";
|
||||
$resourcePath = str_replace("{format}", "json", $resourcePath);
|
||||
$method = "DELETE";
|
||||
$httpBody = '';
|
||||
$queryParams = array();
|
||||
$headerParams = array();
|
||||
$formParams = array();
|
||||
$_header_accept = 'application/json, application/xml';
|
||||
if ($_header_accept !== '') {
|
||||
$headerParams['Accept'] = $_header_accept;
|
||||
}
|
||||
$_header_content_type = array();
|
||||
$headerParams['Content-Type'] = count($_header_content_type) > 0 ? $_header_content_type[0] : 'application/json';
|
||||
|
||||
|
||||
// header params
|
||||
if($api_key !== null) {
|
||||
$headerParams['api_key'] = $this->apiClient->toHeaderValue($api_key);
|
||||
}
|
||||
// path params
|
||||
if($pet_id !== null) {
|
||||
$resourcePath = str_replace("{" . "petId" . "}",
|
||||
$this->apiClient->toPathValue($pet_id), $resourcePath);
|
||||
}
|
||||
|
||||
|
||||
|
||||
// for model (json/xml)
|
||||
if (isset($body)) {
|
||||
$httpBody = $body; // $body is the method argument, if present
|
||||
}
|
||||
|
||||
// for HTTP post (form)
|
||||
if (strpos($headerParams['Content-Type'], "application/x-www-form-urlencoded") > -1) {
|
||||
$httpBody = http_build_query($formParams);
|
||||
}
|
||||
|
||||
// make the API Call
|
||||
$response = $this->apiClient->callAPI($resourcePath, $method,
|
||||
$queryParams, $httpBody,
|
||||
$headerParams);
|
||||
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* uploadFile
|
||||
*
|
||||
* uploads an image
|
||||
*
|
||||
* @param int $pet_id ID of pet to update (required)
|
||||
* @param string $additional_metadata Additional data to pass to server (required)
|
||||
* @param file $file file to upload (required)
|
||||
* @return void
|
||||
*/
|
||||
public function uploadFile($pet_id, $additional_metadata, $file) {
|
||||
|
||||
// parse inputs
|
||||
$resourcePath = "/pet/{petId}/uploadImage";
|
||||
$resourcePath = str_replace("{format}", "json", $resourcePath);
|
||||
$method = "POST";
|
||||
$httpBody = '';
|
||||
$queryParams = array();
|
||||
$headerParams = array();
|
||||
$formParams = array();
|
||||
$_header_accept = 'application/json, application/xml';
|
||||
if ($_header_accept !== '') {
|
||||
$headerParams['Accept'] = $_header_accept;
|
||||
}
|
||||
$_header_content_type = array('multipart/form-data',);
|
||||
$headerParams['Content-Type'] = count($_header_content_type) > 0 ? $_header_content_type[0] : 'application/json';
|
||||
|
||||
|
||||
|
||||
// path params
|
||||
if($pet_id !== null) {
|
||||
$resourcePath = str_replace("{" . "petId" . "}",
|
||||
$this->apiClient->toPathValue($pet_id), $resourcePath);
|
||||
}
|
||||
// form params
|
||||
if ($additional_metadata !== null) {
|
||||
$formParams['additionalMetadata'] = $this->apiClient->toFormValue($additional_metadata);
|
||||
}// form params
|
||||
if ($file !== null) {
|
||||
$formParams['file'] = '@' . $this->apiClient->toFormValue($file);
|
||||
}
|
||||
|
||||
|
||||
// for model (json/xml)
|
||||
if (isset($body)) {
|
||||
$httpBody = $body; // $body is the method argument, if present
|
||||
}
|
||||
|
||||
// for HTTP post (form)
|
||||
if (strpos($headerParams['Content-Type'], "application/x-www-form-urlencoded") > -1) {
|
||||
$httpBody = http_build_query($formParams);
|
||||
}
|
||||
|
||||
// make the API Call
|
||||
$response = $this->apiClient->callAPI($resourcePath, $method,
|
||||
$queryParams, $httpBody,
|
||||
$headerParams);
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
@ -1,258 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* Copyright 2015 Reverb Technologies, Inc.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
/**
|
||||
*
|
||||
* NOTE: This class is auto generated by the swagger code generator program. Do not edit the class manually.
|
||||
*/
|
||||
|
||||
namespace SwaggerPetstore;
|
||||
|
||||
class StoreApi {
|
||||
|
||||
function __construct($apiClient) {
|
||||
$this->apiClient = $apiClient;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* getInventory
|
||||
*
|
||||
* Returns pet inventories by status
|
||||
*
|
||||
* @return map[string,int]
|
||||
*/
|
||||
public function getInventory() {
|
||||
|
||||
// parse inputs
|
||||
$resourcePath = "/store/inventory";
|
||||
$resourcePath = str_replace("{format}", "json", $resourcePath);
|
||||
$method = "GET";
|
||||
$httpBody = '';
|
||||
$queryParams = array();
|
||||
$headerParams = array();
|
||||
$formParams = array();
|
||||
$_header_accept = 'application/json, application/xml';
|
||||
if ($_header_accept !== '') {
|
||||
$headerParams['Accept'] = $_header_accept;
|
||||
}
|
||||
$_header_content_type = array();
|
||||
$headerParams['Content-Type'] = count($_header_content_type) > 0 ? $_header_content_type[0] : 'application/json';
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// for model (json/xml)
|
||||
if (isset($body)) {
|
||||
$httpBody = $body; // $body is the method argument, if present
|
||||
}
|
||||
|
||||
// for HTTP post (form)
|
||||
if (strpos($headerParams['Content-Type'], "application/x-www-form-urlencoded") > -1) {
|
||||
$httpBody = http_build_query($formParams);
|
||||
}
|
||||
|
||||
// make the API Call
|
||||
$response = $this->apiClient->callAPI($resourcePath, $method,
|
||||
$queryParams, $httpBody,
|
||||
$headerParams);
|
||||
|
||||
if(! $response) {
|
||||
return null;
|
||||
}
|
||||
|
||||
$responseObject = $this->apiClient->deserialize($response,
|
||||
'map[string,int]');
|
||||
return $responseObject;
|
||||
}
|
||||
|
||||
/**
|
||||
* placeOrder
|
||||
*
|
||||
* Place an order for a pet
|
||||
*
|
||||
* @param Order $body order placed for purchasing the pet (required)
|
||||
* @return Order
|
||||
*/
|
||||
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 = 'application/json, application/xml';
|
||||
if ($_header_accept !== '') {
|
||||
$headerParams['Accept'] = $_header_accept;
|
||||
}
|
||||
$_header_content_type = array();
|
||||
$headerParams['Content-Type'] = count($_header_content_type) > 0 ? $_header_content_type[0] : 'application/json';
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// body params
|
||||
$body = null;
|
||||
if (isset($body)) {
|
||||
$body = $body;
|
||||
}
|
||||
|
||||
// for model (json/xml)
|
||||
if (isset($body)) {
|
||||
$httpBody = $body; // $body is the method argument, if present
|
||||
}
|
||||
|
||||
// for HTTP post (form)
|
||||
if (strpos($headerParams['Content-Type'], "application/x-www-form-urlencoded") > -1) {
|
||||
$httpBody = http_build_query($formParams);
|
||||
}
|
||||
|
||||
// make the API Call
|
||||
$response = $this->apiClient->callAPI($resourcePath, $method,
|
||||
$queryParams, $httpBody,
|
||||
$headerParams);
|
||||
|
||||
if(! $response) {
|
||||
return null;
|
||||
}
|
||||
|
||||
$responseObject = $this->apiClient->deserialize($response,
|
||||
'Order');
|
||||
return $responseObject;
|
||||
}
|
||||
|
||||
/**
|
||||
* getOrderById
|
||||
*
|
||||
* Find purchase order by ID
|
||||
*
|
||||
* @param string $order_id ID of pet that needs to be fetched (required)
|
||||
* @return Order
|
||||
*/
|
||||
public function getOrderById($order_id) {
|
||||
|
||||
// parse inputs
|
||||
$resourcePath = "/store/order/{orderId}";
|
||||
$resourcePath = str_replace("{format}", "json", $resourcePath);
|
||||
$method = "GET";
|
||||
$httpBody = '';
|
||||
$queryParams = array();
|
||||
$headerParams = array();
|
||||
$formParams = array();
|
||||
$_header_accept = 'application/json, application/xml';
|
||||
if ($_header_accept !== '') {
|
||||
$headerParams['Accept'] = $_header_accept;
|
||||
}
|
||||
$_header_content_type = array();
|
||||
$headerParams['Content-Type'] = count($_header_content_type) > 0 ? $_header_content_type[0] : 'application/json';
|
||||
|
||||
|
||||
|
||||
// path params
|
||||
if($order_id !== null) {
|
||||
$resourcePath = str_replace("{" . "orderId" . "}",
|
||||
$this->apiClient->toPathValue($order_id), $resourcePath);
|
||||
}
|
||||
|
||||
|
||||
|
||||
// for model (json/xml)
|
||||
if (isset($body)) {
|
||||
$httpBody = $body; // $body is the method argument, if present
|
||||
}
|
||||
|
||||
// for HTTP post (form)
|
||||
if (strpos($headerParams['Content-Type'], "application/x-www-form-urlencoded") > -1) {
|
||||
$httpBody = http_build_query($formParams);
|
||||
}
|
||||
|
||||
// make the API Call
|
||||
$response = $this->apiClient->callAPI($resourcePath, $method,
|
||||
$queryParams, $httpBody,
|
||||
$headerParams);
|
||||
|
||||
if(! $response) {
|
||||
return null;
|
||||
}
|
||||
|
||||
$responseObject = $this->apiClient->deserialize($response,
|
||||
'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
|
||||
*/
|
||||
public function deleteOrder($order_id) {
|
||||
|
||||
// parse inputs
|
||||
$resourcePath = "/store/order/{orderId}";
|
||||
$resourcePath = str_replace("{format}", "json", $resourcePath);
|
||||
$method = "DELETE";
|
||||
$httpBody = '';
|
||||
$queryParams = array();
|
||||
$headerParams = array();
|
||||
$formParams = array();
|
||||
$_header_accept = 'application/json, application/xml';
|
||||
if ($_header_accept !== '') {
|
||||
$headerParams['Accept'] = $_header_accept;
|
||||
}
|
||||
$_header_content_type = array();
|
||||
$headerParams['Content-Type'] = count($_header_content_type) > 0 ? $_header_content_type[0] : 'application/json';
|
||||
|
||||
|
||||
|
||||
// path params
|
||||
if($order_id !== null) {
|
||||
$resourcePath = str_replace("{" . "orderId" . "}",
|
||||
$this->apiClient->toPathValue($order_id), $resourcePath);
|
||||
}
|
||||
|
||||
|
||||
|
||||
// for model (json/xml)
|
||||
if (isset($body)) {
|
||||
$httpBody = $body; // $body is the method argument, if present
|
||||
}
|
||||
|
||||
// for HTTP post (form)
|
||||
if (strpos($headerParams['Content-Type'], "application/x-www-form-urlencoded") > -1) {
|
||||
$httpBody = http_build_query($formParams);
|
||||
}
|
||||
|
||||
// make the API Call
|
||||
$response = $this->apiClient->callAPI($resourcePath, $method,
|
||||
$queryParams, $httpBody,
|
||||
$headerParams);
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
@ -1,472 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* Copyright 2015 Reverb Technologies, Inc.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
/**
|
||||
*
|
||||
* NOTE: This class is auto generated by the swagger code generator program. Do not edit the class manually.
|
||||
*/
|
||||
|
||||
namespace SwaggerPetstore;
|
||||
|
||||
class UserApi {
|
||||
|
||||
function __construct($apiClient) {
|
||||
$this->apiClient = $apiClient;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* createUser
|
||||
*
|
||||
* Create user
|
||||
*
|
||||
* @param User $body Created user object (required)
|
||||
* @return void
|
||||
*/
|
||||
public function createUser($body) {
|
||||
|
||||
// parse inputs
|
||||
$resourcePath = "/user";
|
||||
$resourcePath = str_replace("{format}", "json", $resourcePath);
|
||||
$method = "POST";
|
||||
$httpBody = '';
|
||||
$queryParams = array();
|
||||
$headerParams = array();
|
||||
$formParams = array();
|
||||
$_header_accept = 'application/json, application/xml';
|
||||
if ($_header_accept !== '') {
|
||||
$headerParams['Accept'] = $_header_accept;
|
||||
}
|
||||
$_header_content_type = array();
|
||||
$headerParams['Content-Type'] = count($_header_content_type) > 0 ? $_header_content_type[0] : 'application/json';
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// body params
|
||||
$body = null;
|
||||
if (isset($body)) {
|
||||
$body = $body;
|
||||
}
|
||||
|
||||
// for model (json/xml)
|
||||
if (isset($body)) {
|
||||
$httpBody = $body; // $body is the method argument, if present
|
||||
}
|
||||
|
||||
// for HTTP post (form)
|
||||
if (strpos($headerParams['Content-Type'], "application/x-www-form-urlencoded") > -1) {
|
||||
$httpBody = http_build_query($formParams);
|
||||
}
|
||||
|
||||
// make the API Call
|
||||
$response = $this->apiClient->callAPI($resourcePath, $method,
|
||||
$queryParams, $httpBody,
|
||||
$headerParams);
|
||||
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* createUsersWithArrayInput
|
||||
*
|
||||
* Creates list of users with given input array
|
||||
*
|
||||
* @param array[User] $body List of user object (required)
|
||||
* @return void
|
||||
*/
|
||||
public function createUsersWithArrayInput($body) {
|
||||
|
||||
// parse inputs
|
||||
$resourcePath = "/user/createWithArray";
|
||||
$resourcePath = str_replace("{format}", "json", $resourcePath);
|
||||
$method = "POST";
|
||||
$httpBody = '';
|
||||
$queryParams = array();
|
||||
$headerParams = array();
|
||||
$formParams = array();
|
||||
$_header_accept = 'application/json, application/xml';
|
||||
if ($_header_accept !== '') {
|
||||
$headerParams['Accept'] = $_header_accept;
|
||||
}
|
||||
$_header_content_type = array();
|
||||
$headerParams['Content-Type'] = count($_header_content_type) > 0 ? $_header_content_type[0] : 'application/json';
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// body params
|
||||
$body = null;
|
||||
if (isset($body)) {
|
||||
$body = $body;
|
||||
}
|
||||
|
||||
// for model (json/xml)
|
||||
if (isset($body)) {
|
||||
$httpBody = $body; // $body is the method argument, if present
|
||||
}
|
||||
|
||||
// for HTTP post (form)
|
||||
if (strpos($headerParams['Content-Type'], "application/x-www-form-urlencoded") > -1) {
|
||||
$httpBody = http_build_query($formParams);
|
||||
}
|
||||
|
||||
// make the API Call
|
||||
$response = $this->apiClient->callAPI($resourcePath, $method,
|
||||
$queryParams, $httpBody,
|
||||
$headerParams);
|
||||
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* createUsersWithListInput
|
||||
*
|
||||
* Creates list of users with given input array
|
||||
*
|
||||
* @param array[User] $body List of user object (required)
|
||||
* @return void
|
||||
*/
|
||||
public function createUsersWithListInput($body) {
|
||||
|
||||
// parse inputs
|
||||
$resourcePath = "/user/createWithList";
|
||||
$resourcePath = str_replace("{format}", "json", $resourcePath);
|
||||
$method = "POST";
|
||||
$httpBody = '';
|
||||
$queryParams = array();
|
||||
$headerParams = array();
|
||||
$formParams = array();
|
||||
$_header_accept = 'application/json, application/xml';
|
||||
if ($_header_accept !== '') {
|
||||
$headerParams['Accept'] = $_header_accept;
|
||||
}
|
||||
$_header_content_type = array();
|
||||
$headerParams['Content-Type'] = count($_header_content_type) > 0 ? $_header_content_type[0] : 'application/json';
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// body params
|
||||
$body = null;
|
||||
if (isset($body)) {
|
||||
$body = $body;
|
||||
}
|
||||
|
||||
// for model (json/xml)
|
||||
if (isset($body)) {
|
||||
$httpBody = $body; // $body is the method argument, if present
|
||||
}
|
||||
|
||||
// for HTTP post (form)
|
||||
if (strpos($headerParams['Content-Type'], "application/x-www-form-urlencoded") > -1) {
|
||||
$httpBody = http_build_query($formParams);
|
||||
}
|
||||
|
||||
// make the API Call
|
||||
$response = $this->apiClient->callAPI($resourcePath, $method,
|
||||
$queryParams, $httpBody,
|
||||
$headerParams);
|
||||
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* loginUser
|
||||
*
|
||||
* Logs user into the system
|
||||
*
|
||||
* @param string $username The user name for login (required)
|
||||
* @param string $password The password for login in clear text (required)
|
||||
* @return string
|
||||
*/
|
||||
public function loginUser($username, $password) {
|
||||
|
||||
// parse inputs
|
||||
$resourcePath = "/user/login";
|
||||
$resourcePath = str_replace("{format}", "json", $resourcePath);
|
||||
$method = "GET";
|
||||
$httpBody = '';
|
||||
$queryParams = array();
|
||||
$headerParams = array();
|
||||
$formParams = array();
|
||||
$_header_accept = 'application/json, application/xml';
|
||||
if ($_header_accept !== '') {
|
||||
$headerParams['Accept'] = $_header_accept;
|
||||
}
|
||||
$_header_content_type = array();
|
||||
$headerParams['Content-Type'] = count($_header_content_type) > 0 ? $_header_content_type[0] : 'application/json';
|
||||
|
||||
// query params
|
||||
if($username !== null) {
|
||||
$queryParams['username'] = $this->apiClient->toQueryValue($username);
|
||||
}// query params
|
||||
if($password !== null) {
|
||||
$queryParams['password'] = $this->apiClient->toQueryValue($password);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// for model (json/xml)
|
||||
if (isset($body)) {
|
||||
$httpBody = $body; // $body is the method argument, if present
|
||||
}
|
||||
|
||||
// for HTTP post (form)
|
||||
if (strpos($headerParams['Content-Type'], "application/x-www-form-urlencoded") > -1) {
|
||||
$httpBody = http_build_query($formParams);
|
||||
}
|
||||
|
||||
// make the API Call
|
||||
$response = $this->apiClient->callAPI($resourcePath, $method,
|
||||
$queryParams, $httpBody,
|
||||
$headerParams);
|
||||
|
||||
if(! $response) {
|
||||
return null;
|
||||
}
|
||||
|
||||
$responseObject = $this->apiClient->deserialize($response,
|
||||
'string');
|
||||
return $responseObject;
|
||||
}
|
||||
|
||||
/**
|
||||
* logoutUser
|
||||
*
|
||||
* Logs out current logged in user session
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function logoutUser() {
|
||||
|
||||
// parse inputs
|
||||
$resourcePath = "/user/logout";
|
||||
$resourcePath = str_replace("{format}", "json", $resourcePath);
|
||||
$method = "GET";
|
||||
$httpBody = '';
|
||||
$queryParams = array();
|
||||
$headerParams = array();
|
||||
$formParams = array();
|
||||
$_header_accept = 'application/json, application/xml';
|
||||
if ($_header_accept !== '') {
|
||||
$headerParams['Accept'] = $_header_accept;
|
||||
}
|
||||
$_header_content_type = array();
|
||||
$headerParams['Content-Type'] = count($_header_content_type) > 0 ? $_header_content_type[0] : 'application/json';
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// for model (json/xml)
|
||||
if (isset($body)) {
|
||||
$httpBody = $body; // $body is the method argument, if present
|
||||
}
|
||||
|
||||
// for HTTP post (form)
|
||||
if (strpos($headerParams['Content-Type'], "application/x-www-form-urlencoded") > -1) {
|
||||
$httpBody = http_build_query($formParams);
|
||||
}
|
||||
|
||||
// make the API Call
|
||||
$response = $this->apiClient->callAPI($resourcePath, $method,
|
||||
$queryParams, $httpBody,
|
||||
$headerParams);
|
||||
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* getUserByName
|
||||
*
|
||||
* Get user by user name
|
||||
*
|
||||
* @param string $username The name that needs to be fetched. Use user1 for testing. (required)
|
||||
* @return User
|
||||
*/
|
||||
public function getUserByName($username) {
|
||||
|
||||
// parse inputs
|
||||
$resourcePath = "/user/{username}";
|
||||
$resourcePath = str_replace("{format}", "json", $resourcePath);
|
||||
$method = "GET";
|
||||
$httpBody = '';
|
||||
$queryParams = array();
|
||||
$headerParams = array();
|
||||
$formParams = array();
|
||||
$_header_accept = 'application/json, application/xml';
|
||||
if ($_header_accept !== '') {
|
||||
$headerParams['Accept'] = $_header_accept;
|
||||
}
|
||||
$_header_content_type = array();
|
||||
$headerParams['Content-Type'] = count($_header_content_type) > 0 ? $_header_content_type[0] : 'application/json';
|
||||
|
||||
|
||||
|
||||
// path params
|
||||
if($username !== null) {
|
||||
$resourcePath = str_replace("{" . "username" . "}",
|
||||
$this->apiClient->toPathValue($username), $resourcePath);
|
||||
}
|
||||
|
||||
|
||||
|
||||
// for model (json/xml)
|
||||
if (isset($body)) {
|
||||
$httpBody = $body; // $body is the method argument, if present
|
||||
}
|
||||
|
||||
// for HTTP post (form)
|
||||
if (strpos($headerParams['Content-Type'], "application/x-www-form-urlencoded") > -1) {
|
||||
$httpBody = http_build_query($formParams);
|
||||
}
|
||||
|
||||
// make the API Call
|
||||
$response = $this->apiClient->callAPI($resourcePath, $method,
|
||||
$queryParams, $httpBody,
|
||||
$headerParams);
|
||||
|
||||
if(! $response) {
|
||||
return null;
|
||||
}
|
||||
|
||||
$responseObject = $this->apiClient->deserialize($response,
|
||||
'User');
|
||||
return $responseObject;
|
||||
}
|
||||
|
||||
/**
|
||||
* updateUser
|
||||
*
|
||||
* Updated user
|
||||
*
|
||||
* @param string $username name that need to be deleted (required)
|
||||
* @param User $body Updated user object (required)
|
||||
* @return void
|
||||
*/
|
||||
public function updateUser($username, $body) {
|
||||
|
||||
// parse inputs
|
||||
$resourcePath = "/user/{username}";
|
||||
$resourcePath = str_replace("{format}", "json", $resourcePath);
|
||||
$method = "PUT";
|
||||
$httpBody = '';
|
||||
$queryParams = array();
|
||||
$headerParams = array();
|
||||
$formParams = array();
|
||||
$_header_accept = 'application/json, application/xml';
|
||||
if ($_header_accept !== '') {
|
||||
$headerParams['Accept'] = $_header_accept;
|
||||
}
|
||||
$_header_content_type = array();
|
||||
$headerParams['Content-Type'] = count($_header_content_type) > 0 ? $_header_content_type[0] : 'application/json';
|
||||
|
||||
|
||||
|
||||
// path params
|
||||
if($username !== null) {
|
||||
$resourcePath = str_replace("{" . "username" . "}",
|
||||
$this->apiClient->toPathValue($username), $resourcePath);
|
||||
}
|
||||
|
||||
// body params
|
||||
$body = null;
|
||||
if (isset($body)) {
|
||||
$body = $body;
|
||||
}
|
||||
|
||||
// for model (json/xml)
|
||||
if (isset($body)) {
|
||||
$httpBody = $body; // $body is the method argument, if present
|
||||
}
|
||||
|
||||
// for HTTP post (form)
|
||||
if (strpos($headerParams['Content-Type'], "application/x-www-form-urlencoded") > -1) {
|
||||
$httpBody = http_build_query($formParams);
|
||||
}
|
||||
|
||||
// make the API Call
|
||||
$response = $this->apiClient->callAPI($resourcePath, $method,
|
||||
$queryParams, $httpBody,
|
||||
$headerParams);
|
||||
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* deleteUser
|
||||
*
|
||||
* Delete user
|
||||
*
|
||||
* @param string $username The name that needs to be deleted (required)
|
||||
* @return void
|
||||
*/
|
||||
public function deleteUser($username) {
|
||||
|
||||
// parse inputs
|
||||
$resourcePath = "/user/{username}";
|
||||
$resourcePath = str_replace("{format}", "json", $resourcePath);
|
||||
$method = "DELETE";
|
||||
$httpBody = '';
|
||||
$queryParams = array();
|
||||
$headerParams = array();
|
||||
$formParams = array();
|
||||
$_header_accept = 'application/json, application/xml';
|
||||
if ($_header_accept !== '') {
|
||||
$headerParams['Accept'] = $_header_accept;
|
||||
}
|
||||
$_header_content_type = array();
|
||||
$headerParams['Content-Type'] = count($_header_content_type) > 0 ? $_header_content_type[0] : 'application/json';
|
||||
|
||||
|
||||
|
||||
// path params
|
||||
if($username !== null) {
|
||||
$resourcePath = str_replace("{" . "username" . "}",
|
||||
$this->apiClient->toPathValue($username), $resourcePath);
|
||||
}
|
||||
|
||||
|
||||
|
||||
// for model (json/xml)
|
||||
if (isset($body)) {
|
||||
$httpBody = $body; // $body is the method argument, if present
|
||||
}
|
||||
|
||||
// for HTTP post (form)
|
||||
if (strpos($headerParams['Content-Type'], "application/x-www-form-urlencoded") > -1) {
|
||||
$httpBody = http_build_query($formParams);
|
||||
}
|
||||
|
||||
// make the API Call
|
||||
$response = $this->apiClient->callAPI($resourcePath, $method,
|
||||
$queryParams, $httpBody,
|
||||
$headerParams);
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
@ -1,64 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* Copyright 2015 Reverb Technologies, Inc.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
* NOTE: This class is auto generated by the swagger code generator program. Do not edit the class manually.
|
||||
*
|
||||
*/
|
||||
|
||||
namespace SwaggerPetstore\models;
|
||||
|
||||
use \ArrayAccess;
|
||||
|
||||
class Category implements ArrayAccess {
|
||||
static $swaggerTypes = array(
|
||||
'id' => 'int',
|
||||
'name' => 'string'
|
||||
);
|
||||
|
||||
static $attributeMap = array(
|
||||
'id' => 'id',
|
||||
'name' => 'name'
|
||||
);
|
||||
|
||||
|
||||
public $id; /* int */
|
||||
public $name; /* string */
|
||||
|
||||
public function __construct(array $data = null) {
|
||||
$this->id = $data["id"];
|
||||
$this->name = $data["name"];
|
||||
}
|
||||
|
||||
public function offsetExists($offset) {
|
||||
return isset($this->$offset);
|
||||
}
|
||||
|
||||
public function offsetGet($offset) {
|
||||
return $this->$offset;
|
||||
}
|
||||
|
||||
public function offsetSet($offset, $value) {
|
||||
$this->$offset = $value;
|
||||
}
|
||||
|
||||
public function offsetUnset($offset) {
|
||||
unset($this->$offset);
|
||||
}
|
||||
}
|
@ -1,83 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* Copyright 2015 Reverb Technologies, Inc.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
* NOTE: This class is auto generated by the swagger code generator program. Do not edit the class manually.
|
||||
*
|
||||
*/
|
||||
|
||||
namespace SwaggerPetstore\models;
|
||||
|
||||
use \ArrayAccess;
|
||||
|
||||
class Order implements ArrayAccess {
|
||||
static $swaggerTypes = array(
|
||||
'id' => 'int',
|
||||
'pet_id' => 'int',
|
||||
'quantity' => 'int',
|
||||
'ship_date' => 'DateTime',
|
||||
'status' => 'string',
|
||||
'complete' => 'boolean'
|
||||
);
|
||||
|
||||
static $attributeMap = array(
|
||||
'id' => 'id',
|
||||
'pet_id' => 'petId',
|
||||
'quantity' => 'quantity',
|
||||
'ship_date' => 'shipDate',
|
||||
'status' => 'status',
|
||||
'complete' => 'complete'
|
||||
);
|
||||
|
||||
|
||||
public $id; /* int */
|
||||
public $pet_id; /* int */
|
||||
public $quantity; /* int */
|
||||
public $ship_date; /* DateTime */
|
||||
/**
|
||||
* Order Status
|
||||
*/
|
||||
public $status; /* string */
|
||||
public $complete; /* boolean */
|
||||
|
||||
public function __construct(array $data = null) {
|
||||
$this->id = $data["id"];
|
||||
$this->pet_id = $data["pet_id"];
|
||||
$this->quantity = $data["quantity"];
|
||||
$this->ship_date = $data["ship_date"];
|
||||
$this->status = $data["status"];
|
||||
$this->complete = $data["complete"];
|
||||
}
|
||||
|
||||
public function offsetExists($offset) {
|
||||
return isset($this->$offset);
|
||||
}
|
||||
|
||||
public function offsetGet($offset) {
|
||||
return $this->$offset;
|
||||
}
|
||||
|
||||
public function offsetSet($offset, $value) {
|
||||
$this->$offset = $value;
|
||||
}
|
||||
|
||||
public function offsetUnset($offset) {
|
||||
unset($this->$offset);
|
||||
}
|
||||
}
|
@ -1,83 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* Copyright 2015 Reverb Technologies, Inc.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
* NOTE: This class is auto generated by the swagger code generator program. Do not edit the class manually.
|
||||
*
|
||||
*/
|
||||
|
||||
namespace SwaggerPetstore\models;
|
||||
|
||||
use \ArrayAccess;
|
||||
|
||||
class Pet implements ArrayAccess {
|
||||
static $swaggerTypes = array(
|
||||
'id' => 'int',
|
||||
'category' => 'Category',
|
||||
'name' => 'string',
|
||||
'photo_urls' => 'array[string]',
|
||||
'tags' => 'array[Tag]',
|
||||
'status' => 'string'
|
||||
);
|
||||
|
||||
static $attributeMap = array(
|
||||
'id' => 'id',
|
||||
'category' => 'category',
|
||||
'name' => 'name',
|
||||
'photo_urls' => 'photoUrls',
|
||||
'tags' => 'tags',
|
||||
'status' => 'status'
|
||||
);
|
||||
|
||||
|
||||
public $id; /* int */
|
||||
public $category; /* Category */
|
||||
public $name; /* string */
|
||||
public $photo_urls; /* array[string] */
|
||||
public $tags; /* array[Tag] */
|
||||
/**
|
||||
* pet status in the store
|
||||
*/
|
||||
public $status; /* string */
|
||||
|
||||
public function __construct(array $data = null) {
|
||||
$this->id = $data["id"];
|
||||
$this->category = $data["category"];
|
||||
$this->name = $data["name"];
|
||||
$this->photo_urls = $data["photo_urls"];
|
||||
$this->tags = $data["tags"];
|
||||
$this->status = $data["status"];
|
||||
}
|
||||
|
||||
public function offsetExists($offset) {
|
||||
return isset($this->$offset);
|
||||
}
|
||||
|
||||
public function offsetGet($offset) {
|
||||
return $this->$offset;
|
||||
}
|
||||
|
||||
public function offsetSet($offset, $value) {
|
||||
$this->$offset = $value;
|
||||
}
|
||||
|
||||
public function offsetUnset($offset) {
|
||||
unset($this->$offset);
|
||||
}
|
||||
}
|
@ -1,64 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* Copyright 2015 Reverb Technologies, Inc.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
* NOTE: This class is auto generated by the swagger code generator program. Do not edit the class manually.
|
||||
*
|
||||
*/
|
||||
|
||||
namespace SwaggerPetstore\models;
|
||||
|
||||
use \ArrayAccess;
|
||||
|
||||
class Tag implements ArrayAccess {
|
||||
static $swaggerTypes = array(
|
||||
'id' => 'int',
|
||||
'name' => 'string'
|
||||
);
|
||||
|
||||
static $attributeMap = array(
|
||||
'id' => 'id',
|
||||
'name' => 'name'
|
||||
);
|
||||
|
||||
|
||||
public $id; /* int */
|
||||
public $name; /* string */
|
||||
|
||||
public function __construct(array $data = null) {
|
||||
$this->id = $data["id"];
|
||||
$this->name = $data["name"];
|
||||
}
|
||||
|
||||
public function offsetExists($offset) {
|
||||
return isset($this->$offset);
|
||||
}
|
||||
|
||||
public function offsetGet($offset) {
|
||||
return $this->$offset;
|
||||
}
|
||||
|
||||
public function offsetSet($offset, $value) {
|
||||
$this->$offset = $value;
|
||||
}
|
||||
|
||||
public function offsetUnset($offset) {
|
||||
unset($this->$offset);
|
||||
}
|
||||
}
|
@ -1,91 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* Copyright 2015 Reverb Technologies, Inc.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
* NOTE: This class is auto generated by the swagger code generator program. Do not edit the class manually.
|
||||
*
|
||||
*/
|
||||
|
||||
namespace SwaggerPetstore\models;
|
||||
|
||||
use \ArrayAccess;
|
||||
|
||||
class User implements ArrayAccess {
|
||||
static $swaggerTypes = array(
|
||||
'id' => 'int',
|
||||
'username' => 'string',
|
||||
'first_name' => 'string',
|
||||
'last_name' => 'string',
|
||||
'email' => 'string',
|
||||
'password' => 'string',
|
||||
'phone' => 'string',
|
||||
'user_status' => 'int'
|
||||
);
|
||||
|
||||
static $attributeMap = array(
|
||||
'id' => 'id',
|
||||
'username' => 'username',
|
||||
'first_name' => 'firstName',
|
||||
'last_name' => 'lastName',
|
||||
'email' => 'email',
|
||||
'password' => 'password',
|
||||
'phone' => 'phone',
|
||||
'user_status' => 'userStatus'
|
||||
);
|
||||
|
||||
|
||||
public $id; /* int */
|
||||
public $username; /* string */
|
||||
public $first_name; /* string */
|
||||
public $last_name; /* string */
|
||||
public $email; /* string */
|
||||
public $password; /* string */
|
||||
public $phone; /* string */
|
||||
/**
|
||||
* User Status
|
||||
*/
|
||||
public $user_status; /* int */
|
||||
|
||||
public function __construct(array $data = null) {
|
||||
$this->id = $data["id"];
|
||||
$this->username = $data["username"];
|
||||
$this->first_name = $data["first_name"];
|
||||
$this->last_name = $data["last_name"];
|
||||
$this->email = $data["email"];
|
||||
$this->password = $data["password"];
|
||||
$this->phone = $data["phone"];
|
||||
$this->user_status = $data["user_status"];
|
||||
}
|
||||
|
||||
public function offsetExists($offset) {
|
||||
return isset($this->$offset);
|
||||
}
|
||||
|
||||
public function offsetGet($offset) {
|
||||
return $this->$offset;
|
||||
}
|
||||
|
||||
public function offsetSet($offset, $value) {
|
||||
$this->$offset = $value;
|
||||
}
|
||||
|
||||
public function offsetUnset($offset) {
|
||||
unset($this->$offset);
|
||||
}
|
||||
}
|
@ -1,19 +0,0 @@
|
||||
<?php
|
||||
|
||||
require_once('SwaggerPetstore.php');
|
||||
|
||||
class PetApiTest extends \PHPUnit_Framework_TestCase
|
||||
{
|
||||
public function testGetPetById()
|
||||
{
|
||||
// initialize the API client
|
||||
$api_client = new SwaggerPetstore\APIClient('http://petstore.swagger.io/v2');
|
||||
$petId = 5; // ID of pet that needs to be fetched
|
||||
$pet_api = new SwaggerPetstore\PetAPI($api_client);
|
||||
// return Pet (model)
|
||||
$response = $pet_api->getPetById($petId);
|
||||
$this->assertSame($response->id, $petId);
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
@ -1,12 +1,12 @@
|
||||
<?php
|
||||
//require_once('vendor/autoload.php');
|
||||
require_once('SwaggerPetstore-php/SwaggerPetstore.php');
|
||||
require_once('SwaggerClient-php/SwaggerClient.php');
|
||||
|
||||
// initialize the API client
|
||||
$api_client = new SwaggerPetstore\APIClient('http://petstore.swagger.io/v2');
|
||||
$petId = 5; // ID of pet that needs to be fetched
|
||||
$api_client = new SwaggerClient\APIClient('http://petstore.swagger.io/v2');
|
||||
$petId = 10005; // ID of pet that needs to be fetched
|
||||
try {
|
||||
$pet_api = new SwaggerPetstore\PetAPI($api_client);
|
||||
$pet_api = new SwaggerClient\PetAPI($api_client);
|
||||
// return Pet (model)
|
||||
$response = $pet_api->getPetById($petId);
|
||||
var_dump($response);
|
||||
|
Loading…
x
Reference in New Issue
Block a user