forked from loafle/openapi-generator-original
Merge remote-tracking branch 'origin/master' into 3.4.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
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user