forked from loafle/openapi-generator-original
Merge remote-tracking branch 'origin/3.4.x' into 4.0.x
This commit is contained in:
@@ -2517,6 +2517,253 @@ class FakeApi
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Operation testGroupParameters
|
||||
*
|
||||
* Fake endpoint to test group parameters (optional)
|
||||
*
|
||||
* Note: the input parameter is an associative array with the keys listed as the parameter name below
|
||||
*
|
||||
* @param int $string_group String in group parameters (optional)
|
||||
* @param bool $boolean_group Boolean in group parameters (optional)
|
||||
* @param int $int64_group Integer in group parameters (optional)
|
||||
*
|
||||
* @throws \OpenAPI\Client\ApiException on non-2xx response
|
||||
* @throws \InvalidArgumentException
|
||||
* @return void
|
||||
*/
|
||||
public function testGroupParameters($associative_array)
|
||||
{
|
||||
$this->testGroupParametersWithHttpInfo($associative_array);
|
||||
}
|
||||
|
||||
/**
|
||||
* Operation testGroupParametersWithHttpInfo
|
||||
*
|
||||
* Fake endpoint to test group parameters (optional)
|
||||
*
|
||||
* Note: the inpput parameter is an associative array with the keys listed as the parameter name below
|
||||
*
|
||||
* @param int $string_group String in group parameters (optional)
|
||||
* @param bool $boolean_group Boolean in group parameters (optional)
|
||||
* @param int $int64_group Integer in group parameters (optional)
|
||||
*
|
||||
* @throws \OpenAPI\Client\ApiException on non-2xx response
|
||||
* @throws \InvalidArgumentException
|
||||
* @return array of null, HTTP status code, HTTP response headers (array of strings)
|
||||
*/
|
||||
public function testGroupParametersWithHttpInfo($associative_array)
|
||||
{
|
||||
$request = $this->testGroupParametersRequest($associative_array['string_group'], $associative_array['boolean_group'], $associative_array['int64_group']);
|
||||
|
||||
try {
|
||||
$options = $this->createHttpClientOption();
|
||||
try {
|
||||
$response = $this->client->send($request, $options);
|
||||
} catch (RequestException $e) {
|
||||
throw new ApiException(
|
||||
"[{$e->getCode()}] {$e->getMessage()}",
|
||||
$e->getCode(),
|
||||
$e->getResponse() ? $e->getResponse()->getHeaders() : null,
|
||||
$e->getResponse() ? $e->getResponse()->getBody()->getContents() : null
|
||||
);
|
||||
}
|
||||
|
||||
$statusCode = $response->getStatusCode();
|
||||
|
||||
if ($statusCode < 200 || $statusCode > 299) {
|
||||
throw new ApiException(
|
||||
sprintf(
|
||||
'[%d] Error connecting to the API (%s)',
|
||||
$statusCode,
|
||||
$request->getUri()
|
||||
),
|
||||
$statusCode,
|
||||
$response->getHeaders(),
|
||||
$response->getBody()
|
||||
);
|
||||
}
|
||||
|
||||
return [null, $statusCode, $response->getHeaders()];
|
||||
|
||||
} catch (ApiException $e) {
|
||||
switch ($e->getCode()) {
|
||||
}
|
||||
throw $e;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Operation testGroupParametersAsync
|
||||
*
|
||||
* Fake endpoint to test group parameters (optional)
|
||||
*
|
||||
* Note: the inpput parameter is an associative array with the keys listed as the parameter name below
|
||||
*
|
||||
* @param int $string_group String in group parameters (optional)
|
||||
* @param bool $boolean_group Boolean in group parameters (optional)
|
||||
* @param int $int64_group Integer in group parameters (optional)
|
||||
*
|
||||
* @throws \InvalidArgumentException
|
||||
* @return \GuzzleHttp\Promise\PromiseInterface
|
||||
*/
|
||||
public function testGroupParametersAsync($associative_array)
|
||||
{
|
||||
return $this->testGroupParametersAsyncWithHttpInfo($associative_array)
|
||||
->then(
|
||||
function ($response) {
|
||||
return $response[0];
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Operation testGroupParametersAsyncWithHttpInfo
|
||||
*
|
||||
* Fake endpoint to test group parameters (optional)
|
||||
*
|
||||
* Note: the inpput parameter is an associative array with the keys listed as the parameter name below
|
||||
*
|
||||
* @param int $string_group String in group parameters (optional)
|
||||
* @param bool $boolean_group Boolean in group parameters (optional)
|
||||
* @param int $int64_group Integer in group parameters (optional)
|
||||
*
|
||||
* @throws \InvalidArgumentException
|
||||
* @return \GuzzleHttp\Promise\PromiseInterface
|
||||
*/
|
||||
public function testGroupParametersAsyncWithHttpInfo($associative_array)
|
||||
{
|
||||
$returnType = '';
|
||||
$request = $this->testGroupParametersRequest($associative_array);
|
||||
|
||||
return $this->client
|
||||
->sendAsync($request, $this->createHttpClientOption())
|
||||
->then(
|
||||
function ($response) use ($returnType) {
|
||||
return [null, $response->getStatusCode(), $response->getHeaders()];
|
||||
},
|
||||
function ($exception) {
|
||||
$response = $exception->getResponse();
|
||||
$statusCode = $response->getStatusCode();
|
||||
throw new ApiException(
|
||||
sprintf(
|
||||
'[%d] Error connecting to the API (%s)',
|
||||
$statusCode,
|
||||
$exception->getRequest()->getUri()
|
||||
),
|
||||
$statusCode,
|
||||
$response->getHeaders(),
|
||||
$response->getBody()
|
||||
);
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Create request for operation 'testGroupParameters'
|
||||
*
|
||||
* Note: the input parameter is an associative array with the keys listed as the parameter name below
|
||||
*
|
||||
* @param int $string_group String in group parameters (optional)
|
||||
* @param bool $boolean_group Boolean in group parameters (optional)
|
||||
* @param int $int64_group Integer in group parameters (optional)
|
||||
*
|
||||
* @throws \InvalidArgumentException
|
||||
* @return \GuzzleHttp\Psr7\Request
|
||||
*/
|
||||
protected function testGroupParametersRequest($associative_array)
|
||||
{
|
||||
// unbox the parameters from the associative array
|
||||
$string_group = array_key_exists('string_group', $associative_array) ? $associative_array['string_group'] : null;
|
||||
$boolean_group = array_key_exists('boolean_group', $associative_array) ? $associative_array['boolean_group'] : null;
|
||||
$int64_group = array_key_exists('int64_group', $associative_array) ? $associative_array['int64_group'] : null;
|
||||
|
||||
|
||||
$resourcePath = '/fake';
|
||||
$formParams = [];
|
||||
$queryParams = [];
|
||||
$headerParams = [];
|
||||
$httpBody = '';
|
||||
$multipart = false;
|
||||
|
||||
// query params
|
||||
if ($string_group !== null) {
|
||||
$queryParams['string_group'] = ObjectSerializer::toQueryValue($string_group);
|
||||
}
|
||||
// query params
|
||||
if ($int64_group !== null) {
|
||||
$queryParams['int64_group'] = ObjectSerializer::toQueryValue($int64_group);
|
||||
}
|
||||
// header params
|
||||
if ($boolean_group !== null) {
|
||||
$headerParams['boolean_group'] = ObjectSerializer::toHeaderValue($boolean_group);
|
||||
}
|
||||
|
||||
|
||||
// body params
|
||||
$_tempBody = null;
|
||||
|
||||
if ($multipart) {
|
||||
$headers = $this->headerSelector->selectHeadersForMultipart(
|
||||
[]
|
||||
);
|
||||
} else {
|
||||
$headers = $this->headerSelector->selectHeaders(
|
||||
[],
|
||||
[]
|
||||
);
|
||||
}
|
||||
|
||||
// for model (json/xml)
|
||||
if (isset($_tempBody)) {
|
||||
// $_tempBody is the method argument, if present
|
||||
if ($headers['Content-Type'] === 'application/json') {
|
||||
$httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($_tempBody));
|
||||
} else {
|
||||
$httpBody = $_tempBody;
|
||||
}
|
||||
} elseif (count($formParams) > 0) {
|
||||
if ($multipart) {
|
||||
$multipartContents = [];
|
||||
foreach ($formParams as $formParamName => $formParamValue) {
|
||||
$multipartContents[] = [
|
||||
'name' => $formParamName,
|
||||
'contents' => $formParamValue
|
||||
];
|
||||
}
|
||||
// for HTTP post (form)
|
||||
$httpBody = new MultipartStream($multipartContents);
|
||||
|
||||
} elseif ($headers['Content-Type'] === 'application/json') {
|
||||
$httpBody = \GuzzleHttp\json_encode($formParams);
|
||||
|
||||
} else {
|
||||
// for HTTP post (form)
|
||||
$httpBody = \GuzzleHttp\Psr7\build_query($formParams);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
$defaultHeaders = [];
|
||||
if ($this->config->getUserAgent()) {
|
||||
$defaultHeaders['User-Agent'] = $this->config->getUserAgent();
|
||||
}
|
||||
|
||||
$headers = array_merge(
|
||||
$defaultHeaders,
|
||||
$headerParams,
|
||||
$headers
|
||||
);
|
||||
|
||||
$query = \GuzzleHttp\Psr7\build_query($queryParams);
|
||||
return new Request(
|
||||
'DELETE',
|
||||
$this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''),
|
||||
$headers,
|
||||
$httpBody
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Operation testInlineAdditionalProperties
|
||||
*
|
||||
|
||||
@@ -69,7 +69,9 @@ class FormatTest implements ModelInterface, ArrayAccess
|
||||
'date' => '\DateTime',
|
||||
'date_time' => '\DateTime',
|
||||
'uuid' => 'string',
|
||||
'password' => 'string'
|
||||
'password' => 'string',
|
||||
'pattern_with_digits' => 'string',
|
||||
'pattern_with_digits_and_delimiter' => 'string'
|
||||
];
|
||||
|
||||
/**
|
||||
@@ -90,7 +92,9 @@ class FormatTest implements ModelInterface, ArrayAccess
|
||||
'date' => 'date',
|
||||
'date_time' => 'date-time',
|
||||
'uuid' => 'uuid',
|
||||
'password' => 'password'
|
||||
'password' => 'password',
|
||||
'pattern_with_digits' => null,
|
||||
'pattern_with_digits_and_delimiter' => null
|
||||
];
|
||||
|
||||
/**
|
||||
@@ -132,7 +136,9 @@ class FormatTest implements ModelInterface, ArrayAccess
|
||||
'date' => 'date',
|
||||
'date_time' => 'dateTime',
|
||||
'uuid' => 'uuid',
|
||||
'password' => 'password'
|
||||
'password' => 'password',
|
||||
'pattern_with_digits' => 'pattern_with_digits',
|
||||
'pattern_with_digits_and_delimiter' => 'pattern_with_digits_and_delimiter'
|
||||
];
|
||||
|
||||
/**
|
||||
@@ -153,7 +159,9 @@ class FormatTest implements ModelInterface, ArrayAccess
|
||||
'date' => 'setDate',
|
||||
'date_time' => 'setDateTime',
|
||||
'uuid' => 'setUuid',
|
||||
'password' => 'setPassword'
|
||||
'password' => 'setPassword',
|
||||
'pattern_with_digits' => 'setPatternWithDigits',
|
||||
'pattern_with_digits_and_delimiter' => 'setPatternWithDigitsAndDelimiter'
|
||||
];
|
||||
|
||||
/**
|
||||
@@ -174,7 +182,9 @@ class FormatTest implements ModelInterface, ArrayAccess
|
||||
'date' => 'getDate',
|
||||
'date_time' => 'getDateTime',
|
||||
'uuid' => 'getUuid',
|
||||
'password' => 'getPassword'
|
||||
'password' => 'getPassword',
|
||||
'pattern_with_digits' => 'getPatternWithDigits',
|
||||
'pattern_with_digits_and_delimiter' => 'getPatternWithDigitsAndDelimiter'
|
||||
];
|
||||
|
||||
/**
|
||||
@@ -250,6 +260,8 @@ class FormatTest implements ModelInterface, ArrayAccess
|
||||
$this->container['date_time'] = isset($data['date_time']) ? $data['date_time'] : null;
|
||||
$this->container['uuid'] = isset($data['uuid']) ? $data['uuid'] : null;
|
||||
$this->container['password'] = isset($data['password']) ? $data['password'] : null;
|
||||
$this->container['pattern_with_digits'] = isset($data['pattern_with_digits']) ? $data['pattern_with_digits'] : null;
|
||||
$this->container['pattern_with_digits_and_delimiter'] = isset($data['pattern_with_digits_and_delimiter']) ? $data['pattern_with_digits_and_delimiter'] : null;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -325,6 +337,14 @@ class FormatTest implements ModelInterface, ArrayAccess
|
||||
$invalidProperties[] = "invalid value for 'password', the character length must be bigger than or equal to 10.";
|
||||
}
|
||||
|
||||
if (!is_null($this->container['pattern_with_digits']) && !preg_match("/^\\d{10}$/", $this->container['pattern_with_digits'])) {
|
||||
$invalidProperties[] = "invalid value for 'pattern_with_digits', must be conform to the pattern /^\\d{10}$/.";
|
||||
}
|
||||
|
||||
if (!is_null($this->container['pattern_with_digits_and_delimiter']) && !preg_match("/^image_\\d{1,3}$/i", $this->container['pattern_with_digits_and_delimiter'])) {
|
||||
$invalidProperties[] = "invalid value for 'pattern_with_digits_and_delimiter', must be conform to the pattern /^image_\\d{1,3}$/i.";
|
||||
}
|
||||
|
||||
return $invalidProperties;
|
||||
}
|
||||
|
||||
@@ -703,6 +723,64 @@ class FormatTest implements ModelInterface, ArrayAccess
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets pattern_with_digits
|
||||
*
|
||||
* @return string|null
|
||||
*/
|
||||
public function getPatternWithDigits()
|
||||
{
|
||||
return $this->container['pattern_with_digits'];
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets pattern_with_digits
|
||||
*
|
||||
* @param string|null $pattern_with_digits A string that is a 10 digit number. Can have leading zeros.
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function setPatternWithDigits($pattern_with_digits)
|
||||
{
|
||||
|
||||
if (!is_null($pattern_with_digits) && (!preg_match("/^\\d{10}$/", $pattern_with_digits))) {
|
||||
throw new \InvalidArgumentException("invalid value for $pattern_with_digits when calling FormatTest., must conform to the pattern /^\\d{10}$/.");
|
||||
}
|
||||
|
||||
$this->container['pattern_with_digits'] = $pattern_with_digits;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets pattern_with_digits_and_delimiter
|
||||
*
|
||||
* @return string|null
|
||||
*/
|
||||
public function getPatternWithDigitsAndDelimiter()
|
||||
{
|
||||
return $this->container['pattern_with_digits_and_delimiter'];
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets pattern_with_digits_and_delimiter
|
||||
*
|
||||
* @param string|null $pattern_with_digits_and_delimiter A string starting with 'image_' (case insensitive) and one to three digits following i.e. Image_01.
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function setPatternWithDigitsAndDelimiter($pattern_with_digits_and_delimiter)
|
||||
{
|
||||
|
||||
if (!is_null($pattern_with_digits_and_delimiter) && (!preg_match("/^image_\\d{1,3}$/i", $pattern_with_digits_and_delimiter))) {
|
||||
throw new \InvalidArgumentException("invalid value for $pattern_with_digits_and_delimiter when calling FormatTest., must conform to the pattern /^image_\\d{1,3}$/i.");
|
||||
}
|
||||
|
||||
$this->container['pattern_with_digits_and_delimiter'] = $pattern_with_digits_and_delimiter;
|
||||
|
||||
return $this;
|
||||
}
|
||||
/**
|
||||
* Returns true if offset exists. False otherwise.
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user