forked from loafle/openapi-generator-original
Update all the samples.
(except clojure + scalatra, because those are broken, will fixed with later master merge.)
This commit is contained in:
@@ -0,0 +1,171 @@
|
||||
<?php
|
||||
/**
|
||||
* Fake_classname_tags123Api
|
||||
* PHP version 5
|
||||
*
|
||||
* @category Class
|
||||
* @package Swagger\Client
|
||||
* @author Swagger Codegen team
|
||||
* @link https://github.com/swagger-api/swagger-codegen
|
||||
*/
|
||||
|
||||
/**
|
||||
* Swagger Petstore
|
||||
*
|
||||
* This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
|
||||
*
|
||||
* OpenAPI spec version: 1.0.0
|
||||
* Contact: apiteam@swagger.io
|
||||
* Generated by: https://github.com/swagger-api/swagger-codegen.git
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
* NOTE: This class is auto generated by the swagger code generator program.
|
||||
* https://github.com/swagger-api/swagger-codegen
|
||||
* Do not edit the class manually.
|
||||
*/
|
||||
|
||||
namespace Swagger\Client\Api;
|
||||
|
||||
use \Swagger\Client\ApiClient;
|
||||
use \Swagger\Client\ApiException;
|
||||
use \Swagger\Client\Configuration;
|
||||
use \Swagger\Client\ObjectSerializer;
|
||||
|
||||
/**
|
||||
* Fake_classname_tags123Api Class Doc Comment
|
||||
*
|
||||
* @category Class
|
||||
* @package Swagger\Client
|
||||
* @author Swagger Codegen team
|
||||
* @link https://github.com/swagger-api/swagger-codegen
|
||||
*/
|
||||
class Fake_classname_tags123Api
|
||||
{
|
||||
/**
|
||||
* API Client
|
||||
*
|
||||
* @var \Swagger\Client\ApiClient instance of the ApiClient
|
||||
*/
|
||||
protected $apiClient;
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* @param \Swagger\Client\ApiClient|null $apiClient The api client to use
|
||||
*/
|
||||
public function __construct(\Swagger\Client\ApiClient $apiClient = null)
|
||||
{
|
||||
if ($apiClient === null) {
|
||||
$apiClient = new ApiClient();
|
||||
}
|
||||
|
||||
$this->apiClient = $apiClient;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get API client
|
||||
*
|
||||
* @return \Swagger\Client\ApiClient get the API client
|
||||
*/
|
||||
public function getApiClient()
|
||||
{
|
||||
return $this->apiClient;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the API client
|
||||
*
|
||||
* @param \Swagger\Client\ApiClient $apiClient set the API client
|
||||
*
|
||||
* @return Fake_classname_tags123Api
|
||||
*/
|
||||
public function setApiClient(\Swagger\Client\ApiClient $apiClient)
|
||||
{
|
||||
$this->apiClient = $apiClient;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Operation testClassname
|
||||
*
|
||||
* To test class name in snake case
|
||||
*
|
||||
* @param \Swagger\Client\Model\Client $body client model (required)
|
||||
* @throws \Swagger\Client\ApiException on non-2xx response
|
||||
* @return \Swagger\Client\Model\Client
|
||||
*/
|
||||
public function testClassname($body)
|
||||
{
|
||||
list($response) = $this->testClassnameWithHttpInfo($body);
|
||||
return $response;
|
||||
}
|
||||
|
||||
/**
|
||||
* Operation testClassnameWithHttpInfo
|
||||
*
|
||||
* To test class name in snake case
|
||||
*
|
||||
* @param \Swagger\Client\Model\Client $body client model (required)
|
||||
* @throws \Swagger\Client\ApiException on non-2xx response
|
||||
* @return array of \Swagger\Client\Model\Client, HTTP status code, HTTP response headers (array of strings)
|
||||
*/
|
||||
public function testClassnameWithHttpInfo($body)
|
||||
{
|
||||
// verify the required parameter 'body' is set
|
||||
if ($body === null) {
|
||||
throw new \InvalidArgumentException('Missing the required parameter $body when calling testClassname');
|
||||
}
|
||||
// parse inputs
|
||||
$resourcePath = "/fake_classname_test";
|
||||
$httpBody = '';
|
||||
$queryParams = [];
|
||||
$headerParams = [];
|
||||
$formParams = [];
|
||||
$_header_accept = $this->apiClient->selectHeaderAccept(['application/json']);
|
||||
if (!is_null($_header_accept)) {
|
||||
$headerParams['Accept'] = $_header_accept;
|
||||
}
|
||||
$headerParams['Content-Type'] = $this->apiClient->selectHeaderContentType(['application/json']);
|
||||
|
||||
// default format to json
|
||||
$resourcePath = str_replace("{format}", "json", $resourcePath);
|
||||
|
||||
// body params
|
||||
$_tempBody = null;
|
||||
if (isset($body)) {
|
||||
$_tempBody = $body;
|
||||
}
|
||||
|
||||
// for model (json/xml)
|
||||
if (isset($_tempBody)) {
|
||||
$httpBody = $_tempBody; // $_tempBody is the method argument, if present
|
||||
} elseif (count($formParams) > 0) {
|
||||
$httpBody = $formParams; // for HTTP post (form)
|
||||
}
|
||||
// make the API Call
|
||||
try {
|
||||
list($response, $statusCode, $httpHeader) = $this->apiClient->callApi(
|
||||
$resourcePath,
|
||||
'PATCH',
|
||||
$queryParams,
|
||||
$httpBody,
|
||||
$headerParams,
|
||||
'\Swagger\Client\Model\Client',
|
||||
'/fake_classname_test'
|
||||
);
|
||||
|
||||
return [$this->apiClient->getSerializer()->deserialize($response, '\Swagger\Client\Model\Client', $httpHeader), $statusCode, $httpHeader];
|
||||
} catch (ApiException $e) {
|
||||
switch ($e->getCode()) {
|
||||
case 200:
|
||||
$data = $this->apiClient->getSerializer()->deserialize($e->getResponseBody(), '\Swagger\Client\Model\Client', $e->getResponseHeaders());
|
||||
$e->setResponseObject($data);
|
||||
break;
|
||||
}
|
||||
|
||||
throw $e;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user