forked from loafle/openapi-generator-original
php: Update petstore
This commit is contained in:
parent
8f98a6d6f5
commit
a95ade6d2a
@ -4,7 +4,7 @@ This spec is mainly for testing Petstore server and contains fake endpoints, mod
|
||||
This PHP package is automatically generated by the [Swagger Codegen](https://github.com/swagger-api/swagger-codegen) project:
|
||||
|
||||
- API version: 1.0.0
|
||||
- Build date: 2016-08-05T11:24:33.550+02:00
|
||||
- Build date: 2016-08-29T21:41:18.885+03:00
|
||||
- Build package: class io.swagger.codegen.languages.PhpClientCodegen
|
||||
|
||||
## Requirements
|
||||
@ -78,7 +78,7 @@ Class | Method | HTTP request | Description
|
||||
------------ | ------------- | ------------- | -------------
|
||||
*FakeApi* | [**testClientModel**](docs/Api/FakeApi.md#testclientmodel) | **PATCH** /fake | To test \"client\" model
|
||||
*FakeApi* | [**testEndpointParameters**](docs/Api/FakeApi.md#testendpointparameters) | **POST** /fake | Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트
|
||||
*FakeApi* | [**testEnumQueryParameters**](docs/Api/FakeApi.md#testenumqueryparameters) | **GET** /fake | To test enum query parameters
|
||||
*FakeApi* | [**testEnumParameters**](docs/Api/FakeApi.md#testenumparameters) | **GET** /fake | To test enum parameters
|
||||
*PetApi* | [**addPet**](docs/Api/PetApi.md#addpet) | **POST** /pet | Add a new pet to the store
|
||||
*PetApi* | [**deletePet**](docs/Api/PetApi.md#deletepet) | **DELETE** /pet/{petId} | Deletes a pet
|
||||
*PetApi* | [**findPetsByStatus**](docs/Api/PetApi.md#findpetsbystatus) | **GET** /pet/findByStatus | Finds Pets by status
|
||||
@ -146,6 +146,10 @@ Class | Method | HTTP request | Description
|
||||
- **write:pets**: modify pets in your account
|
||||
- **read:pets**: read your pets
|
||||
|
||||
## http_basic_test
|
||||
|
||||
- **Type**: HTTP basic authentication
|
||||
|
||||
## api_key
|
||||
|
||||
- **Type**: API key
|
||||
|
@ -6,7 +6,7 @@ Method | HTTP request | Description
|
||||
------------- | ------------- | -------------
|
||||
[**testClientModel**](FakeApi.md#testClientModel) | **PATCH** /fake | To test \"client\" model
|
||||
[**testEndpointParameters**](FakeApi.md#testEndpointParameters) | **POST** /fake | Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트
|
||||
[**testEnumQueryParameters**](FakeApi.md#testEnumQueryParameters) | **GET** /fake | To test enum query parameters
|
||||
[**testEnumParameters**](FakeApi.md#testEnumParameters) | **GET** /fake | To test enum parameters
|
||||
|
||||
|
||||
# **testClientModel**
|
||||
@ -53,7 +53,7 @@ No authorization required
|
||||
[[Back to top]](#) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to Model list]](../../README.md#documentation-for-models) [[Back to README]](../../README.md)
|
||||
|
||||
# **testEndpointParameters**
|
||||
> testEndpointParameters($number, $double, $string, $byte, $integer, $int32, $int64, $float, $binary, $date, $date_time, $password)
|
||||
> testEndpointParameters($number, $double, $pattern_without_delimiter, $byte, $integer, $int32, $int64, $float, $string, $binary, $date, $date_time, $password)
|
||||
|
||||
Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트
|
||||
|
||||
@ -64,22 +64,27 @@ Fake endpoint for testing various parameters 假端點 偽のエンドポイン
|
||||
<?php
|
||||
require_once(__DIR__ . '/vendor/autoload.php');
|
||||
|
||||
// Configure HTTP basic authorization: http_basic_test
|
||||
Swagger\Client\Configuration::getDefaultConfiguration()->setUsername('YOUR_USERNAME');
|
||||
Swagger\Client\Configuration::getDefaultConfiguration()->setPassword('YOUR_PASSWORD');
|
||||
|
||||
$api_instance = new Swagger\Client\Api\FakeApi();
|
||||
$number = 3.4; // float | None
|
||||
$double = 1.2; // double | None
|
||||
$string = "string_example"; // string | None
|
||||
$pattern_without_delimiter = "pattern_without_delimiter_example"; // string | None
|
||||
$byte = "B"; // string | None
|
||||
$integer = 56; // int | None
|
||||
$int32 = 56; // int | None
|
||||
$int64 = 789; // int | None
|
||||
$float = 3.4; // float | None
|
||||
$string = "string_example"; // string | None
|
||||
$binary = "B"; // string | None
|
||||
$date = new \DateTime(); // \DateTime | None
|
||||
$date_time = new \DateTime(); // \DateTime | None
|
||||
$password = "password_example"; // string | None
|
||||
|
||||
try {
|
||||
$api_instance->testEndpointParameters($number, $double, $string, $byte, $integer, $int32, $int64, $float, $binary, $date, $date_time, $password);
|
||||
$api_instance->testEndpointParameters($number, $double, $pattern_without_delimiter, $byte, $integer, $int32, $int64, $float, $string, $binary, $date, $date_time, $password);
|
||||
} catch (Exception $e) {
|
||||
echo 'Exception when calling FakeApi->testEndpointParameters: ', $e->getMessage(), PHP_EOL;
|
||||
}
|
||||
@ -92,12 +97,13 @@ Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------
|
||||
**number** | **float**| None |
|
||||
**double** | **double**| None |
|
||||
**string** | **string**| None |
|
||||
**pattern_without_delimiter** | **string**| None |
|
||||
**byte** | **string**| None |
|
||||
**integer** | **int**| None | [optional]
|
||||
**int32** | **int**| None | [optional]
|
||||
**int64** | **int**| None | [optional]
|
||||
**float** | **float**| None | [optional]
|
||||
**string** | **string**| None | [optional]
|
||||
**binary** | **string**| None | [optional]
|
||||
**date** | **\DateTime**| None | [optional]
|
||||
**date_time** | **\DateTime**| None | [optional]
|
||||
@ -109,7 +115,7 @@ void (empty response body)
|
||||
|
||||
### Authorization
|
||||
|
||||
No authorization required
|
||||
[http_basic_test](../../README.md#http_basic_test)
|
||||
|
||||
### HTTP request headers
|
||||
|
||||
@ -118,10 +124,10 @@ No authorization required
|
||||
|
||||
[[Back to top]](#) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to Model list]](../../README.md#documentation-for-models) [[Back to README]](../../README.md)
|
||||
|
||||
# **testEnumQueryParameters**
|
||||
> testEnumQueryParameters($enum_query_string, $enum_query_integer, $enum_query_double)
|
||||
# **testEnumParameters**
|
||||
> testEnumParameters($enum_form_string_array, $enum_form_string, $enum_header_string_array, $enum_header_string, $enum_query_string_array, $enum_query_string, $enum_query_integer, $enum_query_double)
|
||||
|
||||
To test enum query parameters
|
||||
To test enum parameters
|
||||
|
||||
### Example
|
||||
```php
|
||||
@ -129,14 +135,19 @@ To test enum query parameters
|
||||
require_once(__DIR__ . '/vendor/autoload.php');
|
||||
|
||||
$api_instance = new Swagger\Client\Api\FakeApi();
|
||||
$enum_form_string_array = array("enum_form_string_array_example"); // string[] | Form parameter enum test (string array)
|
||||
$enum_form_string = "-efg"; // string | Form parameter enum test (string)
|
||||
$enum_header_string_array = array("enum_header_string_array_example"); // string[] | Header parameter enum test (string array)
|
||||
$enum_header_string = "-efg"; // string | Header parameter enum test (string)
|
||||
$enum_query_string_array = array("enum_query_string_array_example"); // string[] | Query parameter enum test (string array)
|
||||
$enum_query_string = "-efg"; // string | Query parameter enum test (string)
|
||||
$enum_query_integer = 3.4; // float | Query parameter enum test (double)
|
||||
$enum_query_double = 1.2; // double | Query parameter enum test (double)
|
||||
|
||||
try {
|
||||
$api_instance->testEnumQueryParameters($enum_query_string, $enum_query_integer, $enum_query_double);
|
||||
$api_instance->testEnumParameters($enum_form_string_array, $enum_form_string, $enum_header_string_array, $enum_header_string, $enum_query_string_array, $enum_query_string, $enum_query_integer, $enum_query_double);
|
||||
} catch (Exception $e) {
|
||||
echo 'Exception when calling FakeApi->testEnumQueryParameters: ', $e->getMessage(), PHP_EOL;
|
||||
echo 'Exception when calling FakeApi->testEnumParameters: ', $e->getMessage(), PHP_EOL;
|
||||
}
|
||||
?>
|
||||
```
|
||||
@ -145,6 +156,11 @@ try {
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------
|
||||
**enum_form_string_array** | [**string[]**](../Model/string.md)| Form parameter enum test (string array) | [optional]
|
||||
**enum_form_string** | **string**| Form parameter enum test (string) | [optional] [default to -efg]
|
||||
**enum_header_string_array** | [**string[]**](../Model/string.md)| Header parameter enum test (string array) | [optional]
|
||||
**enum_header_string** | **string**| Header parameter enum test (string) | [optional] [default to -efg]
|
||||
**enum_query_string_array** | [**string[]**](../Model/string.md)| Query parameter enum test (string array) | [optional]
|
||||
**enum_query_string** | **string**| Query parameter enum test (string) | [optional] [default to -efg]
|
||||
**enum_query_integer** | **float**| Query parameter enum test (double) | [optional]
|
||||
**enum_query_double** | **double**| Query parameter enum test (double) | [optional]
|
||||
|
@ -191,12 +191,13 @@ class FakeApi
|
||||
*
|
||||
* @param float $number None (required)
|
||||
* @param double $double None (required)
|
||||
* @param string $string None (required)
|
||||
* @param string $pattern_without_delimiter None (required)
|
||||
* @param string $byte None (required)
|
||||
* @param int $integer None (optional)
|
||||
* @param int $int32 None (optional)
|
||||
* @param int $int64 None (optional)
|
||||
* @param float $float None (optional)
|
||||
* @param string $string None (optional)
|
||||
* @param string $binary None (optional)
|
||||
* @param \DateTime $date None (optional)
|
||||
* @param \DateTime $date_time None (optional)
|
||||
@ -204,9 +205,9 @@ class FakeApi
|
||||
* @return void
|
||||
* @throws \Swagger\Client\ApiException on non-2xx response
|
||||
*/
|
||||
public function testEndpointParameters($number, $double, $string, $byte, $integer = null, $int32 = null, $int64 = null, $float = null, $binary = null, $date = null, $date_time = null, $password = null)
|
||||
public function testEndpointParameters($number, $double, $pattern_without_delimiter, $byte, $integer = null, $int32 = null, $int64 = null, $float = null, $string = null, $binary = null, $date = null, $date_time = null, $password = null)
|
||||
{
|
||||
list($response) = $this->testEndpointParametersWithHttpInfo($number, $double, $string, $byte, $integer, $int32, $int64, $float, $binary, $date, $date_time, $password);
|
||||
list($response) = $this->testEndpointParametersWithHttpInfo($number, $double, $pattern_without_delimiter, $byte, $integer, $int32, $int64, $float, $string, $binary, $date, $date_time, $password);
|
||||
return $response;
|
||||
}
|
||||
|
||||
@ -217,12 +218,13 @@ class FakeApi
|
||||
*
|
||||
* @param float $number None (required)
|
||||
* @param double $double None (required)
|
||||
* @param string $string None (required)
|
||||
* @param string $pattern_without_delimiter None (required)
|
||||
* @param string $byte None (required)
|
||||
* @param int $integer None (optional)
|
||||
* @param int $int32 None (optional)
|
||||
* @param int $int64 None (optional)
|
||||
* @param float $float None (optional)
|
||||
* @param string $string None (optional)
|
||||
* @param string $binary None (optional)
|
||||
* @param \DateTime $date None (optional)
|
||||
* @param \DateTime $date_time None (optional)
|
||||
@ -230,7 +232,7 @@ class FakeApi
|
||||
* @return Array of null, HTTP status code, HTTP response headers (array of strings)
|
||||
* @throws \Swagger\Client\ApiException on non-2xx response
|
||||
*/
|
||||
public function testEndpointParametersWithHttpInfo($number, $double, $string, $byte, $integer = null, $int32 = null, $int64 = null, $float = null, $binary = null, $date = null, $date_time = null, $password = null)
|
||||
public function testEndpointParametersWithHttpInfo($number, $double, $pattern_without_delimiter, $byte, $integer = null, $int32 = null, $int64 = null, $float = null, $string = null, $binary = null, $date = null, $date_time = null, $password = null)
|
||||
{
|
||||
// verify the required parameter 'number' is set
|
||||
if ($number === null) {
|
||||
@ -254,12 +256,12 @@ class FakeApi
|
||||
throw new \InvalidArgumentException('invalid value for "$double" when calling FakeApi.testEndpointParameters, must be bigger than or equal to 67.8.');
|
||||
}
|
||||
|
||||
// verify the required parameter 'string' is set
|
||||
if ($string === null) {
|
||||
throw new \InvalidArgumentException('Missing the required parameter $string when calling testEndpointParameters');
|
||||
// verify the required parameter 'pattern_without_delimiter' is set
|
||||
if ($pattern_without_delimiter === null) {
|
||||
throw new \InvalidArgumentException('Missing the required parameter $pattern_without_delimiter when calling testEndpointParameters');
|
||||
}
|
||||
if (!preg_match("/[a-z]/i", $string)) {
|
||||
throw new \InvalidArgumentException('invalid value for "string" when calling FakeApi.testEndpointParameters, must conform to the pattern /[a-z]/i.');
|
||||
if (!preg_match("/^[A-Z].*_/", $pattern_without_delimiter)) {
|
||||
throw new \InvalidArgumentException('invalid value for "pattern_without_delimiter" when calling FakeApi.testEndpointParameters, must conform to the pattern /^[A-Z].*_/.');
|
||||
}
|
||||
|
||||
// verify the required parameter 'byte' is set
|
||||
@ -284,6 +286,10 @@ class FakeApi
|
||||
throw new \InvalidArgumentException('invalid value for "$float" when calling FakeApi.testEndpointParameters, must be smaller than or equal to 987.6.');
|
||||
}
|
||||
|
||||
if (!is_null($string) && !preg_match("/[a-z]/i", $string)) {
|
||||
throw new \InvalidArgumentException('invalid value for "string" when calling FakeApi.testEndpointParameters, must conform to the pattern /[a-z]/i.');
|
||||
}
|
||||
|
||||
if (!is_null($password) && (strlen($password) > 64)) {
|
||||
throw new \InvalidArgumentException('invalid length for "$password" when calling FakeApi.testEndpointParameters, must be smaller than or equal to 64.');
|
||||
}
|
||||
@ -335,6 +341,10 @@ class FakeApi
|
||||
$formParams['string'] = $this->apiClient->getSerializer()->toFormValue($string);
|
||||
}
|
||||
// form params
|
||||
if ($pattern_without_delimiter !== null) {
|
||||
$formParams['pattern_without_delimiter'] = $this->apiClient->getSerializer()->toFormValue($pattern_without_delimiter);
|
||||
}
|
||||
// form params
|
||||
if ($byte !== null) {
|
||||
$formParams['byte'] = $this->apiClient->getSerializer()->toFormValue($byte);
|
||||
}
|
||||
@ -361,6 +371,10 @@ class FakeApi
|
||||
} elseif (count($formParams) > 0) {
|
||||
$httpBody = $formParams; // for HTTP post (form)
|
||||
}
|
||||
// this endpoint requires HTTP basic authentication
|
||||
if (strlen($this->apiClient->getConfig()->getUsername()) !== 0 or strlen($this->apiClient->getConfig()->getPassword()) !== 0) {
|
||||
$headerParams['Authorization'] = 'Basic ' . base64_encode($this->apiClient->getConfig()->getUsername() . ":" . $this->apiClient->getConfig()->getPassword());
|
||||
}
|
||||
// make the API Call
|
||||
try {
|
||||
list($response, $statusCode, $httpHeader) = $this->apiClient->callApi(
|
||||
@ -383,34 +397,44 @@ class FakeApi
|
||||
}
|
||||
|
||||
/**
|
||||
* Operation testEnumQueryParameters
|
||||
* Operation testEnumParameters
|
||||
*
|
||||
* To test enum query parameters
|
||||
* To test enum parameters
|
||||
*
|
||||
* @param string[] $enum_form_string_array Form parameter enum test (string array) (optional)
|
||||
* @param string $enum_form_string Form parameter enum test (string) (optional, default to -efg)
|
||||
* @param string[] $enum_header_string_array Header parameter enum test (string array) (optional)
|
||||
* @param string $enum_header_string Header parameter enum test (string) (optional, default to -efg)
|
||||
* @param string[] $enum_query_string_array Query parameter enum test (string array) (optional)
|
||||
* @param string $enum_query_string Query parameter enum test (string) (optional, default to -efg)
|
||||
* @param float $enum_query_integer Query parameter enum test (double) (optional)
|
||||
* @param double $enum_query_double Query parameter enum test (double) (optional)
|
||||
* @return void
|
||||
* @throws \Swagger\Client\ApiException on non-2xx response
|
||||
*/
|
||||
public function testEnumQueryParameters($enum_query_string = null, $enum_query_integer = null, $enum_query_double = null)
|
||||
public function testEnumParameters($enum_form_string_array = null, $enum_form_string = null, $enum_header_string_array = null, $enum_header_string = null, $enum_query_string_array = null, $enum_query_string = null, $enum_query_integer = null, $enum_query_double = null)
|
||||
{
|
||||
list($response) = $this->testEnumQueryParametersWithHttpInfo($enum_query_string, $enum_query_integer, $enum_query_double);
|
||||
list($response) = $this->testEnumParametersWithHttpInfo($enum_form_string_array, $enum_form_string, $enum_header_string_array, $enum_header_string, $enum_query_string_array, $enum_query_string, $enum_query_integer, $enum_query_double);
|
||||
return $response;
|
||||
}
|
||||
|
||||
/**
|
||||
* Operation testEnumQueryParametersWithHttpInfo
|
||||
* Operation testEnumParametersWithHttpInfo
|
||||
*
|
||||
* To test enum query parameters
|
||||
* To test enum parameters
|
||||
*
|
||||
* @param string[] $enum_form_string_array Form parameter enum test (string array) (optional)
|
||||
* @param string $enum_form_string Form parameter enum test (string) (optional, default to -efg)
|
||||
* @param string[] $enum_header_string_array Header parameter enum test (string array) (optional)
|
||||
* @param string $enum_header_string Header parameter enum test (string) (optional, default to -efg)
|
||||
* @param string[] $enum_query_string_array Query parameter enum test (string array) (optional)
|
||||
* @param string $enum_query_string Query parameter enum test (string) (optional, default to -efg)
|
||||
* @param float $enum_query_integer Query parameter enum test (double) (optional)
|
||||
* @param double $enum_query_double Query parameter enum test (double) (optional)
|
||||
* @return Array of null, HTTP status code, HTTP response headers (array of strings)
|
||||
* @throws \Swagger\Client\ApiException on non-2xx response
|
||||
*/
|
||||
public function testEnumQueryParametersWithHttpInfo($enum_query_string = null, $enum_query_integer = null, $enum_query_double = null)
|
||||
public function testEnumParametersWithHttpInfo($enum_form_string_array = null, $enum_form_string = null, $enum_header_string_array = null, $enum_header_string = null, $enum_query_string_array = null, $enum_query_string = null, $enum_query_integer = null, $enum_query_double = null)
|
||||
{
|
||||
// parse inputs
|
||||
$resourcePath = "/fake";
|
||||
@ -424,16 +448,42 @@ class FakeApi
|
||||
}
|
||||
$headerParams['Content-Type'] = $this->apiClient->selectHeaderContentType(array('application/json'));
|
||||
|
||||
// query params
|
||||
if (is_array($enum_query_string_array)) {
|
||||
$enum_query_string_array = $this->apiClient->getSerializer()->serializeCollection($enum_query_string_array, 'csv', true);
|
||||
}
|
||||
if ($enum_query_string_array !== null) {
|
||||
$queryParams['enum_query_string_array'] = $this->apiClient->getSerializer()->toQueryValue($enum_query_string_array);
|
||||
}
|
||||
// query params
|
||||
if ($enum_query_string !== null) {
|
||||
$queryParams['enum_query_string'] = $this->apiClient->getSerializer()->toQueryValue($enum_query_string);
|
||||
}
|
||||
// query params
|
||||
if ($enum_query_integer !== null) {
|
||||
$queryParams['enum_query_integer'] = $this->apiClient->getSerializer()->toQueryValue($enum_query_integer);
|
||||
}
|
||||
// header params
|
||||
if (is_array($enum_header_string_array)) {
|
||||
$enum_header_string_array = $this->apiClient->getSerializer()->serializeCollection($enum_header_string_array, 'csv');
|
||||
}
|
||||
if ($enum_header_string_array !== null) {
|
||||
$headerParams['enum_header_string_array'] = $this->apiClient->getSerializer()->toHeaderValue($enum_header_string_array);
|
||||
}
|
||||
// header params
|
||||
if ($enum_header_string !== null) {
|
||||
$headerParams['enum_header_string'] = $this->apiClient->getSerializer()->toHeaderValue($enum_header_string);
|
||||
}
|
||||
// default format to json
|
||||
$resourcePath = str_replace("{format}", "json", $resourcePath);
|
||||
|
||||
// form params
|
||||
if ($enum_query_string !== null) {
|
||||
$formParams['enum_query_string'] = $this->apiClient->getSerializer()->toFormValue($enum_query_string);
|
||||
if ($enum_form_string_array !== null) {
|
||||
$formParams['enum_form_string_array'] = $this->apiClient->getSerializer()->toFormValue($enum_form_string_array);
|
||||
}
|
||||
// form params
|
||||
if ($enum_form_string !== null) {
|
||||
$formParams['enum_form_string'] = $this->apiClient->getSerializer()->toFormValue($enum_form_string);
|
||||
}
|
||||
// form params
|
||||
if ($enum_query_double !== null) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user