2015-02-16 17:49:22 -08:00

427 lines
11 KiB
PHP

<?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.
*/
class PetApi {
function __construct($apiClient) {
$this->apiClient = $apiClient;
}
/**
* updatePet
*
* Update an existing pet
* body, Pet: Pet object that needs to be added to the store (required)
*
* @return
*/
public function updatePet($body) {
// parse inputs
$resourcePath = "/pet";
$resourcePath = str_replace("{format}", "json", $resourcePath);
$method = "PUT";
$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;
}
$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;
}
$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
$resourcePath = "/pet/findByStatus";
$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($status !== null) {
$queryParams['status'] = $this->apiClient->toQueryValue($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);
if(! $response) {
return null;
}
$responseObject = $this->apiClient->deserialize($response,
'array[Pet]');
return $responseObject;
}
/**
* findPetsByTags
*
* Finds Pets by tags
* tags, array[string]: 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";
$queryParams = array();
$headerParams = array();
$formParams = array();
$headerParams['Accept'] = 'application/json,application/xml';
$headerParams['Content-Type'] = '';
// query params
if($tags !== null) {
$queryParams['tags'] = $this->apiClient->toQueryValue($tags);
}
$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,
'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
* petId, int: ID of pet to update (required)
* * additionalMetadata, string: Additional data to pass to server (required)
* * file, file: file to upload (required)
*
* @return
*/
public function uploadFile($petId, $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';
// path params
if($petId !== null) {
$resourcePath = str_replace("{" . "petId" . "}",
$this->apiClient->toPathValue($petId), $resourcePath);
}
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);
}
}