forked from loafle/openapi-generator-original
195 lines
5.1 KiB
PHP
195 lines
5.1 KiB
PHP
<?php
|
|
/**
|
|
* Copyright 2011 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.
|
|
*/
|
|
|
|
/**
|
|
*
|
|
* NOTE: This class is auto generated by the swagger code generator program. Do not edit the class manually.
|
|
*/
|
|
class PetApi {
|
|
|
|
function __construct($apiClient) {
|
|
$this->apiClient = $apiClient;
|
|
}
|
|
|
|
/**
|
|
* getPetById
|
|
* Find pet by ID
|
|
* petId, string: ID of pet that needs to be fetched (required)
|
|
* @return Pet
|
|
*/
|
|
|
|
public function getPetById($petId) {
|
|
|
|
//parse inputs
|
|
$resourcePath = "/pet.{format}/{petId}";
|
|
$resourcePath = str_replace("{format}", "json", $resourcePath);
|
|
$method = "GET";
|
|
$queryParams = array();
|
|
$headerParams = array();
|
|
|
|
if($petId != null) {
|
|
$resourcePath = str_replace("{" . "petId" . "}",
|
|
$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;
|
|
|
|
}
|
|
/**
|
|
* 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.{format}";
|
|
$resourcePath = str_replace("{format}", "json", $resourcePath);
|
|
$method = "POST";
|
|
$queryParams = array();
|
|
$headerParams = array();
|
|
|
|
//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
|
|
*/
|
|
|
|
public function updatePet($body) {
|
|
|
|
//parse inputs
|
|
$resourcePath = "/pet.{format}";
|
|
$resourcePath = str_replace("{format}", "json", $resourcePath);
|
|
$method = "PUT";
|
|
$queryParams = array();
|
|
$headerParams = array();
|
|
|
|
//make the API Call
|
|
if (! isset($body)) {
|
|
$body = null;
|
|
}
|
|
$response = $this->apiClient->callAPI($resourcePath, $method,
|
|
$queryParams, $body,
|
|
$headerParams);
|
|
|
|
|
|
}
|
|
/**
|
|
* findPetsByStatus
|
|
* Finds Pets by status
|
|
* status, string: Status values that need to be considered for filter (required)
|
|
* @return array[Pet]
|
|
*/
|
|
|
|
public function findPetsByStatus($status) {
|
|
|
|
//parse inputs
|
|
$resourcePath = "/pet.{format}/findByStatus";
|
|
$resourcePath = str_replace("{format}", "json", $resourcePath);
|
|
$method = "GET";
|
|
$queryParams = array();
|
|
$headerParams = array();
|
|
|
|
if($status != null) {
|
|
$queryParams['status'] = $this->apiClient->toPathValue($status);
|
|
}
|
|
//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;
|
|
|
|
}
|
|
/**
|
|
* findPetsByTags
|
|
* Finds Pets by tags
|
|
* tags, string: Tags to filter by (required)
|
|
* @return array[Pet]
|
|
*/
|
|
|
|
public function findPetsByTags($tags) {
|
|
|
|
//parse inputs
|
|
$resourcePath = "/pet.{format}/findByTags";
|
|
$resourcePath = str_replace("{format}", "json", $resourcePath);
|
|
$method = "GET";
|
|
$queryParams = array();
|
|
$headerParams = array();
|
|
|
|
if($tags != null) {
|
|
$queryParams['tags'] = $this->apiClient->toPathValue($tags);
|
|
}
|
|
//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;
|
|
|
|
}
|
|
|
|
}
|
|
|