forked from loafle/openapi-generator-original
[PHP] Allow selecting Content-Type (#13769)
* [PHP] allow selecting Content-Type * [AUTOGENERATED] update samples * [PHP] Fixed tests for HeaderSelector * [PHP] revert Content-Type validation * [AUTOGENERATED] update samples
This commit is contained in:
parent
a66874f8f9
commit
824b2aa5f3
@ -1,6 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
/**
|
/**
|
||||||
* ApiException
|
* HeaderSelector
|
||||||
* PHP version 7.4
|
* PHP version 7.4
|
||||||
*
|
*
|
||||||
* @category Class
|
* @category Class
|
||||||
@ -18,10 +18,8 @@
|
|||||||
|
|
||||||
namespace {{invokerPackage}};
|
namespace {{invokerPackage}};
|
||||||
|
|
||||||
use \Exception;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* ApiException Class Doc Comment
|
* HeaderSelector Class Doc Comment
|
||||||
*
|
*
|
||||||
* @category Class
|
* @category Class
|
||||||
* @package {{invokerPackage}}
|
* @package {{invokerPackage}}
|
||||||
@ -32,10 +30,11 @@ class HeaderSelector
|
|||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* @param string[] $accept
|
* @param string[] $accept
|
||||||
* @param string[] $contentTypes
|
* @param string $contentType
|
||||||
* @return array
|
* @param bool $isMultipart
|
||||||
|
* @return string[]
|
||||||
*/
|
*/
|
||||||
public function selectHeaders($accept, $contentTypes)
|
public function selectHeaders(array $accept, string $contentType, bool $isMultipart): array
|
||||||
{
|
{
|
||||||
$headers = [];
|
$headers = [];
|
||||||
|
|
||||||
@ -43,20 +42,13 @@ class HeaderSelector
|
|||||||
if ($accept !== null) {
|
if ($accept !== null) {
|
||||||
$headers['Accept'] = $accept;
|
$headers['Accept'] = $accept;
|
||||||
}
|
}
|
||||||
|
if(!$isMultipart) {
|
||||||
|
if($contentType === '') {
|
||||||
|
$contentType = 'application/json';
|
||||||
|
}
|
||||||
|
$headers['Content-Type'] = $contentType;
|
||||||
|
}
|
||||||
|
|
||||||
$headers['Content-Type'] = $this->selectContentTypeHeader($contentTypes);
|
|
||||||
return $headers;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param string[] $accept
|
|
||||||
* @return array
|
|
||||||
*/
|
|
||||||
public function selectHeadersForMultipart($accept)
|
|
||||||
{
|
|
||||||
$headers = $this->selectHeaders($accept, []);
|
|
||||||
|
|
||||||
unset($headers['Content-Type']);
|
|
||||||
return $headers;
|
return $headers;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -77,22 +69,4 @@ class HeaderSelector
|
|||||||
return implode(',', $accept);
|
return implode(',', $accept);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Return the content type based on an array of content-type provided
|
|
||||||
*
|
|
||||||
* @param string[] $contentType Array fo content-type
|
|
||||||
*
|
|
||||||
* @return string Content-Type (e.g. application/json)
|
|
||||||
*/
|
|
||||||
private function selectContentTypeHeader($contentType)
|
|
||||||
{
|
|
||||||
if (count($contentType) === 0 || (count($contentType) === 1 && $contentType[0] === '')) {
|
|
||||||
return 'application/json';
|
|
||||||
} elseif (preg_grep("/application\/json/i", $contentType)) {
|
|
||||||
return 'application/json';
|
|
||||||
} else {
|
|
||||||
return implode(',', $contentType);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@ -60,7 +60,16 @@ use {{invokerPackage}}\ObjectSerializer;
|
|||||||
*/
|
*/
|
||||||
protected $hostIndex;
|
protected $hostIndex;
|
||||||
|
|
||||||
/**
|
/** @var string[] $contentTypes **/
|
||||||
|
public const contentTypes = [{{#operation}}
|
||||||
|
'{{{operationId}}}' => [{{#consumes}}
|
||||||
|
'{{{mediaType}}}',{{/consumes}}
|
||||||
|
{{^consumes}}
|
||||||
|
'application/json',
|
||||||
|
{{/consumes}} ],{{/operation}}
|
||||||
|
];
|
||||||
|
|
||||||
|
/**
|
||||||
* @param ClientInterface $client
|
* @param ClientInterface $client
|
||||||
* @param Configuration $config
|
* @param Configuration $config
|
||||||
* @param HeaderSelector $selector
|
* @param HeaderSelector $selector
|
||||||
@ -151,6 +160,7 @@ use {{invokerPackage}}\ObjectSerializer;
|
|||||||
* @param array $variables Associative array of variables to pass to the host. Defaults to empty array.
|
* @param array $variables Associative array of variables to pass to the host. Defaults to empty array.
|
||||||
{{/-first}}
|
{{/-first}}
|
||||||
{{/servers}}
|
{{/servers}}
|
||||||
|
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['{{{operationId}}}'] to see the possible values for this operation
|
||||||
*
|
*
|
||||||
* @throws \{{invokerPackage}}\ApiException on non-2xx response
|
* @throws \{{invokerPackage}}\ApiException on non-2xx response
|
||||||
* @throws \InvalidArgumentException
|
* @throws \InvalidArgumentException
|
||||||
@ -159,9 +169,9 @@ use {{invokerPackage}}\ObjectSerializer;
|
|||||||
* @deprecated
|
* @deprecated
|
||||||
{{/isDeprecated}}
|
{{/isDeprecated}}
|
||||||
*/
|
*/
|
||||||
public function {{operationId}}({{^vendorExtensions.x-group-parameters}}{{#allParams}}${{paramName}}{{^required}} = {{#defaultValue}}{{{.}}}{{/defaultValue}}{{^defaultValue}}null{{/defaultValue}}{{/required}}{{^-last}}, {{/-last}}{{/allParams}}{{#servers}}{{#-first}}{{#allParams}}{{#-first}}, {{/-first}}{{/allParams}}?int $hostIndex = null, array $variables = []{{/-first}}{{/servers}}{{/vendorExtensions.x-group-parameters}}{{#vendorExtensions.x-group-parameters}}$associative_array{{/vendorExtensions.x-group-parameters}})
|
public function {{operationId}}({{^vendorExtensions.x-group-parameters}}{{#allParams}}${{paramName}}{{^required}} = {{#defaultValue}}{{{.}}}{{/defaultValue}}{{^defaultValue}}null{{/defaultValue}}{{/required}}, {{/allParams}}{{#servers}}{{#-first}}?int $hostIndex = null, array $variables = [], {{/-first}}{{/servers}}string $contentType = self::contentTypes['{{{operationId}}}'][0]{{/vendorExtensions.x-group-parameters}}{{#vendorExtensions.x-group-parameters}}$associative_array{{/vendorExtensions.x-group-parameters}})
|
||||||
{
|
{
|
||||||
{{#returnType}}list($response) = {{/returnType}}$this->{{operationId}}WithHttpInfo({{^vendorExtensions.x-group-parameters}}{{#allParams}}${{paramName}}{{^-last}}, {{/-last}}{{/allParams}}{{#servers}}{{#-first}}{{#allParams}}{{#-first}}, {{/-first}}{{/allParams}}$hostIndex, $variables{{/-first}}{{/servers}}{{/vendorExtensions.x-group-parameters}}{{#vendorExtensions.x-group-parameters}}$associative_array{{/vendorExtensions.x-group-parameters}});{{#returnType}}
|
{{#returnType}}list($response) = {{/returnType}}$this->{{operationId}}WithHttpInfo({{^vendorExtensions.x-group-parameters}}{{#allParams}}${{paramName}}, {{/allParams}}{{#servers}}{{#-first}}$hostIndex, $variables, {{/-first}}{{/servers}}$contentType{{/vendorExtensions.x-group-parameters}}{{#vendorExtensions.x-group-parameters}}$associative_array{{/vendorExtensions.x-group-parameters}});{{#returnType}}
|
||||||
return $response;{{/returnType}}
|
return $response;{{/returnType}}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -209,6 +219,7 @@ use {{invokerPackage}}\ObjectSerializer;
|
|||||||
* @param array $variables Associative array of variables to pass to the host. Defaults to empty array.
|
* @param array $variables Associative array of variables to pass to the host. Defaults to empty array.
|
||||||
{{/-first}}
|
{{/-first}}
|
||||||
{{/servers}}
|
{{/servers}}
|
||||||
|
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['{{{operationId}}}'] to see the possible values for this operation
|
||||||
*
|
*
|
||||||
* @throws \{{invokerPackage}}\ApiException on non-2xx response
|
* @throws \{{invokerPackage}}\ApiException on non-2xx response
|
||||||
* @throws \InvalidArgumentException
|
* @throws \InvalidArgumentException
|
||||||
@ -217,9 +228,9 @@ use {{invokerPackage}}\ObjectSerializer;
|
|||||||
* @deprecated
|
* @deprecated
|
||||||
{{/isDeprecated}}
|
{{/isDeprecated}}
|
||||||
*/
|
*/
|
||||||
public function {{operationId}}WithHttpInfo({{^vendorExtensions.x-group-parameters}}{{#allParams}}${{paramName}}{{^required}} = {{#defaultValue}}{{{.}}}{{/defaultValue}}{{^defaultValue}}null{{/defaultValue}}{{/required}}{{^-last}}, {{/-last}}{{/allParams}}{{#servers}}{{#-first}}{{#allParams}}{{#-first}}, {{/-first}}{{/allParams}}?int $hostIndex = null, array $variables = []{{/-first}}{{/servers}}{{/vendorExtensions.x-group-parameters}}{{#vendorExtensions.x-group-parameters}}$associative_array{{/vendorExtensions.x-group-parameters}})
|
public function {{operationId}}WithHttpInfo({{^vendorExtensions.x-group-parameters}}{{#allParams}}${{paramName}}{{^required}} = {{#defaultValue}}{{{.}}}{{/defaultValue}}{{^defaultValue}}null{{/defaultValue}}{{/required}}, {{/allParams}}{{#servers}}{{#-first}}?int $hostIndex = null, array $variables = [], {{/-first}}{{/servers}}string $contentType = self::contentTypes['{{{operationId}}}'][0]{{/vendorExtensions.x-group-parameters}}{{#vendorExtensions.x-group-parameters}}$associative_array{{/vendorExtensions.x-group-parameters}})
|
||||||
{
|
{
|
||||||
$request = $this->{{operationId}}Request({{^vendorExtensions.x-group-parameters}}{{#allParams}}${{paramName}}{{^-last}}, {{/-last}}{{/allParams}}{{#servers}}{{#-first}}{{#allParams}}{{#-first}}, {{/-first}}{{/allParams}}$hostIndex, $variables{{/-first}}{{/servers}}{{/vendorExtensions.x-group-parameters}}{{#vendorExtensions.x-group-parameters}}$associative_array{{/vendorExtensions.x-group-parameters}});
|
$request = $this->{{operationId}}Request({{^vendorExtensions.x-group-parameters}}{{#allParams}}${{paramName}}, {{/allParams}}{{#servers}}{{#-first}}$hostIndex, $variables, {{/-first}}{{/servers}}$contentType{{/vendorExtensions.x-group-parameters}}{{#vendorExtensions.x-group-parameters}}$associative_array{{/vendorExtensions.x-group-parameters}});
|
||||||
|
|
||||||
try {
|
try {
|
||||||
$options = $this->createHttpClientOption();
|
$options = $this->createHttpClientOption();
|
||||||
@ -367,6 +378,7 @@ use {{invokerPackage}}\ObjectSerializer;
|
|||||||
* @param array $variables Associative array of variables to pass to the host. Defaults to empty array.
|
* @param array $variables Associative array of variables to pass to the host. Defaults to empty array.
|
||||||
{{/-first}}
|
{{/-first}}
|
||||||
{{/servers}}
|
{{/servers}}
|
||||||
|
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['{{{operationId}}}'] to see the possible values for this operation
|
||||||
*
|
*
|
||||||
* @throws \InvalidArgumentException
|
* @throws \InvalidArgumentException
|
||||||
* @return \GuzzleHttp\Promise\PromiseInterface
|
* @return \GuzzleHttp\Promise\PromiseInterface
|
||||||
@ -374,9 +386,9 @@ use {{invokerPackage}}\ObjectSerializer;
|
|||||||
* @deprecated
|
* @deprecated
|
||||||
{{/isDeprecated}}
|
{{/isDeprecated}}
|
||||||
*/
|
*/
|
||||||
public function {{operationId}}Async({{^vendorExtensions.x-group-parameters}}{{#allParams}}${{paramName}}{{^required}} = {{#defaultValue}}{{{.}}}{{/defaultValue}}{{^defaultValue}}null{{/defaultValue}}{{/required}}{{^-last}}, {{/-last}}{{/allParams}}{{#servers}}{{#-first}}{{#allParams}}{{#-first}}, {{/-first}}{{/allParams}}?int $hostIndex = null, array $variables = []{{/-first}}{{/servers}}{{/vendorExtensions.x-group-parameters}}{{#vendorExtensions.x-group-parameters}}$associative_array{{/vendorExtensions.x-group-parameters}})
|
public function {{operationId}}Async({{^vendorExtensions.x-group-parameters}}{{#allParams}}${{paramName}}{{^required}} = {{#defaultValue}}{{{.}}}{{/defaultValue}}{{^defaultValue}}null{{/defaultValue}}{{/required}}, {{/allParams}}{{#servers}}{{#-first}}?int $hostIndex = null, array $variables = [], {{/-first}}{{/servers}}string $contentType = self::contentTypes['{{{operationId}}}'][0]{{/vendorExtensions.x-group-parameters}}{{#vendorExtensions.x-group-parameters}}$associative_array{{/vendorExtensions.x-group-parameters}})
|
||||||
{
|
{
|
||||||
return $this->{{operationId}}AsyncWithHttpInfo({{^vendorExtensions.x-group-parameters}}{{#allParams}}${{paramName}}{{^-last}}, {{/-last}}{{/allParams}}{{#servers}}{{#-first}}{{#allParams}}{{#-first}}, {{/-first}}{{/allParams}}$hostIndex, $variables{{/-first}}{{/servers}}{{/vendorExtensions.x-group-parameters}}{{#vendorExtensions.x-group-parameters}}$associative_array{{/vendorExtensions.x-group-parameters}})
|
return $this->{{operationId}}AsyncWithHttpInfo({{^vendorExtensions.x-group-parameters}}{{#allParams}}${{paramName}}, {{/allParams}}{{#servers}}{{#-first}}$hostIndex, $variables, {{/-first}}{{/servers}}$contentType{{/vendorExtensions.x-group-parameters}}{{#vendorExtensions.x-group-parameters}}$associative_array{{/vendorExtensions.x-group-parameters}})
|
||||||
->then(
|
->then(
|
||||||
function ($response) {
|
function ($response) {
|
||||||
return $response[0];
|
return $response[0];
|
||||||
@ -428,6 +440,7 @@ use {{invokerPackage}}\ObjectSerializer;
|
|||||||
* @param array $variables Associative array of variables to pass to the host. Defaults to empty array.
|
* @param array $variables Associative array of variables to pass to the host. Defaults to empty array.
|
||||||
{{/-first}}
|
{{/-first}}
|
||||||
{{/servers}}
|
{{/servers}}
|
||||||
|
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['{{{operationId}}}'] to see the possible values for this operation
|
||||||
*
|
*
|
||||||
* @throws \InvalidArgumentException
|
* @throws \InvalidArgumentException
|
||||||
* @return \GuzzleHttp\Promise\PromiseInterface
|
* @return \GuzzleHttp\Promise\PromiseInterface
|
||||||
@ -435,10 +448,10 @@ use {{invokerPackage}}\ObjectSerializer;
|
|||||||
* @deprecated
|
* @deprecated
|
||||||
{{/isDeprecated}}
|
{{/isDeprecated}}
|
||||||
*/
|
*/
|
||||||
public function {{operationId}}AsyncWithHttpInfo({{^vendorExtensions.x-group-parameters}}{{#allParams}}${{paramName}}{{^required}} = {{#defaultValue}}{{{.}}}{{/defaultValue}}{{^defaultValue}}null{{/defaultValue}}{{/required}}{{^-last}}, {{/-last}}{{/allParams}}{{#servers}}{{#-first}}{{#allParams}}{{#-first}}, {{/-first}}{{/allParams}}?int $hostIndex = null, array $variables = []{{/-first}}{{/servers}}{{/vendorExtensions.x-group-parameters}}{{#vendorExtensions.x-group-parameters}}$associative_array{{/vendorExtensions.x-group-parameters}})
|
public function {{operationId}}AsyncWithHttpInfo({{^vendorExtensions.x-group-parameters}}{{#allParams}}${{paramName}}{{^required}} = {{#defaultValue}}{{{.}}}{{/defaultValue}}{{^defaultValue}}null{{/defaultValue}}{{/required}}, {{/allParams}}{{#servers}}{{#-first}}?int $hostIndex = null, array $variables = [], {{/-first}}{{/servers}}string $contentType = self::contentTypes['{{{operationId}}}'][0]{{/vendorExtensions.x-group-parameters}}{{#vendorExtensions.x-group-parameters}}$associative_array{{/vendorExtensions.x-group-parameters}})
|
||||||
{
|
{
|
||||||
$returnType = '{{{returnType}}}';
|
$returnType = '{{{returnType}}}';
|
||||||
$request = $this->{{operationId}}Request({{^vendorExtensions.x-group-parameters}}{{#allParams}}${{paramName}}{{^-last}}, {{/-last}}{{/allParams}}{{#servers}}{{#-first}}{{#allParams}}{{#-first}}, {{/-first}}{{/allParams}}$hostIndex, $variables{{/-first}}{{/servers}}{{/vendorExtensions.x-group-parameters}}{{#vendorExtensions.x-group-parameters}}$associative_array{{/vendorExtensions.x-group-parameters}});
|
$request = $this->{{operationId}}Request({{^vendorExtensions.x-group-parameters}}{{#allParams}}${{paramName}}, {{/allParams}}{{#servers}}{{#-first}}$hostIndex, $variables, {{/-first}}{{/servers}}$contentType{{/vendorExtensions.x-group-parameters}}{{#vendorExtensions.x-group-parameters}}$associative_array{{/vendorExtensions.x-group-parameters}});
|
||||||
|
|
||||||
return $this->client
|
return $this->client
|
||||||
->sendAsync($request, $this->createHttpClientOption())
|
->sendAsync($request, $this->createHttpClientOption())
|
||||||
@ -517,6 +530,7 @@ use {{invokerPackage}}\ObjectSerializer;
|
|||||||
* @param array $variables Associative array of variables to pass to the host. Defaults to empty array.
|
* @param array $variables Associative array of variables to pass to the host. Defaults to empty array.
|
||||||
{{/-first}}
|
{{/-first}}
|
||||||
{{/servers}}
|
{{/servers}}
|
||||||
|
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['{{{operationId}}}'] to see the possible values for this operation
|
||||||
*
|
*
|
||||||
* @throws \InvalidArgumentException
|
* @throws \InvalidArgumentException
|
||||||
* @return \GuzzleHttp\Psr7\Request
|
* @return \GuzzleHttp\Psr7\Request
|
||||||
@ -524,7 +538,7 @@ use {{invokerPackage}}\ObjectSerializer;
|
|||||||
* @deprecated
|
* @deprecated
|
||||||
{{/isDeprecated}}
|
{{/isDeprecated}}
|
||||||
*/
|
*/
|
||||||
public function {{operationId}}Request({{^vendorExtensions.x-group-parameters}}{{#allParams}}${{paramName}}{{^required}} = {{#defaultValue}}{{{.}}}{{/defaultValue}}{{^defaultValue}}null{{/defaultValue}}{{/required}}{{^-last}}, {{/-last}}{{/allParams}}{{#servers}}{{#-first}}{{#allParams}}{{#-first}}, {{/-first}}{{/allParams}}?int $hostIndex = null, array $variables = []{{/-first}}{{/servers}}{{/vendorExtensions.x-group-parameters}}{{#vendorExtensions.x-group-parameters}}$associative_array{{/vendorExtensions.x-group-parameters}})
|
public function {{operationId}}Request({{^vendorExtensions.x-group-parameters}}{{#allParams}}${{paramName}}{{^required}} = {{#defaultValue}}{{{.}}}{{/defaultValue}}{{^defaultValue}}null{{/defaultValue}}{{/required}}, {{/allParams}}{{#servers}}{{#-first}}?int $hostIndex = null, array $variables = [], {{/-first}}{{/servers}}string $contentType = self::contentTypes['{{{operationId}}}'][0]{{/vendorExtensions.x-group-parameters}}{{#vendorExtensions.x-group-parameters}}$associative_array{{/vendorExtensions.x-group-parameters}})
|
||||||
{
|
{
|
||||||
{{#vendorExtensions.x-group-parameters}}
|
{{#vendorExtensions.x-group-parameters}}
|
||||||
// unbox the parameters from the associative array
|
// unbox the parameters from the associative array
|
||||||
@ -533,7 +547,9 @@ use {{invokerPackage}}\ObjectSerializer;
|
|||||||
{{/allParams}}{{#servers.0}}
|
{{/allParams}}{{#servers.0}}
|
||||||
$hostIndex = $associative_array['hostIndex'];
|
$hostIndex = $associative_array['hostIndex'];
|
||||||
$variables = array_key_exists('variables', $associative_array) ? $associative_array['variables'] : [];
|
$variables = array_key_exists('variables', $associative_array) ? $associative_array['variables'] : [];
|
||||||
{{/servers.0}}{{/vendorExtensions.x-group-parameters}}{{#allParams}}
|
{{/servers.0}}
|
||||||
|
$contentType = $associative_array['contentType'] ?? self::contentTypes['{{{operationId}}}'][0];
|
||||||
|
{{/vendorExtensions.x-group-parameters}}{{#allParams}}
|
||||||
{{#required}}
|
{{#required}}
|
||||||
// verify the required parameter '{{paramName}}' is set
|
// verify the required parameter '{{paramName}}' is set
|
||||||
if (${{paramName}} === null || (is_array(${{paramName}}) && count(${{paramName}}) === 0)) {
|
if (${{paramName}} === null || (is_array(${{paramName}}) && count(${{paramName}}) === 0)) {
|
||||||
@ -578,9 +594,7 @@ use {{invokerPackage}}\ObjectSerializer;
|
|||||||
throw new \InvalidArgumentException('invalid value for "${{paramName}}" when calling {{classname}}.{{operationId}}, number of items must be greater than or equal to {{minItems}}.');
|
throw new \InvalidArgumentException('invalid value for "${{paramName}}" when calling {{classname}}.{{operationId}}, number of items must be greater than or equal to {{minItems}}.');
|
||||||
}
|
}
|
||||||
{{/minItems}}
|
{{/minItems}}
|
||||||
|
{{/hasValidation}}{{/allParams}}
|
||||||
{{/hasValidation}}
|
|
||||||
{{/allParams}}
|
|
||||||
|
|
||||||
$resourcePath = '{{{path}}}';
|
$resourcePath = '{{{path}}}';
|
||||||
$formParams = [];
|
$formParams = [];
|
||||||
@ -649,21 +663,17 @@ use {{invokerPackage}}\ObjectSerializer;
|
|||||||
}
|
}
|
||||||
{{/formParams}}
|
{{/formParams}}
|
||||||
|
|
||||||
if ($multipart) {
|
$headers = $this->headerSelector->selectHeaders(
|
||||||
$headers = $this->headerSelector->selectHeadersForMultipart(
|
[{{#produces}}'{{{mediaType}}}', {{/produces}}],
|
||||||
[{{#produces}}'{{{mediaType}}}'{{^-last}}, {{/-last}}{{/produces}}]
|
$contentType,
|
||||||
);
|
$multipart
|
||||||
} else {
|
);
|
||||||
$headers = $this->headerSelector->selectHeaders(
|
|
||||||
[{{#produces}}'{{{mediaType}}}'{{^-last}}, {{/-last}}{{/produces}}],
|
|
||||||
[{{#consumes}}'{{{mediaType}}}'{{^-last}}, {{/-last}}{{/consumes}}]
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
// for model (json/xml)
|
// for model (json/xml)
|
||||||
{{#bodyParams}}
|
{{#bodyParams}}
|
||||||
if (isset(${{paramName}})) {
|
if (isset(${{paramName}})) {
|
||||||
if ($headers['Content-Type'] === 'application/json') {
|
if (stripos($headers['Content-Type'], 'application/json') !== false) {
|
||||||
|
# if Content-Type contains "application/json", json_encode the body
|
||||||
$httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization(${{paramName}}));
|
$httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization(${{paramName}}));
|
||||||
} else {
|
} else {
|
||||||
$httpBody = ${{paramName}};
|
$httpBody = ${{paramName}};
|
||||||
@ -687,9 +697,9 @@ use {{invokerPackage}}\ObjectSerializer;
|
|||||||
// for HTTP post (form)
|
// for HTTP post (form)
|
||||||
$httpBody = new MultipartStream($multipartContents);
|
$httpBody = new MultipartStream($multipartContents);
|
||||||
|
|
||||||
} elseif ($headers['Content-Type'] === 'application/json') {
|
} elseif (stripos($headers['Content-Type'], 'application/json') !== false) {
|
||||||
|
# if Content-Type contains "application/json", json_encode the form parameters
|
||||||
$httpBody = \GuzzleHttp\json_encode($formParams);
|
$httpBody = \GuzzleHttp\json_encode($formParams);
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
// for HTTP post (form)
|
// for HTTP post (form)
|
||||||
$httpBody = ObjectSerializer::buildQuery($formParams);
|
$httpBody = ObjectSerializer::buildQuery($formParams);
|
||||||
|
@ -69,7 +69,14 @@ class AnotherFakeApi
|
|||||||
*/
|
*/
|
||||||
protected $hostIndex;
|
protected $hostIndex;
|
||||||
|
|
||||||
/**
|
/** @var string[] $contentTypes **/
|
||||||
|
public const contentTypes = [
|
||||||
|
'call123TestSpecialTags' => [
|
||||||
|
'application/json',
|
||||||
|
],
|
||||||
|
];
|
||||||
|
|
||||||
|
/**
|
||||||
* @param ClientInterface $client
|
* @param ClientInterface $client
|
||||||
* @param Configuration $config
|
* @param Configuration $config
|
||||||
* @param HeaderSelector $selector
|
* @param HeaderSelector $selector
|
||||||
@ -121,14 +128,15 @@ class AnotherFakeApi
|
|||||||
* To test special tags
|
* To test special tags
|
||||||
*
|
*
|
||||||
* @param \OpenAPI\Client\Model\Client $client client model (required)
|
* @param \OpenAPI\Client\Model\Client $client client model (required)
|
||||||
|
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['call123TestSpecialTags'] to see the possible values for this operation
|
||||||
*
|
*
|
||||||
* @throws \OpenAPI\Client\ApiException on non-2xx response
|
* @throws \OpenAPI\Client\ApiException on non-2xx response
|
||||||
* @throws \InvalidArgumentException
|
* @throws \InvalidArgumentException
|
||||||
* @return \OpenAPI\Client\Model\Client
|
* @return \OpenAPI\Client\Model\Client
|
||||||
*/
|
*/
|
||||||
public function call123TestSpecialTags($client)
|
public function call123TestSpecialTags($client, string $contentType = self::contentTypes['call123TestSpecialTags'][0])
|
||||||
{
|
{
|
||||||
list($response) = $this->call123TestSpecialTagsWithHttpInfo($client);
|
list($response) = $this->call123TestSpecialTagsWithHttpInfo($client, $contentType);
|
||||||
return $response;
|
return $response;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -138,14 +146,15 @@ class AnotherFakeApi
|
|||||||
* To test special tags
|
* To test special tags
|
||||||
*
|
*
|
||||||
* @param \OpenAPI\Client\Model\Client $client client model (required)
|
* @param \OpenAPI\Client\Model\Client $client client model (required)
|
||||||
|
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['call123TestSpecialTags'] to see the possible values for this operation
|
||||||
*
|
*
|
||||||
* @throws \OpenAPI\Client\ApiException on non-2xx response
|
* @throws \OpenAPI\Client\ApiException on non-2xx response
|
||||||
* @throws \InvalidArgumentException
|
* @throws \InvalidArgumentException
|
||||||
* @return array of \OpenAPI\Client\Model\Client, HTTP status code, HTTP response headers (array of strings)
|
* @return array of \OpenAPI\Client\Model\Client, HTTP status code, HTTP response headers (array of strings)
|
||||||
*/
|
*/
|
||||||
public function call123TestSpecialTagsWithHttpInfo($client)
|
public function call123TestSpecialTagsWithHttpInfo($client, string $contentType = self::contentTypes['call123TestSpecialTags'][0])
|
||||||
{
|
{
|
||||||
$request = $this->call123TestSpecialTagsRequest($client);
|
$request = $this->call123TestSpecialTagsRequest($client, $contentType);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
$options = $this->createHttpClientOption();
|
$options = $this->createHttpClientOption();
|
||||||
@ -237,13 +246,14 @@ class AnotherFakeApi
|
|||||||
* To test special tags
|
* To test special tags
|
||||||
*
|
*
|
||||||
* @param \OpenAPI\Client\Model\Client $client client model (required)
|
* @param \OpenAPI\Client\Model\Client $client client model (required)
|
||||||
|
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['call123TestSpecialTags'] to see the possible values for this operation
|
||||||
*
|
*
|
||||||
* @throws \InvalidArgumentException
|
* @throws \InvalidArgumentException
|
||||||
* @return \GuzzleHttp\Promise\PromiseInterface
|
* @return \GuzzleHttp\Promise\PromiseInterface
|
||||||
*/
|
*/
|
||||||
public function call123TestSpecialTagsAsync($client)
|
public function call123TestSpecialTagsAsync($client, string $contentType = self::contentTypes['call123TestSpecialTags'][0])
|
||||||
{
|
{
|
||||||
return $this->call123TestSpecialTagsAsyncWithHttpInfo($client)
|
return $this->call123TestSpecialTagsAsyncWithHttpInfo($client, $contentType)
|
||||||
->then(
|
->then(
|
||||||
function ($response) {
|
function ($response) {
|
||||||
return $response[0];
|
return $response[0];
|
||||||
@ -257,14 +267,15 @@ class AnotherFakeApi
|
|||||||
* To test special tags
|
* To test special tags
|
||||||
*
|
*
|
||||||
* @param \OpenAPI\Client\Model\Client $client client model (required)
|
* @param \OpenAPI\Client\Model\Client $client client model (required)
|
||||||
|
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['call123TestSpecialTags'] to see the possible values for this operation
|
||||||
*
|
*
|
||||||
* @throws \InvalidArgumentException
|
* @throws \InvalidArgumentException
|
||||||
* @return \GuzzleHttp\Promise\PromiseInterface
|
* @return \GuzzleHttp\Promise\PromiseInterface
|
||||||
*/
|
*/
|
||||||
public function call123TestSpecialTagsAsyncWithHttpInfo($client)
|
public function call123TestSpecialTagsAsyncWithHttpInfo($client, string $contentType = self::contentTypes['call123TestSpecialTags'][0])
|
||||||
{
|
{
|
||||||
$returnType = '\OpenAPI\Client\Model\Client';
|
$returnType = '\OpenAPI\Client\Model\Client';
|
||||||
$request = $this->call123TestSpecialTagsRequest($client);
|
$request = $this->call123TestSpecialTagsRequest($client, $contentType);
|
||||||
|
|
||||||
return $this->client
|
return $this->client
|
||||||
->sendAsync($request, $this->createHttpClientOption())
|
->sendAsync($request, $this->createHttpClientOption())
|
||||||
@ -306,11 +317,12 @@ class AnotherFakeApi
|
|||||||
* Create request for operation 'call123TestSpecialTags'
|
* Create request for operation 'call123TestSpecialTags'
|
||||||
*
|
*
|
||||||
* @param \OpenAPI\Client\Model\Client $client client model (required)
|
* @param \OpenAPI\Client\Model\Client $client client model (required)
|
||||||
|
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['call123TestSpecialTags'] to see the possible values for this operation
|
||||||
*
|
*
|
||||||
* @throws \InvalidArgumentException
|
* @throws \InvalidArgumentException
|
||||||
* @return \GuzzleHttp\Psr7\Request
|
* @return \GuzzleHttp\Psr7\Request
|
||||||
*/
|
*/
|
||||||
public function call123TestSpecialTagsRequest($client)
|
public function call123TestSpecialTagsRequest($client, string $contentType = self::contentTypes['call123TestSpecialTags'][0])
|
||||||
{
|
{
|
||||||
|
|
||||||
// verify the required parameter 'client' is set
|
// verify the required parameter 'client' is set
|
||||||
@ -320,6 +332,7 @@ class AnotherFakeApi
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
$resourcePath = '/another-fake/dummy';
|
$resourcePath = '/another-fake/dummy';
|
||||||
$formParams = [];
|
$formParams = [];
|
||||||
$queryParams = [];
|
$queryParams = [];
|
||||||
@ -331,20 +344,16 @@ class AnotherFakeApi
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
if ($multipart) {
|
$headers = $this->headerSelector->selectHeaders(
|
||||||
$headers = $this->headerSelector->selectHeadersForMultipart(
|
['application/json', ],
|
||||||
['application/json']
|
$contentType,
|
||||||
);
|
$multipart
|
||||||
} else {
|
);
|
||||||
$headers = $this->headerSelector->selectHeaders(
|
|
||||||
['application/json'],
|
|
||||||
['application/json']
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
// for model (json/xml)
|
// for model (json/xml)
|
||||||
if (isset($client)) {
|
if (isset($client)) {
|
||||||
if ($headers['Content-Type'] === 'application/json') {
|
if (stripos($headers['Content-Type'], 'application/json') !== false) {
|
||||||
|
# if Content-Type contains "application/json", json_encode the body
|
||||||
$httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($client));
|
$httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($client));
|
||||||
} else {
|
} else {
|
||||||
$httpBody = $client;
|
$httpBody = $client;
|
||||||
@ -364,9 +373,9 @@ class AnotherFakeApi
|
|||||||
// for HTTP post (form)
|
// for HTTP post (form)
|
||||||
$httpBody = new MultipartStream($multipartContents);
|
$httpBody = new MultipartStream($multipartContents);
|
||||||
|
|
||||||
} elseif ($headers['Content-Type'] === 'application/json') {
|
} elseif (stripos($headers['Content-Type'], 'application/json') !== false) {
|
||||||
|
# if Content-Type contains "application/json", json_encode the form parameters
|
||||||
$httpBody = \GuzzleHttp\json_encode($formParams);
|
$httpBody = \GuzzleHttp\json_encode($formParams);
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
// for HTTP post (form)
|
// for HTTP post (form)
|
||||||
$httpBody = ObjectSerializer::buildQuery($formParams);
|
$httpBody = ObjectSerializer::buildQuery($formParams);
|
||||||
|
@ -69,7 +69,14 @@ class DefaultApi
|
|||||||
*/
|
*/
|
||||||
protected $hostIndex;
|
protected $hostIndex;
|
||||||
|
|
||||||
/**
|
/** @var string[] $contentTypes **/
|
||||||
|
public const contentTypes = [
|
||||||
|
'fooGet' => [
|
||||||
|
'application/json',
|
||||||
|
],
|
||||||
|
];
|
||||||
|
|
||||||
|
/**
|
||||||
* @param ClientInterface $client
|
* @param ClientInterface $client
|
||||||
* @param Configuration $config
|
* @param Configuration $config
|
||||||
* @param HeaderSelector $selector
|
* @param HeaderSelector $selector
|
||||||
@ -118,28 +125,30 @@ class DefaultApi
|
|||||||
/**
|
/**
|
||||||
* Operation fooGet
|
* Operation fooGet
|
||||||
*
|
*
|
||||||
|
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['fooGet'] to see the possible values for this operation
|
||||||
*
|
*
|
||||||
* @throws \OpenAPI\Client\ApiException on non-2xx response
|
* @throws \OpenAPI\Client\ApiException on non-2xx response
|
||||||
* @throws \InvalidArgumentException
|
* @throws \InvalidArgumentException
|
||||||
* @return \OpenAPI\Client\Model\FooGetDefaultResponse
|
* @return \OpenAPI\Client\Model\FooGetDefaultResponse
|
||||||
*/
|
*/
|
||||||
public function fooGet()
|
public function fooGet(string $contentType = self::contentTypes['fooGet'][0])
|
||||||
{
|
{
|
||||||
list($response) = $this->fooGetWithHttpInfo();
|
list($response) = $this->fooGetWithHttpInfo($contentType);
|
||||||
return $response;
|
return $response;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Operation fooGetWithHttpInfo
|
* Operation fooGetWithHttpInfo
|
||||||
*
|
*
|
||||||
|
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['fooGet'] to see the possible values for this operation
|
||||||
*
|
*
|
||||||
* @throws \OpenAPI\Client\ApiException on non-2xx response
|
* @throws \OpenAPI\Client\ApiException on non-2xx response
|
||||||
* @throws \InvalidArgumentException
|
* @throws \InvalidArgumentException
|
||||||
* @return array of \OpenAPI\Client\Model\FooGetDefaultResponse, HTTP status code, HTTP response headers (array of strings)
|
* @return array of \OpenAPI\Client\Model\FooGetDefaultResponse, HTTP status code, HTTP response headers (array of strings)
|
||||||
*/
|
*/
|
||||||
public function fooGetWithHttpInfo()
|
public function fooGetWithHttpInfo(string $contentType = self::contentTypes['fooGet'][0])
|
||||||
{
|
{
|
||||||
$request = $this->fooGetRequest();
|
$request = $this->fooGetRequest($contentType);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
$options = $this->createHttpClientOption();
|
$options = $this->createHttpClientOption();
|
||||||
@ -228,13 +237,14 @@ class DefaultApi
|
|||||||
/**
|
/**
|
||||||
* Operation fooGetAsync
|
* Operation fooGetAsync
|
||||||
*
|
*
|
||||||
|
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['fooGet'] to see the possible values for this operation
|
||||||
*
|
*
|
||||||
* @throws \InvalidArgumentException
|
* @throws \InvalidArgumentException
|
||||||
* @return \GuzzleHttp\Promise\PromiseInterface
|
* @return \GuzzleHttp\Promise\PromiseInterface
|
||||||
*/
|
*/
|
||||||
public function fooGetAsync()
|
public function fooGetAsync(string $contentType = self::contentTypes['fooGet'][0])
|
||||||
{
|
{
|
||||||
return $this->fooGetAsyncWithHttpInfo()
|
return $this->fooGetAsyncWithHttpInfo($contentType)
|
||||||
->then(
|
->then(
|
||||||
function ($response) {
|
function ($response) {
|
||||||
return $response[0];
|
return $response[0];
|
||||||
@ -245,14 +255,15 @@ class DefaultApi
|
|||||||
/**
|
/**
|
||||||
* Operation fooGetAsyncWithHttpInfo
|
* Operation fooGetAsyncWithHttpInfo
|
||||||
*
|
*
|
||||||
|
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['fooGet'] to see the possible values for this operation
|
||||||
*
|
*
|
||||||
* @throws \InvalidArgumentException
|
* @throws \InvalidArgumentException
|
||||||
* @return \GuzzleHttp\Promise\PromiseInterface
|
* @return \GuzzleHttp\Promise\PromiseInterface
|
||||||
*/
|
*/
|
||||||
public function fooGetAsyncWithHttpInfo()
|
public function fooGetAsyncWithHttpInfo(string $contentType = self::contentTypes['fooGet'][0])
|
||||||
{
|
{
|
||||||
$returnType = '\OpenAPI\Client\Model\FooGetDefaultResponse';
|
$returnType = '\OpenAPI\Client\Model\FooGetDefaultResponse';
|
||||||
$request = $this->fooGetRequest();
|
$request = $this->fooGetRequest($contentType);
|
||||||
|
|
||||||
return $this->client
|
return $this->client
|
||||||
->sendAsync($request, $this->createHttpClientOption())
|
->sendAsync($request, $this->createHttpClientOption())
|
||||||
@ -293,13 +304,15 @@ class DefaultApi
|
|||||||
/**
|
/**
|
||||||
* Create request for operation 'fooGet'
|
* Create request for operation 'fooGet'
|
||||||
*
|
*
|
||||||
|
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['fooGet'] to see the possible values for this operation
|
||||||
*
|
*
|
||||||
* @throws \InvalidArgumentException
|
* @throws \InvalidArgumentException
|
||||||
* @return \GuzzleHttp\Psr7\Request
|
* @return \GuzzleHttp\Psr7\Request
|
||||||
*/
|
*/
|
||||||
public function fooGetRequest()
|
public function fooGetRequest(string $contentType = self::contentTypes['fooGet'][0])
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|
||||||
$resourcePath = '/foo';
|
$resourcePath = '/foo';
|
||||||
$formParams = [];
|
$formParams = [];
|
||||||
$queryParams = [];
|
$queryParams = [];
|
||||||
@ -311,16 +324,11 @@ class DefaultApi
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
if ($multipart) {
|
$headers = $this->headerSelector->selectHeaders(
|
||||||
$headers = $this->headerSelector->selectHeadersForMultipart(
|
['application/json', ],
|
||||||
['application/json']
|
$contentType,
|
||||||
);
|
$multipart
|
||||||
} else {
|
);
|
||||||
$headers = $this->headerSelector->selectHeaders(
|
|
||||||
['application/json'],
|
|
||||||
[]
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
// for model (json/xml)
|
// for model (json/xml)
|
||||||
if (count($formParams) > 0) {
|
if (count($formParams) > 0) {
|
||||||
@ -338,9 +346,9 @@ class DefaultApi
|
|||||||
// for HTTP post (form)
|
// for HTTP post (form)
|
||||||
$httpBody = new MultipartStream($multipartContents);
|
$httpBody = new MultipartStream($multipartContents);
|
||||||
|
|
||||||
} elseif ($headers['Content-Type'] === 'application/json') {
|
} elseif (stripos($headers['Content-Type'], 'application/json') !== false) {
|
||||||
|
# if Content-Type contains "application/json", json_encode the form parameters
|
||||||
$httpBody = \GuzzleHttp\json_encode($formParams);
|
$httpBody = \GuzzleHttp\json_encode($formParams);
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
// for HTTP post (form)
|
// for HTTP post (form)
|
||||||
$httpBody = ObjectSerializer::buildQuery($formParams);
|
$httpBody = ObjectSerializer::buildQuery($formParams);
|
||||||
|
File diff suppressed because it is too large
Load Diff
@ -69,7 +69,14 @@ class FakeClassnameTags123Api
|
|||||||
*/
|
*/
|
||||||
protected $hostIndex;
|
protected $hostIndex;
|
||||||
|
|
||||||
/**
|
/** @var string[] $contentTypes **/
|
||||||
|
public const contentTypes = [
|
||||||
|
'testClassname' => [
|
||||||
|
'application/json',
|
||||||
|
],
|
||||||
|
];
|
||||||
|
|
||||||
|
/**
|
||||||
* @param ClientInterface $client
|
* @param ClientInterface $client
|
||||||
* @param Configuration $config
|
* @param Configuration $config
|
||||||
* @param HeaderSelector $selector
|
* @param HeaderSelector $selector
|
||||||
@ -121,14 +128,15 @@ class FakeClassnameTags123Api
|
|||||||
* To test class name in snake case
|
* To test class name in snake case
|
||||||
*
|
*
|
||||||
* @param \OpenAPI\Client\Model\Client $client client model (required)
|
* @param \OpenAPI\Client\Model\Client $client client model (required)
|
||||||
|
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['testClassname'] to see the possible values for this operation
|
||||||
*
|
*
|
||||||
* @throws \OpenAPI\Client\ApiException on non-2xx response
|
* @throws \OpenAPI\Client\ApiException on non-2xx response
|
||||||
* @throws \InvalidArgumentException
|
* @throws \InvalidArgumentException
|
||||||
* @return \OpenAPI\Client\Model\Client
|
* @return \OpenAPI\Client\Model\Client
|
||||||
*/
|
*/
|
||||||
public function testClassname($client)
|
public function testClassname($client, string $contentType = self::contentTypes['testClassname'][0])
|
||||||
{
|
{
|
||||||
list($response) = $this->testClassnameWithHttpInfo($client);
|
list($response) = $this->testClassnameWithHttpInfo($client, $contentType);
|
||||||
return $response;
|
return $response;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -138,14 +146,15 @@ class FakeClassnameTags123Api
|
|||||||
* To test class name in snake case
|
* To test class name in snake case
|
||||||
*
|
*
|
||||||
* @param \OpenAPI\Client\Model\Client $client client model (required)
|
* @param \OpenAPI\Client\Model\Client $client client model (required)
|
||||||
|
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['testClassname'] to see the possible values for this operation
|
||||||
*
|
*
|
||||||
* @throws \OpenAPI\Client\ApiException on non-2xx response
|
* @throws \OpenAPI\Client\ApiException on non-2xx response
|
||||||
* @throws \InvalidArgumentException
|
* @throws \InvalidArgumentException
|
||||||
* @return array of \OpenAPI\Client\Model\Client, HTTP status code, HTTP response headers (array of strings)
|
* @return array of \OpenAPI\Client\Model\Client, HTTP status code, HTTP response headers (array of strings)
|
||||||
*/
|
*/
|
||||||
public function testClassnameWithHttpInfo($client)
|
public function testClassnameWithHttpInfo($client, string $contentType = self::contentTypes['testClassname'][0])
|
||||||
{
|
{
|
||||||
$request = $this->testClassnameRequest($client);
|
$request = $this->testClassnameRequest($client, $contentType);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
$options = $this->createHttpClientOption();
|
$options = $this->createHttpClientOption();
|
||||||
@ -237,13 +246,14 @@ class FakeClassnameTags123Api
|
|||||||
* To test class name in snake case
|
* To test class name in snake case
|
||||||
*
|
*
|
||||||
* @param \OpenAPI\Client\Model\Client $client client model (required)
|
* @param \OpenAPI\Client\Model\Client $client client model (required)
|
||||||
|
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['testClassname'] to see the possible values for this operation
|
||||||
*
|
*
|
||||||
* @throws \InvalidArgumentException
|
* @throws \InvalidArgumentException
|
||||||
* @return \GuzzleHttp\Promise\PromiseInterface
|
* @return \GuzzleHttp\Promise\PromiseInterface
|
||||||
*/
|
*/
|
||||||
public function testClassnameAsync($client)
|
public function testClassnameAsync($client, string $contentType = self::contentTypes['testClassname'][0])
|
||||||
{
|
{
|
||||||
return $this->testClassnameAsyncWithHttpInfo($client)
|
return $this->testClassnameAsyncWithHttpInfo($client, $contentType)
|
||||||
->then(
|
->then(
|
||||||
function ($response) {
|
function ($response) {
|
||||||
return $response[0];
|
return $response[0];
|
||||||
@ -257,14 +267,15 @@ class FakeClassnameTags123Api
|
|||||||
* To test class name in snake case
|
* To test class name in snake case
|
||||||
*
|
*
|
||||||
* @param \OpenAPI\Client\Model\Client $client client model (required)
|
* @param \OpenAPI\Client\Model\Client $client client model (required)
|
||||||
|
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['testClassname'] to see the possible values for this operation
|
||||||
*
|
*
|
||||||
* @throws \InvalidArgumentException
|
* @throws \InvalidArgumentException
|
||||||
* @return \GuzzleHttp\Promise\PromiseInterface
|
* @return \GuzzleHttp\Promise\PromiseInterface
|
||||||
*/
|
*/
|
||||||
public function testClassnameAsyncWithHttpInfo($client)
|
public function testClassnameAsyncWithHttpInfo($client, string $contentType = self::contentTypes['testClassname'][0])
|
||||||
{
|
{
|
||||||
$returnType = '\OpenAPI\Client\Model\Client';
|
$returnType = '\OpenAPI\Client\Model\Client';
|
||||||
$request = $this->testClassnameRequest($client);
|
$request = $this->testClassnameRequest($client, $contentType);
|
||||||
|
|
||||||
return $this->client
|
return $this->client
|
||||||
->sendAsync($request, $this->createHttpClientOption())
|
->sendAsync($request, $this->createHttpClientOption())
|
||||||
@ -306,11 +317,12 @@ class FakeClassnameTags123Api
|
|||||||
* Create request for operation 'testClassname'
|
* Create request for operation 'testClassname'
|
||||||
*
|
*
|
||||||
* @param \OpenAPI\Client\Model\Client $client client model (required)
|
* @param \OpenAPI\Client\Model\Client $client client model (required)
|
||||||
|
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['testClassname'] to see the possible values for this operation
|
||||||
*
|
*
|
||||||
* @throws \InvalidArgumentException
|
* @throws \InvalidArgumentException
|
||||||
* @return \GuzzleHttp\Psr7\Request
|
* @return \GuzzleHttp\Psr7\Request
|
||||||
*/
|
*/
|
||||||
public function testClassnameRequest($client)
|
public function testClassnameRequest($client, string $contentType = self::contentTypes['testClassname'][0])
|
||||||
{
|
{
|
||||||
|
|
||||||
// verify the required parameter 'client' is set
|
// verify the required parameter 'client' is set
|
||||||
@ -320,6 +332,7 @@ class FakeClassnameTags123Api
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
$resourcePath = '/fake_classname_test';
|
$resourcePath = '/fake_classname_test';
|
||||||
$formParams = [];
|
$formParams = [];
|
||||||
$queryParams = [];
|
$queryParams = [];
|
||||||
@ -331,20 +344,16 @@ class FakeClassnameTags123Api
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
if ($multipart) {
|
$headers = $this->headerSelector->selectHeaders(
|
||||||
$headers = $this->headerSelector->selectHeadersForMultipart(
|
['application/json', ],
|
||||||
['application/json']
|
$contentType,
|
||||||
);
|
$multipart
|
||||||
} else {
|
);
|
||||||
$headers = $this->headerSelector->selectHeaders(
|
|
||||||
['application/json'],
|
|
||||||
['application/json']
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
// for model (json/xml)
|
// for model (json/xml)
|
||||||
if (isset($client)) {
|
if (isset($client)) {
|
||||||
if ($headers['Content-Type'] === 'application/json') {
|
if (stripos($headers['Content-Type'], 'application/json') !== false) {
|
||||||
|
# if Content-Type contains "application/json", json_encode the body
|
||||||
$httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($client));
|
$httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($client));
|
||||||
} else {
|
} else {
|
||||||
$httpBody = $client;
|
$httpBody = $client;
|
||||||
@ -364,9 +373,9 @@ class FakeClassnameTags123Api
|
|||||||
// for HTTP post (form)
|
// for HTTP post (form)
|
||||||
$httpBody = new MultipartStream($multipartContents);
|
$httpBody = new MultipartStream($multipartContents);
|
||||||
|
|
||||||
} elseif ($headers['Content-Type'] === 'application/json') {
|
} elseif (stripos($headers['Content-Type'], 'application/json') !== false) {
|
||||||
|
# if Content-Type contains "application/json", json_encode the form parameters
|
||||||
$httpBody = \GuzzleHttp\json_encode($formParams);
|
$httpBody = \GuzzleHttp\json_encode($formParams);
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
// for HTTP post (form)
|
// for HTTP post (form)
|
||||||
$httpBody = ObjectSerializer::buildQuery($formParams);
|
$httpBody = ObjectSerializer::buildQuery($formParams);
|
||||||
|
File diff suppressed because it is too large
Load Diff
@ -69,7 +69,23 @@ class StoreApi
|
|||||||
*/
|
*/
|
||||||
protected $hostIndex;
|
protected $hostIndex;
|
||||||
|
|
||||||
/**
|
/** @var string[] $contentTypes **/
|
||||||
|
public const contentTypes = [
|
||||||
|
'deleteOrder' => [
|
||||||
|
'application/json',
|
||||||
|
],
|
||||||
|
'getInventory' => [
|
||||||
|
'application/json',
|
||||||
|
],
|
||||||
|
'getOrderById' => [
|
||||||
|
'application/json',
|
||||||
|
],
|
||||||
|
'placeOrder' => [
|
||||||
|
'application/json',
|
||||||
|
],
|
||||||
|
];
|
||||||
|
|
||||||
|
/**
|
||||||
* @param ClientInterface $client
|
* @param ClientInterface $client
|
||||||
* @param Configuration $config
|
* @param Configuration $config
|
||||||
* @param HeaderSelector $selector
|
* @param HeaderSelector $selector
|
||||||
@ -121,14 +137,15 @@ class StoreApi
|
|||||||
* Delete purchase order by ID
|
* Delete purchase order by ID
|
||||||
*
|
*
|
||||||
* @param string $order_id ID of the order that needs to be deleted (required)
|
* @param string $order_id ID of the order that needs to be deleted (required)
|
||||||
|
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteOrder'] to see the possible values for this operation
|
||||||
*
|
*
|
||||||
* @throws \OpenAPI\Client\ApiException on non-2xx response
|
* @throws \OpenAPI\Client\ApiException on non-2xx response
|
||||||
* @throws \InvalidArgumentException
|
* @throws \InvalidArgumentException
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function deleteOrder($order_id)
|
public function deleteOrder($order_id, string $contentType = self::contentTypes['deleteOrder'][0])
|
||||||
{
|
{
|
||||||
$this->deleteOrderWithHttpInfo($order_id);
|
$this->deleteOrderWithHttpInfo($order_id, $contentType);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -137,14 +154,15 @@ class StoreApi
|
|||||||
* Delete purchase order by ID
|
* Delete purchase order by ID
|
||||||
*
|
*
|
||||||
* @param string $order_id ID of the order that needs to be deleted (required)
|
* @param string $order_id ID of the order that needs to be deleted (required)
|
||||||
|
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteOrder'] to see the possible values for this operation
|
||||||
*
|
*
|
||||||
* @throws \OpenAPI\Client\ApiException on non-2xx response
|
* @throws \OpenAPI\Client\ApiException on non-2xx response
|
||||||
* @throws \InvalidArgumentException
|
* @throws \InvalidArgumentException
|
||||||
* @return array of null, HTTP status code, HTTP response headers (array of strings)
|
* @return array of null, HTTP status code, HTTP response headers (array of strings)
|
||||||
*/
|
*/
|
||||||
public function deleteOrderWithHttpInfo($order_id)
|
public function deleteOrderWithHttpInfo($order_id, string $contentType = self::contentTypes['deleteOrder'][0])
|
||||||
{
|
{
|
||||||
$request = $this->deleteOrderRequest($order_id);
|
$request = $this->deleteOrderRequest($order_id, $contentType);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
$options = $this->createHttpClientOption();
|
$options = $this->createHttpClientOption();
|
||||||
@ -196,13 +214,14 @@ class StoreApi
|
|||||||
* Delete purchase order by ID
|
* Delete purchase order by ID
|
||||||
*
|
*
|
||||||
* @param string $order_id ID of the order that needs to be deleted (required)
|
* @param string $order_id ID of the order that needs to be deleted (required)
|
||||||
|
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteOrder'] to see the possible values for this operation
|
||||||
*
|
*
|
||||||
* @throws \InvalidArgumentException
|
* @throws \InvalidArgumentException
|
||||||
* @return \GuzzleHttp\Promise\PromiseInterface
|
* @return \GuzzleHttp\Promise\PromiseInterface
|
||||||
*/
|
*/
|
||||||
public function deleteOrderAsync($order_id)
|
public function deleteOrderAsync($order_id, string $contentType = self::contentTypes['deleteOrder'][0])
|
||||||
{
|
{
|
||||||
return $this->deleteOrderAsyncWithHttpInfo($order_id)
|
return $this->deleteOrderAsyncWithHttpInfo($order_id, $contentType)
|
||||||
->then(
|
->then(
|
||||||
function ($response) {
|
function ($response) {
|
||||||
return $response[0];
|
return $response[0];
|
||||||
@ -216,14 +235,15 @@ class StoreApi
|
|||||||
* Delete purchase order by ID
|
* Delete purchase order by ID
|
||||||
*
|
*
|
||||||
* @param string $order_id ID of the order that needs to be deleted (required)
|
* @param string $order_id ID of the order that needs to be deleted (required)
|
||||||
|
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteOrder'] to see the possible values for this operation
|
||||||
*
|
*
|
||||||
* @throws \InvalidArgumentException
|
* @throws \InvalidArgumentException
|
||||||
* @return \GuzzleHttp\Promise\PromiseInterface
|
* @return \GuzzleHttp\Promise\PromiseInterface
|
||||||
*/
|
*/
|
||||||
public function deleteOrderAsyncWithHttpInfo($order_id)
|
public function deleteOrderAsyncWithHttpInfo($order_id, string $contentType = self::contentTypes['deleteOrder'][0])
|
||||||
{
|
{
|
||||||
$returnType = '';
|
$returnType = '';
|
||||||
$request = $this->deleteOrderRequest($order_id);
|
$request = $this->deleteOrderRequest($order_id, $contentType);
|
||||||
|
|
||||||
return $this->client
|
return $this->client
|
||||||
->sendAsync($request, $this->createHttpClientOption())
|
->sendAsync($request, $this->createHttpClientOption())
|
||||||
@ -252,11 +272,12 @@ class StoreApi
|
|||||||
* Create request for operation 'deleteOrder'
|
* Create request for operation 'deleteOrder'
|
||||||
*
|
*
|
||||||
* @param string $order_id ID of the order that needs to be deleted (required)
|
* @param string $order_id ID of the order that needs to be deleted (required)
|
||||||
|
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteOrder'] to see the possible values for this operation
|
||||||
*
|
*
|
||||||
* @throws \InvalidArgumentException
|
* @throws \InvalidArgumentException
|
||||||
* @return \GuzzleHttp\Psr7\Request
|
* @return \GuzzleHttp\Psr7\Request
|
||||||
*/
|
*/
|
||||||
public function deleteOrderRequest($order_id)
|
public function deleteOrderRequest($order_id, string $contentType = self::contentTypes['deleteOrder'][0])
|
||||||
{
|
{
|
||||||
|
|
||||||
// verify the required parameter 'order_id' is set
|
// verify the required parameter 'order_id' is set
|
||||||
@ -266,6 +287,7 @@ class StoreApi
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
$resourcePath = '/store/order/{order_id}';
|
$resourcePath = '/store/order/{order_id}';
|
||||||
$formParams = [];
|
$formParams = [];
|
||||||
$queryParams = [];
|
$queryParams = [];
|
||||||
@ -285,16 +307,11 @@ class StoreApi
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if ($multipart) {
|
$headers = $this->headerSelector->selectHeaders(
|
||||||
$headers = $this->headerSelector->selectHeadersForMultipart(
|
[],
|
||||||
[]
|
$contentType,
|
||||||
);
|
$multipart
|
||||||
} else {
|
);
|
||||||
$headers = $this->headerSelector->selectHeaders(
|
|
||||||
[],
|
|
||||||
[]
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
// for model (json/xml)
|
// for model (json/xml)
|
||||||
if (count($formParams) > 0) {
|
if (count($formParams) > 0) {
|
||||||
@ -312,9 +329,9 @@ class StoreApi
|
|||||||
// for HTTP post (form)
|
// for HTTP post (form)
|
||||||
$httpBody = new MultipartStream($multipartContents);
|
$httpBody = new MultipartStream($multipartContents);
|
||||||
|
|
||||||
} elseif ($headers['Content-Type'] === 'application/json') {
|
} elseif (stripos($headers['Content-Type'], 'application/json') !== false) {
|
||||||
|
# if Content-Type contains "application/json", json_encode the form parameters
|
||||||
$httpBody = \GuzzleHttp\json_encode($formParams);
|
$httpBody = \GuzzleHttp\json_encode($formParams);
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
// for HTTP post (form)
|
// for HTTP post (form)
|
||||||
$httpBody = ObjectSerializer::buildQuery($formParams);
|
$httpBody = ObjectSerializer::buildQuery($formParams);
|
||||||
@ -348,14 +365,15 @@ class StoreApi
|
|||||||
*
|
*
|
||||||
* Returns pet inventories by status
|
* Returns pet inventories by status
|
||||||
*
|
*
|
||||||
|
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getInventory'] to see the possible values for this operation
|
||||||
*
|
*
|
||||||
* @throws \OpenAPI\Client\ApiException on non-2xx response
|
* @throws \OpenAPI\Client\ApiException on non-2xx response
|
||||||
* @throws \InvalidArgumentException
|
* @throws \InvalidArgumentException
|
||||||
* @return array<string,int>
|
* @return array<string,int>
|
||||||
*/
|
*/
|
||||||
public function getInventory()
|
public function getInventory(string $contentType = self::contentTypes['getInventory'][0])
|
||||||
{
|
{
|
||||||
list($response) = $this->getInventoryWithHttpInfo();
|
list($response) = $this->getInventoryWithHttpInfo($contentType);
|
||||||
return $response;
|
return $response;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -364,14 +382,15 @@ class StoreApi
|
|||||||
*
|
*
|
||||||
* Returns pet inventories by status
|
* Returns pet inventories by status
|
||||||
*
|
*
|
||||||
|
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getInventory'] to see the possible values for this operation
|
||||||
*
|
*
|
||||||
* @throws \OpenAPI\Client\ApiException on non-2xx response
|
* @throws \OpenAPI\Client\ApiException on non-2xx response
|
||||||
* @throws \InvalidArgumentException
|
* @throws \InvalidArgumentException
|
||||||
* @return array of array<string,int>, HTTP status code, HTTP response headers (array of strings)
|
* @return array of array<string,int>, HTTP status code, HTTP response headers (array of strings)
|
||||||
*/
|
*/
|
||||||
public function getInventoryWithHttpInfo()
|
public function getInventoryWithHttpInfo(string $contentType = self::contentTypes['getInventory'][0])
|
||||||
{
|
{
|
||||||
$request = $this->getInventoryRequest();
|
$request = $this->getInventoryRequest($contentType);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
$options = $this->createHttpClientOption();
|
$options = $this->createHttpClientOption();
|
||||||
@ -462,13 +481,14 @@ class StoreApi
|
|||||||
*
|
*
|
||||||
* Returns pet inventories by status
|
* Returns pet inventories by status
|
||||||
*
|
*
|
||||||
|
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getInventory'] to see the possible values for this operation
|
||||||
*
|
*
|
||||||
* @throws \InvalidArgumentException
|
* @throws \InvalidArgumentException
|
||||||
* @return \GuzzleHttp\Promise\PromiseInterface
|
* @return \GuzzleHttp\Promise\PromiseInterface
|
||||||
*/
|
*/
|
||||||
public function getInventoryAsync()
|
public function getInventoryAsync(string $contentType = self::contentTypes['getInventory'][0])
|
||||||
{
|
{
|
||||||
return $this->getInventoryAsyncWithHttpInfo()
|
return $this->getInventoryAsyncWithHttpInfo($contentType)
|
||||||
->then(
|
->then(
|
||||||
function ($response) {
|
function ($response) {
|
||||||
return $response[0];
|
return $response[0];
|
||||||
@ -481,14 +501,15 @@ class StoreApi
|
|||||||
*
|
*
|
||||||
* Returns pet inventories by status
|
* Returns pet inventories by status
|
||||||
*
|
*
|
||||||
|
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getInventory'] to see the possible values for this operation
|
||||||
*
|
*
|
||||||
* @throws \InvalidArgumentException
|
* @throws \InvalidArgumentException
|
||||||
* @return \GuzzleHttp\Promise\PromiseInterface
|
* @return \GuzzleHttp\Promise\PromiseInterface
|
||||||
*/
|
*/
|
||||||
public function getInventoryAsyncWithHttpInfo()
|
public function getInventoryAsyncWithHttpInfo(string $contentType = self::contentTypes['getInventory'][0])
|
||||||
{
|
{
|
||||||
$returnType = 'array<string,int>';
|
$returnType = 'array<string,int>';
|
||||||
$request = $this->getInventoryRequest();
|
$request = $this->getInventoryRequest($contentType);
|
||||||
|
|
||||||
return $this->client
|
return $this->client
|
||||||
->sendAsync($request, $this->createHttpClientOption())
|
->sendAsync($request, $this->createHttpClientOption())
|
||||||
@ -529,13 +550,15 @@ class StoreApi
|
|||||||
/**
|
/**
|
||||||
* Create request for operation 'getInventory'
|
* Create request for operation 'getInventory'
|
||||||
*
|
*
|
||||||
|
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getInventory'] to see the possible values for this operation
|
||||||
*
|
*
|
||||||
* @throws \InvalidArgumentException
|
* @throws \InvalidArgumentException
|
||||||
* @return \GuzzleHttp\Psr7\Request
|
* @return \GuzzleHttp\Psr7\Request
|
||||||
*/
|
*/
|
||||||
public function getInventoryRequest()
|
public function getInventoryRequest(string $contentType = self::contentTypes['getInventory'][0])
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|
||||||
$resourcePath = '/store/inventory';
|
$resourcePath = '/store/inventory';
|
||||||
$formParams = [];
|
$formParams = [];
|
||||||
$queryParams = [];
|
$queryParams = [];
|
||||||
@ -547,16 +570,11 @@ class StoreApi
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
if ($multipart) {
|
$headers = $this->headerSelector->selectHeaders(
|
||||||
$headers = $this->headerSelector->selectHeadersForMultipart(
|
['application/json', ],
|
||||||
['application/json']
|
$contentType,
|
||||||
);
|
$multipart
|
||||||
} else {
|
);
|
||||||
$headers = $this->headerSelector->selectHeaders(
|
|
||||||
['application/json'],
|
|
||||||
[]
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
// for model (json/xml)
|
// for model (json/xml)
|
||||||
if (count($formParams) > 0) {
|
if (count($formParams) > 0) {
|
||||||
@ -574,9 +592,9 @@ class StoreApi
|
|||||||
// for HTTP post (form)
|
// for HTTP post (form)
|
||||||
$httpBody = new MultipartStream($multipartContents);
|
$httpBody = new MultipartStream($multipartContents);
|
||||||
|
|
||||||
} elseif ($headers['Content-Type'] === 'application/json') {
|
} elseif (stripos($headers['Content-Type'], 'application/json') !== false) {
|
||||||
|
# if Content-Type contains "application/json", json_encode the form parameters
|
||||||
$httpBody = \GuzzleHttp\json_encode($formParams);
|
$httpBody = \GuzzleHttp\json_encode($formParams);
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
// for HTTP post (form)
|
// for HTTP post (form)
|
||||||
$httpBody = ObjectSerializer::buildQuery($formParams);
|
$httpBody = ObjectSerializer::buildQuery($formParams);
|
||||||
@ -616,14 +634,15 @@ class StoreApi
|
|||||||
* Find purchase order by ID
|
* Find purchase order by ID
|
||||||
*
|
*
|
||||||
* @param int $order_id ID of pet that needs to be fetched (required)
|
* @param int $order_id ID of pet that needs to be fetched (required)
|
||||||
|
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getOrderById'] to see the possible values for this operation
|
||||||
*
|
*
|
||||||
* @throws \OpenAPI\Client\ApiException on non-2xx response
|
* @throws \OpenAPI\Client\ApiException on non-2xx response
|
||||||
* @throws \InvalidArgumentException
|
* @throws \InvalidArgumentException
|
||||||
* @return \OpenAPI\Client\Model\Order
|
* @return \OpenAPI\Client\Model\Order
|
||||||
*/
|
*/
|
||||||
public function getOrderById($order_id)
|
public function getOrderById($order_id, string $contentType = self::contentTypes['getOrderById'][0])
|
||||||
{
|
{
|
||||||
list($response) = $this->getOrderByIdWithHttpInfo($order_id);
|
list($response) = $this->getOrderByIdWithHttpInfo($order_id, $contentType);
|
||||||
return $response;
|
return $response;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -633,14 +652,15 @@ class StoreApi
|
|||||||
* Find purchase order by ID
|
* Find purchase order by ID
|
||||||
*
|
*
|
||||||
* @param int $order_id ID of pet that needs to be fetched (required)
|
* @param int $order_id ID of pet that needs to be fetched (required)
|
||||||
|
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getOrderById'] to see the possible values for this operation
|
||||||
*
|
*
|
||||||
* @throws \OpenAPI\Client\ApiException on non-2xx response
|
* @throws \OpenAPI\Client\ApiException on non-2xx response
|
||||||
* @throws \InvalidArgumentException
|
* @throws \InvalidArgumentException
|
||||||
* @return array of \OpenAPI\Client\Model\Order, HTTP status code, HTTP response headers (array of strings)
|
* @return array of \OpenAPI\Client\Model\Order, HTTP status code, HTTP response headers (array of strings)
|
||||||
*/
|
*/
|
||||||
public function getOrderByIdWithHttpInfo($order_id)
|
public function getOrderByIdWithHttpInfo($order_id, string $contentType = self::contentTypes['getOrderById'][0])
|
||||||
{
|
{
|
||||||
$request = $this->getOrderByIdRequest($order_id);
|
$request = $this->getOrderByIdRequest($order_id, $contentType);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
$options = $this->createHttpClientOption();
|
$options = $this->createHttpClientOption();
|
||||||
@ -732,13 +752,14 @@ class StoreApi
|
|||||||
* Find purchase order by ID
|
* Find purchase order by ID
|
||||||
*
|
*
|
||||||
* @param int $order_id ID of pet that needs to be fetched (required)
|
* @param int $order_id ID of pet that needs to be fetched (required)
|
||||||
|
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getOrderById'] to see the possible values for this operation
|
||||||
*
|
*
|
||||||
* @throws \InvalidArgumentException
|
* @throws \InvalidArgumentException
|
||||||
* @return \GuzzleHttp\Promise\PromiseInterface
|
* @return \GuzzleHttp\Promise\PromiseInterface
|
||||||
*/
|
*/
|
||||||
public function getOrderByIdAsync($order_id)
|
public function getOrderByIdAsync($order_id, string $contentType = self::contentTypes['getOrderById'][0])
|
||||||
{
|
{
|
||||||
return $this->getOrderByIdAsyncWithHttpInfo($order_id)
|
return $this->getOrderByIdAsyncWithHttpInfo($order_id, $contentType)
|
||||||
->then(
|
->then(
|
||||||
function ($response) {
|
function ($response) {
|
||||||
return $response[0];
|
return $response[0];
|
||||||
@ -752,14 +773,15 @@ class StoreApi
|
|||||||
* Find purchase order by ID
|
* Find purchase order by ID
|
||||||
*
|
*
|
||||||
* @param int $order_id ID of pet that needs to be fetched (required)
|
* @param int $order_id ID of pet that needs to be fetched (required)
|
||||||
|
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getOrderById'] to see the possible values for this operation
|
||||||
*
|
*
|
||||||
* @throws \InvalidArgumentException
|
* @throws \InvalidArgumentException
|
||||||
* @return \GuzzleHttp\Promise\PromiseInterface
|
* @return \GuzzleHttp\Promise\PromiseInterface
|
||||||
*/
|
*/
|
||||||
public function getOrderByIdAsyncWithHttpInfo($order_id)
|
public function getOrderByIdAsyncWithHttpInfo($order_id, string $contentType = self::contentTypes['getOrderById'][0])
|
||||||
{
|
{
|
||||||
$returnType = '\OpenAPI\Client\Model\Order';
|
$returnType = '\OpenAPI\Client\Model\Order';
|
||||||
$request = $this->getOrderByIdRequest($order_id);
|
$request = $this->getOrderByIdRequest($order_id, $contentType);
|
||||||
|
|
||||||
return $this->client
|
return $this->client
|
||||||
->sendAsync($request, $this->createHttpClientOption())
|
->sendAsync($request, $this->createHttpClientOption())
|
||||||
@ -801,11 +823,12 @@ class StoreApi
|
|||||||
* Create request for operation 'getOrderById'
|
* Create request for operation 'getOrderById'
|
||||||
*
|
*
|
||||||
* @param int $order_id ID of pet that needs to be fetched (required)
|
* @param int $order_id ID of pet that needs to be fetched (required)
|
||||||
|
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getOrderById'] to see the possible values for this operation
|
||||||
*
|
*
|
||||||
* @throws \InvalidArgumentException
|
* @throws \InvalidArgumentException
|
||||||
* @return \GuzzleHttp\Psr7\Request
|
* @return \GuzzleHttp\Psr7\Request
|
||||||
*/
|
*/
|
||||||
public function getOrderByIdRequest($order_id)
|
public function getOrderByIdRequest($order_id, string $contentType = self::contentTypes['getOrderById'][0])
|
||||||
{
|
{
|
||||||
|
|
||||||
// verify the required parameter 'order_id' is set
|
// verify the required parameter 'order_id' is set
|
||||||
@ -820,7 +843,7 @@ class StoreApi
|
|||||||
if ($order_id < 1) {
|
if ($order_id < 1) {
|
||||||
throw new \InvalidArgumentException('invalid value for "$order_id" when calling StoreApi.getOrderById, must be bigger than or equal to 1.');
|
throw new \InvalidArgumentException('invalid value for "$order_id" when calling StoreApi.getOrderById, must be bigger than or equal to 1.');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
$resourcePath = '/store/order/{order_id}';
|
$resourcePath = '/store/order/{order_id}';
|
||||||
$formParams = [];
|
$formParams = [];
|
||||||
@ -841,16 +864,11 @@ class StoreApi
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if ($multipart) {
|
$headers = $this->headerSelector->selectHeaders(
|
||||||
$headers = $this->headerSelector->selectHeadersForMultipart(
|
['application/xml', 'application/json', ],
|
||||||
['application/xml', 'application/json']
|
$contentType,
|
||||||
);
|
$multipart
|
||||||
} else {
|
);
|
||||||
$headers = $this->headerSelector->selectHeaders(
|
|
||||||
['application/xml', 'application/json'],
|
|
||||||
[]
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
// for model (json/xml)
|
// for model (json/xml)
|
||||||
if (count($formParams) > 0) {
|
if (count($formParams) > 0) {
|
||||||
@ -868,9 +886,9 @@ class StoreApi
|
|||||||
// for HTTP post (form)
|
// for HTTP post (form)
|
||||||
$httpBody = new MultipartStream($multipartContents);
|
$httpBody = new MultipartStream($multipartContents);
|
||||||
|
|
||||||
} elseif ($headers['Content-Type'] === 'application/json') {
|
} elseif (stripos($headers['Content-Type'], 'application/json') !== false) {
|
||||||
|
# if Content-Type contains "application/json", json_encode the form parameters
|
||||||
$httpBody = \GuzzleHttp\json_encode($formParams);
|
$httpBody = \GuzzleHttp\json_encode($formParams);
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
// for HTTP post (form)
|
// for HTTP post (form)
|
||||||
$httpBody = ObjectSerializer::buildQuery($formParams);
|
$httpBody = ObjectSerializer::buildQuery($formParams);
|
||||||
@ -905,14 +923,15 @@ class StoreApi
|
|||||||
* Place an order for a pet
|
* Place an order for a pet
|
||||||
*
|
*
|
||||||
* @param \OpenAPI\Client\Model\Order $order order placed for purchasing the pet (required)
|
* @param \OpenAPI\Client\Model\Order $order order placed for purchasing the pet (required)
|
||||||
|
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['placeOrder'] to see the possible values for this operation
|
||||||
*
|
*
|
||||||
* @throws \OpenAPI\Client\ApiException on non-2xx response
|
* @throws \OpenAPI\Client\ApiException on non-2xx response
|
||||||
* @throws \InvalidArgumentException
|
* @throws \InvalidArgumentException
|
||||||
* @return \OpenAPI\Client\Model\Order
|
* @return \OpenAPI\Client\Model\Order
|
||||||
*/
|
*/
|
||||||
public function placeOrder($order)
|
public function placeOrder($order, string $contentType = self::contentTypes['placeOrder'][0])
|
||||||
{
|
{
|
||||||
list($response) = $this->placeOrderWithHttpInfo($order);
|
list($response) = $this->placeOrderWithHttpInfo($order, $contentType);
|
||||||
return $response;
|
return $response;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -922,14 +941,15 @@ class StoreApi
|
|||||||
* Place an order for a pet
|
* Place an order for a pet
|
||||||
*
|
*
|
||||||
* @param \OpenAPI\Client\Model\Order $order order placed for purchasing the pet (required)
|
* @param \OpenAPI\Client\Model\Order $order order placed for purchasing the pet (required)
|
||||||
|
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['placeOrder'] to see the possible values for this operation
|
||||||
*
|
*
|
||||||
* @throws \OpenAPI\Client\ApiException on non-2xx response
|
* @throws \OpenAPI\Client\ApiException on non-2xx response
|
||||||
* @throws \InvalidArgumentException
|
* @throws \InvalidArgumentException
|
||||||
* @return array of \OpenAPI\Client\Model\Order, HTTP status code, HTTP response headers (array of strings)
|
* @return array of \OpenAPI\Client\Model\Order, HTTP status code, HTTP response headers (array of strings)
|
||||||
*/
|
*/
|
||||||
public function placeOrderWithHttpInfo($order)
|
public function placeOrderWithHttpInfo($order, string $contentType = self::contentTypes['placeOrder'][0])
|
||||||
{
|
{
|
||||||
$request = $this->placeOrderRequest($order);
|
$request = $this->placeOrderRequest($order, $contentType);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
$options = $this->createHttpClientOption();
|
$options = $this->createHttpClientOption();
|
||||||
@ -1021,13 +1041,14 @@ class StoreApi
|
|||||||
* Place an order for a pet
|
* Place an order for a pet
|
||||||
*
|
*
|
||||||
* @param \OpenAPI\Client\Model\Order $order order placed for purchasing the pet (required)
|
* @param \OpenAPI\Client\Model\Order $order order placed for purchasing the pet (required)
|
||||||
|
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['placeOrder'] to see the possible values for this operation
|
||||||
*
|
*
|
||||||
* @throws \InvalidArgumentException
|
* @throws \InvalidArgumentException
|
||||||
* @return \GuzzleHttp\Promise\PromiseInterface
|
* @return \GuzzleHttp\Promise\PromiseInterface
|
||||||
*/
|
*/
|
||||||
public function placeOrderAsync($order)
|
public function placeOrderAsync($order, string $contentType = self::contentTypes['placeOrder'][0])
|
||||||
{
|
{
|
||||||
return $this->placeOrderAsyncWithHttpInfo($order)
|
return $this->placeOrderAsyncWithHttpInfo($order, $contentType)
|
||||||
->then(
|
->then(
|
||||||
function ($response) {
|
function ($response) {
|
||||||
return $response[0];
|
return $response[0];
|
||||||
@ -1041,14 +1062,15 @@ class StoreApi
|
|||||||
* Place an order for a pet
|
* Place an order for a pet
|
||||||
*
|
*
|
||||||
* @param \OpenAPI\Client\Model\Order $order order placed for purchasing the pet (required)
|
* @param \OpenAPI\Client\Model\Order $order order placed for purchasing the pet (required)
|
||||||
|
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['placeOrder'] to see the possible values for this operation
|
||||||
*
|
*
|
||||||
* @throws \InvalidArgumentException
|
* @throws \InvalidArgumentException
|
||||||
* @return \GuzzleHttp\Promise\PromiseInterface
|
* @return \GuzzleHttp\Promise\PromiseInterface
|
||||||
*/
|
*/
|
||||||
public function placeOrderAsyncWithHttpInfo($order)
|
public function placeOrderAsyncWithHttpInfo($order, string $contentType = self::contentTypes['placeOrder'][0])
|
||||||
{
|
{
|
||||||
$returnType = '\OpenAPI\Client\Model\Order';
|
$returnType = '\OpenAPI\Client\Model\Order';
|
||||||
$request = $this->placeOrderRequest($order);
|
$request = $this->placeOrderRequest($order, $contentType);
|
||||||
|
|
||||||
return $this->client
|
return $this->client
|
||||||
->sendAsync($request, $this->createHttpClientOption())
|
->sendAsync($request, $this->createHttpClientOption())
|
||||||
@ -1090,11 +1112,12 @@ class StoreApi
|
|||||||
* Create request for operation 'placeOrder'
|
* Create request for operation 'placeOrder'
|
||||||
*
|
*
|
||||||
* @param \OpenAPI\Client\Model\Order $order order placed for purchasing the pet (required)
|
* @param \OpenAPI\Client\Model\Order $order order placed for purchasing the pet (required)
|
||||||
|
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['placeOrder'] to see the possible values for this operation
|
||||||
*
|
*
|
||||||
* @throws \InvalidArgumentException
|
* @throws \InvalidArgumentException
|
||||||
* @return \GuzzleHttp\Psr7\Request
|
* @return \GuzzleHttp\Psr7\Request
|
||||||
*/
|
*/
|
||||||
public function placeOrderRequest($order)
|
public function placeOrderRequest($order, string $contentType = self::contentTypes['placeOrder'][0])
|
||||||
{
|
{
|
||||||
|
|
||||||
// verify the required parameter 'order' is set
|
// verify the required parameter 'order' is set
|
||||||
@ -1104,6 +1127,7 @@ class StoreApi
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
$resourcePath = '/store/order';
|
$resourcePath = '/store/order';
|
||||||
$formParams = [];
|
$formParams = [];
|
||||||
$queryParams = [];
|
$queryParams = [];
|
||||||
@ -1115,20 +1139,16 @@ class StoreApi
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
if ($multipart) {
|
$headers = $this->headerSelector->selectHeaders(
|
||||||
$headers = $this->headerSelector->selectHeadersForMultipart(
|
['application/xml', 'application/json', ],
|
||||||
['application/xml', 'application/json']
|
$contentType,
|
||||||
);
|
$multipart
|
||||||
} else {
|
);
|
||||||
$headers = $this->headerSelector->selectHeaders(
|
|
||||||
['application/xml', 'application/json'],
|
|
||||||
['application/json']
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
// for model (json/xml)
|
// for model (json/xml)
|
||||||
if (isset($order)) {
|
if (isset($order)) {
|
||||||
if ($headers['Content-Type'] === 'application/json') {
|
if (stripos($headers['Content-Type'], 'application/json') !== false) {
|
||||||
|
# if Content-Type contains "application/json", json_encode the body
|
||||||
$httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($order));
|
$httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($order));
|
||||||
} else {
|
} else {
|
||||||
$httpBody = $order;
|
$httpBody = $order;
|
||||||
@ -1148,9 +1168,9 @@ class StoreApi
|
|||||||
// for HTTP post (form)
|
// for HTTP post (form)
|
||||||
$httpBody = new MultipartStream($multipartContents);
|
$httpBody = new MultipartStream($multipartContents);
|
||||||
|
|
||||||
} elseif ($headers['Content-Type'] === 'application/json') {
|
} elseif (stripos($headers['Content-Type'], 'application/json') !== false) {
|
||||||
|
# if Content-Type contains "application/json", json_encode the form parameters
|
||||||
$httpBody = \GuzzleHttp\json_encode($formParams);
|
$httpBody = \GuzzleHttp\json_encode($formParams);
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
// for HTTP post (form)
|
// for HTTP post (form)
|
||||||
$httpBody = ObjectSerializer::buildQuery($formParams);
|
$httpBody = ObjectSerializer::buildQuery($formParams);
|
||||||
|
File diff suppressed because it is too large
Load Diff
@ -1,6 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
/**
|
/**
|
||||||
* ApiException
|
* HeaderSelector
|
||||||
* PHP version 7.4
|
* PHP version 7.4
|
||||||
*
|
*
|
||||||
* @category Class
|
* @category Class
|
||||||
@ -27,10 +27,8 @@
|
|||||||
|
|
||||||
namespace OpenAPI\Client;
|
namespace OpenAPI\Client;
|
||||||
|
|
||||||
use \Exception;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* ApiException Class Doc Comment
|
* HeaderSelector Class Doc Comment
|
||||||
*
|
*
|
||||||
* @category Class
|
* @category Class
|
||||||
* @package OpenAPI\Client
|
* @package OpenAPI\Client
|
||||||
@ -41,10 +39,11 @@ class HeaderSelector
|
|||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* @param string[] $accept
|
* @param string[] $accept
|
||||||
* @param string[] $contentTypes
|
* @param string $contentType
|
||||||
* @return array
|
* @param bool $isMultipart
|
||||||
|
* @return string[]
|
||||||
*/
|
*/
|
||||||
public function selectHeaders($accept, $contentTypes)
|
public function selectHeaders(array $accept, string $contentType, bool $isMultipart): array
|
||||||
{
|
{
|
||||||
$headers = [];
|
$headers = [];
|
||||||
|
|
||||||
@ -52,20 +51,13 @@ class HeaderSelector
|
|||||||
if ($accept !== null) {
|
if ($accept !== null) {
|
||||||
$headers['Accept'] = $accept;
|
$headers['Accept'] = $accept;
|
||||||
}
|
}
|
||||||
|
if(!$isMultipart) {
|
||||||
|
if($contentType === '') {
|
||||||
|
$contentType = 'application/json';
|
||||||
|
}
|
||||||
|
$headers['Content-Type'] = $contentType;
|
||||||
|
}
|
||||||
|
|
||||||
$headers['Content-Type'] = $this->selectContentTypeHeader($contentTypes);
|
|
||||||
return $headers;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param string[] $accept
|
|
||||||
* @return array
|
|
||||||
*/
|
|
||||||
public function selectHeadersForMultipart($accept)
|
|
||||||
{
|
|
||||||
$headers = $this->selectHeaders($accept, []);
|
|
||||||
|
|
||||||
unset($headers['Content-Type']);
|
|
||||||
return $headers;
|
return $headers;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -86,22 +78,4 @@ class HeaderSelector
|
|||||||
return implode(',', $accept);
|
return implode(',', $accept);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Return the content type based on an array of content-type provided
|
|
||||||
*
|
|
||||||
* @param string[] $contentType Array fo content-type
|
|
||||||
*
|
|
||||||
* @return string Content-Type (e.g. application/json)
|
|
||||||
*/
|
|
||||||
private function selectContentTypeHeader($contentType)
|
|
||||||
{
|
|
||||||
if (count($contentType) === 0 || (count($contentType) === 1 && $contentType[0] === '')) {
|
|
||||||
return 'application/json';
|
|
||||||
} elseif (preg_grep("/application\/json/i", $contentType)) {
|
|
||||||
return 'application/json';
|
|
||||||
} else {
|
|
||||||
return implode(',', $contentType);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@ -1,58 +1,70 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
namespace OpenAPI\Client;
|
namespace OpenAPI\Client;
|
||||||
|
|
||||||
use PHPUnit\Framework\TestCase;
|
use PHPUnit\Framework\TestCase;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* class HeaderSelectorTest
|
||||||
|
*
|
||||||
|
* @package OpenAPI\Client
|
||||||
|
*/
|
||||||
class HeaderSelectorTest extends TestCase
|
class HeaderSelectorTest extends TestCase
|
||||||
{
|
{
|
||||||
public function testSelectingHeaders()
|
/**
|
||||||
|
* @dataProvider headersProvider
|
||||||
|
* @param string[] $accept
|
||||||
|
* @param string $contentType
|
||||||
|
* @param bool $isMultiple
|
||||||
|
* @param string[] $expectedHeaders
|
||||||
|
*/
|
||||||
|
public function testSelectHeaders(array $accept, string $contentType, bool $isMultiple, array $expectedHeaders): void
|
||||||
{
|
{
|
||||||
$selector = new HeaderSelector();
|
$selector = new HeaderSelector();
|
||||||
$headers = $selector->selectHeaders([
|
|
||||||
'application/xml',
|
|
||||||
'application/json'
|
|
||||||
], []);
|
|
||||||
$this->assertSame('application/json', $headers['Accept']);
|
|
||||||
|
|
||||||
$headers = $selector->selectHeaders([], []);
|
$headers = $selector->selectHeaders($accept, $contentType, $isMultiple);
|
||||||
$this->assertArrayNotHasKey('Accept', $headers);
|
$this->assertEquals($expectedHeaders, $headers);
|
||||||
|
|
||||||
$header = $selector->selectHeaders([
|
|
||||||
'application/yaml',
|
|
||||||
'application/xml'
|
|
||||||
], []);
|
|
||||||
$this->assertSame('application/yaml,application/xml', $header['Accept']);
|
|
||||||
|
|
||||||
// test selectHeaderContentType
|
|
||||||
$headers = $selector->selectHeaders([], [
|
|
||||||
'application/xml',
|
|
||||||
'application/json'
|
|
||||||
]);
|
|
||||||
$this->assertSame('application/json', $headers['Content-Type']);
|
|
||||||
|
|
||||||
$headers = $selector->selectHeaders([], []);
|
|
||||||
$this->assertSame('application/json', $headers['Content-Type']);
|
|
||||||
$headers = $selector->selectHeaders([], [
|
|
||||||
'application/yaml',
|
|
||||||
'application/xml'
|
|
||||||
]);
|
|
||||||
$this->assertSame('application/yaml,application/xml', $headers['Content-Type']);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testSelectingHeadersForMultipartBody()
|
/**
|
||||||
|
* @return array[][]
|
||||||
|
*/
|
||||||
|
public function headersProvider(): array
|
||||||
{
|
{
|
||||||
// test selectHeaderAccept
|
return [
|
||||||
$selector = new HeaderSelector();
|
// array $accept, string $contentType, bool $isMultipart, array $expectedHeaders
|
||||||
$headers = $selector->selectHeadersForMultipart([
|
[
|
||||||
'application/xml',
|
[], 'application/xml', false, ['Content-Type' => 'application/xml'],
|
||||||
'application/json'
|
],
|
||||||
]);
|
[
|
||||||
$this->assertSame('application/json', $headers['Accept']);
|
[], 'application/xml', true, [],
|
||||||
$this->assertArrayNotHasKey('Content-Type', $headers);
|
],
|
||||||
|
[
|
||||||
$headers = $selector->selectHeadersForMultipart([]);
|
['application/xml'], '', false, ['Accept' => 'application/xml', 'Content-Type' => 'application/json'],
|
||||||
$this->assertArrayNotHasKey('Accept', $headers);
|
],
|
||||||
$this->assertArrayNotHasKey('Content-Type', $headers);
|
[
|
||||||
|
['application/xml'], '', true, ['Accept' => 'application/xml'],
|
||||||
|
],
|
||||||
|
[
|
||||||
|
['application/xml'], 'application/xml', false, ['Accept' => 'application/xml', 'Content-Type' => 'application/xml'],
|
||||||
|
],
|
||||||
|
[
|
||||||
|
['application/xml'], 'application/xml', true, ['Accept' => 'application/xml'],
|
||||||
|
],
|
||||||
|
[
|
||||||
|
['application/xml', 'text/html'], 'application/xml', false, ['Accept' => 'application/xml,text/html', 'Content-Type' => 'application/xml'],
|
||||||
|
],
|
||||||
|
[
|
||||||
|
['application/json', 'text/html'], 'application/xml', false, ['Accept' => 'application/json', 'Content-Type' => 'application/xml'],
|
||||||
|
],
|
||||||
|
[
|
||||||
|
['text/html', 'application/json'], 'application/xml', false, ['Accept' => 'application/json', 'Content-Type' => 'application/xml'],
|
||||||
|
],
|
||||||
|
[
|
||||||
|
['application/json;format=flowed'], 'text/plain;format=fixed', false, ['Accept' => 'application/json;format=flowed', 'Content-Type' => 'text/plain;format=fixed'],
|
||||||
|
],
|
||||||
|
[
|
||||||
|
['text/html', 'application/json;format=flowed'], 'text/plain;format=fixed', false, ['Accept' => 'application/json;format=flowed', 'Content-Type' => 'text/plain;format=fixed'],
|
||||||
|
],
|
||||||
|
];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user