update php samples

This commit is contained in:
William Cheng
2023-09-23 15:28:43 +08:00
parent d165b8879f
commit d58e68f8c0
27 changed files with 1860 additions and 1486 deletions

View File

@@ -28,6 +28,7 @@
namespace OpenAPI\Client\Api;
use InvalidArgumentException;
use GuzzleHttp\Client;
use GuzzleHttp\ClientInterface;
use GuzzleHttp\Exception\ConnectException;
@@ -35,6 +36,7 @@ use GuzzleHttp\Exception\RequestException;
use GuzzleHttp\Psr7\MultipartStream;
use GuzzleHttp\Psr7\Request;
use GuzzleHttp\RequestOptions;
use GuzzleHttp\Promise\PromiseInterface;
use OpenAPI\Client\ApiException;
use OpenAPI\Client\Configuration;
use OpenAPI\Client\HeaderSelector;
@@ -53,22 +55,22 @@ class AuthApi
/**
* @var ClientInterface
*/
protected $client;
protected ClientInterface $client;
/**
* @var Configuration
*/
protected $config;
protected Configuration $config;
/**
* @var HeaderSelector
*/
protected $headerSelector;
protected HeaderSelector $headerSelector;
/**
* @var int Host index
*/
protected $hostIndex;
protected int $hostIndex;
/** @var string[] $contentTypes **/
public const contentTypes = [
@@ -77,17 +79,17 @@ class AuthApi
],
];
/**
* @param ClientInterface $client
* @param Configuration $config
* @param HeaderSelector $selector
* @param int $hostIndex (Optional) host index to select the list of hosts if defined in the OpenAPI spec
/**
* @param ClientInterface|null $client
* @param Configuration|null $config
* @param HeaderSelector|null $selector
* @param int $hostIndex (Optional) host index to select the list of hosts if defined in the OpenAPI spec
*/
public function __construct(
ClientInterface $client = null,
Configuration $config = null,
HeaderSelector $selector = null,
$hostIndex = 0
int $hostIndex = 0
) {
$this->client = $client ?: new Client();
$this->config = $config ?: new Configuration();
@@ -100,7 +102,7 @@ class AuthApi
*
* @param int $hostIndex Host index (required)
*/
public function setHostIndex($hostIndex): void
public function setHostIndex(int $hostIndex): void
{
$this->hostIndex = $hostIndex;
}
@@ -110,7 +112,7 @@ class AuthApi
*
* @return int Host index
*/
public function getHostIndex()
public function getHostIndex(): int
{
return $this->hostIndex;
}
@@ -118,7 +120,7 @@ class AuthApi
/**
* @return Configuration
*/
public function getConfig()
public function getConfig(): Configuration
{
return $this->config;
}
@@ -130,11 +132,13 @@ class AuthApi
*
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['testAuthHttpBasic'] to see the possible values for this operation
*
* @throws \OpenAPI\Client\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @throws ApiException on non-2xx response
* @throws InvalidArgumentException
* @return string
*/
public function testAuthHttpBasic(string $contentType = self::contentTypes['testAuthHttpBasic'][0])
public function testAuthHttpBasic(
string $contentType = self::contentTypes['testAuthHttpBasic'][0]
): string
{
list($response) = $this->testAuthHttpBasicWithHttpInfo($contentType);
return $response;
@@ -147,11 +151,13 @@ class AuthApi
*
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['testAuthHttpBasic'] to see the possible values for this operation
*
* @throws \OpenAPI\Client\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @throws ApiException on non-2xx response
* @throws InvalidArgumentException
* @return array of string, HTTP status code, HTTP response headers (array of strings)
*/
public function testAuthHttpBasicWithHttpInfo(string $contentType = self::contentTypes['testAuthHttpBasic'][0])
public function testAuthHttpBasicWithHttpInfo(
string $contentType = self::contentTypes['testAuthHttpBasic'][0]
): array
{
$request = $this->testAuthHttpBasicRequest($contentType);
@@ -246,10 +252,12 @@ class AuthApi
*
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['testAuthHttpBasic'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
* @throws InvalidArgumentException
* @return PromiseInterface
*/
public function testAuthHttpBasicAsync(string $contentType = self::contentTypes['testAuthHttpBasic'][0])
public function testAuthHttpBasicAsync(
string $contentType = self::contentTypes['testAuthHttpBasic'][0]
): PromiseInterface
{
return $this->testAuthHttpBasicAsyncWithHttpInfo($contentType)
->then(
@@ -266,10 +274,12 @@ class AuthApi
*
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['testAuthHttpBasic'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
* @throws InvalidArgumentException
* @return PromiseInterface
*/
public function testAuthHttpBasicAsyncWithHttpInfo(string $contentType = self::contentTypes['testAuthHttpBasic'][0])
public function testAuthHttpBasicAsyncWithHttpInfo(
string $contentType = self::contentTypes['testAuthHttpBasic'][0]
): PromiseInterface
{
$returnType = 'string';
$request = $this->testAuthHttpBasicRequest($contentType);
@@ -315,10 +325,12 @@ class AuthApi
*
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['testAuthHttpBasic'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @throws InvalidArgumentException
* @return \GuzzleHttp\Psr7\Request
*/
public function testAuthHttpBasicRequest(string $contentType = self::contentTypes['testAuthHttpBasic'][0])
public function testAuthHttpBasicRequest(
string $contentType = self::contentTypes['testAuthHttpBasic'][0]
): Request
{
@@ -396,7 +408,7 @@ class AuthApi
* @throws \RuntimeException on file opening failure
* @return array of http client options
*/
protected function createHttpClientOption()
protected function createHttpClientOption(): array
{
$options = [];
if ($this->config->getDebug()) {