forked from loafle/openapi-generator-original
rebuilt client
This commit is contained in:
parent
1556bf16a9
commit
ffe5353987
@ -1,29 +0,0 @@
|
||||
/**
|
||||
* Copyright 2014 Wordnik, 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.
|
||||
*/
|
||||
|
||||
import com.wordnik.swagger.codegen.BasicPHPGenerator
|
||||
|
||||
import java.io.File
|
||||
|
||||
object PHPPetstoreCodegen extends BasicPHPGenerator {
|
||||
def main(args: Array[String]) = generateClient(args)
|
||||
|
||||
override def destinationDir = "samples/client/petstore/php"
|
||||
|
||||
override def supportingFiles = List(
|
||||
("Swagger.mustache", destinationDir + File.separator + apiPackage.get, "Swagger.php")
|
||||
)
|
||||
}
|
@ -1,6 +1,6 @@
|
||||
<?php
|
||||
/**
|
||||
* Copyright 2014 Reverb Technologies, Inc.
|
||||
* 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.
|
||||
@ -25,330 +25,397 @@ class PetApi {
|
||||
$this->apiClient = $apiClient;
|
||||
}
|
||||
|
||||
/**
|
||||
* getPetById
|
||||
* Find pet by ID
|
||||
* petId, int: ID of pet that needs to be fetched (required)
|
||||
|
||||
* @return Pet
|
||||
*/
|
||||
|
||||
public function getPetById($petId) {
|
||||
|
||||
//parse inputs
|
||||
$resourcePath = "/pet/{petId}";
|
||||
$resourcePath = str_replace("{format}", "json", $resourcePath);
|
||||
$method = "GET";
|
||||
$queryParams = array();
|
||||
$headerParams = array();
|
||||
$headerParams['Accept'] = 'application/json';
|
||||
$headerParams['Content-Type'] = 'application/json';
|
||||
|
||||
if($petId != null) {
|
||||
$resourcePath = str_replace("{" . "petId" . "}",
|
||||
$this->apiClient->toPathValue($petId), $resourcePath);
|
||||
}
|
||||
//make the API Call
|
||||
if (! isset($body)) {
|
||||
$body = null;
|
||||
}
|
||||
$response = $this->apiClient->callAPI($resourcePath, $method,
|
||||
$queryParams, $body,
|
||||
$headerParams);
|
||||
|
||||
|
||||
if(! $response){
|
||||
return null;
|
||||
}
|
||||
|
||||
$responseObject = $this->apiClient->deserialize($response,
|
||||
'Pet');
|
||||
return $responseObject;
|
||||
|
||||
}
|
||||
/**
|
||||
* deletePet
|
||||
* Deletes a pet
|
||||
* petId, string: Pet id to delete (required)
|
||||
|
||||
* @return
|
||||
*/
|
||||
|
||||
public function deletePet($petId) {
|
||||
|
||||
//parse inputs
|
||||
$resourcePath = "/pet/{petId}";
|
||||
$resourcePath = str_replace("{format}", "json", $resourcePath);
|
||||
$method = "DELETE";
|
||||
$queryParams = array();
|
||||
$headerParams = array();
|
||||
$headerParams['Accept'] = 'application/json';
|
||||
$headerParams['Content-Type'] = 'application/json';
|
||||
|
||||
if($petId != null) {
|
||||
$resourcePath = str_replace("{" . "petId" . "}",
|
||||
$this->apiClient->toPathValue($petId), $resourcePath);
|
||||
}
|
||||
//make the API Call
|
||||
if (! isset($body)) {
|
||||
$body = null;
|
||||
}
|
||||
$response = $this->apiClient->callAPI($resourcePath, $method,
|
||||
$queryParams, $body,
|
||||
$headerParams);
|
||||
|
||||
|
||||
}
|
||||
/**
|
||||
* partialUpdate
|
||||
* partial updates to a pet
|
||||
* petId, string: ID of pet that needs to be fetched (required)
|
||||
|
||||
* body, Pet: Pet object that needs to be added to the store (required)
|
||||
|
||||
* @return Array[Pet]
|
||||
*/
|
||||
|
||||
public function partialUpdate($petId, $body) {
|
||||
|
||||
//parse inputs
|
||||
$resourcePath = "/pet/{petId}";
|
||||
$resourcePath = str_replace("{format}", "json", $resourcePath);
|
||||
$method = "PATCH";
|
||||
$queryParams = array();
|
||||
$headerParams = array();
|
||||
$headerParams['Accept'] = 'application/json,application/xml';
|
||||
$headerParams['Content-Type'] = 'application/json,application/xml';
|
||||
|
||||
if($petId != null) {
|
||||
$resourcePath = str_replace("{" . "petId" . "}",
|
||||
$this->apiClient->toPathValue($petId), $resourcePath);
|
||||
}
|
||||
//make the API Call
|
||||
if (! isset($body)) {
|
||||
$body = null;
|
||||
}
|
||||
$response = $this->apiClient->callAPI($resourcePath, $method,
|
||||
$queryParams, $body,
|
||||
$headerParams);
|
||||
|
||||
|
||||
if(! $response){
|
||||
return null;
|
||||
}
|
||||
|
||||
$responseObject = $this->apiClient->deserialize($response,
|
||||
'Array[Pet]');
|
||||
return $responseObject;
|
||||
|
||||
}
|
||||
/**
|
||||
* updatePetWithForm
|
||||
* Updates a pet in the store with form data
|
||||
* petId, string: ID of pet that needs to be updated (required)
|
||||
|
||||
* name, string: Updated name of the pet (optional)
|
||||
|
||||
* status, string: Updated status of the pet (optional)
|
||||
|
||||
* @return
|
||||
*/
|
||||
|
||||
public function updatePetWithForm($petId, $name=null, $status=null) {
|
||||
|
||||
//parse inputs
|
||||
$resourcePath = "/pet/{petId}";
|
||||
$resourcePath = str_replace("{format}", "json", $resourcePath);
|
||||
$method = "POST";
|
||||
$queryParams = array();
|
||||
$headerParams = array();
|
||||
$headerParams['Accept'] = 'application/json';
|
||||
$headerParams['Content-Type'] = 'application/x-www-form-urlencoded';
|
||||
|
||||
if($petId != null) {
|
||||
$resourcePath = str_replace("{" . "petId" . "}",
|
||||
$this->apiClient->toPathValue($petId), $resourcePath);
|
||||
}
|
||||
//make the API Call
|
||||
if (! isset($body)) {
|
||||
$body = null;
|
||||
}
|
||||
$response = $this->apiClient->callAPI($resourcePath, $method,
|
||||
$queryParams, $body,
|
||||
$headerParams);
|
||||
|
||||
|
||||
}
|
||||
/**
|
||||
* uploadFile
|
||||
* uploads an image
|
||||
* additionalMetadata, string: Additional data to pass to server (optional)
|
||||
|
||||
* body, File: file to upload (optional)
|
||||
|
||||
* @return
|
||||
*/
|
||||
|
||||
public function uploadFile($additionalMetadata=null, $body=null) {
|
||||
|
||||
//parse inputs
|
||||
$resourcePath = "/pet/uploadImage";
|
||||
$resourcePath = str_replace("{format}", "json", $resourcePath);
|
||||
$method = "POST";
|
||||
$queryParams = array();
|
||||
$headerParams = array();
|
||||
$headerParams['Accept'] = 'application/json';
|
||||
$headerParams['Content-Type'] = 'multipart/form-data';
|
||||
|
||||
//make the API Call
|
||||
if (! isset($body)) {
|
||||
$body = null;
|
||||
}
|
||||
$response = $this->apiClient->callAPI($resourcePath, $method,
|
||||
$queryParams, $body,
|
||||
$headerParams);
|
||||
|
||||
|
||||
}
|
||||
/**
|
||||
* addPet
|
||||
* Add a new pet to the store
|
||||
* body, Pet: Pet object that needs to be added to the store (required)
|
||||
|
||||
* @return
|
||||
*/
|
||||
|
||||
public function addPet($body) {
|
||||
|
||||
//parse inputs
|
||||
$resourcePath = "/pet";
|
||||
$resourcePath = str_replace("{format}", "json", $resourcePath);
|
||||
$method = "POST";
|
||||
$queryParams = array();
|
||||
$headerParams = array();
|
||||
$headerParams['Accept'] = 'application/json';
|
||||
$headerParams['Content-Type'] = 'application/json,application/xml';
|
||||
|
||||
//make the API Call
|
||||
if (! isset($body)) {
|
||||
$body = null;
|
||||
}
|
||||
$response = $this->apiClient->callAPI($resourcePath, $method,
|
||||
$queryParams, $body,
|
||||
$headerParams);
|
||||
|
||||
|
||||
}
|
||||
/**
|
||||
|
||||
/**
|
||||
* updatePet
|
||||
*
|
||||
* Update an existing pet
|
||||
* body, Pet: Pet object that needs to be updated in the store (required)
|
||||
|
||||
* @return
|
||||
* body, Pet: Pet object that needs to be added to the store (required)
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
|
||||
public function updatePet($body) {
|
||||
|
||||
//parse inputs
|
||||
// parse inputs
|
||||
$resourcePath = "/pet";
|
||||
$resourcePath = str_replace("{format}", "json", $resourcePath);
|
||||
$method = "PUT";
|
||||
$queryParams = array();
|
||||
$headerParams = array();
|
||||
$headerParams['Accept'] = 'application/json';
|
||||
$headerParams['Content-Type'] = 'application/json';
|
||||
$formParams = array();
|
||||
$headerParams['Accept'] = 'application/json,application/xml';
|
||||
$headerParams['Content-Type'] = 'application/json,application/xml';
|
||||
|
||||
//make the API Call
|
||||
if (! isset($body)) {
|
||||
$body = null;
|
||||
|
||||
|
||||
|
||||
|
||||
// body params
|
||||
$body = null;
|
||||
if (isset($body)) {
|
||||
$body = $body;
|
||||
}
|
||||
|
||||
$body = $body ?: $formParams;
|
||||
|
||||
if (strpos($headerParams['Content-Type'], "application/x-www-form-urlencoded") > -1) {
|
||||
$body = http_build_query($body);
|
||||
}
|
||||
|
||||
// make the API Call
|
||||
$response = $this->apiClient->callAPI($resourcePath, $method,
|
||||
$queryParams, $body,
|
||||
$headerParams);
|
||||
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* addPet
|
||||
*
|
||||
* Add a new pet to the store
|
||||
* body, Pet: Pet object that needs to be added to the store (required)
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
|
||||
public function addPet($body) {
|
||||
|
||||
// parse inputs
|
||||
$resourcePath = "/pet";
|
||||
$resourcePath = str_replace("{format}", "json", $resourcePath);
|
||||
$method = "POST";
|
||||
$queryParams = array();
|
||||
$headerParams = array();
|
||||
$formParams = array();
|
||||
$headerParams['Accept'] = 'application/json,application/xml';
|
||||
$headerParams['Content-Type'] = 'application/json,application/xml';
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// body params
|
||||
$body = null;
|
||||
if (isset($body)) {
|
||||
$body = $body;
|
||||
}
|
||||
/**
|
||||
* findPetsByStatus
|
||||
* Finds Pets by status
|
||||
* status, string: Status values that need to be considered for filter (required)
|
||||
|
||||
* @return Array[Pet]
|
||||
$body = $body ?: $formParams;
|
||||
|
||||
if (strpos($headerParams['Content-Type'], "application/x-www-form-urlencoded") > -1) {
|
||||
$body = http_build_query($body);
|
||||
}
|
||||
|
||||
// make the API Call
|
||||
$response = $this->apiClient->callAPI($resourcePath, $method,
|
||||
$queryParams, $body,
|
||||
$headerParams);
|
||||
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* findPetsByStatus
|
||||
*
|
||||
* Finds Pets by status
|
||||
* status, array[string]: Status values that need to be considered for filter (required)
|
||||
*
|
||||
* @return array[Pet]
|
||||
*/
|
||||
|
||||
public function findPetsByStatus($status) {
|
||||
|
||||
//parse inputs
|
||||
// parse inputs
|
||||
$resourcePath = "/pet/findByStatus";
|
||||
$resourcePath = str_replace("{format}", "json", $resourcePath);
|
||||
$method = "GET";
|
||||
$queryParams = array();
|
||||
$headerParams = array();
|
||||
$headerParams['Accept'] = 'application/json';
|
||||
$headerParams['Content-Type'] = 'application/json';
|
||||
$formParams = array();
|
||||
$headerParams['Accept'] = 'application/json,application/xml';
|
||||
$headerParams['Content-Type'] = '';
|
||||
|
||||
// query params
|
||||
if($status != null) {
|
||||
$queryParams['status'] = $this->apiClient->toQueryValue($status);
|
||||
}
|
||||
//make the API Call
|
||||
if (! isset($body)) {
|
||||
$body = null;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
$body = $body ?: $formParams;
|
||||
|
||||
if (strpos($headerParams['Content-Type'], "application/x-www-form-urlencoded") > -1) {
|
||||
$body = http_build_query($body);
|
||||
}
|
||||
|
||||
// make the API Call
|
||||
$response = $this->apiClient->callAPI($resourcePath, $method,
|
||||
$queryParams, $body,
|
||||
$headerParams);
|
||||
|
||||
|
||||
if(! $response){
|
||||
return null;
|
||||
}
|
||||
if(! $response) {
|
||||
return null;
|
||||
}
|
||||
|
||||
$responseObject = $this->apiClient->deserialize($response,
|
||||
'Array[Pet]');
|
||||
'array[Pet]');
|
||||
return $responseObject;
|
||||
|
||||
}
|
||||
/**
|
||||
}
|
||||
|
||||
/**
|
||||
* findPetsByTags
|
||||
*
|
||||
* Finds Pets by tags
|
||||
* tags, string: Tags to filter by (required)
|
||||
|
||||
* @return Array[Pet]
|
||||
* tags, array[string]: Tags to filter by (required)
|
||||
*
|
||||
* @return array[Pet]
|
||||
*/
|
||||
|
||||
public function findPetsByTags($tags) {
|
||||
|
||||
//parse inputs
|
||||
// parse inputs
|
||||
$resourcePath = "/pet/findByTags";
|
||||
$resourcePath = str_replace("{format}", "json", $resourcePath);
|
||||
$method = "GET";
|
||||
$queryParams = array();
|
||||
$headerParams = array();
|
||||
$headerParams['Accept'] = 'application/json';
|
||||
$headerParams['Content-Type'] = 'application/json';
|
||||
$formParams = array();
|
||||
$headerParams['Accept'] = 'application/json,application/xml';
|
||||
$headerParams['Content-Type'] = '';
|
||||
|
||||
// query params
|
||||
if($tags != null) {
|
||||
$queryParams['tags'] = $this->apiClient->toQueryValue($tags);
|
||||
}
|
||||
//make the API Call
|
||||
if (! isset($body)) {
|
||||
$body = null;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
$body = $body ?: $formParams;
|
||||
|
||||
if (strpos($headerParams['Content-Type'], "application/x-www-form-urlencoded") > -1) {
|
||||
$body = http_build_query($body);
|
||||
}
|
||||
|
||||
// make the API Call
|
||||
$response = $this->apiClient->callAPI($resourcePath, $method,
|
||||
$queryParams, $body,
|
||||
$headerParams);
|
||||
|
||||
|
||||
if(! $response){
|
||||
return null;
|
||||
}
|
||||
if(! $response) {
|
||||
return null;
|
||||
}
|
||||
|
||||
$responseObject = $this->apiClient->deserialize($response,
|
||||
'Array[Pet]');
|
||||
'array[Pet]');
|
||||
return $responseObject;
|
||||
}
|
||||
|
||||
/**
|
||||
* getPetById
|
||||
*
|
||||
* Find pet by ID
|
||||
* petId, int: ID of pet that needs to be fetched (required)
|
||||
*
|
||||
* @return Pet
|
||||
*/
|
||||
|
||||
public function getPetById($petId) {
|
||||
|
||||
// parse inputs
|
||||
$resourcePath = "/pet/{petId}";
|
||||
$resourcePath = str_replace("{format}", "json", $resourcePath);
|
||||
$method = "GET";
|
||||
$queryParams = array();
|
||||
$headerParams = array();
|
||||
$formParams = array();
|
||||
$headerParams['Accept'] = 'application/json,application/xml';
|
||||
$headerParams['Content-Type'] = '';
|
||||
|
||||
|
||||
|
||||
// path params
|
||||
if($petId != null) {
|
||||
$resourcePath = str_replace("{" . "petId" . "}",
|
||||
$this->apiClient->toPathValue($petId), $resourcePath);
|
||||
}
|
||||
|
||||
|
||||
|
||||
$body = $body ?: $formParams;
|
||||
|
||||
if (strpos($headerParams['Content-Type'], "application/x-www-form-urlencoded") > -1) {
|
||||
$body = http_build_query($body);
|
||||
}
|
||||
|
||||
// make the API Call
|
||||
$response = $this->apiClient->callAPI($resourcePath, $method,
|
||||
$queryParams, $body,
|
||||
$headerParams);
|
||||
|
||||
if(! $response) {
|
||||
return null;
|
||||
}
|
||||
|
||||
$responseObject = $this->apiClient->deserialize($response,
|
||||
'Pet');
|
||||
return $responseObject;
|
||||
}
|
||||
|
||||
/**
|
||||
* updatePetWithForm
|
||||
*
|
||||
* Updates a pet in the store with form data
|
||||
* petId, string: ID of pet that needs to be updated (required)
|
||||
* * name, string: Updated name of the pet (required)
|
||||
* * status, string: Updated status of the pet (required)
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
|
||||
public function updatePetWithForm($petId, $name, $status) {
|
||||
|
||||
// parse inputs
|
||||
$resourcePath = "/pet/{petId}";
|
||||
$resourcePath = str_replace("{format}", "json", $resourcePath);
|
||||
$method = "POST";
|
||||
$queryParams = array();
|
||||
$headerParams = array();
|
||||
$formParams = array();
|
||||
$headerParams['Accept'] = 'application/json,application/xml';
|
||||
$headerParams['Content-Type'] = 'application/x-www-form-urlencoded';
|
||||
|
||||
|
||||
|
||||
// path params
|
||||
if($petId != null) {
|
||||
$resourcePath = str_replace("{" . "petId" . "}",
|
||||
$this->apiClient->toPathValue($petId), $resourcePath);
|
||||
}
|
||||
|
||||
if ($name != null) {
|
||||
$formParams[name] = $name;
|
||||
}
|
||||
if ($status != null) {
|
||||
$formParams[status] = $status;
|
||||
}
|
||||
|
||||
|
||||
$body = $body ?: $formParams;
|
||||
|
||||
if (strpos($headerParams['Content-Type'], "application/x-www-form-urlencoded") > -1) {
|
||||
$body = http_build_query($body);
|
||||
}
|
||||
|
||||
// make the API Call
|
||||
$response = $this->apiClient->callAPI($resourcePath, $method,
|
||||
$queryParams, $body,
|
||||
$headerParams);
|
||||
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* deletePet
|
||||
*
|
||||
* Deletes a pet
|
||||
* api_key, string: (required)
|
||||
* * petId, int: Pet id to delete (required)
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
|
||||
public function deletePet($api_key, $petId) {
|
||||
|
||||
// parse inputs
|
||||
$resourcePath = "/pet/{petId}";
|
||||
$resourcePath = str_replace("{format}", "json", $resourcePath);
|
||||
$method = "DELETE";
|
||||
$queryParams = array();
|
||||
$headerParams = array();
|
||||
$formParams = array();
|
||||
$headerParams['Accept'] = 'application/json,application/xml';
|
||||
$headerParams['Content-Type'] = '';
|
||||
|
||||
|
||||
// header params
|
||||
if($api_key != null) {
|
||||
$headerParams['api_key'] = $this->apiClient->toHeaderValue($api_key);
|
||||
}
|
||||
// path params
|
||||
if($petId != null) {
|
||||
$resourcePath = str_replace("{" . "petId" . "}",
|
||||
$this->apiClient->toPathValue($petId), $resourcePath);
|
||||
}
|
||||
|
||||
|
||||
|
||||
$body = $body ?: $formParams;
|
||||
|
||||
if (strpos($headerParams['Content-Type'], "application/x-www-form-urlencoded") > -1) {
|
||||
$body = http_build_query($body);
|
||||
}
|
||||
|
||||
// make the API Call
|
||||
$response = $this->apiClient->callAPI($resourcePath, $method,
|
||||
$queryParams, $body,
|
||||
$headerParams);
|
||||
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* uploadFile
|
||||
*
|
||||
* uploads an image
|
||||
* additionalMetadata, string: Additional data to pass to server (required)
|
||||
* * file, file: file to upload (required)
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
|
||||
public function uploadFile($additionalMetadata, $file) {
|
||||
|
||||
// parse inputs
|
||||
$resourcePath = "/pet/{petId}/uploadImage";
|
||||
$resourcePath = str_replace("{format}", "json", $resourcePath);
|
||||
$method = "POST";
|
||||
$queryParams = array();
|
||||
$headerParams = array();
|
||||
$formParams = array();
|
||||
$headerParams['Accept'] = 'application/json,application/xml';
|
||||
$headerParams['Content-Type'] = 'multipart/form-data';
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
if ($additionalMetadata != null) {
|
||||
$formParams[additionalMetadata] = $additionalMetadata;
|
||||
}
|
||||
if ($file != null) {
|
||||
$formParams[file] = '@' . $file;
|
||||
}
|
||||
|
||||
|
||||
$body = $body ?: $formParams;
|
||||
|
||||
if (strpos($headerParams['Content-Type'], "application/x-www-form-urlencoded") > -1) {
|
||||
$body = http_build_query($body);
|
||||
}
|
||||
|
||||
// make the API Call
|
||||
$response = $this->apiClient->callAPI($resourcePath, $method,
|
||||
$queryParams, $body,
|
||||
$headerParams);
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
<?php
|
||||
/**
|
||||
* Copyright 2014 Reverb Technologies, Inc.
|
||||
* 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.
|
||||
@ -25,110 +25,199 @@ class StoreApi {
|
||||
$this->apiClient = $apiClient;
|
||||
}
|
||||
|
||||
/**
|
||||
* getOrderById
|
||||
* Find purchase order by ID
|
||||
* orderId, string: ID of pet that needs to be fetched (required)
|
||||
|
||||
* @return Order
|
||||
|
||||
/**
|
||||
* getInventory
|
||||
*
|
||||
* Returns pet inventories by status
|
||||
|
||||
* @return map[string,int]
|
||||
*/
|
||||
|
||||
public function getOrderById($orderId) {
|
||||
public function getInventory() {
|
||||
|
||||
//parse inputs
|
||||
$resourcePath = "/store/order/{orderId}";
|
||||
// parse inputs
|
||||
$resourcePath = "/store/inventory";
|
||||
$resourcePath = str_replace("{format}", "json", $resourcePath);
|
||||
$method = "GET";
|
||||
$queryParams = array();
|
||||
$headerParams = array();
|
||||
$headerParams['Accept'] = 'application/json';
|
||||
$headerParams['Content-Type'] = 'application/json';
|
||||
$formParams = array();
|
||||
$headerParams['Accept'] = 'application/json,application/xml';
|
||||
$headerParams['Content-Type'] = '';
|
||||
|
||||
if($orderId != null) {
|
||||
$resourcePath = str_replace("{" . "orderId" . "}",
|
||||
$this->apiClient->toPathValue($orderId), $resourcePath);
|
||||
}
|
||||
//make the API Call
|
||||
if (! isset($body)) {
|
||||
$body = null;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
$body = $body ?: $formParams;
|
||||
|
||||
if (strpos($headerParams['Content-Type'], "application/x-www-form-urlencoded") > -1) {
|
||||
$body = http_build_query($body);
|
||||
}
|
||||
|
||||
// make the API Call
|
||||
$response = $this->apiClient->callAPI($resourcePath, $method,
|
||||
$queryParams, $body,
|
||||
$headerParams);
|
||||
|
||||
|
||||
if(! $response){
|
||||
return null;
|
||||
}
|
||||
if(! $response) {
|
||||
return null;
|
||||
}
|
||||
|
||||
$responseObject = $this->apiClient->deserialize($response,
|
||||
'Order');
|
||||
'map[string,int]');
|
||||
return $responseObject;
|
||||
|
||||
}
|
||||
/**
|
||||
* deleteOrder
|
||||
* Delete purchase order by ID
|
||||
* orderId, string: ID of the order that needs to be deleted (required)
|
||||
|
||||
* @return
|
||||
*/
|
||||
|
||||
public function deleteOrder($orderId) {
|
||||
|
||||
//parse inputs
|
||||
$resourcePath = "/store/order/{orderId}";
|
||||
$resourcePath = str_replace("{format}", "json", $resourcePath);
|
||||
$method = "DELETE";
|
||||
$queryParams = array();
|
||||
$headerParams = array();
|
||||
$headerParams['Accept'] = 'application/json';
|
||||
$headerParams['Content-Type'] = 'application/json';
|
||||
|
||||
if($orderId != null) {
|
||||
$resourcePath = str_replace("{" . "orderId" . "}",
|
||||
$this->apiClient->toPathValue($orderId), $resourcePath);
|
||||
}
|
||||
//make the API Call
|
||||
if (! isset($body)) {
|
||||
$body = null;
|
||||
}
|
||||
$response = $this->apiClient->callAPI($resourcePath, $method,
|
||||
$queryParams, $body,
|
||||
$headerParams);
|
||||
|
||||
|
||||
}
|
||||
/**
|
||||
}
|
||||
|
||||
/**
|
||||
* placeOrder
|
||||
*
|
||||
* Place an order for a pet
|
||||
* body, Order: order placed for purchasing the pet (required)
|
||||
|
||||
* @return
|
||||
*
|
||||
* @return Order
|
||||
*/
|
||||
|
||||
public function placeOrder($body) {
|
||||
|
||||
//parse inputs
|
||||
// parse inputs
|
||||
$resourcePath = "/store/order";
|
||||
$resourcePath = str_replace("{format}", "json", $resourcePath);
|
||||
$method = "POST";
|
||||
$queryParams = array();
|
||||
$headerParams = array();
|
||||
$headerParams['Accept'] = 'application/json';
|
||||
$headerParams['Content-Type'] = 'application/json';
|
||||
$formParams = array();
|
||||
$headerParams['Accept'] = 'application/json,application/xml';
|
||||
$headerParams['Content-Type'] = '';
|
||||
|
||||
//make the API Call
|
||||
if (! isset($body)) {
|
||||
$body = null;
|
||||
|
||||
|
||||
|
||||
|
||||
// body params
|
||||
$body = null;
|
||||
if (isset($body)) {
|
||||
$body = $body;
|
||||
}
|
||||
|
||||
$body = $body ?: $formParams;
|
||||
|
||||
if (strpos($headerParams['Content-Type'], "application/x-www-form-urlencoded") > -1) {
|
||||
$body = http_build_query($body);
|
||||
}
|
||||
|
||||
// make the API Call
|
||||
$response = $this->apiClient->callAPI($resourcePath, $method,
|
||||
$queryParams, $body,
|
||||
$headerParams);
|
||||
|
||||
|
||||
if(! $response) {
|
||||
return null;
|
||||
}
|
||||
|
||||
$responseObject = $this->apiClient->deserialize($response,
|
||||
'Order');
|
||||
return $responseObject;
|
||||
}
|
||||
|
||||
/**
|
||||
* getOrderById
|
||||
*
|
||||
* Find purchase order by ID
|
||||
* orderId, string: ID of pet that needs to be fetched (required)
|
||||
*
|
||||
* @return Order
|
||||
*/
|
||||
|
||||
public function getOrderById($orderId) {
|
||||
|
||||
// parse inputs
|
||||
$resourcePath = "/store/order/{orderId}";
|
||||
$resourcePath = str_replace("{format}", "json", $resourcePath);
|
||||
$method = "GET";
|
||||
$queryParams = array();
|
||||
$headerParams = array();
|
||||
$formParams = array();
|
||||
$headerParams['Accept'] = 'application/json,application/xml';
|
||||
$headerParams['Content-Type'] = '';
|
||||
|
||||
|
||||
|
||||
// path params
|
||||
if($orderId != null) {
|
||||
$resourcePath = str_replace("{" . "orderId" . "}",
|
||||
$this->apiClient->toPathValue($orderId), $resourcePath);
|
||||
}
|
||||
|
||||
|
||||
|
||||
$body = $body ?: $formParams;
|
||||
|
||||
if (strpos($headerParams['Content-Type'], "application/x-www-form-urlencoded") > -1) {
|
||||
$body = http_build_query($body);
|
||||
}
|
||||
|
||||
// make the API Call
|
||||
$response = $this->apiClient->callAPI($resourcePath, $method,
|
||||
$queryParams, $body,
|
||||
$headerParams);
|
||||
|
||||
if(! $response) {
|
||||
return null;
|
||||
}
|
||||
|
||||
$responseObject = $this->apiClient->deserialize($response,
|
||||
'Order');
|
||||
return $responseObject;
|
||||
}
|
||||
|
||||
/**
|
||||
* deleteOrder
|
||||
*
|
||||
* Delete purchase order by ID
|
||||
* orderId, string: ID of the order that needs to be deleted (required)
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
|
||||
public function deleteOrder($orderId) {
|
||||
|
||||
// parse inputs
|
||||
$resourcePath = "/store/order/{orderId}";
|
||||
$resourcePath = str_replace("{format}", "json", $resourcePath);
|
||||
$method = "DELETE";
|
||||
$queryParams = array();
|
||||
$headerParams = array();
|
||||
$formParams = array();
|
||||
$headerParams['Accept'] = 'application/json,application/xml';
|
||||
$headerParams['Content-Type'] = '';
|
||||
|
||||
|
||||
|
||||
// path params
|
||||
if($orderId != null) {
|
||||
$resourcePath = str_replace("{" . "orderId" . "}",
|
||||
$this->apiClient->toPathValue($orderId), $resourcePath);
|
||||
}
|
||||
|
||||
|
||||
|
||||
$body = $body ?: $formParams;
|
||||
|
||||
if (strpos($headerParams['Content-Type'], "application/x-www-form-urlencoded") > -1) {
|
||||
$body = http_build_query($body);
|
||||
}
|
||||
|
||||
// make the API Call
|
||||
$response = $this->apiClient->callAPI($resourcePath, $method,
|
||||
$queryParams, $body,
|
||||
$headerParams);
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
@ -1,128 +1,149 @@
|
||||
<?php
|
||||
/**
|
||||
* APIClient.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.
|
||||
*/
|
||||
|
||||
|
||||
/* Autoload the model definition files */
|
||||
/**
|
||||
*
|
||||
*
|
||||
* @param string $className the class to attempt to load
|
||||
*/
|
||||
function swagger_autoloader($className) {
|
||||
$currentDir = dirname(__FILE__);
|
||||
if (file_exists($currentDir . '/' . $className . '.php')) {
|
||||
include $currentDir . '/' . $className . '.php';
|
||||
} elseif (file_exists($currentDir . '/models/' . $className . '.php')) {
|
||||
include $currentDir . '/models/' . $className . '.php';
|
||||
}
|
||||
$currentDir = dirname(__FILE__);
|
||||
if (file_exists($currentDir . '/' . $className . '.php')) {
|
||||
include $currentDir . '/' . $className . '.php';
|
||||
} elseif (file_exists($currentDir . '/models/' . $className . '.php')) {
|
||||
include $currentDir . '/models/' . $className . '.php';
|
||||
}
|
||||
}
|
||||
spl_autoload_register('swagger_autoloader');
|
||||
|
||||
|
||||
class APIClient {
|
||||
|
||||
public static $POST = "POST";
|
||||
public static $GET = "GET";
|
||||
public static $PUT = "PUT";
|
||||
public static $DELETE = "DELETE";
|
||||
public static $POST = "POST";
|
||||
public static $GET = "GET";
|
||||
public static $PUT = "PUT";
|
||||
public static $DELETE = "DELETE";
|
||||
|
||||
/**
|
||||
* @param string $apiKey your API key
|
||||
* @param string $apiServer the address of the API server
|
||||
*/
|
||||
function __construct($apiKey, $apiServer) {
|
||||
$this->apiKey = $apiKey;
|
||||
$this->apiServer = $apiServer;
|
||||
}
|
||||
/**
|
||||
* @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;
|
||||
}
|
||||
|
||||
/**
|
||||
* @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_timout = $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) {
|
||||
/**
|
||||
* @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();
|
||||
$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 == 'api_key') {
|
||||
$added_api_key = True;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (! $added_api_key) {
|
||||
$headers[] = "api_key: " . $this->apiKey;
|
||||
}
|
||||
# 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 (is_object($postData) or is_array($postData)) {
|
||||
$postData = json_encode($this->sanitizeForSerialization($postData));
|
||||
}
|
||||
if (strpos($headers['Content-Type'], "multipart/form-data") < 0 and (is_object($postData) or is_array($postData))) {
|
||||
$postData = json_encode($this->sanitizeForSerialization($postData));
|
||||
}
|
||||
|
||||
$url = $this->apiServer . $resourcePath;
|
||||
$url = $this->host . $resourcePath;
|
||||
|
||||
$curl = curl_init();
|
||||
curl_setopt($curl, CURLOPT_TIMEOUT, 5);
|
||||
// return the result on success, rather than just TRUE
|
||||
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
|
||||
curl_setopt($curl, CURLOPT_HTTPHEADER, $headers);
|
||||
$curl = curl_init();
|
||||
if ($this->curl_timout) {
|
||||
curl_setopt($curl, CURLOPT_TIMEOUT, $this->curl_timout);
|
||||
}
|
||||
// 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 (! 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::$PUT) {
|
||||
$json_data = json_encode($postData);
|
||||
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);
|
||||
if ($method == self::$POST) {
|
||||
curl_setopt($curl, CURLOPT_POST, true);
|
||||
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);
|
||||
|
||||
// Make the request
|
||||
$response = curl_exec($curl);
|
||||
$response_info = curl_getinfo($curl);
|
||||
// Make the request
|
||||
$response = curl_exec($curl);
|
||||
$response_info = curl_getinfo($curl);
|
||||
|
||||
// Handle the response
|
||||
if ($response_info['http_code'] == 0) {
|
||||
throw new Exception("TIMEOUT: api call to " . $url .
|
||||
" took more than 5s to return" );
|
||||
} else if ($response_info['http_code'] == 200) {
|
||||
$data = json_decode($response);
|
||||
} else if ($response_info['http_code'] == 401) {
|
||||
throw new Exception("Unauthorized API request to " . $url .
|
||||
": ".json_decode($response)->message );
|
||||
} else if ($response_info['http_code'] == 404) {
|
||||
$data = null;
|
||||
} else {
|
||||
throw new Exception("Can't connect to the api: " . $url .
|
||||
" response code: " .
|
||||
$response_info['http_code']);
|
||||
}
|
||||
// Handle the response
|
||||
if ($response_info['http_code'] == 0) {
|
||||
throw new Exception("TIMEOUT: api call to " . $url .
|
||||
" took more than 5s to return" );
|
||||
} else if ($response_info['http_code'] == 200) {
|
||||
$data = json_decode($response);
|
||||
} else if ($response_info['http_code'] == 401) {
|
||||
throw new Exception("Unauthorized API request to " . $url .
|
||||
": ".json_decode($response)->message );
|
||||
} else if ($response_info['http_code'] == 404) {
|
||||
$data = null;
|
||||
} else {
|
||||
throw new Exception("Can't connect to the api: " . $url .
|
||||
" response code: " .
|
||||
$response_info['http_code']);
|
||||
}
|
||||
return $data;
|
||||
}
|
||||
|
||||
return $data;
|
||||
}
|
||||
|
||||
/**
|
||||
* Build a JSON POST object
|
||||
*/
|
||||
/**
|
||||
* Build a JSON POST object
|
||||
*/
|
||||
protected function sanitizeForSerialization($data)
|
||||
{
|
||||
if (is_scalar($data) || null === $data) {
|
||||
@ -147,41 +168,41 @@ class APIClient {
|
||||
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($value);
|
||||
}
|
||||
/**
|
||||
* 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($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) {
|
||||
/**
|
||||
* 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 $object;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Just pass through the header value for now. Placeholder in case we
|
||||
* find out we need to do something with header values.
|
||||
* @param string $value a string which will be part of the header
|
||||
* @return string the header string
|
||||
*/
|
||||
public static function toHeaderValue($value) {
|
||||
return $value;
|
||||
}
|
||||
/**
|
||||
* Just pass through the header value for now. Placeholder in case we
|
||||
* find out we need to do something with header values.
|
||||
* @param string $value a string which will be part of the header
|
||||
* @return string the header string
|
||||
*/
|
||||
public static function toHeaderValue($value) {
|
||||
return $value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Deserialize a JSON string into an object
|
||||
@ -195,10 +216,19 @@ class APIClient {
|
||||
{
|
||||
if (null === $data) {
|
||||
$deserialized = null;
|
||||
} else if (substr($class, 0, 6) == 'array[') {
|
||||
$subClass = substr($class, 6, -1);
|
||||
} elseif (substr($class, 0, 4) == 'map[') {
|
||||
$inner = substr($class, 4, -1);
|
||||
$values = array();
|
||||
foreach ($data as $value) {
|
||||
if(strrpos($inner, ",") !== false) {
|
||||
$subClass = explode(',', $inner, 2)[1];
|
||||
foreach ($data as $key => $value) {
|
||||
$values[] = array($key => self::deserialize($value, $subClass));
|
||||
}
|
||||
}
|
||||
$deserialized = $values;
|
||||
} elseif (substr($class, 0, 6) == 'array[') {
|
||||
$subClass = substr($class, 6, -1);
|
||||
foreach ($data as $key => $value) {
|
||||
$values[] = self::deserialize($value, $subClass);
|
||||
}
|
||||
$deserialized = $values;
|
||||
@ -222,4 +252,3 @@ class APIClient {
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
<?php
|
||||
/**
|
||||
* Copyright 2014 Reverb Technologies, Inc.
|
||||
* 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.
|
||||
@ -25,275 +25,381 @@ class UserApi {
|
||||
$this->apiClient = $apiClient;
|
||||
}
|
||||
|
||||
/**
|
||||
* updateUser
|
||||
* Updated user
|
||||
* username, string: name that need to be deleted (required)
|
||||
|
||||
* body, User: Updated user object (required)
|
||||
|
||||
* @return
|
||||
*/
|
||||
|
||||
public function updateUser($username, $body) {
|
||||
|
||||
//parse inputs
|
||||
$resourcePath = "/user/{username}";
|
||||
$resourcePath = str_replace("{format}", "json", $resourcePath);
|
||||
$method = "PUT";
|
||||
$queryParams = array();
|
||||
$headerParams = array();
|
||||
$headerParams['Accept'] = 'application/json';
|
||||
$headerParams['Content-Type'] = 'application/json';
|
||||
|
||||
if($username != null) {
|
||||
$resourcePath = str_replace("{" . "username" . "}",
|
||||
$this->apiClient->toPathValue($username), $resourcePath);
|
||||
}
|
||||
//make the API Call
|
||||
if (! isset($body)) {
|
||||
$body = null;
|
||||
}
|
||||
$response = $this->apiClient->callAPI($resourcePath, $method,
|
||||
$queryParams, $body,
|
||||
$headerParams);
|
||||
|
||||
|
||||
}
|
||||
/**
|
||||
* deleteUser
|
||||
* Delete user
|
||||
* username, string: The name that needs to be deleted (required)
|
||||
|
||||
* @return
|
||||
*/
|
||||
|
||||
public function deleteUser($username) {
|
||||
|
||||
//parse inputs
|
||||
$resourcePath = "/user/{username}";
|
||||
$resourcePath = str_replace("{format}", "json", $resourcePath);
|
||||
$method = "DELETE";
|
||||
$queryParams = array();
|
||||
$headerParams = array();
|
||||
$headerParams['Accept'] = 'application/json';
|
||||
$headerParams['Content-Type'] = 'application/json';
|
||||
|
||||
if($username != null) {
|
||||
$resourcePath = str_replace("{" . "username" . "}",
|
||||
$this->apiClient->toPathValue($username), $resourcePath);
|
||||
}
|
||||
//make the API Call
|
||||
if (! isset($body)) {
|
||||
$body = null;
|
||||
}
|
||||
$response = $this->apiClient->callAPI($resourcePath, $method,
|
||||
$queryParams, $body,
|
||||
$headerParams);
|
||||
|
||||
|
||||
}
|
||||
/**
|
||||
* getUserByName
|
||||
* Get user by user name
|
||||
* username, string: 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";
|
||||
$queryParams = array();
|
||||
$headerParams = array();
|
||||
$headerParams['Accept'] = 'application/json';
|
||||
$headerParams['Content-Type'] = 'application/json';
|
||||
|
||||
if($username != null) {
|
||||
$resourcePath = str_replace("{" . "username" . "}",
|
||||
$this->apiClient->toPathValue($username), $resourcePath);
|
||||
}
|
||||
//make the API Call
|
||||
if (! isset($body)) {
|
||||
$body = null;
|
||||
}
|
||||
$response = $this->apiClient->callAPI($resourcePath, $method,
|
||||
$queryParams, $body,
|
||||
$headerParams);
|
||||
|
||||
|
||||
if(! $response){
|
||||
return null;
|
||||
}
|
||||
|
||||
$responseObject = $this->apiClient->deserialize($response,
|
||||
'User');
|
||||
return $responseObject;
|
||||
|
||||
}
|
||||
/**
|
||||
* loginUser
|
||||
* Logs user into the system
|
||||
* username, string: The user name for login (required)
|
||||
|
||||
* password, string: 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";
|
||||
$queryParams = array();
|
||||
$headerParams = array();
|
||||
$headerParams['Accept'] = 'application/json';
|
||||
$headerParams['Content-Type'] = 'application/json';
|
||||
|
||||
if($username != null) {
|
||||
$queryParams['username'] = $this->apiClient->toQueryValue($username);
|
||||
}
|
||||
if($password != null) {
|
||||
$queryParams['password'] = $this->apiClient->toQueryValue($password);
|
||||
}
|
||||
//make the API Call
|
||||
if (! isset($body)) {
|
||||
$body = null;
|
||||
}
|
||||
$response = $this->apiClient->callAPI($resourcePath, $method,
|
||||
$queryParams, $body,
|
||||
$headerParams);
|
||||
|
||||
|
||||
if(! $response){
|
||||
return null;
|
||||
}
|
||||
|
||||
$responseObject = $this->apiClient->deserialize($response,
|
||||
'string');
|
||||
return $responseObject;
|
||||
|
||||
}
|
||||
/**
|
||||
* logoutUser
|
||||
* Logs out current logged in user session
|
||||
* @return
|
||||
*/
|
||||
|
||||
public function logoutUser() {
|
||||
|
||||
//parse inputs
|
||||
$resourcePath = "/user/logout";
|
||||
$resourcePath = str_replace("{format}", "json", $resourcePath);
|
||||
$method = "GET";
|
||||
$queryParams = array();
|
||||
$headerParams = array();
|
||||
$headerParams['Accept'] = 'application/json';
|
||||
$headerParams['Content-Type'] = 'application/json';
|
||||
|
||||
//make the API Call
|
||||
if (! isset($body)) {
|
||||
$body = null;
|
||||
}
|
||||
$response = $this->apiClient->callAPI($resourcePath, $method,
|
||||
$queryParams, $body,
|
||||
$headerParams);
|
||||
|
||||
|
||||
}
|
||||
/**
|
||||
|
||||
/**
|
||||
* createUser
|
||||
*
|
||||
* Create user
|
||||
* body, User: Created user object (required)
|
||||
|
||||
* @return
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
|
||||
public function createUser($body) {
|
||||
|
||||
//parse inputs
|
||||
// parse inputs
|
||||
$resourcePath = "/user";
|
||||
$resourcePath = str_replace("{format}", "json", $resourcePath);
|
||||
$method = "POST";
|
||||
$queryParams = array();
|
||||
$headerParams = array();
|
||||
$headerParams['Accept'] = 'application/json';
|
||||
$headerParams['Content-Type'] = 'application/json';
|
||||
$formParams = array();
|
||||
$headerParams['Accept'] = 'application/json,application/xml';
|
||||
$headerParams['Content-Type'] = '';
|
||||
|
||||
//make the API Call
|
||||
if (! isset($body)) {
|
||||
$body = null;
|
||||
|
||||
|
||||
|
||||
|
||||
// body params
|
||||
$body = null;
|
||||
if (isset($body)) {
|
||||
$body = $body;
|
||||
}
|
||||
|
||||
$body = $body ?: $formParams;
|
||||
|
||||
if (strpos($headerParams['Content-Type'], "application/x-www-form-urlencoded") > -1) {
|
||||
$body = http_build_query($body);
|
||||
}
|
||||
|
||||
// make the API Call
|
||||
$response = $this->apiClient->callAPI($resourcePath, $method,
|
||||
$queryParams, $body,
|
||||
$headerParams);
|
||||
|
||||
|
||||
}
|
||||
/**
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* createUsersWithArrayInput
|
||||
*
|
||||
* Creates list of users with given input array
|
||||
* body, array[User]: List of user object (required)
|
||||
|
||||
* @return
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
|
||||
public function createUsersWithArrayInput($body) {
|
||||
|
||||
//parse inputs
|
||||
// parse inputs
|
||||
$resourcePath = "/user/createWithArray";
|
||||
$resourcePath = str_replace("{format}", "json", $resourcePath);
|
||||
$method = "POST";
|
||||
$queryParams = array();
|
||||
$headerParams = array();
|
||||
$headerParams['Accept'] = 'application/json';
|
||||
$headerParams['Content-Type'] = 'application/json';
|
||||
$formParams = array();
|
||||
$headerParams['Accept'] = 'application/json,application/xml';
|
||||
$headerParams['Content-Type'] = '';
|
||||
|
||||
//make the API Call
|
||||
if (! isset($body)) {
|
||||
$body = null;
|
||||
|
||||
|
||||
|
||||
|
||||
// body params
|
||||
$body = null;
|
||||
if (isset($body)) {
|
||||
$body = $body;
|
||||
}
|
||||
|
||||
$body = $body ?: $formParams;
|
||||
|
||||
if (strpos($headerParams['Content-Type'], "application/x-www-form-urlencoded") > -1) {
|
||||
$body = http_build_query($body);
|
||||
}
|
||||
|
||||
// make the API Call
|
||||
$response = $this->apiClient->callAPI($resourcePath, $method,
|
||||
$queryParams, $body,
|
||||
$headerParams);
|
||||
|
||||
|
||||
}
|
||||
/**
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* createUsersWithListInput
|
||||
* Creates list of users with given list input
|
||||
*
|
||||
* Creates list of users with given input array
|
||||
* body, array[User]: List of user object (required)
|
||||
|
||||
* @return
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
|
||||
public function createUsersWithListInput($body) {
|
||||
|
||||
//parse inputs
|
||||
// parse inputs
|
||||
$resourcePath = "/user/createWithList";
|
||||
$resourcePath = str_replace("{format}", "json", $resourcePath);
|
||||
$method = "POST";
|
||||
$queryParams = array();
|
||||
$headerParams = array();
|
||||
$headerParams['Accept'] = 'application/json';
|
||||
$headerParams['Content-Type'] = 'application/json';
|
||||
$formParams = array();
|
||||
$headerParams['Accept'] = 'application/json,application/xml';
|
||||
$headerParams['Content-Type'] = '';
|
||||
|
||||
//make the API Call
|
||||
if (! isset($body)) {
|
||||
$body = null;
|
||||
|
||||
|
||||
|
||||
|
||||
// body params
|
||||
$body = null;
|
||||
if (isset($body)) {
|
||||
$body = $body;
|
||||
}
|
||||
|
||||
$body = $body ?: $formParams;
|
||||
|
||||
if (strpos($headerParams['Content-Type'], "application/x-www-form-urlencoded") > -1) {
|
||||
$body = http_build_query($body);
|
||||
}
|
||||
|
||||
// make the API Call
|
||||
$response = $this->apiClient->callAPI($resourcePath, $method,
|
||||
$queryParams, $body,
|
||||
$headerParams);
|
||||
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* loginUser
|
||||
*
|
||||
* Logs user into the system
|
||||
* username, string: The user name for login (required)
|
||||
* * password, string: 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";
|
||||
$queryParams = array();
|
||||
$headerParams = array();
|
||||
$formParams = array();
|
||||
$headerParams['Accept'] = 'application/json,application/xml';
|
||||
$headerParams['Content-Type'] = '';
|
||||
|
||||
// query params
|
||||
if($username != null) {
|
||||
$queryParams['username'] = $this->apiClient->toQueryValue($username);
|
||||
}// query params
|
||||
if($password != null) {
|
||||
$queryParams['password'] = $this->apiClient->toQueryValue($password);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
$body = $body ?: $formParams;
|
||||
|
||||
if (strpos($headerParams['Content-Type'], "application/x-www-form-urlencoded") > -1) {
|
||||
$body = http_build_query($body);
|
||||
}
|
||||
|
||||
// make the API Call
|
||||
$response = $this->apiClient->callAPI($resourcePath, $method,
|
||||
$queryParams, $body,
|
||||
$headerParams);
|
||||
|
||||
if(! $response) {
|
||||
return null;
|
||||
}
|
||||
|
||||
$responseObject = $this->apiClient->deserialize($response,
|
||||
'string');
|
||||
return $responseObject;
|
||||
}
|
||||
|
||||
/**
|
||||
* logoutUser
|
||||
*
|
||||
* Logs out current logged in user session
|
||||
|
||||
* @return
|
||||
*/
|
||||
|
||||
public function logoutUser() {
|
||||
|
||||
// parse inputs
|
||||
$resourcePath = "/user/logout";
|
||||
$resourcePath = str_replace("{format}", "json", $resourcePath);
|
||||
$method = "GET";
|
||||
$queryParams = array();
|
||||
$headerParams = array();
|
||||
$formParams = array();
|
||||
$headerParams['Accept'] = 'application/json,application/xml';
|
||||
$headerParams['Content-Type'] = '';
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
$body = $body ?: $formParams;
|
||||
|
||||
if (strpos($headerParams['Content-Type'], "application/x-www-form-urlencoded") > -1) {
|
||||
$body = http_build_query($body);
|
||||
}
|
||||
|
||||
// make the API Call
|
||||
$response = $this->apiClient->callAPI($resourcePath, $method,
|
||||
$queryParams, $body,
|
||||
$headerParams);
|
||||
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* getUserByName
|
||||
*
|
||||
* Get user by user name
|
||||
* username, string: 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";
|
||||
$queryParams = array();
|
||||
$headerParams = array();
|
||||
$formParams = array();
|
||||
$headerParams['Accept'] = 'application/json,application/xml';
|
||||
$headerParams['Content-Type'] = '';
|
||||
|
||||
|
||||
|
||||
// path params
|
||||
if($username != null) {
|
||||
$resourcePath = str_replace("{" . "username" . "}",
|
||||
$this->apiClient->toPathValue($username), $resourcePath);
|
||||
}
|
||||
|
||||
|
||||
|
||||
$body = $body ?: $formParams;
|
||||
|
||||
if (strpos($headerParams['Content-Type'], "application/x-www-form-urlencoded") > -1) {
|
||||
$body = http_build_query($body);
|
||||
}
|
||||
|
||||
// make the API Call
|
||||
$response = $this->apiClient->callAPI($resourcePath, $method,
|
||||
$queryParams, $body,
|
||||
$headerParams);
|
||||
|
||||
if(! $response) {
|
||||
return null;
|
||||
}
|
||||
|
||||
$responseObject = $this->apiClient->deserialize($response,
|
||||
'User');
|
||||
return $responseObject;
|
||||
}
|
||||
|
||||
/**
|
||||
* updateUser
|
||||
*
|
||||
* Updated user
|
||||
* username, string: name that need to be deleted (required)
|
||||
* * body, User: Updated user object (required)
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
|
||||
public function updateUser($username, $body) {
|
||||
|
||||
// parse inputs
|
||||
$resourcePath = "/user/{username}";
|
||||
$resourcePath = str_replace("{format}", "json", $resourcePath);
|
||||
$method = "PUT";
|
||||
$queryParams = array();
|
||||
$headerParams = array();
|
||||
$formParams = array();
|
||||
$headerParams['Accept'] = 'application/json,application/xml';
|
||||
$headerParams['Content-Type'] = '';
|
||||
|
||||
|
||||
|
||||
// path params
|
||||
if($username != null) {
|
||||
$resourcePath = str_replace("{" . "username" . "}",
|
||||
$this->apiClient->toPathValue($username), $resourcePath);
|
||||
}
|
||||
|
||||
// body params
|
||||
$body = null;
|
||||
if (isset($body)) {
|
||||
$body = $body;
|
||||
}
|
||||
|
||||
$body = $body ?: $formParams;
|
||||
|
||||
if (strpos($headerParams['Content-Type'], "application/x-www-form-urlencoded") > -1) {
|
||||
$body = http_build_query($body);
|
||||
}
|
||||
|
||||
// make the API Call
|
||||
$response = $this->apiClient->callAPI($resourcePath, $method,
|
||||
$queryParams, $body,
|
||||
$headerParams);
|
||||
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* deleteUser
|
||||
*
|
||||
* Delete user
|
||||
* username, string: The name that needs to be deleted (required)
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
|
||||
public function deleteUser($username) {
|
||||
|
||||
// parse inputs
|
||||
$resourcePath = "/user/{username}";
|
||||
$resourcePath = str_replace("{format}", "json", $resourcePath);
|
||||
$method = "DELETE";
|
||||
$queryParams = array();
|
||||
$headerParams = array();
|
||||
$formParams = array();
|
||||
$headerParams['Accept'] = 'application/json,application/xml';
|
||||
$headerParams['Content-Type'] = '';
|
||||
|
||||
|
||||
|
||||
// path params
|
||||
if($username != null) {
|
||||
$resourcePath = str_replace("{" . "username" . "}",
|
||||
$this->apiClient->toPathValue($username), $resourcePath);
|
||||
}
|
||||
|
||||
|
||||
|
||||
$body = $body ?: $formParams;
|
||||
|
||||
if (strpos($headerParams['Content-Type'], "application/x-www-form-urlencoded") > -1) {
|
||||
$body = http_build_query($body);
|
||||
}
|
||||
|
||||
// make the API Call
|
||||
$response = $this->apiClient->callAPI($resourcePath, $method,
|
||||
$queryParams, $body,
|
||||
$headerParams);
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
<?php
|
||||
/**
|
||||
* Copyright 2014 Reverb Technologies, Inc.
|
||||
* 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.
|
||||
@ -21,15 +21,14 @@
|
||||
* NOTE: This class is auto generated by the swagger code generator program. Do not edit the class manually.
|
||||
*
|
||||
*/
|
||||
class Category {
|
||||
|
||||
class Category {
|
||||
static $swaggerTypes = array(
|
||||
'id' => 'int',
|
||||
'name' => 'string'
|
||||
|
||||
);
|
||||
|
||||
public $id; // int
|
||||
public $name; // string
|
||||
}
|
||||
|
||||
|
||||
public $id; /* int */
|
||||
public $name; /* string */
|
||||
}
|
||||
|
@ -1,6 +1,6 @@
|
||||
<?php
|
||||
/**
|
||||
* Copyright 2014 Reverb Technologies, Inc.
|
||||
* 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.
|
||||
@ -21,24 +21,25 @@
|
||||
* NOTE: This class is auto generated by the swagger code generator program. Do not edit the class manually.
|
||||
*
|
||||
*/
|
||||
class Order {
|
||||
|
||||
class Order {
|
||||
static $swaggerTypes = array(
|
||||
'id' => 'int',
|
||||
'petId' => 'int',
|
||||
'quantity' => 'int',
|
||||
'shipDate' => 'DateTime',
|
||||
'status' => 'string',
|
||||
'shipDate' => 'DateTime'
|
||||
|
||||
'complete' => 'boolean'
|
||||
);
|
||||
|
||||
public $id; // int
|
||||
public $petId; // int
|
||||
public $quantity; // int
|
||||
|
||||
public $id; /* int */
|
||||
public $petId; /* int */
|
||||
public $quantity; /* int */
|
||||
public $shipDate; /* DateTime */
|
||||
/**
|
||||
* Order Status
|
||||
*/
|
||||
public $status; // string
|
||||
public $shipDate; // DateTime
|
||||
}
|
||||
|
||||
public $status; /* string */
|
||||
public $complete; /* boolean */
|
||||
}
|
||||
|
@ -1,6 +1,6 @@
|
||||
<?php
|
||||
/**
|
||||
* Copyright 2014 Reverb Technologies, Inc.
|
||||
* 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.
|
||||
@ -21,8 +21,8 @@
|
||||
* NOTE: This class is auto generated by the swagger code generator program. Do not edit the class manually.
|
||||
*
|
||||
*/
|
||||
class Pet {
|
||||
|
||||
class Pet {
|
||||
static $swaggerTypes = array(
|
||||
'id' => 'int',
|
||||
'category' => 'Category',
|
||||
@ -30,20 +30,16 @@ class Pet {
|
||||
'photoUrls' => 'array[string]',
|
||||
'tags' => 'array[Tag]',
|
||||
'status' => 'string'
|
||||
|
||||
);
|
||||
|
||||
/**
|
||||
* unique identifier for the pet
|
||||
*/
|
||||
public $id; // int
|
||||
public $category; // Category
|
||||
public $name; // string
|
||||
public $photoUrls; // array[string]
|
||||
public $tags; // array[Tag]
|
||||
|
||||
public $id; /* int */
|
||||
public $category; /* Category */
|
||||
public $name; /* string */
|
||||
public $photoUrls; /* array[string] */
|
||||
public $tags; /* array[Tag] */
|
||||
/**
|
||||
* pet status in the store
|
||||
*/
|
||||
public $status; // string
|
||||
}
|
||||
|
||||
public $status; /* string */
|
||||
}
|
||||
|
@ -1,6 +1,6 @@
|
||||
<?php
|
||||
/**
|
||||
* Copyright 2014 Reverb Technologies, Inc.
|
||||
* 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.
|
||||
@ -21,15 +21,14 @@
|
||||
* NOTE: This class is auto generated by the swagger code generator program. Do not edit the class manually.
|
||||
*
|
||||
*/
|
||||
class Tag {
|
||||
|
||||
class Tag {
|
||||
static $swaggerTypes = array(
|
||||
'id' => 'int',
|
||||
'name' => 'string'
|
||||
|
||||
);
|
||||
|
||||
public $id; // int
|
||||
public $name; // string
|
||||
}
|
||||
|
||||
|
||||
public $id; /* int */
|
||||
public $name; /* string */
|
||||
}
|
||||
|
@ -1,6 +1,6 @@
|
||||
<?php
|
||||
/**
|
||||
* Copyright 2014 Reverb Technologies, Inc.
|
||||
* 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.
|
||||
@ -21,30 +21,29 @@
|
||||
* NOTE: This class is auto generated by the swagger code generator program. Do not edit the class manually.
|
||||
*
|
||||
*/
|
||||
class User {
|
||||
|
||||
class User {
|
||||
static $swaggerTypes = array(
|
||||
'id' => 'int',
|
||||
'firstName' => 'string',
|
||||
'username' => 'string',
|
||||
'firstName' => 'string',
|
||||
'lastName' => 'string',
|
||||
'email' => 'string',
|
||||
'password' => 'string',
|
||||
'phone' => 'string',
|
||||
'userStatus' => 'int'
|
||||
|
||||
);
|
||||
|
||||
public $id; // int
|
||||
public $firstName; // string
|
||||
public $username; // string
|
||||
public $lastName; // string
|
||||
public $email; // string
|
||||
public $password; // string
|
||||
public $phone; // string
|
||||
|
||||
public $id; /* int */
|
||||
public $username; /* string */
|
||||
public $firstName; /* string */
|
||||
public $lastName; /* string */
|
||||
public $email; /* string */
|
||||
public $password; /* string */
|
||||
public $phone; /* string */
|
||||
/**
|
||||
* User Status
|
||||
*/
|
||||
public $userStatus; // int
|
||||
}
|
||||
|
||||
public $userStatus; /* int */
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user