forked from loafle/openapi-generator-original
feat(php-nextgen-client): add support for streaming (#19192)
Signed-off-by: Emilien Escalle <emilien.escalle@escemi.com>
This commit is contained in:
@@ -223,7 +223,7 @@ class BodyApi
|
||||
|
||||
switch($statusCode) {
|
||||
case 200:
|
||||
if ('\SplFileObject' === '\SplFileObject') {
|
||||
if (in_array('\SplFileObject', ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) {
|
||||
$content = $response->getBody(); //stream goes to serializer
|
||||
} else {
|
||||
$content = (string) $response->getBody();
|
||||
@@ -252,7 +252,7 @@ class BodyApi
|
||||
}
|
||||
|
||||
$returnType = '\SplFileObject';
|
||||
if ($returnType === '\SplFileObject') {
|
||||
if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) {
|
||||
$content = $response->getBody(); //stream goes to serializer
|
||||
} else {
|
||||
$content = (string) $response->getBody();
|
||||
@@ -337,7 +337,7 @@ class BodyApi
|
||||
->sendAsync($request, $this->createHttpClientOption())
|
||||
->then(
|
||||
function ($response) use ($returnType) {
|
||||
if ($returnType === '\SplFileObject') {
|
||||
if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) {
|
||||
$content = $response->getBody(); //stream goes to serializer
|
||||
} else {
|
||||
$content = (string) $response->getBody();
|
||||
@@ -524,7 +524,7 @@ class BodyApi
|
||||
|
||||
switch($statusCode) {
|
||||
case 200:
|
||||
if ('string' === '\SplFileObject') {
|
||||
if (in_array('string', ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) {
|
||||
$content = $response->getBody(); //stream goes to serializer
|
||||
} else {
|
||||
$content = (string) $response->getBody();
|
||||
@@ -553,7 +553,7 @@ class BodyApi
|
||||
}
|
||||
|
||||
$returnType = 'string';
|
||||
if ($returnType === '\SplFileObject') {
|
||||
if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) {
|
||||
$content = $response->getBody(); //stream goes to serializer
|
||||
} else {
|
||||
$content = (string) $response->getBody();
|
||||
@@ -642,7 +642,7 @@ class BodyApi
|
||||
->sendAsync($request, $this->createHttpClientOption())
|
||||
->then(
|
||||
function ($response) use ($returnType) {
|
||||
if ($returnType === '\SplFileObject') {
|
||||
if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) {
|
||||
$content = $response->getBody(); //stream goes to serializer
|
||||
} else {
|
||||
$content = (string) $response->getBody();
|
||||
@@ -839,7 +839,7 @@ class BodyApi
|
||||
|
||||
switch($statusCode) {
|
||||
case 200:
|
||||
if ('string' === '\SplFileObject') {
|
||||
if (in_array('string', ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) {
|
||||
$content = $response->getBody(); //stream goes to serializer
|
||||
} else {
|
||||
$content = (string) $response->getBody();
|
||||
@@ -868,7 +868,7 @@ class BodyApi
|
||||
}
|
||||
|
||||
$returnType = 'string';
|
||||
if ($returnType === '\SplFileObject') {
|
||||
if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) {
|
||||
$content = $response->getBody(); //stream goes to serializer
|
||||
} else {
|
||||
$content = (string) $response->getBody();
|
||||
@@ -957,7 +957,7 @@ class BodyApi
|
||||
->sendAsync($request, $this->createHttpClientOption())
|
||||
->then(
|
||||
function ($response) use ($returnType) {
|
||||
if ($returnType === '\SplFileObject') {
|
||||
if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) {
|
||||
$content = $response->getBody(); //stream goes to serializer
|
||||
} else {
|
||||
$content = (string) $response->getBody();
|
||||
@@ -1028,10 +1028,12 @@ class BodyApi
|
||||
$formParams['files'] = [];
|
||||
$paramFiles = is_array($files) ? $files : [$files];
|
||||
foreach ($paramFiles as $paramFile) {
|
||||
$formParams['files'][] = \GuzzleHttp\Psr7\Utils::tryFopen(
|
||||
ObjectSerializer::toFormValue($paramFile),
|
||||
'rb'
|
||||
);
|
||||
$formParams['files'][] = $paramFile instanceof \Psr\Http\Message\StreamInterface
|
||||
? $paramFile
|
||||
: \GuzzleHttp\Psr7\Utils::tryFopen(
|
||||
ObjectSerializer::toFormValue($paramFile),
|
||||
'rb'
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1165,7 +1167,7 @@ class BodyApi
|
||||
|
||||
switch($statusCode) {
|
||||
case 200:
|
||||
if ('string' === '\SplFileObject') {
|
||||
if (in_array('string', ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) {
|
||||
$content = $response->getBody(); //stream goes to serializer
|
||||
} else {
|
||||
$content = (string) $response->getBody();
|
||||
@@ -1194,7 +1196,7 @@ class BodyApi
|
||||
}
|
||||
|
||||
$returnType = 'string';
|
||||
if ($returnType === '\SplFileObject') {
|
||||
if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) {
|
||||
$content = $response->getBody(); //stream goes to serializer
|
||||
} else {
|
||||
$content = (string) $response->getBody();
|
||||
@@ -1283,7 +1285,7 @@ class BodyApi
|
||||
->sendAsync($request, $this->createHttpClientOption())
|
||||
->then(
|
||||
function ($response) use ($returnType) {
|
||||
if ($returnType === '\SplFileObject') {
|
||||
if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) {
|
||||
$content = $response->getBody(); //stream goes to serializer
|
||||
} else {
|
||||
$content = (string) $response->getBody();
|
||||
@@ -1348,10 +1350,12 @@ class BodyApi
|
||||
$formParams['my-file'] = [];
|
||||
$paramFiles = is_array($my_file) ? $my_file : [$my_file];
|
||||
foreach ($paramFiles as $paramFile) {
|
||||
$formParams['my-file'][] = \GuzzleHttp\Psr7\Utils::tryFopen(
|
||||
ObjectSerializer::toFormValue($paramFile),
|
||||
'rb'
|
||||
);
|
||||
$formParams['my-file'][] = $paramFile instanceof \Psr\Http\Message\StreamInterface
|
||||
? $paramFile
|
||||
: \GuzzleHttp\Psr7\Utils::tryFopen(
|
||||
ObjectSerializer::toFormValue($paramFile),
|
||||
'rb'
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1485,7 +1489,7 @@ class BodyApi
|
||||
|
||||
switch($statusCode) {
|
||||
case 200:
|
||||
if ('\OpenAPI\Client\Model\Pet' === '\SplFileObject') {
|
||||
if (in_array('\OpenAPI\Client\Model\Pet', ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) {
|
||||
$content = $response->getBody(); //stream goes to serializer
|
||||
} else {
|
||||
$content = (string) $response->getBody();
|
||||
@@ -1514,7 +1518,7 @@ class BodyApi
|
||||
}
|
||||
|
||||
$returnType = '\OpenAPI\Client\Model\Pet';
|
||||
if ($returnType === '\SplFileObject') {
|
||||
if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) {
|
||||
$content = $response->getBody(); //stream goes to serializer
|
||||
} else {
|
||||
$content = (string) $response->getBody();
|
||||
@@ -1603,7 +1607,7 @@ class BodyApi
|
||||
->sendAsync($request, $this->createHttpClientOption())
|
||||
->then(
|
||||
function ($response) use ($returnType) {
|
||||
if ($returnType === '\SplFileObject') {
|
||||
if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) {
|
||||
$content = $response->getBody(); //stream goes to serializer
|
||||
} else {
|
||||
$content = (string) $response->getBody();
|
||||
@@ -1800,7 +1804,7 @@ class BodyApi
|
||||
|
||||
switch($statusCode) {
|
||||
case 200:
|
||||
if ('string' === '\SplFileObject') {
|
||||
if (in_array('string', ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) {
|
||||
$content = $response->getBody(); //stream goes to serializer
|
||||
} else {
|
||||
$content = (string) $response->getBody();
|
||||
@@ -1829,7 +1833,7 @@ class BodyApi
|
||||
}
|
||||
|
||||
$returnType = 'string';
|
||||
if ($returnType === '\SplFileObject') {
|
||||
if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) {
|
||||
$content = $response->getBody(); //stream goes to serializer
|
||||
} else {
|
||||
$content = (string) $response->getBody();
|
||||
@@ -1918,7 +1922,7 @@ class BodyApi
|
||||
->sendAsync($request, $this->createHttpClientOption())
|
||||
->then(
|
||||
function ($response) use ($returnType) {
|
||||
if ($returnType === '\SplFileObject') {
|
||||
if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) {
|
||||
$content = $response->getBody(); //stream goes to serializer
|
||||
} else {
|
||||
$content = (string) $response->getBody();
|
||||
@@ -2115,7 +2119,7 @@ class BodyApi
|
||||
|
||||
switch($statusCode) {
|
||||
case 200:
|
||||
if ('\OpenAPI\Client\Model\Pet' === '\SplFileObject') {
|
||||
if (in_array('\OpenAPI\Client\Model\Pet', ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) {
|
||||
$content = $response->getBody(); //stream goes to serializer
|
||||
} else {
|
||||
$content = (string) $response->getBody();
|
||||
@@ -2144,7 +2148,7 @@ class BodyApi
|
||||
}
|
||||
|
||||
$returnType = '\OpenAPI\Client\Model\Pet';
|
||||
if ($returnType === '\SplFileObject') {
|
||||
if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) {
|
||||
$content = $response->getBody(); //stream goes to serializer
|
||||
} else {
|
||||
$content = (string) $response->getBody();
|
||||
@@ -2233,7 +2237,7 @@ class BodyApi
|
||||
->sendAsync($request, $this->createHttpClientOption())
|
||||
->then(
|
||||
function ($response) use ($returnType) {
|
||||
if ($returnType === '\SplFileObject') {
|
||||
if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) {
|
||||
$content = $response->getBody(); //stream goes to serializer
|
||||
} else {
|
||||
$content = (string) $response->getBody();
|
||||
@@ -2430,7 +2434,7 @@ class BodyApi
|
||||
|
||||
switch($statusCode) {
|
||||
case 200:
|
||||
if ('string' === '\SplFileObject') {
|
||||
if (in_array('string', ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) {
|
||||
$content = $response->getBody(); //stream goes to serializer
|
||||
} else {
|
||||
$content = (string) $response->getBody();
|
||||
@@ -2459,7 +2463,7 @@ class BodyApi
|
||||
}
|
||||
|
||||
$returnType = 'string';
|
||||
if ($returnType === '\SplFileObject') {
|
||||
if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) {
|
||||
$content = $response->getBody(); //stream goes to serializer
|
||||
} else {
|
||||
$content = (string) $response->getBody();
|
||||
@@ -2548,7 +2552,7 @@ class BodyApi
|
||||
->sendAsync($request, $this->createHttpClientOption())
|
||||
->then(
|
||||
function ($response) use ($returnType) {
|
||||
if ($returnType === '\SplFileObject') {
|
||||
if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) {
|
||||
$content = $response->getBody(); //stream goes to serializer
|
||||
} else {
|
||||
$content = (string) $response->getBody();
|
||||
@@ -2745,7 +2749,7 @@ class BodyApi
|
||||
|
||||
switch($statusCode) {
|
||||
case 200:
|
||||
if ('\OpenAPI\Client\Model\StringEnumRef' === '\SplFileObject') {
|
||||
if (in_array('\OpenAPI\Client\Model\StringEnumRef', ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) {
|
||||
$content = $response->getBody(); //stream goes to serializer
|
||||
} else {
|
||||
$content = (string) $response->getBody();
|
||||
@@ -2774,7 +2778,7 @@ class BodyApi
|
||||
}
|
||||
|
||||
$returnType = '\OpenAPI\Client\Model\StringEnumRef';
|
||||
if ($returnType === '\SplFileObject') {
|
||||
if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) {
|
||||
$content = $response->getBody(); //stream goes to serializer
|
||||
} else {
|
||||
$content = (string) $response->getBody();
|
||||
@@ -2863,7 +2867,7 @@ class BodyApi
|
||||
->sendAsync($request, $this->createHttpClientOption())
|
||||
->then(
|
||||
function ($response) use ($returnType) {
|
||||
if ($returnType === '\SplFileObject') {
|
||||
if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) {
|
||||
$content = $response->getBody(); //stream goes to serializer
|
||||
} else {
|
||||
$content = (string) $response->getBody();
|
||||
@@ -3060,7 +3064,7 @@ class BodyApi
|
||||
|
||||
switch($statusCode) {
|
||||
case 200:
|
||||
if ('string' === '\SplFileObject') {
|
||||
if (in_array('string', ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) {
|
||||
$content = $response->getBody(); //stream goes to serializer
|
||||
} else {
|
||||
$content = (string) $response->getBody();
|
||||
@@ -3089,7 +3093,7 @@ class BodyApi
|
||||
}
|
||||
|
||||
$returnType = 'string';
|
||||
if ($returnType === '\SplFileObject') {
|
||||
if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) {
|
||||
$content = $response->getBody(); //stream goes to serializer
|
||||
} else {
|
||||
$content = (string) $response->getBody();
|
||||
@@ -3178,7 +3182,7 @@ class BodyApi
|
||||
->sendAsync($request, $this->createHttpClientOption())
|
||||
->then(
|
||||
function ($response) use ($returnType) {
|
||||
if ($returnType === '\SplFileObject') {
|
||||
if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) {
|
||||
$content = $response->getBody(); //stream goes to serializer
|
||||
} else {
|
||||
$content = (string) $response->getBody();
|
||||
|
||||
Reference in New Issue
Block a user