diff --git a/.openapi-generator/VERSION b/.openapi-generator/VERSION index 1b2d969d..f6b1800f 100644 --- a/.openapi-generator/VERSION +++ b/.openapi-generator/VERSION @@ -1 +1 @@ -7.18.0 +7.27.0 diff --git a/composer.json b/composer.json index 524d657a..97b55250 100644 --- a/composer.json +++ b/composer.json @@ -23,8 +23,9 @@ "ext-curl": "*", "ext-json": "*", "ext-mbstring": "*", - "guzzlehttp/guzzle": "^7.3", - "guzzlehttp/psr7": "^1.7 || ^2.0" + "guzzlehttp/guzzle": "^7.3 || ^8.0", + "guzzlehttp/psr7": "^1.7 || ^2.0 || ^3.0", + "psr/http-client": "^1.0" }, "require-dev": { "phpunit/phpunit": "^8.0 || ^9.0", diff --git a/generate_api.sh b/generate_api.sh index 40be2983..a69db262 100755 --- a/generate_api.sh +++ b/generate_api.sh @@ -10,7 +10,7 @@ rm -r ./lib/* rm -r ./docs/* LOG_LEVEL="warn" -TAG="v7.18.0" +TAG="v7.27.0" # generate sysadmin docker run --rm \ diff --git a/lib/Auth/APITokenApi.php b/lib/Auth/APITokenApi.php index e41e422b..eb5ea13f 100644 --- a/lib/Auth/APITokenApi.php +++ b/lib/Auth/APITokenApi.php @@ -28,11 +28,11 @@ use GuzzleHttp\Client; use GuzzleHttp\ClientInterface; -use GuzzleHttp\Exception\ConnectException; use GuzzleHttp\Exception\RequestException; use GuzzleHttp\Psr7\MultipartStream; use GuzzleHttp\Psr7\Request; use GuzzleHttp\RequestOptions; +use Psr\Http\Client\NetworkExceptionInterface; use Psr\Http\Message\RequestInterface; use Psr\Http\Message\ResponseInterface; use SeaTable\Client\ApiException; @@ -181,13 +181,14 @@ public function createApiTokenWithHttpInfo($workspace_id, $base_name, $app_name, try { $response = $this->client->send($request, $options); } catch (RequestException $e) { + $eResponse = $this->getExceptionResponse($e); throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), - $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? (string) $e->getResponse()->getBody() : null + $eResponse ? $eResponse->getHeaders() : null, + $eResponse ? (string) $eResponse->getBody() : null ); - } catch (ConnectException $e) { + } catch (NetworkExceptionInterface $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), @@ -308,7 +309,15 @@ function ($response) use ($returnType) { ]; }, function ($exception) { - $response = $exception->getResponse(); + $response = $this->getExceptionResponse($exception); + if ($response === null) { + throw new ApiException( + "[{$exception->getCode()}] {$exception->getMessage()}", + (int) $exception->getCode(), + null, + null + ); + } $statusCode = $response->getStatusCode(); throw new ApiException( sprintf( @@ -383,7 +392,7 @@ public function createApiTokenRequest($workspace_id, $base_name, $app_name, $per // path params if ($workspace_id !== null) { $resourcePath = str_replace( - '{' . 'workspace_id' . '}', + '{workspace_id}', ObjectSerializer::toPathValue($workspace_id), $resourcePath ); @@ -391,7 +400,7 @@ public function createApiTokenRequest($workspace_id, $base_name, $app_name, $per // path params if ($base_name !== null) { $resourcePath = str_replace( - '{' . 'base_name' . '}', + '{base_name}', ObjectSerializer::toPathValue($base_name), $resourcePath ); @@ -432,7 +441,11 @@ public function createApiTokenRequest($workspace_id, $base_name, $app_name, $per } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + try { + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + } catch (\JsonException $e) { + throw new \InvalidArgumentException('json_encode error: ' . $e->getMessage(), 0, $e); + } } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -506,13 +519,14 @@ public function createTempApiTokenWithHttpInfo($workspace_id, $base_name, string try { $response = $this->client->send($request, $options); } catch (RequestException $e) { + $eResponse = $this->getExceptionResponse($e); throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), - $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? (string) $e->getResponse()->getBody() : null + $eResponse ? $eResponse->getHeaders() : null, + $eResponse ? (string) $eResponse->getBody() : null ); - } catch (ConnectException $e) { + } catch (NetworkExceptionInterface $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), @@ -629,7 +643,15 @@ function ($response) use ($returnType) { ]; }, function ($exception) { - $response = $exception->getResponse(); + $response = $this->getExceptionResponse($exception); + if ($response === null) { + throw new ApiException( + "[{$exception->getCode()}] {$exception->getMessage()}", + (int) $exception->getCode(), + null, + null + ); + } $statusCode = $response->getStatusCode(); throw new ApiException( sprintf( @@ -688,7 +710,7 @@ public function createTempApiTokenRequest($workspace_id, $base_name, string $con // path params if ($workspace_id !== null) { $resourcePath = str_replace( - '{' . 'workspace_id' . '}', + '{workspace_id}', ObjectSerializer::toPathValue($workspace_id), $resourcePath ); @@ -696,7 +718,7 @@ public function createTempApiTokenRequest($workspace_id, $base_name, string $con // path params if ($base_name !== null) { $resourcePath = str_replace( - '{' . 'base_name' . '}', + '{base_name}', ObjectSerializer::toPathValue($base_name), $resourcePath ); @@ -727,7 +749,11 @@ public function createTempApiTokenRequest($workspace_id, $base_name, string $con } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + try { + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + } catch (\JsonException $e) { + throw new \InvalidArgumentException('json_encode error: ' . $e->getMessage(), 0, $e); + } } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -803,13 +829,14 @@ public function deleteApiTokenWithHttpInfo($workspace_id, $base_name, $app_name, try { $response = $this->client->send($request, $options); } catch (RequestException $e) { + $eResponse = $this->getExceptionResponse($e); throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), - $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? (string) $e->getResponse()->getBody() : null + $eResponse ? $eResponse->getHeaders() : null, + $eResponse ? (string) $eResponse->getBody() : null ); - } catch (ConnectException $e) { + } catch (NetworkExceptionInterface $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), @@ -928,7 +955,15 @@ function ($response) use ($returnType) { ]; }, function ($exception) { - $response = $exception->getResponse(); + $response = $this->getExceptionResponse($exception); + if ($response === null) { + throw new ApiException( + "[{$exception->getCode()}] {$exception->getMessage()}", + (int) $exception->getCode(), + null, + null + ); + } $statusCode = $response->getStatusCode(); throw new ApiException( sprintf( @@ -995,7 +1030,7 @@ public function deleteApiTokenRequest($workspace_id, $base_name, $app_name, stri // path params if ($workspace_id !== null) { $resourcePath = str_replace( - '{' . 'workspace_id' . '}', + '{workspace_id}', ObjectSerializer::toPathValue($workspace_id), $resourcePath ); @@ -1003,7 +1038,7 @@ public function deleteApiTokenRequest($workspace_id, $base_name, $app_name, stri // path params if ($base_name !== null) { $resourcePath = str_replace( - '{' . 'base_name' . '}', + '{base_name}', ObjectSerializer::toPathValue($base_name), $resourcePath ); @@ -1011,7 +1046,7 @@ public function deleteApiTokenRequest($workspace_id, $base_name, $app_name, stri // path params if ($app_name !== null) { $resourcePath = str_replace( - '{' . 'app_name' . '}', + '{app_name}', ObjectSerializer::toPathValue($app_name), $resourcePath ); @@ -1042,7 +1077,11 @@ public function deleteApiTokenRequest($workspace_id, $base_name, $app_name, stri } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + try { + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + } catch (\JsonException $e) { + throw new \InvalidArgumentException('json_encode error: ' . $e->getMessage(), 0, $e); + } } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -1116,13 +1155,14 @@ public function listApiTokensWithHttpInfo($workspace_id, $base_name, string $con try { $response = $this->client->send($request, $options); } catch (RequestException $e) { + $eResponse = $this->getExceptionResponse($e); throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), - $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? (string) $e->getResponse()->getBody() : null + $eResponse ? $eResponse->getHeaders() : null, + $eResponse ? (string) $eResponse->getBody() : null ); - } catch (ConnectException $e) { + } catch (NetworkExceptionInterface $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), @@ -1239,7 +1279,15 @@ function ($response) use ($returnType) { ]; }, function ($exception) { - $response = $exception->getResponse(); + $response = $this->getExceptionResponse($exception); + if ($response === null) { + throw new ApiException( + "[{$exception->getCode()}] {$exception->getMessage()}", + (int) $exception->getCode(), + null, + null + ); + } $statusCode = $response->getStatusCode(); throw new ApiException( sprintf( @@ -1298,7 +1346,7 @@ public function listApiTokensRequest($workspace_id, $base_name, string $contentT // path params if ($workspace_id !== null) { $resourcePath = str_replace( - '{' . 'workspace_id' . '}', + '{workspace_id}', ObjectSerializer::toPathValue($workspace_id), $resourcePath ); @@ -1306,7 +1354,7 @@ public function listApiTokensRequest($workspace_id, $base_name, string $contentT // path params if ($base_name !== null) { $resourcePath = str_replace( - '{' . 'base_name' . '}', + '{base_name}', ObjectSerializer::toPathValue($base_name), $resourcePath ); @@ -1337,7 +1385,11 @@ public function listApiTokensRequest($workspace_id, $base_name, string $contentT } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + try { + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + } catch (\JsonException $e) { + throw new \InvalidArgumentException('json_encode error: ' . $e->getMessage(), 0, $e); + } } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -1415,13 +1467,14 @@ public function updateApiTokenWithHttpInfo($workspace_id, $base_name, $app_name, try { $response = $this->client->send($request, $options); } catch (RequestException $e) { + $eResponse = $this->getExceptionResponse($e); throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), - $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? (string) $e->getResponse()->getBody() : null + $eResponse ? $eResponse->getHeaders() : null, + $eResponse ? (string) $eResponse->getBody() : null ); - } catch (ConnectException $e) { + } catch (NetworkExceptionInterface $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), @@ -1542,7 +1595,15 @@ function ($response) use ($returnType) { ]; }, function ($exception) { - $response = $exception->getResponse(); + $response = $this->getExceptionResponse($exception); + if ($response === null) { + throw new ApiException( + "[{$exception->getCode()}] {$exception->getMessage()}", + (int) $exception->getCode(), + null, + null + ); + } $statusCode = $response->getStatusCode(); throw new ApiException( sprintf( @@ -1617,7 +1678,7 @@ public function updateApiTokenRequest($workspace_id, $base_name, $app_name, $per // path params if ($workspace_id !== null) { $resourcePath = str_replace( - '{' . 'workspace_id' . '}', + '{workspace_id}', ObjectSerializer::toPathValue($workspace_id), $resourcePath ); @@ -1625,7 +1686,7 @@ public function updateApiTokenRequest($workspace_id, $base_name, $app_name, $per // path params if ($base_name !== null) { $resourcePath = str_replace( - '{' . 'base_name' . '}', + '{base_name}', ObjectSerializer::toPathValue($base_name), $resourcePath ); @@ -1633,7 +1694,7 @@ public function updateApiTokenRequest($workspace_id, $base_name, $app_name, $per // path params if ($app_name !== null) { $resourcePath = str_replace( - '{' . 'app_name' . '}', + '{app_name}', ObjectSerializer::toPathValue($app_name), $resourcePath ); @@ -1674,7 +1735,11 @@ public function updateApiTokenRequest($workspace_id, $base_name, $app_name, $per } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + try { + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + } catch (\JsonException $e) { + throw new \InvalidArgumentException('json_encode error: ' . $e->getMessage(), 0, $e); + } } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -1734,6 +1799,21 @@ protected function createHttpClientOption() return $options; } + /** + * Returns the response attached to a Guzzle exception, if there is one. + * + * Guzzle 7 exposes getResponse() on RequestException, while Guzzle 8 only + * exposes it on ResponseException and its subclasses. + * + * @param \Throwable $exception + * + * @return ResponseInterface|null + */ + private function getExceptionResponse(\Throwable $exception): ?ResponseInterface + { + return method_exists($exception, 'getResponse') ? $exception->getResponse() : null; + } + private function handleResponseWithDataType( string $dataType, RequestInterface $request, diff --git a/lib/Auth/AccessToken.php b/lib/Auth/AccessToken.php index 6649ddfc..6d1020e2 100644 --- a/lib/Auth/AccessToken.php +++ b/lib/Auth/AccessToken.php @@ -45,49 +45,49 @@ class AccessToken implements ModelInterface, ArrayAccess, \JsonSerializable public const DISCRIMINATOR = null; /** - * The original name of the model. - * - * @var string - */ + * The original name of the model. + * + * @var string + */ protected static $openAPIModelName = 'AccessToken'; /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ protected static $openAPITypes = [ 'access_token' => 'string', 'dtable_uuid' => 'string' ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - * @phpstan-var array - * @psalm-var array - */ + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ protected static $openAPIFormats = [ 'access_token' => null, 'dtable_uuid' => 'uuid' ]; /** - * Array of nullable properties. Used for (de)serialization - * - * @var boolean[] - */ + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ protected static array $openAPINullables = [ 'access_token' => false, 'dtable_uuid' => false ]; /** - * If a nullable field gets set to null, insert it here - * - * @var boolean[] - */ + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ protected array $openAPINullablesSetToNull = []; /** @@ -255,14 +255,14 @@ public function __construct(?array $data = null) } /** - * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName - * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the - * $this->openAPINullablesSetToNull array - * - * @param string $variableName - * @param array $fields - * @param mixed $defaultValue - */ + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ private function setIfExists(string $variableName, array $fields, $defaultValue): void { if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { diff --git a/lib/Auth/AccountToken.php b/lib/Auth/AccountToken.php index dce8121c..e9da1eca 100644 --- a/lib/Auth/AccountToken.php +++ b/lib/Auth/AccountToken.php @@ -45,46 +45,46 @@ class AccountToken implements ModelInterface, ArrayAccess, \JsonSerializable public const DISCRIMINATOR = null; /** - * The original name of the model. - * - * @var string - */ + * The original name of the model. + * + * @var string + */ protected static $openAPIModelName = 'AccountToken'; /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ protected static $openAPITypes = [ 'token' => 'string' ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - * @phpstan-var array - * @psalm-var array - */ + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ protected static $openAPIFormats = [ 'token' => null ]; /** - * Array of nullable properties. Used for (de)serialization - * - * @var boolean[] - */ + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ protected static array $openAPINullables = [ 'token' => false ]; /** - * If a nullable field gets set to null, insert it here - * - * @var boolean[] - */ + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ protected array $openAPINullablesSetToNull = []; /** @@ -248,14 +248,14 @@ public function __construct(?array $data = null) } /** - * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName - * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the - * $this->openAPINullablesSetToNull array - * - * @param string $variableName - * @param array $fields - * @param mixed $defaultValue - */ + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ private function setIfExists(string $variableName, array $fields, $defaultValue): void { if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { diff --git a/lib/Auth/AccountTokenApi.php b/lib/Auth/AccountTokenApi.php index 2e547a82..e42e93c4 100644 --- a/lib/Auth/AccountTokenApi.php +++ b/lib/Auth/AccountTokenApi.php @@ -28,11 +28,11 @@ use GuzzleHttp\Client; use GuzzleHttp\ClientInterface; -use GuzzleHttp\Exception\ConnectException; use GuzzleHttp\Exception\RequestException; use GuzzleHttp\Psr7\MultipartStream; use GuzzleHttp\Psr7\Request; use GuzzleHttp\RequestOptions; +use Psr\Http\Client\NetworkExceptionInterface; use Psr\Http\Message\RequestInterface; use Psr\Http\Message\ResponseInterface; use SeaTable\Client\ApiException; @@ -167,13 +167,14 @@ public function getAccountTokenfromUsernameWithHttpInfo($username, $password, $x try { $response = $this->client->send($request, $options); } catch (RequestException $e) { + $eResponse = $this->getExceptionResponse($e); throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), - $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? (string) $e->getResponse()->getBody() : null + $eResponse ? $eResponse->getHeaders() : null, + $eResponse ? (string) $eResponse->getBody() : null ); - } catch (ConnectException $e) { + } catch (NetworkExceptionInterface $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), @@ -292,7 +293,15 @@ function ($response) use ($returnType) { ]; }, function ($exception) { - $response = $exception->getResponse(); + $response = $this->getExceptionResponse($exception); + if ($response === null) { + throw new ApiException( + "[{$exception->getCode()}] {$exception->getMessage()}", + (int) $exception->getCode(), + null, + null + ); + } $statusCode = $response->getStatusCode(); throw new ApiException( sprintf( @@ -390,7 +399,11 @@ public function getAccountTokenfromUsernameRequest($username, $password, $x_seaf } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + try { + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + } catch (\JsonException $e) { + throw new \InvalidArgumentException('json_encode error: ' . $e->getMessage(), 0, $e); + } } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -446,6 +459,21 @@ protected function createHttpClientOption() return $options; } + /** + * Returns the response attached to a Guzzle exception, if there is one. + * + * Guzzle 7 exposes getResponse() on RequestException, while Guzzle 8 only + * exposes it on ResponseException and its subclasses. + * + * @param \Throwable $exception + * + * @return ResponseInterface|null + */ + private function getExceptionResponse(\Throwable $exception): ?ResponseInterface + { + return method_exists($exception, 'getResponse') ? $exception->getResponse() : null; + } + private function handleResponseWithDataType( string $dataType, RequestInterface $request, diff --git a/lib/Auth/ApiToken.php b/lib/Auth/ApiToken.php index f8b424fe..318db415 100644 --- a/lib/Auth/ApiToken.php +++ b/lib/Auth/ApiToken.php @@ -45,17 +45,17 @@ class ApiToken implements ModelInterface, ArrayAccess, \JsonSerializable public const DISCRIMINATOR = null; /** - * The original name of the model. - * - * @var string - */ + * The original name of the model. + * + * @var string + */ protected static $openAPIModelName = 'ApiToken'; /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ protected static $openAPITypes = [ 'app_name' => 'string', 'api_token' => 'string', @@ -66,12 +66,12 @@ class ApiToken implements ModelInterface, ArrayAccess, \JsonSerializable ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - * @phpstan-var array - * @psalm-var array - */ + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ protected static $openAPIFormats = [ 'app_name' => null, 'api_token' => null, @@ -82,10 +82,10 @@ class ApiToken implements ModelInterface, ArrayAccess, \JsonSerializable ]; /** - * Array of nullable properties. Used for (de)serialization - * - * @var boolean[] - */ + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ protected static array $openAPINullables = [ 'app_name' => false, 'api_token' => false, @@ -96,10 +96,10 @@ class ApiToken implements ModelInterface, ArrayAccess, \JsonSerializable ]; /** - * If a nullable field gets set to null, insert it here - * - * @var boolean[] - */ + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ protected array $openAPINullablesSetToNull = []; /** @@ -300,14 +300,14 @@ public function __construct(?array $data = null) } /** - * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName - * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the - * $this->openAPINullablesSetToNull array - * - * @param string $variableName - * @param array $fields - * @param mixed $defaultValue - */ + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ private function setIfExists(string $variableName, array $fields, $defaultValue): void { if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { diff --git a/lib/Auth/ApiTokenList.php b/lib/Auth/ApiTokenList.php index 9f8cee1a..0c914f26 100644 --- a/lib/Auth/ApiTokenList.php +++ b/lib/Auth/ApiTokenList.php @@ -45,46 +45,46 @@ class ApiTokenList implements ModelInterface, ArrayAccess, \JsonSerializable public const DISCRIMINATOR = null; /** - * The original name of the model. - * - * @var string - */ + * The original name of the model. + * + * @var string + */ protected static $openAPIModelName = 'ApiTokenList'; /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ protected static $openAPITypes = [ 'api_tokens' => '\SeaTable\Client\Auth\ApiToken[]' ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - * @phpstan-var array - * @psalm-var array - */ + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ protected static $openAPIFormats = [ 'api_tokens' => null ]; /** - * Array of nullable properties. Used for (de)serialization - * - * @var boolean[] - */ + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ protected static array $openAPINullables = [ 'api_tokens' => false ]; /** - * If a nullable field gets set to null, insert it here - * - * @var boolean[] - */ + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ protected array $openAPINullablesSetToNull = []; /** @@ -248,14 +248,14 @@ public function __construct(?array $data = null) } /** - * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName - * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the - * $this->openAPINullablesSetToNull array - * - * @param string $variableName - * @param array $fields - * @param mixed $defaultValue - */ + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ private function setIfExists(string $variableName, array $fields, $defaultValue): void { if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { diff --git a/lib/Auth/ApiTokenTemporary.php b/lib/Auth/ApiTokenTemporary.php index 2827ce16..098fedbf 100644 --- a/lib/Auth/ApiTokenTemporary.php +++ b/lib/Auth/ApiTokenTemporary.php @@ -45,46 +45,46 @@ class ApiTokenTemporary implements ModelInterface, ArrayAccess, \JsonSerializabl public const DISCRIMINATOR = null; /** - * The original name of the model. - * - * @var string - */ + * The original name of the model. + * + * @var string + */ protected static $openAPIModelName = 'ApiTokenTemporary'; /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ protected static $openAPITypes = [ 'api_token' => 'string' ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - * @phpstan-var array - * @psalm-var array - */ + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ protected static $openAPIFormats = [ 'api_token' => null ]; /** - * Array of nullable properties. Used for (de)serialization - * - * @var boolean[] - */ + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ protected static array $openAPINullables = [ 'api_token' => false ]; /** - * If a nullable field gets set to null, insert it here - * - * @var boolean[] - */ + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ protected array $openAPINullablesSetToNull = []; /** @@ -248,14 +248,14 @@ public function __construct(?array $data = null) } /** - * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName - * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the - * $this->openAPINullablesSetToNull array - * - * @param string $variableName - * @param array $fields - * @param mixed $defaultValue - */ + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ private function setIfExists(string $variableName, array $fields, $defaultValue): void { if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { diff --git a/lib/Auth/BaseTokenApi.php b/lib/Auth/BaseTokenApi.php index 1916d175..c194f06e 100644 --- a/lib/Auth/BaseTokenApi.php +++ b/lib/Auth/BaseTokenApi.php @@ -28,11 +28,11 @@ use GuzzleHttp\Client; use GuzzleHttp\ClientInterface; -use GuzzleHttp\Exception\ConnectException; use GuzzleHttp\Exception\RequestException; use GuzzleHttp\Psr7\MultipartStream; use GuzzleHttp\Psr7\Request; use GuzzleHttp\RequestOptions; +use Psr\Http\Client\NetworkExceptionInterface; use Psr\Http\Message\RequestInterface; use Psr\Http\Message\ResponseInterface; use SeaTable\Client\ApiException; @@ -170,13 +170,14 @@ public function getBaseTokenWithAccountTokenWithHttpInfo($workspace_id, $base_na try { $response = $this->client->send($request, $options); } catch (RequestException $e) { + $eResponse = $this->getExceptionResponse($e); throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), - $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? (string) $e->getResponse()->getBody() : null + $eResponse ? $eResponse->getHeaders() : null, + $eResponse ? (string) $eResponse->getBody() : null ); - } catch (ConnectException $e) { + } catch (NetworkExceptionInterface $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), @@ -295,7 +296,15 @@ function ($response) use ($returnType) { ]; }, function ($exception) { - $response = $exception->getResponse(); + $response = $this->getExceptionResponse($exception); + if ($response === null) { + throw new ApiException( + "[{$exception->getCode()}] {$exception->getMessage()}", + (int) $exception->getCode(), + null, + null + ); + } $statusCode = $response->getStatusCode(); throw new ApiException( sprintf( @@ -365,7 +374,7 @@ public function getBaseTokenWithAccountTokenRequest($workspace_id, $base_name, $ // path params if ($workspace_id !== null) { $resourcePath = str_replace( - '{' . 'workspace_id' . '}', + '{workspace_id}', ObjectSerializer::toPathValue($workspace_id), $resourcePath ); @@ -373,7 +382,7 @@ public function getBaseTokenWithAccountTokenRequest($workspace_id, $base_name, $ // path params if ($base_name !== null) { $resourcePath = str_replace( - '{' . 'base_name' . '}', + '{base_name}', ObjectSerializer::toPathValue($base_name), $resourcePath ); @@ -404,7 +413,11 @@ public function getBaseTokenWithAccountTokenRequest($workspace_id, $base_name, $ } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + try { + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + } catch (\JsonException $e) { + throw new \InvalidArgumentException('json_encode error: ' . $e->getMessage(), 0, $e); + } } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -476,13 +489,14 @@ public function getBaseTokenWithApiTokenWithHttpInfo($exp = '3d', string $conten try { $response = $this->client->send($request, $options); } catch (RequestException $e) { + $eResponse = $this->getExceptionResponse($e); throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), - $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? (string) $e->getResponse()->getBody() : null + $eResponse ? $eResponse->getHeaders() : null, + $eResponse ? (string) $eResponse->getBody() : null ); - } catch (ConnectException $e) { + } catch (NetworkExceptionInterface $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), @@ -611,7 +625,15 @@ function ($response) use ($returnType) { ]; }, function ($exception) { - $response = $exception->getResponse(); + $response = $this->getExceptionResponse($exception); + if ($response === null) { + throw new ApiException( + "[{$exception->getCode()}] {$exception->getMessage()}", + (int) $exception->getCode(), + null, + null + ); + } $statusCode = $response->getStatusCode(); throw new ApiException( sprintf( @@ -685,7 +707,11 @@ public function getBaseTokenWithApiTokenRequest($exp = '3d', string $contentType } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + try { + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + } catch (\JsonException $e) { + throw new \InvalidArgumentException('json_encode error: ' . $e->getMessage(), 0, $e); + } } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -745,6 +771,21 @@ protected function createHttpClientOption() return $options; } + /** + * Returns the response attached to a Guzzle exception, if there is one. + * + * Guzzle 7 exposes getResponse() on RequestException, while Guzzle 8 only + * exposes it on ResponseException and its subclasses. + * + * @param \Throwable $exception + * + * @return ResponseInterface|null + */ + private function getExceptionResponse(\Throwable $exception): ?ResponseInterface + { + return method_exists($exception, 'getResponse') ? $exception->getResponse() : null; + } + private function handleResponseWithDataType( string $dataType, RequestInterface $request, diff --git a/lib/Auth/GetBaseTokenWithApiToken200Response.php b/lib/Auth/GetBaseTokenWithApiToken200Response.php index 2518e5ed..a44c1325 100644 --- a/lib/Auth/GetBaseTokenWithApiToken200Response.php +++ b/lib/Auth/GetBaseTokenWithApiToken200Response.php @@ -44,17 +44,17 @@ class GetBaseTokenWithApiToken200Response implements ModelInterface, ArrayAccess public const DISCRIMINATOR = null; /** - * The original name of the model. - * - * @var string - */ + * The original name of the model. + * + * @var string + */ protected static $openAPIModelName = 'getBaseTokenWithApiToken_200_response'; /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ protected static $openAPITypes = [ 'app_name' => 'string', 'access_token' => 'string', @@ -66,12 +66,12 @@ class GetBaseTokenWithApiToken200Response implements ModelInterface, ArrayAccess ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - * @phpstan-var array - * @psalm-var array - */ + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ protected static $openAPIFormats = [ 'app_name' => null, 'access_token' => null, @@ -83,10 +83,10 @@ class GetBaseTokenWithApiToken200Response implements ModelInterface, ArrayAccess ]; /** - * Array of nullable properties. Used for (de)serialization - * - * @var boolean[] - */ + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ protected static array $openAPINullables = [ 'app_name' => false, 'access_token' => false, @@ -98,10 +98,10 @@ class GetBaseTokenWithApiToken200Response implements ModelInterface, ArrayAccess ]; /** - * If a nullable field gets set to null, insert it here - * - * @var boolean[] - */ + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ protected array $openAPINullablesSetToNull = []; /** @@ -289,14 +289,14 @@ public function __construct(?array $data = null) } /** - * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName - * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the - * $this->openAPINullablesSetToNull array - * - * @param string $variableName - * @param array $fields - * @param mixed $defaultValue - */ + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ private function setIfExists(string $variableName, array $fields, $defaultValue): void { if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { diff --git a/lib/Base/ActivitiesLogsApi.php b/lib/Base/ActivitiesLogsApi.php index 5bce7e4e..cc3550ec 100644 --- a/lib/Base/ActivitiesLogsApi.php +++ b/lib/Base/ActivitiesLogsApi.php @@ -28,11 +28,11 @@ use GuzzleHttp\Client; use GuzzleHttp\ClientInterface; -use GuzzleHttp\Exception\ConnectException; use GuzzleHttp\Exception\RequestException; use GuzzleHttp\Psr7\MultipartStream; use GuzzleHttp\Psr7\Request; use GuzzleHttp\RequestOptions; +use Psr\Http\Client\NetworkExceptionInterface; use Psr\Http\Message\RequestInterface; use Psr\Http\Message\ResponseInterface; use SeaTable\Client\ApiException; @@ -168,13 +168,14 @@ public function getBaseActivityLogWithHttpInfo($base_uuid, $page = null, string try { $response = $this->client->send($request, $options); } catch (RequestException $e) { + $eResponse = $this->getExceptionResponse($e); throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), - $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? (string) $e->getResponse()->getBody() : null + $eResponse ? $eResponse->getHeaders() : null, + $eResponse ? (string) $eResponse->getBody() : null ); - } catch (ConnectException $e) { + } catch (NetworkExceptionInterface $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), @@ -291,7 +292,15 @@ function ($response) use ($returnType) { ]; }, function ($exception) { - $response = $exception->getResponse(); + $response = $this->getExceptionResponse($exception); + if ($response === null) { + throw new ApiException( + "[{$exception->getCode()}] {$exception->getMessage()}", + (int) $exception->getCode(), + null, + null + ); + } $statusCode = $response->getStatusCode(); throw new ApiException( sprintf( @@ -356,7 +365,7 @@ public function getBaseActivityLogRequest($base_uuid, $page = null, string $cont // path params if ($base_uuid !== null) { $resourcePath = str_replace( - '{' . 'base_uuid' . '}', + '{base_uuid}', ObjectSerializer::toPathValue($base_uuid), $resourcePath ); @@ -387,7 +396,11 @@ public function getBaseActivityLogRequest($base_uuid, $page = null, string $cont } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + try { + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + } catch (\JsonException $e) { + throw new \InvalidArgumentException('json_encode error: ' . $e->getMessage(), 0, $e); + } } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -465,13 +478,14 @@ public function listRowActivitiesWithHttpInfo($row_id, $base_uuid, $page = null, try { $response = $this->client->send($request, $options); } catch (RequestException $e) { + $eResponse = $this->getExceptionResponse($e); throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), - $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? (string) $e->getResponse()->getBody() : null + $eResponse ? $eResponse->getHeaders() : null, + $eResponse ? (string) $eResponse->getBody() : null ); - } catch (ConnectException $e) { + } catch (NetworkExceptionInterface $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), @@ -592,7 +606,15 @@ function ($response) use ($returnType) { ]; }, function ($exception) { - $response = $exception->getResponse(); + $response = $this->getExceptionResponse($exception); + if ($response === null) { + throw new ApiException( + "[{$exception->getCode()}] {$exception->getMessage()}", + (int) $exception->getCode(), + null, + null + ); + } $statusCode = $response->getStatusCode(); throw new ApiException( sprintf( @@ -691,7 +713,7 @@ public function listRowActivitiesRequest($row_id, $base_uuid, $page = null, $per // path params if ($base_uuid !== null) { $resourcePath = str_replace( - '{' . 'base_uuid' . '}', + '{base_uuid}', ObjectSerializer::toPathValue($base_uuid), $resourcePath ); @@ -722,7 +744,11 @@ public function listRowActivitiesRequest($row_id, $base_uuid, $page = null, $per } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + try { + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + } catch (\JsonException $e) { + throw new \InvalidArgumentException('json_encode error: ' . $e->getMessage(), 0, $e); + } } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -782,6 +808,21 @@ protected function createHttpClientOption() return $options; } + /** + * Returns the response attached to a Guzzle exception, if there is one. + * + * Guzzle 7 exposes getResponse() on RequestException, while Guzzle 8 only + * exposes it on ResponseException and its subclasses. + * + * @param \Throwable $exception + * + * @return ResponseInterface|null + */ + private function getExceptionResponse(\Throwable $exception): ?ResponseInterface + { + return method_exists($exception, 'getResponse') ? $exception->getResponse() : null; + } + private function handleResponseWithDataType( string $dataType, RequestInterface $request, diff --git a/lib/Base/AddSingleMultipleSelectOptions.php b/lib/Base/AddSingleMultipleSelectOptions.php index dd3a6f0d..4a23e7c1 100644 --- a/lib/Base/AddSingleMultipleSelectOptions.php +++ b/lib/Base/AddSingleMultipleSelectOptions.php @@ -44,17 +44,17 @@ class AddSingleMultipleSelectOptions implements ModelInterface, ArrayAccess, \Js public const DISCRIMINATOR = null; /** - * The original name of the model. - * - * @var string - */ + * The original name of the model. + * + * @var string + */ protected static $openAPIModelName = 'add_single__multiple_select_options'; /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ protected static $openAPITypes = [ 'table_name' => 'string', 'column' => 'string', @@ -62,12 +62,12 @@ class AddSingleMultipleSelectOptions implements ModelInterface, ArrayAccess, \Js ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - * @phpstan-var array - * @psalm-var array - */ + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ protected static $openAPIFormats = [ 'table_name' => null, 'column' => null, @@ -75,10 +75,10 @@ class AddSingleMultipleSelectOptions implements ModelInterface, ArrayAccess, \Js ]; /** - * Array of nullable properties. Used for (de)serialization - * - * @var boolean[] - */ + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ protected static array $openAPINullables = [ 'table_name' => false, 'column' => false, @@ -86,10 +86,10 @@ class AddSingleMultipleSelectOptions implements ModelInterface, ArrayAccess, \Js ]; /** - * If a nullable field gets set to null, insert it here - * - * @var boolean[] - */ + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ protected array $openAPINullablesSetToNull = []; /** @@ -261,14 +261,14 @@ public function __construct(?array $data = null) } /** - * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName - * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the - * $this->openAPINullablesSetToNull array - * - * @param string $variableName - * @param array $fields - * @param mixed $defaultValue - */ + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ private function setIfExists(string $variableName, array $fields, $defaultValue): void { if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { diff --git a/lib/Base/AddSingleMultipleSelectOptionsOptionsInner.php b/lib/Base/AddSingleMultipleSelectOptionsOptionsInner.php index 7006ed0c..cc29916e 100644 --- a/lib/Base/AddSingleMultipleSelectOptionsOptionsInner.php +++ b/lib/Base/AddSingleMultipleSelectOptionsOptionsInner.php @@ -44,17 +44,17 @@ class AddSingleMultipleSelectOptionsOptionsInner implements ModelInterface, Arra public const DISCRIMINATOR = null; /** - * The original name of the model. - * - * @var string - */ + * The original name of the model. + * + * @var string + */ protected static $openAPIModelName = 'add_single__multiple_select_options_options_inner'; /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ protected static $openAPITypes = [ 'name' => 'string', 'color' => 'string', @@ -62,12 +62,12 @@ class AddSingleMultipleSelectOptionsOptionsInner implements ModelInterface, Arra ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - * @phpstan-var array - * @psalm-var array - */ + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ protected static $openAPIFormats = [ 'name' => null, 'color' => null, @@ -75,10 +75,10 @@ class AddSingleMultipleSelectOptionsOptionsInner implements ModelInterface, Arra ]; /** - * Array of nullable properties. Used for (de)serialization - * - * @var boolean[] - */ + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ protected static array $openAPINullables = [ 'name' => false, 'color' => false, @@ -86,10 +86,10 @@ class AddSingleMultipleSelectOptionsOptionsInner implements ModelInterface, Arra ]; /** - * If a nullable field gets set to null, insert it here - * - * @var boolean[] - */ + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ protected array $openAPINullablesSetToNull = []; /** @@ -261,14 +261,14 @@ public function __construct(?array $data = null) } /** - * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName - * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the - * $this->openAPINullablesSetToNull array - * - * @param string $variableName - * @param array $fields - * @param mixed $defaultValue - */ + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ private function setIfExists(string $variableName, array $fields, $defaultValue): void { if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { diff --git a/lib/Base/AppendColumnsRequest.php b/lib/Base/AppendColumnsRequest.php index 2527fe3c..cc01662b 100644 --- a/lib/Base/AppendColumnsRequest.php +++ b/lib/Base/AppendColumnsRequest.php @@ -44,49 +44,49 @@ class AppendColumnsRequest implements ModelInterface, ArrayAccess, \JsonSerializ public const DISCRIMINATOR = null; /** - * The original name of the model. - * - * @var string - */ + * The original name of the model. + * + * @var string + */ protected static $openAPIModelName = 'appendColumns_request'; /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ protected static $openAPITypes = [ 'table_name' => 'string', 'columns' => '\SeaTable\Client\Base\AppendColumnsRequestColumnsInner[]' ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - * @phpstan-var array - * @psalm-var array - */ + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ protected static $openAPIFormats = [ 'table_name' => null, 'columns' => null ]; /** - * Array of nullable properties. Used for (de)serialization - * - * @var boolean[] - */ + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ protected static array $openAPINullables = [ 'table_name' => false, 'columns' => false ]; /** - * If a nullable field gets set to null, insert it here - * - * @var boolean[] - */ + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ protected array $openAPINullablesSetToNull = []; /** @@ -254,14 +254,14 @@ public function __construct(?array $data = null) } /** - * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName - * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the - * $this->openAPINullablesSetToNull array - * - * @param string $variableName - * @param array $fields - * @param mixed $defaultValue - */ + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ private function setIfExists(string $variableName, array $fields, $defaultValue): void { if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { diff --git a/lib/Base/AppendColumnsRequestColumnsInner.php b/lib/Base/AppendColumnsRequestColumnsInner.php index 8580e94d..5717d3cf 100644 --- a/lib/Base/AppendColumnsRequestColumnsInner.php +++ b/lib/Base/AppendColumnsRequestColumnsInner.php @@ -44,17 +44,17 @@ class AppendColumnsRequestColumnsInner implements ModelInterface, ArrayAccess, \ public const DISCRIMINATOR = null; /** - * The original name of the model. - * - * @var string - */ + * The original name of the model. + * + * @var string + */ protected static $openAPIModelName = 'appendColumns_request_columns_inner'; /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ protected static $openAPITypes = [ 'column_name' => 'string', 'column_type' => 'string', @@ -63,12 +63,12 @@ class AppendColumnsRequestColumnsInner implements ModelInterface, ArrayAccess, \ ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - * @phpstan-var array - * @psalm-var array - */ + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ protected static $openAPIFormats = [ 'column_name' => null, 'column_type' => null, @@ -77,10 +77,10 @@ class AppendColumnsRequestColumnsInner implements ModelInterface, ArrayAccess, \ ]; /** - * Array of nullable properties. Used for (de)serialization - * - * @var boolean[] - */ + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ protected static array $openAPINullables = [ 'column_name' => false, 'column_type' => false, @@ -89,10 +89,10 @@ class AppendColumnsRequestColumnsInner implements ModelInterface, ArrayAccess, \ ]; /** - * If a nullable field gets set to null, insert it here - * - * @var boolean[] - */ + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ protected array $openAPINullablesSetToNull = []; /** @@ -281,14 +281,14 @@ public function __construct(?array $data = null) } /** - * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName - * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the - * $this->openAPINullablesSetToNull array - * - * @param string $variableName - * @param array $fields - * @param mixed $defaultValue - */ + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ private function setIfExists(string $variableName, array $fields, $defaultValue): void { if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { diff --git a/lib/Base/AppendRow.php b/lib/Base/AppendRow.php index 6a59e6c3..014c4b5d 100644 --- a/lib/Base/AppendRow.php +++ b/lib/Base/AppendRow.php @@ -45,17 +45,17 @@ class AppendRow implements ModelInterface, ArrayAccess, \JsonSerializable public const DISCRIMINATOR = null; /** - * The original name of the model. - * - * @var string - */ + * The original name of the model. + * + * @var string + */ protected static $openAPIModelName = 'append_row'; /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ protected static $openAPITypes = [ 'table_name' => 'string', 'row' => 'object', @@ -63,12 +63,12 @@ class AppendRow implements ModelInterface, ArrayAccess, \JsonSerializable ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - * @phpstan-var array - * @psalm-var array - */ + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ protected static $openAPIFormats = [ 'table_name' => null, 'row' => null, @@ -76,10 +76,10 @@ class AppendRow implements ModelInterface, ArrayAccess, \JsonSerializable ]; /** - * Array of nullable properties. Used for (de)serialization - * - * @var boolean[] - */ + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ protected static array $openAPINullables = [ 'table_name' => false, 'row' => false, @@ -87,10 +87,10 @@ class AppendRow implements ModelInterface, ArrayAccess, \JsonSerializable ]; /** - * If a nullable field gets set to null, insert it here - * - * @var boolean[] - */ + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ protected array $openAPINullablesSetToNull = []; /** @@ -262,14 +262,14 @@ public function __construct(?array $data = null) } /** - * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName - * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the - * $this->openAPINullablesSetToNull array - * - * @param string $variableName - * @param array $fields - * @param mixed $defaultValue - */ + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ private function setIfExists(string $variableName, array $fields, $defaultValue): void { if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { diff --git a/lib/Base/AppendRows.php b/lib/Base/AppendRows.php index fb9eee4b..2ef24dc3 100644 --- a/lib/Base/AppendRows.php +++ b/lib/Base/AppendRows.php @@ -45,17 +45,17 @@ class AppendRows implements ModelInterface, ArrayAccess, \JsonSerializable public const DISCRIMINATOR = null; /** - * The original name of the model. - * - * @var string - */ + * The original name of the model. + * + * @var string + */ protected static $openAPIModelName = 'append_rows'; /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ protected static $openAPITypes = [ 'table_name' => 'string', 'rows' => 'object[]', @@ -63,12 +63,12 @@ class AppendRows implements ModelInterface, ArrayAccess, \JsonSerializable ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - * @phpstan-var array - * @psalm-var array - */ + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ protected static $openAPIFormats = [ 'table_name' => null, 'rows' => null, @@ -76,10 +76,10 @@ class AppendRows implements ModelInterface, ArrayAccess, \JsonSerializable ]; /** - * Array of nullable properties. Used for (de)serialization - * - * @var boolean[] - */ + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ protected static array $openAPINullables = [ 'table_name' => false, 'rows' => false, @@ -87,10 +87,10 @@ class AppendRows implements ModelInterface, ArrayAccess, \JsonSerializable ]; /** - * If a nullable field gets set to null, insert it here - * - * @var boolean[] - */ + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ protected array $openAPINullablesSetToNull = []; /** @@ -262,14 +262,14 @@ public function __construct(?array $data = null) } /** - * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName - * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the - * $this->openAPINullablesSetToNull array - * - * @param string $variableName - * @param array $fields - * @param mixed $defaultValue - */ + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ private function setIfExists(string $variableName, array $fields, $defaultValue): void { if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { @@ -362,7 +362,6 @@ public function setRows($rows) if (is_null($rows)) { throw new \InvalidArgumentException('non-nullable rows cannot be null'); } - if ((count($rows) > 1000)) { throw new \InvalidArgumentException('invalid value for $rows when calling AppendRows., number of items must be less than or equal to 1000.'); } diff --git a/lib/Base/AppendRows200Response.php b/lib/Base/AppendRows200Response.php index 61a97285..45f3369d 100644 --- a/lib/Base/AppendRows200Response.php +++ b/lib/Base/AppendRows200Response.php @@ -44,17 +44,17 @@ class AppendRows200Response implements ModelInterface, ArrayAccess, \JsonSeriali public const DISCRIMINATOR = null; /** - * The original name of the model. - * - * @var string - */ + * The original name of the model. + * + * @var string + */ protected static $openAPIModelName = 'appendRows_200_response'; /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ protected static $openAPITypes = [ 'inserted_row_count' => 'int', 'row_ids' => 'object[]', @@ -62,12 +62,12 @@ class AppendRows200Response implements ModelInterface, ArrayAccess, \JsonSeriali ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - * @phpstan-var array - * @psalm-var array - */ + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ protected static $openAPIFormats = [ 'inserted_row_count' => null, 'row_ids' => null, @@ -75,10 +75,10 @@ class AppendRows200Response implements ModelInterface, ArrayAccess, \JsonSeriali ]; /** - * Array of nullable properties. Used for (de)serialization - * - * @var boolean[] - */ + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ protected static array $openAPINullables = [ 'inserted_row_count' => false, 'row_ids' => false, @@ -86,10 +86,10 @@ class AppendRows200Response implements ModelInterface, ArrayAccess, \JsonSeriali ]; /** - * If a nullable field gets set to null, insert it here - * - * @var boolean[] - */ + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ protected array $openAPINullablesSetToNull = []; /** @@ -261,14 +261,14 @@ public function __construct(?array $data = null) } /** - * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName - * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the - * $this->openAPINullablesSetToNull array - * - * @param string $variableName - * @param array $fields - * @param mixed $defaultValue - */ + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ private function setIfExists(string $variableName, array $fields, $defaultValue): void { if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { diff --git a/lib/Base/ArchiveView.php b/lib/Base/ArchiveView.php index 4109dd4d..bb5ecc68 100644 --- a/lib/Base/ArchiveView.php +++ b/lib/Base/ArchiveView.php @@ -44,49 +44,49 @@ class ArchiveView implements ModelInterface, ArrayAccess, \JsonSerializable public const DISCRIMINATOR = null; /** - * The original name of the model. - * - * @var string - */ + * The original name of the model. + * + * @var string + */ protected static $openAPIModelName = 'archive-view'; /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ protected static $openAPITypes = [ 'table_name' => 'string', 'view_name' => 'string' ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - * @phpstan-var array - * @psalm-var array - */ + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ protected static $openAPIFormats = [ 'table_name' => null, 'view_name' => null ]; /** - * Array of nullable properties. Used for (de)serialization - * - * @var boolean[] - */ + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ protected static array $openAPINullables = [ 'table_name' => false, 'view_name' => false ]; /** - * If a nullable field gets set to null, insert it here - * - * @var boolean[] - */ + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ protected array $openAPINullablesSetToNull = []; /** @@ -254,14 +254,14 @@ public function __construct(?array $data = null) } /** - * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName - * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the - * $this->openAPINullablesSetToNull array - * - * @param string $variableName - * @param array $fields - * @param mixed $defaultValue - */ + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ private function setIfExists(string $variableName, array $fields, $defaultValue): void { if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { diff --git a/lib/Base/AutonumberColumn.php b/lib/Base/AutonumberColumn.php index 00eee1bd..82132e37 100644 --- a/lib/Base/AutonumberColumn.php +++ b/lib/Base/AutonumberColumn.php @@ -45,17 +45,17 @@ class AutonumberColumn implements ModelInterface, ArrayAccess, \JsonSerializable public const DISCRIMINATOR = null; /** - * The original name of the model. - * - * @var string - */ + * The original name of the model. + * + * @var string + */ protected static $openAPIModelName = 'autonumber_column'; /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ protected static $openAPITypes = [ 'column_name' => 'string', 'column_type' => 'string', @@ -64,12 +64,12 @@ class AutonumberColumn implements ModelInterface, ArrayAccess, \JsonSerializable ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - * @phpstan-var array - * @psalm-var array - */ + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ protected static $openAPIFormats = [ 'column_name' => null, 'column_type' => null, @@ -78,10 +78,10 @@ class AutonumberColumn implements ModelInterface, ArrayAccess, \JsonSerializable ]; /** - * Array of nullable properties. Used for (de)serialization - * - * @var boolean[] - */ + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ protected static array $openAPINullables = [ 'column_name' => false, 'column_type' => false, @@ -90,10 +90,10 @@ class AutonumberColumn implements ModelInterface, ArrayAccess, \JsonSerializable ]; /** - * If a nullable field gets set to null, insert it here - * - * @var boolean[] - */ + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ protected array $openAPINullablesSetToNull = []; /** @@ -282,14 +282,14 @@ public function __construct(?array $data = null) } /** - * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName - * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the - * $this->openAPINullablesSetToNull array - * - * @param string $variableName - * @param array $fields - * @param mixed $defaultValue - */ + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ private function setIfExists(string $variableName, array $fields, $defaultValue): void { if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { diff --git a/lib/Base/AutonumberColumnFormat.php b/lib/Base/AutonumberColumnFormat.php index 16eb9733..2b425ca3 100644 --- a/lib/Base/AutonumberColumnFormat.php +++ b/lib/Base/AutonumberColumnFormat.php @@ -45,17 +45,17 @@ class AutonumberColumnFormat implements ModelInterface, ArrayAccess, \JsonSerial public const DISCRIMINATOR = null; /** - * The original name of the model. - * - * @var string - */ + * The original name of the model. + * + * @var string + */ protected static $openAPIModelName = 'autonumber_column_format'; /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ protected static $openAPITypes = [ 'format' => 'string', 'digits' => 'int', @@ -64,12 +64,12 @@ class AutonumberColumnFormat implements ModelInterface, ArrayAccess, \JsonSerial ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - * @phpstan-var array - * @psalm-var array - */ + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ protected static $openAPIFormats = [ 'format' => null, 'digits' => null, @@ -78,10 +78,10 @@ class AutonumberColumnFormat implements ModelInterface, ArrayAccess, \JsonSerial ]; /** - * Array of nullable properties. Used for (de)serialization - * - * @var boolean[] - */ + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ protected static array $openAPINullables = [ 'format' => false, 'digits' => false, @@ -90,10 +90,10 @@ class AutonumberColumnFormat implements ModelInterface, ArrayAccess, \JsonSerial ]; /** - * If a nullable field gets set to null, insert it here - * - * @var boolean[] - */ + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ protected array $openAPINullablesSetToNull = []; /** @@ -284,14 +284,14 @@ public function __construct(?array $data = null) } /** - * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName - * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the - * $this->openAPINullablesSetToNull array - * - * @param string $variableName - * @param array $fields - * @param mixed $defaultValue - */ + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ private function setIfExists(string $variableName, array $fields, $defaultValue): void { if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { diff --git a/lib/Base/AutonumberColumnWithTableName.php b/lib/Base/AutonumberColumnWithTableName.php index a4797543..63a53244 100644 --- a/lib/Base/AutonumberColumnWithTableName.php +++ b/lib/Base/AutonumberColumnWithTableName.php @@ -44,17 +44,17 @@ class AutonumberColumnWithTableName implements ModelInterface, ArrayAccess, \Jso public const DISCRIMINATOR = null; /** - * The original name of the model. - * - * @var string - */ + * The original name of the model. + * + * @var string + */ protected static $openAPIModelName = 'autonumber_column_with_table_name'; /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ protected static $openAPITypes = [ 'table_name' => 'string', 'column_name' => 'string', @@ -64,12 +64,12 @@ class AutonumberColumnWithTableName implements ModelInterface, ArrayAccess, \Jso ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - * @phpstan-var array - * @psalm-var array - */ + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ protected static $openAPIFormats = [ 'table_name' => null, 'column_name' => null, @@ -79,10 +79,10 @@ class AutonumberColumnWithTableName implements ModelInterface, ArrayAccess, \Jso ]; /** - * Array of nullable properties. Used for (de)serialization - * - * @var boolean[] - */ + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ protected static array $openAPINullables = [ 'table_name' => false, 'column_name' => false, @@ -92,10 +92,10 @@ class AutonumberColumnWithTableName implements ModelInterface, ArrayAccess, \Jso ]; /** - * If a nullable field gets set to null, insert it here - * - * @var boolean[] - */ + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ protected array $openAPINullablesSetToNull = []; /** @@ -288,14 +288,14 @@ public function __construct(?array $data = null) } /** - * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName - * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the - * $this->openAPINullablesSetToNull array - * - * @param string $variableName - * @param array $fields - * @param mixed $defaultValue - */ + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ private function setIfExists(string $variableName, array $fields, $defaultValue): void { if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { diff --git a/lib/Base/Base.php b/lib/Base/Base.php index d92f86c0..ae57406c 100644 --- a/lib/Base/Base.php +++ b/lib/Base/Base.php @@ -45,17 +45,17 @@ class Base implements ModelInterface, ArrayAccess, \JsonSerializable public const DISCRIMINATOR = null; /** - * The original name of the model. - * - * @var string - */ + * The original name of the model. + * + * @var string + */ protected static $openAPIModelName = 'base'; /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ protected static $openAPITypes = [ '_id' => 'string', 'name' => 'string', @@ -68,12 +68,12 @@ class Base implements ModelInterface, ArrayAccess, \JsonSerializable ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - * @phpstan-var array - * @psalm-var array - */ + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ protected static $openAPIFormats = [ '_id' => null, 'name' => null, @@ -86,10 +86,10 @@ class Base implements ModelInterface, ArrayAccess, \JsonSerializable ]; /** - * Array of nullable properties. Used for (de)serialization - * - * @var boolean[] - */ + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ protected static array $openAPINullables = [ '_id' => false, 'name' => false, @@ -102,10 +102,10 @@ class Base implements ModelInterface, ArrayAccess, \JsonSerializable ]; /** - * If a nullable field gets set to null, insert it here - * - * @var boolean[] - */ + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ protected array $openAPINullablesSetToNull = []; /** @@ -297,14 +297,14 @@ public function __construct(?array $data = null) } /** - * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName - * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the - * $this->openAPINullablesSetToNull array - * - * @param string $variableName - * @param array $fields - * @param mixed $defaultValue - */ + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ private function setIfExists(string $variableName, array $fields, $defaultValue): void { if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { diff --git a/lib/Base/BaseInfoApi.php b/lib/Base/BaseInfoApi.php index cd913a5b..959fbf04 100644 --- a/lib/Base/BaseInfoApi.php +++ b/lib/Base/BaseInfoApi.php @@ -28,11 +28,11 @@ use GuzzleHttp\Client; use GuzzleHttp\ClientInterface; -use GuzzleHttp\Exception\ConnectException; use GuzzleHttp\Exception\RequestException; use GuzzleHttp\Psr7\MultipartStream; use GuzzleHttp\Psr7\Request; use GuzzleHttp\RequestOptions; +use Psr\Http\Client\NetworkExceptionInterface; use Psr\Http\Message\RequestInterface; use Psr\Http\Message\ResponseInterface; use SeaTable\Client\ApiException; @@ -166,13 +166,14 @@ public function getMetadataWithHttpInfo($base_uuid, string $contentType = self:: try { $response = $this->client->send($request, $options); } catch (RequestException $e) { + $eResponse = $this->getExceptionResponse($e); throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), - $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? (string) $e->getResponse()->getBody() : null + $eResponse ? $eResponse->getHeaders() : null, + $eResponse ? (string) $eResponse->getBody() : null ); - } catch (ConnectException $e) { + } catch (NetworkExceptionInterface $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), @@ -301,7 +302,15 @@ function ($response) use ($returnType) { ]; }, function ($exception) { - $response = $exception->getResponse(); + $response = $this->getExceptionResponse($exception); + if ($response === null) { + throw new ApiException( + "[{$exception->getCode()}] {$exception->getMessage()}", + (int) $exception->getCode(), + null, + null + ); + } $statusCode = $response->getStatusCode(); throw new ApiException( sprintf( @@ -352,7 +361,7 @@ public function getMetadataRequest($base_uuid, string $contentType = self::conte // path params if ($base_uuid !== null) { $resourcePath = str_replace( - '{' . 'base_uuid' . '}', + '{base_uuid}', ObjectSerializer::toPathValue($base_uuid), $resourcePath ); @@ -383,7 +392,11 @@ public function getMetadataRequest($base_uuid, string $contentType = self::conte } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + try { + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + } catch (\JsonException $e) { + throw new \InvalidArgumentException('json_encode error: ' . $e->getMessage(), 0, $e); + } } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -455,13 +468,14 @@ public function listCollaboratorsWithHttpInfo($base_uuid, string $contentType = try { $response = $this->client->send($request, $options); } catch (RequestException $e) { + $eResponse = $this->getExceptionResponse($e); throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), - $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? (string) $e->getResponse()->getBody() : null + $eResponse ? $eResponse->getHeaders() : null, + $eResponse ? (string) $eResponse->getBody() : null ); - } catch (ConnectException $e) { + } catch (NetworkExceptionInterface $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), @@ -576,7 +590,15 @@ function ($response) use ($returnType) { ]; }, function ($exception) { - $response = $exception->getResponse(); + $response = $this->getExceptionResponse($exception); + if ($response === null) { + throw new ApiException( + "[{$exception->getCode()}] {$exception->getMessage()}", + (int) $exception->getCode(), + null, + null + ); + } $statusCode = $response->getStatusCode(); throw new ApiException( sprintf( @@ -627,7 +649,7 @@ public function listCollaboratorsRequest($base_uuid, string $contentType = self: // path params if ($base_uuid !== null) { $resourcePath = str_replace( - '{' . 'base_uuid' . '}', + '{base_uuid}', ObjectSerializer::toPathValue($base_uuid), $resourcePath ); @@ -658,7 +680,11 @@ public function listCollaboratorsRequest($base_uuid, string $contentType = self: } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + try { + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + } catch (\JsonException $e) { + throw new \InvalidArgumentException('json_encode error: ' . $e->getMessage(), 0, $e); + } } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -718,6 +744,21 @@ protected function createHttpClientOption() return $options; } + /** + * Returns the response attached to a Guzzle exception, if there is one. + * + * Guzzle 7 exposes getResponse() on RequestException, while Guzzle 8 only + * exposes it on ResponseException and its subclasses. + * + * @param \Throwable $exception + * + * @return ResponseInterface|null + */ + private function getExceptionResponse(\Throwable $exception): ?ResponseInterface + { + return method_exists($exception, 'getResponse') ? $exception->getResponse() : null; + } + private function handleResponseWithDataType( string $dataType, RequestInterface $request, diff --git a/lib/Base/BigDataApi.php b/lib/Base/BigDataApi.php index 60873359..888ccef3 100644 --- a/lib/Base/BigDataApi.php +++ b/lib/Base/BigDataApi.php @@ -28,11 +28,11 @@ use GuzzleHttp\Client; use GuzzleHttp\ClientInterface; -use GuzzleHttp\Exception\ConnectException; use GuzzleHttp\Exception\RequestException; use GuzzleHttp\Psr7\MultipartStream; use GuzzleHttp\Psr7\Request; use GuzzleHttp\RequestOptions; +use Psr\Http\Client\NetworkExceptionInterface; use Psr\Http\Message\RequestInterface; use Psr\Http\Message\ResponseInterface; use SeaTable\Client\ApiException; @@ -177,13 +177,14 @@ public function addBigDataRowsWithHttpInfo($base_uuid, $insert_rows_into_big_dat try { $response = $this->client->send($request, $options); } catch (RequestException $e) { + $eResponse = $this->getExceptionResponse($e); throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), - $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? (string) $e->getResponse()->getBody() : null + $eResponse ? $eResponse->getHeaders() : null, + $eResponse ? (string) $eResponse->getBody() : null ); - } catch (ConnectException $e) { + } catch (NetworkExceptionInterface $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), @@ -300,7 +301,15 @@ function ($response) use ($returnType) { ]; }, function ($exception) { - $response = $exception->getResponse(); + $response = $this->getExceptionResponse($exception); + if ($response === null) { + throw new ApiException( + "[{$exception->getCode()}] {$exception->getMessage()}", + (int) $exception->getCode(), + null, + null + ); + } $statusCode = $response->getStatusCode(); throw new ApiException( sprintf( @@ -353,7 +362,7 @@ public function addBigDataRowsRequest($base_uuid, $insert_rows_into_big_data = n // path params if ($base_uuid !== null) { $resourcePath = str_replace( - '{' . 'base_uuid' . '}', + '{base_uuid}', ObjectSerializer::toPathValue($base_uuid), $resourcePath ); @@ -370,7 +379,11 @@ public function addBigDataRowsRequest($base_uuid, $insert_rows_into_big_data = n if (isset($insert_rows_into_big_data)) { if (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the body - $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($insert_rows_into_big_data)); + try { + $httpBody = json_encode(ObjectSerializer::sanitizeForSerialization($insert_rows_into_big_data), JSON_THROW_ON_ERROR); + } catch (\JsonException $e) { + throw new \InvalidArgumentException('json_encode error: ' . $e->getMessage(), 0, $e); + } } else { $httpBody = $insert_rows_into_big_data; } @@ -391,7 +404,11 @@ public function addBigDataRowsRequest($base_uuid, $insert_rows_into_big_data = n } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + try { + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + } catch (\JsonException $e) { + throw new \InvalidArgumentException('json_encode error: ' . $e->getMessage(), 0, $e); + } } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -467,13 +484,14 @@ public function getBaseBigDataOperationsWithHttpInfo($base_uuid, $page = null, $ try { $response = $this->client->send($request, $options); } catch (RequestException $e) { + $eResponse = $this->getExceptionResponse($e); throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), - $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? (string) $e->getResponse()->getBody() : null + $eResponse ? $eResponse->getHeaders() : null, + $eResponse ? (string) $eResponse->getBody() : null ); - } catch (ConnectException $e) { + } catch (NetworkExceptionInterface $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), @@ -592,7 +610,15 @@ function ($response) use ($returnType) { ]; }, function ($exception) { - $response = $exception->getResponse(); + $response = $this->getExceptionResponse($exception); + if ($response === null) { + throw new ApiException( + "[{$exception->getCode()}] {$exception->getMessage()}", + (int) $exception->getCode(), + null, + null + ); + } $statusCode = $response->getStatusCode(); throw new ApiException( sprintf( @@ -671,7 +697,7 @@ public function getBaseBigDataOperationsRequest($base_uuid, $page = null, $per_p // path params if ($base_uuid !== null) { $resourcePath = str_replace( - '{' . 'base_uuid' . '}', + '{base_uuid}', ObjectSerializer::toPathValue($base_uuid), $resourcePath ); @@ -702,7 +728,11 @@ public function getBaseBigDataOperationsRequest($base_uuid, $page = null, $per_p } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + try { + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + } catch (\JsonException $e) { + throw new \InvalidArgumentException('json_encode error: ' . $e->getMessage(), 0, $e); + } } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -776,13 +806,14 @@ public function moveRowsToBigDataWithHttpInfo($base_uuid, $archive_view = null, try { $response = $this->client->send($request, $options); } catch (RequestException $e) { + $eResponse = $this->getExceptionResponse($e); throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), - $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? (string) $e->getResponse()->getBody() : null + $eResponse ? $eResponse->getHeaders() : null, + $eResponse ? (string) $eResponse->getBody() : null ); - } catch (ConnectException $e) { + } catch (NetworkExceptionInterface $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), @@ -899,7 +930,15 @@ function ($response) use ($returnType) { ]; }, function ($exception) { - $response = $exception->getResponse(); + $response = $this->getExceptionResponse($exception); + if ($response === null) { + throw new ApiException( + "[{$exception->getCode()}] {$exception->getMessage()}", + (int) $exception->getCode(), + null, + null + ); + } $statusCode = $response->getStatusCode(); throw new ApiException( sprintf( @@ -952,7 +991,7 @@ public function moveRowsToBigDataRequest($base_uuid, $archive_view = null, strin // path params if ($base_uuid !== null) { $resourcePath = str_replace( - '{' . 'base_uuid' . '}', + '{base_uuid}', ObjectSerializer::toPathValue($base_uuid), $resourcePath ); @@ -969,7 +1008,11 @@ public function moveRowsToBigDataRequest($base_uuid, $archive_view = null, strin if (isset($archive_view)) { if (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the body - $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($archive_view)); + try { + $httpBody = json_encode(ObjectSerializer::sanitizeForSerialization($archive_view), JSON_THROW_ON_ERROR); + } catch (\JsonException $e) { + throw new \InvalidArgumentException('json_encode error: ' . $e->getMessage(), 0, $e); + } } else { $httpBody = $archive_view; } @@ -990,7 +1033,11 @@ public function moveRowsToBigDataRequest($base_uuid, $archive_view = null, strin } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + try { + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + } catch (\JsonException $e) { + throw new \InvalidArgumentException('json_encode error: ' . $e->getMessage(), 0, $e); + } } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -1064,13 +1111,14 @@ public function moveRowsToNormalBackendWithHttpInfo($base_uuid, $move_rows_to_no try { $response = $this->client->send($request, $options); } catch (RequestException $e) { + $eResponse = $this->getExceptionResponse($e); throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), - $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? (string) $e->getResponse()->getBody() : null + $eResponse ? $eResponse->getHeaders() : null, + $eResponse ? (string) $eResponse->getBody() : null ); - } catch (ConnectException $e) { + } catch (NetworkExceptionInterface $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), @@ -1187,7 +1235,15 @@ function ($response) use ($returnType) { ]; }, function ($exception) { - $response = $exception->getResponse(); + $response = $this->getExceptionResponse($exception); + if ($response === null) { + throw new ApiException( + "[{$exception->getCode()}] {$exception->getMessage()}", + (int) $exception->getCode(), + null, + null + ); + } $statusCode = $response->getStatusCode(); throw new ApiException( sprintf( @@ -1240,7 +1296,7 @@ public function moveRowsToNormalBackendRequest($base_uuid, $move_rows_to_normal_ // path params if ($base_uuid !== null) { $resourcePath = str_replace( - '{' . 'base_uuid' . '}', + '{base_uuid}', ObjectSerializer::toPathValue($base_uuid), $resourcePath ); @@ -1257,7 +1313,11 @@ public function moveRowsToNormalBackendRequest($base_uuid, $move_rows_to_normal_ if (isset($move_rows_to_normal_backend_request)) { if (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the body - $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($move_rows_to_normal_backend_request)); + try { + $httpBody = json_encode(ObjectSerializer::sanitizeForSerialization($move_rows_to_normal_backend_request), JSON_THROW_ON_ERROR); + } catch (\JsonException $e) { + throw new \InvalidArgumentException('json_encode error: ' . $e->getMessage(), 0, $e); + } } else { $httpBody = $move_rows_to_normal_backend_request; } @@ -1278,7 +1338,11 @@ public function moveRowsToNormalBackendRequest($base_uuid, $move_rows_to_normal_ } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + try { + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + } catch (\JsonException $e) { + throw new \InvalidArgumentException('json_encode error: ' . $e->getMessage(), 0, $e); + } } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -1352,13 +1416,14 @@ public function restoreBigDataOperationsWithHttpInfo($base_uuid, $op_id, string try { $response = $this->client->send($request, $options); } catch (RequestException $e) { + $eResponse = $this->getExceptionResponse($e); throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), - $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? (string) $e->getResponse()->getBody() : null + $eResponse ? $eResponse->getHeaders() : null, + $eResponse ? (string) $eResponse->getBody() : null ); - } catch (ConnectException $e) { + } catch (NetworkExceptionInterface $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), @@ -1475,7 +1540,15 @@ function ($response) use ($returnType) { ]; }, function ($exception) { - $response = $exception->getResponse(); + $response = $this->getExceptionResponse($exception); + if ($response === null) { + throw new ApiException( + "[{$exception->getCode()}] {$exception->getMessage()}", + (int) $exception->getCode(), + null, + null + ); + } $statusCode = $response->getStatusCode(); throw new ApiException( sprintf( @@ -1537,7 +1610,7 @@ public function restoreBigDataOperationsRequest($base_uuid, $op_id, string $cont // path params if ($base_uuid !== null) { $resourcePath = str_replace( - '{' . 'base_uuid' . '}', + '{base_uuid}', ObjectSerializer::toPathValue($base_uuid), $resourcePath ); @@ -1545,7 +1618,7 @@ public function restoreBigDataOperationsRequest($base_uuid, $op_id, string $cont // path params if ($op_id !== null) { $resourcePath = str_replace( - '{' . 'op_id' . '}', + '{op_id}', ObjectSerializer::toPathValue($op_id), $resourcePath ); @@ -1576,7 +1649,11 @@ public function restoreBigDataOperationsRequest($base_uuid, $op_id, string $cont } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + try { + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + } catch (\JsonException $e) { + throw new \InvalidArgumentException('json_encode error: ' . $e->getMessage(), 0, $e); + } } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -1636,6 +1713,21 @@ protected function createHttpClientOption() return $options; } + /** + * Returns the response attached to a Guzzle exception, if there is one. + * + * Guzzle 7 exposes getResponse() on RequestException, while Guzzle 8 only + * exposes it on ResponseException and its subclasses. + * + * @param \Throwable $exception + * + * @return ResponseInterface|null + */ + private function getExceptionResponse(\Throwable $exception): ?ResponseInterface + { + return method_exists($exception, 'getResponse') ? $exception->getResponse() : null; + } + private function handleResponseWithDataType( string $dataType, RequestInterface $request, diff --git a/lib/Base/ButtonColumn.php b/lib/Base/ButtonColumn.php index 53575d27..b6fcd660 100644 --- a/lib/Base/ButtonColumn.php +++ b/lib/Base/ButtonColumn.php @@ -45,17 +45,17 @@ class ButtonColumn implements ModelInterface, ArrayAccess, \JsonSerializable public const DISCRIMINATOR = null; /** - * The original name of the model. - * - * @var string - */ + * The original name of the model. + * + * @var string + */ protected static $openAPIModelName = 'button_column'; /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ protected static $openAPITypes = [ 'column_name' => 'string', 'column_type' => 'string', @@ -64,12 +64,12 @@ class ButtonColumn implements ModelInterface, ArrayAccess, \JsonSerializable ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - * @phpstan-var array - * @psalm-var array - */ + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ protected static $openAPIFormats = [ 'column_name' => null, 'column_type' => null, @@ -78,10 +78,10 @@ class ButtonColumn implements ModelInterface, ArrayAccess, \JsonSerializable ]; /** - * Array of nullable properties. Used for (de)serialization - * - * @var boolean[] - */ + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ protected static array $openAPINullables = [ 'column_name' => false, 'column_type' => false, @@ -90,10 +90,10 @@ class ButtonColumn implements ModelInterface, ArrayAccess, \JsonSerializable ]; /** - * If a nullable field gets set to null, insert it here - * - * @var boolean[] - */ + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ protected array $openAPINullablesSetToNull = []; /** @@ -282,14 +282,14 @@ public function __construct(?array $data = null) } /** - * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName - * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the - * $this->openAPINullablesSetToNull array - * - * @param string $variableName - * @param array $fields - * @param mixed $defaultValue - */ + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ private function setIfExists(string $variableName, array $fields, $defaultValue): void { if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { diff --git a/lib/Base/ButtonColumnFormat.php b/lib/Base/ButtonColumnFormat.php index cbac1c98..39f06972 100644 --- a/lib/Base/ButtonColumnFormat.php +++ b/lib/Base/ButtonColumnFormat.php @@ -45,17 +45,17 @@ class ButtonColumnFormat implements ModelInterface, ArrayAccess, \JsonSerializab public const DISCRIMINATOR = null; /** - * The original name of the model. - * - * @var string - */ + * The original name of the model. + * + * @var string + */ protected static $openAPIModelName = 'button_column_format'; /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ protected static $openAPITypes = [ 'button_type' => 'string', 'button_name' => 'string', @@ -66,12 +66,12 @@ class ButtonColumnFormat implements ModelInterface, ArrayAccess, \JsonSerializab ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - * @phpstan-var array - * @psalm-var array - */ + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ protected static $openAPIFormats = [ 'button_type' => null, 'button_name' => null, @@ -82,10 +82,10 @@ class ButtonColumnFormat implements ModelInterface, ArrayAccess, \JsonSerializab ]; /** - * Array of nullable properties. Used for (de)serialization - * - * @var boolean[] - */ + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ protected static array $openAPINullables = [ 'button_type' => false, 'button_name' => false, @@ -96,10 +96,10 @@ class ButtonColumnFormat implements ModelInterface, ArrayAccess, \JsonSerializab ]; /** - * If a nullable field gets set to null, insert it here - * - * @var boolean[] - */ + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ protected array $openAPINullablesSetToNull = []; /** @@ -304,14 +304,14 @@ public function __construct(?array $data = null) } /** - * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName - * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the - * $this->openAPINullablesSetToNull array - * - * @param string $variableName - * @param array $fields - * @param mixed $defaultValue - */ + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ private function setIfExists(string $variableName, array $fields, $defaultValue): void { if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { diff --git a/lib/Base/ButtonColumnFormatSelectedColumnsInner.php b/lib/Base/ButtonColumnFormatSelectedColumnsInner.php index 0a4b52d0..43576eee 100644 --- a/lib/Base/ButtonColumnFormatSelectedColumnsInner.php +++ b/lib/Base/ButtonColumnFormatSelectedColumnsInner.php @@ -44,49 +44,49 @@ class ButtonColumnFormatSelectedColumnsInner implements ModelInterface, ArrayAcc public const DISCRIMINATOR = null; /** - * The original name of the model. - * - * @var string - */ + * The original name of the model. + * + * @var string + */ protected static $openAPIModelName = 'button_column_format_selected_columns_inner'; /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ protected static $openAPITypes = [ 'key' => 'string', 'value' => 'string' ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - * @phpstan-var array - * @psalm-var array - */ + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ protected static $openAPIFormats = [ 'key' => null, 'value' => null ]; /** - * Array of nullable properties. Used for (de)serialization - * - * @var boolean[] - */ + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ protected static array $openAPINullables = [ 'key' => false, 'value' => false ]; /** - * If a nullable field gets set to null, insert it here - * - * @var boolean[] - */ + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ protected array $openAPINullablesSetToNull = []; /** @@ -254,14 +254,14 @@ public function __construct(?array $data = null) } /** - * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName - * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the - * $this->openAPINullablesSetToNull array - * - * @param string $variableName - * @param array $fields - * @param mixed $defaultValue - */ + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ private function setIfExists(string $variableName, array $fields, $defaultValue): void { if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { diff --git a/lib/Base/ButtonColumnWithTableName.php b/lib/Base/ButtonColumnWithTableName.php index aa5a8db4..ce2bb015 100644 --- a/lib/Base/ButtonColumnWithTableName.php +++ b/lib/Base/ButtonColumnWithTableName.php @@ -44,17 +44,17 @@ class ButtonColumnWithTableName implements ModelInterface, ArrayAccess, \JsonSer public const DISCRIMINATOR = null; /** - * The original name of the model. - * - * @var string - */ + * The original name of the model. + * + * @var string + */ protected static $openAPIModelName = 'button_column_with_table_name'; /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ protected static $openAPITypes = [ 'table_name' => 'string', 'column_name' => 'string', @@ -64,12 +64,12 @@ class ButtonColumnWithTableName implements ModelInterface, ArrayAccess, \JsonSer ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - * @phpstan-var array - * @psalm-var array - */ + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ protected static $openAPIFormats = [ 'table_name' => null, 'column_name' => null, @@ -79,10 +79,10 @@ class ButtonColumnWithTableName implements ModelInterface, ArrayAccess, \JsonSer ]; /** - * Array of nullable properties. Used for (de)serialization - * - * @var boolean[] - */ + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ protected static array $openAPINullables = [ 'table_name' => false, 'column_name' => false, @@ -92,10 +92,10 @@ class ButtonColumnWithTableName implements ModelInterface, ArrayAccess, \JsonSer ]; /** - * If a nullable field gets set to null, insert it here - * - * @var boolean[] - */ + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ protected array $openAPINullablesSetToNull = []; /** @@ -288,14 +288,14 @@ public function __construct(?array $data = null) } /** - * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName - * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the - * $this->openAPINullablesSetToNull array - * - * @param string $variableName - * @param array $fields - * @param mixed $defaultValue - */ + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ private function setIfExists(string $variableName, array $fields, $defaultValue): void { if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { diff --git a/lib/Base/CheckboxColumn.php b/lib/Base/CheckboxColumn.php index a6b944da..93ab7c18 100644 --- a/lib/Base/CheckboxColumn.php +++ b/lib/Base/CheckboxColumn.php @@ -45,17 +45,17 @@ class CheckboxColumn implements ModelInterface, ArrayAccess, \JsonSerializable public const DISCRIMINATOR = null; /** - * The original name of the model. - * - * @var string - */ + * The original name of the model. + * + * @var string + */ protected static $openAPIModelName = 'checkbox_column'; /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ protected static $openAPITypes = [ 'column_name' => 'string', 'column_type' => 'string', @@ -63,12 +63,12 @@ class CheckboxColumn implements ModelInterface, ArrayAccess, \JsonSerializable ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - * @phpstan-var array - * @psalm-var array - */ + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ protected static $openAPIFormats = [ 'column_name' => null, 'column_type' => null, @@ -76,10 +76,10 @@ class CheckboxColumn implements ModelInterface, ArrayAccess, \JsonSerializable ]; /** - * Array of nullable properties. Used for (de)serialization - * - * @var boolean[] - */ + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ protected static array $openAPINullables = [ 'column_name' => false, 'column_type' => false, @@ -87,10 +87,10 @@ class CheckboxColumn implements ModelInterface, ArrayAccess, \JsonSerializable ]; /** - * If a nullable field gets set to null, insert it here - * - * @var boolean[] - */ + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ protected array $openAPINullablesSetToNull = []; /** @@ -275,14 +275,14 @@ public function __construct(?array $data = null) } /** - * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName - * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the - * $this->openAPINullablesSetToNull array - * - * @param string $variableName - * @param array $fields - * @param mixed $defaultValue - */ + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ private function setIfExists(string $variableName, array $fields, $defaultValue): void { if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { diff --git a/lib/Base/CheckboxColumnWithTableName.php b/lib/Base/CheckboxColumnWithTableName.php index cb04b650..dc5b9442 100644 --- a/lib/Base/CheckboxColumnWithTableName.php +++ b/lib/Base/CheckboxColumnWithTableName.php @@ -44,17 +44,17 @@ class CheckboxColumnWithTableName implements ModelInterface, ArrayAccess, \JsonS public const DISCRIMINATOR = null; /** - * The original name of the model. - * - * @var string - */ + * The original name of the model. + * + * @var string + */ protected static $openAPIModelName = 'checkbox_column_with_table_name'; /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ protected static $openAPITypes = [ 'table_name' => 'string', 'column_name' => 'string', @@ -63,12 +63,12 @@ class CheckboxColumnWithTableName implements ModelInterface, ArrayAccess, \JsonS ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - * @phpstan-var array - * @psalm-var array - */ + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ protected static $openAPIFormats = [ 'table_name' => null, 'column_name' => null, @@ -77,10 +77,10 @@ class CheckboxColumnWithTableName implements ModelInterface, ArrayAccess, \JsonS ]; /** - * Array of nullable properties. Used for (de)serialization - * - * @var boolean[] - */ + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ protected static array $openAPINullables = [ 'table_name' => false, 'column_name' => false, @@ -89,10 +89,10 @@ class CheckboxColumnWithTableName implements ModelInterface, ArrayAccess, \JsonS ]; /** - * If a nullable field gets set to null, insert it here - * - * @var boolean[] - */ + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ protected array $openAPINullablesSetToNull = []; /** @@ -281,14 +281,14 @@ public function __construct(?array $data = null) } /** - * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName - * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the - * $this->openAPINullablesSetToNull array - * - * @param string $variableName - * @param array $fields - * @param mixed $defaultValue - */ + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ private function setIfExists(string $variableName, array $fields, $defaultValue): void { if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { diff --git a/lib/Base/CollaboratorColumn.php b/lib/Base/CollaboratorColumn.php index 30a1bb6a..0ad9e677 100644 --- a/lib/Base/CollaboratorColumn.php +++ b/lib/Base/CollaboratorColumn.php @@ -45,17 +45,17 @@ class CollaboratorColumn implements ModelInterface, ArrayAccess, \JsonSerializab public const DISCRIMINATOR = null; /** - * The original name of the model. - * - * @var string - */ + * The original name of the model. + * + * @var string + */ protected static $openAPIModelName = 'collaborator_column'; /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ protected static $openAPITypes = [ 'column_name' => 'string', 'column_type' => 'string', @@ -63,12 +63,12 @@ class CollaboratorColumn implements ModelInterface, ArrayAccess, \JsonSerializab ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - * @phpstan-var array - * @psalm-var array - */ + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ protected static $openAPIFormats = [ 'column_name' => null, 'column_type' => null, @@ -76,10 +76,10 @@ class CollaboratorColumn implements ModelInterface, ArrayAccess, \JsonSerializab ]; /** - * Array of nullable properties. Used for (de)serialization - * - * @var boolean[] - */ + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ protected static array $openAPINullables = [ 'column_name' => false, 'column_type' => false, @@ -87,10 +87,10 @@ class CollaboratorColumn implements ModelInterface, ArrayAccess, \JsonSerializab ]; /** - * If a nullable field gets set to null, insert it here - * - * @var boolean[] - */ + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ protected array $openAPINullablesSetToNull = []; /** @@ -275,14 +275,14 @@ public function __construct(?array $data = null) } /** - * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName - * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the - * $this->openAPINullablesSetToNull array - * - * @param string $variableName - * @param array $fields - * @param mixed $defaultValue - */ + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ private function setIfExists(string $variableName, array $fields, $defaultValue): void { if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { diff --git a/lib/Base/CollaboratorColumnWithTableName.php b/lib/Base/CollaboratorColumnWithTableName.php index 58feab07..148f1822 100644 --- a/lib/Base/CollaboratorColumnWithTableName.php +++ b/lib/Base/CollaboratorColumnWithTableName.php @@ -44,17 +44,17 @@ class CollaboratorColumnWithTableName implements ModelInterface, ArrayAccess, \J public const DISCRIMINATOR = null; /** - * The original name of the model. - * - * @var string - */ + * The original name of the model. + * + * @var string + */ protected static $openAPIModelName = 'collaborator_column_with_table_name'; /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ protected static $openAPITypes = [ 'table_name' => 'string', 'column_name' => 'string', @@ -63,12 +63,12 @@ class CollaboratorColumnWithTableName implements ModelInterface, ArrayAccess, \J ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - * @phpstan-var array - * @psalm-var array - */ + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ protected static $openAPIFormats = [ 'table_name' => null, 'column_name' => null, @@ -77,10 +77,10 @@ class CollaboratorColumnWithTableName implements ModelInterface, ArrayAccess, \J ]; /** - * Array of nullable properties. Used for (de)serialization - * - * @var boolean[] - */ + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ protected static array $openAPINullables = [ 'table_name' => false, 'column_name' => false, @@ -89,10 +89,10 @@ class CollaboratorColumnWithTableName implements ModelInterface, ArrayAccess, \J ]; /** - * If a nullable field gets set to null, insert it here - * - * @var boolean[] - */ + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ protected array $openAPINullablesSetToNull = []; /** @@ -281,14 +281,14 @@ public function __construct(?array $data = null) } /** - * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName - * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the - * $this->openAPINullablesSetToNull array - * - * @param string $variableName - * @param array $fields - * @param mixed $defaultValue - */ + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ private function setIfExists(string $variableName, array $fields, $defaultValue): void { if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { diff --git a/lib/Base/ColumnsApi.php b/lib/Base/ColumnsApi.php index b1511f1e..a20144e3 100644 --- a/lib/Base/ColumnsApi.php +++ b/lib/Base/ColumnsApi.php @@ -28,11 +28,11 @@ use GuzzleHttp\Client; use GuzzleHttp\ClientInterface; -use GuzzleHttp\Exception\ConnectException; use GuzzleHttp\Exception\RequestException; use GuzzleHttp\Psr7\MultipartStream; use GuzzleHttp\Psr7\Request; use GuzzleHttp\RequestOptions; +use Psr\Http\Client\NetworkExceptionInterface; use Psr\Http\Message\RequestInterface; use Psr\Http\Message\ResponseInterface; use SeaTable\Client\ApiException; @@ -189,13 +189,14 @@ public function addSelectOptionWithHttpInfo($base_uuid, $add_single_multiple_sel try { $response = $this->client->send($request, $options); } catch (RequestException $e) { + $eResponse = $this->getExceptionResponse($e); throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), - $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? (string) $e->getResponse()->getBody() : null + $eResponse ? $eResponse->getHeaders() : null, + $eResponse ? (string) $eResponse->getBody() : null ); - } catch (ConnectException $e) { + } catch (NetworkExceptionInterface $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), @@ -312,7 +313,15 @@ function ($response) use ($returnType) { ]; }, function ($exception) { - $response = $exception->getResponse(); + $response = $this->getExceptionResponse($exception); + if ($response === null) { + throw new ApiException( + "[{$exception->getCode()}] {$exception->getMessage()}", + (int) $exception->getCode(), + null, + null + ); + } $statusCode = $response->getStatusCode(); throw new ApiException( sprintf( @@ -365,7 +374,7 @@ public function addSelectOptionRequest($base_uuid, $add_single_multiple_select_o // path params if ($base_uuid !== null) { $resourcePath = str_replace( - '{' . 'base_uuid' . '}', + '{base_uuid}', ObjectSerializer::toPathValue($base_uuid), $resourcePath ); @@ -382,7 +391,11 @@ public function addSelectOptionRequest($base_uuid, $add_single_multiple_select_o if (isset($add_single_multiple_select_options)) { if (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the body - $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($add_single_multiple_select_options)); + try { + $httpBody = json_encode(ObjectSerializer::sanitizeForSerialization($add_single_multiple_select_options), JSON_THROW_ON_ERROR); + } catch (\JsonException $e) { + throw new \InvalidArgumentException('json_encode error: ' . $e->getMessage(), 0, $e); + } } else { $httpBody = $add_single_multiple_select_options; } @@ -403,7 +416,11 @@ public function addSelectOptionRequest($base_uuid, $add_single_multiple_select_o } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + try { + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + } catch (\JsonException $e) { + throw new \InvalidArgumentException('json_encode error: ' . $e->getMessage(), 0, $e); + } } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -477,13 +494,14 @@ public function appendColumnsWithHttpInfo($base_uuid, $append_columns_request = try { $response = $this->client->send($request, $options); } catch (RequestException $e) { + $eResponse = $this->getExceptionResponse($e); throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), - $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? (string) $e->getResponse()->getBody() : null + $eResponse ? $eResponse->getHeaders() : null, + $eResponse ? (string) $eResponse->getBody() : null ); - } catch (ConnectException $e) { + } catch (NetworkExceptionInterface $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), @@ -600,7 +618,15 @@ function ($response) use ($returnType) { ]; }, function ($exception) { - $response = $exception->getResponse(); + $response = $this->getExceptionResponse($exception); + if ($response === null) { + throw new ApiException( + "[{$exception->getCode()}] {$exception->getMessage()}", + (int) $exception->getCode(), + null, + null + ); + } $statusCode = $response->getStatusCode(); throw new ApiException( sprintf( @@ -653,7 +679,7 @@ public function appendColumnsRequest($base_uuid, $append_columns_request = null, // path params if ($base_uuid !== null) { $resourcePath = str_replace( - '{' . 'base_uuid' . '}', + '{base_uuid}', ObjectSerializer::toPathValue($base_uuid), $resourcePath ); @@ -670,7 +696,11 @@ public function appendColumnsRequest($base_uuid, $append_columns_request = null, if (isset($append_columns_request)) { if (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the body - $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($append_columns_request)); + try { + $httpBody = json_encode(ObjectSerializer::sanitizeForSerialization($append_columns_request), JSON_THROW_ON_ERROR); + } catch (\JsonException $e) { + throw new \InvalidArgumentException('json_encode error: ' . $e->getMessage(), 0, $e); + } } else { $httpBody = $append_columns_request; } @@ -691,7 +721,11 @@ public function appendColumnsRequest($base_uuid, $append_columns_request = null, } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + try { + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + } catch (\JsonException $e) { + throw new \InvalidArgumentException('json_encode error: ' . $e->getMessage(), 0, $e); + } } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -765,13 +799,14 @@ public function deleteColumnWithHttpInfo($base_uuid, $delete_column = null, stri try { $response = $this->client->send($request, $options); } catch (RequestException $e) { + $eResponse = $this->getExceptionResponse($e); throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), - $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? (string) $e->getResponse()->getBody() : null + $eResponse ? $eResponse->getHeaders() : null, + $eResponse ? (string) $eResponse->getBody() : null ); - } catch (ConnectException $e) { + } catch (NetworkExceptionInterface $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), @@ -888,7 +923,15 @@ function ($response) use ($returnType) { ]; }, function ($exception) { - $response = $exception->getResponse(); + $response = $this->getExceptionResponse($exception); + if ($response === null) { + throw new ApiException( + "[{$exception->getCode()}] {$exception->getMessage()}", + (int) $exception->getCode(), + null, + null + ); + } $statusCode = $response->getStatusCode(); throw new ApiException( sprintf( @@ -941,7 +984,7 @@ public function deleteColumnRequest($base_uuid, $delete_column = null, string $c // path params if ($base_uuid !== null) { $resourcePath = str_replace( - '{' . 'base_uuid' . '}', + '{base_uuid}', ObjectSerializer::toPathValue($base_uuid), $resourcePath ); @@ -958,7 +1001,11 @@ public function deleteColumnRequest($base_uuid, $delete_column = null, string $c if (isset($delete_column)) { if (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the body - $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($delete_column)); + try { + $httpBody = json_encode(ObjectSerializer::sanitizeForSerialization($delete_column), JSON_THROW_ON_ERROR); + } catch (\JsonException $e) { + throw new \InvalidArgumentException('json_encode error: ' . $e->getMessage(), 0, $e); + } } else { $httpBody = $delete_column; } @@ -979,7 +1026,11 @@ public function deleteColumnRequest($base_uuid, $delete_column = null, string $c } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + try { + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + } catch (\JsonException $e) { + throw new \InvalidArgumentException('json_encode error: ' . $e->getMessage(), 0, $e); + } } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -1053,13 +1104,14 @@ public function deleteSelectOptionWithHttpInfo($base_uuid, $delete_select_option try { $response = $this->client->send($request, $options); } catch (RequestException $e) { + $eResponse = $this->getExceptionResponse($e); throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), - $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? (string) $e->getResponse()->getBody() : null + $eResponse ? $eResponse->getHeaders() : null, + $eResponse ? (string) $eResponse->getBody() : null ); - } catch (ConnectException $e) { + } catch (NetworkExceptionInterface $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), @@ -1176,7 +1228,15 @@ function ($response) use ($returnType) { ]; }, function ($exception) { - $response = $exception->getResponse(); + $response = $this->getExceptionResponse($exception); + if ($response === null) { + throw new ApiException( + "[{$exception->getCode()}] {$exception->getMessage()}", + (int) $exception->getCode(), + null, + null + ); + } $statusCode = $response->getStatusCode(); throw new ApiException( sprintf( @@ -1229,7 +1289,7 @@ public function deleteSelectOptionRequest($base_uuid, $delete_select_options = n // path params if ($base_uuid !== null) { $resourcePath = str_replace( - '{' . 'base_uuid' . '}', + '{base_uuid}', ObjectSerializer::toPathValue($base_uuid), $resourcePath ); @@ -1246,7 +1306,11 @@ public function deleteSelectOptionRequest($base_uuid, $delete_select_options = n if (isset($delete_select_options)) { if (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the body - $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($delete_select_options)); + try { + $httpBody = json_encode(ObjectSerializer::sanitizeForSerialization($delete_select_options), JSON_THROW_ON_ERROR); + } catch (\JsonException $e) { + throw new \InvalidArgumentException('json_encode error: ' . $e->getMessage(), 0, $e); + } } else { $httpBody = $delete_select_options; } @@ -1267,7 +1331,11 @@ public function deleteSelectOptionRequest($base_uuid, $delete_select_options = n } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + try { + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + } catch (\JsonException $e) { + throw new \InvalidArgumentException('json_encode error: ' . $e->getMessage(), 0, $e); + } } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -1341,13 +1409,14 @@ public function insertColumnWithHttpInfo($base_uuid, $insert_column_request = nu try { $response = $this->client->send($request, $options); } catch (RequestException $e) { + $eResponse = $this->getExceptionResponse($e); throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), - $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? (string) $e->getResponse()->getBody() : null + $eResponse ? $eResponse->getHeaders() : null, + $eResponse ? (string) $eResponse->getBody() : null ); - } catch (ConnectException $e) { + } catch (NetworkExceptionInterface $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), @@ -1464,7 +1533,15 @@ function ($response) use ($returnType) { ]; }, function ($exception) { - $response = $exception->getResponse(); + $response = $this->getExceptionResponse($exception); + if ($response === null) { + throw new ApiException( + "[{$exception->getCode()}] {$exception->getMessage()}", + (int) $exception->getCode(), + null, + null + ); + } $statusCode = $response->getStatusCode(); throw new ApiException( sprintf( @@ -1517,7 +1594,7 @@ public function insertColumnRequest($base_uuid, $insert_column_request = null, s // path params if ($base_uuid !== null) { $resourcePath = str_replace( - '{' . 'base_uuid' . '}', + '{base_uuid}', ObjectSerializer::toPathValue($base_uuid), $resourcePath ); @@ -1534,7 +1611,11 @@ public function insertColumnRequest($base_uuid, $insert_column_request = null, s if (isset($insert_column_request)) { if (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the body - $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($insert_column_request)); + try { + $httpBody = json_encode(ObjectSerializer::sanitizeForSerialization($insert_column_request), JSON_THROW_ON_ERROR); + } catch (\JsonException $e) { + throw new \InvalidArgumentException('json_encode error: ' . $e->getMessage(), 0, $e); + } } else { $httpBody = $insert_column_request; } @@ -1555,7 +1636,11 @@ public function insertColumnRequest($base_uuid, $insert_column_request = null, s } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + try { + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + } catch (\JsonException $e) { + throw new \InvalidArgumentException('json_encode error: ' . $e->getMessage(), 0, $e); + } } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -1631,13 +1716,14 @@ public function listColumnsWithHttpInfo($table_name, $base_uuid, $view_name = nu try { $response = $this->client->send($request, $options); } catch (RequestException $e) { + $eResponse = $this->getExceptionResponse($e); throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), - $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? (string) $e->getResponse()->getBody() : null + $eResponse ? $eResponse->getHeaders() : null, + $eResponse ? (string) $eResponse->getBody() : null ); - } catch (ConnectException $e) { + } catch (NetworkExceptionInterface $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), @@ -1756,7 +1842,15 @@ function ($response) use ($returnType) { ]; }, function ($exception) { - $response = $exception->getResponse(); + $response = $this->getExceptionResponse($exception); + if ($response === null) { + throw new ApiException( + "[{$exception->getCode()}] {$exception->getMessage()}", + (int) $exception->getCode(), + null, + null + ); + } $statusCode = $response->getStatusCode(); throw new ApiException( sprintf( @@ -1835,7 +1929,7 @@ public function listColumnsRequest($table_name, $base_uuid, $view_name = null, s // path params if ($base_uuid !== null) { $resourcePath = str_replace( - '{' . 'base_uuid' . '}', + '{base_uuid}', ObjectSerializer::toPathValue($base_uuid), $resourcePath ); @@ -1866,7 +1960,11 @@ public function listColumnsRequest($table_name, $base_uuid, $view_name = null, s } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + try { + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + } catch (\JsonException $e) { + throw new \InvalidArgumentException('json_encode error: ' . $e->getMessage(), 0, $e); + } } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -1940,13 +2038,14 @@ public function updateColumnWithHttpInfo($base_uuid, $update_column = null, stri try { $response = $this->client->send($request, $options); } catch (RequestException $e) { + $eResponse = $this->getExceptionResponse($e); throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), - $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? (string) $e->getResponse()->getBody() : null + $eResponse ? $eResponse->getHeaders() : null, + $eResponse ? (string) $eResponse->getBody() : null ); - } catch (ConnectException $e) { + } catch (NetworkExceptionInterface $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), @@ -2063,7 +2162,15 @@ function ($response) use ($returnType) { ]; }, function ($exception) { - $response = $exception->getResponse(); + $response = $this->getExceptionResponse($exception); + if ($response === null) { + throw new ApiException( + "[{$exception->getCode()}] {$exception->getMessage()}", + (int) $exception->getCode(), + null, + null + ); + } $statusCode = $response->getStatusCode(); throw new ApiException( sprintf( @@ -2116,7 +2223,7 @@ public function updateColumnRequest($base_uuid, $update_column = null, string $c // path params if ($base_uuid !== null) { $resourcePath = str_replace( - '{' . 'base_uuid' . '}', + '{base_uuid}', ObjectSerializer::toPathValue($base_uuid), $resourcePath ); @@ -2133,7 +2240,11 @@ public function updateColumnRequest($base_uuid, $update_column = null, string $c if (isset($update_column)) { if (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the body - $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($update_column)); + try { + $httpBody = json_encode(ObjectSerializer::sanitizeForSerialization($update_column), JSON_THROW_ON_ERROR); + } catch (\JsonException $e) { + throw new \InvalidArgumentException('json_encode error: ' . $e->getMessage(), 0, $e); + } } else { $httpBody = $update_column; } @@ -2154,7 +2265,11 @@ public function updateColumnRequest($base_uuid, $update_column = null, string $c } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + try { + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + } catch (\JsonException $e) { + throw new \InvalidArgumentException('json_encode error: ' . $e->getMessage(), 0, $e); + } } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -2228,13 +2343,14 @@ public function updateColumnCascadeWithHttpInfo($base_uuid, $body = null, string try { $response = $this->client->send($request, $options); } catch (RequestException $e) { + $eResponse = $this->getExceptionResponse($e); throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), - $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? (string) $e->getResponse()->getBody() : null + $eResponse ? $eResponse->getHeaders() : null, + $eResponse ? (string) $eResponse->getBody() : null ); - } catch (ConnectException $e) { + } catch (NetworkExceptionInterface $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), @@ -2351,7 +2467,15 @@ function ($response) use ($returnType) { ]; }, function ($exception) { - $response = $exception->getResponse(); + $response = $this->getExceptionResponse($exception); + if ($response === null) { + throw new ApiException( + "[{$exception->getCode()}] {$exception->getMessage()}", + (int) $exception->getCode(), + null, + null + ); + } $statusCode = $response->getStatusCode(); throw new ApiException( sprintf( @@ -2404,7 +2528,7 @@ public function updateColumnCascadeRequest($base_uuid, $body = null, string $con // path params if ($base_uuid !== null) { $resourcePath = str_replace( - '{' . 'base_uuid' . '}', + '{base_uuid}', ObjectSerializer::toPathValue($base_uuid), $resourcePath ); @@ -2421,7 +2545,11 @@ public function updateColumnCascadeRequest($base_uuid, $body = null, string $con if (isset($body)) { if (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the body - $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($body)); + try { + $httpBody = json_encode(ObjectSerializer::sanitizeForSerialization($body), JSON_THROW_ON_ERROR); + } catch (\JsonException $e) { + throw new \InvalidArgumentException('json_encode error: ' . $e->getMessage(), 0, $e); + } } else { $httpBody = $body; } @@ -2442,7 +2570,11 @@ public function updateColumnCascadeRequest($base_uuid, $body = null, string $con } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + try { + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + } catch (\JsonException $e) { + throw new \InvalidArgumentException('json_encode error: ' . $e->getMessage(), 0, $e); + } } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -2516,13 +2648,14 @@ public function updateSelectOptionWithHttpInfo($base_uuid, $update_single_multip try { $response = $this->client->send($request, $options); } catch (RequestException $e) { + $eResponse = $this->getExceptionResponse($e); throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), - $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? (string) $e->getResponse()->getBody() : null + $eResponse ? $eResponse->getHeaders() : null, + $eResponse ? (string) $eResponse->getBody() : null ); - } catch (ConnectException $e) { + } catch (NetworkExceptionInterface $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), @@ -2639,7 +2772,15 @@ function ($response) use ($returnType) { ]; }, function ($exception) { - $response = $exception->getResponse(); + $response = $this->getExceptionResponse($exception); + if ($response === null) { + throw new ApiException( + "[{$exception->getCode()}] {$exception->getMessage()}", + (int) $exception->getCode(), + null, + null + ); + } $statusCode = $response->getStatusCode(); throw new ApiException( sprintf( @@ -2692,7 +2833,7 @@ public function updateSelectOptionRequest($base_uuid, $update_single_multiple_se // path params if ($base_uuid !== null) { $resourcePath = str_replace( - '{' . 'base_uuid' . '}', + '{base_uuid}', ObjectSerializer::toPathValue($base_uuid), $resourcePath ); @@ -2709,7 +2850,11 @@ public function updateSelectOptionRequest($base_uuid, $update_single_multiple_se if (isset($update_single_multiple_select_options)) { if (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the body - $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($update_single_multiple_select_options)); + try { + $httpBody = json_encode(ObjectSerializer::sanitizeForSerialization($update_single_multiple_select_options), JSON_THROW_ON_ERROR); + } catch (\JsonException $e) { + throw new \InvalidArgumentException('json_encode error: ' . $e->getMessage(), 0, $e); + } } else { $httpBody = $update_single_multiple_select_options; } @@ -2730,7 +2875,11 @@ public function updateSelectOptionRequest($base_uuid, $update_single_multiple_se } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + try { + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + } catch (\JsonException $e) { + throw new \InvalidArgumentException('json_encode error: ' . $e->getMessage(), 0, $e); + } } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -2790,6 +2939,21 @@ protected function createHttpClientOption() return $options; } + /** + * Returns the response attached to a Guzzle exception, if there is one. + * + * Guzzle 7 exposes getResponse() on RequestException, while Guzzle 8 only + * exposes it on ResponseException and its subclasses. + * + * @param \Throwable $exception + * + * @return ResponseInterface|null + */ + private function getExceptionResponse(\Throwable $exception): ?ResponseInterface + { + return method_exists($exception, 'getResponse') ? $exception->getResponse() : null; + } + private function handleResponseWithDataType( string $dataType, RequestInterface $request, diff --git a/lib/Base/CreateRowComment.php b/lib/Base/CreateRowComment.php index e7b63395..cf81017a 100644 --- a/lib/Base/CreateRowComment.php +++ b/lib/Base/CreateRowComment.php @@ -44,46 +44,46 @@ class CreateRowComment implements ModelInterface, ArrayAccess, \JsonSerializable public const DISCRIMINATOR = null; /** - * The original name of the model. - * - * @var string - */ + * The original name of the model. + * + * @var string + */ protected static $openAPIModelName = 'create_row_comment'; /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ protected static $openAPITypes = [ 'comment' => 'string' ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - * @phpstan-var array - * @psalm-var array - */ + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ protected static $openAPIFormats = [ 'comment' => null ]; /** - * Array of nullable properties. Used for (de)serialization - * - * @var boolean[] - */ + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ protected static array $openAPINullables = [ 'comment' => false ]; /** - * If a nullable field gets set to null, insert it here - * - * @var boolean[] - */ + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ protected array $openAPINullablesSetToNull = []; /** @@ -247,14 +247,14 @@ public function __construct(?array $data = null) } /** - * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName - * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the - * $this->openAPINullablesSetToNull array - * - * @param string $variableName - * @param array $fields - * @param mixed $defaultValue - */ + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ private function setIfExists(string $variableName, array $fields, $defaultValue): void { if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { diff --git a/lib/Base/CreateTableRequest.php b/lib/Base/CreateTableRequest.php index b2182ebb..ba9f400b 100644 --- a/lib/Base/CreateTableRequest.php +++ b/lib/Base/CreateTableRequest.php @@ -44,49 +44,49 @@ class CreateTableRequest implements ModelInterface, ArrayAccess, \JsonSerializab public const DISCRIMINATOR = null; /** - * The original name of the model. - * - * @var string - */ + * The original name of the model. + * + * @var string + */ protected static $openAPIModelName = 'createTable_request'; /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ protected static $openAPITypes = [ 'table_name' => 'string', 'columns' => '\SeaTable\Client\Base\CreateTableRequestColumnsInner[]' ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - * @phpstan-var array - * @psalm-var array - */ + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ protected static $openAPIFormats = [ 'table_name' => null, 'columns' => null ]; /** - * Array of nullable properties. Used for (de)serialization - * - * @var boolean[] - */ + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ protected static array $openAPINullables = [ 'table_name' => false, 'columns' => false ]; /** - * If a nullable field gets set to null, insert it here - * - * @var boolean[] - */ + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ protected array $openAPINullablesSetToNull = []; /** @@ -254,14 +254,14 @@ public function __construct(?array $data = null) } /** - * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName - * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the - * $this->openAPINullablesSetToNull array - * - * @param string $variableName - * @param array $fields - * @param mixed $defaultValue - */ + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ private function setIfExists(string $variableName, array $fields, $defaultValue): void { if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { diff --git a/lib/Base/CreateTableRequestColumnsInner.php b/lib/Base/CreateTableRequestColumnsInner.php index cebd006d..c267ebdb 100644 --- a/lib/Base/CreateTableRequestColumnsInner.php +++ b/lib/Base/CreateTableRequestColumnsInner.php @@ -44,17 +44,17 @@ class CreateTableRequestColumnsInner implements ModelInterface, ArrayAccess, \Js public const DISCRIMINATOR = null; /** - * The original name of the model. - * - * @var string - */ + * The original name of the model. + * + * @var string + */ protected static $openAPIModelName = 'createTable_request_columns_inner'; /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ protected static $openAPITypes = [ 'column_name' => 'string', 'column_type' => 'string', @@ -63,12 +63,12 @@ class CreateTableRequestColumnsInner implements ModelInterface, ArrayAccess, \Js ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - * @phpstan-var array - * @psalm-var array - */ + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ protected static $openAPIFormats = [ 'column_name' => null, 'column_type' => null, @@ -77,10 +77,10 @@ class CreateTableRequestColumnsInner implements ModelInterface, ArrayAccess, \Js ]; /** - * Array of nullable properties. Used for (de)serialization - * - * @var boolean[] - */ + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ protected static array $openAPINullables = [ 'column_name' => false, 'column_type' => false, @@ -89,10 +89,10 @@ class CreateTableRequestColumnsInner implements ModelInterface, ArrayAccess, \Js ]; /** - * If a nullable field gets set to null, insert it here - * - * @var boolean[] - */ + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ protected array $openAPINullablesSetToNull = []; /** @@ -281,14 +281,14 @@ public function __construct(?array $data = null) } /** - * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName - * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the - * $this->openAPINullablesSetToNull array - * - * @param string $variableName - * @param array $fields - * @param mixed $defaultValue - */ + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ private function setIfExists(string $variableName, array $fields, $defaultValue): void { if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { diff --git a/lib/Base/CreateView200Response.php b/lib/Base/CreateView200Response.php index 1ea1816b..17d3918b 100644 --- a/lib/Base/CreateView200Response.php +++ b/lib/Base/CreateView200Response.php @@ -44,17 +44,17 @@ class CreateView200Response implements ModelInterface, ArrayAccess, \JsonSeriali public const DISCRIMINATOR = null; /** - * The original name of the model. - * - * @var string - */ + * The original name of the model. + * + * @var string + */ protected static $openAPIModelName = 'createView_200_response'; /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ protected static $openAPITypes = [ '_id' => 'string', 'name' => 'string', @@ -76,12 +76,12 @@ class CreateView200Response implements ModelInterface, ArrayAccess, \JsonSeriali ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - * @phpstan-var array - * @psalm-var array - */ + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ protected static $openAPIFormats = [ '_id' => null, 'name' => null, @@ -103,10 +103,10 @@ class CreateView200Response implements ModelInterface, ArrayAccess, \JsonSeriali ]; /** - * Array of nullable properties. Used for (de)serialization - * - * @var boolean[] - */ + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ protected static array $openAPINullables = [ '_id' => false, 'name' => false, @@ -128,10 +128,10 @@ class CreateView200Response implements ModelInterface, ArrayAccess, \JsonSeriali ]; /** - * If a nullable field gets set to null, insert it here - * - * @var boolean[] - */ + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ protected array $openAPINullablesSetToNull = []; /** @@ -359,14 +359,14 @@ public function __construct(?array $data = null) } /** - * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName - * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the - * $this->openAPINullablesSetToNull array - * - * @param string $variableName - * @param array $fields - * @param mixed $defaultValue - */ + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ private function setIfExists(string $variableName, array $fields, $defaultValue): void { if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { diff --git a/lib/Base/CreatorColumn.php b/lib/Base/CreatorColumn.php index 25509c50..5e2453d3 100644 --- a/lib/Base/CreatorColumn.php +++ b/lib/Base/CreatorColumn.php @@ -45,17 +45,17 @@ class CreatorColumn implements ModelInterface, ArrayAccess, \JsonSerializable public const DISCRIMINATOR = null; /** - * The original name of the model. - * - * @var string - */ + * The original name of the model. + * + * @var string + */ protected static $openAPIModelName = 'creator_column'; /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ protected static $openAPITypes = [ 'column_name' => 'string', 'column_type' => 'string', @@ -63,12 +63,12 @@ class CreatorColumn implements ModelInterface, ArrayAccess, \JsonSerializable ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - * @phpstan-var array - * @psalm-var array - */ + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ protected static $openAPIFormats = [ 'column_name' => null, 'column_type' => null, @@ -76,10 +76,10 @@ class CreatorColumn implements ModelInterface, ArrayAccess, \JsonSerializable ]; /** - * Array of nullable properties. Used for (de)serialization - * - * @var boolean[] - */ + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ protected static array $openAPINullables = [ 'column_name' => false, 'column_type' => false, @@ -87,10 +87,10 @@ class CreatorColumn implements ModelInterface, ArrayAccess, \JsonSerializable ]; /** - * If a nullable field gets set to null, insert it here - * - * @var boolean[] - */ + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ protected array $openAPINullablesSetToNull = []; /** @@ -275,14 +275,14 @@ public function __construct(?array $data = null) } /** - * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName - * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the - * $this->openAPINullablesSetToNull array - * - * @param string $variableName - * @param array $fields - * @param mixed $defaultValue - */ + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ private function setIfExists(string $variableName, array $fields, $defaultValue): void { if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { diff --git a/lib/Base/CreatorColumnWithTableName.php b/lib/Base/CreatorColumnWithTableName.php index e1c81594..3467bfd7 100644 --- a/lib/Base/CreatorColumnWithTableName.php +++ b/lib/Base/CreatorColumnWithTableName.php @@ -44,17 +44,17 @@ class CreatorColumnWithTableName implements ModelInterface, ArrayAccess, \JsonSe public const DISCRIMINATOR = null; /** - * The original name of the model. - * - * @var string - */ + * The original name of the model. + * + * @var string + */ protected static $openAPIModelName = 'creator_column_with_table_name'; /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ protected static $openAPITypes = [ 'table_name' => 'string', 'column_name' => 'string', @@ -63,12 +63,12 @@ class CreatorColumnWithTableName implements ModelInterface, ArrayAccess, \JsonSe ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - * @phpstan-var array - * @psalm-var array - */ + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ protected static $openAPIFormats = [ 'table_name' => null, 'column_name' => null, @@ -77,10 +77,10 @@ class CreatorColumnWithTableName implements ModelInterface, ArrayAccess, \JsonSe ]; /** - * Array of nullable properties. Used for (de)serialization - * - * @var boolean[] - */ + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ protected static array $openAPINullables = [ 'table_name' => false, 'column_name' => false, @@ -89,10 +89,10 @@ class CreatorColumnWithTableName implements ModelInterface, ArrayAccess, \JsonSe ]; /** - * If a nullable field gets set to null, insert it here - * - * @var boolean[] - */ + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ protected array $openAPINullablesSetToNull = []; /** @@ -281,14 +281,14 @@ public function __construct(?array $data = null) } /** - * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName - * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the - * $this->openAPINullablesSetToNull array - * - * @param string $variableName - * @param array $fields - * @param mixed $defaultValue - */ + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ private function setIfExists(string $variableName, array $fields, $defaultValue): void { if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { diff --git a/lib/Base/CtimeColumn.php b/lib/Base/CtimeColumn.php index 7c1ab446..9bf9cd5f 100644 --- a/lib/Base/CtimeColumn.php +++ b/lib/Base/CtimeColumn.php @@ -45,17 +45,17 @@ class CtimeColumn implements ModelInterface, ArrayAccess, \JsonSerializable public const DISCRIMINATOR = null; /** - * The original name of the model. - * - * @var string - */ + * The original name of the model. + * + * @var string + */ protected static $openAPIModelName = 'ctime_column'; /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ protected static $openAPITypes = [ 'column_name' => 'string', 'column_type' => 'string', @@ -63,12 +63,12 @@ class CtimeColumn implements ModelInterface, ArrayAccess, \JsonSerializable ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - * @phpstan-var array - * @psalm-var array - */ + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ protected static $openAPIFormats = [ 'column_name' => null, 'column_type' => null, @@ -76,10 +76,10 @@ class CtimeColumn implements ModelInterface, ArrayAccess, \JsonSerializable ]; /** - * Array of nullable properties. Used for (de)serialization - * - * @var boolean[] - */ + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ protected static array $openAPINullables = [ 'column_name' => false, 'column_type' => false, @@ -87,10 +87,10 @@ class CtimeColumn implements ModelInterface, ArrayAccess, \JsonSerializable ]; /** - * If a nullable field gets set to null, insert it here - * - * @var boolean[] - */ + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ protected array $openAPINullablesSetToNull = []; /** @@ -275,14 +275,14 @@ public function __construct(?array $data = null) } /** - * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName - * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the - * $this->openAPINullablesSetToNull array - * - * @param string $variableName - * @param array $fields - * @param mixed $defaultValue - */ + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ private function setIfExists(string $variableName, array $fields, $defaultValue): void { if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { diff --git a/lib/Base/CtimeColumnWithTableName.php b/lib/Base/CtimeColumnWithTableName.php index ff9d518a..0c5b4bf6 100644 --- a/lib/Base/CtimeColumnWithTableName.php +++ b/lib/Base/CtimeColumnWithTableName.php @@ -44,17 +44,17 @@ class CtimeColumnWithTableName implements ModelInterface, ArrayAccess, \JsonSeri public const DISCRIMINATOR = null; /** - * The original name of the model. - * - * @var string - */ + * The original name of the model. + * + * @var string + */ protected static $openAPIModelName = 'ctime_column_with_table_name'; /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ protected static $openAPITypes = [ 'table_name' => 'string', 'column_name' => 'string', @@ -63,12 +63,12 @@ class CtimeColumnWithTableName implements ModelInterface, ArrayAccess, \JsonSeri ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - * @phpstan-var array - * @psalm-var array - */ + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ protected static $openAPIFormats = [ 'table_name' => null, 'column_name' => null, @@ -77,10 +77,10 @@ class CtimeColumnWithTableName implements ModelInterface, ArrayAccess, \JsonSeri ]; /** - * Array of nullable properties. Used for (de)serialization - * - * @var boolean[] - */ + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ protected static array $openAPINullables = [ 'table_name' => false, 'column_name' => false, @@ -89,10 +89,10 @@ class CtimeColumnWithTableName implements ModelInterface, ArrayAccess, \JsonSeri ]; /** - * If a nullable field gets set to null, insert it here - * - * @var boolean[] - */ + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ protected array $openAPINullablesSetToNull = []; /** @@ -281,14 +281,14 @@ public function __construct(?array $data = null) } /** - * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName - * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the - * $this->openAPINullablesSetToNull array - * - * @param string $variableName - * @param array $fields - * @param mixed $defaultValue - */ + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ private function setIfExists(string $variableName, array $fields, $defaultValue): void { if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { diff --git a/lib/Base/DateColumn.php b/lib/Base/DateColumn.php index a4b2cef3..930999a0 100644 --- a/lib/Base/DateColumn.php +++ b/lib/Base/DateColumn.php @@ -45,17 +45,17 @@ class DateColumn implements ModelInterface, ArrayAccess, \JsonSerializable public const DISCRIMINATOR = null; /** - * The original name of the model. - * - * @var string - */ + * The original name of the model. + * + * @var string + */ protected static $openAPIModelName = 'date_column'; /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ protected static $openAPITypes = [ 'column_name' => 'string', 'column_type' => 'string', @@ -64,12 +64,12 @@ class DateColumn implements ModelInterface, ArrayAccess, \JsonSerializable ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - * @phpstan-var array - * @psalm-var array - */ + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ protected static $openAPIFormats = [ 'column_name' => null, 'column_type' => null, @@ -78,10 +78,10 @@ class DateColumn implements ModelInterface, ArrayAccess, \JsonSerializable ]; /** - * Array of nullable properties. Used for (de)serialization - * - * @var boolean[] - */ + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ protected static array $openAPINullables = [ 'column_name' => false, 'column_type' => false, @@ -90,10 +90,10 @@ class DateColumn implements ModelInterface, ArrayAccess, \JsonSerializable ]; /** - * If a nullable field gets set to null, insert it here - * - * @var boolean[] - */ + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ protected array $openAPINullablesSetToNull = []; /** @@ -282,14 +282,14 @@ public function __construct(?array $data = null) } /** - * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName - * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the - * $this->openAPINullablesSetToNull array - * - * @param string $variableName - * @param array $fields - * @param mixed $defaultValue - */ + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ private function setIfExists(string $variableName, array $fields, $defaultValue): void { if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { diff --git a/lib/Base/DateColumnFormat.php b/lib/Base/DateColumnFormat.php index f6b38f15..4c5f42d1 100644 --- a/lib/Base/DateColumnFormat.php +++ b/lib/Base/DateColumnFormat.php @@ -45,46 +45,46 @@ class DateColumnFormat implements ModelInterface, ArrayAccess, \JsonSerializable public const DISCRIMINATOR = null; /** - * The original name of the model. - * - * @var string - */ + * The original name of the model. + * + * @var string + */ protected static $openAPIModelName = 'date_column_format'; /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ protected static $openAPITypes = [ 'format' => 'string' ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - * @phpstan-var array - * @psalm-var array - */ + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ protected static $openAPIFormats = [ 'format' => null ]; /** - * Array of nullable properties. Used for (de)serialization - * - * @var boolean[] - */ + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ protected static array $openAPINullables = [ 'format' => false ]; /** - * If a nullable field gets set to null, insert it here - * - * @var boolean[] - */ + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ protected array $openAPINullablesSetToNull = []; /** @@ -277,14 +277,14 @@ public function __construct(?array $data = null) } /** - * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName - * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the - * $this->openAPINullablesSetToNull array - * - * @param string $variableName - * @param array $fields - * @param mixed $defaultValue - */ + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ private function setIfExists(string $variableName, array $fields, $defaultValue): void { if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { diff --git a/lib/Base/DateColumnWithTableName.php b/lib/Base/DateColumnWithTableName.php index f366a7d5..7bd07c0e 100644 --- a/lib/Base/DateColumnWithTableName.php +++ b/lib/Base/DateColumnWithTableName.php @@ -44,17 +44,17 @@ class DateColumnWithTableName implements ModelInterface, ArrayAccess, \JsonSeria public const DISCRIMINATOR = null; /** - * The original name of the model. - * - * @var string - */ + * The original name of the model. + * + * @var string + */ protected static $openAPIModelName = 'date_column_with_table_name'; /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ protected static $openAPITypes = [ 'table_name' => 'string', 'column_name' => 'string', @@ -64,12 +64,12 @@ class DateColumnWithTableName implements ModelInterface, ArrayAccess, \JsonSeria ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - * @phpstan-var array - * @psalm-var array - */ + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ protected static $openAPIFormats = [ 'table_name' => null, 'column_name' => null, @@ -79,10 +79,10 @@ class DateColumnWithTableName implements ModelInterface, ArrayAccess, \JsonSeria ]; /** - * Array of nullable properties. Used for (de)serialization - * - * @var boolean[] - */ + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ protected static array $openAPINullables = [ 'table_name' => false, 'column_name' => false, @@ -92,10 +92,10 @@ class DateColumnWithTableName implements ModelInterface, ArrayAccess, \JsonSeria ]; /** - * If a nullable field gets set to null, insert it here - * - * @var boolean[] - */ + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ protected array $openAPINullablesSetToNull = []; /** @@ -288,14 +288,14 @@ public function __construct(?array $data = null) } /** - * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName - * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the - * $this->openAPINullablesSetToNull array - * - * @param string $variableName - * @param array $fields - * @param mixed $defaultValue - */ + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ private function setIfExists(string $variableName, array $fields, $defaultValue): void { if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { diff --git a/lib/Base/DeleteColumn.php b/lib/Base/DeleteColumn.php index 9e0fb396..7790610b 100644 --- a/lib/Base/DeleteColumn.php +++ b/lib/Base/DeleteColumn.php @@ -44,49 +44,49 @@ class DeleteColumn implements ModelInterface, ArrayAccess, \JsonSerializable public const DISCRIMINATOR = null; /** - * The original name of the model. - * - * @var string - */ + * The original name of the model. + * + * @var string + */ protected static $openAPIModelName = 'delete_column'; /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ protected static $openAPITypes = [ 'table_name' => 'string', 'column' => 'string' ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - * @phpstan-var array - * @psalm-var array - */ + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ protected static $openAPIFormats = [ 'table_name' => null, 'column' => null ]; /** - * Array of nullable properties. Used for (de)serialization - * - * @var boolean[] - */ + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ protected static array $openAPINullables = [ 'table_name' => false, 'column' => false ]; /** - * If a nullable field gets set to null, insert it here - * - * @var boolean[] - */ + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ protected array $openAPINullablesSetToNull = []; /** @@ -254,14 +254,14 @@ public function __construct(?array $data = null) } /** - * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName - * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the - * $this->openAPINullablesSetToNull array - * - * @param string $variableName - * @param array $fields - * @param mixed $defaultValue - */ + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ private function setIfExists(string $variableName, array $fields, $defaultValue): void { if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { diff --git a/lib/Base/DeleteRow.php b/lib/Base/DeleteRow.php index 036424b1..dc9805a8 100644 --- a/lib/Base/DeleteRow.php +++ b/lib/Base/DeleteRow.php @@ -45,49 +45,49 @@ class DeleteRow implements ModelInterface, ArrayAccess, \JsonSerializable public const DISCRIMINATOR = null; /** - * The original name of the model. - * - * @var string - */ + * The original name of the model. + * + * @var string + */ protected static $openAPIModelName = 'delete_row'; /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ protected static $openAPITypes = [ 'table_name' => 'string', 'row_id' => 'string' ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - * @phpstan-var array - * @psalm-var array - */ + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ protected static $openAPIFormats = [ 'table_name' => null, 'row_id' => null ]; /** - * Array of nullable properties. Used for (de)serialization - * - * @var boolean[] - */ + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ protected static array $openAPINullables = [ 'table_name' => false, 'row_id' => false ]; /** - * If a nullable field gets set to null, insert it here - * - * @var boolean[] - */ + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ protected array $openAPINullablesSetToNull = []; /** @@ -255,14 +255,14 @@ public function __construct(?array $data = null) } /** - * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName - * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the - * $this->openAPINullablesSetToNull array - * - * @param string $variableName - * @param array $fields - * @param mixed $defaultValue - */ + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ private function setIfExists(string $variableName, array $fields, $defaultValue): void { if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { diff --git a/lib/Base/DeleteRow200Response.php b/lib/Base/DeleteRow200Response.php index a38ac0e3..c1fc358b 100644 --- a/lib/Base/DeleteRow200Response.php +++ b/lib/Base/DeleteRow200Response.php @@ -44,46 +44,46 @@ class DeleteRow200Response implements ModelInterface, ArrayAccess, \JsonSerializ public const DISCRIMINATOR = null; /** - * The original name of the model. - * - * @var string - */ + * The original name of the model. + * + * @var string + */ protected static $openAPIModelName = 'deleteRow_200_response'; /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ protected static $openAPITypes = [ 'deleted_rows' => 'int' ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - * @phpstan-var array - * @psalm-var array - */ + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ protected static $openAPIFormats = [ 'deleted_rows' => null ]; /** - * Array of nullable properties. Used for (de)serialization - * - * @var boolean[] - */ + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ protected static array $openAPINullables = [ 'deleted_rows' => false ]; /** - * If a nullable field gets set to null, insert it here - * - * @var boolean[] - */ + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ protected array $openAPINullablesSetToNull = []; /** @@ -247,14 +247,14 @@ public function __construct(?array $data = null) } /** - * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName - * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the - * $this->openAPINullablesSetToNull array - * - * @param string $variableName - * @param array $fields - * @param mixed $defaultValue - */ + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ private function setIfExists(string $variableName, array $fields, $defaultValue): void { if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { diff --git a/lib/Base/DeleteRows.php b/lib/Base/DeleteRows.php index 174cfe8b..1cc7f025 100644 --- a/lib/Base/DeleteRows.php +++ b/lib/Base/DeleteRows.php @@ -45,49 +45,49 @@ class DeleteRows implements ModelInterface, ArrayAccess, \JsonSerializable public const DISCRIMINATOR = null; /** - * The original name of the model. - * - * @var string - */ + * The original name of the model. + * + * @var string + */ protected static $openAPIModelName = 'delete_rows'; /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ protected static $openAPITypes = [ 'table_name' => 'string', 'row_ids' => 'string[]' ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - * @phpstan-var array - * @psalm-var array - */ + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ protected static $openAPIFormats = [ 'table_name' => null, 'row_ids' => null ]; /** - * Array of nullable properties. Used for (de)serialization - * - * @var boolean[] - */ + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ protected static array $openAPINullables = [ 'table_name' => false, 'row_ids' => false ]; /** - * If a nullable field gets set to null, insert it here - * - * @var boolean[] - */ + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ protected array $openAPINullablesSetToNull = []; /** @@ -255,14 +255,14 @@ public function __construct(?array $data = null) } /** - * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName - * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the - * $this->openAPINullablesSetToNull array - * - * @param string $variableName - * @param array $fields - * @param mixed $defaultValue - */ + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ private function setIfExists(string $variableName, array $fields, $defaultValue): void { if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { @@ -355,7 +355,6 @@ public function setRowIds($row_ids) if (is_null($row_ids)) { throw new \InvalidArgumentException('non-nullable row_ids cannot be null'); } - if ((count($row_ids) > 10000)) { throw new \InvalidArgumentException('invalid value for $row_ids when calling DeleteRows., number of items must be less than or equal to 10000.'); } diff --git a/lib/Base/DeleteSelectOptions.php b/lib/Base/DeleteSelectOptions.php index f8000b69..b2ac72a8 100644 --- a/lib/Base/DeleteSelectOptions.php +++ b/lib/Base/DeleteSelectOptions.php @@ -44,17 +44,17 @@ class DeleteSelectOptions implements ModelInterface, ArrayAccess, \JsonSerializa public const DISCRIMINATOR = null; /** - * The original name of the model. - * - * @var string - */ + * The original name of the model. + * + * @var string + */ protected static $openAPIModelName = 'delete_select_options'; /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ protected static $openAPITypes = [ 'table_name' => 'string', 'column' => 'string', @@ -62,12 +62,12 @@ class DeleteSelectOptions implements ModelInterface, ArrayAccess, \JsonSerializa ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - * @phpstan-var array - * @psalm-var array - */ + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ protected static $openAPIFormats = [ 'table_name' => null, 'column' => null, @@ -75,10 +75,10 @@ class DeleteSelectOptions implements ModelInterface, ArrayAccess, \JsonSerializa ]; /** - * Array of nullable properties. Used for (de)serialization - * - * @var boolean[] - */ + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ protected static array $openAPINullables = [ 'table_name' => false, 'column' => false, @@ -86,10 +86,10 @@ class DeleteSelectOptions implements ModelInterface, ArrayAccess, \JsonSerializa ]; /** - * If a nullable field gets set to null, insert it here - * - * @var boolean[] - */ + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ protected array $openAPINullablesSetToNull = []; /** @@ -261,14 +261,14 @@ public function __construct(?array $data = null) } /** - * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName - * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the - * $this->openAPINullablesSetToNull array - * - * @param string $variableName - * @param array $fields - * @param mixed $defaultValue - */ + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ private function setIfExists(string $variableName, array $fields, $defaultValue): void { if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { diff --git a/lib/Base/DeleteTable.php b/lib/Base/DeleteTable.php index 33adea83..a97bebe8 100644 --- a/lib/Base/DeleteTable.php +++ b/lib/Base/DeleteTable.php @@ -45,46 +45,46 @@ class DeleteTable implements ModelInterface, ArrayAccess, \JsonSerializable public const DISCRIMINATOR = null; /** - * The original name of the model. - * - * @var string - */ + * The original name of the model. + * + * @var string + */ protected static $openAPIModelName = 'delete_table'; /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ protected static $openAPITypes = [ 'table_name' => 'string' ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - * @phpstan-var array - * @psalm-var array - */ + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ protected static $openAPIFormats = [ 'table_name' => null ]; /** - * Array of nullable properties. Used for (de)serialization - * - * @var boolean[] - */ + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ protected static array $openAPINullables = [ 'table_name' => false ]; /** - * If a nullable field gets set to null, insert it here - * - * @var boolean[] - */ + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ protected array $openAPINullablesSetToNull = []; /** @@ -248,14 +248,14 @@ public function __construct(?array $data = null) } /** - * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName - * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the - * $this->openAPINullablesSetToNull array - * - * @param string $variableName - * @param array $fields - * @param mixed $defaultValue - */ + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ private function setIfExists(string $variableName, array $fields, $defaultValue): void { if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { diff --git a/lib/Base/DuplicateTable.php b/lib/Base/DuplicateTable.php index ac2fed4f..ef4a89b2 100644 --- a/lib/Base/DuplicateTable.php +++ b/lib/Base/DuplicateTable.php @@ -44,49 +44,49 @@ class DuplicateTable implements ModelInterface, ArrayAccess, \JsonSerializable public const DISCRIMINATOR = null; /** - * The original name of the model. - * - * @var string - */ + * The original name of the model. + * + * @var string + */ protected static $openAPIModelName = 'duplicate_table'; /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ protected static $openAPITypes = [ 'table_name' => 'string', 'is_duplicate_records' => 'bool' ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - * @phpstan-var array - * @psalm-var array - */ + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ protected static $openAPIFormats = [ 'table_name' => null, 'is_duplicate_records' => null ]; /** - * Array of nullable properties. Used for (de)serialization - * - * @var boolean[] - */ + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ protected static array $openAPINullables = [ 'table_name' => false, 'is_duplicate_records' => false ]; /** - * If a nullable field gets set to null, insert it here - * - * @var boolean[] - */ + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ protected array $openAPINullablesSetToNull = []; /** @@ -254,14 +254,14 @@ public function __construct(?array $data = null) } /** - * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName - * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the - * $this->openAPINullablesSetToNull array - * - * @param string $variableName - * @param array $fields - * @param mixed $defaultValue - */ + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ private function setIfExists(string $variableName, array $fields, $defaultValue): void { if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { diff --git a/lib/Base/DuplicateTable200Response.php b/lib/Base/DuplicateTable200Response.php index e1d468e2..553f1169 100644 --- a/lib/Base/DuplicateTable200Response.php +++ b/lib/Base/DuplicateTable200Response.php @@ -44,17 +44,17 @@ class DuplicateTable200Response implements ModelInterface, ArrayAccess, \JsonSer public const DISCRIMINATOR = null; /** - * The original name of the model. - * - * @var string - */ + * The original name of the model. + * + * @var string + */ protected static $openAPIModelName = 'duplicateTable_200_response'; /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ protected static $openAPITypes = [ '_id' => 'string', 'name' => 'string', @@ -65,12 +65,12 @@ class DuplicateTable200Response implements ModelInterface, ArrayAccess, \JsonSer ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - * @phpstan-var array - * @psalm-var array - */ + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ protected static $openAPIFormats = [ '_id' => null, 'name' => null, @@ -81,10 +81,10 @@ class DuplicateTable200Response implements ModelInterface, ArrayAccess, \JsonSer ]; /** - * Array of nullable properties. Used for (de)serialization - * - * @var boolean[] - */ + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ protected static array $openAPINullables = [ '_id' => false, 'name' => false, @@ -95,10 +95,10 @@ class DuplicateTable200Response implements ModelInterface, ArrayAccess, \JsonSer ]; /** - * If a nullable field gets set to null, insert it here - * - * @var boolean[] - */ + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ protected array $openAPINullablesSetToNull = []; /** @@ -282,14 +282,14 @@ public function __construct(?array $data = null) } /** - * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName - * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the - * $this->openAPINullablesSetToNull array - * - * @param string $variableName - * @param array $fields - * @param mixed $defaultValue - */ + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ private function setIfExists(string $variableName, array $fields, $defaultValue): void { if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { diff --git a/lib/Base/DurationColumn.php b/lib/Base/DurationColumn.php index 2ad4841d..2acef8ad 100644 --- a/lib/Base/DurationColumn.php +++ b/lib/Base/DurationColumn.php @@ -45,17 +45,17 @@ class DurationColumn implements ModelInterface, ArrayAccess, \JsonSerializable public const DISCRIMINATOR = null; /** - * The original name of the model. - * - * @var string - */ + * The original name of the model. + * + * @var string + */ protected static $openAPIModelName = 'duration_column'; /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ protected static $openAPITypes = [ 'column_name' => 'string', 'column_type' => 'string', @@ -64,12 +64,12 @@ class DurationColumn implements ModelInterface, ArrayAccess, \JsonSerializable ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - * @phpstan-var array - * @psalm-var array - */ + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ protected static $openAPIFormats = [ 'column_name' => null, 'column_type' => null, @@ -78,10 +78,10 @@ class DurationColumn implements ModelInterface, ArrayAccess, \JsonSerializable ]; /** - * Array of nullable properties. Used for (de)serialization - * - * @var boolean[] - */ + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ protected static array $openAPINullables = [ 'column_name' => false, 'column_type' => false, @@ -90,10 +90,10 @@ class DurationColumn implements ModelInterface, ArrayAccess, \JsonSerializable ]; /** - * If a nullable field gets set to null, insert it here - * - * @var boolean[] - */ + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ protected array $openAPINullablesSetToNull = []; /** @@ -282,14 +282,14 @@ public function __construct(?array $data = null) } /** - * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName - * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the - * $this->openAPINullablesSetToNull array - * - * @param string $variableName - * @param array $fields - * @param mixed $defaultValue - */ + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ private function setIfExists(string $variableName, array $fields, $defaultValue): void { if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { diff --git a/lib/Base/DurationColumnFormat.php b/lib/Base/DurationColumnFormat.php index ca3db14a..95392f65 100644 --- a/lib/Base/DurationColumnFormat.php +++ b/lib/Base/DurationColumnFormat.php @@ -45,49 +45,49 @@ class DurationColumnFormat implements ModelInterface, ArrayAccess, \JsonSerializ public const DISCRIMINATOR = null; /** - * The original name of the model. - * - * @var string - */ + * The original name of the model. + * + * @var string + */ protected static $openAPIModelName = 'duration_column_format'; /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ protected static $openAPITypes = [ 'format' => 'string', 'duration_format' => 'string' ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - * @phpstan-var array - * @psalm-var array - */ + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ protected static $openAPIFormats = [ 'format' => null, 'duration_format' => null ]; /** - * Array of nullable properties. Used for (de)serialization - * - * @var boolean[] - */ + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ protected static array $openAPINullables = [ 'format' => false, 'duration_format' => false ]; /** - * If a nullable field gets set to null, insert it here - * - * @var boolean[] - */ + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ protected array $openAPINullablesSetToNull = []; /** @@ -285,14 +285,14 @@ public function __construct(?array $data = null) } /** - * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName - * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the - * $this->openAPINullablesSetToNull array - * - * @param string $variableName - * @param array $fields - * @param mixed $defaultValue - */ + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ private function setIfExists(string $variableName, array $fields, $defaultValue): void { if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { diff --git a/lib/Base/DurationColumnWithTableName.php b/lib/Base/DurationColumnWithTableName.php index 1a504a15..357cc641 100644 --- a/lib/Base/DurationColumnWithTableName.php +++ b/lib/Base/DurationColumnWithTableName.php @@ -44,17 +44,17 @@ class DurationColumnWithTableName implements ModelInterface, ArrayAccess, \JsonS public const DISCRIMINATOR = null; /** - * The original name of the model. - * - * @var string - */ + * The original name of the model. + * + * @var string + */ protected static $openAPIModelName = 'duration_column_with_table_name'; /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ protected static $openAPITypes = [ 'table_name' => 'string', 'column_name' => 'string', @@ -64,12 +64,12 @@ class DurationColumnWithTableName implements ModelInterface, ArrayAccess, \JsonS ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - * @phpstan-var array - * @psalm-var array - */ + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ protected static $openAPIFormats = [ 'table_name' => null, 'column_name' => null, @@ -79,10 +79,10 @@ class DurationColumnWithTableName implements ModelInterface, ArrayAccess, \JsonS ]; /** - * Array of nullable properties. Used for (de)serialization - * - * @var boolean[] - */ + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ protected static array $openAPINullables = [ 'table_name' => false, 'column_name' => false, @@ -92,10 +92,10 @@ class DurationColumnWithTableName implements ModelInterface, ArrayAccess, \JsonS ]; /** - * If a nullable field gets set to null, insert it here - * - * @var boolean[] - */ + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ protected array $openAPINullablesSetToNull = []; /** @@ -288,14 +288,14 @@ public function __construct(?array $data = null) } /** - * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName - * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the - * $this->openAPINullablesSetToNull array - * - * @param string $variableName - * @param array $fields - * @param mixed $defaultValue - */ + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ private function setIfExists(string $variableName, array $fields, $defaultValue): void { if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { diff --git a/lib/Base/EmailColumn.php b/lib/Base/EmailColumn.php index 1113da12..bddcb7f5 100644 --- a/lib/Base/EmailColumn.php +++ b/lib/Base/EmailColumn.php @@ -45,17 +45,17 @@ class EmailColumn implements ModelInterface, ArrayAccess, \JsonSerializable public const DISCRIMINATOR = null; /** - * The original name of the model. - * - * @var string - */ + * The original name of the model. + * + * @var string + */ protected static $openAPIModelName = 'email_column'; /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ protected static $openAPITypes = [ 'column_name' => 'string', 'column_type' => 'string', @@ -63,12 +63,12 @@ class EmailColumn implements ModelInterface, ArrayAccess, \JsonSerializable ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - * @phpstan-var array - * @psalm-var array - */ + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ protected static $openAPIFormats = [ 'column_name' => null, 'column_type' => null, @@ -76,10 +76,10 @@ class EmailColumn implements ModelInterface, ArrayAccess, \JsonSerializable ]; /** - * Array of nullable properties. Used for (de)serialization - * - * @var boolean[] - */ + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ protected static array $openAPINullables = [ 'column_name' => false, 'column_type' => false, @@ -87,10 +87,10 @@ class EmailColumn implements ModelInterface, ArrayAccess, \JsonSerializable ]; /** - * If a nullable field gets set to null, insert it here - * - * @var boolean[] - */ + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ protected array $openAPINullablesSetToNull = []; /** @@ -275,14 +275,14 @@ public function __construct(?array $data = null) } /** - * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName - * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the - * $this->openAPINullablesSetToNull array - * - * @param string $variableName - * @param array $fields - * @param mixed $defaultValue - */ + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ private function setIfExists(string $variableName, array $fields, $defaultValue): void { if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { diff --git a/lib/Base/EmailColumnWithTableName.php b/lib/Base/EmailColumnWithTableName.php index 073c9765..a2f10b98 100644 --- a/lib/Base/EmailColumnWithTableName.php +++ b/lib/Base/EmailColumnWithTableName.php @@ -44,17 +44,17 @@ class EmailColumnWithTableName implements ModelInterface, ArrayAccess, \JsonSeri public const DISCRIMINATOR = null; /** - * The original name of the model. - * - * @var string - */ + * The original name of the model. + * + * @var string + */ protected static $openAPIModelName = 'email_column_with_table_name'; /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ protected static $openAPITypes = [ 'table_name' => 'string', 'column_name' => 'string', @@ -63,12 +63,12 @@ class EmailColumnWithTableName implements ModelInterface, ArrayAccess, \JsonSeri ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - * @phpstan-var array - * @psalm-var array - */ + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ protected static $openAPIFormats = [ 'table_name' => null, 'column_name' => null, @@ -77,10 +77,10 @@ class EmailColumnWithTableName implements ModelInterface, ArrayAccess, \JsonSeri ]; /** - * Array of nullable properties. Used for (de)serialization - * - * @var boolean[] - */ + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ protected static array $openAPINullables = [ 'table_name' => false, 'column_name' => false, @@ -89,10 +89,10 @@ class EmailColumnWithTableName implements ModelInterface, ArrayAccess, \JsonSeri ]; /** - * If a nullable field gets set to null, insert it here - * - * @var boolean[] - */ + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ protected array $openAPINullablesSetToNull = []; /** @@ -281,14 +281,14 @@ public function __construct(?array $data = null) } /** - * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName - * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the - * $this->openAPINullablesSetToNull array - * - * @param string $variableName - * @param array $fields - * @param mixed $defaultValue - */ + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ private function setIfExists(string $variableName, array $fields, $defaultValue): void { if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { diff --git a/lib/Base/FileColumn.php b/lib/Base/FileColumn.php index ec09e507..588a2fa3 100644 --- a/lib/Base/FileColumn.php +++ b/lib/Base/FileColumn.php @@ -45,17 +45,17 @@ class FileColumn implements ModelInterface, ArrayAccess, \JsonSerializable public const DISCRIMINATOR = null; /** - * The original name of the model. - * - * @var string - */ + * The original name of the model. + * + * @var string + */ protected static $openAPIModelName = 'file_column'; /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ protected static $openAPITypes = [ 'column_name' => 'string', 'column_type' => 'string', @@ -63,12 +63,12 @@ class FileColumn implements ModelInterface, ArrayAccess, \JsonSerializable ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - * @phpstan-var array - * @psalm-var array - */ + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ protected static $openAPIFormats = [ 'column_name' => null, 'column_type' => null, @@ -76,10 +76,10 @@ class FileColumn implements ModelInterface, ArrayAccess, \JsonSerializable ]; /** - * Array of nullable properties. Used for (de)serialization - * - * @var boolean[] - */ + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ protected static array $openAPINullables = [ 'column_name' => false, 'column_type' => false, @@ -87,10 +87,10 @@ class FileColumn implements ModelInterface, ArrayAccess, \JsonSerializable ]; /** - * If a nullable field gets set to null, insert it here - * - * @var boolean[] - */ + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ protected array $openAPINullablesSetToNull = []; /** @@ -275,14 +275,14 @@ public function __construct(?array $data = null) } /** - * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName - * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the - * $this->openAPINullablesSetToNull array - * - * @param string $variableName - * @param array $fields - * @param mixed $defaultValue - */ + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ private function setIfExists(string $variableName, array $fields, $defaultValue): void { if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { diff --git a/lib/Base/FileColumnWithTableName.php b/lib/Base/FileColumnWithTableName.php index 3461b7a9..08e3d7a4 100644 --- a/lib/Base/FileColumnWithTableName.php +++ b/lib/Base/FileColumnWithTableName.php @@ -44,17 +44,17 @@ class FileColumnWithTableName implements ModelInterface, ArrayAccess, \JsonSeria public const DISCRIMINATOR = null; /** - * The original name of the model. - * - * @var string - */ + * The original name of the model. + * + * @var string + */ protected static $openAPIModelName = 'file_column_with_table_name'; /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ protected static $openAPITypes = [ 'table_name' => 'string', 'column_name' => 'string', @@ -63,12 +63,12 @@ class FileColumnWithTableName implements ModelInterface, ArrayAccess, \JsonSeria ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - * @phpstan-var array - * @psalm-var array - */ + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ protected static $openAPIFormats = [ 'table_name' => null, 'column_name' => null, @@ -77,10 +77,10 @@ class FileColumnWithTableName implements ModelInterface, ArrayAccess, \JsonSeria ]; /** - * Array of nullable properties. Used for (de)serialization - * - * @var boolean[] - */ + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ protected static array $openAPINullables = [ 'table_name' => false, 'column_name' => false, @@ -89,10 +89,10 @@ class FileColumnWithTableName implements ModelInterface, ArrayAccess, \JsonSeria ]; /** - * If a nullable field gets set to null, insert it here - * - * @var boolean[] - */ + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ protected array $openAPINullablesSetToNull = []; /** @@ -281,14 +281,14 @@ public function __construct(?array $data = null) } /** - * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName - * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the - * $this->openAPINullablesSetToNull array - * - * @param string $variableName - * @param array $fields - * @param mixed $defaultValue - */ + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ private function setIfExists(string $variableName, array $fields, $defaultValue): void { if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { diff --git a/lib/Base/FiltersAutomatic.php b/lib/Base/FiltersAutomatic.php index ca278967..f24cb5f5 100644 --- a/lib/Base/FiltersAutomatic.php +++ b/lib/Base/FiltersAutomatic.php @@ -44,17 +44,17 @@ class FiltersAutomatic implements ModelInterface, ArrayAccess, \JsonSerializable public const DISCRIMINATOR = null; /** - * The original name of the model. - * - * @var string - */ + * The original name of the model. + * + * @var string + */ protected static $openAPIModelName = 'filters_automatic'; /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ protected static $openAPITypes = [ 'column_key' => 'string', 'filter_predicate' => '\SeaTable\Client\Base\AutomaticFilterPredicate', @@ -62,12 +62,12 @@ class FiltersAutomatic implements ModelInterface, ArrayAccess, \JsonSerializable ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - * @phpstan-var array - * @psalm-var array - */ + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ protected static $openAPIFormats = [ 'column_key' => null, 'filter_predicate' => null, @@ -75,10 +75,10 @@ class FiltersAutomatic implements ModelInterface, ArrayAccess, \JsonSerializable ]; /** - * Array of nullable properties. Used for (de)serialization - * - * @var boolean[] - */ + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ protected static array $openAPINullables = [ 'column_key' => false, 'filter_predicate' => false, @@ -86,10 +86,10 @@ class FiltersAutomatic implements ModelInterface, ArrayAccess, \JsonSerializable ]; /** - * If a nullable field gets set to null, insert it here - * - * @var boolean[] - */ + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ protected array $openAPINullablesSetToNull = []; /** @@ -261,14 +261,14 @@ public function __construct(?array $data = null) } /** - * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName - * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the - * $this->openAPINullablesSetToNull array - * - * @param string $variableName - * @param array $fields - * @param mixed $defaultValue - */ + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ private function setIfExists(string $variableName, array $fields, $defaultValue): void { if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { diff --git a/lib/Base/FiltersCheckbox.php b/lib/Base/FiltersCheckbox.php index 4dfd0a9f..cbd3b58d 100644 --- a/lib/Base/FiltersCheckbox.php +++ b/lib/Base/FiltersCheckbox.php @@ -44,17 +44,17 @@ class FiltersCheckbox implements ModelInterface, ArrayAccess, \JsonSerializable public const DISCRIMINATOR = null; /** - * The original name of the model. - * - * @var string - */ + * The original name of the model. + * + * @var string + */ protected static $openAPIModelName = 'filters_checkbox'; /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ protected static $openAPITypes = [ 'column_key' => 'string', 'filter_predicate' => '\SeaTable\Client\Base\CheckboxFilterPredicate', @@ -62,12 +62,12 @@ class FiltersCheckbox implements ModelInterface, ArrayAccess, \JsonSerializable ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - * @phpstan-var array - * @psalm-var array - */ + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ protected static $openAPIFormats = [ 'column_key' => null, 'filter_predicate' => null, @@ -75,10 +75,10 @@ class FiltersCheckbox implements ModelInterface, ArrayAccess, \JsonSerializable ]; /** - * Array of nullable properties. Used for (de)serialization - * - * @var boolean[] - */ + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ protected static array $openAPINullables = [ 'column_key' => false, 'filter_predicate' => false, @@ -86,10 +86,10 @@ class FiltersCheckbox implements ModelInterface, ArrayAccess, \JsonSerializable ]; /** - * If a nullable field gets set to null, insert it here - * - * @var boolean[] - */ + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ protected array $openAPINullablesSetToNull = []; /** @@ -261,14 +261,14 @@ public function __construct(?array $data = null) } /** - * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName - * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the - * $this->openAPINullablesSetToNull array - * - * @param string $variableName - * @param array $fields - * @param mixed $defaultValue - */ + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ private function setIfExists(string $variableName, array $fields, $defaultValue): void { if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { diff --git a/lib/Base/FiltersCollaborator.php b/lib/Base/FiltersCollaborator.php index 6b179435..e43b19dc 100644 --- a/lib/Base/FiltersCollaborator.php +++ b/lib/Base/FiltersCollaborator.php @@ -44,17 +44,17 @@ class FiltersCollaborator implements ModelInterface, ArrayAccess, \JsonSerializa public const DISCRIMINATOR = null; /** - * The original name of the model. - * - * @var string - */ + * The original name of the model. + * + * @var string + */ protected static $openAPIModelName = 'filters_collaborator'; /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ protected static $openAPITypes = [ 'column_key' => 'string', 'filter_predicate' => '\SeaTable\Client\Base\CollaboratorFilterPredicate', @@ -62,12 +62,12 @@ class FiltersCollaborator implements ModelInterface, ArrayAccess, \JsonSerializa ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - * @phpstan-var array - * @psalm-var array - */ + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ protected static $openAPIFormats = [ 'column_key' => null, 'filter_predicate' => null, @@ -75,10 +75,10 @@ class FiltersCollaborator implements ModelInterface, ArrayAccess, \JsonSerializa ]; /** - * Array of nullable properties. Used for (de)serialization - * - * @var boolean[] - */ + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ protected static array $openAPINullables = [ 'column_key' => false, 'filter_predicate' => false, @@ -86,10 +86,10 @@ class FiltersCollaborator implements ModelInterface, ArrayAccess, \JsonSerializa ]; /** - * If a nullable field gets set to null, insert it here - * - * @var boolean[] - */ + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ protected array $openAPINullablesSetToNull = []; /** @@ -261,14 +261,14 @@ public function __construct(?array $data = null) } /** - * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName - * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the - * $this->openAPINullablesSetToNull array - * - * @param string $variableName - * @param array $fields - * @param mixed $defaultValue - */ + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ private function setIfExists(string $variableName, array $fields, $defaultValue): void { if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { diff --git a/lib/Base/FiltersCreated.php b/lib/Base/FiltersCreated.php index 2eee970b..8d013530 100644 --- a/lib/Base/FiltersCreated.php +++ b/lib/Base/FiltersCreated.php @@ -44,17 +44,17 @@ class FiltersCreated implements ModelInterface, ArrayAccess, \JsonSerializable public const DISCRIMINATOR = null; /** - * The original name of the model. - * - * @var string - */ + * The original name of the model. + * + * @var string + */ protected static $openAPIModelName = 'filters_created'; /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ protected static $openAPITypes = [ 'column_key' => 'string', 'filter_predicate' => '\SeaTable\Client\Base\DateFilterPredicate', @@ -63,12 +63,12 @@ class FiltersCreated implements ModelInterface, ArrayAccess, \JsonSerializable ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - * @phpstan-var array - * @psalm-var array - */ + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ protected static $openAPIFormats = [ 'column_key' => null, 'filter_predicate' => null, @@ -77,10 +77,10 @@ class FiltersCreated implements ModelInterface, ArrayAccess, \JsonSerializable ]; /** - * Array of nullable properties. Used for (de)serialization - * - * @var boolean[] - */ + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ protected static array $openAPINullables = [ 'column_key' => false, 'filter_predicate' => false, @@ -89,10 +89,10 @@ class FiltersCreated implements ModelInterface, ArrayAccess, \JsonSerializable ]; /** - * If a nullable field gets set to null, insert it here - * - * @var boolean[] - */ + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ protected array $openAPINullablesSetToNull = []; /** @@ -268,14 +268,14 @@ public function __construct(?array $data = null) } /** - * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName - * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the - * $this->openAPINullablesSetToNull array - * - * @param string $variableName - * @param array $fields - * @param mixed $defaultValue - */ + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ private function setIfExists(string $variableName, array $fields, $defaultValue): void { if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { diff --git a/lib/Base/FiltersCreator.php b/lib/Base/FiltersCreator.php index 44c2cb12..4d424e3a 100644 --- a/lib/Base/FiltersCreator.php +++ b/lib/Base/FiltersCreator.php @@ -44,17 +44,17 @@ class FiltersCreator implements ModelInterface, ArrayAccess, \JsonSerializable public const DISCRIMINATOR = null; /** - * The original name of the model. - * - * @var string - */ + * The original name of the model. + * + * @var string + */ protected static $openAPIModelName = 'filters_creator'; /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ protected static $openAPITypes = [ 'column_key' => 'string', 'filter_predicate' => '\SeaTable\Client\Base\CreatorFilterPredicate', @@ -62,12 +62,12 @@ class FiltersCreator implements ModelInterface, ArrayAccess, \JsonSerializable ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - * @phpstan-var array - * @psalm-var array - */ + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ protected static $openAPIFormats = [ 'column_key' => null, 'filter_predicate' => null, @@ -75,10 +75,10 @@ class FiltersCreator implements ModelInterface, ArrayAccess, \JsonSerializable ]; /** - * Array of nullable properties. Used for (de)serialization - * - * @var boolean[] - */ + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ protected static array $openAPINullables = [ 'column_key' => false, 'filter_predicate' => false, @@ -86,10 +86,10 @@ class FiltersCreator implements ModelInterface, ArrayAccess, \JsonSerializable ]; /** - * If a nullable field gets set to null, insert it here - * - * @var boolean[] - */ + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ protected array $openAPINullablesSetToNull = []; /** @@ -261,14 +261,14 @@ public function __construct(?array $data = null) } /** - * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName - * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the - * $this->openAPINullablesSetToNull array - * - * @param string $variableName - * @param array $fields - * @param mixed $defaultValue - */ + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ private function setIfExists(string $variableName, array $fields, $defaultValue): void { if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { diff --git a/lib/Base/FiltersDate.php b/lib/Base/FiltersDate.php index 33c180e4..71d2e5eb 100644 --- a/lib/Base/FiltersDate.php +++ b/lib/Base/FiltersDate.php @@ -44,17 +44,17 @@ class FiltersDate implements ModelInterface, ArrayAccess, \JsonSerializable public const DISCRIMINATOR = null; /** - * The original name of the model. - * - * @var string - */ + * The original name of the model. + * + * @var string + */ protected static $openAPIModelName = 'filters_date'; /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ protected static $openAPITypes = [ 'column_key' => 'string', 'filter_predicate' => '\SeaTable\Client\Base\DateFilterPredicate', @@ -63,12 +63,12 @@ class FiltersDate implements ModelInterface, ArrayAccess, \JsonSerializable ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - * @phpstan-var array - * @psalm-var array - */ + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ protected static $openAPIFormats = [ 'column_key' => null, 'filter_predicate' => null, @@ -77,10 +77,10 @@ class FiltersDate implements ModelInterface, ArrayAccess, \JsonSerializable ]; /** - * Array of nullable properties. Used for (de)serialization - * - * @var boolean[] - */ + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ protected static array $openAPINullables = [ 'column_key' => false, 'filter_predicate' => false, @@ -89,10 +89,10 @@ class FiltersDate implements ModelInterface, ArrayAccess, \JsonSerializable ]; /** - * If a nullable field gets set to null, insert it here - * - * @var boolean[] - */ + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ protected array $openAPINullablesSetToNull = []; /** @@ -268,14 +268,14 @@ public function __construct(?array $data = null) } /** - * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName - * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the - * $this->openAPINullablesSetToNull array - * - * @param string $variableName - * @param array $fields - * @param mixed $defaultValue - */ + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ private function setIfExists(string $variableName, array $fields, $defaultValue): void { if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { diff --git a/lib/Base/FiltersDateTime.php b/lib/Base/FiltersDateTime.php index ca66199c..a38d3c7d 100644 --- a/lib/Base/FiltersDateTime.php +++ b/lib/Base/FiltersDateTime.php @@ -44,17 +44,17 @@ class FiltersDateTime implements ModelInterface, ArrayAccess, \JsonSerializable public const DISCRIMINATOR = null; /** - * The original name of the model. - * - * @var string - */ + * The original name of the model. + * + * @var string + */ protected static $openAPIModelName = 'filters_date-time'; /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ protected static $openAPITypes = [ 'column_key' => 'string', 'filter_predicate' => '\SeaTable\Client\Base\DateFilterPredicate', @@ -63,12 +63,12 @@ class FiltersDateTime implements ModelInterface, ArrayAccess, \JsonSerializable ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - * @phpstan-var array - * @psalm-var array - */ + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ protected static $openAPIFormats = [ 'column_key' => null, 'filter_predicate' => null, @@ -77,10 +77,10 @@ class FiltersDateTime implements ModelInterface, ArrayAccess, \JsonSerializable ]; /** - * Array of nullable properties. Used for (de)serialization - * - * @var boolean[] - */ + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ protected static array $openAPINullables = [ 'column_key' => false, 'filter_predicate' => false, @@ -89,10 +89,10 @@ class FiltersDateTime implements ModelInterface, ArrayAccess, \JsonSerializable ]; /** - * If a nullable field gets set to null, insert it here - * - * @var boolean[] - */ + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ protected array $openAPINullablesSetToNull = []; /** @@ -268,14 +268,14 @@ public function __construct(?array $data = null) } /** - * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName - * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the - * $this->openAPINullablesSetToNull array - * - * @param string $variableName - * @param array $fields - * @param mixed $defaultValue - */ + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ private function setIfExists(string $variableName, array $fields, $defaultValue): void { if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { diff --git a/lib/Base/FiltersDuration.php b/lib/Base/FiltersDuration.php index 90f3355a..ce5631b8 100644 --- a/lib/Base/FiltersDuration.php +++ b/lib/Base/FiltersDuration.php @@ -44,17 +44,17 @@ class FiltersDuration implements ModelInterface, ArrayAccess, \JsonSerializable public const DISCRIMINATOR = null; /** - * The original name of the model. - * - * @var string - */ + * The original name of the model. + * + * @var string + */ protected static $openAPIModelName = 'filters_duration'; /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ protected static $openAPITypes = [ 'column_key' => 'string', 'filter_predicate' => '\SeaTable\Client\Base\NumberFilterPredicate', @@ -62,12 +62,12 @@ class FiltersDuration implements ModelInterface, ArrayAccess, \JsonSerializable ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - * @phpstan-var array - * @psalm-var array - */ + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ protected static $openAPIFormats = [ 'column_key' => null, 'filter_predicate' => null, @@ -75,10 +75,10 @@ class FiltersDuration implements ModelInterface, ArrayAccess, \JsonSerializable ]; /** - * Array of nullable properties. Used for (de)serialization - * - * @var boolean[] - */ + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ protected static array $openAPINullables = [ 'column_key' => false, 'filter_predicate' => false, @@ -86,10 +86,10 @@ class FiltersDuration implements ModelInterface, ArrayAccess, \JsonSerializable ]; /** - * If a nullable field gets set to null, insert it here - * - * @var boolean[] - */ + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ protected array $openAPINullablesSetToNull = []; /** @@ -261,14 +261,14 @@ public function __construct(?array $data = null) } /** - * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName - * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the - * $this->openAPINullablesSetToNull array - * - * @param string $variableName - * @param array $fields - * @param mixed $defaultValue - */ + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ private function setIfExists(string $variableName, array $fields, $defaultValue): void { if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { diff --git a/lib/Base/FiltersEditor.php b/lib/Base/FiltersEditor.php index d4968020..8a6cf3e6 100644 --- a/lib/Base/FiltersEditor.php +++ b/lib/Base/FiltersEditor.php @@ -44,17 +44,17 @@ class FiltersEditor implements ModelInterface, ArrayAccess, \JsonSerializable public const DISCRIMINATOR = null; /** - * The original name of the model. - * - * @var string - */ + * The original name of the model. + * + * @var string + */ protected static $openAPIModelName = 'filters_editor'; /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ protected static $openAPITypes = [ 'column_key' => 'string', 'filter_predicate' => '\SeaTable\Client\Base\CreatorFilterPredicate', @@ -62,12 +62,12 @@ class FiltersEditor implements ModelInterface, ArrayAccess, \JsonSerializable ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - * @phpstan-var array - * @psalm-var array - */ + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ protected static $openAPIFormats = [ 'column_key' => null, 'filter_predicate' => null, @@ -75,10 +75,10 @@ class FiltersEditor implements ModelInterface, ArrayAccess, \JsonSerializable ]; /** - * Array of nullable properties. Used for (de)serialization - * - * @var boolean[] - */ + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ protected static array $openAPINullables = [ 'column_key' => false, 'filter_predicate' => false, @@ -86,10 +86,10 @@ class FiltersEditor implements ModelInterface, ArrayAccess, \JsonSerializable ]; /** - * If a nullable field gets set to null, insert it here - * - * @var boolean[] - */ + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ protected array $openAPINullablesSetToNull = []; /** @@ -261,14 +261,14 @@ public function __construct(?array $data = null) } /** - * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName - * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the - * $this->openAPINullablesSetToNull array - * - * @param string $variableName - * @param array $fields - * @param mixed $defaultValue - */ + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ private function setIfExists(string $variableName, array $fields, $defaultValue): void { if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { diff --git a/lib/Base/FiltersEmail.php b/lib/Base/FiltersEmail.php index 4cad4ce2..19992fcc 100644 --- a/lib/Base/FiltersEmail.php +++ b/lib/Base/FiltersEmail.php @@ -44,17 +44,17 @@ class FiltersEmail implements ModelInterface, ArrayAccess, \JsonSerializable public const DISCRIMINATOR = null; /** - * The original name of the model. - * - * @var string - */ + * The original name of the model. + * + * @var string + */ protected static $openAPIModelName = 'filters_email'; /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ protected static $openAPITypes = [ 'column_key' => 'string', 'filter_predicate' => '\SeaTable\Client\Base\EmailFilterPredicate', @@ -62,12 +62,12 @@ class FiltersEmail implements ModelInterface, ArrayAccess, \JsonSerializable ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - * @phpstan-var array - * @psalm-var array - */ + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ protected static $openAPIFormats = [ 'column_key' => null, 'filter_predicate' => null, @@ -75,10 +75,10 @@ class FiltersEmail implements ModelInterface, ArrayAccess, \JsonSerializable ]; /** - * Array of nullable properties. Used for (de)serialization - * - * @var boolean[] - */ + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ protected static array $openAPINullables = [ 'column_key' => false, 'filter_predicate' => false, @@ -86,10 +86,10 @@ class FiltersEmail implements ModelInterface, ArrayAccess, \JsonSerializable ]; /** - * If a nullable field gets set to null, insert it here - * - * @var boolean[] - */ + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ protected array $openAPINullablesSetToNull = []; /** @@ -261,14 +261,14 @@ public function __construct(?array $data = null) } /** - * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName - * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the - * $this->openAPINullablesSetToNull array - * - * @param string $variableName - * @param array $fields - * @param mixed $defaultValue - */ + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ private function setIfExists(string $variableName, array $fields, $defaultValue): void { if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { diff --git a/lib/Base/FiltersFile.php b/lib/Base/FiltersFile.php index 11d3518a..1012576d 100644 --- a/lib/Base/FiltersFile.php +++ b/lib/Base/FiltersFile.php @@ -44,17 +44,17 @@ class FiltersFile implements ModelInterface, ArrayAccess, \JsonSerializable public const DISCRIMINATOR = null; /** - * The original name of the model. - * - * @var string - */ + * The original name of the model. + * + * @var string + */ protected static $openAPIModelName = 'filters_file'; /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ protected static $openAPITypes = [ 'column_key' => 'string', 'filter_predicate' => '\SeaTable\Client\Base\ImageFilterPredicate', @@ -62,12 +62,12 @@ class FiltersFile implements ModelInterface, ArrayAccess, \JsonSerializable ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - * @phpstan-var array - * @psalm-var array - */ + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ protected static $openAPIFormats = [ 'column_key' => null, 'filter_predicate' => null, @@ -75,10 +75,10 @@ class FiltersFile implements ModelInterface, ArrayAccess, \JsonSerializable ]; /** - * Array of nullable properties. Used for (de)serialization - * - * @var boolean[] - */ + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ protected static array $openAPINullables = [ 'column_key' => false, 'filter_predicate' => false, @@ -86,10 +86,10 @@ class FiltersFile implements ModelInterface, ArrayAccess, \JsonSerializable ]; /** - * If a nullable field gets set to null, insert it here - * - * @var boolean[] - */ + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ protected array $openAPINullablesSetToNull = []; /** @@ -261,14 +261,14 @@ public function __construct(?array $data = null) } /** - * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName - * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the - * $this->openAPINullablesSetToNull array - * - * @param string $variableName - * @param array $fields - * @param mixed $defaultValue - */ + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ private function setIfExists(string $variableName, array $fields, $defaultValue): void { if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { diff --git a/lib/Base/FiltersFormula.php b/lib/Base/FiltersFormula.php index 542777ac..12df4b58 100644 --- a/lib/Base/FiltersFormula.php +++ b/lib/Base/FiltersFormula.php @@ -44,17 +44,17 @@ class FiltersFormula implements ModelInterface, ArrayAccess, \JsonSerializable public const DISCRIMINATOR = null; /** - * The original name of the model. - * - * @var string - */ + * The original name of the model. + * + * @var string + */ protected static $openAPIModelName = 'filters_formula'; /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ protected static $openAPITypes = [ 'column_key' => 'string', 'filter_predicate' => '\SeaTable\Client\Base\StringFilterPredicate', @@ -62,12 +62,12 @@ class FiltersFormula implements ModelInterface, ArrayAccess, \JsonSerializable ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - * @phpstan-var array - * @psalm-var array - */ + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ protected static $openAPIFormats = [ 'column_key' => null, 'filter_predicate' => null, @@ -75,10 +75,10 @@ class FiltersFormula implements ModelInterface, ArrayAccess, \JsonSerializable ]; /** - * Array of nullable properties. Used for (de)serialization - * - * @var boolean[] - */ + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ protected static array $openAPINullables = [ 'column_key' => false, 'filter_predicate' => false, @@ -86,10 +86,10 @@ class FiltersFormula implements ModelInterface, ArrayAccess, \JsonSerializable ]; /** - * If a nullable field gets set to null, insert it here - * - * @var boolean[] - */ + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ protected array $openAPINullablesSetToNull = []; /** @@ -261,14 +261,14 @@ public function __construct(?array $data = null) } /** - * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName - * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the - * $this->openAPINullablesSetToNull array - * - * @param string $variableName - * @param array $fields - * @param mixed $defaultValue - */ + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ private function setIfExists(string $variableName, array $fields, $defaultValue): void { if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { diff --git a/lib/Base/FiltersGeolocation.php b/lib/Base/FiltersGeolocation.php index 575c4045..63633f7e 100644 --- a/lib/Base/FiltersGeolocation.php +++ b/lib/Base/FiltersGeolocation.php @@ -44,17 +44,17 @@ class FiltersGeolocation implements ModelInterface, ArrayAccess, \JsonSerializab public const DISCRIMINATOR = null; /** - * The original name of the model. - * - * @var string - */ + * The original name of the model. + * + * @var string + */ protected static $openAPIModelName = 'filters_geolocation'; /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ protected static $openAPITypes = [ 'column_key' => 'string', 'filter_predicate' => '\SeaTable\Client\Base\EmailFilterPredicate', @@ -62,12 +62,12 @@ class FiltersGeolocation implements ModelInterface, ArrayAccess, \JsonSerializab ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - * @phpstan-var array - * @psalm-var array - */ + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ protected static $openAPIFormats = [ 'column_key' => null, 'filter_predicate' => null, @@ -75,10 +75,10 @@ class FiltersGeolocation implements ModelInterface, ArrayAccess, \JsonSerializab ]; /** - * Array of nullable properties. Used for (de)serialization - * - * @var boolean[] - */ + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ protected static array $openAPINullables = [ 'column_key' => false, 'filter_predicate' => false, @@ -86,10 +86,10 @@ class FiltersGeolocation implements ModelInterface, ArrayAccess, \JsonSerializab ]; /** - * If a nullable field gets set to null, insert it here - * - * @var boolean[] - */ + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ protected array $openAPINullablesSetToNull = []; /** @@ -261,14 +261,14 @@ public function __construct(?array $data = null) } /** - * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName - * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the - * $this->openAPINullablesSetToNull array - * - * @param string $variableName - * @param array $fields - * @param mixed $defaultValue - */ + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ private function setIfExists(string $variableName, array $fields, $defaultValue): void { if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { diff --git a/lib/Base/FiltersImage.php b/lib/Base/FiltersImage.php index 9f64d776..dd95463e 100644 --- a/lib/Base/FiltersImage.php +++ b/lib/Base/FiltersImage.php @@ -44,17 +44,17 @@ class FiltersImage implements ModelInterface, ArrayAccess, \JsonSerializable public const DISCRIMINATOR = null; /** - * The original name of the model. - * - * @var string - */ + * The original name of the model. + * + * @var string + */ protected static $openAPIModelName = 'filters_image'; /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ protected static $openAPITypes = [ 'column_key' => 'string', 'filter_predicate' => '\SeaTable\Client\Base\ImageFilterPredicate', @@ -62,12 +62,12 @@ class FiltersImage implements ModelInterface, ArrayAccess, \JsonSerializable ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - * @phpstan-var array - * @psalm-var array - */ + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ protected static $openAPIFormats = [ 'column_key' => null, 'filter_predicate' => null, @@ -75,10 +75,10 @@ class FiltersImage implements ModelInterface, ArrayAccess, \JsonSerializable ]; /** - * Array of nullable properties. Used for (de)serialization - * - * @var boolean[] - */ + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ protected static array $openAPINullables = [ 'column_key' => false, 'filter_predicate' => false, @@ -86,10 +86,10 @@ class FiltersImage implements ModelInterface, ArrayAccess, \JsonSerializable ]; /** - * If a nullable field gets set to null, insert it here - * - * @var boolean[] - */ + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ protected array $openAPINullablesSetToNull = []; /** @@ -261,14 +261,14 @@ public function __construct(?array $data = null) } /** - * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName - * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the - * $this->openAPINullablesSetToNull array - * - * @param string $variableName - * @param array $fields - * @param mixed $defaultValue - */ + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ private function setIfExists(string $variableName, array $fields, $defaultValue): void { if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { diff --git a/lib/Base/FiltersLink.php b/lib/Base/FiltersLink.php index 5f11c873..d05684f6 100644 --- a/lib/Base/FiltersLink.php +++ b/lib/Base/FiltersLink.php @@ -44,17 +44,17 @@ class FiltersLink implements ModelInterface, ArrayAccess, \JsonSerializable public const DISCRIMINATOR = null; /** - * The original name of the model. - * - * @var string - */ + * The original name of the model. + * + * @var string + */ protected static $openAPIModelName = 'filters_link'; /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ protected static $openAPITypes = [ 'column_key' => 'string', 'filter_predicate' => '\SeaTable\Client\Base\LinkFilterPredicate', @@ -62,12 +62,12 @@ class FiltersLink implements ModelInterface, ArrayAccess, \JsonSerializable ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - * @phpstan-var array - * @psalm-var array - */ + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ protected static $openAPIFormats = [ 'column_key' => null, 'filter_predicate' => null, @@ -75,10 +75,10 @@ class FiltersLink implements ModelInterface, ArrayAccess, \JsonSerializable ]; /** - * Array of nullable properties. Used for (de)serialization - * - * @var boolean[] - */ + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ protected static array $openAPINullables = [ 'column_key' => false, 'filter_predicate' => false, @@ -86,10 +86,10 @@ class FiltersLink implements ModelInterface, ArrayAccess, \JsonSerializable ]; /** - * If a nullable field gets set to null, insert it here - * - * @var boolean[] - */ + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ protected array $openAPINullablesSetToNull = []; /** @@ -261,14 +261,14 @@ public function __construct(?array $data = null) } /** - * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName - * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the - * $this->openAPINullablesSetToNull array - * - * @param string $variableName - * @param array $fields - * @param mixed $defaultValue - */ + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ private function setIfExists(string $variableName, array $fields, $defaultValue): void { if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { diff --git a/lib/Base/FiltersLinkFormula.php b/lib/Base/FiltersLinkFormula.php index bda88c14..ed091020 100644 --- a/lib/Base/FiltersLinkFormula.php +++ b/lib/Base/FiltersLinkFormula.php @@ -44,17 +44,17 @@ class FiltersLinkFormula implements ModelInterface, ArrayAccess, \JsonSerializab public const DISCRIMINATOR = null; /** - * The original name of the model. - * - * @var string - */ + * The original name of the model. + * + * @var string + */ protected static $openAPIModelName = 'filters_link_formula'; /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ protected static $openAPITypes = [ 'column_key' => 'string', 'filter_predicate' => '\SeaTable\Client\Base\LinkFilterPredicate', @@ -62,12 +62,12 @@ class FiltersLinkFormula implements ModelInterface, ArrayAccess, \JsonSerializab ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - * @phpstan-var array - * @psalm-var array - */ + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ protected static $openAPIFormats = [ 'column_key' => null, 'filter_predicate' => null, @@ -75,10 +75,10 @@ class FiltersLinkFormula implements ModelInterface, ArrayAccess, \JsonSerializab ]; /** - * Array of nullable properties. Used for (de)serialization - * - * @var boolean[] - */ + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ protected static array $openAPINullables = [ 'column_key' => false, 'filter_predicate' => false, @@ -86,10 +86,10 @@ class FiltersLinkFormula implements ModelInterface, ArrayAccess, \JsonSerializab ]; /** - * If a nullable field gets set to null, insert it here - * - * @var boolean[] - */ + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ protected array $openAPINullablesSetToNull = []; /** @@ -261,14 +261,14 @@ public function __construct(?array $data = null) } /** - * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName - * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the - * $this->openAPINullablesSetToNull array - * - * @param string $variableName - * @param array $fields - * @param mixed $defaultValue - */ + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ private function setIfExists(string $variableName, array $fields, $defaultValue): void { if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { diff --git a/lib/Base/FiltersLongText.php b/lib/Base/FiltersLongText.php index a210ef04..71306d1c 100644 --- a/lib/Base/FiltersLongText.php +++ b/lib/Base/FiltersLongText.php @@ -44,17 +44,17 @@ class FiltersLongText implements ModelInterface, ArrayAccess, \JsonSerializable public const DISCRIMINATOR = null; /** - * The original name of the model. - * - * @var string - */ + * The original name of the model. + * + * @var string + */ protected static $openAPIModelName = 'filters_long_text'; /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ protected static $openAPITypes = [ 'column_key' => 'string', 'filter_predicate' => '\SeaTable\Client\Base\ImageFilterPredicate', @@ -62,12 +62,12 @@ class FiltersLongText implements ModelInterface, ArrayAccess, \JsonSerializable ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - * @phpstan-var array - * @psalm-var array - */ + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ protected static $openAPIFormats = [ 'column_key' => null, 'filter_predicate' => null, @@ -75,10 +75,10 @@ class FiltersLongText implements ModelInterface, ArrayAccess, \JsonSerializable ]; /** - * Array of nullable properties. Used for (de)serialization - * - * @var boolean[] - */ + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ protected static array $openAPINullables = [ 'column_key' => false, 'filter_predicate' => false, @@ -86,10 +86,10 @@ class FiltersLongText implements ModelInterface, ArrayAccess, \JsonSerializable ]; /** - * If a nullable field gets set to null, insert it here - * - * @var boolean[] - */ + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ protected array $openAPINullablesSetToNull = []; /** @@ -261,14 +261,14 @@ public function __construct(?array $data = null) } /** - * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName - * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the - * $this->openAPINullablesSetToNull array - * - * @param string $variableName - * @param array $fields - * @param mixed $defaultValue - */ + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ private function setIfExists(string $variableName, array $fields, $defaultValue): void { if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { diff --git a/lib/Base/FiltersModified.php b/lib/Base/FiltersModified.php index 12cd090f..5af01ae0 100644 --- a/lib/Base/FiltersModified.php +++ b/lib/Base/FiltersModified.php @@ -44,17 +44,17 @@ class FiltersModified implements ModelInterface, ArrayAccess, \JsonSerializable public const DISCRIMINATOR = null; /** - * The original name of the model. - * - * @var string - */ + * The original name of the model. + * + * @var string + */ protected static $openAPIModelName = 'filters_modified'; /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ protected static $openAPITypes = [ 'column_key' => 'string', 'filter_predicate' => '\SeaTable\Client\Base\DateFilterPredicate', @@ -63,12 +63,12 @@ class FiltersModified implements ModelInterface, ArrayAccess, \JsonSerializable ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - * @phpstan-var array - * @psalm-var array - */ + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ protected static $openAPIFormats = [ 'column_key' => null, 'filter_predicate' => null, @@ -77,10 +77,10 @@ class FiltersModified implements ModelInterface, ArrayAccess, \JsonSerializable ]; /** - * Array of nullable properties. Used for (de)serialization - * - * @var boolean[] - */ + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ protected static array $openAPINullables = [ 'column_key' => false, 'filter_predicate' => false, @@ -89,10 +89,10 @@ class FiltersModified implements ModelInterface, ArrayAccess, \JsonSerializable ]; /** - * If a nullable field gets set to null, insert it here - * - * @var boolean[] - */ + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ protected array $openAPINullablesSetToNull = []; /** @@ -268,14 +268,14 @@ public function __construct(?array $data = null) } /** - * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName - * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the - * $this->openAPINullablesSetToNull array - * - * @param string $variableName - * @param array $fields - * @param mixed $defaultValue - */ + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ private function setIfExists(string $variableName, array $fields, $defaultValue): void { if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { diff --git a/lib/Base/FiltersMultiSelect.php b/lib/Base/FiltersMultiSelect.php index a3e79d32..13d1d34d 100644 --- a/lib/Base/FiltersMultiSelect.php +++ b/lib/Base/FiltersMultiSelect.php @@ -44,17 +44,17 @@ class FiltersMultiSelect implements ModelInterface, ArrayAccess, \JsonSerializab public const DISCRIMINATOR = null; /** - * The original name of the model. - * - * @var string - */ + * The original name of the model. + * + * @var string + */ protected static $openAPIModelName = 'filters_multi_select'; /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ protected static $openAPITypes = [ 'column_key' => 'string', 'filter_predicate' => '\SeaTable\Client\Base\MultipleSelectFilterPredicate', @@ -62,12 +62,12 @@ class FiltersMultiSelect implements ModelInterface, ArrayAccess, \JsonSerializab ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - * @phpstan-var array - * @psalm-var array - */ + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ protected static $openAPIFormats = [ 'column_key' => null, 'filter_predicate' => null, @@ -75,10 +75,10 @@ class FiltersMultiSelect implements ModelInterface, ArrayAccess, \JsonSerializab ]; /** - * Array of nullable properties. Used for (de)serialization - * - * @var boolean[] - */ + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ protected static array $openAPINullables = [ 'column_key' => false, 'filter_predicate' => false, @@ -86,10 +86,10 @@ class FiltersMultiSelect implements ModelInterface, ArrayAccess, \JsonSerializab ]; /** - * If a nullable field gets set to null, insert it here - * - * @var boolean[] - */ + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ protected array $openAPINullablesSetToNull = []; /** @@ -261,14 +261,14 @@ public function __construct(?array $data = null) } /** - * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName - * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the - * $this->openAPINullablesSetToNull array - * - * @param string $variableName - * @param array $fields - * @param mixed $defaultValue - */ + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ private function setIfExists(string $variableName, array $fields, $defaultValue): void { if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { diff --git a/lib/Base/FiltersNumber.php b/lib/Base/FiltersNumber.php index 85b178eb..d905085c 100644 --- a/lib/Base/FiltersNumber.php +++ b/lib/Base/FiltersNumber.php @@ -44,17 +44,17 @@ class FiltersNumber implements ModelInterface, ArrayAccess, \JsonSerializable public const DISCRIMINATOR = null; /** - * The original name of the model. - * - * @var string - */ + * The original name of the model. + * + * @var string + */ protected static $openAPIModelName = 'filters_number'; /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ protected static $openAPITypes = [ 'column_key' => 'string', 'filter_predicate' => '\SeaTable\Client\Base\NumberFilterPredicate', @@ -62,12 +62,12 @@ class FiltersNumber implements ModelInterface, ArrayAccess, \JsonSerializable ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - * @phpstan-var array - * @psalm-var array - */ + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ protected static $openAPIFormats = [ 'column_key' => null, 'filter_predicate' => null, @@ -75,10 +75,10 @@ class FiltersNumber implements ModelInterface, ArrayAccess, \JsonSerializable ]; /** - * Array of nullable properties. Used for (de)serialization - * - * @var boolean[] - */ + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ protected static array $openAPINullables = [ 'column_key' => false, 'filter_predicate' => false, @@ -86,10 +86,10 @@ class FiltersNumber implements ModelInterface, ArrayAccess, \JsonSerializable ]; /** - * If a nullable field gets set to null, insert it here - * - * @var boolean[] - */ + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ protected array $openAPINullablesSetToNull = []; /** @@ -261,14 +261,14 @@ public function __construct(?array $data = null) } /** - * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName - * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the - * $this->openAPINullablesSetToNull array - * - * @param string $variableName - * @param array $fields - * @param mixed $defaultValue - */ + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ private function setIfExists(string $variableName, array $fields, $defaultValue): void { if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { diff --git a/lib/Base/FiltersPercentage.php b/lib/Base/FiltersPercentage.php index 8962e415..133f0f19 100644 --- a/lib/Base/FiltersPercentage.php +++ b/lib/Base/FiltersPercentage.php @@ -44,17 +44,17 @@ class FiltersPercentage implements ModelInterface, ArrayAccess, \JsonSerializabl public const DISCRIMINATOR = null; /** - * The original name of the model. - * - * @var string - */ + * The original name of the model. + * + * @var string + */ protected static $openAPIModelName = 'filters_percentage'; /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ protected static $openAPITypes = [ 'column_key' => 'string', 'filter_predicate' => '\SeaTable\Client\Base\NumberFilterPredicate', @@ -62,12 +62,12 @@ class FiltersPercentage implements ModelInterface, ArrayAccess, \JsonSerializabl ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - * @phpstan-var array - * @psalm-var array - */ + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ protected static $openAPIFormats = [ 'column_key' => null, 'filter_predicate' => null, @@ -75,10 +75,10 @@ class FiltersPercentage implements ModelInterface, ArrayAccess, \JsonSerializabl ]; /** - * Array of nullable properties. Used for (de)serialization - * - * @var boolean[] - */ + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ protected static array $openAPINullables = [ 'column_key' => false, 'filter_predicate' => false, @@ -86,10 +86,10 @@ class FiltersPercentage implements ModelInterface, ArrayAccess, \JsonSerializabl ]; /** - * If a nullable field gets set to null, insert it here - * - * @var boolean[] - */ + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ protected array $openAPINullablesSetToNull = []; /** @@ -261,14 +261,14 @@ public function __construct(?array $data = null) } /** - * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName - * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the - * $this->openAPINullablesSetToNull array - * - * @param string $variableName - * @param array $fields - * @param mixed $defaultValue - */ + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ private function setIfExists(string $variableName, array $fields, $defaultValue): void { if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { diff --git a/lib/Base/FiltersRating.php b/lib/Base/FiltersRating.php index 8d0caf29..726b46dd 100644 --- a/lib/Base/FiltersRating.php +++ b/lib/Base/FiltersRating.php @@ -44,17 +44,17 @@ class FiltersRating implements ModelInterface, ArrayAccess, \JsonSerializable public const DISCRIMINATOR = null; /** - * The original name of the model. - * - * @var string - */ + * The original name of the model. + * + * @var string + */ protected static $openAPIModelName = 'filters_rating'; /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ protected static $openAPITypes = [ 'column_key' => 'string', 'filter_predicate' => '\SeaTable\Client\Base\NumberFilterPredicate', @@ -62,12 +62,12 @@ class FiltersRating implements ModelInterface, ArrayAccess, \JsonSerializable ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - * @phpstan-var array - * @psalm-var array - */ + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ protected static $openAPIFormats = [ 'column_key' => null, 'filter_predicate' => null, @@ -75,10 +75,10 @@ class FiltersRating implements ModelInterface, ArrayAccess, \JsonSerializable ]; /** - * Array of nullable properties. Used for (de)serialization - * - * @var boolean[] - */ + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ protected static array $openAPINullables = [ 'column_key' => false, 'filter_predicate' => false, @@ -86,10 +86,10 @@ class FiltersRating implements ModelInterface, ArrayAccess, \JsonSerializable ]; /** - * If a nullable field gets set to null, insert it here - * - * @var boolean[] - */ + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ protected array $openAPINullablesSetToNull = []; /** @@ -261,14 +261,14 @@ public function __construct(?array $data = null) } /** - * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName - * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the - * $this->openAPINullablesSetToNull array - * - * @param string $variableName - * @param array $fields - * @param mixed $defaultValue - */ + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ private function setIfExists(string $variableName, array $fields, $defaultValue): void { if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { diff --git a/lib/Base/FiltersSingleSelect.php b/lib/Base/FiltersSingleSelect.php index f941d8e5..a0b6a125 100644 --- a/lib/Base/FiltersSingleSelect.php +++ b/lib/Base/FiltersSingleSelect.php @@ -44,17 +44,17 @@ class FiltersSingleSelect implements ModelInterface, ArrayAccess, \JsonSerializa public const DISCRIMINATOR = null; /** - * The original name of the model. - * - * @var string - */ + * The original name of the model. + * + * @var string + */ protected static $openAPIModelName = 'filters_single_select'; /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ protected static $openAPITypes = [ 'column_key' => 'string', 'filter_predicate' => '\SeaTable\Client\Base\SingleSelectFilterPredicate', @@ -62,12 +62,12 @@ class FiltersSingleSelect implements ModelInterface, ArrayAccess, \JsonSerializa ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - * @phpstan-var array - * @psalm-var array - */ + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ protected static $openAPIFormats = [ 'column_key' => null, 'filter_predicate' => null, @@ -75,10 +75,10 @@ class FiltersSingleSelect implements ModelInterface, ArrayAccess, \JsonSerializa ]; /** - * Array of nullable properties. Used for (de)serialization - * - * @var boolean[] - */ + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ protected static array $openAPINullables = [ 'column_key' => false, 'filter_predicate' => false, @@ -86,10 +86,10 @@ class FiltersSingleSelect implements ModelInterface, ArrayAccess, \JsonSerializa ]; /** - * If a nullable field gets set to null, insert it here - * - * @var boolean[] - */ + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ protected array $openAPINullablesSetToNull = []; /** @@ -261,14 +261,14 @@ public function __construct(?array $data = null) } /** - * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName - * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the - * $this->openAPINullablesSetToNull array - * - * @param string $variableName - * @param array $fields - * @param mixed $defaultValue - */ + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ private function setIfExists(string $variableName, array $fields, $defaultValue): void { if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { diff --git a/lib/Base/FiltersText.php b/lib/Base/FiltersText.php index 963d0403..de4f22da 100644 --- a/lib/Base/FiltersText.php +++ b/lib/Base/FiltersText.php @@ -44,17 +44,17 @@ class FiltersText implements ModelInterface, ArrayAccess, \JsonSerializable public const DISCRIMINATOR = null; /** - * The original name of the model. - * - * @var string - */ + * The original name of the model. + * + * @var string + */ protected static $openAPIModelName = 'filters_text'; /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ protected static $openAPITypes = [ 'column_key' => 'string', 'filter_predicate' => '\SeaTable\Client\Base\StringFilterPredicate', @@ -62,12 +62,12 @@ class FiltersText implements ModelInterface, ArrayAccess, \JsonSerializable ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - * @phpstan-var array - * @psalm-var array - */ + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ protected static $openAPIFormats = [ 'column_key' => null, 'filter_predicate' => null, @@ -75,10 +75,10 @@ class FiltersText implements ModelInterface, ArrayAccess, \JsonSerializable ]; /** - * Array of nullable properties. Used for (de)serialization - * - * @var boolean[] - */ + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ protected static array $openAPINullables = [ 'column_key' => false, 'filter_predicate' => false, @@ -86,10 +86,10 @@ class FiltersText implements ModelInterface, ArrayAccess, \JsonSerializable ]; /** - * If a nullable field gets set to null, insert it here - * - * @var boolean[] - */ + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ protected array $openAPINullablesSetToNull = []; /** @@ -261,14 +261,14 @@ public function __construct(?array $data = null) } /** - * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName - * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the - * $this->openAPINullablesSetToNull array - * - * @param string $variableName - * @param array $fields - * @param mixed $defaultValue - */ + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ private function setIfExists(string $variableName, array $fields, $defaultValue): void { if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { diff --git a/lib/Base/FiltersUrl.php b/lib/Base/FiltersUrl.php index 46e10c4c..8a04d08d 100644 --- a/lib/Base/FiltersUrl.php +++ b/lib/Base/FiltersUrl.php @@ -44,17 +44,17 @@ class FiltersUrl implements ModelInterface, ArrayAccess, \JsonSerializable public const DISCRIMINATOR = null; /** - * The original name of the model. - * - * @var string - */ + * The original name of the model. + * + * @var string + */ protected static $openAPIModelName = 'filters_url'; /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ protected static $openAPITypes = [ 'column_key' => 'string', 'filter_predicate' => '\SeaTable\Client\Base\EmailFilterPredicate', @@ -62,12 +62,12 @@ class FiltersUrl implements ModelInterface, ArrayAccess, \JsonSerializable ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - * @phpstan-var array - * @psalm-var array - */ + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ protected static $openAPIFormats = [ 'column_key' => null, 'filter_predicate' => null, @@ -75,10 +75,10 @@ class FiltersUrl implements ModelInterface, ArrayAccess, \JsonSerializable ]; /** - * Array of nullable properties. Used for (de)serialization - * - * @var boolean[] - */ + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ protected static array $openAPINullables = [ 'column_key' => false, 'filter_predicate' => false, @@ -86,10 +86,10 @@ class FiltersUrl implements ModelInterface, ArrayAccess, \JsonSerializable ]; /** - * If a nullable field gets set to null, insert it here - * - * @var boolean[] - */ + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ protected array $openAPINullablesSetToNull = []; /** @@ -261,14 +261,14 @@ public function __construct(?array $data = null) } /** - * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName - * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the - * $this->openAPINullablesSetToNull array - * - * @param string $variableName - * @param array $fields - * @param mixed $defaultValue - */ + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ private function setIfExists(string $variableName, array $fields, $defaultValue): void { if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { diff --git a/lib/Base/FormulaColumn.php b/lib/Base/FormulaColumn.php index b321b6ff..1950bb89 100644 --- a/lib/Base/FormulaColumn.php +++ b/lib/Base/FormulaColumn.php @@ -45,17 +45,17 @@ class FormulaColumn implements ModelInterface, ArrayAccess, \JsonSerializable public const DISCRIMINATOR = null; /** - * The original name of the model. - * - * @var string - */ + * The original name of the model. + * + * @var string + */ protected static $openAPIModelName = 'formula_column'; /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ protected static $openAPITypes = [ 'column_name' => 'string', 'column_type' => 'string', @@ -64,12 +64,12 @@ class FormulaColumn implements ModelInterface, ArrayAccess, \JsonSerializable ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - * @phpstan-var array - * @psalm-var array - */ + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ protected static $openAPIFormats = [ 'column_name' => null, 'column_type' => null, @@ -78,10 +78,10 @@ class FormulaColumn implements ModelInterface, ArrayAccess, \JsonSerializable ]; /** - * Array of nullable properties. Used for (de)serialization - * - * @var boolean[] - */ + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ protected static array $openAPINullables = [ 'column_name' => false, 'column_type' => false, @@ -90,10 +90,10 @@ class FormulaColumn implements ModelInterface, ArrayAccess, \JsonSerializable ]; /** - * If a nullable field gets set to null, insert it here - * - * @var boolean[] - */ + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ protected array $openAPINullablesSetToNull = []; /** @@ -282,14 +282,14 @@ public function __construct(?array $data = null) } /** - * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName - * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the - * $this->openAPINullablesSetToNull array - * - * @param string $variableName - * @param array $fields - * @param mixed $defaultValue - */ + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ private function setIfExists(string $variableName, array $fields, $defaultValue): void { if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { diff --git a/lib/Base/FormulaColumnFormat.php b/lib/Base/FormulaColumnFormat.php index e9a8417c..fac83526 100644 --- a/lib/Base/FormulaColumnFormat.php +++ b/lib/Base/FormulaColumnFormat.php @@ -45,46 +45,46 @@ class FormulaColumnFormat implements ModelInterface, ArrayAccess, \JsonSerializa public const DISCRIMINATOR = null; /** - * The original name of the model. - * - * @var string - */ + * The original name of the model. + * + * @var string + */ protected static $openAPIModelName = 'formula_column_format'; /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ protected static $openAPITypes = [ 'formula' => 'string' ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - * @phpstan-var array - * @psalm-var array - */ + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ protected static $openAPIFormats = [ 'formula' => null ]; /** - * Array of nullable properties. Used for (de)serialization - * - * @var boolean[] - */ + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ protected static array $openAPINullables = [ 'formula' => false ]; /** - * If a nullable field gets set to null, insert it here - * - * @var boolean[] - */ + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ protected array $openAPINullablesSetToNull = []; /** @@ -248,14 +248,14 @@ public function __construct(?array $data = null) } /** - * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName - * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the - * $this->openAPINullablesSetToNull array - * - * @param string $variableName - * @param array $fields - * @param mixed $defaultValue - */ + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ private function setIfExists(string $variableName, array $fields, $defaultValue): void { if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { diff --git a/lib/Base/FormulaColumnWithTableName.php b/lib/Base/FormulaColumnWithTableName.php index 5308585c..669678d4 100644 --- a/lib/Base/FormulaColumnWithTableName.php +++ b/lib/Base/FormulaColumnWithTableName.php @@ -44,17 +44,17 @@ class FormulaColumnWithTableName implements ModelInterface, ArrayAccess, \JsonSe public const DISCRIMINATOR = null; /** - * The original name of the model. - * - * @var string - */ + * The original name of the model. + * + * @var string + */ protected static $openAPIModelName = 'formula_column_with_table_name'; /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ protected static $openAPITypes = [ 'table_name' => 'string', 'column_name' => 'string', @@ -64,12 +64,12 @@ class FormulaColumnWithTableName implements ModelInterface, ArrayAccess, \JsonSe ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - * @phpstan-var array - * @psalm-var array - */ + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ protected static $openAPIFormats = [ 'table_name' => null, 'column_name' => null, @@ -79,10 +79,10 @@ class FormulaColumnWithTableName implements ModelInterface, ArrayAccess, \JsonSe ]; /** - * Array of nullable properties. Used for (de)serialization - * - * @var boolean[] - */ + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ protected static array $openAPINullables = [ 'table_name' => false, 'column_name' => false, @@ -92,10 +92,10 @@ class FormulaColumnWithTableName implements ModelInterface, ArrayAccess, \JsonSe ]; /** - * If a nullable field gets set to null, insert it here - * - * @var boolean[] - */ + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ protected array $openAPINullablesSetToNull = []; /** @@ -288,14 +288,14 @@ public function __construct(?array $data = null) } /** - * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName - * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the - * $this->openAPINullablesSetToNull array - * - * @param string $variableName - * @param array $fields - * @param mixed $defaultValue - */ + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ private function setIfExists(string $variableName, array $fields, $defaultValue): void { if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { diff --git a/lib/Base/FreezeUnfreezeColumn.php b/lib/Base/FreezeUnfreezeColumn.php index aabac84e..a3f5947e 100644 --- a/lib/Base/FreezeUnfreezeColumn.php +++ b/lib/Base/FreezeUnfreezeColumn.php @@ -44,17 +44,17 @@ class FreezeUnfreezeColumn implements ModelInterface, ArrayAccess, \JsonSerializ public const DISCRIMINATOR = null; /** - * The original name of the model. - * - * @var string - */ + * The original name of the model. + * + * @var string + */ protected static $openAPIModelName = 'freeze_unfreeze_column'; /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ protected static $openAPITypes = [ 'op_type' => 'string', 'table_name' => 'string', @@ -63,12 +63,12 @@ class FreezeUnfreezeColumn implements ModelInterface, ArrayAccess, \JsonSerializ ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - * @phpstan-var array - * @psalm-var array - */ + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ protected static $openAPIFormats = [ 'op_type' => null, 'table_name' => null, @@ -77,10 +77,10 @@ class FreezeUnfreezeColumn implements ModelInterface, ArrayAccess, \JsonSerializ ]; /** - * Array of nullable properties. Used for (de)serialization - * - * @var boolean[] - */ + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ protected static array $openAPINullables = [ 'op_type' => false, 'table_name' => false, @@ -89,10 +89,10 @@ class FreezeUnfreezeColumn implements ModelInterface, ArrayAccess, \JsonSerializ ]; /** - * If a nullable field gets set to null, insert it here - * - * @var boolean[] - */ + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ protected array $openAPINullablesSetToNull = []; /** @@ -281,14 +281,14 @@ public function __construct(?array $data = null) } /** - * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName - * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the - * $this->openAPINullablesSetToNull array - * - * @param string $variableName - * @param array $fields - * @param mixed $defaultValue - */ + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ private function setIfExists(string $variableName, array $fields, $defaultValue): void { if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { diff --git a/lib/Base/GenerateSnapshot.php b/lib/Base/GenerateSnapshot.php index 259b2778..1fbc9718 100644 --- a/lib/Base/GenerateSnapshot.php +++ b/lib/Base/GenerateSnapshot.php @@ -44,46 +44,46 @@ class GenerateSnapshot implements ModelInterface, ArrayAccess, \JsonSerializable public const DISCRIMINATOR = null; /** - * The original name of the model. - * - * @var string - */ + * The original name of the model. + * + * @var string + */ protected static $openAPIModelName = 'generate_snapshot'; /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ protected static $openAPITypes = [ 'dtable_name' => 'string' ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - * @phpstan-var array - * @psalm-var array - */ + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ protected static $openAPIFormats = [ 'dtable_name' => null ]; /** - * Array of nullable properties. Used for (de)serialization - * - * @var boolean[] - */ + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ protected static array $openAPINullables = [ 'dtable_name' => false ]; /** - * If a nullable field gets set to null, insert it here - * - * @var boolean[] - */ + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ protected array $openAPINullablesSetToNull = []; /** @@ -247,14 +247,14 @@ public function __construct(?array $data = null) } /** - * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName - * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the - * $this->openAPINullablesSetToNull array - * - * @param string $variableName - * @param array $fields - * @param mixed $defaultValue - */ + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ private function setIfExists(string $variableName, array $fields, $defaultValue): void { if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { diff --git a/lib/Base/GeoColumnFormat.php b/lib/Base/GeoColumnFormat.php index 52a601a8..b413f6fb 100644 --- a/lib/Base/GeoColumnFormat.php +++ b/lib/Base/GeoColumnFormat.php @@ -45,46 +45,46 @@ class GeoColumnFormat implements ModelInterface, ArrayAccess, \JsonSerializable public const DISCRIMINATOR = null; /** - * The original name of the model. - * - * @var string - */ + * The original name of the model. + * + * @var string + */ protected static $openAPIModelName = 'geo_column_format'; /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ protected static $openAPITypes = [ 'geo_format' => 'string' ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - * @phpstan-var array - * @psalm-var array - */ + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ protected static $openAPIFormats = [ 'geo_format' => null ]; /** - * Array of nullable properties. Used for (de)serialization - * - * @var boolean[] - */ + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ protected static array $openAPINullables = [ 'geo_format' => false ]; /** - * If a nullable field gets set to null, insert it here - * - * @var boolean[] - */ + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ protected array $openAPINullablesSetToNull = []; /** @@ -263,14 +263,14 @@ public function __construct(?array $data = null) } /** - * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName - * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the - * $this->openAPINullablesSetToNull array - * - * @param string $variableName - * @param array $fields - * @param mixed $defaultValue - */ + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ private function setIfExists(string $variableName, array $fields, $defaultValue): void { if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { diff --git a/lib/Base/GeolocationColumn.php b/lib/Base/GeolocationColumn.php index 40666849..226aab27 100644 --- a/lib/Base/GeolocationColumn.php +++ b/lib/Base/GeolocationColumn.php @@ -45,17 +45,17 @@ class GeolocationColumn implements ModelInterface, ArrayAccess, \JsonSerializabl public const DISCRIMINATOR = null; /** - * The original name of the model. - * - * @var string - */ + * The original name of the model. + * + * @var string + */ protected static $openAPIModelName = 'geolocation_column'; /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ protected static $openAPITypes = [ 'column_name' => 'string', 'column_type' => 'string', @@ -64,12 +64,12 @@ class GeolocationColumn implements ModelInterface, ArrayAccess, \JsonSerializabl ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - * @phpstan-var array - * @psalm-var array - */ + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ protected static $openAPIFormats = [ 'column_name' => null, 'column_type' => null, @@ -78,10 +78,10 @@ class GeolocationColumn implements ModelInterface, ArrayAccess, \JsonSerializabl ]; /** - * Array of nullable properties. Used for (de)serialization - * - * @var boolean[] - */ + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ protected static array $openAPINullables = [ 'column_name' => false, 'column_type' => false, @@ -90,10 +90,10 @@ class GeolocationColumn implements ModelInterface, ArrayAccess, \JsonSerializabl ]; /** - * If a nullable field gets set to null, insert it here - * - * @var boolean[] - */ + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ protected array $openAPINullablesSetToNull = []; /** @@ -282,14 +282,14 @@ public function __construct(?array $data = null) } /** - * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName - * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the - * $this->openAPINullablesSetToNull array - * - * @param string $variableName - * @param array $fields - * @param mixed $defaultValue - */ + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ private function setIfExists(string $variableName, array $fields, $defaultValue): void { if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { diff --git a/lib/Base/GeolocationColumnWithTableName.php b/lib/Base/GeolocationColumnWithTableName.php index 777cd8f6..2a81bbca 100644 --- a/lib/Base/GeolocationColumnWithTableName.php +++ b/lib/Base/GeolocationColumnWithTableName.php @@ -44,17 +44,17 @@ class GeolocationColumnWithTableName implements ModelInterface, ArrayAccess, \Js public const DISCRIMINATOR = null; /** - * The original name of the model. - * - * @var string - */ + * The original name of the model. + * + * @var string + */ protected static $openAPIModelName = 'geolocation_column_with_table_name'; /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ protected static $openAPITypes = [ 'table_name' => 'string', 'column_name' => 'string', @@ -64,12 +64,12 @@ class GeolocationColumnWithTableName implements ModelInterface, ArrayAccess, \Js ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - * @phpstan-var array - * @psalm-var array - */ + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ protected static $openAPIFormats = [ 'table_name' => null, 'column_name' => null, @@ -79,10 +79,10 @@ class GeolocationColumnWithTableName implements ModelInterface, ArrayAccess, \Js ]; /** - * Array of nullable properties. Used for (de)serialization - * - * @var boolean[] - */ + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ protected static array $openAPINullables = [ 'table_name' => false, 'column_name' => false, @@ -92,10 +92,10 @@ class GeolocationColumnWithTableName implements ModelInterface, ArrayAccess, \Js ]; /** - * If a nullable field gets set to null, insert it here - * - * @var boolean[] - */ + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ protected array $openAPINullablesSetToNull = []; /** @@ -288,14 +288,14 @@ public function __construct(?array $data = null) } /** - * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName - * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the - * $this->openAPINullablesSetToNull array - * - * @param string $variableName - * @param array $fields - * @param mixed $defaultValue - */ + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ private function setIfExists(string $variableName, array $fields, $defaultValue): void { if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { diff --git a/lib/Base/GetComment200Response.php b/lib/Base/GetComment200Response.php index eb452b60..a73b32b1 100644 --- a/lib/Base/GetComment200Response.php +++ b/lib/Base/GetComment200Response.php @@ -44,17 +44,17 @@ class GetComment200Response implements ModelInterface, ArrayAccess, \JsonSeriali public const DISCRIMINATOR = null; /** - * The original name of the model. - * - * @var string - */ + * The original name of the model. + * + * @var string + */ protected static $openAPIModelName = 'getComment_200_response'; /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ protected static $openAPITypes = [ 'id' => 'int', 'author' => 'string', @@ -67,12 +67,12 @@ class GetComment200Response implements ModelInterface, ArrayAccess, \JsonSeriali ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - * @phpstan-var array - * @psalm-var array - */ + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ protected static $openAPIFormats = [ 'id' => null, 'author' => null, @@ -85,10 +85,10 @@ class GetComment200Response implements ModelInterface, ArrayAccess, \JsonSeriali ]; /** - * Array of nullable properties. Used for (de)serialization - * - * @var boolean[] - */ + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ protected static array $openAPINullables = [ 'id' => false, 'author' => false, @@ -101,10 +101,10 @@ class GetComment200Response implements ModelInterface, ArrayAccess, \JsonSeriali ]; /** - * If a nullable field gets set to null, insert it here - * - * @var boolean[] - */ + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ protected array $openAPINullablesSetToNull = []; /** @@ -296,14 +296,14 @@ public function __construct(?array $data = null) } /** - * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName - * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the - * $this->openAPINullablesSetToNull array - * - * @param string $variableName - * @param array $fields - * @param mixed $defaultValue - */ + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ private function setIfExists(string $variableName, array $fields, $defaultValue): void { if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { diff --git a/lib/Base/GetRow200Response.php b/lib/Base/GetRow200Response.php index 64368ac7..5e9d15f4 100644 --- a/lib/Base/GetRow200Response.php +++ b/lib/Base/GetRow200Response.php @@ -44,17 +44,17 @@ class GetRow200Response implements ModelInterface, ArrayAccess, \JsonSerializabl public const DISCRIMINATOR = null; /** - * The original name of the model. - * - * @var string - */ + * The original name of the model. + * + * @var string + */ protected static $openAPIModelName = 'getRow_200_response'; /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ protected static $openAPITypes = [ '_id' => 'string', '_mtime' => 'string', @@ -65,12 +65,12 @@ class GetRow200Response implements ModelInterface, ArrayAccess, \JsonSerializabl ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - * @phpstan-var array - * @psalm-var array - */ + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ protected static $openAPIFormats = [ '_id' => null, '_mtime' => null, @@ -81,10 +81,10 @@ class GetRow200Response implements ModelInterface, ArrayAccess, \JsonSerializabl ]; /** - * Array of nullable properties. Used for (de)serialization - * - * @var boolean[] - */ + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ protected static array $openAPINullables = [ '_id' => false, '_mtime' => false, @@ -95,10 +95,10 @@ class GetRow200Response implements ModelInterface, ArrayAccess, \JsonSerializabl ]; /** - * If a nullable field gets set to null, insert it here - * - * @var boolean[] - */ + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ protected array $openAPINullablesSetToNull = []; /** @@ -282,14 +282,14 @@ public function __construct(?array $data = null) } /** - * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName - * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the - * $this->openAPINullablesSetToNull array - * - * @param string $variableName - * @param array $fields - * @param mixed $defaultValue - */ + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ private function setIfExists(string $variableName, array $fields, $defaultValue): void { if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { diff --git a/lib/Base/ImageColumn.php b/lib/Base/ImageColumn.php index 5f4ec67f..ba2b4722 100644 --- a/lib/Base/ImageColumn.php +++ b/lib/Base/ImageColumn.php @@ -45,17 +45,17 @@ class ImageColumn implements ModelInterface, ArrayAccess, \JsonSerializable public const DISCRIMINATOR = null; /** - * The original name of the model. - * - * @var string - */ + * The original name of the model. + * + * @var string + */ protected static $openAPIModelName = 'image_column'; /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ protected static $openAPITypes = [ 'column_name' => 'string', 'column_type' => 'string', @@ -63,12 +63,12 @@ class ImageColumn implements ModelInterface, ArrayAccess, \JsonSerializable ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - * @phpstan-var array - * @psalm-var array - */ + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ protected static $openAPIFormats = [ 'column_name' => null, 'column_type' => null, @@ -76,10 +76,10 @@ class ImageColumn implements ModelInterface, ArrayAccess, \JsonSerializable ]; /** - * Array of nullable properties. Used for (de)serialization - * - * @var boolean[] - */ + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ protected static array $openAPINullables = [ 'column_name' => false, 'column_type' => false, @@ -87,10 +87,10 @@ class ImageColumn implements ModelInterface, ArrayAccess, \JsonSerializable ]; /** - * If a nullable field gets set to null, insert it here - * - * @var boolean[] - */ + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ protected array $openAPINullablesSetToNull = []; /** @@ -275,14 +275,14 @@ public function __construct(?array $data = null) } /** - * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName - * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the - * $this->openAPINullablesSetToNull array - * - * @param string $variableName - * @param array $fields - * @param mixed $defaultValue - */ + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ private function setIfExists(string $variableName, array $fields, $defaultValue): void { if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { diff --git a/lib/Base/ImageColumnWithTableName.php b/lib/Base/ImageColumnWithTableName.php index 7120cecd..e8b885aa 100644 --- a/lib/Base/ImageColumnWithTableName.php +++ b/lib/Base/ImageColumnWithTableName.php @@ -44,17 +44,17 @@ class ImageColumnWithTableName implements ModelInterface, ArrayAccess, \JsonSeri public const DISCRIMINATOR = null; /** - * The original name of the model. - * - * @var string - */ + * The original name of the model. + * + * @var string + */ protected static $openAPIModelName = 'image_column_with_table_name'; /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ protected static $openAPITypes = [ 'table_name' => 'string', 'column_name' => 'string', @@ -63,12 +63,12 @@ class ImageColumnWithTableName implements ModelInterface, ArrayAccess, \JsonSeri ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - * @phpstan-var array - * @psalm-var array - */ + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ protected static $openAPIFormats = [ 'table_name' => null, 'column_name' => null, @@ -77,10 +77,10 @@ class ImageColumnWithTableName implements ModelInterface, ArrayAccess, \JsonSeri ]; /** - * Array of nullable properties. Used for (de)serialization - * - * @var boolean[] - */ + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ protected static array $openAPINullables = [ 'table_name' => false, 'column_name' => false, @@ -89,10 +89,10 @@ class ImageColumnWithTableName implements ModelInterface, ArrayAccess, \JsonSeri ]; /** - * If a nullable field gets set to null, insert it here - * - * @var boolean[] - */ + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ protected array $openAPINullablesSetToNull = []; /** @@ -281,14 +281,14 @@ public function __construct(?array $data = null) } /** - * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName - * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the - * $this->openAPINullablesSetToNull array - * - * @param string $variableName - * @param array $fields - * @param mixed $defaultValue - */ + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ private function setIfExists(string $variableName, array $fields, $defaultValue): void { if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { diff --git a/lib/Base/InsertColumnRequest.php b/lib/Base/InsertColumnRequest.php index db2bddf0..fa6d7384 100644 --- a/lib/Base/InsertColumnRequest.php +++ b/lib/Base/InsertColumnRequest.php @@ -44,17 +44,17 @@ class InsertColumnRequest implements ModelInterface, ArrayAccess, \JsonSerializa public const DISCRIMINATOR = null; /** - * The original name of the model. - * - * @var string - */ + * The original name of the model. + * + * @var string + */ protected static $openAPIModelName = 'insertColumn_request'; /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ protected static $openAPITypes = [ 'table_name' => 'string', 'column_name' => 'string', @@ -64,12 +64,12 @@ class InsertColumnRequest implements ModelInterface, ArrayAccess, \JsonSerializa ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - * @phpstan-var array - * @psalm-var array - */ + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ protected static $openAPIFormats = [ 'table_name' => null, 'column_name' => null, @@ -79,10 +79,10 @@ class InsertColumnRequest implements ModelInterface, ArrayAccess, \JsonSerializa ]; /** - * Array of nullable properties. Used for (de)serialization - * - * @var boolean[] - */ + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ protected static array $openAPINullables = [ 'table_name' => false, 'column_name' => false, @@ -92,10 +92,10 @@ class InsertColumnRequest implements ModelInterface, ArrayAccess, \JsonSerializa ]; /** - * If a nullable field gets set to null, insert it here - * - * @var boolean[] - */ + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ protected array $openAPINullablesSetToNull = []; /** @@ -288,14 +288,14 @@ public function __construct(?array $data = null) } /** - * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName - * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the - * $this->openAPINullablesSetToNull array - * - * @param string $variableName - * @param array $fields - * @param mixed $defaultValue - */ + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ private function setIfExists(string $variableName, array $fields, $defaultValue): void { if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { diff --git a/lib/Base/InsertRow.php b/lib/Base/InsertRow.php index 88f3c8bb..5eb65f91 100644 --- a/lib/Base/InsertRow.php +++ b/lib/Base/InsertRow.php @@ -45,17 +45,17 @@ class InsertRow implements ModelInterface, ArrayAccess, \JsonSerializable public const DISCRIMINATOR = null; /** - * The original name of the model. - * - * @var string - */ + * The original name of the model. + * + * @var string + */ protected static $openAPIModelName = 'insert_row'; /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ protected static $openAPITypes = [ 'table_name' => 'string', 'anchor_row_id' => 'string', @@ -65,12 +65,12 @@ class InsertRow implements ModelInterface, ArrayAccess, \JsonSerializable ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - * @phpstan-var array - * @psalm-var array - */ + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ protected static $openAPIFormats = [ 'table_name' => null, 'anchor_row_id' => null, @@ -80,10 +80,10 @@ class InsertRow implements ModelInterface, ArrayAccess, \JsonSerializable ]; /** - * Array of nullable properties. Used for (de)serialization - * - * @var boolean[] - */ + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ protected static array $openAPINullables = [ 'table_name' => false, 'anchor_row_id' => false, @@ -93,10 +93,10 @@ class InsertRow implements ModelInterface, ArrayAccess, \JsonSerializable ]; /** - * If a nullable field gets set to null, insert it here - * - * @var boolean[] - */ + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ protected array $openAPINullablesSetToNull = []; /** @@ -293,14 +293,14 @@ public function __construct(?array $data = null) } /** - * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName - * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the - * $this->openAPINullablesSetToNull array - * - * @param string $variableName - * @param array $fields - * @param mixed $defaultValue - */ + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ private function setIfExists(string $variableName, array $fields, $defaultValue): void { if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { diff --git a/lib/Base/InsertRowsIntoBigData.php b/lib/Base/InsertRowsIntoBigData.php index d4d24ff2..50c79e4f 100644 --- a/lib/Base/InsertRowsIntoBigData.php +++ b/lib/Base/InsertRowsIntoBigData.php @@ -44,49 +44,49 @@ class InsertRowsIntoBigData implements ModelInterface, ArrayAccess, \JsonSeriali public const DISCRIMINATOR = null; /** - * The original name of the model. - * - * @var string - */ + * The original name of the model. + * + * @var string + */ protected static $openAPIModelName = 'insert_rows_into_big_data'; /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ protected static $openAPITypes = [ 'table_name' => 'string', 'rows' => 'object[]' ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - * @phpstan-var array - * @psalm-var array - */ + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ protected static $openAPIFormats = [ 'table_name' => null, 'rows' => null ]; /** - * Array of nullable properties. Used for (de)serialization - * - * @var boolean[] - */ + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ protected static array $openAPINullables = [ 'table_name' => false, 'rows' => false ]; /** - * If a nullable field gets set to null, insert it here - * - * @var boolean[] - */ + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ protected array $openAPINullablesSetToNull = []; /** @@ -254,14 +254,14 @@ public function __construct(?array $data = null) } /** - * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName - * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the - * $this->openAPINullablesSetToNull array - * - * @param string $variableName - * @param array $fields - * @param mixed $defaultValue - */ + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ private function setIfExists(string $variableName, array $fields, $defaultValue): void { if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { diff --git a/lib/Base/LastModifierColumn.php b/lib/Base/LastModifierColumn.php index c32a1471..d8ef0fb9 100644 --- a/lib/Base/LastModifierColumn.php +++ b/lib/Base/LastModifierColumn.php @@ -45,17 +45,17 @@ class LastModifierColumn implements ModelInterface, ArrayAccess, \JsonSerializab public const DISCRIMINATOR = null; /** - * The original name of the model. - * - * @var string - */ + * The original name of the model. + * + * @var string + */ protected static $openAPIModelName = 'last_modifier_column'; /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ protected static $openAPITypes = [ 'column_name' => 'string', 'column_type' => 'string', @@ -63,12 +63,12 @@ class LastModifierColumn implements ModelInterface, ArrayAccess, \JsonSerializab ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - * @phpstan-var array - * @psalm-var array - */ + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ protected static $openAPIFormats = [ 'column_name' => null, 'column_type' => null, @@ -76,10 +76,10 @@ class LastModifierColumn implements ModelInterface, ArrayAccess, \JsonSerializab ]; /** - * Array of nullable properties. Used for (de)serialization - * - * @var boolean[] - */ + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ protected static array $openAPINullables = [ 'column_name' => false, 'column_type' => false, @@ -87,10 +87,10 @@ class LastModifierColumn implements ModelInterface, ArrayAccess, \JsonSerializab ]; /** - * If a nullable field gets set to null, insert it here - * - * @var boolean[] - */ + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ protected array $openAPINullablesSetToNull = []; /** @@ -275,14 +275,14 @@ public function __construct(?array $data = null) } /** - * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName - * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the - * $this->openAPINullablesSetToNull array - * - * @param string $variableName - * @param array $fields - * @param mixed $defaultValue - */ + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ private function setIfExists(string $variableName, array $fields, $defaultValue): void { if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { diff --git a/lib/Base/LastModifierColumnWithTableName.php b/lib/Base/LastModifierColumnWithTableName.php index 8cd3283a..4b2de5a1 100644 --- a/lib/Base/LastModifierColumnWithTableName.php +++ b/lib/Base/LastModifierColumnWithTableName.php @@ -44,17 +44,17 @@ class LastModifierColumnWithTableName implements ModelInterface, ArrayAccess, \J public const DISCRIMINATOR = null; /** - * The original name of the model. - * - * @var string - */ + * The original name of the model. + * + * @var string + */ protected static $openAPIModelName = 'last_modifier_column_with_table_name'; /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ protected static $openAPITypes = [ 'table_name' => 'string', 'column_name' => 'string', @@ -63,12 +63,12 @@ class LastModifierColumnWithTableName implements ModelInterface, ArrayAccess, \J ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - * @phpstan-var array - * @psalm-var array - */ + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ protected static $openAPIFormats = [ 'table_name' => null, 'column_name' => null, @@ -77,10 +77,10 @@ class LastModifierColumnWithTableName implements ModelInterface, ArrayAccess, \J ]; /** - * Array of nullable properties. Used for (de)serialization - * - * @var boolean[] - */ + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ protected static array $openAPINullables = [ 'table_name' => false, 'column_name' => false, @@ -89,10 +89,10 @@ class LastModifierColumnWithTableName implements ModelInterface, ArrayAccess, \J ]; /** - * If a nullable field gets set to null, insert it here - * - * @var boolean[] - */ + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ protected array $openAPINullablesSetToNull = []; /** @@ -281,14 +281,14 @@ public function __construct(?array $data = null) } /** - * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName - * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the - * $this->openAPINullablesSetToNull array - * - * @param string $variableName - * @param array $fields - * @param mixed $defaultValue - */ + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ private function setIfExists(string $variableName, array $fields, $defaultValue): void { if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { diff --git a/lib/Base/LinkColumn.php b/lib/Base/LinkColumn.php index ac121f7a..5665b8e0 100644 --- a/lib/Base/LinkColumn.php +++ b/lib/Base/LinkColumn.php @@ -45,17 +45,17 @@ class LinkColumn implements ModelInterface, ArrayAccess, \JsonSerializable public const DISCRIMINATOR = null; /** - * The original name of the model. - * - * @var string - */ + * The original name of the model. + * + * @var string + */ protected static $openAPIModelName = 'link_column'; /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ protected static $openAPITypes = [ 'column_name' => 'string', 'column_type' => 'string', @@ -64,12 +64,12 @@ class LinkColumn implements ModelInterface, ArrayAccess, \JsonSerializable ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - * @phpstan-var array - * @psalm-var array - */ + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ protected static $openAPIFormats = [ 'column_name' => null, 'column_type' => null, @@ -78,10 +78,10 @@ class LinkColumn implements ModelInterface, ArrayAccess, \JsonSerializable ]; /** - * Array of nullable properties. Used for (de)serialization - * - * @var boolean[] - */ + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ protected static array $openAPINullables = [ 'column_name' => false, 'column_type' => false, @@ -90,10 +90,10 @@ class LinkColumn implements ModelInterface, ArrayAccess, \JsonSerializable ]; /** - * If a nullable field gets set to null, insert it here - * - * @var boolean[] - */ + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ protected array $openAPINullablesSetToNull = []; /** @@ -282,14 +282,14 @@ public function __construct(?array $data = null) } /** - * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName - * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the - * $this->openAPINullablesSetToNull array - * - * @param string $variableName - * @param array $fields - * @param mixed $defaultValue - */ + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ private function setIfExists(string $variableName, array $fields, $defaultValue): void { if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { diff --git a/lib/Base/LinkColumnFormat.php b/lib/Base/LinkColumnFormat.php index 522b173c..5562edb1 100644 --- a/lib/Base/LinkColumnFormat.php +++ b/lib/Base/LinkColumnFormat.php @@ -45,49 +45,49 @@ class LinkColumnFormat implements ModelInterface, ArrayAccess, \JsonSerializable public const DISCRIMINATOR = null; /** - * The original name of the model. - * - * @var string - */ + * The original name of the model. + * + * @var string + */ protected static $openAPIModelName = 'link_column_format'; /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ protected static $openAPITypes = [ 'table' => 'string', 'other_table' => 'string' ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - * @phpstan-var array - * @psalm-var array - */ + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ protected static $openAPIFormats = [ 'table' => null, 'other_table' => null ]; /** - * Array of nullable properties. Used for (de)serialization - * - * @var boolean[] - */ + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ protected static array $openAPINullables = [ 'table' => false, 'other_table' => false ]; /** - * If a nullable field gets set to null, insert it here - * - * @var boolean[] - */ + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ protected array $openAPINullablesSetToNull = []; /** @@ -255,14 +255,14 @@ public function __construct(?array $data = null) } /** - * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName - * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the - * $this->openAPINullablesSetToNull array - * - * @param string $variableName - * @param array $fields - * @param mixed $defaultValue - */ + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ private function setIfExists(string $variableName, array $fields, $defaultValue): void { if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { diff --git a/lib/Base/LinkColumnWithTableName.php b/lib/Base/LinkColumnWithTableName.php index 48886ba5..355e2099 100644 --- a/lib/Base/LinkColumnWithTableName.php +++ b/lib/Base/LinkColumnWithTableName.php @@ -44,17 +44,17 @@ class LinkColumnWithTableName implements ModelInterface, ArrayAccess, \JsonSeria public const DISCRIMINATOR = null; /** - * The original name of the model. - * - * @var string - */ + * The original name of the model. + * + * @var string + */ protected static $openAPIModelName = 'link_column_with_table_name'; /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ protected static $openAPITypes = [ 'table_name' => 'string', 'column_name' => 'string', @@ -64,12 +64,12 @@ class LinkColumnWithTableName implements ModelInterface, ArrayAccess, \JsonSeria ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - * @phpstan-var array - * @psalm-var array - */ + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ protected static $openAPIFormats = [ 'table_name' => null, 'column_name' => null, @@ -79,10 +79,10 @@ class LinkColumnWithTableName implements ModelInterface, ArrayAccess, \JsonSeria ]; /** - * Array of nullable properties. Used for (de)serialization - * - * @var boolean[] - */ + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ protected static array $openAPINullables = [ 'table_name' => false, 'column_name' => false, @@ -92,10 +92,10 @@ class LinkColumnWithTableName implements ModelInterface, ArrayAccess, \JsonSeria ]; /** - * If a nullable field gets set to null, insert it here - * - * @var boolean[] - */ + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ protected array $openAPINullablesSetToNull = []; /** @@ -288,14 +288,14 @@ public function __construct(?array $data = null) } /** - * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName - * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the - * $this->openAPINullablesSetToNull array - * - * @param string $variableName - * @param array $fields - * @param mixed $defaultValue - */ + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ private function setIfExists(string $variableName, array $fields, $defaultValue): void { if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { diff --git a/lib/Base/LinkFormulaColumn.php b/lib/Base/LinkFormulaColumn.php index 2fe3f83e..320fcb85 100644 --- a/lib/Base/LinkFormulaColumn.php +++ b/lib/Base/LinkFormulaColumn.php @@ -45,17 +45,17 @@ class LinkFormulaColumn implements ModelInterface, ArrayAccess, \JsonSerializabl public const DISCRIMINATOR = null; /** - * The original name of the model. - * - * @var string - */ + * The original name of the model. + * + * @var string + */ protected static $openAPIModelName = 'link_formula_column'; /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ protected static $openAPITypes = [ 'column_name' => 'string', 'column_type' => 'string', @@ -64,12 +64,12 @@ class LinkFormulaColumn implements ModelInterface, ArrayAccess, \JsonSerializabl ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - * @phpstan-var array - * @psalm-var array - */ + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ protected static $openAPIFormats = [ 'column_name' => null, 'column_type' => null, @@ -78,10 +78,10 @@ class LinkFormulaColumn implements ModelInterface, ArrayAccess, \JsonSerializabl ]; /** - * Array of nullable properties. Used for (de)serialization - * - * @var boolean[] - */ + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ protected static array $openAPINullables = [ 'column_name' => false, 'column_type' => false, @@ -90,10 +90,10 @@ class LinkFormulaColumn implements ModelInterface, ArrayAccess, \JsonSerializabl ]; /** - * If a nullable field gets set to null, insert it here - * - * @var boolean[] - */ + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ protected array $openAPINullablesSetToNull = []; /** @@ -282,14 +282,14 @@ public function __construct(?array $data = null) } /** - * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName - * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the - * $this->openAPINullablesSetToNull array - * - * @param string $variableName - * @param array $fields - * @param mixed $defaultValue - */ + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ private function setIfExists(string $variableName, array $fields, $defaultValue): void { if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { diff --git a/lib/Base/LinkFormulaColumnColumnData.php b/lib/Base/LinkFormulaColumnColumnData.php index 682ee39f..ade1e2d0 100644 --- a/lib/Base/LinkFormulaColumnColumnData.php +++ b/lib/Base/LinkFormulaColumnColumnData.php @@ -44,17 +44,17 @@ class LinkFormulaColumnColumnData implements ModelInterface, ArrayAccess, \JsonS public const DISCRIMINATOR = null; /** - * The original name of the model. - * - * @var string - */ + * The original name of the model. + * + * @var string + */ protected static $openAPIModelName = 'link_formula_column_column_data'; /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ protected static $openAPITypes = [ 'formula' => 'string', 'link_column' => 'string', @@ -67,12 +67,12 @@ class LinkFormulaColumnColumnData implements ModelInterface, ArrayAccess, \JsonS ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - * @phpstan-var array - * @psalm-var array - */ + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ protected static $openAPIFormats = [ 'formula' => null, 'link_column' => null, @@ -85,10 +85,10 @@ class LinkFormulaColumnColumnData implements ModelInterface, ArrayAccess, \JsonS ]; /** - * Array of nullable properties. Used for (de)serialization - * - * @var boolean[] - */ + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ protected static array $openAPINullables = [ 'formula' => false, 'link_column' => false, @@ -101,10 +101,10 @@ class LinkFormulaColumnColumnData implements ModelInterface, ArrayAccess, \JsonS ]; /** - * If a nullable field gets set to null, insert it here - * - * @var boolean[] - */ + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ protected array $openAPINullablesSetToNull = []; /** @@ -330,14 +330,14 @@ public function __construct(?array $data = null) } /** - * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName - * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the - * $this->openAPINullablesSetToNull array - * - * @param string $variableName - * @param array $fields - * @param mixed $defaultValue - */ + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ private function setIfExists(string $variableName, array $fields, $defaultValue): void { if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { diff --git a/lib/Base/LinkFormulaColumnCountLinksFormat.php b/lib/Base/LinkFormulaColumnCountLinksFormat.php index 4db67a07..9363c683 100644 --- a/lib/Base/LinkFormulaColumnCountLinksFormat.php +++ b/lib/Base/LinkFormulaColumnCountLinksFormat.php @@ -45,49 +45,49 @@ class LinkFormulaColumnCountLinksFormat implements ModelInterface, ArrayAccess, public const DISCRIMINATOR = null; /** - * The original name of the model. - * - * @var string - */ + * The original name of the model. + * + * @var string + */ protected static $openAPIModelName = 'link_formula_column_countLinks_format'; /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ protected static $openAPITypes = [ 'formula' => 'string', 'link_column' => 'string' ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - * @phpstan-var array - * @psalm-var array - */ + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ protected static $openAPIFormats = [ 'formula' => null, 'link_column' => null ]; /** - * Array of nullable properties. Used for (de)serialization - * - * @var boolean[] - */ + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ protected static array $openAPINullables = [ 'formula' => false, 'link_column' => false ]; /** - * If a nullable field gets set to null, insert it here - * - * @var boolean[] - */ + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ protected array $openAPINullablesSetToNull = []; /** @@ -268,14 +268,14 @@ public function __construct(?array $data = null) } /** - * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName - * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the - * $this->openAPINullablesSetToNull array - * - * @param string $variableName - * @param array $fields - * @param mixed $defaultValue - */ + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ private function setIfExists(string $variableName, array $fields, $defaultValue): void { if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { diff --git a/lib/Base/LinkFormulaColumnFindmaxFormat.php b/lib/Base/LinkFormulaColumnFindmaxFormat.php index 0bfe685a..b3f7f5d2 100644 --- a/lib/Base/LinkFormulaColumnFindmaxFormat.php +++ b/lib/Base/LinkFormulaColumnFindmaxFormat.php @@ -45,17 +45,17 @@ class LinkFormulaColumnFindmaxFormat implements ModelInterface, ArrayAccess, \Js public const DISCRIMINATOR = null; /** - * The original name of the model. - * - * @var string - */ + * The original name of the model. + * + * @var string + */ protected static $openAPIModelName = 'link_formula_column_findmax_format'; /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ protected static $openAPITypes = [ 'formula' => 'string', 'link_column' => 'string', @@ -64,12 +64,12 @@ class LinkFormulaColumnFindmaxFormat implements ModelInterface, ArrayAccess, \Js ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - * @phpstan-var array - * @psalm-var array - */ + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ protected static $openAPIFormats = [ 'formula' => null, 'link_column' => null, @@ -78,10 +78,10 @@ class LinkFormulaColumnFindmaxFormat implements ModelInterface, ArrayAccess, \Js ]; /** - * Array of nullable properties. Used for (de)serialization - * - * @var boolean[] - */ + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ protected static array $openAPINullables = [ 'formula' => false, 'link_column' => false, @@ -90,10 +90,10 @@ class LinkFormulaColumnFindmaxFormat implements ModelInterface, ArrayAccess, \Js ]; /** - * If a nullable field gets set to null, insert it here - * - * @var boolean[] - */ + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ protected array $openAPINullablesSetToNull = []; /** @@ -282,14 +282,14 @@ public function __construct(?array $data = null) } /** - * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName - * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the - * $this->openAPINullablesSetToNull array - * - * @param string $variableName - * @param array $fields - * @param mixed $defaultValue - */ + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ private function setIfExists(string $variableName, array $fields, $defaultValue): void { if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { diff --git a/lib/Base/LinkFormulaColumnFindminFormat.php b/lib/Base/LinkFormulaColumnFindminFormat.php index 43280cd9..f4ee97f3 100644 --- a/lib/Base/LinkFormulaColumnFindminFormat.php +++ b/lib/Base/LinkFormulaColumnFindminFormat.php @@ -45,17 +45,17 @@ class LinkFormulaColumnFindminFormat implements ModelInterface, ArrayAccess, \Js public const DISCRIMINATOR = null; /** - * The original name of the model. - * - * @var string - */ + * The original name of the model. + * + * @var string + */ protected static $openAPIModelName = 'link_formula_column_findmin_format'; /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ protected static $openAPITypes = [ 'formula' => 'string', 'link_column' => 'string', @@ -64,12 +64,12 @@ class LinkFormulaColumnFindminFormat implements ModelInterface, ArrayAccess, \Js ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - * @phpstan-var array - * @psalm-var array - */ + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ protected static $openAPIFormats = [ 'formula' => null, 'link_column' => null, @@ -78,10 +78,10 @@ class LinkFormulaColumnFindminFormat implements ModelInterface, ArrayAccess, \Js ]; /** - * Array of nullable properties. Used for (de)serialization - * - * @var boolean[] - */ + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ protected static array $openAPINullables = [ 'formula' => false, 'link_column' => false, @@ -90,10 +90,10 @@ class LinkFormulaColumnFindminFormat implements ModelInterface, ArrayAccess, \Js ]; /** - * If a nullable field gets set to null, insert it here - * - * @var boolean[] - */ + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ protected array $openAPINullablesSetToNull = []; /** @@ -282,14 +282,14 @@ public function __construct(?array $data = null) } /** - * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName - * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the - * $this->openAPINullablesSetToNull array - * - * @param string $variableName - * @param array $fields - * @param mixed $defaultValue - */ + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ private function setIfExists(string $variableName, array $fields, $defaultValue): void { if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { diff --git a/lib/Base/LinkFormulaColumnLookupFormat.php b/lib/Base/LinkFormulaColumnLookupFormat.php index 79d5f81c..e7ffb2a0 100644 --- a/lib/Base/LinkFormulaColumnLookupFormat.php +++ b/lib/Base/LinkFormulaColumnLookupFormat.php @@ -45,17 +45,17 @@ class LinkFormulaColumnLookupFormat implements ModelInterface, ArrayAccess, \Jso public const DISCRIMINATOR = null; /** - * The original name of the model. - * - * @var string - */ + * The original name of the model. + * + * @var string + */ protected static $openAPIModelName = 'link_formula_column_lookup_format'; /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ protected static $openAPITypes = [ 'formula' => 'string', 'link_column' => 'string', @@ -64,12 +64,12 @@ class LinkFormulaColumnLookupFormat implements ModelInterface, ArrayAccess, \Jso ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - * @phpstan-var array - * @psalm-var array - */ + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ protected static $openAPIFormats = [ 'formula' => null, 'link_column' => null, @@ -78,10 +78,10 @@ class LinkFormulaColumnLookupFormat implements ModelInterface, ArrayAccess, \Jso ]; /** - * Array of nullable properties. Used for (de)serialization - * - * @var boolean[] - */ + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ protected static array $openAPINullables = [ 'formula' => false, 'link_column' => false, @@ -90,10 +90,10 @@ class LinkFormulaColumnLookupFormat implements ModelInterface, ArrayAccess, \Jso ]; /** - * If a nullable field gets set to null, insert it here - * - * @var boolean[] - */ + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ protected array $openAPINullablesSetToNull = []; /** @@ -282,14 +282,14 @@ public function __construct(?array $data = null) } /** - * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName - * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the - * $this->openAPINullablesSetToNull array - * - * @param string $variableName - * @param array $fields - * @param mixed $defaultValue - */ + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ private function setIfExists(string $variableName, array $fields, $defaultValue): void { if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { diff --git a/lib/Base/LinkFormulaColumnRollupFormat.php b/lib/Base/LinkFormulaColumnRollupFormat.php index 1ff9bc86..714331cb 100644 --- a/lib/Base/LinkFormulaColumnRollupFormat.php +++ b/lib/Base/LinkFormulaColumnRollupFormat.php @@ -45,17 +45,17 @@ class LinkFormulaColumnRollupFormat implements ModelInterface, ArrayAccess, \Jso public const DISCRIMINATOR = null; /** - * The original name of the model. - * - * @var string - */ + * The original name of the model. + * + * @var string + */ protected static $openAPIModelName = 'link_formula_column_rollup_format'; /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ protected static $openAPITypes = [ 'formula' => 'string', 'link_column' => 'string', @@ -64,12 +64,12 @@ class LinkFormulaColumnRollupFormat implements ModelInterface, ArrayAccess, \Jso ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - * @phpstan-var array - * @psalm-var array - */ + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ protected static $openAPIFormats = [ 'formula' => null, 'link_column' => null, @@ -78,10 +78,10 @@ class LinkFormulaColumnRollupFormat implements ModelInterface, ArrayAccess, \Jso ]; /** - * Array of nullable properties. Used for (de)serialization - * - * @var boolean[] - */ + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ protected static array $openAPINullables = [ 'formula' => false, 'link_column' => false, @@ -90,10 +90,10 @@ class LinkFormulaColumnRollupFormat implements ModelInterface, ArrayAccess, \Jso ]; /** - * If a nullable field gets set to null, insert it here - * - * @var boolean[] - */ + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ protected array $openAPINullablesSetToNull = []; /** @@ -303,14 +303,14 @@ public function __construct(?array $data = null) } /** - * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName - * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the - * $this->openAPINullablesSetToNull array - * - * @param string $variableName - * @param array $fields - * @param mixed $defaultValue - */ + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ private function setIfExists(string $variableName, array $fields, $defaultValue): void { if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { diff --git a/lib/Base/LinkFormulaColumnWithTableName.php b/lib/Base/LinkFormulaColumnWithTableName.php index 797c647e..9969cb3e 100644 --- a/lib/Base/LinkFormulaColumnWithTableName.php +++ b/lib/Base/LinkFormulaColumnWithTableName.php @@ -44,17 +44,17 @@ class LinkFormulaColumnWithTableName implements ModelInterface, ArrayAccess, \Js public const DISCRIMINATOR = null; /** - * The original name of the model. - * - * @var string - */ + * The original name of the model. + * + * @var string + */ protected static $openAPIModelName = 'link_formula_column_with_table_name'; /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ protected static $openAPITypes = [ 'table_name' => 'string', 'column_name' => 'string', @@ -64,12 +64,12 @@ class LinkFormulaColumnWithTableName implements ModelInterface, ArrayAccess, \Js ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - * @phpstan-var array - * @psalm-var array - */ + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ protected static $openAPIFormats = [ 'table_name' => null, 'column_name' => null, @@ -79,10 +79,10 @@ class LinkFormulaColumnWithTableName implements ModelInterface, ArrayAccess, \Js ]; /** - * Array of nullable properties. Used for (de)serialization - * - * @var boolean[] - */ + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ protected static array $openAPINullables = [ 'table_name' => false, 'column_name' => false, @@ -92,10 +92,10 @@ class LinkFormulaColumnWithTableName implements ModelInterface, ArrayAccess, \Js ]; /** - * If a nullable field gets set to null, insert it here - * - * @var boolean[] - */ + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ protected array $openAPINullablesSetToNull = []; /** @@ -288,14 +288,14 @@ public function __construct(?array $data = null) } /** - * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName - * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the - * $this->openAPINullablesSetToNull array - * - * @param string $variableName - * @param array $fields - * @param mixed $defaultValue - */ + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ private function setIfExists(string $variableName, array $fields, $defaultValue): void { if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { diff --git a/lib/Base/LinksApi.php b/lib/Base/LinksApi.php index 514fe1a6..5745d0d8 100644 --- a/lib/Base/LinksApi.php +++ b/lib/Base/LinksApi.php @@ -28,11 +28,11 @@ use GuzzleHttp\Client; use GuzzleHttp\ClientInterface; -use GuzzleHttp\Exception\ConnectException; use GuzzleHttp\Exception\RequestException; use GuzzleHttp\Psr7\MultipartStream; use GuzzleHttp\Psr7\Request; use GuzzleHttp\RequestOptions; +use Psr\Http\Client\NetworkExceptionInterface; use Psr\Http\Message\RequestInterface; use Psr\Http\Message\ResponseInterface; use SeaTable\Client\ApiException; @@ -180,13 +180,14 @@ public function autoLinkTaskWithHttpInfo($base_uuid, $body = null, string $conte try { $response = $this->client->send($request, $options); } catch (RequestException $e) { + $eResponse = $this->getExceptionResponse($e); throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), - $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? (string) $e->getResponse()->getBody() : null + $eResponse ? $eResponse->getHeaders() : null, + $eResponse ? (string) $eResponse->getBody() : null ); - } catch (ConnectException $e) { + } catch (NetworkExceptionInterface $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), @@ -303,7 +304,15 @@ function ($response) use ($returnType) { ]; }, function ($exception) { - $response = $exception->getResponse(); + $response = $this->getExceptionResponse($exception); + if ($response === null) { + throw new ApiException( + "[{$exception->getCode()}] {$exception->getMessage()}", + (int) $exception->getCode(), + null, + null + ); + } $statusCode = $response->getStatusCode(); throw new ApiException( sprintf( @@ -356,7 +365,7 @@ public function autoLinkTaskRequest($base_uuid, $body = null, string $contentTyp // path params if ($base_uuid !== null) { $resourcePath = str_replace( - '{' . 'base_uuid' . '}', + '{base_uuid}', ObjectSerializer::toPathValue($base_uuid), $resourcePath ); @@ -373,7 +382,11 @@ public function autoLinkTaskRequest($base_uuid, $body = null, string $contentTyp if (isset($body)) { if (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the body - $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($body)); + try { + $httpBody = json_encode(ObjectSerializer::sanitizeForSerialization($body), JSON_THROW_ON_ERROR); + } catch (\JsonException $e) { + throw new \InvalidArgumentException('json_encode error: ' . $e->getMessage(), 0, $e); + } } else { $httpBody = $body; } @@ -394,7 +407,11 @@ public function autoLinkTaskRequest($base_uuid, $body = null, string $contentTyp } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + try { + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + } catch (\JsonException $e) { + throw new \InvalidArgumentException('json_encode error: ' . $e->getMessage(), 0, $e); + } } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -468,13 +485,14 @@ public function autoLinksWithHttpInfo($base_uuid, $match_link_columns = null, st try { $response = $this->client->send($request, $options); } catch (RequestException $e) { + $eResponse = $this->getExceptionResponse($e); throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), - $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? (string) $e->getResponse()->getBody() : null + $eResponse ? $eResponse->getHeaders() : null, + $eResponse ? (string) $eResponse->getBody() : null ); - } catch (ConnectException $e) { + } catch (NetworkExceptionInterface $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), @@ -591,7 +609,15 @@ function ($response) use ($returnType) { ]; }, function ($exception) { - $response = $exception->getResponse(); + $response = $this->getExceptionResponse($exception); + if ($response === null) { + throw new ApiException( + "[{$exception->getCode()}] {$exception->getMessage()}", + (int) $exception->getCode(), + null, + null + ); + } $statusCode = $response->getStatusCode(); throw new ApiException( sprintf( @@ -644,7 +670,7 @@ public function autoLinksRequest($base_uuid, $match_link_columns = null, string // path params if ($base_uuid !== null) { $resourcePath = str_replace( - '{' . 'base_uuid' . '}', + '{base_uuid}', ObjectSerializer::toPathValue($base_uuid), $resourcePath ); @@ -661,7 +687,11 @@ public function autoLinksRequest($base_uuid, $match_link_columns = null, string if (isset($match_link_columns)) { if (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the body - $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($match_link_columns)); + try { + $httpBody = json_encode(ObjectSerializer::sanitizeForSerialization($match_link_columns), JSON_THROW_ON_ERROR); + } catch (\JsonException $e) { + throw new \InvalidArgumentException('json_encode error: ' . $e->getMessage(), 0, $e); + } } else { $httpBody = $match_link_columns; } @@ -682,7 +712,11 @@ public function autoLinksRequest($base_uuid, $match_link_columns = null, string } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + try { + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + } catch (\JsonException $e) { + throw new \InvalidArgumentException('json_encode error: ' . $e->getMessage(), 0, $e); + } } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -756,13 +790,14 @@ public function createRowLinkWithHttpInfo($base_uuid, $row_link_create_update_de try { $response = $this->client->send($request, $options); } catch (RequestException $e) { + $eResponse = $this->getExceptionResponse($e); throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), - $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? (string) $e->getResponse()->getBody() : null + $eResponse ? $eResponse->getHeaders() : null, + $eResponse ? (string) $eResponse->getBody() : null ); - } catch (ConnectException $e) { + } catch (NetworkExceptionInterface $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), @@ -879,7 +914,15 @@ function ($response) use ($returnType) { ]; }, function ($exception) { - $response = $exception->getResponse(); + $response = $this->getExceptionResponse($exception); + if ($response === null) { + throw new ApiException( + "[{$exception->getCode()}] {$exception->getMessage()}", + (int) $exception->getCode(), + null, + null + ); + } $statusCode = $response->getStatusCode(); throw new ApiException( sprintf( @@ -932,7 +975,7 @@ public function createRowLinkRequest($base_uuid, $row_link_create_update_delete // path params if ($base_uuid !== null) { $resourcePath = str_replace( - '{' . 'base_uuid' . '}', + '{base_uuid}', ObjectSerializer::toPathValue($base_uuid), $resourcePath ); @@ -949,7 +992,11 @@ public function createRowLinkRequest($base_uuid, $row_link_create_update_delete if (isset($row_link_create_update_delete)) { if (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the body - $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($row_link_create_update_delete)); + try { + $httpBody = json_encode(ObjectSerializer::sanitizeForSerialization($row_link_create_update_delete), JSON_THROW_ON_ERROR); + } catch (\JsonException $e) { + throw new \InvalidArgumentException('json_encode error: ' . $e->getMessage(), 0, $e); + } } else { $httpBody = $row_link_create_update_delete; } @@ -970,7 +1017,11 @@ public function createRowLinkRequest($base_uuid, $row_link_create_update_delete } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + try { + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + } catch (\JsonException $e) { + throw new \InvalidArgumentException('json_encode error: ' . $e->getMessage(), 0, $e); + } } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -1044,13 +1095,14 @@ public function deleteRowLinkWithHttpInfo($base_uuid, $row_link_create_update_de try { $response = $this->client->send($request, $options); } catch (RequestException $e) { + $eResponse = $this->getExceptionResponse($e); throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), - $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? (string) $e->getResponse()->getBody() : null + $eResponse ? $eResponse->getHeaders() : null, + $eResponse ? (string) $eResponse->getBody() : null ); - } catch (ConnectException $e) { + } catch (NetworkExceptionInterface $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), @@ -1167,7 +1219,15 @@ function ($response) use ($returnType) { ]; }, function ($exception) { - $response = $exception->getResponse(); + $response = $this->getExceptionResponse($exception); + if ($response === null) { + throw new ApiException( + "[{$exception->getCode()}] {$exception->getMessage()}", + (int) $exception->getCode(), + null, + null + ); + } $statusCode = $response->getStatusCode(); throw new ApiException( sprintf( @@ -1220,7 +1280,7 @@ public function deleteRowLinkRequest($base_uuid, $row_link_create_update_delete // path params if ($base_uuid !== null) { $resourcePath = str_replace( - '{' . 'base_uuid' . '}', + '{base_uuid}', ObjectSerializer::toPathValue($base_uuid), $resourcePath ); @@ -1237,7 +1297,11 @@ public function deleteRowLinkRequest($base_uuid, $row_link_create_update_delete if (isset($row_link_create_update_delete)) { if (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the body - $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($row_link_create_update_delete)); + try { + $httpBody = json_encode(ObjectSerializer::sanitizeForSerialization($row_link_create_update_delete), JSON_THROW_ON_ERROR); + } catch (\JsonException $e) { + throw new \InvalidArgumentException('json_encode error: ' . $e->getMessage(), 0, $e); + } } else { $httpBody = $row_link_create_update_delete; } @@ -1258,7 +1322,11 @@ public function deleteRowLinkRequest($base_uuid, $row_link_create_update_delete } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + try { + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + } catch (\JsonException $e) { + throw new \InvalidArgumentException('json_encode error: ' . $e->getMessage(), 0, $e); + } } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -1332,13 +1400,14 @@ public function listRowLinksWithHttpInfo($base_uuid, $list_row_links = null, str try { $response = $this->client->send($request, $options); } catch (RequestException $e) { + $eResponse = $this->getExceptionResponse($e); throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), - $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? (string) $e->getResponse()->getBody() : null + $eResponse ? $eResponse->getHeaders() : null, + $eResponse ? (string) $eResponse->getBody() : null ); - } catch (ConnectException $e) { + } catch (NetworkExceptionInterface $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), @@ -1455,7 +1524,15 @@ function ($response) use ($returnType) { ]; }, function ($exception) { - $response = $exception->getResponse(); + $response = $this->getExceptionResponse($exception); + if ($response === null) { + throw new ApiException( + "[{$exception->getCode()}] {$exception->getMessage()}", + (int) $exception->getCode(), + null, + null + ); + } $statusCode = $response->getStatusCode(); throw new ApiException( sprintf( @@ -1508,7 +1585,7 @@ public function listRowLinksRequest($base_uuid, $list_row_links = null, string $ // path params if ($base_uuid !== null) { $resourcePath = str_replace( - '{' . 'base_uuid' . '}', + '{base_uuid}', ObjectSerializer::toPathValue($base_uuid), $resourcePath ); @@ -1525,7 +1602,11 @@ public function listRowLinksRequest($base_uuid, $list_row_links = null, string $ if (isset($list_row_links)) { if (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the body - $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($list_row_links)); + try { + $httpBody = json_encode(ObjectSerializer::sanitizeForSerialization($list_row_links), JSON_THROW_ON_ERROR); + } catch (\JsonException $e) { + throw new \InvalidArgumentException('json_encode error: ' . $e->getMessage(), 0, $e); + } } else { $httpBody = $list_row_links; } @@ -1546,7 +1627,11 @@ public function listRowLinksRequest($base_uuid, $list_row_links = null, string $ } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + try { + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + } catch (\JsonException $e) { + throw new \InvalidArgumentException('json_encode error: ' . $e->getMessage(), 0, $e); + } } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -1620,13 +1705,14 @@ public function updateRowLinkWithHttpInfo($base_uuid, $row_link_create_update_de try { $response = $this->client->send($request, $options); } catch (RequestException $e) { + $eResponse = $this->getExceptionResponse($e); throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), - $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? (string) $e->getResponse()->getBody() : null + $eResponse ? $eResponse->getHeaders() : null, + $eResponse ? (string) $eResponse->getBody() : null ); - } catch (ConnectException $e) { + } catch (NetworkExceptionInterface $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), @@ -1743,7 +1829,15 @@ function ($response) use ($returnType) { ]; }, function ($exception) { - $response = $exception->getResponse(); + $response = $this->getExceptionResponse($exception); + if ($response === null) { + throw new ApiException( + "[{$exception->getCode()}] {$exception->getMessage()}", + (int) $exception->getCode(), + null, + null + ); + } $statusCode = $response->getStatusCode(); throw new ApiException( sprintf( @@ -1796,7 +1890,7 @@ public function updateRowLinkRequest($base_uuid, $row_link_create_update_delete // path params if ($base_uuid !== null) { $resourcePath = str_replace( - '{' . 'base_uuid' . '}', + '{base_uuid}', ObjectSerializer::toPathValue($base_uuid), $resourcePath ); @@ -1813,7 +1907,11 @@ public function updateRowLinkRequest($base_uuid, $row_link_create_update_delete if (isset($row_link_create_update_delete)) { if (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the body - $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($row_link_create_update_delete)); + try { + $httpBody = json_encode(ObjectSerializer::sanitizeForSerialization($row_link_create_update_delete), JSON_THROW_ON_ERROR); + } catch (\JsonException $e) { + throw new \InvalidArgumentException('json_encode error: ' . $e->getMessage(), 0, $e); + } } else { $httpBody = $row_link_create_update_delete; } @@ -1834,7 +1932,11 @@ public function updateRowLinkRequest($base_uuid, $row_link_create_update_delete } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + try { + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + } catch (\JsonException $e) { + throw new \InvalidArgumentException('json_encode error: ' . $e->getMessage(), 0, $e); + } } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -1894,6 +1996,21 @@ protected function createHttpClientOption() return $options; } + /** + * Returns the response attached to a Guzzle exception, if there is one. + * + * Guzzle 7 exposes getResponse() on RequestException, while Guzzle 8 only + * exposes it on ResponseException and its subclasses. + * + * @param \Throwable $exception + * + * @return ResponseInterface|null + */ + private function getExceptionResponse(\Throwable $exception): ?ResponseInterface + { + return method_exists($exception, 'getResponse') ? $exception->getResponse() : null; + } + private function handleResponseWithDataType( string $dataType, RequestInterface $request, diff --git a/lib/Base/ListRowLinks.php b/lib/Base/ListRowLinks.php index 866a2c24..b496152d 100644 --- a/lib/Base/ListRowLinks.php +++ b/lib/Base/ListRowLinks.php @@ -44,17 +44,17 @@ class ListRowLinks implements ModelInterface, ArrayAccess, \JsonSerializable public const DISCRIMINATOR = null; /** - * The original name of the model. - * - * @var string - */ + * The original name of the model. + * + * @var string + */ protected static $openAPIModelName = 'list_row_links'; /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ protected static $openAPITypes = [ 'table_name' => 'string', 'link_column_name' => 'string', @@ -62,12 +62,12 @@ class ListRowLinks implements ModelInterface, ArrayAccess, \JsonSerializable ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - * @phpstan-var array - * @psalm-var array - */ + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ protected static $openAPIFormats = [ 'table_name' => null, 'link_column_name' => null, @@ -75,10 +75,10 @@ class ListRowLinks implements ModelInterface, ArrayAccess, \JsonSerializable ]; /** - * Array of nullable properties. Used for (de)serialization - * - * @var boolean[] - */ + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ protected static array $openAPINullables = [ 'table_name' => false, 'link_column_name' => false, @@ -86,10 +86,10 @@ class ListRowLinks implements ModelInterface, ArrayAccess, \JsonSerializable ]; /** - * If a nullable field gets set to null, insert it here - * - * @var boolean[] - */ + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ protected array $openAPINullablesSetToNull = []; /** @@ -261,14 +261,14 @@ public function __construct(?array $data = null) } /** - * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName - * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the - * $this->openAPINullablesSetToNull array - * - * @param string $variableName - * @param array $fields - * @param mixed $defaultValue - */ + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ private function setIfExists(string $variableName, array $fields, $defaultValue): void { if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { diff --git a/lib/Base/ListRowLinksRowsInner.php b/lib/Base/ListRowLinksRowsInner.php index 33400056..b3f1f169 100644 --- a/lib/Base/ListRowLinksRowsInner.php +++ b/lib/Base/ListRowLinksRowsInner.php @@ -44,17 +44,17 @@ class ListRowLinksRowsInner implements ModelInterface, ArrayAccess, \JsonSeriali public const DISCRIMINATOR = null; /** - * The original name of the model. - * - * @var string - */ + * The original name of the model. + * + * @var string + */ protected static $openAPIModelName = 'list_row_links_rows_inner'; /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ protected static $openAPITypes = [ 'row_id' => 'string', 'offset' => 'int', @@ -62,12 +62,12 @@ class ListRowLinksRowsInner implements ModelInterface, ArrayAccess, \JsonSeriali ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - * @phpstan-var array - * @psalm-var array - */ + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ protected static $openAPIFormats = [ 'row_id' => null, 'offset' => null, @@ -75,10 +75,10 @@ class ListRowLinksRowsInner implements ModelInterface, ArrayAccess, \JsonSeriali ]; /** - * Array of nullable properties. Used for (de)serialization - * - * @var boolean[] - */ + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ protected static array $openAPINullables = [ 'row_id' => false, 'offset' => false, @@ -86,10 +86,10 @@ class ListRowLinksRowsInner implements ModelInterface, ArrayAccess, \JsonSeriali ]; /** - * If a nullable field gets set to null, insert it here - * - * @var boolean[] - */ + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ protected array $openAPINullablesSetToNull = []; /** @@ -261,14 +261,14 @@ public function __construct(?array $data = null) } /** - * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName - * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the - * $this->openAPINullablesSetToNull array - * - * @param string $variableName - * @param array $fields - * @param mixed $defaultValue - */ + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ private function setIfExists(string $variableName, array $fields, $defaultValue): void { if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { diff --git a/lib/Base/LongTextColumn.php b/lib/Base/LongTextColumn.php index fe4343c0..d8968144 100644 --- a/lib/Base/LongTextColumn.php +++ b/lib/Base/LongTextColumn.php @@ -45,17 +45,17 @@ class LongTextColumn implements ModelInterface, ArrayAccess, \JsonSerializable public const DISCRIMINATOR = null; /** - * The original name of the model. - * - * @var string - */ + * The original name of the model. + * + * @var string + */ protected static $openAPIModelName = 'long_text_column'; /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ protected static $openAPITypes = [ 'column_name' => 'string', 'column_type' => 'string', @@ -63,12 +63,12 @@ class LongTextColumn implements ModelInterface, ArrayAccess, \JsonSerializable ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - * @phpstan-var array - * @psalm-var array - */ + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ protected static $openAPIFormats = [ 'column_name' => null, 'column_type' => null, @@ -76,10 +76,10 @@ class LongTextColumn implements ModelInterface, ArrayAccess, \JsonSerializable ]; /** - * Array of nullable properties. Used for (de)serialization - * - * @var boolean[] - */ + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ protected static array $openAPINullables = [ 'column_name' => false, 'column_type' => false, @@ -87,10 +87,10 @@ class LongTextColumn implements ModelInterface, ArrayAccess, \JsonSerializable ]; /** - * If a nullable field gets set to null, insert it here - * - * @var boolean[] - */ + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ protected array $openAPINullablesSetToNull = []; /** @@ -275,14 +275,14 @@ public function __construct(?array $data = null) } /** - * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName - * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the - * $this->openAPINullablesSetToNull array - * - * @param string $variableName - * @param array $fields - * @param mixed $defaultValue - */ + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ private function setIfExists(string $variableName, array $fields, $defaultValue): void { if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { diff --git a/lib/Base/LongTextColumnWithTableName.php b/lib/Base/LongTextColumnWithTableName.php index 531e87fc..28d08553 100644 --- a/lib/Base/LongTextColumnWithTableName.php +++ b/lib/Base/LongTextColumnWithTableName.php @@ -44,17 +44,17 @@ class LongTextColumnWithTableName implements ModelInterface, ArrayAccess, \JsonS public const DISCRIMINATOR = null; /** - * The original name of the model. - * - * @var string - */ + * The original name of the model. + * + * @var string + */ protected static $openAPIModelName = 'long_text_column_with_table_name'; /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ protected static $openAPITypes = [ 'table_name' => 'string', 'column_name' => 'string', @@ -63,12 +63,12 @@ class LongTextColumnWithTableName implements ModelInterface, ArrayAccess, \JsonS ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - * @phpstan-var array - * @psalm-var array - */ + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ protected static $openAPIFormats = [ 'table_name' => null, 'column_name' => null, @@ -77,10 +77,10 @@ class LongTextColumnWithTableName implements ModelInterface, ArrayAccess, \JsonS ]; /** - * Array of nullable properties. Used for (de)serialization - * - * @var boolean[] - */ + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ protected static array $openAPINullables = [ 'table_name' => false, 'column_name' => false, @@ -89,10 +89,10 @@ class LongTextColumnWithTableName implements ModelInterface, ArrayAccess, \JsonS ]; /** - * If a nullable field gets set to null, insert it here - * - * @var boolean[] - */ + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ protected array $openAPINullablesSetToNull = []; /** @@ -281,14 +281,14 @@ public function __construct(?array $data = null) } /** - * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName - * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the - * $this->openAPINullablesSetToNull array - * - * @param string $variableName - * @param array $fields - * @param mixed $defaultValue - */ + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ private function setIfExists(string $variableName, array $fields, $defaultValue): void { if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { diff --git a/lib/Base/MatchLinkColumns.php b/lib/Base/MatchLinkColumns.php index 19903e07..b9aa1eb3 100644 --- a/lib/Base/MatchLinkColumns.php +++ b/lib/Base/MatchLinkColumns.php @@ -45,49 +45,49 @@ class MatchLinkColumns implements ModelInterface, ArrayAccess, \JsonSerializable public const DISCRIMINATOR = null; /** - * The original name of the model. - * - * @var string - */ + * The original name of the model. + * + * @var string + */ protected static $openAPIModelName = 'match_link_columns'; /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ protected static $openAPITypes = [ 'link_id' => 'string', 'matching_keys' => '\SeaTable\Client\Base\MatchLinkColumnsMatchingKeysInner[]' ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - * @phpstan-var array - * @psalm-var array - */ + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ protected static $openAPIFormats = [ 'link_id' => null, 'matching_keys' => null ]; /** - * Array of nullable properties. Used for (de)serialization - * - * @var boolean[] - */ + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ protected static array $openAPINullables = [ 'link_id' => false, 'matching_keys' => false ]; /** - * If a nullable field gets set to null, insert it here - * - * @var boolean[] - */ + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ protected array $openAPINullablesSetToNull = []; /** @@ -255,14 +255,14 @@ public function __construct(?array $data = null) } /** - * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName - * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the - * $this->openAPINullablesSetToNull array - * - * @param string $variableName - * @param array $fields - * @param mixed $defaultValue - */ + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ private function setIfExists(string $variableName, array $fields, $defaultValue): void { if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { diff --git a/lib/Base/MatchLinkColumnsMatchingKeysInner.php b/lib/Base/MatchLinkColumnsMatchingKeysInner.php index 2fa66f8a..5bb46603 100644 --- a/lib/Base/MatchLinkColumnsMatchingKeysInner.php +++ b/lib/Base/MatchLinkColumnsMatchingKeysInner.php @@ -44,49 +44,49 @@ class MatchLinkColumnsMatchingKeysInner implements ModelInterface, ArrayAccess, public const DISCRIMINATOR = null; /** - * The original name of the model. - * - * @var string - */ + * The original name of the model. + * + * @var string + */ protected static $openAPIModelName = 'match_link_columns_matching_keys_inner'; /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ protected static $openAPITypes = [ 'table1_key' => 'string', 'table2_key' => 'string' ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - * @phpstan-var array - * @psalm-var array - */ + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ protected static $openAPIFormats = [ 'table1_key' => null, 'table2_key' => null ]; /** - * Array of nullable properties. Used for (de)serialization - * - * @var boolean[] - */ + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ protected static array $openAPINullables = [ 'table1_key' => false, 'table2_key' => false ]; /** - * If a nullable field gets set to null, insert it here - * - * @var boolean[] - */ + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ protected array $openAPINullablesSetToNull = []; /** @@ -254,14 +254,14 @@ public function __construct(?array $data = null) } /** - * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName - * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the - * $this->openAPINullablesSetToNull array - * - * @param string $variableName - * @param array $fields - * @param mixed $defaultValue - */ + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ private function setIfExists(string $variableName, array $fields, $defaultValue): void { if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { diff --git a/lib/Base/MoveColumn.php b/lib/Base/MoveColumn.php index 2ab5ab16..677c6d34 100644 --- a/lib/Base/MoveColumn.php +++ b/lib/Base/MoveColumn.php @@ -44,17 +44,17 @@ class MoveColumn implements ModelInterface, ArrayAccess, \JsonSerializable public const DISCRIMINATOR = null; /** - * The original name of the model. - * - * @var string - */ + * The original name of the model. + * + * @var string + */ protected static $openAPIModelName = 'move_column'; /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ protected static $openAPITypes = [ 'op_type' => 'string', 'table_name' => 'string', @@ -63,12 +63,12 @@ class MoveColumn implements ModelInterface, ArrayAccess, \JsonSerializable ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - * @phpstan-var array - * @psalm-var array - */ + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ protected static $openAPIFormats = [ 'op_type' => null, 'table_name' => null, @@ -77,10 +77,10 @@ class MoveColumn implements ModelInterface, ArrayAccess, \JsonSerializable ]; /** - * Array of nullable properties. Used for (de)serialization - * - * @var boolean[] - */ + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ protected static array $openAPINullables = [ 'op_type' => false, 'table_name' => false, @@ -89,10 +89,10 @@ class MoveColumn implements ModelInterface, ArrayAccess, \JsonSerializable ]; /** - * If a nullable field gets set to null, insert it here - * - * @var boolean[] - */ + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ protected array $openAPINullablesSetToNull = []; /** @@ -281,14 +281,14 @@ public function __construct(?array $data = null) } /** - * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName - * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the - * $this->openAPINullablesSetToNull array - * - * @param string $variableName - * @param array $fields - * @param mixed $defaultValue - */ + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ private function setIfExists(string $variableName, array $fields, $defaultValue): void { if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { diff --git a/lib/Base/MoveRowsToNormalBackendRequest.php b/lib/Base/MoveRowsToNormalBackendRequest.php index 27717007..8ab9f5c8 100644 --- a/lib/Base/MoveRowsToNormalBackendRequest.php +++ b/lib/Base/MoveRowsToNormalBackendRequest.php @@ -44,49 +44,49 @@ class MoveRowsToNormalBackendRequest implements ModelInterface, ArrayAccess, \Js public const DISCRIMINATOR = null; /** - * The original name of the model. - * - * @var string - */ + * The original name of the model. + * + * @var string + */ protected static $openAPIModelName = 'moveRowsToNormalBackend_request'; /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ protected static $openAPITypes = [ 'table_id' => 'string', 'row_ids' => 'string[]' ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - * @phpstan-var array - * @psalm-var array - */ + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ protected static $openAPIFormats = [ 'table_id' => null, 'row_ids' => null ]; /** - * Array of nullable properties. Used for (de)serialization - * - * @var boolean[] - */ + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ protected static array $openAPINullables = [ 'table_id' => false, 'row_ids' => false ]; /** - * If a nullable field gets set to null, insert it here - * - * @var boolean[] - */ + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ protected array $openAPINullablesSetToNull = []; /** @@ -254,14 +254,14 @@ public function __construct(?array $data = null) } /** - * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName - * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the - * $this->openAPINullablesSetToNull array - * - * @param string $variableName - * @param array $fields - * @param mixed $defaultValue - */ + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ private function setIfExists(string $variableName, array $fields, $defaultValue): void { if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { diff --git a/lib/Base/MtimeColumn.php b/lib/Base/MtimeColumn.php index b84a4bf7..4d708887 100644 --- a/lib/Base/MtimeColumn.php +++ b/lib/Base/MtimeColumn.php @@ -45,17 +45,17 @@ class MtimeColumn implements ModelInterface, ArrayAccess, \JsonSerializable public const DISCRIMINATOR = null; /** - * The original name of the model. - * - * @var string - */ + * The original name of the model. + * + * @var string + */ protected static $openAPIModelName = 'mtime_column'; /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ protected static $openAPITypes = [ 'column_name' => 'string', 'column_type' => 'string', @@ -63,12 +63,12 @@ class MtimeColumn implements ModelInterface, ArrayAccess, \JsonSerializable ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - * @phpstan-var array - * @psalm-var array - */ + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ protected static $openAPIFormats = [ 'column_name' => null, 'column_type' => null, @@ -76,10 +76,10 @@ class MtimeColumn implements ModelInterface, ArrayAccess, \JsonSerializable ]; /** - * Array of nullable properties. Used for (de)serialization - * - * @var boolean[] - */ + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ protected static array $openAPINullables = [ 'column_name' => false, 'column_type' => false, @@ -87,10 +87,10 @@ class MtimeColumn implements ModelInterface, ArrayAccess, \JsonSerializable ]; /** - * If a nullable field gets set to null, insert it here - * - * @var boolean[] - */ + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ protected array $openAPINullablesSetToNull = []; /** @@ -275,14 +275,14 @@ public function __construct(?array $data = null) } /** - * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName - * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the - * $this->openAPINullablesSetToNull array - * - * @param string $variableName - * @param array $fields - * @param mixed $defaultValue - */ + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ private function setIfExists(string $variableName, array $fields, $defaultValue): void { if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { diff --git a/lib/Base/MtimeColumnWithTableName.php b/lib/Base/MtimeColumnWithTableName.php index 46161e31..f1fce443 100644 --- a/lib/Base/MtimeColumnWithTableName.php +++ b/lib/Base/MtimeColumnWithTableName.php @@ -44,17 +44,17 @@ class MtimeColumnWithTableName implements ModelInterface, ArrayAccess, \JsonSeri public const DISCRIMINATOR = null; /** - * The original name of the model. - * - * @var string - */ + * The original name of the model. + * + * @var string + */ protected static $openAPIModelName = 'mtime_column_with_table_name'; /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ protected static $openAPITypes = [ 'table_name' => 'string', 'column_name' => 'string', @@ -63,12 +63,12 @@ class MtimeColumnWithTableName implements ModelInterface, ArrayAccess, \JsonSeri ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - * @phpstan-var array - * @psalm-var array - */ + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ protected static $openAPIFormats = [ 'table_name' => null, 'column_name' => null, @@ -77,10 +77,10 @@ class MtimeColumnWithTableName implements ModelInterface, ArrayAccess, \JsonSeri ]; /** - * Array of nullable properties. Used for (de)serialization - * - * @var boolean[] - */ + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ protected static array $openAPINullables = [ 'table_name' => false, 'column_name' => false, @@ -89,10 +89,10 @@ class MtimeColumnWithTableName implements ModelInterface, ArrayAccess, \JsonSeri ]; /** - * If a nullable field gets set to null, insert it here - * - * @var boolean[] - */ + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ protected array $openAPINullablesSetToNull = []; /** @@ -281,14 +281,14 @@ public function __construct(?array $data = null) } /** - * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName - * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the - * $this->openAPINullablesSetToNull array - * - * @param string $variableName - * @param array $fields - * @param mixed $defaultValue - */ + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ private function setIfExists(string $variableName, array $fields, $defaultValue): void { if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { diff --git a/lib/Base/MultipleSelectColumn.php b/lib/Base/MultipleSelectColumn.php index dfa278aa..237ba800 100644 --- a/lib/Base/MultipleSelectColumn.php +++ b/lib/Base/MultipleSelectColumn.php @@ -45,17 +45,17 @@ class MultipleSelectColumn implements ModelInterface, ArrayAccess, \JsonSerializ public const DISCRIMINATOR = null; /** - * The original name of the model. - * - * @var string - */ + * The original name of the model. + * + * @var string + */ protected static $openAPIModelName = 'multiple_select_column'; /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ protected static $openAPITypes = [ 'column_name' => 'string', 'column_type' => 'string', @@ -64,12 +64,12 @@ class MultipleSelectColumn implements ModelInterface, ArrayAccess, \JsonSerializ ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - * @phpstan-var array - * @psalm-var array - */ + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ protected static $openAPIFormats = [ 'column_name' => null, 'column_type' => null, @@ -78,10 +78,10 @@ class MultipleSelectColumn implements ModelInterface, ArrayAccess, \JsonSerializ ]; /** - * Array of nullable properties. Used for (de)serialization - * - * @var boolean[] - */ + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ protected static array $openAPINullables = [ 'column_name' => false, 'column_type' => false, @@ -90,10 +90,10 @@ class MultipleSelectColumn implements ModelInterface, ArrayAccess, \JsonSerializ ]; /** - * If a nullable field gets set to null, insert it here - * - * @var boolean[] - */ + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ protected array $openAPINullablesSetToNull = []; /** @@ -282,14 +282,14 @@ public function __construct(?array $data = null) } /** - * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName - * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the - * $this->openAPINullablesSetToNull array - * - * @param string $variableName - * @param array $fields - * @param mixed $defaultValue - */ + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ private function setIfExists(string $variableName, array $fields, $defaultValue): void { if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { diff --git a/lib/Base/MultipleSelectColumnWithTableName.php b/lib/Base/MultipleSelectColumnWithTableName.php index 5d6e5159..47b543e5 100644 --- a/lib/Base/MultipleSelectColumnWithTableName.php +++ b/lib/Base/MultipleSelectColumnWithTableName.php @@ -44,17 +44,17 @@ class MultipleSelectColumnWithTableName implements ModelInterface, ArrayAccess, public const DISCRIMINATOR = null; /** - * The original name of the model. - * - * @var string - */ + * The original name of the model. + * + * @var string + */ protected static $openAPIModelName = 'multiple_select_column_with_table_name'; /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ protected static $openAPITypes = [ 'table_name' => 'string', 'column_name' => 'string', @@ -64,12 +64,12 @@ class MultipleSelectColumnWithTableName implements ModelInterface, ArrayAccess, ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - * @phpstan-var array - * @psalm-var array - */ + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ protected static $openAPIFormats = [ 'table_name' => null, 'column_name' => null, @@ -79,10 +79,10 @@ class MultipleSelectColumnWithTableName implements ModelInterface, ArrayAccess, ]; /** - * Array of nullable properties. Used for (de)serialization - * - * @var boolean[] - */ + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ protected static array $openAPINullables = [ 'table_name' => false, 'column_name' => false, @@ -92,10 +92,10 @@ class MultipleSelectColumnWithTableName implements ModelInterface, ArrayAccess, ]; /** - * If a nullable field gets set to null, insert it here - * - * @var boolean[] - */ + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ protected array $openAPINullablesSetToNull = []; /** @@ -288,14 +288,14 @@ public function __construct(?array $data = null) } /** - * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName - * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the - * $this->openAPINullablesSetToNull array - * - * @param string $variableName - * @param array $fields - * @param mixed $defaultValue - */ + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ private function setIfExists(string $variableName, array $fields, $defaultValue): void { if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { diff --git a/lib/Base/NewView.php b/lib/Base/NewView.php index 4361a53d..fefa701b 100644 --- a/lib/Base/NewView.php +++ b/lib/Base/NewView.php @@ -44,17 +44,17 @@ class NewView implements ModelInterface, ArrayAccess, \JsonSerializable public const DISCRIMINATOR = null; /** - * The original name of the model. - * - * @var string - */ + * The original name of the model. + * + * @var string + */ protected static $openAPIModelName = 'new_view'; /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ protected static $openAPITypes = [ 'name' => 'string', 'type' => 'string', @@ -62,12 +62,12 @@ class NewView implements ModelInterface, ArrayAccess, \JsonSerializable ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - * @phpstan-var array - * @psalm-var array - */ + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ protected static $openAPIFormats = [ 'name' => null, 'type' => null, @@ -75,10 +75,10 @@ class NewView implements ModelInterface, ArrayAccess, \JsonSerializable ]; /** - * Array of nullable properties. Used for (de)serialization - * - * @var boolean[] - */ + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ protected static array $openAPINullables = [ 'name' => false, 'type' => false, @@ -86,10 +86,10 @@ class NewView implements ModelInterface, ArrayAccess, \JsonSerializable ]; /** - * If a nullable field gets set to null, insert it here - * - * @var boolean[] - */ + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ protected array $openAPINullablesSetToNull = []; /** @@ -278,14 +278,14 @@ public function __construct(?array $data = null) } /** - * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName - * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the - * $this->openAPINullablesSetToNull array - * - * @param string $variableName - * @param array $fields - * @param mixed $defaultValue - */ + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ private function setIfExists(string $variableName, array $fields, $defaultValue): void { if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { diff --git a/lib/Base/NotificationsApi.php b/lib/Base/NotificationsApi.php index ffc7d3f2..49240dcb 100644 --- a/lib/Base/NotificationsApi.php +++ b/lib/Base/NotificationsApi.php @@ -28,11 +28,11 @@ use GuzzleHttp\Client; use GuzzleHttp\ClientInterface; -use GuzzleHttp\Exception\ConnectException; use GuzzleHttp\Exception\RequestException; use GuzzleHttp\Psr7\MultipartStream; use GuzzleHttp\Psr7\Request; use GuzzleHttp\RequestOptions; +use Psr\Http\Client\NetworkExceptionInterface; use Psr\Http\Message\RequestInterface; use Psr\Http\Message\ResponseInterface; use SeaTable\Client\ApiException; @@ -175,13 +175,14 @@ public function deleteBaseNotificationsWithHttpInfo($base_uuid, string $contentT try { $response = $this->client->send($request, $options); } catch (RequestException $e) { + $eResponse = $this->getExceptionResponse($e); throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), - $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? (string) $e->getResponse()->getBody() : null + $eResponse ? $eResponse->getHeaders() : null, + $eResponse ? (string) $eResponse->getBody() : null ); - } catch (ConnectException $e) { + } catch (NetworkExceptionInterface $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), @@ -296,7 +297,15 @@ function ($response) use ($returnType) { ]; }, function ($exception) { - $response = $exception->getResponse(); + $response = $this->getExceptionResponse($exception); + if ($response === null) { + throw new ApiException( + "[{$exception->getCode()}] {$exception->getMessage()}", + (int) $exception->getCode(), + null, + null + ); + } $statusCode = $response->getStatusCode(); throw new ApiException( sprintf( @@ -347,7 +356,7 @@ public function deleteBaseNotificationsRequest($base_uuid, string $contentType = // path params if ($base_uuid !== null) { $resourcePath = str_replace( - '{' . 'base_uuid' . '}', + '{base_uuid}', ObjectSerializer::toPathValue($base_uuid), $resourcePath ); @@ -378,7 +387,11 @@ public function deleteBaseNotificationsRequest($base_uuid, string $contentType = } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + try { + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + } catch (\JsonException $e) { + throw new \InvalidArgumentException('json_encode error: ' . $e->getMessage(), 0, $e); + } } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -450,13 +463,14 @@ public function listBaseNotificationsWithHttpInfo($base_uuid, string $contentTyp try { $response = $this->client->send($request, $options); } catch (RequestException $e) { + $eResponse = $this->getExceptionResponse($e); throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), - $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? (string) $e->getResponse()->getBody() : null + $eResponse ? $eResponse->getHeaders() : null, + $eResponse ? (string) $eResponse->getBody() : null ); - } catch (ConnectException $e) { + } catch (NetworkExceptionInterface $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), @@ -571,7 +585,15 @@ function ($response) use ($returnType) { ]; }, function ($exception) { - $response = $exception->getResponse(); + $response = $this->getExceptionResponse($exception); + if ($response === null) { + throw new ApiException( + "[{$exception->getCode()}] {$exception->getMessage()}", + (int) $exception->getCode(), + null, + null + ); + } $statusCode = $response->getStatusCode(); throw new ApiException( sprintf( @@ -622,7 +644,7 @@ public function listBaseNotificationsRequest($base_uuid, string $contentType = s // path params if ($base_uuid !== null) { $resourcePath = str_replace( - '{' . 'base_uuid' . '}', + '{base_uuid}', ObjectSerializer::toPathValue($base_uuid), $resourcePath ); @@ -653,7 +675,11 @@ public function listBaseNotificationsRequest($base_uuid, string $contentType = s } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + try { + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + } catch (\JsonException $e) { + throw new \InvalidArgumentException('json_encode error: ' . $e->getMessage(), 0, $e); + } } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -729,13 +755,14 @@ public function markBaseNotificationAsSeenWithHttpInfo($base_uuid, $notification try { $response = $this->client->send($request, $options); } catch (RequestException $e) { + $eResponse = $this->getExceptionResponse($e); throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), - $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? (string) $e->getResponse()->getBody() : null + $eResponse ? $eResponse->getHeaders() : null, + $eResponse ? (string) $eResponse->getBody() : null ); - } catch (ConnectException $e) { + } catch (NetworkExceptionInterface $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), @@ -854,7 +881,15 @@ function ($response) use ($returnType) { ]; }, function ($exception) { - $response = $exception->getResponse(); + $response = $this->getExceptionResponse($exception); + if ($response === null) { + throw new ApiException( + "[{$exception->getCode()}] {$exception->getMessage()}", + (int) $exception->getCode(), + null, + null + ); + } $statusCode = $response->getStatusCode(); throw new ApiException( sprintf( @@ -918,7 +953,7 @@ public function markBaseNotificationAsSeenRequest($base_uuid, $notification_id, // path params if ($base_uuid !== null) { $resourcePath = str_replace( - '{' . 'base_uuid' . '}', + '{base_uuid}', ObjectSerializer::toPathValue($base_uuid), $resourcePath ); @@ -926,7 +961,7 @@ public function markBaseNotificationAsSeenRequest($base_uuid, $notification_id, // path params if ($notification_id !== null) { $resourcePath = str_replace( - '{' . 'notification_id' . '}', + '{notification_id}', ObjectSerializer::toPathValue($notification_id), $resourcePath ); @@ -966,7 +1001,11 @@ public function markBaseNotificationAsSeenRequest($base_uuid, $notification_id, } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + try { + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + } catch (\JsonException $e) { + throw new \InvalidArgumentException('json_encode error: ' . $e->getMessage(), 0, $e); + } } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -1040,13 +1079,14 @@ public function markBaseNotificationsAsSeenWithHttpInfo($base_uuid, $seen = null try { $response = $this->client->send($request, $options); } catch (RequestException $e) { + $eResponse = $this->getExceptionResponse($e); throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), - $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? (string) $e->getResponse()->getBody() : null + $eResponse ? $eResponse->getHeaders() : null, + $eResponse ? (string) $eResponse->getBody() : null ); - } catch (ConnectException $e) { + } catch (NetworkExceptionInterface $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), @@ -1163,7 +1203,15 @@ function ($response) use ($returnType) { ]; }, function ($exception) { - $response = $exception->getResponse(); + $response = $this->getExceptionResponse($exception); + if ($response === null) { + throw new ApiException( + "[{$exception->getCode()}] {$exception->getMessage()}", + (int) $exception->getCode(), + null, + null + ); + } $statusCode = $response->getStatusCode(); throw new ApiException( sprintf( @@ -1216,7 +1264,7 @@ public function markBaseNotificationsAsSeenRequest($base_uuid, $seen = null, str // path params if ($base_uuid !== null) { $resourcePath = str_replace( - '{' . 'base_uuid' . '}', + '{base_uuid}', ObjectSerializer::toPathValue($base_uuid), $resourcePath ); @@ -1256,7 +1304,11 @@ public function markBaseNotificationsAsSeenRequest($base_uuid, $seen = null, str } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + try { + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + } catch (\JsonException $e) { + throw new \InvalidArgumentException('json_encode error: ' . $e->getMessage(), 0, $e); + } } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -1330,13 +1382,14 @@ public function sendToastNotificationWithHttpInfo($base_uuid, $send_toast_notifi try { $response = $this->client->send($request, $options); } catch (RequestException $e) { + $eResponse = $this->getExceptionResponse($e); throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), - $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? (string) $e->getResponse()->getBody() : null + $eResponse ? $eResponse->getHeaders() : null, + $eResponse ? (string) $eResponse->getBody() : null ); - } catch (ConnectException $e) { + } catch (NetworkExceptionInterface $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), @@ -1453,7 +1506,15 @@ function ($response) use ($returnType) { ]; }, function ($exception) { - $response = $exception->getResponse(); + $response = $this->getExceptionResponse($exception); + if ($response === null) { + throw new ApiException( + "[{$exception->getCode()}] {$exception->getMessage()}", + (int) $exception->getCode(), + null, + null + ); + } $statusCode = $response->getStatusCode(); throw new ApiException( sprintf( @@ -1506,7 +1567,7 @@ public function sendToastNotificationRequest($base_uuid, $send_toast_notificatio // path params if ($base_uuid !== null) { $resourcePath = str_replace( - '{' . 'base_uuid' . '}', + '{base_uuid}', ObjectSerializer::toPathValue($base_uuid), $resourcePath ); @@ -1523,7 +1584,11 @@ public function sendToastNotificationRequest($base_uuid, $send_toast_notificatio if (isset($send_toast_notification_request)) { if (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the body - $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($send_toast_notification_request)); + try { + $httpBody = json_encode(ObjectSerializer::sanitizeForSerialization($send_toast_notification_request), JSON_THROW_ON_ERROR); + } catch (\JsonException $e) { + throw new \InvalidArgumentException('json_encode error: ' . $e->getMessage(), 0, $e); + } } else { $httpBody = $send_toast_notification_request; } @@ -1544,7 +1609,11 @@ public function sendToastNotificationRequest($base_uuid, $send_toast_notificatio } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + try { + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + } catch (\JsonException $e) { + throw new \InvalidArgumentException('json_encode error: ' . $e->getMessage(), 0, $e); + } } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -1604,6 +1673,21 @@ protected function createHttpClientOption() return $options; } + /** + * Returns the response attached to a Guzzle exception, if there is one. + * + * Guzzle 7 exposes getResponse() on RequestException, while Guzzle 8 only + * exposes it on ResponseException and its subclasses. + * + * @param \Throwable $exception + * + * @return ResponseInterface|null + */ + private function getExceptionResponse(\Throwable $exception): ?ResponseInterface + { + return method_exists($exception, 'getResponse') ? $exception->getResponse() : null; + } + private function handleResponseWithDataType( string $dataType, RequestInterface $request, diff --git a/lib/Base/NumberColumn.php b/lib/Base/NumberColumn.php index 3d2da169..a447ca94 100644 --- a/lib/Base/NumberColumn.php +++ b/lib/Base/NumberColumn.php @@ -45,17 +45,17 @@ class NumberColumn implements ModelInterface, ArrayAccess, \JsonSerializable public const DISCRIMINATOR = null; /** - * The original name of the model. - * - * @var string - */ + * The original name of the model. + * + * @var string + */ protected static $openAPIModelName = 'number_column'; /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ protected static $openAPITypes = [ 'column_name' => 'string', 'column_type' => 'string', @@ -64,12 +64,12 @@ class NumberColumn implements ModelInterface, ArrayAccess, \JsonSerializable ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - * @phpstan-var array - * @psalm-var array - */ + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ protected static $openAPIFormats = [ 'column_name' => null, 'column_type' => null, @@ -78,10 +78,10 @@ class NumberColumn implements ModelInterface, ArrayAccess, \JsonSerializable ]; /** - * Array of nullable properties. Used for (de)serialization - * - * @var boolean[] - */ + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ protected static array $openAPINullables = [ 'column_name' => false, 'column_type' => false, @@ -90,10 +90,10 @@ class NumberColumn implements ModelInterface, ArrayAccess, \JsonSerializable ]; /** - * If a nullable field gets set to null, insert it here - * - * @var boolean[] - */ + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ protected array $openAPINullablesSetToNull = []; /** @@ -282,14 +282,14 @@ public function __construct(?array $data = null) } /** - * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName - * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the - * $this->openAPINullablesSetToNull array - * - * @param string $variableName - * @param array $fields - * @param mixed $defaultValue - */ + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ private function setIfExists(string $variableName, array $fields, $defaultValue): void { if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { diff --git a/lib/Base/NumberColumnFormat.php b/lib/Base/NumberColumnFormat.php index 783fdf95..0d58d1f5 100644 --- a/lib/Base/NumberColumnFormat.php +++ b/lib/Base/NumberColumnFormat.php @@ -45,17 +45,17 @@ class NumberColumnFormat implements ModelInterface, ArrayAccess, \JsonSerializab public const DISCRIMINATOR = null; /** - * The original name of the model. - * - * @var string - */ + * The original name of the model. + * + * @var string + */ protected static $openAPIModelName = 'number_column_format'; /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ protected static $openAPITypes = [ 'format' => 'string', 'decimal' => 'string', @@ -63,12 +63,12 @@ class NumberColumnFormat implements ModelInterface, ArrayAccess, \JsonSerializab ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - * @phpstan-var array - * @psalm-var array - */ + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ protected static $openAPIFormats = [ 'format' => null, 'decimal' => null, @@ -76,10 +76,10 @@ class NumberColumnFormat implements ModelInterface, ArrayAccess, \JsonSerializab ]; /** - * Array of nullable properties. Used for (de)serialization - * - * @var boolean[] - */ + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ protected static array $openAPINullables = [ 'format' => false, 'decimal' => false, @@ -87,10 +87,10 @@ class NumberColumnFormat implements ModelInterface, ArrayAccess, \JsonSerializab ]; /** - * If a nullable field gets set to null, insert it here - * - * @var boolean[] - */ + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ protected array $openAPINullablesSetToNull = []; /** @@ -319,14 +319,14 @@ public function __construct(?array $data = null) } /** - * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName - * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the - * $this->openAPINullablesSetToNull array - * - * @param string $variableName - * @param array $fields - * @param mixed $defaultValue - */ + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ private function setIfExists(string $variableName, array $fields, $defaultValue): void { if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { diff --git a/lib/Base/NumberColumnWithTableName.php b/lib/Base/NumberColumnWithTableName.php index 18f1b0a1..56eb114c 100644 --- a/lib/Base/NumberColumnWithTableName.php +++ b/lib/Base/NumberColumnWithTableName.php @@ -44,17 +44,17 @@ class NumberColumnWithTableName implements ModelInterface, ArrayAccess, \JsonSer public const DISCRIMINATOR = null; /** - * The original name of the model. - * - * @var string - */ + * The original name of the model. + * + * @var string + */ protected static $openAPIModelName = 'number_column_with_table_name'; /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ protected static $openAPITypes = [ 'table_name' => 'string', 'column_name' => 'string', @@ -64,12 +64,12 @@ class NumberColumnWithTableName implements ModelInterface, ArrayAccess, \JsonSer ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - * @phpstan-var array - * @psalm-var array - */ + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ protected static $openAPIFormats = [ 'table_name' => null, 'column_name' => null, @@ -79,10 +79,10 @@ class NumberColumnWithTableName implements ModelInterface, ArrayAccess, \JsonSer ]; /** - * Array of nullable properties. Used for (de)serialization - * - * @var boolean[] - */ + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ protected static array $openAPINullables = [ 'table_name' => false, 'column_name' => false, @@ -92,10 +92,10 @@ class NumberColumnWithTableName implements ModelInterface, ArrayAccess, \JsonSer ]; /** - * If a nullable field gets set to null, insert it here - * - * @var boolean[] - */ + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ protected array $openAPINullablesSetToNull = []; /** @@ -288,14 +288,14 @@ public function __construct(?array $data = null) } /** - * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName - * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the - * $this->openAPINullablesSetToNull array - * - * @param string $variableName - * @param array $fields - * @param mixed $defaultValue - */ + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ private function setIfExists(string $variableName, array $fields, $defaultValue): void { if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { diff --git a/lib/Base/QuerySQL400Response.php b/lib/Base/QuerySQL400Response.php index cd50c683..67d008c5 100644 --- a/lib/Base/QuerySQL400Response.php +++ b/lib/Base/QuerySQL400Response.php @@ -44,46 +44,46 @@ class QuerySQL400Response implements ModelInterface, ArrayAccess, \JsonSerializa public const DISCRIMINATOR = null; /** - * The original name of the model. - * - * @var string - */ + * The original name of the model. + * + * @var string + */ protected static $openAPIModelName = 'querySQL_400_response'; /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ protected static $openAPITypes = [ 'error_message' => 'string' ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - * @phpstan-var array - * @psalm-var array - */ + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ protected static $openAPIFormats = [ 'error_message' => null ]; /** - * Array of nullable properties. Used for (de)serialization - * - * @var boolean[] - */ + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ protected static array $openAPINullables = [ 'error_message' => false ]; /** - * If a nullable field gets set to null, insert it here - * - * @var boolean[] - */ + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ protected array $openAPINullablesSetToNull = []; /** @@ -247,14 +247,14 @@ public function __construct(?array $data = null) } /** - * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName - * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the - * $this->openAPINullablesSetToNull array - * - * @param string $variableName - * @param array $fields - * @param mixed $defaultValue - */ + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ private function setIfExists(string $variableName, array $fields, $defaultValue): void { if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { diff --git a/lib/Base/RatingColumn.php b/lib/Base/RatingColumn.php index 3c2d268d..c468ab94 100644 --- a/lib/Base/RatingColumn.php +++ b/lib/Base/RatingColumn.php @@ -45,17 +45,17 @@ class RatingColumn implements ModelInterface, ArrayAccess, \JsonSerializable public const DISCRIMINATOR = null; /** - * The original name of the model. - * - * @var string - */ + * The original name of the model. + * + * @var string + */ protected static $openAPIModelName = 'rating_column'; /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ protected static $openAPITypes = [ 'column_name' => 'string', 'column_type' => 'string', @@ -64,12 +64,12 @@ class RatingColumn implements ModelInterface, ArrayAccess, \JsonSerializable ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - * @phpstan-var array - * @psalm-var array - */ + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ protected static $openAPIFormats = [ 'column_name' => null, 'column_type' => null, @@ -78,10 +78,10 @@ class RatingColumn implements ModelInterface, ArrayAccess, \JsonSerializable ]; /** - * Array of nullable properties. Used for (de)serialization - * - * @var boolean[] - */ + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ protected static array $openAPINullables = [ 'column_name' => false, 'column_type' => false, @@ -90,10 +90,10 @@ class RatingColumn implements ModelInterface, ArrayAccess, \JsonSerializable ]; /** - * If a nullable field gets set to null, insert it here - * - * @var boolean[] - */ + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ protected array $openAPINullablesSetToNull = []; /** @@ -282,14 +282,14 @@ public function __construct(?array $data = null) } /** - * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName - * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the - * $this->openAPINullablesSetToNull array - * - * @param string $variableName - * @param array $fields - * @param mixed $defaultValue - */ + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ private function setIfExists(string $variableName, array $fields, $defaultValue): void { if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { diff --git a/lib/Base/RatingColumnFormat.php b/lib/Base/RatingColumnFormat.php index 0fbb1684..3f648855 100644 --- a/lib/Base/RatingColumnFormat.php +++ b/lib/Base/RatingColumnFormat.php @@ -45,17 +45,17 @@ class RatingColumnFormat implements ModelInterface, ArrayAccess, \JsonSerializab public const DISCRIMINATOR = null; /** - * The original name of the model. - * - * @var string - */ + * The original name of the model. + * + * @var string + */ protected static $openAPIModelName = 'rating_column_format'; /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ protected static $openAPITypes = [ 'rate_max_number' => 'int', 'rate_style_color' => 'string', @@ -63,12 +63,12 @@ class RatingColumnFormat implements ModelInterface, ArrayAccess, \JsonSerializab ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - * @phpstan-var array - * @psalm-var array - */ + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ protected static $openAPIFormats = [ 'rate_max_number' => null, 'rate_style_color' => null, @@ -76,10 +76,10 @@ class RatingColumnFormat implements ModelInterface, ArrayAccess, \JsonSerializab ]; /** - * Array of nullable properties. Used for (de)serialization - * - * @var boolean[] - */ + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ protected static array $openAPINullables = [ 'rate_max_number' => false, 'rate_style_color' => false, @@ -87,10 +87,10 @@ class RatingColumnFormat implements ModelInterface, ArrayAccess, \JsonSerializab ]; /** - * If a nullable field gets set to null, insert it here - * - * @var boolean[] - */ + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ protected array $openAPINullablesSetToNull = []; /** @@ -281,14 +281,14 @@ public function __construct(?array $data = null) } /** - * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName - * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the - * $this->openAPINullablesSetToNull array - * - * @param string $variableName - * @param array $fields - * @param mixed $defaultValue - */ + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ private function setIfExists(string $variableName, array $fields, $defaultValue): void { if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { @@ -365,7 +365,6 @@ public function setRateMaxNumber($rate_max_number) if (is_null($rate_max_number)) { throw new \InvalidArgumentException('non-nullable rate_max_number cannot be null'); } - if (($rate_max_number > 10)) { throw new \InvalidArgumentException('invalid value for $rate_max_number when calling RatingColumnFormat., must be smaller than or equal to 10.'); } diff --git a/lib/Base/RatingColumnWithTableName.php b/lib/Base/RatingColumnWithTableName.php index 57927193..671afb83 100644 --- a/lib/Base/RatingColumnWithTableName.php +++ b/lib/Base/RatingColumnWithTableName.php @@ -44,17 +44,17 @@ class RatingColumnWithTableName implements ModelInterface, ArrayAccess, \JsonSer public const DISCRIMINATOR = null; /** - * The original name of the model. - * - * @var string - */ + * The original name of the model. + * + * @var string + */ protected static $openAPIModelName = 'rating_column_with_table_name'; /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ protected static $openAPITypes = [ 'table_name' => 'string', 'column_name' => 'string', @@ -64,12 +64,12 @@ class RatingColumnWithTableName implements ModelInterface, ArrayAccess, \JsonSer ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - * @phpstan-var array - * @psalm-var array - */ + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ protected static $openAPIFormats = [ 'table_name' => null, 'column_name' => null, @@ -79,10 +79,10 @@ class RatingColumnWithTableName implements ModelInterface, ArrayAccess, \JsonSer ]; /** - * Array of nullable properties. Used for (de)serialization - * - * @var boolean[] - */ + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ protected static array $openAPINullables = [ 'table_name' => false, 'column_name' => false, @@ -92,10 +92,10 @@ class RatingColumnWithTableName implements ModelInterface, ArrayAccess, \JsonSer ]; /** - * If a nullable field gets set to null, insert it here - * - * @var boolean[] - */ + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ protected array $openAPINullablesSetToNull = []; /** @@ -288,14 +288,14 @@ public function __construct(?array $data = null) } /** - * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName - * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the - * $this->openAPINullablesSetToNull array - * - * @param string $variableName - * @param array $fields - * @param mixed $defaultValue - */ + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ private function setIfExists(string $variableName, array $fields, $defaultValue): void { if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { diff --git a/lib/Base/RenameColumn.php b/lib/Base/RenameColumn.php index 0722ac9d..408ce04e 100644 --- a/lib/Base/RenameColumn.php +++ b/lib/Base/RenameColumn.php @@ -44,17 +44,17 @@ class RenameColumn implements ModelInterface, ArrayAccess, \JsonSerializable public const DISCRIMINATOR = null; /** - * The original name of the model. - * - * @var string - */ + * The original name of the model. + * + * @var string + */ protected static $openAPIModelName = 'rename_column'; /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ protected static $openAPITypes = [ 'op_type' => 'string', 'table_name' => 'string', @@ -63,12 +63,12 @@ class RenameColumn implements ModelInterface, ArrayAccess, \JsonSerializable ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - * @phpstan-var array - * @psalm-var array - */ + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ protected static $openAPIFormats = [ 'op_type' => null, 'table_name' => null, @@ -77,10 +77,10 @@ class RenameColumn implements ModelInterface, ArrayAccess, \JsonSerializable ]; /** - * Array of nullable properties. Used for (de)serialization - * - * @var boolean[] - */ + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ protected static array $openAPINullables = [ 'op_type' => false, 'table_name' => false, @@ -89,10 +89,10 @@ class RenameColumn implements ModelInterface, ArrayAccess, \JsonSerializable ]; /** - * If a nullable field gets set to null, insert it here - * - * @var boolean[] - */ + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ protected array $openAPINullablesSetToNull = []; /** @@ -281,14 +281,14 @@ public function __construct(?array $data = null) } /** - * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName - * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the - * $this->openAPINullablesSetToNull array - * - * @param string $variableName - * @param array $fields - * @param mixed $defaultValue - */ + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ private function setIfExists(string $variableName, array $fields, $defaultValue): void { if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { diff --git a/lib/Base/RenameTable.php b/lib/Base/RenameTable.php index 7d853db2..3e5c22fa 100644 --- a/lib/Base/RenameTable.php +++ b/lib/Base/RenameTable.php @@ -45,49 +45,49 @@ class RenameTable implements ModelInterface, ArrayAccess, \JsonSerializable public const DISCRIMINATOR = null; /** - * The original name of the model. - * - * @var string - */ + * The original name of the model. + * + * @var string + */ protected static $openAPIModelName = 'rename_table'; /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ protected static $openAPITypes = [ 'table_name' => 'string', 'new_table_name' => 'string' ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - * @phpstan-var array - * @psalm-var array - */ + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ protected static $openAPIFormats = [ 'table_name' => null, 'new_table_name' => null ]; /** - * Array of nullable properties. Used for (de)serialization - * - * @var boolean[] - */ + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ protected static array $openAPINullables = [ 'table_name' => false, 'new_table_name' => false ]; /** - * If a nullable field gets set to null, insert it here - * - * @var boolean[] - */ + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ protected array $openAPINullablesSetToNull = []; /** @@ -255,14 +255,14 @@ public function __construct(?array $data = null) } /** - * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName - * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the - * $this->openAPINullablesSetToNull array - * - * @param string $variableName - * @param array $fields - * @param mixed $defaultValue - */ + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ private function setIfExists(string $variableName, array $fields, $defaultValue): void { if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { diff --git a/lib/Base/ResizeColumn.php b/lib/Base/ResizeColumn.php index 55960fd5..574c43e9 100644 --- a/lib/Base/ResizeColumn.php +++ b/lib/Base/ResizeColumn.php @@ -44,17 +44,17 @@ class ResizeColumn implements ModelInterface, ArrayAccess, \JsonSerializable public const DISCRIMINATOR = null; /** - * The original name of the model. - * - * @var string - */ + * The original name of the model. + * + * @var string + */ protected static $openAPIModelName = 'resize_column'; /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ protected static $openAPITypes = [ 'op_type' => 'string', 'table_name' => 'string', @@ -63,12 +63,12 @@ class ResizeColumn implements ModelInterface, ArrayAccess, \JsonSerializable ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - * @phpstan-var array - * @psalm-var array - */ + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ protected static $openAPIFormats = [ 'op_type' => null, 'table_name' => null, @@ -77,10 +77,10 @@ class ResizeColumn implements ModelInterface, ArrayAccess, \JsonSerializable ]; /** - * Array of nullable properties. Used for (de)serialization - * - * @var boolean[] - */ + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ protected static array $openAPINullables = [ 'op_type' => false, 'table_name' => false, @@ -89,10 +89,10 @@ class ResizeColumn implements ModelInterface, ArrayAccess, \JsonSerializable ]; /** - * If a nullable field gets set to null, insert it here - * - * @var boolean[] - */ + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ protected array $openAPINullablesSetToNull = []; /** @@ -281,14 +281,14 @@ public function __construct(?array $data = null) } /** - * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName - * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the - * $this->openAPINullablesSetToNull array - * - * @param string $variableName - * @param array $fields - * @param mixed $defaultValue - */ + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ private function setIfExists(string $variableName, array $fields, $defaultValue): void { if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { diff --git a/lib/Base/RowCommentsApi.php b/lib/Base/RowCommentsApi.php index 5416058d..41342f4a 100644 --- a/lib/Base/RowCommentsApi.php +++ b/lib/Base/RowCommentsApi.php @@ -28,11 +28,11 @@ use GuzzleHttp\Client; use GuzzleHttp\ClientInterface; -use GuzzleHttp\Exception\ConnectException; use GuzzleHttp\Exception\RequestException; use GuzzleHttp\Psr7\MultipartStream; use GuzzleHttp\Psr7\Request; use GuzzleHttp\RequestOptions; +use Psr\Http\Client\NetworkExceptionInterface; use Psr\Http\Message\RequestInterface; use Psr\Http\Message\ResponseInterface; use SeaTable\Client\ApiException; @@ -187,13 +187,14 @@ public function createRowCommentWithHttpInfo($base_uuid, $table_id, $row_id, $cr try { $response = $this->client->send($request, $options); } catch (RequestException $e) { + $eResponse = $this->getExceptionResponse($e); throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), - $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? (string) $e->getResponse()->getBody() : null + $eResponse ? $eResponse->getHeaders() : null, + $eResponse ? (string) $eResponse->getBody() : null ); - } catch (ConnectException $e) { + } catch (NetworkExceptionInterface $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), @@ -314,7 +315,15 @@ function ($response) use ($returnType) { ]; }, function ($exception) { - $response = $exception->getResponse(); + $response = $this->getExceptionResponse($exception); + if ($response === null) { + throw new ApiException( + "[{$exception->getCode()}] {$exception->getMessage()}", + (int) $exception->getCode(), + null, + null + ); + } $statusCode = $response->getStatusCode(); throw new ApiException( sprintf( @@ -407,7 +416,7 @@ public function createRowCommentRequest($base_uuid, $table_id, $row_id, $create_ // path params if ($base_uuid !== null) { $resourcePath = str_replace( - '{' . 'base_uuid' . '}', + '{base_uuid}', ObjectSerializer::toPathValue($base_uuid), $resourcePath ); @@ -424,7 +433,11 @@ public function createRowCommentRequest($base_uuid, $table_id, $row_id, $create_ if (isset($create_row_comment)) { if (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the body - $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($create_row_comment)); + try { + $httpBody = json_encode(ObjectSerializer::sanitizeForSerialization($create_row_comment), JSON_THROW_ON_ERROR); + } catch (\JsonException $e) { + throw new \InvalidArgumentException('json_encode error: ' . $e->getMessage(), 0, $e); + } } else { $httpBody = $create_row_comment; } @@ -445,7 +458,11 @@ public function createRowCommentRequest($base_uuid, $table_id, $row_id, $create_ } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + try { + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + } catch (\JsonException $e) { + throw new \InvalidArgumentException('json_encode error: ' . $e->getMessage(), 0, $e); + } } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -519,13 +536,14 @@ public function deleteCommentWithHttpInfo($base_uuid, $comment_id, string $conte try { $response = $this->client->send($request, $options); } catch (RequestException $e) { + $eResponse = $this->getExceptionResponse($e); throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), - $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? (string) $e->getResponse()->getBody() : null + $eResponse ? $eResponse->getHeaders() : null, + $eResponse ? (string) $eResponse->getBody() : null ); - } catch (ConnectException $e) { + } catch (NetworkExceptionInterface $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), @@ -642,7 +660,15 @@ function ($response) use ($returnType) { ]; }, function ($exception) { - $response = $exception->getResponse(); + $response = $this->getExceptionResponse($exception); + if ($response === null) { + throw new ApiException( + "[{$exception->getCode()}] {$exception->getMessage()}", + (int) $exception->getCode(), + null, + null + ); + } $statusCode = $response->getStatusCode(); throw new ApiException( sprintf( @@ -704,7 +730,7 @@ public function deleteCommentRequest($base_uuid, $comment_id, string $contentTyp // path params if ($base_uuid !== null) { $resourcePath = str_replace( - '{' . 'base_uuid' . '}', + '{base_uuid}', ObjectSerializer::toPathValue($base_uuid), $resourcePath ); @@ -712,7 +738,7 @@ public function deleteCommentRequest($base_uuid, $comment_id, string $contentTyp // path params if ($comment_id !== null) { $resourcePath = str_replace( - '{' . 'comment_id' . '}', + '{comment_id}', ObjectSerializer::toPathValue($comment_id), $resourcePath ); @@ -743,7 +769,11 @@ public function deleteCommentRequest($base_uuid, $comment_id, string $contentTyp } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + try { + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + } catch (\JsonException $e) { + throw new \InvalidArgumentException('json_encode error: ' . $e->getMessage(), 0, $e); + } } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -817,13 +847,14 @@ public function getCommentWithHttpInfo($base_uuid, $comment_id, string $contentT try { $response = $this->client->send($request, $options); } catch (RequestException $e) { + $eResponse = $this->getExceptionResponse($e); throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), - $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? (string) $e->getResponse()->getBody() : null + $eResponse ? $eResponse->getHeaders() : null, + $eResponse ? (string) $eResponse->getBody() : null ); - } catch (ConnectException $e) { + } catch (NetworkExceptionInterface $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), @@ -940,7 +971,15 @@ function ($response) use ($returnType) { ]; }, function ($exception) { - $response = $exception->getResponse(); + $response = $this->getExceptionResponse($exception); + if ($response === null) { + throw new ApiException( + "[{$exception->getCode()}] {$exception->getMessage()}", + (int) $exception->getCode(), + null, + null + ); + } $statusCode = $response->getStatusCode(); throw new ApiException( sprintf( @@ -1002,7 +1041,7 @@ public function getCommentRequest($base_uuid, $comment_id, string $contentType = // path params if ($base_uuid !== null) { $resourcePath = str_replace( - '{' . 'base_uuid' . '}', + '{base_uuid}', ObjectSerializer::toPathValue($base_uuid), $resourcePath ); @@ -1010,7 +1049,7 @@ public function getCommentRequest($base_uuid, $comment_id, string $contentType = // path params if ($comment_id !== null) { $resourcePath = str_replace( - '{' . 'comment_id' . '}', + '{comment_id}', ObjectSerializer::toPathValue($comment_id), $resourcePath ); @@ -1041,7 +1080,11 @@ public function getCommentRequest($base_uuid, $comment_id, string $contentType = } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + try { + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + } catch (\JsonException $e) { + throw new \InvalidArgumentException('json_encode error: ' . $e->getMessage(), 0, $e); + } } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -1113,13 +1156,14 @@ public function getNumberOfCommentsWithHttpInfo($base_uuid, string $contentType try { $response = $this->client->send($request, $options); } catch (RequestException $e) { + $eResponse = $this->getExceptionResponse($e); throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), - $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? (string) $e->getResponse()->getBody() : null + $eResponse ? $eResponse->getHeaders() : null, + $eResponse ? (string) $eResponse->getBody() : null ); - } catch (ConnectException $e) { + } catch (NetworkExceptionInterface $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), @@ -1234,7 +1278,15 @@ function ($response) use ($returnType) { ]; }, function ($exception) { - $response = $exception->getResponse(); + $response = $this->getExceptionResponse($exception); + if ($response === null) { + throw new ApiException( + "[{$exception->getCode()}] {$exception->getMessage()}", + (int) $exception->getCode(), + null, + null + ); + } $statusCode = $response->getStatusCode(); throw new ApiException( sprintf( @@ -1285,7 +1337,7 @@ public function getNumberOfCommentsRequest($base_uuid, string $contentType = sel // path params if ($base_uuid !== null) { $resourcePath = str_replace( - '{' . 'base_uuid' . '}', + '{base_uuid}', ObjectSerializer::toPathValue($base_uuid), $resourcePath ); @@ -1316,7 +1368,11 @@ public function getNumberOfCommentsRequest($base_uuid, string $contentType = sel } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + try { + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + } catch (\JsonException $e) { + throw new \InvalidArgumentException('json_encode error: ' . $e->getMessage(), 0, $e); + } } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -1390,13 +1446,14 @@ public function getRowCommentsCountWithHttpInfo($base_uuid, $row_id, string $con try { $response = $this->client->send($request, $options); } catch (RequestException $e) { + $eResponse = $this->getExceptionResponse($e); throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), - $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? (string) $e->getResponse()->getBody() : null + $eResponse ? $eResponse->getHeaders() : null, + $eResponse ? (string) $eResponse->getBody() : null ); - } catch (ConnectException $e) { + } catch (NetworkExceptionInterface $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), @@ -1513,7 +1570,15 @@ function ($response) use ($returnType) { ]; }, function ($exception) { - $response = $exception->getResponse(); + $response = $this->getExceptionResponse($exception); + if ($response === null) { + throw new ApiException( + "[{$exception->getCode()}] {$exception->getMessage()}", + (int) $exception->getCode(), + null, + null + ); + } $statusCode = $response->getStatusCode(); throw new ApiException( sprintf( @@ -1584,7 +1649,7 @@ public function getRowCommentsCountRequest($base_uuid, $row_id, string $contentT // path params if ($base_uuid !== null) { $resourcePath = str_replace( - '{' . 'base_uuid' . '}', + '{base_uuid}', ObjectSerializer::toPathValue($base_uuid), $resourcePath ); @@ -1615,7 +1680,11 @@ public function getRowCommentsCountRequest($base_uuid, $row_id, string $contentT } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + try { + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + } catch (\JsonException $e) { + throw new \InvalidArgumentException('json_encode error: ' . $e->getMessage(), 0, $e); + } } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -1689,13 +1758,14 @@ public function listCommentsWithinDaysWithHttpInfo($base_uuid, $days = null, str try { $response = $this->client->send($request, $options); } catch (RequestException $e) { + $eResponse = $this->getExceptionResponse($e); throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), - $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? (string) $e->getResponse()->getBody() : null + $eResponse ? $eResponse->getHeaders() : null, + $eResponse ? (string) $eResponse->getBody() : null ); - } catch (ConnectException $e) { + } catch (NetworkExceptionInterface $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), @@ -1812,7 +1882,15 @@ function ($response) use ($returnType) { ]; }, function ($exception) { - $response = $exception->getResponse(); + $response = $this->getExceptionResponse($exception); + if ($response === null) { + throw new ApiException( + "[{$exception->getCode()}] {$exception->getMessage()}", + (int) $exception->getCode(), + null, + null + ); + } $statusCode = $response->getStatusCode(); throw new ApiException( sprintf( @@ -1877,7 +1955,7 @@ public function listCommentsWithinDaysRequest($base_uuid, $days = null, string $ // path params if ($base_uuid !== null) { $resourcePath = str_replace( - '{' . 'base_uuid' . '}', + '{base_uuid}', ObjectSerializer::toPathValue($base_uuid), $resourcePath ); @@ -1908,7 +1986,11 @@ public function listCommentsWithinDaysRequest($base_uuid, $days = null, string $ } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + try { + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + } catch (\JsonException $e) { + throw new \InvalidArgumentException('json_encode error: ' . $e->getMessage(), 0, $e); + } } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -1982,13 +2064,14 @@ public function listRowCommentsWithHttpInfo($base_uuid, $row_id, string $content try { $response = $this->client->send($request, $options); } catch (RequestException $e) { + $eResponse = $this->getExceptionResponse($e); throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), - $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? (string) $e->getResponse()->getBody() : null + $eResponse ? $eResponse->getHeaders() : null, + $eResponse ? (string) $eResponse->getBody() : null ); - } catch (ConnectException $e) { + } catch (NetworkExceptionInterface $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), @@ -2105,7 +2188,15 @@ function ($response) use ($returnType) { ]; }, function ($exception) { - $response = $exception->getResponse(); + $response = $this->getExceptionResponse($exception); + if ($response === null) { + throw new ApiException( + "[{$exception->getCode()}] {$exception->getMessage()}", + (int) $exception->getCode(), + null, + null + ); + } $statusCode = $response->getStatusCode(); throw new ApiException( sprintf( @@ -2176,7 +2267,7 @@ public function listRowCommentsRequest($base_uuid, $row_id, string $contentType // path params if ($base_uuid !== null) { $resourcePath = str_replace( - '{' . 'base_uuid' . '}', + '{base_uuid}', ObjectSerializer::toPathValue($base_uuid), $resourcePath ); @@ -2207,7 +2298,11 @@ public function listRowCommentsRequest($base_uuid, $row_id, string $contentType } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + try { + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + } catch (\JsonException $e) { + throw new \InvalidArgumentException('json_encode error: ' . $e->getMessage(), 0, $e); + } } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -2267,6 +2362,21 @@ protected function createHttpClientOption() return $options; } + /** + * Returns the response attached to a Guzzle exception, if there is one. + * + * Guzzle 7 exposes getResponse() on RequestException, while Guzzle 8 only + * exposes it on ResponseException and its subclasses. + * + * @param \Throwable $exception + * + * @return ResponseInterface|null + */ + private function getExceptionResponse(\Throwable $exception): ?ResponseInterface + { + return method_exists($exception, 'getResponse') ? $exception->getResponse() : null; + } + private function handleResponseWithDataType( string $dataType, RequestInterface $request, diff --git a/lib/Base/RowLinkCreateUpdateDelete.php b/lib/Base/RowLinkCreateUpdateDelete.php index aab7eaba..f0bcef00 100644 --- a/lib/Base/RowLinkCreateUpdateDelete.php +++ b/lib/Base/RowLinkCreateUpdateDelete.php @@ -44,17 +44,17 @@ class RowLinkCreateUpdateDelete implements ModelInterface, ArrayAccess, \JsonSer public const DISCRIMINATOR = null; /** - * The original name of the model. - * - * @var string - */ + * The original name of the model. + * + * @var string + */ protected static $openAPIModelName = 'row_link_create_update_delete'; /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ protected static $openAPITypes = [ 'table_id' => 'string', 'other_table_id' => 'string', @@ -63,12 +63,12 @@ class RowLinkCreateUpdateDelete implements ModelInterface, ArrayAccess, \JsonSer ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - * @phpstan-var array - * @psalm-var array - */ + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ protected static $openAPIFormats = [ 'table_id' => null, 'other_table_id' => null, @@ -77,10 +77,10 @@ class RowLinkCreateUpdateDelete implements ModelInterface, ArrayAccess, \JsonSer ]; /** - * Array of nullable properties. Used for (de)serialization - * - * @var boolean[] - */ + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ protected static array $openAPINullables = [ 'table_id' => false, 'other_table_id' => false, @@ -89,10 +89,10 @@ class RowLinkCreateUpdateDelete implements ModelInterface, ArrayAccess, \JsonSer ]; /** - * If a nullable field gets set to null, insert it here - * - * @var boolean[] - */ + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ protected array $openAPINullablesSetToNull = []; /** @@ -268,14 +268,14 @@ public function __construct(?array $data = null) } /** - * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName - * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the - * $this->openAPINullablesSetToNull array - * - * @param string $variableName - * @param array $fields - * @param mixed $defaultValue - */ + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ private function setIfExists(string $variableName, array $fields, $defaultValue): void { if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { diff --git a/lib/Base/Rows.php b/lib/Base/Rows.php index 3a4fe1e7..5c839790 100644 --- a/lib/Base/Rows.php +++ b/lib/Base/Rows.php @@ -45,46 +45,46 @@ class Rows implements ModelInterface, ArrayAccess, \JsonSerializable public const DISCRIMINATOR = null; /** - * The original name of the model. - * - * @var string - */ + * The original name of the model. + * + * @var string + */ protected static $openAPIModelName = 'rows'; /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ protected static $openAPITypes = [ 'rows' => 'object[]' ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - * @phpstan-var array - * @psalm-var array - */ + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ protected static $openAPIFormats = [ 'rows' => null ]; /** - * Array of nullable properties. Used for (de)serialization - * - * @var boolean[] - */ + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ protected static array $openAPINullables = [ 'rows' => false ]; /** - * If a nullable field gets set to null, insert it here - * - * @var boolean[] - */ + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ protected array $openAPINullablesSetToNull = []; /** @@ -248,14 +248,14 @@ public function __construct(?array $data = null) } /** - * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName - * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the - * $this->openAPINullablesSetToNull array - * - * @param string $variableName - * @param array $fields - * @param mixed $defaultValue - */ + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ private function setIfExists(string $variableName, array $fields, $defaultValue): void { if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { diff --git a/lib/Base/RowsApi.php b/lib/Base/RowsApi.php index 8c250286..8db7adc9 100644 --- a/lib/Base/RowsApi.php +++ b/lib/Base/RowsApi.php @@ -28,11 +28,11 @@ use GuzzleHttp\Client; use GuzzleHttp\ClientInterface; -use GuzzleHttp\Exception\ConnectException; use GuzzleHttp\Exception\RequestException; use GuzzleHttp\Psr7\MultipartStream; use GuzzleHttp\Psr7\Request; use GuzzleHttp\RequestOptions; +use Psr\Http\Client\NetworkExceptionInterface; use Psr\Http\Message\RequestInterface; use Psr\Http\Message\ResponseInterface; use SeaTable\Client\ApiException; @@ -186,13 +186,14 @@ public function appendRowsWithHttpInfo($base_uuid, $append_rows = null, string $ try { $response = $this->client->send($request, $options); } catch (RequestException $e) { + $eResponse = $this->getExceptionResponse($e); throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), - $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? (string) $e->getResponse()->getBody() : null + $eResponse ? $eResponse->getHeaders() : null, + $eResponse ? (string) $eResponse->getBody() : null ); - } catch (ConnectException $e) { + } catch (NetworkExceptionInterface $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), @@ -323,7 +324,15 @@ function ($response) use ($returnType) { ]; }, function ($exception) { - $response = $exception->getResponse(); + $response = $this->getExceptionResponse($exception); + if ($response === null) { + throw new ApiException( + "[{$exception->getCode()}] {$exception->getMessage()}", + (int) $exception->getCode(), + null, + null + ); + } $statusCode = $response->getStatusCode(); throw new ApiException( sprintf( @@ -376,7 +385,7 @@ public function appendRowsRequest($base_uuid, $append_rows = null, string $conte // path params if ($base_uuid !== null) { $resourcePath = str_replace( - '{' . 'base_uuid' . '}', + '{base_uuid}', ObjectSerializer::toPathValue($base_uuid), $resourcePath ); @@ -393,7 +402,11 @@ public function appendRowsRequest($base_uuid, $append_rows = null, string $conte if (isset($append_rows)) { if (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the body - $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($append_rows)); + try { + $httpBody = json_encode(ObjectSerializer::sanitizeForSerialization($append_rows), JSON_THROW_ON_ERROR); + } catch (\JsonException $e) { + throw new \InvalidArgumentException('json_encode error: ' . $e->getMessage(), 0, $e); + } } else { $httpBody = $append_rows; } @@ -414,7 +427,11 @@ public function appendRowsRequest($base_uuid, $append_rows = null, string $conte } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + try { + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + } catch (\JsonException $e) { + throw new \InvalidArgumentException('json_encode error: ' . $e->getMessage(), 0, $e); + } } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -488,13 +505,14 @@ public function deleteRowWithHttpInfo($base_uuid, $delete_rows = null, string $c try { $response = $this->client->send($request, $options); } catch (RequestException $e) { + $eResponse = $this->getExceptionResponse($e); throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), - $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? (string) $e->getResponse()->getBody() : null + $eResponse ? $eResponse->getHeaders() : null, + $eResponse ? (string) $eResponse->getBody() : null ); - } catch (ConnectException $e) { + } catch (NetworkExceptionInterface $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), @@ -625,7 +643,15 @@ function ($response) use ($returnType) { ]; }, function ($exception) { - $response = $exception->getResponse(); + $response = $this->getExceptionResponse($exception); + if ($response === null) { + throw new ApiException( + "[{$exception->getCode()}] {$exception->getMessage()}", + (int) $exception->getCode(), + null, + null + ); + } $statusCode = $response->getStatusCode(); throw new ApiException( sprintf( @@ -678,7 +704,7 @@ public function deleteRowRequest($base_uuid, $delete_rows = null, string $conten // path params if ($base_uuid !== null) { $resourcePath = str_replace( - '{' . 'base_uuid' . '}', + '{base_uuid}', ObjectSerializer::toPathValue($base_uuid), $resourcePath ); @@ -695,7 +721,11 @@ public function deleteRowRequest($base_uuid, $delete_rows = null, string $conten if (isset($delete_rows)) { if (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the body - $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($delete_rows)); + try { + $httpBody = json_encode(ObjectSerializer::sanitizeForSerialization($delete_rows), JSON_THROW_ON_ERROR); + } catch (\JsonException $e) { + throw new \InvalidArgumentException('json_encode error: ' . $e->getMessage(), 0, $e); + } } else { $httpBody = $delete_rows; } @@ -716,7 +746,11 @@ public function deleteRowRequest($base_uuid, $delete_rows = null, string $conten } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + try { + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + } catch (\JsonException $e) { + throw new \InvalidArgumentException('json_encode error: ' . $e->getMessage(), 0, $e); + } } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -794,13 +828,14 @@ public function getRowWithHttpInfo($base_uuid, $row_id, $table_name, $convert_ke try { $response = $this->client->send($request, $options); } catch (RequestException $e) { + $eResponse = $this->getExceptionResponse($e); throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), - $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? (string) $e->getResponse()->getBody() : null + $eResponse ? $eResponse->getHeaders() : null, + $eResponse ? (string) $eResponse->getBody() : null ); - } catch (ConnectException $e) { + } catch (NetworkExceptionInterface $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), @@ -949,7 +984,15 @@ function ($response) use ($returnType) { ]; }, function ($exception) { - $response = $exception->getResponse(); + $response = $this->getExceptionResponse($exception); + if ($response === null) { + throw new ApiException( + "[{$exception->getCode()}] {$exception->getMessage()}", + (int) $exception->getCode(), + null, + null + ); + } $statusCode = $response->getStatusCode(); throw new ApiException( sprintf( @@ -1039,7 +1082,7 @@ public function getRowRequest($base_uuid, $row_id, $table_name, $convert_keys = // path params if ($base_uuid !== null) { $resourcePath = str_replace( - '{' . 'base_uuid' . '}', + '{base_uuid}', ObjectSerializer::toPathValue($base_uuid), $resourcePath ); @@ -1047,7 +1090,7 @@ public function getRowRequest($base_uuid, $row_id, $table_name, $convert_keys = // path params if ($row_id !== null) { $resourcePath = str_replace( - '{' . 'row_id' . '}', + '{row_id}', ObjectSerializer::toPathValue($row_id), $resourcePath ); @@ -1078,7 +1121,11 @@ public function getRowRequest($base_uuid, $row_id, $table_name, $convert_keys = } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + try { + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + } catch (\JsonException $e) { + throw new \InvalidArgumentException('json_encode error: ' . $e->getMessage(), 0, $e); + } } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -1160,13 +1207,14 @@ public function listRowsWithHttpInfo($base_uuid, $table_name, $view_name = null, try { $response = $this->client->send($request, $options); } catch (RequestException $e) { + $eResponse = $this->getExceptionResponse($e); throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), - $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? (string) $e->getResponse()->getBody() : null + $eResponse ? $eResponse->getHeaders() : null, + $eResponse ? (string) $eResponse->getBody() : null ); - } catch (ConnectException $e) { + } catch (NetworkExceptionInterface $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), @@ -1291,7 +1339,15 @@ function ($response) use ($returnType) { ]; }, function ($exception) { - $response = $exception->getResponse(); + $response = $this->getExceptionResponse($exception); + if ($response === null) { + throw new ApiException( + "[{$exception->getCode()}] {$exception->getMessage()}", + (int) $exception->getCode(), + null, + null + ); + } $statusCode = $response->getStatusCode(); throw new ApiException( sprintf( @@ -1409,7 +1465,7 @@ public function listRowsRequest($base_uuid, $table_name, $view_name = null, $sta // path params if ($base_uuid !== null) { $resourcePath = str_replace( - '{' . 'base_uuid' . '}', + '{base_uuid}', ObjectSerializer::toPathValue($base_uuid), $resourcePath ); @@ -1440,7 +1496,11 @@ public function listRowsRequest($base_uuid, $table_name, $view_name = null, $sta } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + try { + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + } catch (\JsonException $e) { + throw new \InvalidArgumentException('json_encode error: ' . $e->getMessage(), 0, $e); + } } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -1514,13 +1574,14 @@ public function lockRowsWithHttpInfo($base_uuid, $table_with_row_ids = null, str try { $response = $this->client->send($request, $options); } catch (RequestException $e) { + $eResponse = $this->getExceptionResponse($e); throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), - $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? (string) $e->getResponse()->getBody() : null + $eResponse ? $eResponse->getHeaders() : null, + $eResponse ? (string) $eResponse->getBody() : null ); - } catch (ConnectException $e) { + } catch (NetworkExceptionInterface $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), @@ -1637,7 +1698,15 @@ function ($response) use ($returnType) { ]; }, function ($exception) { - $response = $exception->getResponse(); + $response = $this->getExceptionResponse($exception); + if ($response === null) { + throw new ApiException( + "[{$exception->getCode()}] {$exception->getMessage()}", + (int) $exception->getCode(), + null, + null + ); + } $statusCode = $response->getStatusCode(); throw new ApiException( sprintf( @@ -1690,7 +1759,7 @@ public function lockRowsRequest($base_uuid, $table_with_row_ids = null, string $ // path params if ($base_uuid !== null) { $resourcePath = str_replace( - '{' . 'base_uuid' . '}', + '{base_uuid}', ObjectSerializer::toPathValue($base_uuid), $resourcePath ); @@ -1707,7 +1776,11 @@ public function lockRowsRequest($base_uuid, $table_with_row_ids = null, string $ if (isset($table_with_row_ids)) { if (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the body - $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($table_with_row_ids)); + try { + $httpBody = json_encode(ObjectSerializer::sanitizeForSerialization($table_with_row_ids), JSON_THROW_ON_ERROR); + } catch (\JsonException $e) { + throw new \InvalidArgumentException('json_encode error: ' . $e->getMessage(), 0, $e); + } } else { $httpBody = $table_with_row_ids; } @@ -1728,7 +1801,11 @@ public function lockRowsRequest($base_uuid, $table_with_row_ids = null, string $ } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + try { + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + } catch (\JsonException $e) { + throw new \InvalidArgumentException('json_encode error: ' . $e->getMessage(), 0, $e); + } } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -1802,13 +1879,14 @@ public function querySQLWithHttpInfo($base_uuid, $sql_query = null, string $cont try { $response = $this->client->send($request, $options); } catch (RequestException $e) { + $eResponse = $this->getExceptionResponse($e); throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), - $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? (string) $e->getResponse()->getBody() : null + $eResponse ? $eResponse->getHeaders() : null, + $eResponse ? (string) $eResponse->getBody() : null ); - } catch (ConnectException $e) { + } catch (NetworkExceptionInterface $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), @@ -1939,7 +2017,15 @@ function ($response) use ($returnType) { ]; }, function ($exception) { - $response = $exception->getResponse(); + $response = $this->getExceptionResponse($exception); + if ($response === null) { + throw new ApiException( + "[{$exception->getCode()}] {$exception->getMessage()}", + (int) $exception->getCode(), + null, + null + ); + } $statusCode = $response->getStatusCode(); throw new ApiException( sprintf( @@ -1992,7 +2078,7 @@ public function querySQLRequest($base_uuid, $sql_query = null, string $contentTy // path params if ($base_uuid !== null) { $resourcePath = str_replace( - '{' . 'base_uuid' . '}', + '{base_uuid}', ObjectSerializer::toPathValue($base_uuid), $resourcePath ); @@ -2009,7 +2095,11 @@ public function querySQLRequest($base_uuid, $sql_query = null, string $contentTy if (isset($sql_query)) { if (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the body - $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($sql_query)); + try { + $httpBody = json_encode(ObjectSerializer::sanitizeForSerialization($sql_query), JSON_THROW_ON_ERROR); + } catch (\JsonException $e) { + throw new \InvalidArgumentException('json_encode error: ' . $e->getMessage(), 0, $e); + } } else { $httpBody = $sql_query; } @@ -2030,7 +2120,11 @@ public function querySQLRequest($base_uuid, $sql_query = null, string $contentTy } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + try { + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + } catch (\JsonException $e) { + throw new \InvalidArgumentException('json_encode error: ' . $e->getMessage(), 0, $e); + } } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -2104,13 +2198,14 @@ public function unlockRowsWithHttpInfo($base_uuid, $table_with_row_ids = null, s try { $response = $this->client->send($request, $options); } catch (RequestException $e) { + $eResponse = $this->getExceptionResponse($e); throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), - $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? (string) $e->getResponse()->getBody() : null + $eResponse ? $eResponse->getHeaders() : null, + $eResponse ? (string) $eResponse->getBody() : null ); - } catch (ConnectException $e) { + } catch (NetworkExceptionInterface $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), @@ -2227,7 +2322,15 @@ function ($response) use ($returnType) { ]; }, function ($exception) { - $response = $exception->getResponse(); + $response = $this->getExceptionResponse($exception); + if ($response === null) { + throw new ApiException( + "[{$exception->getCode()}] {$exception->getMessage()}", + (int) $exception->getCode(), + null, + null + ); + } $statusCode = $response->getStatusCode(); throw new ApiException( sprintf( @@ -2280,7 +2383,7 @@ public function unlockRowsRequest($base_uuid, $table_with_row_ids = null, string // path params if ($base_uuid !== null) { $resourcePath = str_replace( - '{' . 'base_uuid' . '}', + '{base_uuid}', ObjectSerializer::toPathValue($base_uuid), $resourcePath ); @@ -2297,7 +2400,11 @@ public function unlockRowsRequest($base_uuid, $table_with_row_ids = null, string if (isset($table_with_row_ids)) { if (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the body - $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($table_with_row_ids)); + try { + $httpBody = json_encode(ObjectSerializer::sanitizeForSerialization($table_with_row_ids), JSON_THROW_ON_ERROR); + } catch (\JsonException $e) { + throw new \InvalidArgumentException('json_encode error: ' . $e->getMessage(), 0, $e); + } } else { $httpBody = $table_with_row_ids; } @@ -2318,7 +2425,11 @@ public function unlockRowsRequest($base_uuid, $table_with_row_ids = null, string } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + try { + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + } catch (\JsonException $e) { + throw new \InvalidArgumentException('json_encode error: ' . $e->getMessage(), 0, $e); + } } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -2392,13 +2503,14 @@ public function updateRowWithHttpInfo($base_uuid, $update_rows = null, string $c try { $response = $this->client->send($request, $options); } catch (RequestException $e) { + $eResponse = $this->getExceptionResponse($e); throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), - $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? (string) $e->getResponse()->getBody() : null + $eResponse ? $eResponse->getHeaders() : null, + $eResponse ? (string) $eResponse->getBody() : null ); - } catch (ConnectException $e) { + } catch (NetworkExceptionInterface $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), @@ -2529,7 +2641,15 @@ function ($response) use ($returnType) { ]; }, function ($exception) { - $response = $exception->getResponse(); + $response = $this->getExceptionResponse($exception); + if ($response === null) { + throw new ApiException( + "[{$exception->getCode()}] {$exception->getMessage()}", + (int) $exception->getCode(), + null, + null + ); + } $statusCode = $response->getStatusCode(); throw new ApiException( sprintf( @@ -2582,7 +2702,7 @@ public function updateRowRequest($base_uuid, $update_rows = null, string $conten // path params if ($base_uuid !== null) { $resourcePath = str_replace( - '{' . 'base_uuid' . '}', + '{base_uuid}', ObjectSerializer::toPathValue($base_uuid), $resourcePath ); @@ -2599,7 +2719,11 @@ public function updateRowRequest($base_uuid, $update_rows = null, string $conten if (isset($update_rows)) { if (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the body - $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($update_rows)); + try { + $httpBody = json_encode(ObjectSerializer::sanitizeForSerialization($update_rows), JSON_THROW_ON_ERROR); + } catch (\JsonException $e) { + throw new \InvalidArgumentException('json_encode error: ' . $e->getMessage(), 0, $e); + } } else { $httpBody = $update_rows; } @@ -2620,7 +2744,11 @@ public function updateRowRequest($base_uuid, $update_rows = null, string $conten } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + try { + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + } catch (\JsonException $e) { + throw new \InvalidArgumentException('json_encode error: ' . $e->getMessage(), 0, $e); + } } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -2680,6 +2808,21 @@ protected function createHttpClientOption() return $options; } + /** + * Returns the response attached to a Guzzle exception, if there is one. + * + * Guzzle 7 exposes getResponse() on RequestException, while Guzzle 8 only + * exposes it on ResponseException and its subclasses. + * + * @param \Throwable $exception + * + * @return ResponseInterface|null + */ + private function getExceptionResponse(\Throwable $exception): ?ResponseInterface + { + return method_exists($exception, 'getResponse') ? $exception->getResponse() : null; + } + private function handleResponseWithDataType( string $dataType, RequestInterface $request, diff --git a/lib/Base/RowsWithTableName.php b/lib/Base/RowsWithTableName.php index 727e9f6b..8baa9179 100644 --- a/lib/Base/RowsWithTableName.php +++ b/lib/Base/RowsWithTableName.php @@ -44,49 +44,49 @@ class RowsWithTableName implements ModelInterface, ArrayAccess, \JsonSerializabl public const DISCRIMINATOR = null; /** - * The original name of the model. - * - * @var string - */ + * The original name of the model. + * + * @var string + */ protected static $openAPIModelName = 'rows_with_table_name'; /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ protected static $openAPITypes = [ 'table_name' => 'string', 'rows' => 'object[]' ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - * @phpstan-var array - * @psalm-var array - */ + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ protected static $openAPIFormats = [ 'table_name' => null, 'rows' => null ]; /** - * Array of nullable properties. Used for (de)serialization - * - * @var boolean[] - */ + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ protected static array $openAPINullables = [ 'table_name' => false, 'rows' => false ]; /** - * If a nullable field gets set to null, insert it here - * - * @var boolean[] - */ + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ protected array $openAPINullablesSetToNull = []; /** @@ -254,14 +254,14 @@ public function __construct(?array $data = null) } /** - * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName - * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the - * $this->openAPINullablesSetToNull array - * - * @param string $variableName - * @param array $fields - * @param mixed $defaultValue - */ + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ private function setIfExists(string $variableName, array $fields, $defaultValue): void { if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { diff --git a/lib/Base/SelectColumnFormat.php b/lib/Base/SelectColumnFormat.php index 6b6fa730..059a45b7 100644 --- a/lib/Base/SelectColumnFormat.php +++ b/lib/Base/SelectColumnFormat.php @@ -45,46 +45,46 @@ class SelectColumnFormat implements ModelInterface, ArrayAccess, \JsonSerializab public const DISCRIMINATOR = null; /** - * The original name of the model. - * - * @var string - */ + * The original name of the model. + * + * @var string + */ protected static $openAPIModelName = 'select_column_format'; /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ protected static $openAPITypes = [ 'options' => '\SeaTable\Client\Base\SelectColumnFormatOptionsInner[]' ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - * @phpstan-var array - * @psalm-var array - */ + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ protected static $openAPIFormats = [ 'options' => null ]; /** - * Array of nullable properties. Used for (de)serialization - * - * @var boolean[] - */ + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ protected static array $openAPINullables = [ 'options' => false ]; /** - * If a nullable field gets set to null, insert it here - * - * @var boolean[] - */ + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ protected array $openAPINullablesSetToNull = []; /** @@ -248,14 +248,14 @@ public function __construct(?array $data = null) } /** - * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName - * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the - * $this->openAPINullablesSetToNull array - * - * @param string $variableName - * @param array $fields - * @param mixed $defaultValue - */ + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ private function setIfExists(string $variableName, array $fields, $defaultValue): void { if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { diff --git a/lib/Base/SelectColumnFormatOptionsInner.php b/lib/Base/SelectColumnFormatOptionsInner.php index 1caefe7e..f282fca8 100644 --- a/lib/Base/SelectColumnFormatOptionsInner.php +++ b/lib/Base/SelectColumnFormatOptionsInner.php @@ -45,17 +45,17 @@ class SelectColumnFormatOptionsInner implements ModelInterface, ArrayAccess, \Js public const DISCRIMINATOR = null; /** - * The original name of the model. - * - * @var string - */ + * The original name of the model. + * + * @var string + */ protected static $openAPIModelName = 'select_column_format_options_inner'; /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ protected static $openAPITypes = [ 'id' => 'string', 'name' => 'string', @@ -65,12 +65,12 @@ class SelectColumnFormatOptionsInner implements ModelInterface, ArrayAccess, \Js ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - * @phpstan-var array - * @psalm-var array - */ + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ protected static $openAPIFormats = [ 'id' => null, 'name' => null, @@ -80,10 +80,10 @@ class SelectColumnFormatOptionsInner implements ModelInterface, ArrayAccess, \Js ]; /** - * Array of nullable properties. Used for (de)serialization - * - * @var boolean[] - */ + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ protected static array $openAPINullables = [ 'id' => false, 'name' => false, @@ -93,10 +93,10 @@ class SelectColumnFormatOptionsInner implements ModelInterface, ArrayAccess, \Js ]; /** - * If a nullable field gets set to null, insert it here - * - * @var boolean[] - */ + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ protected array $openAPINullablesSetToNull = []; /** @@ -276,14 +276,14 @@ public function __construct(?array $data = null) } /** - * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName - * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the - * $this->openAPINullablesSetToNull array - * - * @param string $variableName - * @param array $fields - * @param mixed $defaultValue - */ + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ private function setIfExists(string $variableName, array $fields, $defaultValue): void { if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { diff --git a/lib/Base/SendToastNotificationRequest.php b/lib/Base/SendToastNotificationRequest.php index 3ec9246f..80ce33b2 100644 --- a/lib/Base/SendToastNotificationRequest.php +++ b/lib/Base/SendToastNotificationRequest.php @@ -44,17 +44,17 @@ class SendToastNotificationRequest implements ModelInterface, ArrayAccess, \Json public const DISCRIMINATOR = null; /** - * The original name of the model. - * - * @var string - */ + * The original name of the model. + * + * @var string + */ protected static $openAPIModelName = 'sendToastNotification_request'; /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ protected static $openAPITypes = [ 'to_user' => 'string', 'toast_type' => 'string', @@ -62,12 +62,12 @@ class SendToastNotificationRequest implements ModelInterface, ArrayAccess, \Json ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - * @phpstan-var array - * @psalm-var array - */ + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ protected static $openAPIFormats = [ 'to_user' => null, 'toast_type' => null, @@ -75,10 +75,10 @@ class SendToastNotificationRequest implements ModelInterface, ArrayAccess, \Json ]; /** - * Array of nullable properties. Used for (de)serialization - * - * @var boolean[] - */ + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ protected static array $openAPINullables = [ 'to_user' => false, 'toast_type' => false, @@ -86,10 +86,10 @@ class SendToastNotificationRequest implements ModelInterface, ArrayAccess, \Json ]; /** - * If a nullable field gets set to null, insert it here - * - * @var boolean[] - */ + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ protected array $openAPINullablesSetToNull = []; /** @@ -278,14 +278,14 @@ public function __construct(?array $data = null) } /** - * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName - * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the - * $this->openAPINullablesSetToNull array - * - * @param string $variableName - * @param array $fields - * @param mixed $defaultValue - */ + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ private function setIfExists(string $variableName, array $fields, $defaultValue): void { if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { diff --git a/lib/Base/SendToastNotificationRequestDetail.php b/lib/Base/SendToastNotificationRequestDetail.php index b327e869..94325fea 100644 --- a/lib/Base/SendToastNotificationRequestDetail.php +++ b/lib/Base/SendToastNotificationRequestDetail.php @@ -44,46 +44,46 @@ class SendToastNotificationRequestDetail implements ModelInterface, ArrayAccess, public const DISCRIMINATOR = null; /** - * The original name of the model. - * - * @var string - */ + * The original name of the model. + * + * @var string + */ protected static $openAPIModelName = 'sendToastNotification_request_detail'; /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ protected static $openAPITypes = [ 'msg' => 'string' ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - * @phpstan-var array - * @psalm-var array - */ + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ protected static $openAPIFormats = [ 'msg' => null ]; /** - * Array of nullable properties. Used for (de)serialization - * - * @var boolean[] - */ + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ protected static array $openAPINullables = [ 'msg' => false ]; /** - * If a nullable field gets set to null, insert it here - * - * @var boolean[] - */ + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ protected array $openAPINullablesSetToNull = []; /** @@ -247,14 +247,14 @@ public function __construct(?array $data = null) } /** - * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName - * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the - * $this->openAPINullablesSetToNull array - * - * @param string $variableName - * @param array $fields - * @param mixed $defaultValue - */ + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ private function setIfExists(string $variableName, array $fields, $defaultValue): void { if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { diff --git a/lib/Base/SingleSelectColumn.php b/lib/Base/SingleSelectColumn.php index 9a79cc3e..a8bb03ca 100644 --- a/lib/Base/SingleSelectColumn.php +++ b/lib/Base/SingleSelectColumn.php @@ -45,17 +45,17 @@ class SingleSelectColumn implements ModelInterface, ArrayAccess, \JsonSerializab public const DISCRIMINATOR = null; /** - * The original name of the model. - * - * @var string - */ + * The original name of the model. + * + * @var string + */ protected static $openAPIModelName = 'single_select_column'; /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ protected static $openAPITypes = [ 'column_name' => 'string', 'column_type' => 'string', @@ -64,12 +64,12 @@ class SingleSelectColumn implements ModelInterface, ArrayAccess, \JsonSerializab ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - * @phpstan-var array - * @psalm-var array - */ + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ protected static $openAPIFormats = [ 'column_name' => null, 'column_type' => null, @@ -78,10 +78,10 @@ class SingleSelectColumn implements ModelInterface, ArrayAccess, \JsonSerializab ]; /** - * Array of nullable properties. Used for (de)serialization - * - * @var boolean[] - */ + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ protected static array $openAPINullables = [ 'column_name' => false, 'column_type' => false, @@ -90,10 +90,10 @@ class SingleSelectColumn implements ModelInterface, ArrayAccess, \JsonSerializab ]; /** - * If a nullable field gets set to null, insert it here - * - * @var boolean[] - */ + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ protected array $openAPINullablesSetToNull = []; /** @@ -282,14 +282,14 @@ public function __construct(?array $data = null) } /** - * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName - * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the - * $this->openAPINullablesSetToNull array - * - * @param string $variableName - * @param array $fields - * @param mixed $defaultValue - */ + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ private function setIfExists(string $variableName, array $fields, $defaultValue): void { if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { diff --git a/lib/Base/SingleSelectColumnWithTableName.php b/lib/Base/SingleSelectColumnWithTableName.php index f7928521..3970ebd0 100644 --- a/lib/Base/SingleSelectColumnWithTableName.php +++ b/lib/Base/SingleSelectColumnWithTableName.php @@ -44,17 +44,17 @@ class SingleSelectColumnWithTableName implements ModelInterface, ArrayAccess, \J public const DISCRIMINATOR = null; /** - * The original name of the model. - * - * @var string - */ + * The original name of the model. + * + * @var string + */ protected static $openAPIModelName = 'single_select_column_with_table_name'; /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ protected static $openAPITypes = [ 'table_name' => 'string', 'column_name' => 'string', @@ -64,12 +64,12 @@ class SingleSelectColumnWithTableName implements ModelInterface, ArrayAccess, \J ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - * @phpstan-var array - * @psalm-var array - */ + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ protected static $openAPIFormats = [ 'table_name' => null, 'column_name' => null, @@ -79,10 +79,10 @@ class SingleSelectColumnWithTableName implements ModelInterface, ArrayAccess, \J ]; /** - * Array of nullable properties. Used for (de)serialization - * - * @var boolean[] - */ + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ protected static array $openAPINullables = [ 'table_name' => false, 'column_name' => false, @@ -92,10 +92,10 @@ class SingleSelectColumnWithTableName implements ModelInterface, ArrayAccess, \J ]; /** - * If a nullable field gets set to null, insert it here - * - * @var boolean[] - */ + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ protected array $openAPINullablesSetToNull = []; /** @@ -288,14 +288,14 @@ public function __construct(?array $data = null) } /** - * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName - * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the - * $this->openAPINullablesSetToNull array - * - * @param string $variableName - * @param array $fields - * @param mixed $defaultValue - */ + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ private function setIfExists(string $variableName, array $fields, $defaultValue): void { if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { diff --git a/lib/Base/SnapshotsApi.php b/lib/Base/SnapshotsApi.php index 9a54cd7d..d190833b 100644 --- a/lib/Base/SnapshotsApi.php +++ b/lib/Base/SnapshotsApi.php @@ -28,11 +28,11 @@ use GuzzleHttp\Client; use GuzzleHttp\ClientInterface; -use GuzzleHttp\Exception\ConnectException; use GuzzleHttp\Exception\RequestException; use GuzzleHttp\Psr7\MultipartStream; use GuzzleHttp\Psr7\Request; use GuzzleHttp\RequestOptions; +use Psr\Http\Client\NetworkExceptionInterface; use Psr\Http\Message\RequestInterface; use Psr\Http\Message\ResponseInterface; use SeaTable\Client\ApiException; @@ -165,13 +165,14 @@ public function createSnapshotWithHttpInfo($base_uuid, $generate_snapshot = null try { $response = $this->client->send($request, $options); } catch (RequestException $e) { + $eResponse = $this->getExceptionResponse($e); throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), - $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? (string) $e->getResponse()->getBody() : null + $eResponse ? $eResponse->getHeaders() : null, + $eResponse ? (string) $eResponse->getBody() : null ); - } catch (ConnectException $e) { + } catch (NetworkExceptionInterface $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), @@ -288,7 +289,15 @@ function ($response) use ($returnType) { ]; }, function ($exception) { - $response = $exception->getResponse(); + $response = $this->getExceptionResponse($exception); + if ($response === null) { + throw new ApiException( + "[{$exception->getCode()}] {$exception->getMessage()}", + (int) $exception->getCode(), + null, + null + ); + } $statusCode = $response->getStatusCode(); throw new ApiException( sprintf( @@ -341,7 +350,7 @@ public function createSnapshotRequest($base_uuid, $generate_snapshot = null, str // path params if ($base_uuid !== null) { $resourcePath = str_replace( - '{' . 'base_uuid' . '}', + '{base_uuid}', ObjectSerializer::toPathValue($base_uuid), $resourcePath ); @@ -358,7 +367,11 @@ public function createSnapshotRequest($base_uuid, $generate_snapshot = null, str if (isset($generate_snapshot)) { if (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the body - $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($generate_snapshot)); + try { + $httpBody = json_encode(ObjectSerializer::sanitizeForSerialization($generate_snapshot), JSON_THROW_ON_ERROR); + } catch (\JsonException $e) { + throw new \InvalidArgumentException('json_encode error: ' . $e->getMessage(), 0, $e); + } } else { $httpBody = $generate_snapshot; } @@ -379,7 +392,11 @@ public function createSnapshotRequest($base_uuid, $generate_snapshot = null, str } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + try { + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + } catch (\JsonException $e) { + throw new \InvalidArgumentException('json_encode error: ' . $e->getMessage(), 0, $e); + } } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -439,6 +456,21 @@ protected function createHttpClientOption() return $options; } + /** + * Returns the response attached to a Guzzle exception, if there is one. + * + * Guzzle 7 exposes getResponse() on RequestException, while Guzzle 8 only + * exposes it on ResponseException and its subclasses. + * + * @param \Throwable $exception + * + * @return ResponseInterface|null + */ + private function getExceptionResponse(\Throwable $exception): ?ResponseInterface + { + return method_exists($exception, 'getResponse') ? $exception->getResponse() : null; + } + private function handleResponseWithDataType( string $dataType, RequestInterface $request, diff --git a/lib/Base/SortsInner.php b/lib/Base/SortsInner.php index 031f7368..84da4fb2 100644 --- a/lib/Base/SortsInner.php +++ b/lib/Base/SortsInner.php @@ -44,49 +44,49 @@ class SortsInner implements ModelInterface, ArrayAccess, \JsonSerializable public const DISCRIMINATOR = null; /** - * The original name of the model. - * - * @var string - */ + * The original name of the model. + * + * @var string + */ protected static $openAPIModelName = 'sorts_inner'; /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ protected static $openAPITypes = [ 'column_key' => 'string', 'sort_type' => '\SeaTable\Client\Base\SortType' ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - * @phpstan-var array - * @psalm-var array - */ + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ protected static $openAPIFormats = [ 'column_key' => null, 'sort_type' => null ]; /** - * Array of nullable properties. Used for (de)serialization - * - * @var boolean[] - */ + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ protected static array $openAPINullables = [ 'column_key' => false, 'sort_type' => false ]; /** - * If a nullable field gets set to null, insert it here - * - * @var boolean[] - */ + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ protected array $openAPINullablesSetToNull = []; /** @@ -254,14 +254,14 @@ public function __construct(?array $data = null) } /** - * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName - * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the - * $this->openAPINullablesSetToNull array - * - * @param string $variableName - * @param array $fields - * @param mixed $defaultValue - */ + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ private function setIfExists(string $variableName, array $fields, $defaultValue): void { if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { diff --git a/lib/Base/SqlQuery.php b/lib/Base/SqlQuery.php index 5147d11d..008838ed 100644 --- a/lib/Base/SqlQuery.php +++ b/lib/Base/SqlQuery.php @@ -44,17 +44,17 @@ class SqlQuery implements ModelInterface, ArrayAccess, \JsonSerializable public const DISCRIMINATOR = null; /** - * The original name of the model. - * - * @var string - */ + * The original name of the model. + * + * @var string + */ protected static $openAPIModelName = 'sql_query'; /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ protected static $openAPITypes = [ 'sql' => 'string', 'convert_keys' => 'bool', @@ -63,12 +63,12 @@ class SqlQuery implements ModelInterface, ArrayAccess, \JsonSerializable ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - * @phpstan-var array - * @psalm-var array - */ + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ protected static $openAPIFormats = [ 'sql' => 'SQL-Query', 'convert_keys' => null, @@ -77,10 +77,10 @@ class SqlQuery implements ModelInterface, ArrayAccess, \JsonSerializable ]; /** - * Array of nullable properties. Used for (de)serialization - * - * @var boolean[] - */ + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ protected static array $openAPINullables = [ 'sql' => false, 'convert_keys' => false, @@ -89,10 +89,10 @@ class SqlQuery implements ModelInterface, ArrayAccess, \JsonSerializable ]; /** - * If a nullable field gets set to null, insert it here - * - * @var boolean[] - */ + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ protected array $openAPINullablesSetToNull = []; /** @@ -268,14 +268,14 @@ public function __construct(?array $data = null) } /** - * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName - * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the - * $this->openAPINullablesSetToNull array - * - * @param string $variableName - * @param array $fields - * @param mixed $defaultValue - */ + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ private function setIfExists(string $variableName, array $fields, $defaultValue): void { if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { diff --git a/lib/Base/SqlQueryParametersInner.php b/lib/Base/SqlQueryParametersInner.php index b5f320f3..4d196401 100644 --- a/lib/Base/SqlQueryParametersInner.php +++ b/lib/Base/SqlQueryParametersInner.php @@ -44,46 +44,46 @@ class SqlQueryParametersInner implements ModelInterface, ArrayAccess, \JsonSeria public const DISCRIMINATOR = null; /** - * The original name of the model. - * - * @var string - */ + * The original name of the model. + * + * @var string + */ protected static $openAPIModelName = 'sql_query_parameters_inner'; /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ protected static $openAPITypes = [ ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - * @phpstan-var array - * @psalm-var array - */ + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ protected static $openAPIFormats = [ ]; /** - * Array of nullable properties. Used for (de)serialization - * - * @var boolean[] - */ + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ protected static array $openAPINullables = [ ]; /** - * If a nullable field gets set to null, insert it here - * - * @var boolean[] - */ + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ protected array $openAPINullablesSetToNull = []; /** @@ -246,14 +246,14 @@ public function __construct(?array $data = null) } /** - * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName - * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the - * $this->openAPINullablesSetToNull array - * - * @param string $variableName - * @param array $fields - * @param mixed $defaultValue - */ + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ private function setIfExists(string $variableName, array $fields, $defaultValue): void { if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { diff --git a/lib/Base/SqlQueryResponse.php b/lib/Base/SqlQueryResponse.php index e793478b..188b7866 100644 --- a/lib/Base/SqlQueryResponse.php +++ b/lib/Base/SqlQueryResponse.php @@ -44,17 +44,17 @@ class SqlQueryResponse implements ModelInterface, ArrayAccess, \JsonSerializable public const DISCRIMINATOR = null; /** - * The original name of the model. - * - * @var string - */ + * The original name of the model. + * + * @var string + */ protected static $openAPIModelName = 'sql_query_response'; /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ protected static $openAPITypes = [ 'metadata' => 'object[]', 'results' => 'object[]', @@ -62,12 +62,12 @@ class SqlQueryResponse implements ModelInterface, ArrayAccess, \JsonSerializable ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - * @phpstan-var array - * @psalm-var array - */ + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ protected static $openAPIFormats = [ 'metadata' => null, 'results' => null, @@ -75,10 +75,10 @@ class SqlQueryResponse implements ModelInterface, ArrayAccess, \JsonSerializable ]; /** - * Array of nullable properties. Used for (de)serialization - * - * @var boolean[] - */ + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ protected static array $openAPINullables = [ 'metadata' => false, 'results' => false, @@ -86,10 +86,10 @@ class SqlQueryResponse implements ModelInterface, ArrayAccess, \JsonSerializable ]; /** - * If a nullable field gets set to null, insert it here - * - * @var boolean[] - */ + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ protected array $openAPINullablesSetToNull = []; /** @@ -261,14 +261,14 @@ public function __construct(?array $data = null) } /** - * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName - * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the - * $this->openAPINullablesSetToNull array - * - * @param string $variableName - * @param array $fields - * @param mixed $defaultValue - */ + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ private function setIfExists(string $variableName, array $fields, $defaultValue): void { if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { diff --git a/lib/Base/TableNameObject.php b/lib/Base/TableNameObject.php index f5a17863..79a4d7d0 100644 --- a/lib/Base/TableNameObject.php +++ b/lib/Base/TableNameObject.php @@ -44,46 +44,46 @@ class TableNameObject implements ModelInterface, ArrayAccess, \JsonSerializable public const DISCRIMINATOR = null; /** - * The original name of the model. - * - * @var string - */ + * The original name of the model. + * + * @var string + */ protected static $openAPIModelName = 'table_name_object'; /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ protected static $openAPITypes = [ 'table_name' => 'string' ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - * @phpstan-var array - * @psalm-var array - */ + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ protected static $openAPIFormats = [ 'table_name' => null ]; /** - * Array of nullable properties. Used for (de)serialization - * - * @var boolean[] - */ + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ protected static array $openAPINullables = [ 'table_name' => false ]; /** - * If a nullable field gets set to null, insert it here - * - * @var boolean[] - */ + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ protected array $openAPINullablesSetToNull = []; /** @@ -247,14 +247,14 @@ public function __construct(?array $data = null) } /** - * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName - * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the - * $this->openAPINullablesSetToNull array - * - * @param string $variableName - * @param array $fields - * @param mixed $defaultValue - */ + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ private function setIfExists(string $variableName, array $fields, $defaultValue): void { if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { diff --git a/lib/Base/TableWithRowIds.php b/lib/Base/TableWithRowIds.php index aaf31a6d..a026ed8e 100644 --- a/lib/Base/TableWithRowIds.php +++ b/lib/Base/TableWithRowIds.php @@ -44,49 +44,49 @@ class TableWithRowIds implements ModelInterface, ArrayAccess, \JsonSerializable public const DISCRIMINATOR = null; /** - * The original name of the model. - * - * @var string - */ + * The original name of the model. + * + * @var string + */ protected static $openAPIModelName = 'table_with_row_ids'; /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ protected static $openAPITypes = [ 'table_name' => 'string', 'row_ids' => 'string[]' ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - * @phpstan-var array - * @psalm-var array - */ + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ protected static $openAPIFormats = [ 'table_name' => null, 'row_ids' => null ]; /** - * Array of nullable properties. Used for (de)serialization - * - * @var boolean[] - */ + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ protected static array $openAPINullables = [ 'table_name' => false, 'row_ids' => false ]; /** - * If a nullable field gets set to null, insert it here - * - * @var boolean[] - */ + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ protected array $openAPINullablesSetToNull = []; /** @@ -254,14 +254,14 @@ public function __construct(?array $data = null) } /** - * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName - * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the - * $this->openAPINullablesSetToNull array - * - * @param string $variableName - * @param array $fields - * @param mixed $defaultValue - */ + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ private function setIfExists(string $variableName, array $fields, $defaultValue): void { if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { diff --git a/lib/Base/TablesApi.php b/lib/Base/TablesApi.php index 548de181..4c0baa4c 100644 --- a/lib/Base/TablesApi.php +++ b/lib/Base/TablesApi.php @@ -28,11 +28,11 @@ use GuzzleHttp\Client; use GuzzleHttp\ClientInterface; -use GuzzleHttp\Exception\ConnectException; use GuzzleHttp\Exception\RequestException; use GuzzleHttp\Psr7\MultipartStream; use GuzzleHttp\Psr7\Request; use GuzzleHttp\RequestOptions; +use Psr\Http\Client\NetworkExceptionInterface; use Psr\Http\Message\RequestInterface; use Psr\Http\Message\ResponseInterface; use SeaTable\Client\ApiException; @@ -174,13 +174,14 @@ public function createTableWithHttpInfo($base_uuid, $create_table_request = null try { $response = $this->client->send($request, $options); } catch (RequestException $e) { + $eResponse = $this->getExceptionResponse($e); throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), - $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? (string) $e->getResponse()->getBody() : null + $eResponse ? $eResponse->getHeaders() : null, + $eResponse ? (string) $eResponse->getBody() : null ); - } catch (ConnectException $e) { + } catch (NetworkExceptionInterface $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), @@ -297,7 +298,15 @@ function ($response) use ($returnType) { ]; }, function ($exception) { - $response = $exception->getResponse(); + $response = $this->getExceptionResponse($exception); + if ($response === null) { + throw new ApiException( + "[{$exception->getCode()}] {$exception->getMessage()}", + (int) $exception->getCode(), + null, + null + ); + } $statusCode = $response->getStatusCode(); throw new ApiException( sprintf( @@ -350,7 +359,7 @@ public function createTableRequest($base_uuid, $create_table_request = null, str // path params if ($base_uuid !== null) { $resourcePath = str_replace( - '{' . 'base_uuid' . '}', + '{base_uuid}', ObjectSerializer::toPathValue($base_uuid), $resourcePath ); @@ -367,7 +376,11 @@ public function createTableRequest($base_uuid, $create_table_request = null, str if (isset($create_table_request)) { if (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the body - $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($create_table_request)); + try { + $httpBody = json_encode(ObjectSerializer::sanitizeForSerialization($create_table_request), JSON_THROW_ON_ERROR); + } catch (\JsonException $e) { + throw new \InvalidArgumentException('json_encode error: ' . $e->getMessage(), 0, $e); + } } else { $httpBody = $create_table_request; } @@ -388,7 +401,11 @@ public function createTableRequest($base_uuid, $create_table_request = null, str } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + try { + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + } catch (\JsonException $e) { + throw new \InvalidArgumentException('json_encode error: ' . $e->getMessage(), 0, $e); + } } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -462,13 +479,14 @@ public function deleteTableWithHttpInfo($base_uuid, $delete_table = null, string try { $response = $this->client->send($request, $options); } catch (RequestException $e) { + $eResponse = $this->getExceptionResponse($e); throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), - $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? (string) $e->getResponse()->getBody() : null + $eResponse ? $eResponse->getHeaders() : null, + $eResponse ? (string) $eResponse->getBody() : null ); - } catch (ConnectException $e) { + } catch (NetworkExceptionInterface $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), @@ -585,7 +603,15 @@ function ($response) use ($returnType) { ]; }, function ($exception) { - $response = $exception->getResponse(); + $response = $this->getExceptionResponse($exception); + if ($response === null) { + throw new ApiException( + "[{$exception->getCode()}] {$exception->getMessage()}", + (int) $exception->getCode(), + null, + null + ); + } $statusCode = $response->getStatusCode(); throw new ApiException( sprintf( @@ -638,7 +664,7 @@ public function deleteTableRequest($base_uuid, $delete_table = null, string $con // path params if ($base_uuid !== null) { $resourcePath = str_replace( - '{' . 'base_uuid' . '}', + '{base_uuid}', ObjectSerializer::toPathValue($base_uuid), $resourcePath ); @@ -655,7 +681,11 @@ public function deleteTableRequest($base_uuid, $delete_table = null, string $con if (isset($delete_table)) { if (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the body - $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($delete_table)); + try { + $httpBody = json_encode(ObjectSerializer::sanitizeForSerialization($delete_table), JSON_THROW_ON_ERROR); + } catch (\JsonException $e) { + throw new \InvalidArgumentException('json_encode error: ' . $e->getMessage(), 0, $e); + } } else { $httpBody = $delete_table; } @@ -676,7 +706,11 @@ public function deleteTableRequest($base_uuid, $delete_table = null, string $con } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + try { + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + } catch (\JsonException $e) { + throw new \InvalidArgumentException('json_encode error: ' . $e->getMessage(), 0, $e); + } } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -750,13 +784,14 @@ public function duplicateTableWithHttpInfo($base_uuid, $duplicate_table = null, try { $response = $this->client->send($request, $options); } catch (RequestException $e) { + $eResponse = $this->getExceptionResponse($e); throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), - $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? (string) $e->getResponse()->getBody() : null + $eResponse ? $eResponse->getHeaders() : null, + $eResponse ? (string) $eResponse->getBody() : null ); - } catch (ConnectException $e) { + } catch (NetworkExceptionInterface $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), @@ -873,7 +908,15 @@ function ($response) use ($returnType) { ]; }, function ($exception) { - $response = $exception->getResponse(); + $response = $this->getExceptionResponse($exception); + if ($response === null) { + throw new ApiException( + "[{$exception->getCode()}] {$exception->getMessage()}", + (int) $exception->getCode(), + null, + null + ); + } $statusCode = $response->getStatusCode(); throw new ApiException( sprintf( @@ -926,7 +969,7 @@ public function duplicateTableRequest($base_uuid, $duplicate_table = null, strin // path params if ($base_uuid !== null) { $resourcePath = str_replace( - '{' . 'base_uuid' . '}', + '{base_uuid}', ObjectSerializer::toPathValue($base_uuid), $resourcePath ); @@ -943,7 +986,11 @@ public function duplicateTableRequest($base_uuid, $duplicate_table = null, strin if (isset($duplicate_table)) { if (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the body - $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($duplicate_table)); + try { + $httpBody = json_encode(ObjectSerializer::sanitizeForSerialization($duplicate_table), JSON_THROW_ON_ERROR); + } catch (\JsonException $e) { + throw new \InvalidArgumentException('json_encode error: ' . $e->getMessage(), 0, $e); + } } else { $httpBody = $duplicate_table; } @@ -964,7 +1011,11 @@ public function duplicateTableRequest($base_uuid, $duplicate_table = null, strin } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + try { + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + } catch (\JsonException $e) { + throw new \InvalidArgumentException('json_encode error: ' . $e->getMessage(), 0, $e); + } } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -1038,13 +1089,14 @@ public function renameTableWithHttpInfo($base_uuid, $rename_table = null, string try { $response = $this->client->send($request, $options); } catch (RequestException $e) { + $eResponse = $this->getExceptionResponse($e); throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), - $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? (string) $e->getResponse()->getBody() : null + $eResponse ? $eResponse->getHeaders() : null, + $eResponse ? (string) $eResponse->getBody() : null ); - } catch (ConnectException $e) { + } catch (NetworkExceptionInterface $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), @@ -1161,7 +1213,15 @@ function ($response) use ($returnType) { ]; }, function ($exception) { - $response = $exception->getResponse(); + $response = $this->getExceptionResponse($exception); + if ($response === null) { + throw new ApiException( + "[{$exception->getCode()}] {$exception->getMessage()}", + (int) $exception->getCode(), + null, + null + ); + } $statusCode = $response->getStatusCode(); throw new ApiException( sprintf( @@ -1214,7 +1274,7 @@ public function renameTableRequest($base_uuid, $rename_table = null, string $con // path params if ($base_uuid !== null) { $resourcePath = str_replace( - '{' . 'base_uuid' . '}', + '{base_uuid}', ObjectSerializer::toPathValue($base_uuid), $resourcePath ); @@ -1231,7 +1291,11 @@ public function renameTableRequest($base_uuid, $rename_table = null, string $con if (isset($rename_table)) { if (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the body - $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($rename_table)); + try { + $httpBody = json_encode(ObjectSerializer::sanitizeForSerialization($rename_table), JSON_THROW_ON_ERROR); + } catch (\JsonException $e) { + throw new \InvalidArgumentException('json_encode error: ' . $e->getMessage(), 0, $e); + } } else { $httpBody = $rename_table; } @@ -1252,7 +1316,11 @@ public function renameTableRequest($base_uuid, $rename_table = null, string $con } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + try { + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + } catch (\JsonException $e) { + throw new \InvalidArgumentException('json_encode error: ' . $e->getMessage(), 0, $e); + } } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -1312,6 +1380,21 @@ protected function createHttpClientOption() return $options; } + /** + * Returns the response attached to a Guzzle exception, if there is one. + * + * Guzzle 7 exposes getResponse() on RequestException, while Guzzle 8 only + * exposes it on ResponseException and its subclasses. + * + * @param \Throwable $exception + * + * @return ResponseInterface|null + */ + private function getExceptionResponse(\Throwable $exception): ?ResponseInterface + { + return method_exists($exception, 'getResponse') ? $exception->getResponse() : null; + } + private function handleResponseWithDataType( string $dataType, RequestInterface $request, diff --git a/lib/Base/TextColumn.php b/lib/Base/TextColumn.php index c9d3fb9e..db98e771 100644 --- a/lib/Base/TextColumn.php +++ b/lib/Base/TextColumn.php @@ -45,17 +45,17 @@ class TextColumn implements ModelInterface, ArrayAccess, \JsonSerializable public const DISCRIMINATOR = null; /** - * The original name of the model. - * - * @var string - */ + * The original name of the model. + * + * @var string + */ protected static $openAPIModelName = 'text_column'; /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ protected static $openAPITypes = [ 'column_name' => 'string', 'column_type' => 'string', @@ -63,12 +63,12 @@ class TextColumn implements ModelInterface, ArrayAccess, \JsonSerializable ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - * @phpstan-var array - * @psalm-var array - */ + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ protected static $openAPIFormats = [ 'column_name' => null, 'column_type' => null, @@ -76,10 +76,10 @@ class TextColumn implements ModelInterface, ArrayAccess, \JsonSerializable ]; /** - * Array of nullable properties. Used for (de)serialization - * - * @var boolean[] - */ + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ protected static array $openAPINullables = [ 'column_name' => false, 'column_type' => false, @@ -87,10 +87,10 @@ class TextColumn implements ModelInterface, ArrayAccess, \JsonSerializable ]; /** - * If a nullable field gets set to null, insert it here - * - * @var boolean[] - */ + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ protected array $openAPINullablesSetToNull = []; /** @@ -275,14 +275,14 @@ public function __construct(?array $data = null) } /** - * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName - * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the - * $this->openAPINullablesSetToNull array - * - * @param string $variableName - * @param array $fields - * @param mixed $defaultValue - */ + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ private function setIfExists(string $variableName, array $fields, $defaultValue): void { if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { diff --git a/lib/Base/TextColumnWithTableName.php b/lib/Base/TextColumnWithTableName.php index 611386f1..2a036590 100644 --- a/lib/Base/TextColumnWithTableName.php +++ b/lib/Base/TextColumnWithTableName.php @@ -44,17 +44,17 @@ class TextColumnWithTableName implements ModelInterface, ArrayAccess, \JsonSeria public const DISCRIMINATOR = null; /** - * The original name of the model. - * - * @var string - */ + * The original name of the model. + * + * @var string + */ protected static $openAPIModelName = 'text_column_with_table_name'; /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ protected static $openAPITypes = [ 'table_name' => 'string', 'column_name' => 'string', @@ -63,12 +63,12 @@ class TextColumnWithTableName implements ModelInterface, ArrayAccess, \JsonSeria ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - * @phpstan-var array - * @psalm-var array - */ + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ protected static $openAPIFormats = [ 'table_name' => null, 'column_name' => null, @@ -77,10 +77,10 @@ class TextColumnWithTableName implements ModelInterface, ArrayAccess, \JsonSeria ]; /** - * Array of nullable properties. Used for (de)serialization - * - * @var boolean[] - */ + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ protected static array $openAPINullables = [ 'table_name' => false, 'column_name' => false, @@ -89,10 +89,10 @@ class TextColumnWithTableName implements ModelInterface, ArrayAccess, \JsonSeria ]; /** - * If a nullable field gets set to null, insert it here - * - * @var boolean[] - */ + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ protected array $openAPINullablesSetToNull = []; /** @@ -281,14 +281,14 @@ public function __construct(?array $data = null) } /** - * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName - * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the - * $this->openAPINullablesSetToNull array - * - * @param string $variableName - * @param array $fields - * @param mixed $defaultValue - */ + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ private function setIfExists(string $variableName, array $fields, $defaultValue): void { if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { diff --git a/lib/Base/UpdateColumn.php b/lib/Base/UpdateColumn.php index 53edfd2d..c9faa5a2 100644 --- a/lib/Base/UpdateColumn.php +++ b/lib/Base/UpdateColumn.php @@ -44,17 +44,17 @@ class UpdateColumn implements ModelInterface, ArrayAccess, \JsonSerializable public const DISCRIMINATOR = null; /** - * The original name of the model. - * - * @var string - */ + * The original name of the model. + * + * @var string + */ protected static $openAPIModelName = 'update_column'; /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ protected static $openAPITypes = [ 'op_type' => 'string', 'table_name' => 'string', @@ -68,12 +68,12 @@ class UpdateColumn implements ModelInterface, ArrayAccess, \JsonSerializable ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - * @phpstan-var array - * @psalm-var array - */ + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ protected static $openAPIFormats = [ 'op_type' => null, 'table_name' => null, @@ -87,10 +87,10 @@ class UpdateColumn implements ModelInterface, ArrayAccess, \JsonSerializable ]; /** - * Array of nullable properties. Used for (de)serialization - * - * @var boolean[] - */ + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ protected static array $openAPINullables = [ 'op_type' => false, 'table_name' => false, @@ -104,10 +104,10 @@ class UpdateColumn implements ModelInterface, ArrayAccess, \JsonSerializable ]; /** - * If a nullable field gets set to null, insert it here - * - * @var boolean[] - */ + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ protected array $openAPINullablesSetToNull = []; /** @@ -316,14 +316,14 @@ public function __construct(?array $data = null) } /** - * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName - * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the - * $this->openAPINullablesSetToNull array - * - * @param string $variableName - * @param array $fields - * @param mixed $defaultValue - */ + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ private function setIfExists(string $variableName, array $fields, $defaultValue): void { if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { diff --git a/lib/Base/UpdateColumn200Response.php b/lib/Base/UpdateColumn200Response.php index 3d935625..ad781356 100644 --- a/lib/Base/UpdateColumn200Response.php +++ b/lib/Base/UpdateColumn200Response.php @@ -44,17 +44,17 @@ class UpdateColumn200Response implements ModelInterface, ArrayAccess, \JsonSeria public const DISCRIMINATOR = null; /** - * The original name of the model. - * - * @var string - */ + * The original name of the model. + * + * @var string + */ protected static $openAPIModelName = 'updateColumn_200_response'; /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ protected static $openAPITypes = [ 'key' => 'string', 'type' => 'string', @@ -69,12 +69,12 @@ class UpdateColumn200Response implements ModelInterface, ArrayAccess, \JsonSeria ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - * @phpstan-var array - * @psalm-var array - */ + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ protected static $openAPIFormats = [ 'key' => null, 'type' => null, @@ -89,10 +89,10 @@ class UpdateColumn200Response implements ModelInterface, ArrayAccess, \JsonSeria ]; /** - * Array of nullable properties. Used for (de)serialization - * - * @var boolean[] - */ + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ protected static array $openAPINullables = [ 'key' => false, 'type' => false, @@ -107,10 +107,10 @@ class UpdateColumn200Response implements ModelInterface, ArrayAccess, \JsonSeria ]; /** - * If a nullable field gets set to null, insert it here - * - * @var boolean[] - */ + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ protected array $openAPINullablesSetToNull = []; /** @@ -310,14 +310,14 @@ public function __construct(?array $data = null) } /** - * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName - * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the - * $this->openAPINullablesSetToNull array - * - * @param string $variableName - * @param array $fields - * @param mixed $defaultValue - */ + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ private function setIfExists(string $variableName, array $fields, $defaultValue): void { if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { diff --git a/lib/Base/UpdateColumnType.php b/lib/Base/UpdateColumnType.php index 95af2713..c7a894a5 100644 --- a/lib/Base/UpdateColumnType.php +++ b/lib/Base/UpdateColumnType.php @@ -44,17 +44,17 @@ class UpdateColumnType implements ModelInterface, ArrayAccess, \JsonSerializable public const DISCRIMINATOR = null; /** - * The original name of the model. - * - * @var string - */ + * The original name of the model. + * + * @var string + */ protected static $openAPIModelName = 'update_column_type'; /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ protected static $openAPITypes = [ 'op_type' => 'string', 'table_name' => 'string', @@ -64,12 +64,12 @@ class UpdateColumnType implements ModelInterface, ArrayAccess, \JsonSerializable ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - * @phpstan-var array - * @psalm-var array - */ + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ protected static $openAPIFormats = [ 'op_type' => null, 'table_name' => null, @@ -79,10 +79,10 @@ class UpdateColumnType implements ModelInterface, ArrayAccess, \JsonSerializable ]; /** - * Array of nullable properties. Used for (de)serialization - * - * @var boolean[] - */ + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ protected static array $openAPINullables = [ 'op_type' => false, 'table_name' => false, @@ -92,10 +92,10 @@ class UpdateColumnType implements ModelInterface, ArrayAccess, \JsonSerializable ]; /** - * If a nullable field gets set to null, insert it here - * - * @var boolean[] - */ + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ protected array $openAPINullablesSetToNull = []; /** @@ -288,14 +288,14 @@ public function __construct(?array $data = null) } /** - * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName - * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the - * $this->openAPINullablesSetToNull array - * - * @param string $variableName - * @param array $fields - * @param mixed $defaultValue - */ + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ private function setIfExists(string $variableName, array $fields, $defaultValue): void { if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { diff --git a/lib/Base/UpdateComment.php b/lib/Base/UpdateComment.php index 15ce9cc4..d0b87d1e 100644 --- a/lib/Base/UpdateComment.php +++ b/lib/Base/UpdateComment.php @@ -44,46 +44,46 @@ class UpdateComment implements ModelInterface, ArrayAccess, \JsonSerializable public const DISCRIMINATOR = null; /** - * The original name of the model. - * - * @var string - */ + * The original name of the model. + * + * @var string + */ protected static $openAPIModelName = 'update_comment'; /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ protected static $openAPITypes = [ 'options' => '\SeaTable\Client\Base\UpdateCommentOptions' ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - * @phpstan-var array - * @psalm-var array - */ + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ protected static $openAPIFormats = [ 'options' => null ]; /** - * Array of nullable properties. Used for (de)serialization - * - * @var boolean[] - */ + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ protected static array $openAPINullables = [ 'options' => false ]; /** - * If a nullable field gets set to null, insert it here - * - * @var boolean[] - */ + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ protected array $openAPINullablesSetToNull = []; /** @@ -247,14 +247,14 @@ public function __construct(?array $data = null) } /** - * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName - * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the - * $this->openAPINullablesSetToNull array - * - * @param string $variableName - * @param array $fields - * @param mixed $defaultValue - */ + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ private function setIfExists(string $variableName, array $fields, $defaultValue): void { if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { diff --git a/lib/Base/UpdateCommentOptions.php b/lib/Base/UpdateCommentOptions.php index 38e1463f..179bc6d3 100644 --- a/lib/Base/UpdateCommentOptions.php +++ b/lib/Base/UpdateCommentOptions.php @@ -44,49 +44,49 @@ class UpdateCommentOptions implements ModelInterface, ArrayAccess, \JsonSerializ public const DISCRIMINATOR = null; /** - * The original name of the model. - * - * @var string - */ + * The original name of the model. + * + * @var string + */ protected static $openAPIModelName = 'update_comment_options'; /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ protected static $openAPITypes = [ 'comment' => 'string', 'resolved' => 'string' ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - * @phpstan-var array - * @psalm-var array - */ + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ protected static $openAPIFormats = [ 'comment' => null, 'resolved' => null ]; /** - * Array of nullable properties. Used for (de)serialization - * - * @var boolean[] - */ + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ protected static array $openAPINullables = [ 'comment' => false, 'resolved' => false ]; /** - * If a nullable field gets set to null, insert it here - * - * @var boolean[] - */ + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ protected array $openAPINullablesSetToNull = []; /** @@ -269,14 +269,14 @@ public function __construct(?array $data = null) } /** - * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName - * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the - * $this->openAPINullablesSetToNull array - * - * @param string $variableName - * @param array $fields - * @param mixed $defaultValue - */ + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ private function setIfExists(string $variableName, array $fields, $defaultValue): void { if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { diff --git a/lib/Base/UpdateRow.php b/lib/Base/UpdateRow.php index 288d4574..edc3057b 100644 --- a/lib/Base/UpdateRow.php +++ b/lib/Base/UpdateRow.php @@ -45,17 +45,17 @@ class UpdateRow implements ModelInterface, ArrayAccess, \JsonSerializable public const DISCRIMINATOR = null; /** - * The original name of the model. - * - * @var string - */ + * The original name of the model. + * + * @var string + */ protected static $openAPIModelName = 'update_row'; /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ protected static $openAPITypes = [ 'table_name' => 'string', 'row_id' => 'string', @@ -63,12 +63,12 @@ class UpdateRow implements ModelInterface, ArrayAccess, \JsonSerializable ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - * @phpstan-var array - * @psalm-var array - */ + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ protected static $openAPIFormats = [ 'table_name' => null, 'row_id' => null, @@ -76,10 +76,10 @@ class UpdateRow implements ModelInterface, ArrayAccess, \JsonSerializable ]; /** - * Array of nullable properties. Used for (de)serialization - * - * @var boolean[] - */ + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ protected static array $openAPINullables = [ 'table_name' => false, 'row_id' => false, @@ -87,10 +87,10 @@ class UpdateRow implements ModelInterface, ArrayAccess, \JsonSerializable ]; /** - * If a nullable field gets set to null, insert it here - * - * @var boolean[] - */ + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ protected array $openAPINullablesSetToNull = []; /** @@ -262,14 +262,14 @@ public function __construct(?array $data = null) } /** - * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName - * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the - * $this->openAPINullablesSetToNull array - * - * @param string $variableName - * @param array $fields - * @param mixed $defaultValue - */ + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ private function setIfExists(string $variableName, array $fields, $defaultValue): void { if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { diff --git a/lib/Base/UpdateRow413Response.php b/lib/Base/UpdateRow413Response.php index e0c9eef0..50657d8d 100644 --- a/lib/Base/UpdateRow413Response.php +++ b/lib/Base/UpdateRow413Response.php @@ -44,46 +44,46 @@ class UpdateRow413Response implements ModelInterface, ArrayAccess, \JsonSerializ public const DISCRIMINATOR = null; /** - * The original name of the model. - * - * @var string - */ + * The original name of the model. + * + * @var string + */ protected static $openAPIModelName = 'updateRow_413_response'; /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ protected static $openAPITypes = [ 'error_message' => 'string' ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - * @phpstan-var array - * @psalm-var array - */ + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ protected static $openAPIFormats = [ 'error_message' => null ]; /** - * Array of nullable properties. Used for (de)serialization - * - * @var boolean[] - */ + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ protected static array $openAPINullables = [ 'error_message' => false ]; /** - * If a nullable field gets set to null, insert it here - * - * @var boolean[] - */ + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ protected array $openAPINullablesSetToNull = []; /** @@ -247,14 +247,14 @@ public function __construct(?array $data = null) } /** - * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName - * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the - * $this->openAPINullablesSetToNull array - * - * @param string $variableName - * @param array $fields - * @param mixed $defaultValue - */ + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ private function setIfExists(string $variableName, array $fields, $defaultValue): void { if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { diff --git a/lib/Base/UpdateRows.php b/lib/Base/UpdateRows.php index 1a60154f..f6236b45 100644 --- a/lib/Base/UpdateRows.php +++ b/lib/Base/UpdateRows.php @@ -45,49 +45,49 @@ class UpdateRows implements ModelInterface, ArrayAccess, \JsonSerializable public const DISCRIMINATOR = null; /** - * The original name of the model. - * - * @var string - */ + * The original name of the model. + * + * @var string + */ protected static $openAPIModelName = 'update_rows'; /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ protected static $openAPITypes = [ 'table_name' => 'string', 'updates' => '\SeaTable\Client\Base\UpdateRowsUpdatesInner[]' ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - * @phpstan-var array - * @psalm-var array - */ + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ protected static $openAPIFormats = [ 'table_name' => null, 'updates' => null ]; /** - * Array of nullable properties. Used for (de)serialization - * - * @var boolean[] - */ + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ protected static array $openAPINullables = [ 'table_name' => false, 'updates' => false ]; /** - * If a nullable field gets set to null, insert it here - * - * @var boolean[] - */ + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ protected array $openAPINullablesSetToNull = []; /** @@ -255,14 +255,14 @@ public function __construct(?array $data = null) } /** - * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName - * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the - * $this->openAPINullablesSetToNull array - * - * @param string $variableName - * @param array $fields - * @param mixed $defaultValue - */ + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ private function setIfExists(string $variableName, array $fields, $defaultValue): void { if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { @@ -355,7 +355,6 @@ public function setUpdates($updates) if (is_null($updates)) { throw new \InvalidArgumentException('non-nullable updates cannot be null'); } - if ((count($updates) > 1000)) { throw new \InvalidArgumentException('invalid value for $updates when calling UpdateRows., number of items must be less than or equal to 1000.'); } diff --git a/lib/Base/UpdateRowsUpdatesInner.php b/lib/Base/UpdateRowsUpdatesInner.php index 0f4cd3c0..faff66ad 100644 --- a/lib/Base/UpdateRowsUpdatesInner.php +++ b/lib/Base/UpdateRowsUpdatesInner.php @@ -44,49 +44,49 @@ class UpdateRowsUpdatesInner implements ModelInterface, ArrayAccess, \JsonSerial public const DISCRIMINATOR = null; /** - * The original name of the model. - * - * @var string - */ + * The original name of the model. + * + * @var string + */ protected static $openAPIModelName = 'update_rows_updates_inner'; /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ protected static $openAPITypes = [ 'row_id' => 'string', 'row' => 'object' ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - * @phpstan-var array - * @psalm-var array - */ + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ protected static $openAPIFormats = [ 'row_id' => null, 'row' => null ]; /** - * Array of nullable properties. Used for (de)serialization - * - * @var boolean[] - */ + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ protected static array $openAPINullables = [ 'row_id' => false, 'row' => false ]; /** - * If a nullable field gets set to null, insert it here - * - * @var boolean[] - */ + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ protected array $openAPINullablesSetToNull = []; /** @@ -254,14 +254,14 @@ public function __construct(?array $data = null) } /** - * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName - * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the - * $this->openAPINullablesSetToNull array - * - * @param string $variableName - * @param array $fields - * @param mixed $defaultValue - */ + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ private function setIfExists(string $variableName, array $fields, $defaultValue): void { if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { diff --git a/lib/Base/UpdateSingleMultipleSelectOptions.php b/lib/Base/UpdateSingleMultipleSelectOptions.php index b1374d5d..2bc6b904 100644 --- a/lib/Base/UpdateSingleMultipleSelectOptions.php +++ b/lib/Base/UpdateSingleMultipleSelectOptions.php @@ -44,17 +44,17 @@ class UpdateSingleMultipleSelectOptions implements ModelInterface, ArrayAccess, public const DISCRIMINATOR = null; /** - * The original name of the model. - * - * @var string - */ + * The original name of the model. + * + * @var string + */ protected static $openAPIModelName = 'update_single__multiple_select_options'; /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ protected static $openAPITypes = [ 'table_name' => 'string', 'column' => 'string', @@ -63,12 +63,12 @@ class UpdateSingleMultipleSelectOptions implements ModelInterface, ArrayAccess, ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - * @phpstan-var array - * @psalm-var array - */ + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ protected static $openAPIFormats = [ 'table_name' => null, 'column' => null, @@ -77,10 +77,10 @@ class UpdateSingleMultipleSelectOptions implements ModelInterface, ArrayAccess, ]; /** - * Array of nullable properties. Used for (de)serialization - * - * @var boolean[] - */ + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ protected static array $openAPINullables = [ 'table_name' => false, 'column' => false, @@ -89,10 +89,10 @@ class UpdateSingleMultipleSelectOptions implements ModelInterface, ArrayAccess, ]; /** - * If a nullable field gets set to null, insert it here - * - * @var boolean[] - */ + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ protected array $openAPINullablesSetToNull = []; /** @@ -268,14 +268,14 @@ public function __construct(?array $data = null) } /** - * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName - * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the - * $this->openAPINullablesSetToNull array - * - * @param string $variableName - * @param array $fields - * @param mixed $defaultValue - */ + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ private function setIfExists(string $variableName, array $fields, $defaultValue): void { if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { diff --git a/lib/Base/UpdateSingleMultipleSelectOptionsOptionsInner.php b/lib/Base/UpdateSingleMultipleSelectOptionsOptionsInner.php index fac70097..077a3c1b 100644 --- a/lib/Base/UpdateSingleMultipleSelectOptionsOptionsInner.php +++ b/lib/Base/UpdateSingleMultipleSelectOptionsOptionsInner.php @@ -44,17 +44,17 @@ class UpdateSingleMultipleSelectOptionsOptionsInner implements ModelInterface, A public const DISCRIMINATOR = null; /** - * The original name of the model. - * - * @var string - */ + * The original name of the model. + * + * @var string + */ protected static $openAPIModelName = 'update_single__multiple_select_options_options_inner'; /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ protected static $openAPITypes = [ 'id' => 'string', 'color' => 'string', @@ -63,12 +63,12 @@ class UpdateSingleMultipleSelectOptionsOptionsInner implements ModelInterface, A ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - * @phpstan-var array - * @psalm-var array - */ + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ protected static $openAPIFormats = [ 'id' => null, 'color' => null, @@ -77,10 +77,10 @@ class UpdateSingleMultipleSelectOptionsOptionsInner implements ModelInterface, A ]; /** - * Array of nullable properties. Used for (de)serialization - * - * @var boolean[] - */ + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ protected static array $openAPINullables = [ 'id' => false, 'color' => false, @@ -89,10 +89,10 @@ class UpdateSingleMultipleSelectOptionsOptionsInner implements ModelInterface, A ]; /** - * If a nullable field gets set to null, insert it here - * - * @var boolean[] - */ + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ protected array $openAPINullablesSetToNull = []; /** @@ -268,14 +268,14 @@ public function __construct(?array $data = null) } /** - * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName - * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the - * $this->openAPINullablesSetToNull array - * - * @param string $variableName - * @param array $fields - * @param mixed $defaultValue - */ + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ private function setIfExists(string $variableName, array $fields, $defaultValue): void { if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { diff --git a/lib/Base/UpdateView.php b/lib/Base/UpdateView.php index 9db5c606..e50a5ce5 100644 --- a/lib/Base/UpdateView.php +++ b/lib/Base/UpdateView.php @@ -44,17 +44,17 @@ class UpdateView implements ModelInterface, ArrayAccess, \JsonSerializable public const DISCRIMINATOR = null; /** - * The original name of the model. - * - * @var string - */ + * The original name of the model. + * + * @var string + */ protected static $openAPIModelName = 'update_view'; /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ protected static $openAPITypes = [ 'name' => 'string', 'is_locked' => 'bool', @@ -66,12 +66,12 @@ class UpdateView implements ModelInterface, ArrayAccess, \JsonSerializable ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - * @phpstan-var array - * @psalm-var array - */ + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ protected static $openAPIFormats = [ 'name' => null, 'is_locked' => null, @@ -83,10 +83,10 @@ class UpdateView implements ModelInterface, ArrayAccess, \JsonSerializable ]; /** - * Array of nullable properties. Used for (de)serialization - * - * @var boolean[] - */ + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ protected static array $openAPINullables = [ 'name' => false, 'is_locked' => false, @@ -98,10 +98,10 @@ class UpdateView implements ModelInterface, ArrayAccess, \JsonSerializable ]; /** - * If a nullable field gets set to null, insert it here - * - * @var boolean[] - */ + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ protected array $openAPINullablesSetToNull = []; /** @@ -289,14 +289,14 @@ public function __construct(?array $data = null) } /** - * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName - * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the - * $this->openAPINullablesSetToNull array - * - * @param string $variableName - * @param array $fields - * @param mixed $defaultValue - */ + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ private function setIfExists(string $variableName, array $fields, $defaultValue): void { if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { diff --git a/lib/Base/UpdateViewFiltersInner.php b/lib/Base/UpdateViewFiltersInner.php index c7ceca1d..d9b0521e 100644 --- a/lib/Base/UpdateViewFiltersInner.php +++ b/lib/Base/UpdateViewFiltersInner.php @@ -44,17 +44,17 @@ class UpdateViewFiltersInner implements ModelInterface, ArrayAccess, \JsonSerial public const DISCRIMINATOR = null; /** - * The original name of the model. - * - * @var string - */ + * The original name of the model. + * + * @var string + */ protected static $openAPIModelName = 'update_view_filters_inner'; /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ protected static $openAPITypes = [ 'column_key' => 'string', 'filter_predicate' => '\SeaTable\Client\Base\EmailFilterPredicate', @@ -63,12 +63,12 @@ class UpdateViewFiltersInner implements ModelInterface, ArrayAccess, \JsonSerial ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - * @phpstan-var array - * @psalm-var array - */ + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ protected static $openAPIFormats = [ 'column_key' => null, 'filter_predicate' => null, @@ -77,10 +77,10 @@ class UpdateViewFiltersInner implements ModelInterface, ArrayAccess, \JsonSerial ]; /** - * Array of nullable properties. Used for (de)serialization - * - * @var boolean[] - */ + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ protected static array $openAPINullables = [ 'column_key' => false, 'filter_predicate' => false, @@ -89,10 +89,10 @@ class UpdateViewFiltersInner implements ModelInterface, ArrayAccess, \JsonSerial ]; /** - * If a nullable field gets set to null, insert it here - * - * @var boolean[] - */ + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ protected array $openAPINullablesSetToNull = []; /** @@ -268,14 +268,14 @@ public function __construct(?array $data = null) } /** - * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName - * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the - * $this->openAPINullablesSetToNull array - * - * @param string $variableName - * @param array $fields - * @param mixed $defaultValue - */ + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ private function setIfExists(string $variableName, array $fields, $defaultValue): void { if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { diff --git a/lib/Base/UrlColumn.php b/lib/Base/UrlColumn.php index 72c2e959..af0c5f5a 100644 --- a/lib/Base/UrlColumn.php +++ b/lib/Base/UrlColumn.php @@ -45,17 +45,17 @@ class UrlColumn implements ModelInterface, ArrayAccess, \JsonSerializable public const DISCRIMINATOR = null; /** - * The original name of the model. - * - * @var string - */ + * The original name of the model. + * + * @var string + */ protected static $openAPIModelName = 'url_column'; /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ protected static $openAPITypes = [ 'column_name' => 'string', 'column_type' => 'string', @@ -63,12 +63,12 @@ class UrlColumn implements ModelInterface, ArrayAccess, \JsonSerializable ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - * @phpstan-var array - * @psalm-var array - */ + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ protected static $openAPIFormats = [ 'column_name' => null, 'column_type' => null, @@ -76,10 +76,10 @@ class UrlColumn implements ModelInterface, ArrayAccess, \JsonSerializable ]; /** - * Array of nullable properties. Used for (de)serialization - * - * @var boolean[] - */ + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ protected static array $openAPINullables = [ 'column_name' => false, 'column_type' => false, @@ -87,10 +87,10 @@ class UrlColumn implements ModelInterface, ArrayAccess, \JsonSerializable ]; /** - * If a nullable field gets set to null, insert it here - * - * @var boolean[] - */ + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ protected array $openAPINullablesSetToNull = []; /** @@ -275,14 +275,14 @@ public function __construct(?array $data = null) } /** - * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName - * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the - * $this->openAPINullablesSetToNull array - * - * @param string $variableName - * @param array $fields - * @param mixed $defaultValue - */ + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ private function setIfExists(string $variableName, array $fields, $defaultValue): void { if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { diff --git a/lib/Base/UrlColumnWithTableName.php b/lib/Base/UrlColumnWithTableName.php index bf6f67a5..eddbba3a 100644 --- a/lib/Base/UrlColumnWithTableName.php +++ b/lib/Base/UrlColumnWithTableName.php @@ -44,17 +44,17 @@ class UrlColumnWithTableName implements ModelInterface, ArrayAccess, \JsonSerial public const DISCRIMINATOR = null; /** - * The original name of the model. - * - * @var string - */ + * The original name of the model. + * + * @var string + */ protected static $openAPIModelName = 'url_column_with_table_name'; /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ protected static $openAPITypes = [ 'table_name' => 'string', 'column_name' => 'string', @@ -63,12 +63,12 @@ class UrlColumnWithTableName implements ModelInterface, ArrayAccess, \JsonSerial ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - * @phpstan-var array - * @psalm-var array - */ + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ protected static $openAPIFormats = [ 'table_name' => null, 'column_name' => null, @@ -77,10 +77,10 @@ class UrlColumnWithTableName implements ModelInterface, ArrayAccess, \JsonSerial ]; /** - * Array of nullable properties. Used for (de)serialization - * - * @var boolean[] - */ + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ protected static array $openAPINullables = [ 'table_name' => false, 'column_name' => false, @@ -89,10 +89,10 @@ class UrlColumnWithTableName implements ModelInterface, ArrayAccess, \JsonSerial ]; /** - * If a nullable field gets set to null, insert it here - * - * @var boolean[] - */ + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ protected array $openAPINullablesSetToNull = []; /** @@ -281,14 +281,14 @@ public function __construct(?array $data = null) } /** - * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName - * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the - * $this->openAPINullablesSetToNull array - * - * @param string $variableName - * @param array $fields - * @param mixed $defaultValue - */ + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ private function setIfExists(string $variableName, array $fields, $defaultValue): void { if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { diff --git a/lib/Base/ViewsApi.php b/lib/Base/ViewsApi.php index 332b3d47..21c8a177 100644 --- a/lib/Base/ViewsApi.php +++ b/lib/Base/ViewsApi.php @@ -28,11 +28,11 @@ use GuzzleHttp\Client; use GuzzleHttp\ClientInterface; -use GuzzleHttp\Exception\ConnectException; use GuzzleHttp\Exception\RequestException; use GuzzleHttp\Psr7\MultipartStream; use GuzzleHttp\Psr7\Request; use GuzzleHttp\RequestOptions; +use Psr\Http\Client\NetworkExceptionInterface; use Psr\Http\Message\RequestInterface; use Psr\Http\Message\ResponseInterface; use SeaTable\Client\ApiException; @@ -179,13 +179,14 @@ public function createViewWithHttpInfo($base_uuid, $table_name, $new_view = null try { $response = $this->client->send($request, $options); } catch (RequestException $e) { + $eResponse = $this->getExceptionResponse($e); throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), - $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? (string) $e->getResponse()->getBody() : null + $eResponse ? $eResponse->getHeaders() : null, + $eResponse ? (string) $eResponse->getBody() : null ); - } catch (ConnectException $e) { + } catch (NetworkExceptionInterface $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), @@ -304,7 +305,15 @@ function ($response) use ($returnType) { ]; }, function ($exception) { - $response = $exception->getResponse(); + $response = $this->getExceptionResponse($exception); + if ($response === null) { + throw new ApiException( + "[{$exception->getCode()}] {$exception->getMessage()}", + (int) $exception->getCode(), + null, + null + ); + } $statusCode = $response->getStatusCode(); throw new ApiException( sprintf( @@ -374,7 +383,7 @@ public function createViewRequest($base_uuid, $table_name, $new_view = null, str // path params if ($base_uuid !== null) { $resourcePath = str_replace( - '{' . 'base_uuid' . '}', + '{base_uuid}', ObjectSerializer::toPathValue($base_uuid), $resourcePath ); @@ -391,7 +400,11 @@ public function createViewRequest($base_uuid, $table_name, $new_view = null, str if (isset($new_view)) { if (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the body - $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($new_view)); + try { + $httpBody = json_encode(ObjectSerializer::sanitizeForSerialization($new_view), JSON_THROW_ON_ERROR); + } catch (\JsonException $e) { + throw new \InvalidArgumentException('json_encode error: ' . $e->getMessage(), 0, $e); + } } else { $httpBody = $new_view; } @@ -412,7 +425,11 @@ public function createViewRequest($base_uuid, $table_name, $new_view = null, str } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + try { + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + } catch (\JsonException $e) { + throw new \InvalidArgumentException('json_encode error: ' . $e->getMessage(), 0, $e); + } } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -488,13 +505,14 @@ public function deleteViewWithHttpInfo($base_uuid, $view_name, $table_name, stri try { $response = $this->client->send($request, $options); } catch (RequestException $e) { + $eResponse = $this->getExceptionResponse($e); throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), - $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? (string) $e->getResponse()->getBody() : null + $eResponse ? $eResponse->getHeaders() : null, + $eResponse ? (string) $eResponse->getBody() : null ); - } catch (ConnectException $e) { + } catch (NetworkExceptionInterface $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), @@ -613,7 +631,15 @@ function ($response) use ($returnType) { ]; }, function ($exception) { - $response = $exception->getResponse(); + $response = $this->getExceptionResponse($exception); + if ($response === null) { + throw new ApiException( + "[{$exception->getCode()}] {$exception->getMessage()}", + (int) $exception->getCode(), + null, + null + ); + } $statusCode = $response->getStatusCode(); throw new ApiException( sprintf( @@ -689,7 +715,7 @@ public function deleteViewRequest($base_uuid, $view_name, $table_name, string $c // path params if ($base_uuid !== null) { $resourcePath = str_replace( - '{' . 'base_uuid' . '}', + '{base_uuid}', ObjectSerializer::toPathValue($base_uuid), $resourcePath ); @@ -697,7 +723,7 @@ public function deleteViewRequest($base_uuid, $view_name, $table_name, string $c // path params if ($view_name !== null) { $resourcePath = str_replace( - '{' . 'view_name' . '}', + '{view_name}', ObjectSerializer::toPathValue($view_name), $resourcePath ); @@ -728,7 +754,11 @@ public function deleteViewRequest($base_uuid, $view_name, $table_name, string $c } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + try { + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + } catch (\JsonException $e) { + throw new \InvalidArgumentException('json_encode error: ' . $e->getMessage(), 0, $e); + } } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -804,13 +834,14 @@ public function getViewWithHttpInfo($base_uuid, $view_name, $table_name, string try { $response = $this->client->send($request, $options); } catch (RequestException $e) { + $eResponse = $this->getExceptionResponse($e); throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), - $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? (string) $e->getResponse()->getBody() : null + $eResponse ? $eResponse->getHeaders() : null, + $eResponse ? (string) $eResponse->getBody() : null ); - } catch (ConnectException $e) { + } catch (NetworkExceptionInterface $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), @@ -929,7 +960,15 @@ function ($response) use ($returnType) { ]; }, function ($exception) { - $response = $exception->getResponse(); + $response = $this->getExceptionResponse($exception); + if ($response === null) { + throw new ApiException( + "[{$exception->getCode()}] {$exception->getMessage()}", + (int) $exception->getCode(), + null, + null + ); + } $statusCode = $response->getStatusCode(); throw new ApiException( sprintf( @@ -1005,7 +1044,7 @@ public function getViewRequest($base_uuid, $view_name, $table_name, string $cont // path params if ($base_uuid !== null) { $resourcePath = str_replace( - '{' . 'base_uuid' . '}', + '{base_uuid}', ObjectSerializer::toPathValue($base_uuid), $resourcePath ); @@ -1013,7 +1052,7 @@ public function getViewRequest($base_uuid, $view_name, $table_name, string $cont // path params if ($view_name !== null) { $resourcePath = str_replace( - '{' . 'view_name' . '}', + '{view_name}', ObjectSerializer::toPathValue($view_name), $resourcePath ); @@ -1044,7 +1083,11 @@ public function getViewRequest($base_uuid, $view_name, $table_name, string $cont } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + try { + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + } catch (\JsonException $e) { + throw new \InvalidArgumentException('json_encode error: ' . $e->getMessage(), 0, $e); + } } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -1118,13 +1161,14 @@ public function listViewsWithHttpInfo($base_uuid, $table_name, string $contentTy try { $response = $this->client->send($request, $options); } catch (RequestException $e) { + $eResponse = $this->getExceptionResponse($e); throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), - $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? (string) $e->getResponse()->getBody() : null + $eResponse ? $eResponse->getHeaders() : null, + $eResponse ? (string) $eResponse->getBody() : null ); - } catch (ConnectException $e) { + } catch (NetworkExceptionInterface $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), @@ -1241,7 +1285,15 @@ function ($response) use ($returnType) { ]; }, function ($exception) { - $response = $exception->getResponse(); + $response = $this->getExceptionResponse($exception); + if ($response === null) { + throw new ApiException( + "[{$exception->getCode()}] {$exception->getMessage()}", + (int) $exception->getCode(), + null, + null + ); + } $statusCode = $response->getStatusCode(); throw new ApiException( sprintf( @@ -1309,7 +1361,7 @@ public function listViewsRequest($base_uuid, $table_name, string $contentType = // path params if ($base_uuid !== null) { $resourcePath = str_replace( - '{' . 'base_uuid' . '}', + '{base_uuid}', ObjectSerializer::toPathValue($base_uuid), $resourcePath ); @@ -1340,7 +1392,11 @@ public function listViewsRequest($base_uuid, $table_name, string $contentType = } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + try { + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + } catch (\JsonException $e) { + throw new \InvalidArgumentException('json_encode error: ' . $e->getMessage(), 0, $e); + } } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -1418,13 +1474,14 @@ public function updateViewWithHttpInfo($base_uuid, $view_name, $table_name, $upd try { $response = $this->client->send($request, $options); } catch (RequestException $e) { + $eResponse = $this->getExceptionResponse($e); throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), - $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? (string) $e->getResponse()->getBody() : null + $eResponse ? $eResponse->getHeaders() : null, + $eResponse ? (string) $eResponse->getBody() : null ); - } catch (ConnectException $e) { + } catch (NetworkExceptionInterface $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), @@ -1545,7 +1602,15 @@ function ($response) use ($returnType) { ]; }, function ($exception) { - $response = $exception->getResponse(); + $response = $this->getExceptionResponse($exception); + if ($response === null) { + throw new ApiException( + "[{$exception->getCode()}] {$exception->getMessage()}", + (int) $exception->getCode(), + null, + null + ); + } $statusCode = $response->getStatusCode(); throw new ApiException( sprintf( @@ -1623,7 +1688,7 @@ public function updateViewRequest($base_uuid, $view_name, $table_name, $update_v // path params if ($base_uuid !== null) { $resourcePath = str_replace( - '{' . 'base_uuid' . '}', + '{base_uuid}', ObjectSerializer::toPathValue($base_uuid), $resourcePath ); @@ -1631,7 +1696,7 @@ public function updateViewRequest($base_uuid, $view_name, $table_name, $update_v // path params if ($view_name !== null) { $resourcePath = str_replace( - '{' . 'view_name' . '}', + '{view_name}', ObjectSerializer::toPathValue($view_name), $resourcePath ); @@ -1648,7 +1713,11 @@ public function updateViewRequest($base_uuid, $view_name, $table_name, $update_v if (isset($update_view)) { if (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the body - $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($update_view)); + try { + $httpBody = json_encode(ObjectSerializer::sanitizeForSerialization($update_view), JSON_THROW_ON_ERROR); + } catch (\JsonException $e) { + throw new \InvalidArgumentException('json_encode error: ' . $e->getMessage(), 0, $e); + } } else { $httpBody = $update_view; } @@ -1669,7 +1738,11 @@ public function updateViewRequest($base_uuid, $view_name, $table_name, $update_v } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + try { + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + } catch (\JsonException $e) { + throw new \InvalidArgumentException('json_encode error: ' . $e->getMessage(), 0, $e); + } } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -1729,6 +1802,21 @@ protected function createHttpClientOption() return $options; } + /** + * Returns the response attached to a Guzzle exception, if there is one. + * + * Guzzle 7 exposes getResponse() on RequestException, while Guzzle 8 only + * exposes it on ResponseException and its subclasses. + * + * @param \Throwable $exception + * + * @return ResponseInterface|null + */ + private function getExceptionResponse(\Throwable $exception): ?ResponseInterface + { + return method_exists($exception, 'getResponse') ? $exception->getResponse() : null; + } + private function handleResponseWithDataType( string $dataType, RequestInterface $request, diff --git a/lib/File/DeleteBaseAsset404Response.php b/lib/File/DeleteBaseAsset404Response.php index c3608c89..34bfad14 100644 --- a/lib/File/DeleteBaseAsset404Response.php +++ b/lib/File/DeleteBaseAsset404Response.php @@ -44,46 +44,46 @@ class DeleteBaseAsset404Response implements ModelInterface, ArrayAccess, \JsonSe public const DISCRIMINATOR = null; /** - * The original name of the model. - * - * @var string - */ + * The original name of the model. + * + * @var string + */ protected static $openAPIModelName = 'deleteBaseAsset_404_response'; /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ protected static $openAPITypes = [ 'error_msg' => 'string' ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - * @phpstan-var array - * @psalm-var array - */ + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ protected static $openAPIFormats = [ 'error_msg' => null ]; /** - * Array of nullable properties. Used for (de)serialization - * - * @var boolean[] - */ + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ protected static array $openAPINullables = [ 'error_msg' => false ]; /** - * If a nullable field gets set to null, insert it here - * - * @var boolean[] - */ + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ protected array $openAPINullablesSetToNull = []; /** @@ -247,14 +247,14 @@ public function __construct(?array $data = null) } /** - * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName - * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the - * $this->openAPINullablesSetToNull array - * - * @param string $variableName - * @param array $fields - * @param mixed $defaultValue - */ + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ private function setIfExists(string $variableName, array $fields, $defaultValue): void { if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { diff --git a/lib/File/FilesImagesApi.php b/lib/File/FilesImagesApi.php index fad1da60..e7a64042 100644 --- a/lib/File/FilesImagesApi.php +++ b/lib/File/FilesImagesApi.php @@ -28,11 +28,11 @@ use GuzzleHttp\Client; use GuzzleHttp\ClientInterface; -use GuzzleHttp\Exception\ConnectException; use GuzzleHttp\Exception\RequestException; use GuzzleHttp\Psr7\MultipartStream; use GuzzleHttp\Psr7\Request; use GuzzleHttp\RequestOptions; +use Psr\Http\Client\NetworkExceptionInterface; use Psr\Http\Message\RequestInterface; use Psr\Http\Message\ResponseInterface; use SeaTable\Client\ApiException; @@ -172,13 +172,14 @@ public function deleteBaseAssetWithHttpInfo($path, string $contentType = self::c try { $response = $this->client->send($request, $options); } catch (RequestException $e) { + $eResponse = $this->getExceptionResponse($e); throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), - $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? (string) $e->getResponse()->getBody() : null + $eResponse ? $eResponse->getHeaders() : null, + $eResponse ? (string) $eResponse->getBody() : null ); - } catch (ConnectException $e) { + } catch (NetworkExceptionInterface $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), @@ -307,7 +308,15 @@ function ($response) use ($returnType) { ]; }, function ($exception) { - $response = $exception->getResponse(); + $response = $this->getExceptionResponse($exception); + if ($response === null) { + throw new ApiException( + "[{$exception->getCode()}] {$exception->getMessage()}", + (int) $exception->getCode(), + null, + null + ); + } $statusCode = $response->getStatusCode(); throw new ApiException( sprintf( @@ -390,7 +399,11 @@ public function deleteBaseAssetRequest($path, string $contentType = self::conten } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + try { + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + } catch (\JsonException $e) { + throw new \InvalidArgumentException('json_encode error: ' . $e->getMessage(), 0, $e); + } } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -462,13 +475,14 @@ public function getFileDownloadLinkWithHttpInfo($path, string $contentType = sel try { $response = $this->client->send($request, $options); } catch (RequestException $e) { + $eResponse = $this->getExceptionResponse($e); throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), - $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? (string) $e->getResponse()->getBody() : null + $eResponse ? $eResponse->getHeaders() : null, + $eResponse ? (string) $eResponse->getBody() : null ); - } catch (ConnectException $e) { + } catch (NetworkExceptionInterface $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), @@ -597,7 +611,15 @@ function ($response) use ($returnType) { ]; }, function ($exception) { - $response = $exception->getResponse(); + $response = $this->getExceptionResponse($exception); + if ($response === null) { + throw new ApiException( + "[{$exception->getCode()}] {$exception->getMessage()}", + (int) $exception->getCode(), + null, + null + ); + } $statusCode = $response->getStatusCode(); throw new ApiException( sprintf( @@ -680,7 +702,11 @@ public function getFileDownloadLinkRequest($path, string $contentType = self::co } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + try { + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + } catch (\JsonException $e) { + throw new \InvalidArgumentException('json_encode error: ' . $e->getMessage(), 0, $e); + } } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -750,13 +776,14 @@ public function getUploadLinkWithHttpInfo(string $contentType = self::contentTyp try { $response = $this->client->send($request, $options); } catch (RequestException $e) { + $eResponse = $this->getExceptionResponse($e); throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), - $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? (string) $e->getResponse()->getBody() : null + $eResponse ? $eResponse->getHeaders() : null, + $eResponse ? (string) $eResponse->getBody() : null ); - } catch (ConnectException $e) { + } catch (NetworkExceptionInterface $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), @@ -869,7 +896,15 @@ function ($response) use ($returnType) { ]; }, function ($exception) { - $response = $exception->getResponse(); + $response = $this->getExceptionResponse($exception); + if ($response === null) { + throw new ApiException( + "[{$exception->getCode()}] {$exception->getMessage()}", + (int) $exception->getCode(), + null, + null + ); + } $statusCode = $response->getStatusCode(); throw new ApiException( sprintf( @@ -932,7 +967,11 @@ public function getUploadLinkRequest(string $contentType = self::contentTypes['g } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + try { + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + } catch (\JsonException $e) { + throw new \InvalidArgumentException('json_encode error: ' . $e->getMessage(), 0, $e); + } } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -1012,13 +1051,14 @@ public function uploadFileWithHttpInfo($upload_link, $file, $parent_dir, $relati try { $response = $this->client->send($request, $options); } catch (RequestException $e) { + $eResponse = $this->getExceptionResponse($e); throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), - $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? (string) $e->getResponse()->getBody() : null + $eResponse ? $eResponse->getHeaders() : null, + $eResponse ? (string) $eResponse->getBody() : null ); - } catch (ConnectException $e) { + } catch (NetworkExceptionInterface $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), @@ -1141,7 +1181,15 @@ function ($response) use ($returnType) { ]; }, function ($exception) { - $response = $exception->getResponse(); + $response = $this->getExceptionResponse($exception); + if ($response === null) { + throw new ApiException( + "[{$exception->getCode()}] {$exception->getMessage()}", + (int) $exception->getCode(), + null, + null + ); + } $statusCode = $response->getStatusCode(); throw new ApiException( sprintf( @@ -1221,7 +1269,7 @@ public function uploadFileRequest($upload_link, $file, $parent_dir, $relative_pa // path params if ($upload_link !== null) { $resourcePath = str_replace( - '{' . 'upload_link' . '}', + '{upload_link}', ObjectSerializer::toPathValue($upload_link), $resourcePath ); @@ -1265,7 +1313,11 @@ public function uploadFileRequest($upload_link, $file, $parent_dir, $relative_pa } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + try { + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + } catch (\JsonException $e) { + throw new \InvalidArgumentException('json_encode error: ' . $e->getMessage(), 0, $e); + } } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -1325,6 +1377,21 @@ protected function createHttpClientOption() return $options; } + /** + * Returns the response attached to a Guzzle exception, if there is one. + * + * Guzzle 7 exposes getResponse() on RequestException, while Guzzle 8 only + * exposes it on ResponseException and its subclasses. + * + * @param \Throwable $exception + * + * @return ResponseInterface|null + */ + private function getExceptionResponse(\Throwable $exception): ?ResponseInterface + { + return method_exists($exception, 'getResponse') ? $exception->getResponse() : null; + } + private function handleResponseWithDataType( string $dataType, RequestInterface $request, diff --git a/lib/File/FilesImagesCustomFolderApi.php b/lib/File/FilesImagesCustomFolderApi.php index 24891248..e566c695 100644 --- a/lib/File/FilesImagesCustomFolderApi.php +++ b/lib/File/FilesImagesCustomFolderApi.php @@ -28,11 +28,11 @@ use GuzzleHttp\Client; use GuzzleHttp\ClientInterface; -use GuzzleHttp\Exception\ConnectException; use GuzzleHttp\Exception\RequestException; use GuzzleHttp\Psr7\MultipartStream; use GuzzleHttp\Psr7\Request; use GuzzleHttp\RequestOptions; +use Psr\Http\Client\NetworkExceptionInterface; use Psr\Http\Message\RequestInterface; use Psr\Http\Message\ResponseInterface; use SeaTable\Client\ApiException; @@ -175,13 +175,14 @@ public function deleteBaseCustomFolderAssetWithHttpInfo($path, string $contentTy try { $response = $this->client->send($request, $options); } catch (RequestException $e) { + $eResponse = $this->getExceptionResponse($e); throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), - $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? (string) $e->getResponse()->getBody() : null + $eResponse ? $eResponse->getHeaders() : null, + $eResponse ? (string) $eResponse->getBody() : null ); - } catch (ConnectException $e) { + } catch (NetworkExceptionInterface $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), @@ -296,7 +297,15 @@ function ($response) use ($returnType) { ]; }, function ($exception) { - $response = $exception->getResponse(); + $response = $this->getExceptionResponse($exception); + if ($response === null) { + throw new ApiException( + "[{$exception->getCode()}] {$exception->getMessage()}", + (int) $exception->getCode(), + null, + null + ); + } $statusCode = $response->getStatusCode(); throw new ApiException( sprintf( @@ -376,7 +385,11 @@ public function deleteBaseCustomFolderAssetRequest($path, string $contentType = } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + try { + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + } catch (\JsonException $e) { + throw new \InvalidArgumentException('json_encode error: ' . $e->getMessage(), 0, $e); + } } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -448,13 +461,14 @@ public function getCustomDownloadLinkWithHttpInfo($path, string $contentType = s try { $response = $this->client->send($request, $options); } catch (RequestException $e) { + $eResponse = $this->getExceptionResponse($e); throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), - $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? (string) $e->getResponse()->getBody() : null + $eResponse ? $eResponse->getHeaders() : null, + $eResponse ? (string) $eResponse->getBody() : null ); - } catch (ConnectException $e) { + } catch (NetworkExceptionInterface $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), @@ -569,7 +583,15 @@ function ($response) use ($returnType) { ]; }, function ($exception) { - $response = $exception->getResponse(); + $response = $this->getExceptionResponse($exception); + if ($response === null) { + throw new ApiException( + "[{$exception->getCode()}] {$exception->getMessage()}", + (int) $exception->getCode(), + null, + null + ); + } $statusCode = $response->getStatusCode(); throw new ApiException( sprintf( @@ -649,7 +671,11 @@ public function getCustomDownloadLinkRequest($path, string $contentType = self:: } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + try { + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + } catch (\JsonException $e) { + throw new \InvalidArgumentException('json_encode error: ' . $e->getMessage(), 0, $e); + } } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -723,13 +749,14 @@ public function getCustomFileMetadataWithHttpInfo($path, $name, string $contentT try { $response = $this->client->send($request, $options); } catch (RequestException $e) { + $eResponse = $this->getExceptionResponse($e); throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), - $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? (string) $e->getResponse()->getBody() : null + $eResponse ? $eResponse->getHeaders() : null, + $eResponse ? (string) $eResponse->getBody() : null ); - } catch (ConnectException $e) { + } catch (NetworkExceptionInterface $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), @@ -846,7 +873,15 @@ function ($response) use ($returnType) { ]; }, function ($exception) { - $response = $exception->getResponse(); + $response = $this->getExceptionResponse($exception); + if ($response === null) { + throw new ApiException( + "[{$exception->getCode()}] {$exception->getMessage()}", + (int) $exception->getCode(), + null, + null + ); + } $statusCode = $response->getStatusCode(); throw new ApiException( sprintf( @@ -943,7 +978,11 @@ public function getCustomFileMetadataRequest($path, $name, string $contentType = } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + try { + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + } catch (\JsonException $e) { + throw new \InvalidArgumentException('json_encode error: ' . $e->getMessage(), 0, $e); + } } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -1015,13 +1054,14 @@ public function getCustomFilesWithHttpInfo($path, string $contentType = self::co try { $response = $this->client->send($request, $options); } catch (RequestException $e) { + $eResponse = $this->getExceptionResponse($e); throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), - $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? (string) $e->getResponse()->getBody() : null + $eResponse ? $eResponse->getHeaders() : null, + $eResponse ? (string) $eResponse->getBody() : null ); - } catch (ConnectException $e) { + } catch (NetworkExceptionInterface $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), @@ -1136,7 +1176,15 @@ function ($response) use ($returnType) { ]; }, function ($exception) { - $response = $exception->getResponse(); + $response = $this->getExceptionResponse($exception); + if ($response === null) { + throw new ApiException( + "[{$exception->getCode()}] {$exception->getMessage()}", + (int) $exception->getCode(), + null, + null + ); + } $statusCode = $response->getStatusCode(); throw new ApiException( sprintf( @@ -1216,7 +1264,11 @@ public function getCustomFilesRequest($path, string $contentType = self::content } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + try { + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + } catch (\JsonException $e) { + throw new \InvalidArgumentException('json_encode error: ' . $e->getMessage(), 0, $e); + } } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -1288,13 +1340,14 @@ public function getCustomUploadLinkWithHttpInfo($path, string $contentType = sel try { $response = $this->client->send($request, $options); } catch (RequestException $e) { + $eResponse = $this->getExceptionResponse($e); throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), - $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? (string) $e->getResponse()->getBody() : null + $eResponse ? $eResponse->getHeaders() : null, + $eResponse ? (string) $eResponse->getBody() : null ); - } catch (ConnectException $e) { + } catch (NetworkExceptionInterface $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), @@ -1409,7 +1462,15 @@ function ($response) use ($returnType) { ]; }, function ($exception) { - $response = $exception->getResponse(); + $response = $this->getExceptionResponse($exception); + if ($response === null) { + throw new ApiException( + "[{$exception->getCode()}] {$exception->getMessage()}", + (int) $exception->getCode(), + null, + null + ); + } $statusCode = $response->getStatusCode(); throw new ApiException( sprintf( @@ -1489,7 +1550,11 @@ public function getCustomUploadLinkRequest($path, string $contentType = self::co } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + try { + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + } catch (\JsonException $e) { + throw new \InvalidArgumentException('json_encode error: ' . $e->getMessage(), 0, $e); + } } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -1549,6 +1614,21 @@ protected function createHttpClientOption() return $options; } + /** + * Returns the response attached to a Guzzle exception, if there is one. + * + * Guzzle 7 exposes getResponse() on RequestException, while Guzzle 8 only + * exposes it on ResponseException and its subclasses. + * + * @param \Throwable $exception + * + * @return ResponseInterface|null + */ + private function getExceptionResponse(\Throwable $exception): ?ResponseInterface + { + return method_exists($exception, 'getResponse') ? $exception->getResponse() : null; + } + private function handleResponseWithDataType( string $dataType, RequestInterface $request, diff --git a/lib/File/GetFileDownloadLink404Response.php b/lib/File/GetFileDownloadLink404Response.php index 76f1da34..557a5bbd 100644 --- a/lib/File/GetFileDownloadLink404Response.php +++ b/lib/File/GetFileDownloadLink404Response.php @@ -44,46 +44,46 @@ class GetFileDownloadLink404Response implements ModelInterface, ArrayAccess, \Js public const DISCRIMINATOR = null; /** - * The original name of the model. - * - * @var string - */ + * The original name of the model. + * + * @var string + */ protected static $openAPIModelName = 'getFileDownloadLink_404_response'; /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ protected static $openAPITypes = [ 'error_msg' => 'string' ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - * @phpstan-var array - * @psalm-var array - */ + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ protected static $openAPIFormats = [ 'error_msg' => null ]; /** - * Array of nullable properties. Used for (de)serialization - * - * @var boolean[] - */ + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ protected static array $openAPINullables = [ 'error_msg' => false ]; /** - * If a nullable field gets set to null, insert it here - * - * @var boolean[] - */ + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ protected array $openAPINullablesSetToNull = []; /** @@ -247,14 +247,14 @@ public function __construct(?array $data = null) } /** - * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName - * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the - * $this->openAPINullablesSetToNull array - * - * @param string $variableName - * @param array $fields - * @param mixed $defaultValue - */ + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ private function setIfExists(string $variableName, array $fields, $defaultValue): void { if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { diff --git a/lib/File/GetUploadLink200Response.php b/lib/File/GetUploadLink200Response.php index 962fa577..8e624bbf 100644 --- a/lib/File/GetUploadLink200Response.php +++ b/lib/File/GetUploadLink200Response.php @@ -44,17 +44,17 @@ class GetUploadLink200Response implements ModelInterface, ArrayAccess, \JsonSeri public const DISCRIMINATOR = null; /** - * The original name of the model. - * - * @var string - */ + * The original name of the model. + * + * @var string + */ protected static $openAPIModelName = 'getUploadLink_200_response'; /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ protected static $openAPITypes = [ 'upload_link' => 'string', 'workspace_id' => 'int', @@ -64,12 +64,12 @@ class GetUploadLink200Response implements ModelInterface, ArrayAccess, \JsonSeri ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - * @phpstan-var array - * @psalm-var array - */ + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ protected static $openAPIFormats = [ 'upload_link' => null, 'workspace_id' => null, @@ -79,10 +79,10 @@ class GetUploadLink200Response implements ModelInterface, ArrayAccess, \JsonSeri ]; /** - * Array of nullable properties. Used for (de)serialization - * - * @var boolean[] - */ + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ protected static array $openAPINullables = [ 'upload_link' => false, 'workspace_id' => false, @@ -92,10 +92,10 @@ class GetUploadLink200Response implements ModelInterface, ArrayAccess, \JsonSeri ]; /** - * If a nullable field gets set to null, insert it here - * - * @var boolean[] - */ + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ protected array $openAPINullablesSetToNull = []; /** @@ -275,14 +275,14 @@ public function __construct(?array $data = null) } /** - * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName - * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the - * $this->openAPINullablesSetToNull array - * - * @param string $variableName - * @param array $fields - * @param mixed $defaultValue - */ + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ private function setIfExists(string $variableName, array $fields, $defaultValue): void { if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { diff --git a/lib/PythonScheduler/RunsApi.php b/lib/PythonScheduler/RunsApi.php index c578802c..fcb099c6 100644 --- a/lib/PythonScheduler/RunsApi.php +++ b/lib/PythonScheduler/RunsApi.php @@ -28,11 +28,11 @@ use GuzzleHttp\Client; use GuzzleHttp\ClientInterface; -use GuzzleHttp\Exception\ConnectException; use GuzzleHttp\Exception\RequestException; use GuzzleHttp\Psr7\MultipartStream; use GuzzleHttp\Psr7\Request; use GuzzleHttp\RequestOptions; +use Psr\Http\Client\NetworkExceptionInterface; use Psr\Http\Message\RequestInterface; use Psr\Http\Message\ResponseInterface; use SeaTable\Client\ApiException; @@ -173,13 +173,14 @@ public function listRunsWithHttpInfo($org_id = null, $base_uuid = null, $start = try { $response = $this->client->send($request, $options); } catch (RequestException $e) { + $eResponse = $this->getExceptionResponse($e); throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), - $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? (string) $e->getResponse()->getBody() : null + $eResponse ? $eResponse->getHeaders() : null, + $eResponse ? (string) $eResponse->getBody() : null ); - } catch (ConnectException $e) { + } catch (NetworkExceptionInterface $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), @@ -304,7 +305,15 @@ function ($response) use ($returnType) { ]; }, function ($exception) { - $response = $exception->getResponse(); + $response = $this->getExceptionResponse($exception); + if ($response === null) { + throw new ApiException( + "[{$exception->getCode()}] {$exception->getMessage()}", + (int) $exception->getCode(), + null, + null + ); + } $statusCode = $response->getStatusCode(); throw new ApiException( sprintf( @@ -445,7 +454,11 @@ public function listRunsRequest($org_id = null, $base_uuid = null, $start = null } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + try { + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + } catch (\JsonException $e) { + throw new \InvalidArgumentException('json_encode error: ' . $e->getMessage(), 0, $e); + } } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -505,6 +518,21 @@ protected function createHttpClientOption() return $options; } + /** + * Returns the response attached to a Guzzle exception, if there is one. + * + * Guzzle 7 exposes getResponse() on RequestException, while Guzzle 8 only + * exposes it on ResponseException and its subclasses. + * + * @param \Throwable $exception + * + * @return ResponseInterface|null + */ + private function getExceptionResponse(\Throwable $exception): ?ResponseInterface + { + return method_exists($exception, 'getResponse') ? $exception->getResponse() : null; + } + private function handleResponseWithDataType( string $dataType, RequestInterface $request, diff --git a/lib/PythonScheduler/ScriptRunsPerUser200Response.php b/lib/PythonScheduler/ScriptRunsPerUser200Response.php index 96b737c1..eb3b711d 100644 --- a/lib/PythonScheduler/ScriptRunsPerUser200Response.php +++ b/lib/PythonScheduler/ScriptRunsPerUser200Response.php @@ -44,17 +44,17 @@ class ScriptRunsPerUser200Response implements ModelInterface, ArrayAccess, \Json public const DISCRIMINATOR = null; /** - * The original name of the model. - * - * @var string - */ + * The original name of the model. + * + * @var string + */ protected static $openAPIModelName = 'scriptRunsPerUser_200_response'; /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ protected static $openAPITypes = [ 'month' => 'string', 'results' => 'object[]', @@ -62,12 +62,12 @@ class ScriptRunsPerUser200Response implements ModelInterface, ArrayAccess, \Json ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - * @phpstan-var array - * @psalm-var array - */ + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ protected static $openAPIFormats = [ 'month' => null, 'results' => null, @@ -75,10 +75,10 @@ class ScriptRunsPerUser200Response implements ModelInterface, ArrayAccess, \Json ]; /** - * Array of nullable properties. Used for (de)serialization - * - * @var boolean[] - */ + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ protected static array $openAPINullables = [ 'month' => false, 'results' => false, @@ -86,10 +86,10 @@ class ScriptRunsPerUser200Response implements ModelInterface, ArrayAccess, \Json ]; /** - * If a nullable field gets set to null, insert it here - * - * @var boolean[] - */ + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ protected array $openAPINullablesSetToNull = []; /** @@ -261,14 +261,14 @@ public function __construct(?array $data = null) } /** - * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName - * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the - * $this->openAPINullablesSetToNull array - * - * @param string $variableName - * @param array $fields - * @param mixed $defaultValue - */ + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ private function setIfExists(string $variableName, array $fields, $defaultValue): void { if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { diff --git a/lib/PythonScheduler/StatisticsApi.php b/lib/PythonScheduler/StatisticsApi.php index d497d215..a2850413 100644 --- a/lib/PythonScheduler/StatisticsApi.php +++ b/lib/PythonScheduler/StatisticsApi.php @@ -28,11 +28,11 @@ use GuzzleHttp\Client; use GuzzleHttp\ClientInterface; -use GuzzleHttp\Exception\ConnectException; use GuzzleHttp\Exception\RequestException; use GuzzleHttp\Psr7\MultipartStream; use GuzzleHttp\Psr7\Request; use GuzzleHttp\RequestOptions; +use Psr\Http\Client\NetworkExceptionInterface; use Psr\Http\Message\RequestInterface; use Psr\Http\Message\ResponseInterface; use SeaTable\Client\ApiException; @@ -183,13 +183,14 @@ public function getStatisticsGroupedByBaseWithHttpInfo($org_id = null, $start = try { $response = $this->client->send($request, $options); } catch (RequestException $e) { + $eResponse = $this->getExceptionResponse($e); throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), - $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? (string) $e->getResponse()->getBody() : null + $eResponse ? $eResponse->getHeaders() : null, + $eResponse ? (string) $eResponse->getBody() : null ); - } catch (ConnectException $e) { + } catch (NetworkExceptionInterface $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), @@ -312,7 +313,15 @@ function ($response) use ($returnType) { ]; }, function ($exception) { - $response = $exception->getResponse(); + $response = $this->getExceptionResponse($exception); + if ($response === null) { + throw new ApiException( + "[{$exception->getCode()}] {$exception->getMessage()}", + (int) $exception->getCode(), + null, + null + ); + } $statusCode = $response->getStatusCode(); throw new ApiException( sprintf( @@ -439,7 +448,11 @@ public function getStatisticsGroupedByBaseRequest($org_id = null, $start = null, } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + try { + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + } catch (\JsonException $e) { + throw new \InvalidArgumentException('json_encode error: ' . $e->getMessage(), 0, $e); + } } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -521,13 +534,14 @@ public function getStatisticsGroupedByDayWithHttpInfo($org_id = null, $base_uuid try { $response = $this->client->send($request, $options); } catch (RequestException $e) { + $eResponse = $this->getExceptionResponse($e); throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), - $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? (string) $e->getResponse()->getBody() : null + $eResponse ? $eResponse->getHeaders() : null, + $eResponse ? (string) $eResponse->getBody() : null ); - } catch (ConnectException $e) { + } catch (NetworkExceptionInterface $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), @@ -652,7 +666,15 @@ function ($response) use ($returnType) { ]; }, function ($exception) { - $response = $exception->getResponse(); + $response = $this->getExceptionResponse($exception); + if ($response === null) { + throw new ApiException( + "[{$exception->getCode()}] {$exception->getMessage()}", + (int) $exception->getCode(), + null, + null + ); + } $statusCode = $response->getStatusCode(); throw new ApiException( sprintf( @@ -793,7 +815,11 @@ public function getStatisticsGroupedByDayRequest($org_id = null, $base_uuid = nu } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + try { + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + } catch (\JsonException $e) { + throw new \InvalidArgumentException('json_encode error: ' . $e->getMessage(), 0, $e); + } } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -873,13 +899,14 @@ public function scriptRunsPerBaseWithHttpInfo($month = null, $order_by = '', $di try { $response = $this->client->send($request, $options); } catch (RequestException $e) { + $eResponse = $this->getExceptionResponse($e); throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), - $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? (string) $e->getResponse()->getBody() : null + $eResponse ? $eResponse->getHeaders() : null, + $eResponse ? (string) $eResponse->getBody() : null ); - } catch (ConnectException $e) { + } catch (NetworkExceptionInterface $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), @@ -1002,7 +1029,15 @@ function ($response) use ($returnType) { ]; }, function ($exception) { - $response = $exception->getResponse(); + $response = $this->getExceptionResponse($exception); + if ($response === null) { + throw new ApiException( + "[{$exception->getCode()}] {$exception->getMessage()}", + (int) $exception->getCode(), + null, + null + ); + } $statusCode = $response->getStatusCode(); throw new ApiException( sprintf( @@ -1129,7 +1164,11 @@ public function scriptRunsPerBaseRequest($month = null, $order_by = '', $directi } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + try { + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + } catch (\JsonException $e) { + throw new \InvalidArgumentException('json_encode error: ' . $e->getMessage(), 0, $e); + } } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -1209,13 +1248,14 @@ public function scriptRunsPerTeamWithHttpInfo($month = null, $order_by = '', $di try { $response = $this->client->send($request, $options); } catch (RequestException $e) { + $eResponse = $this->getExceptionResponse($e); throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), - $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? (string) $e->getResponse()->getBody() : null + $eResponse ? $eResponse->getHeaders() : null, + $eResponse ? (string) $eResponse->getBody() : null ); - } catch (ConnectException $e) { + } catch (NetworkExceptionInterface $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), @@ -1338,7 +1378,15 @@ function ($response) use ($returnType) { ]; }, function ($exception) { - $response = $exception->getResponse(); + $response = $this->getExceptionResponse($exception); + if ($response === null) { + throw new ApiException( + "[{$exception->getCode()}] {$exception->getMessage()}", + (int) $exception->getCode(), + null, + null + ); + } $statusCode = $response->getStatusCode(); throw new ApiException( sprintf( @@ -1465,7 +1513,11 @@ public function scriptRunsPerTeamRequest($month = null, $order_by = '', $directi } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + try { + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + } catch (\JsonException $e) { + throw new \InvalidArgumentException('json_encode error: ' . $e->getMessage(), 0, $e); + } } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -1545,13 +1597,14 @@ public function scriptRunsPerUserWithHttpInfo($month = null, $order_by = '', $di try { $response = $this->client->send($request, $options); } catch (RequestException $e) { + $eResponse = $this->getExceptionResponse($e); throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), - $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? (string) $e->getResponse()->getBody() : null + $eResponse ? $eResponse->getHeaders() : null, + $eResponse ? (string) $eResponse->getBody() : null ); - } catch (ConnectException $e) { + } catch (NetworkExceptionInterface $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), @@ -1674,7 +1727,15 @@ function ($response) use ($returnType) { ]; }, function ($exception) { - $response = $exception->getResponse(); + $response = $this->getExceptionResponse($exception); + if ($response === null) { + throw new ApiException( + "[{$exception->getCode()}] {$exception->getMessage()}", + (int) $exception->getCode(), + null, + null + ); + } $statusCode = $response->getStatusCode(); throw new ApiException( sprintf( @@ -1801,7 +1862,11 @@ public function scriptRunsPerUserRequest($month = null, $order_by = '', $directi } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + try { + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + } catch (\JsonException $e) { + throw new \InvalidArgumentException('json_encode error: ' . $e->getMessage(), 0, $e); + } } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -1861,6 +1926,21 @@ protected function createHttpClientOption() return $options; } + /** + * Returns the response attached to a Guzzle exception, if there is one. + * + * Guzzle 7 exposes getResponse() on RequestException, while Guzzle 8 only + * exposes it on ResponseException and its subclasses. + * + * @param \Throwable $exception + * + * @return ResponseInterface|null + */ + private function getExceptionResponse(\Throwable $exception): ?ResponseInterface + { + return method_exists($exception, 'getResponse') ? $exception->getResponse() : null; + } + private function handleResponseWithDataType( string $dataType, RequestInterface $request, diff --git a/lib/SysAdmin/AddDepartment200Response.php b/lib/SysAdmin/AddDepartment200Response.php index f49ed0da..cf05a97a 100644 --- a/lib/SysAdmin/AddDepartment200Response.php +++ b/lib/SysAdmin/AddDepartment200Response.php @@ -44,46 +44,46 @@ class AddDepartment200Response implements ModelInterface, ArrayAccess, \JsonSeri public const DISCRIMINATOR = null; /** - * The original name of the model. - * - * @var string - */ + * The original name of the model. + * + * @var string + */ protected static $openAPIModelName = 'addDepartment_200_response'; /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ protected static $openAPITypes = [ 'department' => '\SeaTable\Client\SysAdmin\AddDepartment200ResponseDepartment' ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - * @phpstan-var array - * @psalm-var array - */ + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ protected static $openAPIFormats = [ 'department' => null ]; /** - * Array of nullable properties. Used for (de)serialization - * - * @var boolean[] - */ + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ protected static array $openAPINullables = [ 'department' => false ]; /** - * If a nullable field gets set to null, insert it here - * - * @var boolean[] - */ + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ protected array $openAPINullablesSetToNull = []; /** @@ -247,14 +247,14 @@ public function __construct(?array $data = null) } /** - * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName - * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the - * $this->openAPINullablesSetToNull array - * - * @param string $variableName - * @param array $fields - * @param mixed $defaultValue - */ + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ private function setIfExists(string $variableName, array $fields, $defaultValue): void { if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { diff --git a/lib/SysAdmin/AddDepartment200ResponseDepartment.php b/lib/SysAdmin/AddDepartment200ResponseDepartment.php index 7368d2f4..ed10ab6b 100644 --- a/lib/SysAdmin/AddDepartment200ResponseDepartment.php +++ b/lib/SysAdmin/AddDepartment200ResponseDepartment.php @@ -44,17 +44,17 @@ class AddDepartment200ResponseDepartment implements ModelInterface, ArrayAccess, public const DISCRIMINATOR = null; /** - * The original name of the model. - * - * @var string - */ + * The original name of the model. + * + * @var string + */ protected static $openAPIModelName = 'addDepartment_200_response_department'; /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ protected static $openAPITypes = [ 'id' => 'int', 'name' => 'string', @@ -64,12 +64,12 @@ class AddDepartment200ResponseDepartment implements ModelInterface, ArrayAccess, ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - * @phpstan-var array - * @psalm-var array - */ + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ protected static $openAPIFormats = [ 'id' => null, 'name' => null, @@ -79,10 +79,10 @@ class AddDepartment200ResponseDepartment implements ModelInterface, ArrayAccess, ]; /** - * Array of nullable properties. Used for (de)serialization - * - * @var boolean[] - */ + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ protected static array $openAPINullables = [ 'id' => false, 'name' => false, @@ -92,10 +92,10 @@ class AddDepartment200ResponseDepartment implements ModelInterface, ArrayAccess, ]; /** - * If a nullable field gets set to null, insert it here - * - * @var boolean[] - */ + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ protected array $openAPINullablesSetToNull = []; /** @@ -275,14 +275,14 @@ public function __construct(?array $data = null) } /** - * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName - * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the - * $this->openAPINullablesSetToNull array - * - * @param string $variableName - * @param array $fields - * @param mixed $defaultValue - */ + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ private function setIfExists(string $variableName, array $fields, $defaultValue): void { if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { diff --git a/lib/SysAdmin/AddDepartmentMembers200Response.php b/lib/SysAdmin/AddDepartmentMembers200Response.php index 07b2c69a..e86d9698 100644 --- a/lib/SysAdmin/AddDepartmentMembers200Response.php +++ b/lib/SysAdmin/AddDepartmentMembers200Response.php @@ -44,49 +44,49 @@ class AddDepartmentMembers200Response implements ModelInterface, ArrayAccess, \J public const DISCRIMINATOR = null; /** - * The original name of the model. - * - * @var string - */ + * The original name of the model. + * + * @var string + */ protected static $openAPIModelName = 'addDepartmentMembers_200_response'; /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ protected static $openAPITypes = [ 'success' => 'object[]', 'failed' => 'object[]' ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - * @phpstan-var array - * @psalm-var array - */ + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ protected static $openAPIFormats = [ 'success' => null, 'failed' => null ]; /** - * Array of nullable properties. Used for (de)serialization - * - * @var boolean[] - */ + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ protected static array $openAPINullables = [ 'success' => false, 'failed' => false ]; /** - * If a nullable field gets set to null, insert it here - * - * @var boolean[] - */ + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ protected array $openAPINullablesSetToNull = []; /** @@ -254,14 +254,14 @@ public function __construct(?array $data = null) } /** - * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName - * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the - * $this->openAPINullablesSetToNull array - * - * @param string $variableName - * @param array $fields - * @param mixed $defaultValue - */ + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ private function setIfExists(string $variableName, array $fields, $defaultValue): void { if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { diff --git a/lib/SysAdmin/AddDepartmentRequest.php b/lib/SysAdmin/AddDepartmentRequest.php index f59492ad..d2afda9f 100644 --- a/lib/SysAdmin/AddDepartmentRequest.php +++ b/lib/SysAdmin/AddDepartmentRequest.php @@ -44,17 +44,17 @@ class AddDepartmentRequest implements ModelInterface, ArrayAccess, \JsonSerializ public const DISCRIMINATOR = null; /** - * The original name of the model. - * - * @var string - */ + * The original name of the model. + * + * @var string + */ protected static $openAPIModelName = 'addDepartment_request'; /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ protected static $openAPITypes = [ 'name' => 'string', 'parent_id' => 'int', @@ -62,12 +62,12 @@ class AddDepartmentRequest implements ModelInterface, ArrayAccess, \JsonSerializ ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - * @phpstan-var array - * @psalm-var array - */ + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ protected static $openAPIFormats = [ 'name' => null, 'parent_id' => null, @@ -75,10 +75,10 @@ class AddDepartmentRequest implements ModelInterface, ArrayAccess, \JsonSerializ ]; /** - * Array of nullable properties. Used for (de)serialization - * - * @var boolean[] - */ + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ protected static array $openAPINullables = [ 'name' => false, 'parent_id' => false, @@ -86,10 +86,10 @@ class AddDepartmentRequest implements ModelInterface, ArrayAccess, \JsonSerializ ]; /** - * If a nullable field gets set to null, insert it here - * - * @var boolean[] - */ + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ protected array $openAPINullablesSetToNull = []; /** @@ -261,14 +261,14 @@ public function __construct(?array $data = null) } /** - * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName - * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the - * $this->openAPINullablesSetToNull array - * - * @param string $variableName - * @param array $fields - * @param mixed $defaultValue - */ + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ private function setIfExists(string $variableName, array $fields, $defaultValue): void { if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { diff --git a/lib/SysAdmin/AddNewUser200Response.php b/lib/SysAdmin/AddNewUser200Response.php index 6b9c4f2a..eff19413 100644 --- a/lib/SysAdmin/AddNewUser200Response.php +++ b/lib/SysAdmin/AddNewUser200Response.php @@ -44,17 +44,17 @@ class AddNewUser200Response implements ModelInterface, ArrayAccess, \JsonSeriali public const DISCRIMINATOR = null; /** - * The original name of the model. - * - * @var string - */ + * The original name of the model. + * + * @var string + */ protected static $openAPIModelName = 'addNewUser_200_response'; /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ protected static $openAPITypes = [ 'email' => 'string', 'name' => 'string', @@ -69,12 +69,12 @@ class AddNewUser200Response implements ModelInterface, ArrayAccess, \JsonSeriali ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - * @phpstan-var array - * @psalm-var array - */ + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ protected static $openAPIFormats = [ 'email' => null, 'name' => null, @@ -89,10 +89,10 @@ class AddNewUser200Response implements ModelInterface, ArrayAccess, \JsonSeriali ]; /** - * Array of nullable properties. Used for (de)serialization - * - * @var boolean[] - */ + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ protected static array $openAPINullables = [ 'email' => false, 'name' => false, @@ -107,10 +107,10 @@ class AddNewUser200Response implements ModelInterface, ArrayAccess, \JsonSeriali ]; /** - * If a nullable field gets set to null, insert it here - * - * @var boolean[] - */ + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ protected array $openAPINullablesSetToNull = []; /** @@ -310,14 +310,14 @@ public function __construct(?array $data = null) } /** - * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName - * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the - * $this->openAPINullablesSetToNull array - * - * @param string $variableName - * @param array $fields - * @param mixed $defaultValue - */ + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ private function setIfExists(string $variableName, array $fields, $defaultValue): void { if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { diff --git a/lib/SysAdmin/AddNewUserRequest.php b/lib/SysAdmin/AddNewUserRequest.php index b2fede95..e28b7f52 100644 --- a/lib/SysAdmin/AddNewUserRequest.php +++ b/lib/SysAdmin/AddNewUserRequest.php @@ -44,17 +44,17 @@ class AddNewUserRequest implements ModelInterface, ArrayAccess, \JsonSerializabl public const DISCRIMINATOR = null; /** - * The original name of the model. - * - * @var string - */ + * The original name of the model. + * + * @var string + */ protected static $openAPIModelName = 'addNewUser_request'; /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ protected static $openAPITypes = [ 'email' => 'string', 'password' => 'string', @@ -64,12 +64,12 @@ class AddNewUserRequest implements ModelInterface, ArrayAccess, \JsonSerializabl ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - * @phpstan-var array - * @psalm-var array - */ + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ protected static $openAPIFormats = [ 'email' => null, 'password' => null, @@ -79,10 +79,10 @@ class AddNewUserRequest implements ModelInterface, ArrayAccess, \JsonSerializabl ]; /** - * Array of nullable properties. Used for (de)serialization - * - * @var boolean[] - */ + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ protected static array $openAPINullables = [ 'email' => false, 'password' => false, @@ -92,10 +92,10 @@ class AddNewUserRequest implements ModelInterface, ArrayAccess, \JsonSerializabl ]; /** - * If a nullable field gets set to null, insert it here - * - * @var boolean[] - */ + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ protected array $openAPINullablesSetToNull = []; /** @@ -275,14 +275,14 @@ public function __construct(?array $data = null) } /** - * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName - * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the - * $this->openAPINullablesSetToNull array - * - * @param string $variableName - * @param array $fields - * @param mixed $defaultValue - */ + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ private function setIfExists(string $variableName, array $fields, $defaultValue): void { if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { diff --git a/lib/SysAdmin/AddNotificationToUserRequest.php b/lib/SysAdmin/AddNotificationToUserRequest.php index b2acccdb..d75df365 100644 --- a/lib/SysAdmin/AddNotificationToUserRequest.php +++ b/lib/SysAdmin/AddNotificationToUserRequest.php @@ -44,49 +44,49 @@ class AddNotificationToUserRequest implements ModelInterface, ArrayAccess, \Json public const DISCRIMINATOR = null; /** - * The original name of the model. - * - * @var string - */ + * The original name of the model. + * + * @var string + */ protected static $openAPIModelName = 'addNotificationToUser_request'; /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ protected static $openAPITypes = [ 'msg' => 'string', 'username' => 'string' ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - * @phpstan-var array - * @psalm-var array - */ + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ protected static $openAPIFormats = [ 'msg' => null, 'username' => null ]; /** - * Array of nullable properties. Used for (de)serialization - * - * @var boolean[] - */ + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ protected static array $openAPINullables = [ 'msg' => false, 'username' => false ]; /** - * If a nullable field gets set to null, insert it here - * - * @var boolean[] - */ + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ protected array $openAPINullablesSetToNull = []; /** @@ -254,14 +254,14 @@ public function __construct(?array $data = null) } /** - * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName - * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the - * $this->openAPINullablesSetToNull array - * - * @param string $variableName - * @param array $fields - * @param mixed $defaultValue - */ + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ private function setIfExists(string $variableName, array $fields, $defaultValue): void { if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { diff --git a/lib/SysAdmin/AddPlugin200Response.php b/lib/SysAdmin/AddPlugin200Response.php index 4ab60f52..78cfb429 100644 --- a/lib/SysAdmin/AddPlugin200Response.php +++ b/lib/SysAdmin/AddPlugin200Response.php @@ -44,17 +44,17 @@ class AddPlugin200Response implements ModelInterface, ArrayAccess, \JsonSerializ public const DISCRIMINATOR = null; /** - * The original name of the model. - * - * @var string - */ + * The original name of the model. + * + * @var string + */ protected static $openAPIModelName = 'addPlugin_200_response'; /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ protected static $openAPITypes = [ 'id' => 'int', 'plugin_name' => 'string', @@ -64,12 +64,12 @@ class AddPlugin200Response implements ModelInterface, ArrayAccess, \JsonSerializ ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - * @phpstan-var array - * @psalm-var array - */ + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ protected static $openAPIFormats = [ 'id' => null, 'plugin_name' => null, @@ -79,10 +79,10 @@ class AddPlugin200Response implements ModelInterface, ArrayAccess, \JsonSerializ ]; /** - * Array of nullable properties. Used for (de)serialization - * - * @var boolean[] - */ + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ protected static array $openAPINullables = [ 'id' => false, 'plugin_name' => false, @@ -92,10 +92,10 @@ class AddPlugin200Response implements ModelInterface, ArrayAccess, \JsonSerializ ]; /** - * If a nullable field gets set to null, insert it here - * - * @var boolean[] - */ + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ protected array $openAPINullablesSetToNull = []; /** @@ -275,14 +275,14 @@ public function __construct(?array $data = null) } /** - * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName - * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the - * $this->openAPINullablesSetToNull array - * - * @param string $variableName - * @param array $fields - * @param mixed $defaultValue - */ + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ private function setIfExists(string $variableName, array $fields, $defaultValue): void { if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { diff --git a/lib/SysAdmin/AddTeam200Response.php b/lib/SysAdmin/AddTeam200Response.php index 17df3001..7bec0dd0 100644 --- a/lib/SysAdmin/AddTeam200Response.php +++ b/lib/SysAdmin/AddTeam200Response.php @@ -44,17 +44,17 @@ class AddTeam200Response implements ModelInterface, ArrayAccess, \JsonSerializab public const DISCRIMINATOR = null; /** - * The original name of the model. - * - * @var string - */ + * The original name of the model. + * + * @var string + */ protected static $openAPIModelName = 'addTeam_200_response'; /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ protected static $openAPITypes = [ 'org_id' => 'int', 'org_name' => 'string', @@ -73,12 +73,12 @@ class AddTeam200Response implements ModelInterface, ArrayAccess, \JsonSerializab ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - * @phpstan-var array - * @psalm-var array - */ + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ protected static $openAPIFormats = [ 'org_id' => null, 'org_name' => null, @@ -97,10 +97,10 @@ class AddTeam200Response implements ModelInterface, ArrayAccess, \JsonSerializab ]; /** - * Array of nullable properties. Used for (de)serialization - * - * @var boolean[] - */ + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ protected static array $openAPINullables = [ 'org_id' => false, 'org_name' => false, @@ -119,10 +119,10 @@ class AddTeam200Response implements ModelInterface, ArrayAccess, \JsonSerializab ]; /** - * If a nullable field gets set to null, insert it here - * - * @var boolean[] - */ + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ protected array $openAPINullablesSetToNull = []; /** @@ -338,14 +338,14 @@ public function __construct(?array $data = null) } /** - * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName - * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the - * $this->openAPINullablesSetToNull array - * - * @param string $variableName - * @param array $fields - * @param mixed $defaultValue - */ + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ private function setIfExists(string $variableName, array $fields, $defaultValue): void { if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { diff --git a/lib/SysAdmin/AddTeamRequest.php b/lib/SysAdmin/AddTeamRequest.php index e3b46454..7f9dbb1d 100644 --- a/lib/SysAdmin/AddTeamRequest.php +++ b/lib/SysAdmin/AddTeamRequest.php @@ -44,17 +44,17 @@ class AddTeamRequest implements ModelInterface, ArrayAccess, \JsonSerializable public const DISCRIMINATOR = null; /** - * The original name of the model. - * - * @var string - */ + * The original name of the model. + * + * @var string + */ protected static $openAPIModelName = 'addTeam_request'; /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ protected static $openAPITypes = [ 'org_name' => 'string', 'admin_email' => 'string', @@ -64,12 +64,12 @@ class AddTeamRequest implements ModelInterface, ArrayAccess, \JsonSerializable ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - * @phpstan-var array - * @psalm-var array - */ + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ protected static $openAPIFormats = [ 'org_name' => null, 'admin_email' => null, @@ -79,10 +79,10 @@ class AddTeamRequest implements ModelInterface, ArrayAccess, \JsonSerializable ]; /** - * Array of nullable properties. Used for (de)serialization - * - * @var boolean[] - */ + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ protected static array $openAPINullables = [ 'org_name' => false, 'admin_email' => false, @@ -92,10 +92,10 @@ class AddTeamRequest implements ModelInterface, ArrayAccess, \JsonSerializable ]; /** - * If a nullable field gets set to null, insert it here - * - * @var boolean[] - */ + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ protected array $openAPINullablesSetToNull = []; /** @@ -275,14 +275,14 @@ public function __construct(?array $data = null) } /** - * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName - * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the - * $this->openAPINullablesSetToNull array - * - * @param string $variableName - * @param array $fields - * @param mixed $defaultValue - */ + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ private function setIfExists(string $variableName, array $fields, $defaultValue): void { if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { diff --git a/lib/SysAdmin/AddTeamUser200Response.php b/lib/SysAdmin/AddTeamUser200Response.php index 6703665b..bd290b45 100644 --- a/lib/SysAdmin/AddTeamUser200Response.php +++ b/lib/SysAdmin/AddTeamUser200Response.php @@ -44,17 +44,17 @@ class AddTeamUser200Response implements ModelInterface, ArrayAccess, \JsonSerial public const DISCRIMINATOR = null; /** - * The original name of the model. - * - * @var string - */ + * The original name of the model. + * + * @var string + */ protected static $openAPIModelName = 'addTeamUser_200_response'; /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ protected static $openAPITypes = [ 'org_id' => 'int', 'workspace_id' => 'int', @@ -70,12 +70,12 @@ class AddTeamUser200Response implements ModelInterface, ArrayAccess, \JsonSerial ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - * @phpstan-var array - * @psalm-var array - */ + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ protected static $openAPIFormats = [ 'org_id' => null, 'workspace_id' => null, @@ -91,10 +91,10 @@ class AddTeamUser200Response implements ModelInterface, ArrayAccess, \JsonSerial ]; /** - * Array of nullable properties. Used for (de)serialization - * - * @var boolean[] - */ + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ protected static array $openAPINullables = [ 'org_id' => false, 'workspace_id' => false, @@ -110,10 +110,10 @@ class AddTeamUser200Response implements ModelInterface, ArrayAccess, \JsonSerial ]; /** - * If a nullable field gets set to null, insert it here - * - * @var boolean[] - */ + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ protected array $openAPINullablesSetToNull = []; /** @@ -317,14 +317,14 @@ public function __construct(?array $data = null) } /** - * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName - * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the - * $this->openAPINullablesSetToNull array - * - * @param string $variableName - * @param array $fields - * @param mixed $defaultValue - */ + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ private function setIfExists(string $variableName, array $fields, $defaultValue): void { if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { diff --git a/lib/SysAdmin/AddUserToDepartmentsRequest.php b/lib/SysAdmin/AddUserToDepartmentsRequest.php index c2b7ecc6..e0f1fc88 100644 --- a/lib/SysAdmin/AddUserToDepartmentsRequest.php +++ b/lib/SysAdmin/AddUserToDepartmentsRequest.php @@ -44,49 +44,49 @@ class AddUserToDepartmentsRequest implements ModelInterface, ArrayAccess, \JsonS public const DISCRIMINATOR = null; /** - * The original name of the model. - * - * @var string - */ + * The original name of the model. + * + * @var string + */ protected static $openAPIModelName = 'addUserToDepartments_request'; /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ protected static $openAPITypes = [ 'email' => 'string', 'department_ids' => 'int[]' ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - * @phpstan-var array - * @psalm-var array - */ + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ protected static $openAPIFormats = [ 'email' => null, 'department_ids' => null ]; /** - * Array of nullable properties. Used for (de)serialization - * - * @var boolean[] - */ + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ protected static array $openAPINullables = [ 'email' => false, 'department_ids' => false ]; /** - * If a nullable field gets set to null, insert it here - * - * @var boolean[] - */ + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ protected array $openAPINullablesSetToNull = []; /** @@ -254,14 +254,14 @@ public function __construct(?array $data = null) } /** - * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName - * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the - * $this->openAPINullablesSetToNull array - * - * @param string $variableName - * @param array $fields - * @param mixed $defaultValue - */ + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ private function setIfExists(string $variableName, array $fields, $defaultValue): void { if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { diff --git a/lib/SysAdmin/AutomationsApi.php b/lib/SysAdmin/AutomationsApi.php index a86982ee..d3560d87 100644 --- a/lib/SysAdmin/AutomationsApi.php +++ b/lib/SysAdmin/AutomationsApi.php @@ -28,11 +28,11 @@ use GuzzleHttp\Client; use GuzzleHttp\ClientInterface; -use GuzzleHttp\Exception\ConnectException; use GuzzleHttp\Exception\RequestException; use GuzzleHttp\Psr7\MultipartStream; use GuzzleHttp\Psr7\Request; use GuzzleHttp\RequestOptions; +use Psr\Http\Client\NetworkExceptionInterface; use Psr\Http\Message\RequestInterface; use Psr\Http\Message\ResponseInterface; use SeaTable\Client\ApiException; @@ -172,13 +172,14 @@ public function deleteAutomationWithHttpInfo($automation_rule_id, string $conten try { $response = $this->client->send($request, $options); } catch (RequestException $e) { + $eResponse = $this->getExceptionResponse($e); throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), - $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? (string) $e->getResponse()->getBody() : null + $eResponse ? $eResponse->getHeaders() : null, + $eResponse ? (string) $eResponse->getBody() : null ); - } catch (ConnectException $e) { + } catch (NetworkExceptionInterface $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), @@ -293,7 +294,15 @@ function ($response) use ($returnType) { ]; }, function ($exception) { - $response = $exception->getResponse(); + $response = $this->getExceptionResponse($exception); + if ($response === null) { + throw new ApiException( + "[{$exception->getCode()}] {$exception->getMessage()}", + (int) $exception->getCode(), + null, + null + ); + } $statusCode = $response->getStatusCode(); throw new ApiException( sprintf( @@ -344,7 +353,7 @@ public function deleteAutomationRequest($automation_rule_id, string $contentType // path params if ($automation_rule_id !== null) { $resourcePath = str_replace( - '{' . 'automation_rule_id' . '}', + '{automation_rule_id}', ObjectSerializer::toPathValue($automation_rule_id), $resourcePath ); @@ -375,7 +384,11 @@ public function deleteAutomationRequest($automation_rule_id, string $contentType } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + try { + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + } catch (\JsonException $e) { + throw new \InvalidArgumentException('json_encode error: ' . $e->getMessage(), 0, $e); + } } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -445,13 +458,14 @@ public function deleteInvalidAutomationsWithHttpInfo(string $contentType = self: try { $response = $this->client->send($request, $options); } catch (RequestException $e) { + $eResponse = $this->getExceptionResponse($e); throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), - $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? (string) $e->getResponse()->getBody() : null + $eResponse ? $eResponse->getHeaders() : null, + $eResponse ? (string) $eResponse->getBody() : null ); - } catch (ConnectException $e) { + } catch (NetworkExceptionInterface $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), @@ -564,7 +578,15 @@ function ($response) use ($returnType) { ]; }, function ($exception) { - $response = $exception->getResponse(); + $response = $this->getExceptionResponse($exception); + if ($response === null) { + throw new ApiException( + "[{$exception->getCode()}] {$exception->getMessage()}", + (int) $exception->getCode(), + null, + null + ); + } $statusCode = $response->getStatusCode(); throw new ApiException( sprintf( @@ -627,7 +649,11 @@ public function deleteInvalidAutomationsRequest(string $contentType = self::cont } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + try { + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + } catch (\JsonException $e) { + throw new \InvalidArgumentException('json_encode error: ' . $e->getMessage(), 0, $e); + } } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -701,13 +727,14 @@ public function listAutomationsWithHttpInfo($page = null, $per_page = null, stri try { $response = $this->client->send($request, $options); } catch (RequestException $e) { + $eResponse = $this->getExceptionResponse($e); throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), - $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? (string) $e->getResponse()->getBody() : null + $eResponse ? $eResponse->getHeaders() : null, + $eResponse ? (string) $eResponse->getBody() : null ); - } catch (ConnectException $e) { + } catch (NetworkExceptionInterface $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), @@ -824,7 +851,15 @@ function ($response) use ($returnType) { ]; }, function ($exception) { - $response = $exception->getResponse(); + $response = $this->getExceptionResponse($exception); + if ($response === null) { + throw new ApiException( + "[{$exception->getCode()}] {$exception->getMessage()}", + (int) $exception->getCode(), + null, + null + ); + } $statusCode = $response->getStatusCode(); throw new ApiException( sprintf( @@ -915,7 +950,11 @@ public function listAutomationsRequest($page = null, $per_page = null, string $c } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + try { + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + } catch (\JsonException $e) { + throw new \InvalidArgumentException('json_encode error: ' . $e->getMessage(), 0, $e); + } } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -989,13 +1028,14 @@ public function listInvalidAutomationsWithHttpInfo($page = null, $per_page = nul try { $response = $this->client->send($request, $options); } catch (RequestException $e) { + $eResponse = $this->getExceptionResponse($e); throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), - $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? (string) $e->getResponse()->getBody() : null + $eResponse ? $eResponse->getHeaders() : null, + $eResponse ? (string) $eResponse->getBody() : null ); - } catch (ConnectException $e) { + } catch (NetworkExceptionInterface $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), @@ -1112,7 +1152,15 @@ function ($response) use ($returnType) { ]; }, function ($exception) { - $response = $exception->getResponse(); + $response = $this->getExceptionResponse($exception); + if ($response === null) { + throw new ApiException( + "[{$exception->getCode()}] {$exception->getMessage()}", + (int) $exception->getCode(), + null, + null + ); + } $statusCode = $response->getStatusCode(); throw new ApiException( sprintf( @@ -1203,7 +1251,11 @@ public function listInvalidAutomationsRequest($page = null, $per_page = null, st } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + try { + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + } catch (\JsonException $e) { + throw new \InvalidArgumentException('json_encode error: ' . $e->getMessage(), 0, $e); + } } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -1263,6 +1315,21 @@ protected function createHttpClientOption() return $options; } + /** + * Returns the response attached to a Guzzle exception, if there is one. + * + * Guzzle 7 exposes getResponse() on RequestException, while Guzzle 8 only + * exposes it on ResponseException and its subclasses. + * + * @param \Throwable $exception + * + * @return ResponseInterface|null + */ + private function getExceptionResponse(\Throwable $exception): ?ResponseInterface + { + return method_exists($exception, 'getResponse') ? $exception->getResponse() : null; + } + private function handleResponseWithDataType( string $dataType, RequestInterface $request, diff --git a/lib/SysAdmin/BasesApi.php b/lib/SysAdmin/BasesApi.php index 4d9240e2..79b6cdcc 100644 --- a/lib/SysAdmin/BasesApi.php +++ b/lib/SysAdmin/BasesApi.php @@ -28,11 +28,11 @@ use GuzzleHttp\Client; use GuzzleHttp\ClientInterface; -use GuzzleHttp\Exception\ConnectException; use GuzzleHttp\Exception\RequestException; use GuzzleHttp\Psr7\MultipartStream; use GuzzleHttp\Psr7\Request; use GuzzleHttp\RequestOptions; +use Psr\Http\Client\NetworkExceptionInterface; use Psr\Http\Message\RequestInterface; use Psr\Http\Message\ResponseInterface; use SeaTable\Client\ApiException; @@ -181,13 +181,14 @@ public function deleteBaseWithHttpInfo($base_uuid, string $contentType = self::c try { $response = $this->client->send($request, $options); } catch (RequestException $e) { + $eResponse = $this->getExceptionResponse($e); throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), - $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? (string) $e->getResponse()->getBody() : null + $eResponse ? $eResponse->getHeaders() : null, + $eResponse ? (string) $eResponse->getBody() : null ); - } catch (ConnectException $e) { + } catch (NetworkExceptionInterface $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), @@ -302,7 +303,15 @@ function ($response) use ($returnType) { ]; }, function ($exception) { - $response = $exception->getResponse(); + $response = $this->getExceptionResponse($exception); + if ($response === null) { + throw new ApiException( + "[{$exception->getCode()}] {$exception->getMessage()}", + (int) $exception->getCode(), + null, + null + ); + } $statusCode = $response->getStatusCode(); throw new ApiException( sprintf( @@ -353,7 +362,7 @@ public function deleteBaseRequest($base_uuid, string $contentType = self::conten // path params if ($base_uuid !== null) { $resourcePath = str_replace( - '{' . 'base_uuid' . '}', + '{base_uuid}', ObjectSerializer::toPathValue($base_uuid), $resourcePath ); @@ -384,7 +393,11 @@ public function deleteBaseRequest($base_uuid, string $contentType = self::conten } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + try { + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + } catch (\JsonException $e) { + throw new \InvalidArgumentException('json_encode error: ' . $e->getMessage(), 0, $e); + } } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -456,13 +469,14 @@ public function deleteBasePasswordWithHttpInfo($base_uuid, string $contentType = try { $response = $this->client->send($request, $options); } catch (RequestException $e) { + $eResponse = $this->getExceptionResponse($e); throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), - $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? (string) $e->getResponse()->getBody() : null + $eResponse ? $eResponse->getHeaders() : null, + $eResponse ? (string) $eResponse->getBody() : null ); - } catch (ConnectException $e) { + } catch (NetworkExceptionInterface $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), @@ -577,7 +591,15 @@ function ($response) use ($returnType) { ]; }, function ($exception) { - $response = $exception->getResponse(); + $response = $this->getExceptionResponse($exception); + if ($response === null) { + throw new ApiException( + "[{$exception->getCode()}] {$exception->getMessage()}", + (int) $exception->getCode(), + null, + null + ); + } $statusCode = $response->getStatusCode(); throw new ApiException( sprintf( @@ -628,7 +650,7 @@ public function deleteBasePasswordRequest($base_uuid, string $contentType = self // path params if ($base_uuid !== null) { $resourcePath = str_replace( - '{' . 'base_uuid' . '}', + '{base_uuid}', ObjectSerializer::toPathValue($base_uuid), $resourcePath ); @@ -659,7 +681,11 @@ public function deleteBasePasswordRequest($base_uuid, string $contentType = self } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + try { + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + } catch (\JsonException $e) { + throw new \InvalidArgumentException('json_encode error: ' . $e->getMessage(), 0, $e); + } } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -733,13 +759,14 @@ public function listAllBasesWithHttpInfo($per_page = null, $page = null, string try { $response = $this->client->send($request, $options); } catch (RequestException $e) { + $eResponse = $this->getExceptionResponse($e); throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), - $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? (string) $e->getResponse()->getBody() : null + $eResponse ? $eResponse->getHeaders() : null, + $eResponse ? (string) $eResponse->getBody() : null ); - } catch (ConnectException $e) { + } catch (NetworkExceptionInterface $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), @@ -856,7 +883,15 @@ function ($response) use ($returnType) { ]; }, function ($exception) { - $response = $exception->getResponse(); + $response = $this->getExceptionResponse($exception); + if ($response === null) { + throw new ApiException( + "[{$exception->getCode()}] {$exception->getMessage()}", + (int) $exception->getCode(), + null, + null + ); + } $statusCode = $response->getStatusCode(); throw new ApiException( sprintf( @@ -947,7 +982,11 @@ public function listAllBasesRequest($per_page = null, $page = null, string $cont } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + try { + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + } catch (\JsonException $e) { + throw new \InvalidArgumentException('json_encode error: ' . $e->getMessage(), 0, $e); + } } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -1029,13 +1068,14 @@ public function listBaseNotificationsWithHttpInfo($dtable_uuid, $username = null try { $response = $this->client->send($request, $options); } catch (RequestException $e) { + $eResponse = $this->getExceptionResponse($e); throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), - $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? (string) $e->getResponse()->getBody() : null + $eResponse ? $eResponse->getHeaders() : null, + $eResponse ? (string) $eResponse->getBody() : null ); - } catch (ConnectException $e) { + } catch (NetworkExceptionInterface $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), @@ -1160,7 +1200,15 @@ function ($response) use ($returnType) { ]; }, function ($exception) { - $response = $exception->getResponse(); + $response = $this->getExceptionResponse($exception); + if ($response === null) { + throw new ApiException( + "[{$exception->getCode()}] {$exception->getMessage()}", + (int) $exception->getCode(), + null, + null + ); + } $statusCode = $response->getStatusCode(); throw new ApiException( sprintf( @@ -1307,7 +1355,11 @@ public function listBaseNotificationsRequest($dtable_uuid, $username = null, $co } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + try { + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + } catch (\JsonException $e) { + throw new \InvalidArgumentException('json_encode error: ' . $e->getMessage(), 0, $e); + } } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -1381,13 +1433,14 @@ public function listTrashedBasesWithHttpInfo($page = null, $per_page = null, str try { $response = $this->client->send($request, $options); } catch (RequestException $e) { + $eResponse = $this->getExceptionResponse($e); throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), - $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? (string) $e->getResponse()->getBody() : null + $eResponse ? $eResponse->getHeaders() : null, + $eResponse ? (string) $eResponse->getBody() : null ); - } catch (ConnectException $e) { + } catch (NetworkExceptionInterface $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), @@ -1504,7 +1557,15 @@ function ($response) use ($returnType) { ]; }, function ($exception) { - $response = $exception->getResponse(); + $response = $this->getExceptionResponse($exception); + if ($response === null) { + throw new ApiException( + "[{$exception->getCode()}] {$exception->getMessage()}", + (int) $exception->getCode(), + null, + null + ); + } $statusCode = $response->getStatusCode(); throw new ApiException( sprintf( @@ -1595,7 +1656,11 @@ public function listTrashedBasesRequest($page = null, $per_page = null, string $ } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + try { + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + } catch (\JsonException $e) { + throw new \InvalidArgumentException('json_encode error: ' . $e->getMessage(), 0, $e); + } } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -1671,13 +1736,14 @@ public function listUsersBasesWithHttpInfo($user_id, $page = null, $per_page = n try { $response = $this->client->send($request, $options); } catch (RequestException $e) { + $eResponse = $this->getExceptionResponse($e); throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), - $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? (string) $e->getResponse()->getBody() : null + $eResponse ? $eResponse->getHeaders() : null, + $eResponse ? (string) $eResponse->getBody() : null ); - } catch (ConnectException $e) { + } catch (NetworkExceptionInterface $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), @@ -1796,7 +1862,15 @@ function ($response) use ($returnType) { ]; }, function ($exception) { - $response = $exception->getResponse(); + $response = $this->getExceptionResponse($exception); + if ($response === null) { + throw new ApiException( + "[{$exception->getCode()}] {$exception->getMessage()}", + (int) $exception->getCode(), + null, + null + ); + } $statusCode = $response->getStatusCode(); throw new ApiException( sprintf( @@ -1875,7 +1949,7 @@ public function listUsersBasesRequest($user_id, $page = null, $per_page = null, // path params if ($user_id !== null) { $resourcePath = str_replace( - '{' . 'user_id' . '}', + '{user_id}', ObjectSerializer::toPathValue($user_id), $resourcePath ); @@ -1906,7 +1980,11 @@ public function listUsersBasesRequest($user_id, $page = null, $per_page = null, } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + try { + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + } catch (\JsonException $e) { + throw new \InvalidArgumentException('json_encode error: ' . $e->getMessage(), 0, $e); + } } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -1978,13 +2056,14 @@ public function restoreTrashedBaseWithHttpInfo($base_id, string $contentType = s try { $response = $this->client->send($request, $options); } catch (RequestException $e) { + $eResponse = $this->getExceptionResponse($e); throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), - $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? (string) $e->getResponse()->getBody() : null + $eResponse ? $eResponse->getHeaders() : null, + $eResponse ? (string) $eResponse->getBody() : null ); - } catch (ConnectException $e) { + } catch (NetworkExceptionInterface $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), @@ -2099,7 +2178,15 @@ function ($response) use ($returnType) { ]; }, function ($exception) { - $response = $exception->getResponse(); + $response = $this->getExceptionResponse($exception); + if ($response === null) { + throw new ApiException( + "[{$exception->getCode()}] {$exception->getMessage()}", + (int) $exception->getCode(), + null, + null + ); + } $statusCode = $response->getStatusCode(); throw new ApiException( sprintf( @@ -2147,7 +2234,7 @@ public function restoreTrashedBaseRequest($base_id, string $contentType = self:: // path params if ($base_id !== null) { $resourcePath = str_replace( - '{' . 'base_id' . '}', + '{base_id}', ObjectSerializer::toPathValue($base_id), $resourcePath ); @@ -2178,7 +2265,11 @@ public function restoreTrashedBaseRequest($base_id, string $contentType = self:: } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + try { + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + } catch (\JsonException $e) { + throw new \InvalidArgumentException('json_encode error: ' . $e->getMessage(), 0, $e); + } } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -2238,6 +2329,21 @@ protected function createHttpClientOption() return $options; } + /** + * Returns the response attached to a Guzzle exception, if there is one. + * + * Guzzle 7 exposes getResponse() on RequestException, while Guzzle 8 only + * exposes it on ResponseException and its subclasses. + * + * @param \Throwable $exception + * + * @return ResponseInterface|null + */ + private function getExceptionResponse(\Throwable $exception): ?ResponseInterface + { + return method_exists($exception, 'getResponse') ? $exception->getResponse() : null; + } + private function handleResponseWithDataType( string $dataType, RequestInterface $request, diff --git a/lib/SysAdmin/CommonDatasetApi.php b/lib/SysAdmin/CommonDatasetApi.php index 060e3406..d7d17ced 100644 --- a/lib/SysAdmin/CommonDatasetApi.php +++ b/lib/SysAdmin/CommonDatasetApi.php @@ -28,11 +28,11 @@ use GuzzleHttp\Client; use GuzzleHttp\ClientInterface; -use GuzzleHttp\Exception\ConnectException; use GuzzleHttp\Exception\RequestException; use GuzzleHttp\Psr7\MultipartStream; use GuzzleHttp\Psr7\Request; use GuzzleHttp\RequestOptions; +use Psr\Http\Client\NetworkExceptionInterface; use Psr\Http\Message\RequestInterface; use Psr\Http\Message\ResponseInterface; use SeaTable\Client\ApiException; @@ -175,13 +175,14 @@ public function deleteInvalidSyncWithHttpInfo($sync_id, string $contentType = se try { $response = $this->client->send($request, $options); } catch (RequestException $e) { + $eResponse = $this->getExceptionResponse($e); throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), - $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? (string) $e->getResponse()->getBody() : null + $eResponse ? $eResponse->getHeaders() : null, + $eResponse ? (string) $eResponse->getBody() : null ); - } catch (ConnectException $e) { + } catch (NetworkExceptionInterface $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), @@ -296,7 +297,15 @@ function ($response) use ($returnType) { ]; }, function ($exception) { - $response = $exception->getResponse(); + $response = $this->getExceptionResponse($exception); + if ($response === null) { + throw new ApiException( + "[{$exception->getCode()}] {$exception->getMessage()}", + (int) $exception->getCode(), + null, + null + ); + } $statusCode = $response->getStatusCode(); throw new ApiException( sprintf( @@ -347,7 +356,7 @@ public function deleteInvalidSyncRequest($sync_id, string $contentType = self::c // path params if ($sync_id !== null) { $resourcePath = str_replace( - '{' . 'sync_id' . '}', + '{sync_id}', ObjectSerializer::toPathValue($sync_id), $resourcePath ); @@ -378,7 +387,11 @@ public function deleteInvalidSyncRequest($sync_id, string $contentType = self::c } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + try { + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + } catch (\JsonException $e) { + throw new \InvalidArgumentException('json_encode error: ' . $e->getMessage(), 0, $e); + } } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -448,13 +461,14 @@ public function deleteInvalidSyncsWithHttpInfo(string $contentType = self::conte try { $response = $this->client->send($request, $options); } catch (RequestException $e) { + $eResponse = $this->getExceptionResponse($e); throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), - $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? (string) $e->getResponse()->getBody() : null + $eResponse ? $eResponse->getHeaders() : null, + $eResponse ? (string) $eResponse->getBody() : null ); - } catch (ConnectException $e) { + } catch (NetworkExceptionInterface $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), @@ -567,7 +581,15 @@ function ($response) use ($returnType) { ]; }, function ($exception) { - $response = $exception->getResponse(); + $response = $this->getExceptionResponse($exception); + if ($response === null) { + throw new ApiException( + "[{$exception->getCode()}] {$exception->getMessage()}", + (int) $exception->getCode(), + null, + null + ); + } $statusCode = $response->getStatusCode(); throw new ApiException( sprintf( @@ -630,7 +652,11 @@ public function deleteInvalidSyncsRequest(string $contentType = self::contentTyp } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + try { + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + } catch (\JsonException $e) { + throw new \InvalidArgumentException('json_encode error: ' . $e->getMessage(), 0, $e); + } } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -704,13 +730,14 @@ public function listCommonDatasetWithHttpInfo($page = null, $per_page = null, st try { $response = $this->client->send($request, $options); } catch (RequestException $e) { + $eResponse = $this->getExceptionResponse($e); throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), - $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? (string) $e->getResponse()->getBody() : null + $eResponse ? $eResponse->getHeaders() : null, + $eResponse ? (string) $eResponse->getBody() : null ); - } catch (ConnectException $e) { + } catch (NetworkExceptionInterface $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), @@ -827,7 +854,15 @@ function ($response) use ($returnType) { ]; }, function ($exception) { - $response = $exception->getResponse(); + $response = $this->getExceptionResponse($exception); + if ($response === null) { + throw new ApiException( + "[{$exception->getCode()}] {$exception->getMessage()}", + (int) $exception->getCode(), + null, + null + ); + } $statusCode = $response->getStatusCode(); throw new ApiException( sprintf( @@ -918,7 +953,11 @@ public function listCommonDatasetRequest($page = null, $per_page = null, string } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + try { + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + } catch (\JsonException $e) { + throw new \InvalidArgumentException('json_encode error: ' . $e->getMessage(), 0, $e); + } } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -992,13 +1031,14 @@ public function listCommonDatasetSyncsWithHttpInfo($page = null, $per_page = nul try { $response = $this->client->send($request, $options); } catch (RequestException $e) { + $eResponse = $this->getExceptionResponse($e); throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), - $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? (string) $e->getResponse()->getBody() : null + $eResponse ? $eResponse->getHeaders() : null, + $eResponse ? (string) $eResponse->getBody() : null ); - } catch (ConnectException $e) { + } catch (NetworkExceptionInterface $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), @@ -1115,7 +1155,15 @@ function ($response) use ($returnType) { ]; }, function ($exception) { - $response = $exception->getResponse(); + $response = $this->getExceptionResponse($exception); + if ($response === null) { + throw new ApiException( + "[{$exception->getCode()}] {$exception->getMessage()}", + (int) $exception->getCode(), + null, + null + ); + } $statusCode = $response->getStatusCode(); throw new ApiException( sprintf( @@ -1206,7 +1254,11 @@ public function listCommonDatasetSyncsRequest($page = null, $per_page = null, st } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + try { + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + } catch (\JsonException $e) { + throw new \InvalidArgumentException('json_encode error: ' . $e->getMessage(), 0, $e); + } } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -1280,13 +1332,14 @@ public function listInvalidSyncsWithHttpInfo($page = null, $per_page = null, str try { $response = $this->client->send($request, $options); } catch (RequestException $e) { + $eResponse = $this->getExceptionResponse($e); throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), - $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? (string) $e->getResponse()->getBody() : null + $eResponse ? $eResponse->getHeaders() : null, + $eResponse ? (string) $eResponse->getBody() : null ); - } catch (ConnectException $e) { + } catch (NetworkExceptionInterface $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), @@ -1403,7 +1456,15 @@ function ($response) use ($returnType) { ]; }, function ($exception) { - $response = $exception->getResponse(); + $response = $this->getExceptionResponse($exception); + if ($response === null) { + throw new ApiException( + "[{$exception->getCode()}] {$exception->getMessage()}", + (int) $exception->getCode(), + null, + null + ); + } $statusCode = $response->getStatusCode(); throw new ApiException( sprintf( @@ -1494,7 +1555,11 @@ public function listInvalidSyncsRequest($page = null, $per_page = null, string $ } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + try { + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + } catch (\JsonException $e) { + throw new \InvalidArgumentException('json_encode error: ' . $e->getMessage(), 0, $e); + } } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -1554,6 +1619,21 @@ protected function createHttpClientOption() return $options; } + /** + * Returns the response attached to a Guzzle exception, if there is one. + * + * Guzzle 7 exposes getResponse() on RequestException, while Guzzle 8 only + * exposes it on ResponseException and its subclasses. + * + * @param \Throwable $exception + * + * @return ResponseInterface|null + */ + private function getExceptionResponse(\Throwable $exception): ?ResponseInterface + { + return method_exists($exception, 'getResponse') ? $exception->getResponse() : null; + } + private function handleResponseWithDataType( string $dataType, RequestInterface $request, diff --git a/lib/SysAdmin/CreateGroupRequest.php b/lib/SysAdmin/CreateGroupRequest.php index 4e551b80..61b29489 100644 --- a/lib/SysAdmin/CreateGroupRequest.php +++ b/lib/SysAdmin/CreateGroupRequest.php @@ -44,49 +44,49 @@ class CreateGroupRequest implements ModelInterface, ArrayAccess, \JsonSerializab public const DISCRIMINATOR = null; /** - * The original name of the model. - * - * @var string - */ + * The original name of the model. + * + * @var string + */ protected static $openAPIModelName = 'createGroup_request'; /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ protected static $openAPITypes = [ 'group_name' => 'string', 'group_owner' => 'string' ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - * @phpstan-var array - * @psalm-var array - */ + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ protected static $openAPIFormats = [ 'group_name' => null, 'group_owner' => null ]; /** - * Array of nullable properties. Used for (de)serialization - * - * @var boolean[] - */ + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ protected static array $openAPINullables = [ 'group_name' => false, 'group_owner' => false ]; /** - * If a nullable field gets set to null, insert it here - * - * @var boolean[] - */ + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ protected array $openAPINullablesSetToNull = []; /** @@ -254,14 +254,14 @@ public function __construct(?array $data = null) } /** - * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName - * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the - * $this->openAPINullablesSetToNull array - * - * @param string $variableName - * @param array $fields - * @param mixed $defaultValue - */ + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ private function setIfExists(string $variableName, array $fields, $defaultValue): void { if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { diff --git a/lib/SysAdmin/DepartmentsApi.php b/lib/SysAdmin/DepartmentsApi.php index 82bd0e23..a17b6596 100644 --- a/lib/SysAdmin/DepartmentsApi.php +++ b/lib/SysAdmin/DepartmentsApi.php @@ -28,11 +28,11 @@ use GuzzleHttp\Client; use GuzzleHttp\ClientInterface; -use GuzzleHttp\Exception\ConnectException; use GuzzleHttp\Exception\RequestException; use GuzzleHttp\Psr7\MultipartStream; use GuzzleHttp\Psr7\Request; use GuzzleHttp\RequestOptions; +use Psr\Http\Client\NetworkExceptionInterface; use Psr\Http\Message\RequestInterface; use Psr\Http\Message\ResponseInterface; use SeaTable\Client\ApiException; @@ -199,13 +199,14 @@ public function addDepartmentWithHttpInfo($add_department_request = null, string try { $response = $this->client->send($request, $options); } catch (RequestException $e) { + $eResponse = $this->getExceptionResponse($e); throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), - $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? (string) $e->getResponse()->getBody() : null + $eResponse ? $eResponse->getHeaders() : null, + $eResponse ? (string) $eResponse->getBody() : null ); - } catch (ConnectException $e) { + } catch (NetworkExceptionInterface $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), @@ -334,7 +335,15 @@ function ($response) use ($returnType) { ]; }, function ($exception) { - $response = $exception->getResponse(); + $response = $this->getExceptionResponse($exception); + if ($response === null) { + throw new ApiException( + "[{$exception->getCode()}] {$exception->getMessage()}", + (int) $exception->getCode(), + null, + null + ); + } $statusCode = $response->getStatusCode(); throw new ApiException( sprintf( @@ -385,7 +394,11 @@ public function addDepartmentRequest($add_department_request = null, string $con if (isset($add_department_request)) { if (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the body - $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($add_department_request)); + try { + $httpBody = json_encode(ObjectSerializer::sanitizeForSerialization($add_department_request), JSON_THROW_ON_ERROR); + } catch (\JsonException $e) { + throw new \InvalidArgumentException('json_encode error: ' . $e->getMessage(), 0, $e); + } } else { $httpBody = $add_department_request; } @@ -406,7 +419,11 @@ public function addDepartmentRequest($add_department_request = null, string $con } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + try { + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + } catch (\JsonException $e) { + throw new \InvalidArgumentException('json_encode error: ' . $e->getMessage(), 0, $e); + } } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -480,13 +497,14 @@ public function addDepartmentMembersWithHttpInfo($department_id, $email, string try { $response = $this->client->send($request, $options); } catch (RequestException $e) { + $eResponse = $this->getExceptionResponse($e); throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), - $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? (string) $e->getResponse()->getBody() : null + $eResponse ? $eResponse->getHeaders() : null, + $eResponse ? (string) $eResponse->getBody() : null ); - } catch (ConnectException $e) { + } catch (NetworkExceptionInterface $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), @@ -603,7 +621,15 @@ function ($response) use ($returnType) { ]; }, function ($exception) { - $response = $exception->getResponse(); + $response = $this->getExceptionResponse($exception); + if ($response === null) { + throw new ApiException( + "[{$exception->getCode()}] {$exception->getMessage()}", + (int) $exception->getCode(), + null, + null + ); + } $statusCode = $response->getStatusCode(); throw new ApiException( sprintf( @@ -662,7 +688,7 @@ public function addDepartmentMembersRequest($department_id, $email, string $cont // path params if ($department_id !== null) { $resourcePath = str_replace( - '{' . 'department_id' . '}', + '{department_id}', ObjectSerializer::toPathValue($department_id), $resourcePath ); @@ -702,7 +728,11 @@ public function addDepartmentMembersRequest($department_id, $email, string $cont } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + try { + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + } catch (\JsonException $e) { + throw new \InvalidArgumentException('json_encode error: ' . $e->getMessage(), 0, $e); + } } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -774,13 +804,14 @@ public function addUserToDepartmentsWithHttpInfo($add_user_to_departments_reques try { $response = $this->client->send($request, $options); } catch (RequestException $e) { + $eResponse = $this->getExceptionResponse($e); throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), - $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? (string) $e->getResponse()->getBody() : null + $eResponse ? $eResponse->getHeaders() : null, + $eResponse ? (string) $eResponse->getBody() : null ); - } catch (ConnectException $e) { + } catch (NetworkExceptionInterface $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), @@ -895,7 +926,15 @@ function ($response) use ($returnType) { ]; }, function ($exception) { - $response = $exception->getResponse(); + $response = $this->getExceptionResponse($exception); + if ($response === null) { + throw new ApiException( + "[{$exception->getCode()}] {$exception->getMessage()}", + (int) $exception->getCode(), + null, + null + ); + } $statusCode = $response->getStatusCode(); throw new ApiException( sprintf( @@ -946,7 +985,11 @@ public function addUserToDepartmentsRequest($add_user_to_departments_request = n if (isset($add_user_to_departments_request)) { if (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the body - $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($add_user_to_departments_request)); + try { + $httpBody = json_encode(ObjectSerializer::sanitizeForSerialization($add_user_to_departments_request), JSON_THROW_ON_ERROR); + } catch (\JsonException $e) { + throw new \InvalidArgumentException('json_encode error: ' . $e->getMessage(), 0, $e); + } } else { $httpBody = $add_user_to_departments_request; } @@ -967,7 +1010,11 @@ public function addUserToDepartmentsRequest($add_user_to_departments_request = n } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + try { + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + } catch (\JsonException $e) { + throw new \InvalidArgumentException('json_encode error: ' . $e->getMessage(), 0, $e); + } } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -1039,13 +1086,14 @@ public function createDepartmentGroupWithHttpInfo($department_id, string $conten try { $response = $this->client->send($request, $options); } catch (RequestException $e) { + $eResponse = $this->getExceptionResponse($e); throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), - $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? (string) $e->getResponse()->getBody() : null + $eResponse ? $eResponse->getHeaders() : null, + $eResponse ? (string) $eResponse->getBody() : null ); - } catch (ConnectException $e) { + } catch (NetworkExceptionInterface $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), @@ -1174,7 +1222,15 @@ function ($response) use ($returnType) { ]; }, function ($exception) { - $response = $exception->getResponse(); + $response = $this->getExceptionResponse($exception); + if ($response === null) { + throw new ApiException( + "[{$exception->getCode()}] {$exception->getMessage()}", + (int) $exception->getCode(), + null, + null + ); + } $statusCode = $response->getStatusCode(); throw new ApiException( sprintf( @@ -1225,7 +1281,7 @@ public function createDepartmentGroupRequest($department_id, string $contentType // path params if ($department_id !== null) { $resourcePath = str_replace( - '{' . 'department_id' . '}', + '{department_id}', ObjectSerializer::toPathValue($department_id), $resourcePath ); @@ -1256,7 +1312,11 @@ public function createDepartmentGroupRequest($department_id, string $contentType } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + try { + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + } catch (\JsonException $e) { + throw new \InvalidArgumentException('json_encode error: ' . $e->getMessage(), 0, $e); + } } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -1328,13 +1388,14 @@ public function deleteDepartmentWithHttpInfo($department_id, string $contentType try { $response = $this->client->send($request, $options); } catch (RequestException $e) { + $eResponse = $this->getExceptionResponse($e); throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), - $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? (string) $e->getResponse()->getBody() : null + $eResponse ? $eResponse->getHeaders() : null, + $eResponse ? (string) $eResponse->getBody() : null ); - } catch (ConnectException $e) { + } catch (NetworkExceptionInterface $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), @@ -1449,7 +1510,15 @@ function ($response) use ($returnType) { ]; }, function ($exception) { - $response = $exception->getResponse(); + $response = $this->getExceptionResponse($exception); + if ($response === null) { + throw new ApiException( + "[{$exception->getCode()}] {$exception->getMessage()}", + (int) $exception->getCode(), + null, + null + ); + } $statusCode = $response->getStatusCode(); throw new ApiException( sprintf( @@ -1500,7 +1569,7 @@ public function deleteDepartmentRequest($department_id, string $contentType = se // path params if ($department_id !== null) { $resourcePath = str_replace( - '{' . 'department_id' . '}', + '{department_id}', ObjectSerializer::toPathValue($department_id), $resourcePath ); @@ -1531,7 +1600,11 @@ public function deleteDepartmentRequest($department_id, string $contentType = se } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + try { + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + } catch (\JsonException $e) { + throw new \InvalidArgumentException('json_encode error: ' . $e->getMessage(), 0, $e); + } } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -1603,13 +1676,14 @@ public function deleteDepartmentGroupWithHttpInfo($department_id, string $conten try { $response = $this->client->send($request, $options); } catch (RequestException $e) { + $eResponse = $this->getExceptionResponse($e); throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), - $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? (string) $e->getResponse()->getBody() : null + $eResponse ? $eResponse->getHeaders() : null, + $eResponse ? (string) $eResponse->getBody() : null ); - } catch (ConnectException $e) { + } catch (NetworkExceptionInterface $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), @@ -1724,7 +1798,15 @@ function ($response) use ($returnType) { ]; }, function ($exception) { - $response = $exception->getResponse(); + $response = $this->getExceptionResponse($exception); + if ($response === null) { + throw new ApiException( + "[{$exception->getCode()}] {$exception->getMessage()}", + (int) $exception->getCode(), + null, + null + ); + } $statusCode = $response->getStatusCode(); throw new ApiException( sprintf( @@ -1775,7 +1857,7 @@ public function deleteDepartmentGroupRequest($department_id, string $contentType // path params if ($department_id !== null) { $resourcePath = str_replace( - '{' . 'department_id' . '}', + '{department_id}', ObjectSerializer::toPathValue($department_id), $resourcePath ); @@ -1806,7 +1888,11 @@ public function deleteDepartmentGroupRequest($department_id, string $contentType } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + try { + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + } catch (\JsonException $e) { + throw new \InvalidArgumentException('json_encode error: ' . $e->getMessage(), 0, $e); + } } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -1878,13 +1964,14 @@ public function getDepartmentGroupWithHttpInfo($department_id, string $contentTy try { $response = $this->client->send($request, $options); } catch (RequestException $e) { + $eResponse = $this->getExceptionResponse($e); throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), - $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? (string) $e->getResponse()->getBody() : null + $eResponse ? $eResponse->getHeaders() : null, + $eResponse ? (string) $eResponse->getBody() : null ); - } catch (ConnectException $e) { + } catch (NetworkExceptionInterface $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), @@ -1999,7 +2086,15 @@ function ($response) use ($returnType) { ]; }, function ($exception) { - $response = $exception->getResponse(); + $response = $this->getExceptionResponse($exception); + if ($response === null) { + throw new ApiException( + "[{$exception->getCode()}] {$exception->getMessage()}", + (int) $exception->getCode(), + null, + null + ); + } $statusCode = $response->getStatusCode(); throw new ApiException( sprintf( @@ -2050,7 +2145,7 @@ public function getDepartmentGroupRequest($department_id, string $contentType = // path params if ($department_id !== null) { $resourcePath = str_replace( - '{' . 'department_id' . '}', + '{department_id}', ObjectSerializer::toPathValue($department_id), $resourcePath ); @@ -2081,7 +2176,11 @@ public function getDepartmentGroupRequest($department_id, string $contentType = } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + try { + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + } catch (\JsonException $e) { + throw new \InvalidArgumentException('json_encode error: ' . $e->getMessage(), 0, $e); + } } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -2153,13 +2252,14 @@ public function listDepartmentMembersWithHttpInfo($department_id, string $conten try { $response = $this->client->send($request, $options); } catch (RequestException $e) { + $eResponse = $this->getExceptionResponse($e); throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), - $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? (string) $e->getResponse()->getBody() : null + $eResponse ? $eResponse->getHeaders() : null, + $eResponse ? (string) $eResponse->getBody() : null ); - } catch (ConnectException $e) { + } catch (NetworkExceptionInterface $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), @@ -2274,7 +2374,15 @@ function ($response) use ($returnType) { ]; }, function ($exception) { - $response = $exception->getResponse(); + $response = $this->getExceptionResponse($exception); + if ($response === null) { + throw new ApiException( + "[{$exception->getCode()}] {$exception->getMessage()}", + (int) $exception->getCode(), + null, + null + ); + } $statusCode = $response->getStatusCode(); throw new ApiException( sprintf( @@ -2325,7 +2433,7 @@ public function listDepartmentMembersRequest($department_id, string $contentType // path params if ($department_id !== null) { $resourcePath = str_replace( - '{' . 'department_id' . '}', + '{department_id}', ObjectSerializer::toPathValue($department_id), $resourcePath ); @@ -2356,7 +2464,11 @@ public function listDepartmentMembersRequest($department_id, string $contentType } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + try { + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + } catch (\JsonException $e) { + throw new \InvalidArgumentException('json_encode error: ' . $e->getMessage(), 0, $e); + } } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -2430,13 +2542,14 @@ public function listDepartmentsWithHttpInfo($parent_id = null, $org_id = null, s try { $response = $this->client->send($request, $options); } catch (RequestException $e) { + $eResponse = $this->getExceptionResponse($e); throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), - $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? (string) $e->getResponse()->getBody() : null + $eResponse ? $eResponse->getHeaders() : null, + $eResponse ? (string) $eResponse->getBody() : null ); - } catch (ConnectException $e) { + } catch (NetworkExceptionInterface $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), @@ -2553,7 +2666,15 @@ function ($response) use ($returnType) { ]; }, function ($exception) { - $response = $exception->getResponse(); + $response = $this->getExceptionResponse($exception); + if ($response === null) { + throw new ApiException( + "[{$exception->getCode()}] {$exception->getMessage()}", + (int) $exception->getCode(), + null, + null + ); + } $statusCode = $response->getStatusCode(); throw new ApiException( sprintf( @@ -2644,7 +2765,11 @@ public function listDepartmentsRequest($parent_id = null, $org_id = null, string } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + try { + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + } catch (\JsonException $e) { + throw new \InvalidArgumentException('json_encode error: ' . $e->getMessage(), 0, $e); + } } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -2714,13 +2839,14 @@ public function listNonDepartmentUsersWithHttpInfo(string $contentType = self::c try { $response = $this->client->send($request, $options); } catch (RequestException $e) { + $eResponse = $this->getExceptionResponse($e); throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), - $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? (string) $e->getResponse()->getBody() : null + $eResponse ? $eResponse->getHeaders() : null, + $eResponse ? (string) $eResponse->getBody() : null ); - } catch (ConnectException $e) { + } catch (NetworkExceptionInterface $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), @@ -2833,7 +2959,15 @@ function ($response) use ($returnType) { ]; }, function ($exception) { - $response = $exception->getResponse(); + $response = $this->getExceptionResponse($exception); + if ($response === null) { + throw new ApiException( + "[{$exception->getCode()}] {$exception->getMessage()}", + (int) $exception->getCode(), + null, + null + ); + } $statusCode = $response->getStatusCode(); throw new ApiException( sprintf( @@ -2896,7 +3030,11 @@ public function listNonDepartmentUsersRequest(string $contentType = self::conten } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + try { + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + } catch (\JsonException $e) { + throw new \InvalidArgumentException('json_encode error: ' . $e->getMessage(), 0, $e); + } } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -2970,13 +3108,14 @@ public function removeDepartmentMemberWithHttpInfo($department_id, $user_id, str try { $response = $this->client->send($request, $options); } catch (RequestException $e) { + $eResponse = $this->getExceptionResponse($e); throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), - $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? (string) $e->getResponse()->getBody() : null + $eResponse ? $eResponse->getHeaders() : null, + $eResponse ? (string) $eResponse->getBody() : null ); - } catch (ConnectException $e) { + } catch (NetworkExceptionInterface $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), @@ -3093,7 +3232,15 @@ function ($response) use ($returnType) { ]; }, function ($exception) { - $response = $exception->getResponse(); + $response = $this->getExceptionResponse($exception); + if ($response === null) { + throw new ApiException( + "[{$exception->getCode()}] {$exception->getMessage()}", + (int) $exception->getCode(), + null, + null + ); + } $statusCode = $response->getStatusCode(); throw new ApiException( sprintf( @@ -3155,7 +3302,7 @@ public function removeDepartmentMemberRequest($department_id, $user_id, string $ // path params if ($department_id !== null) { $resourcePath = str_replace( - '{' . 'department_id' . '}', + '{department_id}', ObjectSerializer::toPathValue($department_id), $resourcePath ); @@ -3163,7 +3310,7 @@ public function removeDepartmentMemberRequest($department_id, $user_id, string $ // path params if ($user_id !== null) { $resourcePath = str_replace( - '{' . 'user_id' . '}', + '{user_id}', ObjectSerializer::toPathValue($user_id), $resourcePath ); @@ -3194,7 +3341,11 @@ public function removeDepartmentMemberRequest($department_id, $user_id, string $ } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + try { + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + } catch (\JsonException $e) { + throw new \InvalidArgumentException('json_encode error: ' . $e->getMessage(), 0, $e); + } } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -3268,13 +3419,14 @@ public function updateDepartmentWithHttpInfo($department_id, $update_department_ try { $response = $this->client->send($request, $options); } catch (RequestException $e) { + $eResponse = $this->getExceptionResponse($e); throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), - $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? (string) $e->getResponse()->getBody() : null + $eResponse ? $eResponse->getHeaders() : null, + $eResponse ? (string) $eResponse->getBody() : null ); - } catch (ConnectException $e) { + } catch (NetworkExceptionInterface $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), @@ -3391,7 +3543,15 @@ function ($response) use ($returnType) { ]; }, function ($exception) { - $response = $exception->getResponse(); + $response = $this->getExceptionResponse($exception); + if ($response === null) { + throw new ApiException( + "[{$exception->getCode()}] {$exception->getMessage()}", + (int) $exception->getCode(), + null, + null + ); + } $statusCode = $response->getStatusCode(); throw new ApiException( sprintf( @@ -3444,7 +3604,7 @@ public function updateDepartmentRequest($department_id, $update_department_reque // path params if ($department_id !== null) { $resourcePath = str_replace( - '{' . 'department_id' . '}', + '{department_id}', ObjectSerializer::toPathValue($department_id), $resourcePath ); @@ -3461,7 +3621,11 @@ public function updateDepartmentRequest($department_id, $update_department_reque if (isset($update_department_request)) { if (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the body - $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($update_department_request)); + try { + $httpBody = json_encode(ObjectSerializer::sanitizeForSerialization($update_department_request), JSON_THROW_ON_ERROR); + } catch (\JsonException $e) { + throw new \InvalidArgumentException('json_encode error: ' . $e->getMessage(), 0, $e); + } } else { $httpBody = $update_department_request; } @@ -3482,7 +3646,11 @@ public function updateDepartmentRequest($department_id, $update_department_reque } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + try { + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + } catch (\JsonException $e) { + throw new \InvalidArgumentException('json_encode error: ' . $e->getMessage(), 0, $e); + } } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -3558,13 +3726,14 @@ public function updateDepartmentMemberWithHttpInfo($department_id, $user_id, $up try { $response = $this->client->send($request, $options); } catch (RequestException $e) { + $eResponse = $this->getExceptionResponse($e); throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), - $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? (string) $e->getResponse()->getBody() : null + $eResponse ? $eResponse->getHeaders() : null, + $eResponse ? (string) $eResponse->getBody() : null ); - } catch (ConnectException $e) { + } catch (NetworkExceptionInterface $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), @@ -3683,7 +3852,15 @@ function ($response) use ($returnType) { ]; }, function ($exception) { - $response = $exception->getResponse(); + $response = $this->getExceptionResponse($exception); + if ($response === null) { + throw new ApiException( + "[{$exception->getCode()}] {$exception->getMessage()}", + (int) $exception->getCode(), + null, + null + ); + } $statusCode = $response->getStatusCode(); throw new ApiException( sprintf( @@ -3747,7 +3924,7 @@ public function updateDepartmentMemberRequest($department_id, $user_id, $update_ // path params if ($department_id !== null) { $resourcePath = str_replace( - '{' . 'department_id' . '}', + '{department_id}', ObjectSerializer::toPathValue($department_id), $resourcePath ); @@ -3755,7 +3932,7 @@ public function updateDepartmentMemberRequest($department_id, $user_id, $update_ // path params if ($user_id !== null) { $resourcePath = str_replace( - '{' . 'user_id' . '}', + '{user_id}', ObjectSerializer::toPathValue($user_id), $resourcePath ); @@ -3772,7 +3949,11 @@ public function updateDepartmentMemberRequest($department_id, $user_id, $update_ if (isset($update_department_member_request)) { if (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the body - $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($update_department_member_request)); + try { + $httpBody = json_encode(ObjectSerializer::sanitizeForSerialization($update_department_member_request), JSON_THROW_ON_ERROR); + } catch (\JsonException $e) { + throw new \InvalidArgumentException('json_encode error: ' . $e->getMessage(), 0, $e); + } } else { $httpBody = $update_department_member_request; } @@ -3793,7 +3974,11 @@ public function updateDepartmentMemberRequest($department_id, $user_id, $update_ } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + try { + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + } catch (\JsonException $e) { + throw new \InvalidArgumentException('json_encode error: ' . $e->getMessage(), 0, $e); + } } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -3853,6 +4038,21 @@ protected function createHttpClientOption() return $options; } + /** + * Returns the response attached to a Guzzle exception, if there is one. + * + * Guzzle 7 exposes getResponse() on RequestException, while Guzzle 8 only + * exposes it on ResponseException and its subclasses. + * + * @param \Throwable $exception + * + * @return ResponseInterface|null + */ + private function getExceptionResponse(\Throwable $exception): ?ResponseInterface + { + return method_exists($exception, 'getResponse') ? $exception->getResponse() : null; + } + private function handleResponseWithDataType( string $dataType, RequestInterface $request, diff --git a/lib/SysAdmin/EnforceTwoFactorRequest.php b/lib/SysAdmin/EnforceTwoFactorRequest.php index 472a12bc..0c606cd0 100644 --- a/lib/SysAdmin/EnforceTwoFactorRequest.php +++ b/lib/SysAdmin/EnforceTwoFactorRequest.php @@ -44,46 +44,46 @@ class EnforceTwoFactorRequest implements ModelInterface, ArrayAccess, \JsonSeria public const DISCRIMINATOR = null; /** - * The original name of the model. - * - * @var string - */ + * The original name of the model. + * + * @var string + */ protected static $openAPIModelName = 'enforceTwoFactor_request'; /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ protected static $openAPITypes = [ 'force_2fa' => 'bool' ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - * @phpstan-var array - * @psalm-var array - */ + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ protected static $openAPIFormats = [ 'force_2fa' => null ]; /** - * Array of nullable properties. Used for (de)serialization - * - * @var boolean[] - */ + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ protected static array $openAPINullables = [ 'force_2fa' => false ]; /** - * If a nullable field gets set to null, insert it here - * - * @var boolean[] - */ + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ protected array $openAPINullablesSetToNull = []; /** @@ -247,14 +247,14 @@ public function __construct(?array $data = null) } /** - * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName - * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the - * $this->openAPINullablesSetToNull array - * - * @param string $variableName - * @param array $fields - * @param mixed $defaultValue - */ + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ private function setIfExists(string $variableName, array $fields, $defaultValue): void { if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { diff --git a/lib/SysAdmin/ExportApi.php b/lib/SysAdmin/ExportApi.php index 5a6f521a..04132c3f 100644 --- a/lib/SysAdmin/ExportApi.php +++ b/lib/SysAdmin/ExportApi.php @@ -28,11 +28,11 @@ use GuzzleHttp\Client; use GuzzleHttp\ClientInterface; -use GuzzleHttp\Exception\ConnectException; use GuzzleHttp\Exception\RequestException; use GuzzleHttp\Psr7\MultipartStream; use GuzzleHttp\Psr7\Request; use GuzzleHttp\RequestOptions; +use Psr\Http\Client\NetworkExceptionInterface; use Psr\Http\Message\RequestInterface; use Psr\Http\Message\ResponseInterface; use SeaTable\Client\ApiException; @@ -164,13 +164,14 @@ public function exportBaseWithHttpInfo($base_uuid, $ignore_asset = null, string try { $response = $this->client->send($request, $options); } catch (RequestException $e) { + $eResponse = $this->getExceptionResponse($e); throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), - $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? (string) $e->getResponse()->getBody() : null + $eResponse ? $eResponse->getHeaders() : null, + $eResponse ? (string) $eResponse->getBody() : null ); - } catch (ConnectException $e) { + } catch (NetworkExceptionInterface $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), @@ -238,7 +239,15 @@ function ($response) use ($returnType) { return [null, $response->getStatusCode(), $response->getHeaders()]; }, function ($exception) { - $response = $exception->getResponse(); + $response = $this->getExceptionResponse($exception); + if ($response === null) { + throw new ApiException( + "[{$exception->getCode()}] {$exception->getMessage()}", + (int) $exception->getCode(), + null, + null + ); + } $statusCode = $response->getStatusCode(); throw new ApiException( sprintf( @@ -300,7 +309,7 @@ public function exportBaseRequest($base_uuid, $ignore_asset = null, string $cont // path params if ($base_uuid !== null) { $resourcePath = str_replace( - '{' . 'base_uuid' . '}', + '{base_uuid}', ObjectSerializer::toPathValue($base_uuid), $resourcePath ); @@ -331,7 +340,11 @@ public function exportBaseRequest($base_uuid, $ignore_asset = null, string $cont } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + try { + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + } catch (\JsonException $e) { + throw new \InvalidArgumentException('json_encode error: ' . $e->getMessage(), 0, $e); + } } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -391,6 +404,21 @@ protected function createHttpClientOption() return $options; } + /** + * Returns the response attached to a Guzzle exception, if there is one. + * + * Guzzle 7 exposes getResponse() on RequestException, while Guzzle 8 only + * exposes it on ResponseException and its subclasses. + * + * @param \Throwable $exception + * + * @return ResponseInterface|null + */ + private function getExceptionResponse(\Throwable $exception): ?ResponseInterface + { + return method_exists($exception, 'getResponse') ? $exception->getResponse() : null; + } + private function handleResponseWithDataType( string $dataType, RequestInterface $request, diff --git a/lib/SysAdmin/FormsApi.php b/lib/SysAdmin/FormsApi.php index 62c6faf2..ddc9cee1 100644 --- a/lib/SysAdmin/FormsApi.php +++ b/lib/SysAdmin/FormsApi.php @@ -28,11 +28,11 @@ use GuzzleHttp\Client; use GuzzleHttp\ClientInterface; -use GuzzleHttp\Exception\ConnectException; use GuzzleHttp\Exception\RequestException; use GuzzleHttp\Psr7\MultipartStream; use GuzzleHttp\Psr7\Request; use GuzzleHttp\RequestOptions; +use Psr\Http\Client\NetworkExceptionInterface; use Psr\Http\Message\RequestInterface; use Psr\Http\Message\ResponseInterface; use SeaTable\Client\ApiException; @@ -172,13 +172,14 @@ public function deleteDataCollectionFormsWithHttpInfo($collection_table_token, s try { $response = $this->client->send($request, $options); } catch (RequestException $e) { + $eResponse = $this->getExceptionResponse($e); throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), - $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? (string) $e->getResponse()->getBody() : null + $eResponse ? $eResponse->getHeaders() : null, + $eResponse ? (string) $eResponse->getBody() : null ); - } catch (ConnectException $e) { + } catch (NetworkExceptionInterface $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), @@ -293,7 +294,15 @@ function ($response) use ($returnType) { ]; }, function ($exception) { - $response = $exception->getResponse(); + $response = $this->getExceptionResponse($exception); + if ($response === null) { + throw new ApiException( + "[{$exception->getCode()}] {$exception->getMessage()}", + (int) $exception->getCode(), + null, + null + ); + } $statusCode = $response->getStatusCode(); throw new ApiException( sprintf( @@ -344,7 +353,7 @@ public function deleteDataCollectionFormsRequest($collection_table_token, string // path params if ($collection_table_token !== null) { $resourcePath = str_replace( - '{' . 'collection_table_token' . '}', + '{collection_table_token}', ObjectSerializer::toPathValue($collection_table_token), $resourcePath ); @@ -375,7 +384,11 @@ public function deleteDataCollectionFormsRequest($collection_table_token, string } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + try { + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + } catch (\JsonException $e) { + throw new \InvalidArgumentException('json_encode error: ' . $e->getMessage(), 0, $e); + } } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -447,13 +460,14 @@ public function deleteFormWithHttpInfo($form_token, string $contentType = self:: try { $response = $this->client->send($request, $options); } catch (RequestException $e) { + $eResponse = $this->getExceptionResponse($e); throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), - $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? (string) $e->getResponse()->getBody() : null + $eResponse ? $eResponse->getHeaders() : null, + $eResponse ? (string) $eResponse->getBody() : null ); - } catch (ConnectException $e) { + } catch (NetworkExceptionInterface $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), @@ -568,7 +582,15 @@ function ($response) use ($returnType) { ]; }, function ($exception) { - $response = $exception->getResponse(); + $response = $this->getExceptionResponse($exception); + if ($response === null) { + throw new ApiException( + "[{$exception->getCode()}] {$exception->getMessage()}", + (int) $exception->getCode(), + null, + null + ); + } $statusCode = $response->getStatusCode(); throw new ApiException( sprintf( @@ -619,7 +641,7 @@ public function deleteFormRequest($form_token, string $contentType = self::conte // path params if ($form_token !== null) { $resourcePath = str_replace( - '{' . 'form_token' . '}', + '{form_token}', ObjectSerializer::toPathValue($form_token), $resourcePath ); @@ -650,7 +672,11 @@ public function deleteFormRequest($form_token, string $contentType = self::conte } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + try { + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + } catch (\JsonException $e) { + throw new \InvalidArgumentException('json_encode error: ' . $e->getMessage(), 0, $e); + } } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -720,13 +746,14 @@ public function listDataCollectionFormsWithHttpInfo(string $contentType = self:: try { $response = $this->client->send($request, $options); } catch (RequestException $e) { + $eResponse = $this->getExceptionResponse($e); throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), - $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? (string) $e->getResponse()->getBody() : null + $eResponse ? $eResponse->getHeaders() : null, + $eResponse ? (string) $eResponse->getBody() : null ); - } catch (ConnectException $e) { + } catch (NetworkExceptionInterface $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), @@ -839,7 +866,15 @@ function ($response) use ($returnType) { ]; }, function ($exception) { - $response = $exception->getResponse(); + $response = $this->getExceptionResponse($exception); + if ($response === null) { + throw new ApiException( + "[{$exception->getCode()}] {$exception->getMessage()}", + (int) $exception->getCode(), + null, + null + ); + } $statusCode = $response->getStatusCode(); throw new ApiException( sprintf( @@ -902,7 +937,11 @@ public function listDataCollectionFormsRequest(string $contentType = self::conte } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + try { + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + } catch (\JsonException $e) { + throw new \InvalidArgumentException('json_encode error: ' . $e->getMessage(), 0, $e); + } } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -972,13 +1011,14 @@ public function listFormsWithHttpInfo(string $contentType = self::contentTypes[' try { $response = $this->client->send($request, $options); } catch (RequestException $e) { + $eResponse = $this->getExceptionResponse($e); throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), - $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? (string) $e->getResponse()->getBody() : null + $eResponse ? $eResponse->getHeaders() : null, + $eResponse ? (string) $eResponse->getBody() : null ); - } catch (ConnectException $e) { + } catch (NetworkExceptionInterface $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), @@ -1091,7 +1131,15 @@ function ($response) use ($returnType) { ]; }, function ($exception) { - $response = $exception->getResponse(); + $response = $this->getExceptionResponse($exception); + if ($response === null) { + throw new ApiException( + "[{$exception->getCode()}] {$exception->getMessage()}", + (int) $exception->getCode(), + null, + null + ); + } $statusCode = $response->getStatusCode(); throw new ApiException( sprintf( @@ -1154,7 +1202,11 @@ public function listFormsRequest(string $contentType = self::contentTypes['listF } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + try { + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + } catch (\JsonException $e) { + throw new \InvalidArgumentException('json_encode error: ' . $e->getMessage(), 0, $e); + } } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -1214,6 +1266,21 @@ protected function createHttpClientOption() return $options; } + /** + * Returns the response attached to a Guzzle exception, if there is one. + * + * Guzzle 7 exposes getResponse() on RequestException, while Guzzle 8 only + * exposes it on ResponseException and its subclasses. + * + * @param \Throwable $exception + * + * @return ResponseInterface|null + */ + private function getExceptionResponse(\Throwable $exception): ?ResponseInterface + { + return method_exists($exception, 'getResponse') ? $exception->getResponse() : null; + } + private function handleResponseWithDataType( string $dataType, RequestInterface $request, diff --git a/lib/SysAdmin/GetDepartmentGroup200Response.php b/lib/SysAdmin/GetDepartmentGroup200Response.php index afc3dd8c..e7dcd3f1 100644 --- a/lib/SysAdmin/GetDepartmentGroup200Response.php +++ b/lib/SysAdmin/GetDepartmentGroup200Response.php @@ -44,49 +44,49 @@ class GetDepartmentGroup200Response implements ModelInterface, ArrayAccess, \Jso public const DISCRIMINATOR = null; /** - * The original name of the model. - * - * @var string - */ + * The original name of the model. + * + * @var string + */ protected static $openAPIModelName = 'getDepartmentGroup_200_response'; /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ protected static $openAPITypes = [ 'group_id' => 'int', 'group_name' => 'string' ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - * @phpstan-var array - * @psalm-var array - */ + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ protected static $openAPIFormats = [ 'group_id' => null, 'group_name' => null ]; /** - * Array of nullable properties. Used for (de)serialization - * - * @var boolean[] - */ + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ protected static array $openAPINullables = [ 'group_id' => false, 'group_name' => false ]; /** - * If a nullable field gets set to null, insert it here - * - * @var boolean[] - */ + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ protected array $openAPINullablesSetToNull = []; /** @@ -254,14 +254,14 @@ public function __construct(?array $data = null) } /** - * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName - * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the - * $this->openAPINullablesSetToNull array - * - * @param string $variableName - * @param array $fields - * @param mixed $defaultValue - */ + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ private function setIfExists(string $variableName, array $fields, $defaultValue): void { if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { diff --git a/lib/SysAdmin/GetSystemInformation200Response.php b/lib/SysAdmin/GetSystemInformation200Response.php index 31ff21f0..edf3f662 100644 --- a/lib/SysAdmin/GetSystemInformation200Response.php +++ b/lib/SysAdmin/GetSystemInformation200Response.php @@ -44,17 +44,17 @@ class GetSystemInformation200Response implements ModelInterface, ArrayAccess, \J public const DISCRIMINATOR = null; /** - * The original name of the model. - * - * @var string - */ + * The original name of the model. + * + * @var string + */ protected static $openAPIModelName = 'getSystemInformation_200_response'; /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ protected static $openAPITypes = [ 'version' => 'string', 'users_count' => 'int', @@ -77,12 +77,12 @@ class GetSystemInformation200Response implements ModelInterface, ArrayAccess, \J ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - * @phpstan-var array - * @psalm-var array - */ + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ protected static $openAPIFormats = [ 'version' => null, 'users_count' => null, @@ -105,10 +105,10 @@ class GetSystemInformation200Response implements ModelInterface, ArrayAccess, \J ]; /** - * Array of nullable properties. Used for (de)serialization - * - * @var boolean[] - */ + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ protected static array $openAPINullables = [ 'version' => false, 'users_count' => false, @@ -131,10 +131,10 @@ class GetSystemInformation200Response implements ModelInterface, ArrayAccess, \J ]; /** - * If a nullable field gets set to null, insert it here - * - * @var boolean[] - */ + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ protected array $openAPINullablesSetToNull = []; /** @@ -366,14 +366,14 @@ public function __construct(?array $data = null) } /** - * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName - * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the - * $this->openAPINullablesSetToNull array - * - * @param string $variableName - * @param array $fields - * @param mixed $defaultValue - */ + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ private function setIfExists(string $variableName, array $fields, $defaultValue): void { if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { diff --git a/lib/SysAdmin/GetUser200Response.php b/lib/SysAdmin/GetUser200Response.php index 9b3c0daf..94f3a38b 100644 --- a/lib/SysAdmin/GetUser200Response.php +++ b/lib/SysAdmin/GetUser200Response.php @@ -44,17 +44,17 @@ class GetUser200Response implements ModelInterface, ArrayAccess, \JsonSerializab public const DISCRIMINATOR = null; /** - * The original name of the model. - * - * @var string - */ + * The original name of the model. + * + * @var string + */ protected static $openAPIModelName = 'getUser_200_response'; /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ protected static $openAPITypes = [ 'org_id' => 'int', 'org_name' => 'string', @@ -75,12 +75,12 @@ class GetUser200Response implements ModelInterface, ArrayAccess, \JsonSerializab ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - * @phpstan-var array - * @psalm-var array - */ + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ protected static $openAPIFormats = [ 'org_id' => null, 'org_name' => null, @@ -101,10 +101,10 @@ class GetUser200Response implements ModelInterface, ArrayAccess, \JsonSerializab ]; /** - * Array of nullable properties. Used for (de)serialization - * - * @var boolean[] - */ + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ protected static array $openAPINullables = [ 'org_id' => false, 'org_name' => false, @@ -125,10 +125,10 @@ class GetUser200Response implements ModelInterface, ArrayAccess, \JsonSerializab ]; /** - * If a nullable field gets set to null, insert it here - * - * @var boolean[] - */ + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ protected array $openAPINullablesSetToNull = []; /** @@ -352,14 +352,14 @@ public function __construct(?array $data = null) } /** - * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName - * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the - * $this->openAPINullablesSetToNull array - * - * @param string $variableName - * @param array $fields - * @param mixed $defaultValue - */ + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ private function setIfExists(string $variableName, array $fields, $defaultValue): void { if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { diff --git a/lib/SysAdmin/GroupsApi.php b/lib/SysAdmin/GroupsApi.php index 29631a3f..5ea0ad7a 100644 --- a/lib/SysAdmin/GroupsApi.php +++ b/lib/SysAdmin/GroupsApi.php @@ -28,11 +28,11 @@ use GuzzleHttp\Client; use GuzzleHttp\ClientInterface; -use GuzzleHttp\Exception\ConnectException; use GuzzleHttp\Exception\RequestException; use GuzzleHttp\Psr7\MultipartStream; use GuzzleHttp\Psr7\Request; use GuzzleHttp\RequestOptions; +use Psr\Http\Client\NetworkExceptionInterface; use Psr\Http\Message\RequestInterface; use Psr\Http\Message\ResponseInterface; use SeaTable\Client\ApiException; @@ -172,13 +172,14 @@ public function createGroupWithHttpInfo($create_group_request = null, string $co try { $response = $this->client->send($request, $options); } catch (RequestException $e) { + $eResponse = $this->getExceptionResponse($e); throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), - $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? (string) $e->getResponse()->getBody() : null + $eResponse ? $eResponse->getHeaders() : null, + $eResponse ? (string) $eResponse->getBody() : null ); - } catch (ConnectException $e) { + } catch (NetworkExceptionInterface $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), @@ -293,7 +294,15 @@ function ($response) use ($returnType) { ]; }, function ($exception) { - $response = $exception->getResponse(); + $response = $this->getExceptionResponse($exception); + if ($response === null) { + throw new ApiException( + "[{$exception->getCode()}] {$exception->getMessage()}", + (int) $exception->getCode(), + null, + null + ); + } $statusCode = $response->getStatusCode(); throw new ApiException( sprintf( @@ -344,7 +353,11 @@ public function createGroupRequest($create_group_request = null, string $content if (isset($create_group_request)) { if (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the body - $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($create_group_request)); + try { + $httpBody = json_encode(ObjectSerializer::sanitizeForSerialization($create_group_request), JSON_THROW_ON_ERROR); + } catch (\JsonException $e) { + throw new \InvalidArgumentException('json_encode error: ' . $e->getMessage(), 0, $e); + } } else { $httpBody = $create_group_request; } @@ -365,7 +378,11 @@ public function createGroupRequest($create_group_request = null, string $content } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + try { + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + } catch (\JsonException $e) { + throw new \InvalidArgumentException('json_encode error: ' . $e->getMessage(), 0, $e); + } } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -437,13 +454,14 @@ public function deleteGroupWithHttpInfo($group_id, string $contentType = self::c try { $response = $this->client->send($request, $options); } catch (RequestException $e) { + $eResponse = $this->getExceptionResponse($e); throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), - $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? (string) $e->getResponse()->getBody() : null + $eResponse ? $eResponse->getHeaders() : null, + $eResponse ? (string) $eResponse->getBody() : null ); - } catch (ConnectException $e) { + } catch (NetworkExceptionInterface $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), @@ -558,7 +576,15 @@ function ($response) use ($returnType) { ]; }, function ($exception) { - $response = $exception->getResponse(); + $response = $this->getExceptionResponse($exception); + if ($response === null) { + throw new ApiException( + "[{$exception->getCode()}] {$exception->getMessage()}", + (int) $exception->getCode(), + null, + null + ); + } $statusCode = $response->getStatusCode(); throw new ApiException( sprintf( @@ -609,7 +635,7 @@ public function deleteGroupRequest($group_id, string $contentType = self::conten // path params if ($group_id !== null) { $resourcePath = str_replace( - '{' . 'group_id' . '}', + '{group_id}', ObjectSerializer::toPathValue($group_id), $resourcePath ); @@ -640,7 +666,11 @@ public function deleteGroupRequest($group_id, string $contentType = self::conten } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + try { + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + } catch (\JsonException $e) { + throw new \InvalidArgumentException('json_encode error: ' . $e->getMessage(), 0, $e); + } } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -716,13 +746,14 @@ public function listGroupsWithHttpInfo($page = null, $per_page = null, $name = n try { $response = $this->client->send($request, $options); } catch (RequestException $e) { + $eResponse = $this->getExceptionResponse($e); throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), - $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? (string) $e->getResponse()->getBody() : null + $eResponse ? $eResponse->getHeaders() : null, + $eResponse ? (string) $eResponse->getBody() : null ); - } catch (ConnectException $e) { + } catch (NetworkExceptionInterface $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), @@ -841,7 +872,15 @@ function ($response) use ($returnType) { ]; }, function ($exception) { - $response = $exception->getResponse(); + $response = $this->getExceptionResponse($exception); + if ($response === null) { + throw new ApiException( + "[{$exception->getCode()}] {$exception->getMessage()}", + (int) $exception->getCode(), + null, + null + ); + } $statusCode = $response->getStatusCode(); throw new ApiException( sprintf( @@ -943,7 +982,11 @@ public function listGroupsRequest($page = null, $per_page = null, $name = null, } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + try { + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + } catch (\JsonException $e) { + throw new \InvalidArgumentException('json_encode error: ' . $e->getMessage(), 0, $e); + } } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -1017,13 +1060,14 @@ public function transferGroupWithHttpInfo($group_id, $transfer_group_request = n try { $response = $this->client->send($request, $options); } catch (RequestException $e) { + $eResponse = $this->getExceptionResponse($e); throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), - $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? (string) $e->getResponse()->getBody() : null + $eResponse ? $eResponse->getHeaders() : null, + $eResponse ? (string) $eResponse->getBody() : null ); - } catch (ConnectException $e) { + } catch (NetworkExceptionInterface $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), @@ -1140,7 +1184,15 @@ function ($response) use ($returnType) { ]; }, function ($exception) { - $response = $exception->getResponse(); + $response = $this->getExceptionResponse($exception); + if ($response === null) { + throw new ApiException( + "[{$exception->getCode()}] {$exception->getMessage()}", + (int) $exception->getCode(), + null, + null + ); + } $statusCode = $response->getStatusCode(); throw new ApiException( sprintf( @@ -1193,7 +1245,7 @@ public function transferGroupRequest($group_id, $transfer_group_request = null, // path params if ($group_id !== null) { $resourcePath = str_replace( - '{' . 'group_id' . '}', + '{group_id}', ObjectSerializer::toPathValue($group_id), $resourcePath ); @@ -1210,7 +1262,11 @@ public function transferGroupRequest($group_id, $transfer_group_request = null, if (isset($transfer_group_request)) { if (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the body - $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($transfer_group_request)); + try { + $httpBody = json_encode(ObjectSerializer::sanitizeForSerialization($transfer_group_request), JSON_THROW_ON_ERROR); + } catch (\JsonException $e) { + throw new \InvalidArgumentException('json_encode error: ' . $e->getMessage(), 0, $e); + } } else { $httpBody = $transfer_group_request; } @@ -1231,7 +1287,11 @@ public function transferGroupRequest($group_id, $transfer_group_request = null, } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + try { + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + } catch (\JsonException $e) { + throw new \InvalidArgumentException('json_encode error: ' . $e->getMessage(), 0, $e); + } } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -1291,6 +1351,21 @@ protected function createHttpClientOption() return $options; } + /** + * Returns the response attached to a Guzzle exception, if there is one. + * + * Guzzle 7 exposes getResponse() on RequestException, while Guzzle 8 only + * exposes it on ResponseException and its subclasses. + * + * @param \Throwable $exception + * + * @return ResponseInterface|null + */ + private function getExceptionResponse(\Throwable $exception): ?ResponseInterface + { + return method_exists($exception, 'getResponse') ? $exception->getResponse() : null; + } + private function handleResponseWithDataType( string $dataType, RequestInterface $request, diff --git a/lib/SysAdmin/ListActiveUsersByDay200Response.php b/lib/SysAdmin/ListActiveUsersByDay200Response.php index a9fac852..4ef4e974 100644 --- a/lib/SysAdmin/ListActiveUsersByDay200Response.php +++ b/lib/SysAdmin/ListActiveUsersByDay200Response.php @@ -44,17 +44,17 @@ class ListActiveUsersByDay200Response implements ModelInterface, ArrayAccess, \J public const DISCRIMINATOR = null; /** - * The original name of the model. - * - * @var string - */ + * The original name of the model. + * + * @var string + */ protected static $openAPIModelName = 'listActiveUsersByDay_200_response'; /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ protected static $openAPITypes = [ 'active_user_list' => 'object[]', 'page' => 'int', @@ -62,12 +62,12 @@ class ListActiveUsersByDay200Response implements ModelInterface, ArrayAccess, \J ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - * @phpstan-var array - * @psalm-var array - */ + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ protected static $openAPIFormats = [ 'active_user_list' => null, 'page' => null, @@ -75,10 +75,10 @@ class ListActiveUsersByDay200Response implements ModelInterface, ArrayAccess, \J ]; /** - * Array of nullable properties. Used for (de)serialization - * - * @var boolean[] - */ + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ protected static array $openAPINullables = [ 'active_user_list' => false, 'page' => false, @@ -86,10 +86,10 @@ class ListActiveUsersByDay200Response implements ModelInterface, ArrayAccess, \J ]; /** - * If a nullable field gets set to null, insert it here - * - * @var boolean[] - */ + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ protected array $openAPINullablesSetToNull = []; /** @@ -261,14 +261,14 @@ public function __construct(?array $data = null) } /** - * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName - * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the - * $this->openAPINullablesSetToNull array - * - * @param string $variableName - * @param array $fields - * @param mixed $defaultValue - */ + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ private function setIfExists(string $variableName, array $fields, $defaultValue): void { if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { diff --git a/lib/SysAdmin/ListAuditLogs200Response.php b/lib/SysAdmin/ListAuditLogs200Response.php index f0190bec..7572aeee 100644 --- a/lib/SysAdmin/ListAuditLogs200Response.php +++ b/lib/SysAdmin/ListAuditLogs200Response.php @@ -44,49 +44,49 @@ class ListAuditLogs200Response implements ModelInterface, ArrayAccess, \JsonSeri public const DISCRIMINATOR = null; /** - * The original name of the model. - * - * @var string - */ + * The original name of the model. + * + * @var string + */ protected static $openAPIModelName = 'listAuditLogs_200_response'; /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ protected static $openAPITypes = [ 'audit_log_list' => '\SeaTable\Client\SysAdmin\ListAuditLogs200ResponseAuditLogListInner[]', 'total_count' => 'int' ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - * @phpstan-var array - * @psalm-var array - */ + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ protected static $openAPIFormats = [ 'audit_log_list' => null, 'total_count' => null ]; /** - * Array of nullable properties. Used for (de)serialization - * - * @var boolean[] - */ + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ protected static array $openAPINullables = [ 'audit_log_list' => false, 'total_count' => false ]; /** - * If a nullable field gets set to null, insert it here - * - * @var boolean[] - */ + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ protected array $openAPINullablesSetToNull = []; /** @@ -254,14 +254,14 @@ public function __construct(?array $data = null) } /** - * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName - * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the - * $this->openAPINullablesSetToNull array - * - * @param string $variableName - * @param array $fields - * @param mixed $defaultValue - */ + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ private function setIfExists(string $variableName, array $fields, $defaultValue): void { if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { diff --git a/lib/SysAdmin/ListAuditLogs200ResponseAuditLogListInner.php b/lib/SysAdmin/ListAuditLogs200ResponseAuditLogListInner.php index e006ae6a..338ad0a2 100644 --- a/lib/SysAdmin/ListAuditLogs200ResponseAuditLogListInner.php +++ b/lib/SysAdmin/ListAuditLogs200ResponseAuditLogListInner.php @@ -44,17 +44,17 @@ class ListAuditLogs200ResponseAuditLogListInner implements ModelInterface, Array public const DISCRIMINATOR = null; /** - * The original name of the model. - * - * @var string - */ + * The original name of the model. + * + * @var string + */ protected static $openAPIModelName = 'listAuditLogs_200_response_audit_log_list_inner'; /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ protected static $openAPITypes = [ 'username' => 'string', 'name' => 'string', @@ -66,12 +66,12 @@ class ListAuditLogs200ResponseAuditLogListInner implements ModelInterface, Array ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - * @phpstan-var array - * @psalm-var array - */ + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ protected static $openAPIFormats = [ 'username' => null, 'name' => null, @@ -83,10 +83,10 @@ class ListAuditLogs200ResponseAuditLogListInner implements ModelInterface, Array ]; /** - * Array of nullable properties. Used for (de)serialization - * - * @var boolean[] - */ + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ protected static array $openAPINullables = [ 'username' => false, 'name' => false, @@ -98,10 +98,10 @@ class ListAuditLogs200ResponseAuditLogListInner implements ModelInterface, Array ]; /** - * If a nullable field gets set to null, insert it here - * - * @var boolean[] - */ + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ protected array $openAPINullablesSetToNull = []; /** @@ -289,14 +289,14 @@ public function __construct(?array $data = null) } /** - * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName - * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the - * $this->openAPINullablesSetToNull array - * - * @param string $variableName - * @param array $fields - * @param mixed $defaultValue - */ + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ private function setIfExists(string $variableName, array $fields, $defaultValue): void { if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { diff --git a/lib/SysAdmin/ListAuditLogs200ResponseAuditLogListInnerDetail.php b/lib/SysAdmin/ListAuditLogs200ResponseAuditLogListInnerDetail.php index dbd2750f..b36020be 100644 --- a/lib/SysAdmin/ListAuditLogs200ResponseAuditLogListInnerDetail.php +++ b/lib/SysAdmin/ListAuditLogs200ResponseAuditLogListInnerDetail.php @@ -45,49 +45,49 @@ class ListAuditLogs200ResponseAuditLogListInnerDetail implements ModelInterface, public const DISCRIMINATOR = null; /** - * The original name of the model. - * - * @var string - */ + * The original name of the model. + * + * @var string + */ protected static $openAPIModelName = 'listAuditLogs_200_response_audit_log_list_inner_detail'; /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ protected static $openAPITypes = [ 'id' => 'int', 'name' => 'string' ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - * @phpstan-var array - * @psalm-var array - */ + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ protected static $openAPIFormats = [ 'id' => null, 'name' => null ]; /** - * Array of nullable properties. Used for (de)serialization - * - * @var boolean[] - */ + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ protected static array $openAPINullables = [ 'id' => false, 'name' => false ]; /** - * If a nullable field gets set to null, insert it here - * - * @var boolean[] - */ + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ protected array $openAPINullablesSetToNull = []; /** @@ -255,14 +255,14 @@ public function __construct(?array $data = null) } /** - * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName - * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the - * $this->openAPINullablesSetToNull array - * - * @param string $variableName - * @param array $fields - * @param mixed $defaultValue - */ + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ private function setIfExists(string $variableName, array $fields, $defaultValue): void { if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { diff --git a/lib/SysAdmin/ListDepartmentMembers200Response.php b/lib/SysAdmin/ListDepartmentMembers200Response.php index a1b377a8..bf9aba37 100644 --- a/lib/SysAdmin/ListDepartmentMembers200Response.php +++ b/lib/SysAdmin/ListDepartmentMembers200Response.php @@ -44,46 +44,46 @@ class ListDepartmentMembers200Response implements ModelInterface, ArrayAccess, \ public const DISCRIMINATOR = null; /** - * The original name of the model. - * - * @var string - */ + * The original name of the model. + * + * @var string + */ protected static $openAPIModelName = 'listDepartmentMembers_200_response'; /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ protected static $openAPITypes = [ 'member_list' => 'object[]' ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - * @phpstan-var array - * @psalm-var array - */ + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ protected static $openAPIFormats = [ 'member_list' => null ]; /** - * Array of nullable properties. Used for (de)serialization - * - * @var boolean[] - */ + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ protected static array $openAPINullables = [ 'member_list' => false ]; /** - * If a nullable field gets set to null, insert it here - * - * @var boolean[] - */ + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ protected array $openAPINullablesSetToNull = []; /** @@ -247,14 +247,14 @@ public function __construct(?array $data = null) } /** - * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName - * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the - * $this->openAPINullablesSetToNull array - * - * @param string $variableName - * @param array $fields - * @param mixed $defaultValue - */ + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ private function setIfExists(string $variableName, array $fields, $defaultValue): void { if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { diff --git a/lib/SysAdmin/ListDepartments200Response.php b/lib/SysAdmin/ListDepartments200Response.php index b76c8302..0e007be8 100644 --- a/lib/SysAdmin/ListDepartments200Response.php +++ b/lib/SysAdmin/ListDepartments200Response.php @@ -44,46 +44,46 @@ class ListDepartments200Response implements ModelInterface, ArrayAccess, \JsonSe public const DISCRIMINATOR = null; /** - * The original name of the model. - * - * @var string - */ + * The original name of the model. + * + * @var string + */ protected static $openAPIModelName = 'listDepartments_200_response'; /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ protected static $openAPITypes = [ 'department_list' => 'object[]' ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - * @phpstan-var array - * @psalm-var array - */ + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ protected static $openAPIFormats = [ 'department_list' => null ]; /** - * Array of nullable properties. Used for (de)serialization - * - * @var boolean[] - */ + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ protected static array $openAPINullables = [ 'department_list' => false ]; /** - * If a nullable field gets set to null, insert it here - * - * @var boolean[] - */ + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ protected array $openAPINullablesSetToNull = []; /** @@ -247,14 +247,14 @@ public function __construct(?array $data = null) } /** - * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName - * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the - * $this->openAPINullablesSetToNull array - * - * @param string $variableName - * @param array $fields - * @param mixed $defaultValue - */ + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ private function setIfExists(string $variableName, array $fields, $defaultValue): void { if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { diff --git a/lib/SysAdmin/ListNonDepartmentUsers200Response.php b/lib/SysAdmin/ListNonDepartmentUsers200Response.php index cbd53017..5caaf394 100644 --- a/lib/SysAdmin/ListNonDepartmentUsers200Response.php +++ b/lib/SysAdmin/ListNonDepartmentUsers200Response.php @@ -44,46 +44,46 @@ class ListNonDepartmentUsers200Response implements ModelInterface, ArrayAccess, public const DISCRIMINATOR = null; /** - * The original name of the model. - * - * @var string - */ + * The original name of the model. + * + * @var string + */ protected static $openAPIModelName = 'listNonDepartmentUsers_200_response'; /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ protected static $openAPITypes = [ 'user_list' => 'object[]' ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - * @phpstan-var array - * @psalm-var array - */ + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ protected static $openAPIFormats = [ 'user_list' => null ]; /** - * Array of nullable properties. Used for (de)serialization - * - * @var boolean[] - */ + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ protected static array $openAPINullables = [ 'user_list' => false ]; /** - * If a nullable field gets set to null, insert it here - * - * @var boolean[] - */ + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ protected array $openAPINullablesSetToNull = []; /** @@ -247,14 +247,14 @@ public function __construct(?array $data = null) } /** - * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName - * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the - * $this->openAPINullablesSetToNull array - * - * @param string $variableName - * @param array $fields - * @param mixed $defaultValue - */ + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ private function setIfExists(string $variableName, array $fields, $defaultValue): void { if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { diff --git a/lib/SysAdmin/LogsApi.php b/lib/SysAdmin/LogsApi.php index 260429ad..7596c024 100644 --- a/lib/SysAdmin/LogsApi.php +++ b/lib/SysAdmin/LogsApi.php @@ -28,11 +28,11 @@ use GuzzleHttp\Client; use GuzzleHttp\ClientInterface; -use GuzzleHttp\Exception\ConnectException; use GuzzleHttp\Exception\RequestException; use GuzzleHttp\Psr7\MultipartStream; use GuzzleHttp\Psr7\Request; use GuzzleHttp\RequestOptions; +use Psr\Http\Client\NetworkExceptionInterface; use Psr\Http\Message\RequestInterface; use Psr\Http\Message\ResponseInterface; use SeaTable\Client\ApiException; @@ -193,13 +193,14 @@ public function deleteVirusFileWithHttpInfo($virus_id, string $contentType = sel try { $response = $this->client->send($request, $options); } catch (RequestException $e) { + $eResponse = $this->getExceptionResponse($e); throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), - $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? (string) $e->getResponse()->getBody() : null + $eResponse ? $eResponse->getHeaders() : null, + $eResponse ? (string) $eResponse->getBody() : null ); - } catch (ConnectException $e) { + } catch (NetworkExceptionInterface $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), @@ -314,7 +315,15 @@ function ($response) use ($returnType) { ]; }, function ($exception) { - $response = $exception->getResponse(); + $response = $this->getExceptionResponse($exception); + if ($response === null) { + throw new ApiException( + "[{$exception->getCode()}] {$exception->getMessage()}", + (int) $exception->getCode(), + null, + null + ); + } $statusCode = $response->getStatusCode(); throw new ApiException( sprintf( @@ -362,7 +371,7 @@ public function deleteVirusFileRequest($virus_id, string $contentType = self::co // path params if ($virus_id !== null) { $resourcePath = str_replace( - '{' . 'virus_id' . '}', + '{virus_id}', ObjectSerializer::toPathValue($virus_id), $resourcePath ); @@ -393,7 +402,11 @@ public function deleteVirusFileRequest($virus_id, string $contentType = self::co } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + try { + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + } catch (\JsonException $e) { + throw new \InvalidArgumentException('json_encode error: ' . $e->getMessage(), 0, $e); + } } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -463,13 +476,14 @@ public function listAbuseReportsWithHttpInfo(string $contentType = self::content try { $response = $this->client->send($request, $options); } catch (RequestException $e) { + $eResponse = $this->getExceptionResponse($e); throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), - $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? (string) $e->getResponse()->getBody() : null + $eResponse ? $eResponse->getHeaders() : null, + $eResponse ? (string) $eResponse->getBody() : null ); - } catch (ConnectException $e) { + } catch (NetworkExceptionInterface $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), @@ -582,7 +596,15 @@ function ($response) use ($returnType) { ]; }, function ($exception) { - $response = $exception->getResponse(); + $response = $this->getExceptionResponse($exception); + if ($response === null) { + throw new ApiException( + "[{$exception->getCode()}] {$exception->getMessage()}", + (int) $exception->getCode(), + null, + null + ); + } $statusCode = $response->getStatusCode(); throw new ApiException( sprintf( @@ -645,7 +667,11 @@ public function listAbuseReportsRequest(string $contentType = self::contentTypes } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + try { + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + } catch (\JsonException $e) { + throw new \InvalidArgumentException('json_encode error: ' . $e->getMessage(), 0, $e); + } } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -719,13 +745,14 @@ public function listAuditLogsWithHttpInfo($page = null, $per_page = null, string try { $response = $this->client->send($request, $options); } catch (RequestException $e) { + $eResponse = $this->getExceptionResponse($e); throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), - $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? (string) $e->getResponse()->getBody() : null + $eResponse ? $eResponse->getHeaders() : null, + $eResponse ? (string) $eResponse->getBody() : null ); - } catch (ConnectException $e) { + } catch (NetworkExceptionInterface $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), @@ -842,7 +869,15 @@ function ($response) use ($returnType) { ]; }, function ($exception) { - $response = $exception->getResponse(); + $response = $this->getExceptionResponse($exception); + if ($response === null) { + throw new ApiException( + "[{$exception->getCode()}] {$exception->getMessage()}", + (int) $exception->getCode(), + null, + null + ); + } $statusCode = $response->getStatusCode(); throw new ApiException( sprintf( @@ -933,7 +968,11 @@ public function listAuditLogsRequest($page = null, $per_page = null, string $con } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + try { + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + } catch (\JsonException $e) { + throw new \InvalidArgumentException('json_encode error: ' . $e->getMessage(), 0, $e); + } } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -1007,13 +1046,14 @@ public function listEmailLogsWithHttpInfo($page = null, $per_page = null, string try { $response = $this->client->send($request, $options); } catch (RequestException $e) { + $eResponse = $this->getExceptionResponse($e); throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), - $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? (string) $e->getResponse()->getBody() : null + $eResponse ? $eResponse->getHeaders() : null, + $eResponse ? (string) $eResponse->getBody() : null ); - } catch (ConnectException $e) { + } catch (NetworkExceptionInterface $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), @@ -1130,7 +1170,15 @@ function ($response) use ($returnType) { ]; }, function ($exception) { - $response = $exception->getResponse(); + $response = $this->getExceptionResponse($exception); + if ($response === null) { + throw new ApiException( + "[{$exception->getCode()}] {$exception->getMessage()}", + (int) $exception->getCode(), + null, + null + ); + } $statusCode = $response->getStatusCode(); throw new ApiException( sprintf( @@ -1221,7 +1269,11 @@ public function listEmailLogsRequest($page = null, $per_page = null, string $con } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + try { + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + } catch (\JsonException $e) { + throw new \InvalidArgumentException('json_encode error: ' . $e->getMessage(), 0, $e); + } } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -1294,13 +1346,14 @@ public function listFileAccessLogsWithHttpInfo($page = null, $per_page = null, s try { $response = $this->client->send($request, $options); } catch (RequestException $e) { + $eResponse = $this->getExceptionResponse($e); throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), - $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? (string) $e->getResponse()->getBody() : null + $eResponse ? $eResponse->getHeaders() : null, + $eResponse ? (string) $eResponse->getBody() : null ); - } catch (ConnectException $e) { + } catch (NetworkExceptionInterface $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), @@ -1368,7 +1421,15 @@ function ($response) use ($returnType) { return [null, $response->getStatusCode(), $response->getHeaders()]; }, function ($exception) { - $response = $exception->getResponse(); + $response = $this->getExceptionResponse($exception); + if ($response === null) { + throw new ApiException( + "[{$exception->getCode()}] {$exception->getMessage()}", + (int) $exception->getCode(), + null, + null + ); + } $statusCode = $response->getStatusCode(); throw new ApiException( sprintf( @@ -1459,7 +1520,11 @@ public function listFileAccessLogsRequest($page = null, $per_page = null, string } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + try { + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + } catch (\JsonException $e) { + throw new \InvalidArgumentException('json_encode error: ' . $e->getMessage(), 0, $e); + } } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -1533,13 +1598,14 @@ public function listGroupMemberAuditLogsWithHttpInfo($page = null, $per_page = n try { $response = $this->client->send($request, $options); } catch (RequestException $e) { + $eResponse = $this->getExceptionResponse($e); throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), - $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? (string) $e->getResponse()->getBody() : null + $eResponse ? $eResponse->getHeaders() : null, + $eResponse ? (string) $eResponse->getBody() : null ); - } catch (ConnectException $e) { + } catch (NetworkExceptionInterface $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), @@ -1656,7 +1722,15 @@ function ($response) use ($returnType) { ]; }, function ($exception) { - $response = $exception->getResponse(); + $response = $this->getExceptionResponse($exception); + if ($response === null) { + throw new ApiException( + "[{$exception->getCode()}] {$exception->getMessage()}", + (int) $exception->getCode(), + null, + null + ); + } $statusCode = $response->getStatusCode(); throw new ApiException( sprintf( @@ -1747,7 +1821,11 @@ public function listGroupMemberAuditLogsRequest($page = null, $per_page = null, } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + try { + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + } catch (\JsonException $e) { + throw new \InvalidArgumentException('json_encode error: ' . $e->getMessage(), 0, $e); + } } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -1821,13 +1899,14 @@ public function listLoginLogsWithHttpInfo($page = null, $per_page = null, string try { $response = $this->client->send($request, $options); } catch (RequestException $e) { + $eResponse = $this->getExceptionResponse($e); throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), - $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? (string) $e->getResponse()->getBody() : null + $eResponse ? $eResponse->getHeaders() : null, + $eResponse ? (string) $eResponse->getBody() : null ); - } catch (ConnectException $e) { + } catch (NetworkExceptionInterface $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), @@ -1944,7 +2023,15 @@ function ($response) use ($returnType) { ]; }, function ($exception) { - $response = $exception->getResponse(); + $response = $this->getExceptionResponse($exception); + if ($response === null) { + throw new ApiException( + "[{$exception->getCode()}] {$exception->getMessage()}", + (int) $exception->getCode(), + null, + null + ); + } $statusCode = $response->getStatusCode(); throw new ApiException( sprintf( @@ -2035,7 +2122,11 @@ public function listLoginLogsRequest($page = null, $per_page = null, string $con } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + try { + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + } catch (\JsonException $e) { + throw new \InvalidArgumentException('json_encode error: ' . $e->getMessage(), 0, $e); + } } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -2105,13 +2196,14 @@ public function listRegistrationLogsWithHttpInfo(string $contentType = self::con try { $response = $this->client->send($request, $options); } catch (RequestException $e) { + $eResponse = $this->getExceptionResponse($e); throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), - $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? (string) $e->getResponse()->getBody() : null + $eResponse ? $eResponse->getHeaders() : null, + $eResponse ? (string) $eResponse->getBody() : null ); - } catch (ConnectException $e) { + } catch (NetworkExceptionInterface $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), @@ -2224,7 +2316,15 @@ function ($response) use ($returnType) { ]; }, function ($exception) { - $response = $exception->getResponse(); + $response = $this->getExceptionResponse($exception); + if ($response === null) { + throw new ApiException( + "[{$exception->getCode()}] {$exception->getMessage()}", + (int) $exception->getCode(), + null, + null + ); + } $statusCode = $response->getStatusCode(); throw new ApiException( sprintf( @@ -2287,7 +2387,11 @@ public function listRegistrationLogsRequest(string $contentType = self::contentT } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + try { + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + } catch (\JsonException $e) { + throw new \InvalidArgumentException('json_encode error: ' . $e->getMessage(), 0, $e); + } } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -2362,13 +2466,14 @@ public function listVirusFilesWithHttpInfo($page = null, $per_page = null, $has_ try { $response = $this->client->send($request, $options); } catch (RequestException $e) { + $eResponse = $this->getExceptionResponse($e); throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), - $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? (string) $e->getResponse()->getBody() : null + $eResponse ? $eResponse->getHeaders() : null, + $eResponse ? (string) $eResponse->getBody() : null ); - } catch (ConnectException $e) { + } catch (NetworkExceptionInterface $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), @@ -2438,7 +2543,15 @@ function ($response) use ($returnType) { return [null, $response->getStatusCode(), $response->getHeaders()]; }, function ($exception) { - $response = $exception->getResponse(); + $response = $this->getExceptionResponse($exception); + if ($response === null) { + throw new ApiException( + "[{$exception->getCode()}] {$exception->getMessage()}", + (int) $exception->getCode(), + null, + null + ); + } $statusCode = $response->getStatusCode(); throw new ApiException( sprintf( @@ -2540,7 +2653,11 @@ public function listVirusFilesRequest($page = null, $per_page = null, $has_handl } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + try { + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + } catch (\JsonException $e) { + throw new \InvalidArgumentException('json_encode error: ' . $e->getMessage(), 0, $e); + } } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -2614,13 +2731,14 @@ public function updateAbuseReportWithHttpInfo($abuse_report_id, $update_abuse_re try { $response = $this->client->send($request, $options); } catch (RequestException $e) { + $eResponse = $this->getExceptionResponse($e); throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), - $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? (string) $e->getResponse()->getBody() : null + $eResponse ? $eResponse->getHeaders() : null, + $eResponse ? (string) $eResponse->getBody() : null ); - } catch (ConnectException $e) { + } catch (NetworkExceptionInterface $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), @@ -2737,7 +2855,15 @@ function ($response) use ($returnType) { ]; }, function ($exception) { - $response = $exception->getResponse(); + $response = $this->getExceptionResponse($exception); + if ($response === null) { + throw new ApiException( + "[{$exception->getCode()}] {$exception->getMessage()}", + (int) $exception->getCode(), + null, + null + ); + } $statusCode = $response->getStatusCode(); throw new ApiException( sprintf( @@ -2790,7 +2916,7 @@ public function updateAbuseReportRequest($abuse_report_id, $update_abuse_report_ // path params if ($abuse_report_id !== null) { $resourcePath = str_replace( - '{' . 'abuse_report_id' . '}', + '{abuse_report_id}', ObjectSerializer::toPathValue($abuse_report_id), $resourcePath ); @@ -2807,7 +2933,11 @@ public function updateAbuseReportRequest($abuse_report_id, $update_abuse_report_ if (isset($update_abuse_report_request)) { if (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the body - $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($update_abuse_report_request)); + try { + $httpBody = json_encode(ObjectSerializer::sanitizeForSerialization($update_abuse_report_request), JSON_THROW_ON_ERROR); + } catch (\JsonException $e) { + throw new \InvalidArgumentException('json_encode error: ' . $e->getMessage(), 0, $e); + } } else { $httpBody = $update_abuse_report_request; } @@ -2828,7 +2958,11 @@ public function updateAbuseReportRequest($abuse_report_id, $update_abuse_report_ } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + try { + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + } catch (\JsonException $e) { + throw new \InvalidArgumentException('json_encode error: ' . $e->getMessage(), 0, $e); + } } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -2901,13 +3035,14 @@ public function updateVirusFileWithHttpInfo($virus_id, $ignore, string $contentT try { $response = $this->client->send($request, $options); } catch (RequestException $e) { + $eResponse = $this->getExceptionResponse($e); throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), - $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? (string) $e->getResponse()->getBody() : null + $eResponse ? $eResponse->getHeaders() : null, + $eResponse ? (string) $eResponse->getBody() : null ); - } catch (ConnectException $e) { + } catch (NetworkExceptionInterface $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), @@ -2975,7 +3110,15 @@ function ($response) use ($returnType) { return [null, $response->getStatusCode(), $response->getHeaders()]; }, function ($exception) { - $response = $exception->getResponse(); + $response = $this->getExceptionResponse($exception); + if ($response === null) { + throw new ApiException( + "[{$exception->getCode()}] {$exception->getMessage()}", + (int) $exception->getCode(), + null, + null + ); + } $statusCode = $response->getStatusCode(); throw new ApiException( sprintf( @@ -3031,7 +3174,7 @@ public function updateVirusFileRequest($virus_id, $ignore, string $contentType = // path params if ($virus_id !== null) { $resourcePath = str_replace( - '{' . 'virus_id' . '}', + '{virus_id}', ObjectSerializer::toPathValue($virus_id), $resourcePath ); @@ -3071,7 +3214,11 @@ public function updateVirusFileRequest($virus_id, $ignore, string $contentType = } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + try { + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + } catch (\JsonException $e) { + throw new \InvalidArgumentException('json_encode error: ' . $e->getMessage(), 0, $e); + } } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -3131,6 +3278,21 @@ protected function createHttpClientOption() return $options; } + /** + * Returns the response attached to a Guzzle exception, if there is one. + * + * Guzzle 7 exposes getResponse() on RequestException, while Guzzle 8 only + * exposes it on ResponseException and its subclasses. + * + * @param \Throwable $exception + * + * @return ResponseInterface|null + */ + private function getExceptionResponse(\Throwable $exception): ?ResponseInterface + { + return method_exists($exception, 'getResponse') ? $exception->getResponse() : null; + } + private function handleResponseWithDataType( string $dataType, RequestInterface $request, diff --git a/lib/SysAdmin/MaintenanceApi.php b/lib/SysAdmin/MaintenanceApi.php index 9a904194..f029ca3b 100644 --- a/lib/SysAdmin/MaintenanceApi.php +++ b/lib/SysAdmin/MaintenanceApi.php @@ -28,11 +28,11 @@ use GuzzleHttp\Client; use GuzzleHttp\ClientInterface; -use GuzzleHttp\Exception\ConnectException; use GuzzleHttp\Exception\RequestException; use GuzzleHttp\Psr7\MultipartStream; use GuzzleHttp\Psr7\Request; use GuzzleHttp\RequestOptions; +use Psr\Http\Client\NetworkExceptionInterface; use Psr\Http\Message\RequestInterface; use Psr\Http\Message\ResponseInterface; use SeaTable\Client\ApiException; @@ -163,13 +163,14 @@ public function repairBaseWithHttpInfo($base_uuid, string $contentType = self::c try { $response = $this->client->send($request, $options); } catch (RequestException $e) { + $eResponse = $this->getExceptionResponse($e); throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), - $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? (string) $e->getResponse()->getBody() : null + $eResponse ? $eResponse->getHeaders() : null, + $eResponse ? (string) $eResponse->getBody() : null ); - } catch (ConnectException $e) { + } catch (NetworkExceptionInterface $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), @@ -284,7 +285,15 @@ function ($response) use ($returnType) { ]; }, function ($exception) { - $response = $exception->getResponse(); + $response = $this->getExceptionResponse($exception); + if ($response === null) { + throw new ApiException( + "[{$exception->getCode()}] {$exception->getMessage()}", + (int) $exception->getCode(), + null, + null + ); + } $statusCode = $response->getStatusCode(); throw new ApiException( sprintf( @@ -335,7 +344,7 @@ public function repairBaseRequest($base_uuid, string $contentType = self::conten // path params if ($base_uuid !== null) { $resourcePath = str_replace( - '{' . 'base_uuid' . '}', + '{base_uuid}', ObjectSerializer::toPathValue($base_uuid), $resourcePath ); @@ -366,7 +375,11 @@ public function repairBaseRequest($base_uuid, string $contentType = self::conten } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + try { + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + } catch (\JsonException $e) { + throw new \InvalidArgumentException('json_encode error: ' . $e->getMessage(), 0, $e); + } } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -426,6 +439,21 @@ protected function createHttpClientOption() return $options; } + /** + * Returns the response attached to a Guzzle exception, if there is one. + * + * Guzzle 7 exposes getResponse() on RequestException, while Guzzle 8 only + * exposes it on ResponseException and its subclasses. + * + * @param \Throwable $exception + * + * @return ResponseInterface|null + */ + private function getExceptionResponse(\Throwable $exception): ?ResponseInterface + { + return method_exists($exception, 'getResponse') ? $exception->getResponse() : null; + } + private function handleResponseWithDataType( string $dataType, RequestInterface $request, diff --git a/lib/SysAdmin/NotificationsApi.php b/lib/SysAdmin/NotificationsApi.php index 2fae5c43..dc102e34 100644 --- a/lib/SysAdmin/NotificationsApi.php +++ b/lib/SysAdmin/NotificationsApi.php @@ -28,11 +28,11 @@ use GuzzleHttp\Client; use GuzzleHttp\ClientInterface; -use GuzzleHttp\Exception\ConnectException; use GuzzleHttp\Exception\RequestException; use GuzzleHttp\Psr7\MultipartStream; use GuzzleHttp\Psr7\Request; use GuzzleHttp\RequestOptions; +use Psr\Http\Client\NetworkExceptionInterface; use Psr\Http\Message\RequestInterface; use Psr\Http\Message\ResponseInterface; use SeaTable\Client\ApiException; @@ -170,13 +170,14 @@ public function deleteInvalidNotificationsWithHttpInfo(string $contentType = sel try { $response = $this->client->send($request, $options); } catch (RequestException $e) { + $eResponse = $this->getExceptionResponse($e); throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), - $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? (string) $e->getResponse()->getBody() : null + $eResponse ? $eResponse->getHeaders() : null, + $eResponse ? (string) $eResponse->getBody() : null ); - } catch (ConnectException $e) { + } catch (NetworkExceptionInterface $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), @@ -289,7 +290,15 @@ function ($response) use ($returnType) { ]; }, function ($exception) { - $response = $exception->getResponse(); + $response = $this->getExceptionResponse($exception); + if ($response === null) { + throw new ApiException( + "[{$exception->getCode()}] {$exception->getMessage()}", + (int) $exception->getCode(), + null, + null + ); + } $statusCode = $response->getStatusCode(); throw new ApiException( sprintf( @@ -352,7 +361,11 @@ public function deleteInvalidNotificationsRequest(string $contentType = self::co } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + try { + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + } catch (\JsonException $e) { + throw new \InvalidArgumentException('json_encode error: ' . $e->getMessage(), 0, $e); + } } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -424,13 +437,14 @@ public function deleteNotificationRuleWithHttpInfo($notification_rule_id, string try { $response = $this->client->send($request, $options); } catch (RequestException $e) { + $eResponse = $this->getExceptionResponse($e); throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), - $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? (string) $e->getResponse()->getBody() : null + $eResponse ? $eResponse->getHeaders() : null, + $eResponse ? (string) $eResponse->getBody() : null ); - } catch (ConnectException $e) { + } catch (NetworkExceptionInterface $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), @@ -545,7 +559,15 @@ function ($response) use ($returnType) { ]; }, function ($exception) { - $response = $exception->getResponse(); + $response = $this->getExceptionResponse($exception); + if ($response === null) { + throw new ApiException( + "[{$exception->getCode()}] {$exception->getMessage()}", + (int) $exception->getCode(), + null, + null + ); + } $statusCode = $response->getStatusCode(); throw new ApiException( sprintf( @@ -596,7 +618,7 @@ public function deleteNotificationRuleRequest($notification_rule_id, string $con // path params if ($notification_rule_id !== null) { $resourcePath = str_replace( - '{' . 'notification_rule_id' . '}', + '{notification_rule_id}', ObjectSerializer::toPathValue($notification_rule_id), $resourcePath ); @@ -627,7 +649,11 @@ public function deleteNotificationRuleRequest($notification_rule_id, string $con } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + try { + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + } catch (\JsonException $e) { + throw new \InvalidArgumentException('json_encode error: ' . $e->getMessage(), 0, $e); + } } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -701,13 +727,14 @@ public function listInvalidNotificationsWithHttpInfo($page = null, $per_page = n try { $response = $this->client->send($request, $options); } catch (RequestException $e) { + $eResponse = $this->getExceptionResponse($e); throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), - $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? (string) $e->getResponse()->getBody() : null + $eResponse ? $eResponse->getHeaders() : null, + $eResponse ? (string) $eResponse->getBody() : null ); - } catch (ConnectException $e) { + } catch (NetworkExceptionInterface $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), @@ -824,7 +851,15 @@ function ($response) use ($returnType) { ]; }, function ($exception) { - $response = $exception->getResponse(); + $response = $this->getExceptionResponse($exception); + if ($response === null) { + throw new ApiException( + "[{$exception->getCode()}] {$exception->getMessage()}", + (int) $exception->getCode(), + null, + null + ); + } $statusCode = $response->getStatusCode(); throw new ApiException( sprintf( @@ -915,7 +950,11 @@ public function listInvalidNotificationsRequest($page = null, $per_page = null, } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + try { + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + } catch (\JsonException $e) { + throw new \InvalidArgumentException('json_encode error: ' . $e->getMessage(), 0, $e); + } } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -989,13 +1028,14 @@ public function listNotificationRulesWithHttpInfo($page = null, $per_page = null try { $response = $this->client->send($request, $options); } catch (RequestException $e) { + $eResponse = $this->getExceptionResponse($e); throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), - $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? (string) $e->getResponse()->getBody() : null + $eResponse ? $eResponse->getHeaders() : null, + $eResponse ? (string) $eResponse->getBody() : null ); - } catch (ConnectException $e) { + } catch (NetworkExceptionInterface $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), @@ -1112,7 +1152,15 @@ function ($response) use ($returnType) { ]; }, function ($exception) { - $response = $exception->getResponse(); + $response = $this->getExceptionResponse($exception); + if ($response === null) { + throw new ApiException( + "[{$exception->getCode()}] {$exception->getMessage()}", + (int) $exception->getCode(), + null, + null + ); + } $statusCode = $response->getStatusCode(); throw new ApiException( sprintf( @@ -1203,7 +1251,11 @@ public function listNotificationRulesRequest($page = null, $per_page = null, str } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + try { + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + } catch (\JsonException $e) { + throw new \InvalidArgumentException('json_encode error: ' . $e->getMessage(), 0, $e); + } } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -1263,6 +1315,21 @@ protected function createHttpClientOption() return $options; } + /** + * Returns the response attached to a Guzzle exception, if there is one. + * + * Guzzle 7 exposes getResponse() on RequestException, while Guzzle 8 only + * exposes it on ResponseException and its subclasses. + * + * @param \Throwable $exception + * + * @return ResponseInterface|null + */ + private function getExceptionResponse(\Throwable $exception): ?ResponseInterface + { + return method_exists($exception, 'getResponse') ? $exception->getResponse() : null; + } + private function handleResponseWithDataType( string $dataType, RequestInterface $request, diff --git a/lib/SysAdmin/PluginsApi.php b/lib/SysAdmin/PluginsApi.php index 51138e6b..fb9fbc06 100644 --- a/lib/SysAdmin/PluginsApi.php +++ b/lib/SysAdmin/PluginsApi.php @@ -28,11 +28,11 @@ use GuzzleHttp\Client; use GuzzleHttp\ClientInterface; -use GuzzleHttp\Exception\ConnectException; use GuzzleHttp\Exception\RequestException; use GuzzleHttp\Psr7\MultipartStream; use GuzzleHttp\Psr7\Request; use GuzzleHttp\RequestOptions; +use Psr\Http\Client\NetworkExceptionInterface; use Psr\Http\Message\RequestInterface; use Psr\Http\Message\ResponseInterface; use SeaTable\Client\ApiException; @@ -175,13 +175,14 @@ public function addPluginWithHttpInfo($plugin, string $contentType = self::conte try { $response = $this->client->send($request, $options); } catch (RequestException $e) { + $eResponse = $this->getExceptionResponse($e); throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), - $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? (string) $e->getResponse()->getBody() : null + $eResponse ? $eResponse->getHeaders() : null, + $eResponse ? (string) $eResponse->getBody() : null ); - } catch (ConnectException $e) { + } catch (NetworkExceptionInterface $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), @@ -296,7 +297,15 @@ function ($response) use ($returnType) { ]; }, function ($exception) { - $response = $exception->getResponse(); + $response = $this->getExceptionResponse($exception); + if ($response === null) { + throw new ApiException( + "[{$exception->getCode()}] {$exception->getMessage()}", + (int) $exception->getCode(), + null, + null + ); + } $statusCode = $response->getStatusCode(); throw new ApiException( sprintf( @@ -377,7 +386,11 @@ public function addPluginRequest($plugin, string $contentType = self::contentTyp } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + try { + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + } catch (\JsonException $e) { + throw new \InvalidArgumentException('json_encode error: ' . $e->getMessage(), 0, $e); + } } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -449,13 +462,14 @@ public function deletePluginWithHttpInfo($plugin_id, string $contentType = self: try { $response = $this->client->send($request, $options); } catch (RequestException $e) { + $eResponse = $this->getExceptionResponse($e); throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), - $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? (string) $e->getResponse()->getBody() : null + $eResponse ? $eResponse->getHeaders() : null, + $eResponse ? (string) $eResponse->getBody() : null ); - } catch (ConnectException $e) { + } catch (NetworkExceptionInterface $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), @@ -570,7 +584,15 @@ function ($response) use ($returnType) { ]; }, function ($exception) { - $response = $exception->getResponse(); + $response = $this->getExceptionResponse($exception); + if ($response === null) { + throw new ApiException( + "[{$exception->getCode()}] {$exception->getMessage()}", + (int) $exception->getCode(), + null, + null + ); + } $statusCode = $response->getStatusCode(); throw new ApiException( sprintf( @@ -621,7 +643,7 @@ public function deletePluginRequest($plugin_id, string $contentType = self::cont // path params if ($plugin_id !== null) { $resourcePath = str_replace( - '{' . 'plugin_id' . '}', + '{plugin_id}', ObjectSerializer::toPathValue($plugin_id), $resourcePath ); @@ -652,7 +674,11 @@ public function deletePluginRequest($plugin_id, string $contentType = self::cont } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + try { + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + } catch (\JsonException $e) { + throw new \InvalidArgumentException('json_encode error: ' . $e->getMessage(), 0, $e); + } } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -722,13 +748,14 @@ public function listPluginsWithHttpInfo(string $contentType = self::contentTypes try { $response = $this->client->send($request, $options); } catch (RequestException $e) { + $eResponse = $this->getExceptionResponse($e); throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), - $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? (string) $e->getResponse()->getBody() : null + $eResponse ? $eResponse->getHeaders() : null, + $eResponse ? (string) $eResponse->getBody() : null ); - } catch (ConnectException $e) { + } catch (NetworkExceptionInterface $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), @@ -841,7 +868,15 @@ function ($response) use ($returnType) { ]; }, function ($exception) { - $response = $exception->getResponse(); + $response = $this->getExceptionResponse($exception); + if ($response === null) { + throw new ApiException( + "[{$exception->getCode()}] {$exception->getMessage()}", + (int) $exception->getCode(), + null, + null + ); + } $statusCode = $response->getStatusCode(); throw new ApiException( sprintf( @@ -904,7 +939,11 @@ public function listPluginsRequest(string $contentType = self::contentTypes['lis } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + try { + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + } catch (\JsonException $e) { + throw new \InvalidArgumentException('json_encode error: ' . $e->getMessage(), 0, $e); + } } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -973,13 +1012,14 @@ public function listPluginsInstallCountWithHttpInfo(string $contentType = self:: try { $response = $this->client->send($request, $options); } catch (RequestException $e) { + $eResponse = $this->getExceptionResponse($e); throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), - $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? (string) $e->getResponse()->getBody() : null + $eResponse ? $eResponse->getHeaders() : null, + $eResponse ? (string) $eResponse->getBody() : null ); - } catch (ConnectException $e) { + } catch (NetworkExceptionInterface $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), @@ -1043,7 +1083,15 @@ function ($response) use ($returnType) { return [null, $response->getStatusCode(), $response->getHeaders()]; }, function ($exception) { - $response = $exception->getResponse(); + $response = $this->getExceptionResponse($exception); + if ($response === null) { + throw new ApiException( + "[{$exception->getCode()}] {$exception->getMessage()}", + (int) $exception->getCode(), + null, + null + ); + } $statusCode = $response->getStatusCode(); throw new ApiException( sprintf( @@ -1106,7 +1154,11 @@ public function listPluginsInstallCountRequest(string $contentType = self::conte } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + try { + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + } catch (\JsonException $e) { + throw new \InvalidArgumentException('json_encode error: ' . $e->getMessage(), 0, $e); + } } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -1180,13 +1232,14 @@ public function updatePluginWithHttpInfo($plugin_id, $plugin = null, string $con try { $response = $this->client->send($request, $options); } catch (RequestException $e) { + $eResponse = $this->getExceptionResponse($e); throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), - $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? (string) $e->getResponse()->getBody() : null + $eResponse ? $eResponse->getHeaders() : null, + $eResponse ? (string) $eResponse->getBody() : null ); - } catch (ConnectException $e) { + } catch (NetworkExceptionInterface $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), @@ -1303,7 +1356,15 @@ function ($response) use ($returnType) { ]; }, function ($exception) { - $response = $exception->getResponse(); + $response = $this->getExceptionResponse($exception); + if ($response === null) { + throw new ApiException( + "[{$exception->getCode()}] {$exception->getMessage()}", + (int) $exception->getCode(), + null, + null + ); + } $statusCode = $response->getStatusCode(); throw new ApiException( sprintf( @@ -1356,7 +1417,7 @@ public function updatePluginRequest($plugin_id, $plugin = null, string $contentT // path params if ($plugin_id !== null) { $resourcePath = str_replace( - '{' . 'plugin_id' . '}', + '{plugin_id}', ObjectSerializer::toPathValue($plugin_id), $resourcePath ); @@ -1397,7 +1458,11 @@ public function updatePluginRequest($plugin_id, $plugin = null, string $contentT } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + try { + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + } catch (\JsonException $e) { + throw new \InvalidArgumentException('json_encode error: ' . $e->getMessage(), 0, $e); + } } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -1457,6 +1522,21 @@ protected function createHttpClientOption() return $options; } + /** + * Returns the response attached to a Guzzle exception, if there is one. + * + * Guzzle 7 exposes getResponse() on RequestException, while Guzzle 8 only + * exposes it on ResponseException and its subclasses. + * + * @param \Throwable $exception + * + * @return ResponseInterface|null + */ + private function getExceptionResponse(\Throwable $exception): ?ResponseInterface + { + return method_exists($exception, 'getResponse') ? $exception->getResponse() : null; + } + private function handleResponseWithDataType( string $dataType, RequestInterface $request, diff --git a/lib/SysAdmin/RepairBase200Response.php b/lib/SysAdmin/RepairBase200Response.php index e27323bb..608f8dd1 100644 --- a/lib/SysAdmin/RepairBase200Response.php +++ b/lib/SysAdmin/RepairBase200Response.php @@ -44,46 +44,46 @@ class RepairBase200Response implements ModelInterface, ArrayAccess, \JsonSeriali public const DISCRIMINATOR = null; /** - * The original name of the model. - * - * @var string - */ + * The original name of the model. + * + * @var string + */ protected static $openAPIModelName = 'repairBase_200_response'; /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ protected static $openAPITypes = [ 'success' => 'bool' ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - * @phpstan-var array - * @psalm-var array - */ + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ protected static $openAPIFormats = [ 'success' => null ]; /** - * Array of nullable properties. Used for (de)serialization - * - * @var boolean[] - */ + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ protected static array $openAPINullables = [ 'success' => false ]; /** - * If a nullable field gets set to null, insert it here - * - * @var boolean[] - */ + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ protected array $openAPINullablesSetToNull = []; /** @@ -247,14 +247,14 @@ public function __construct(?array $data = null) } /** - * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName - * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the - * $this->openAPINullablesSetToNull array - * - * @param string $variableName - * @param array $fields - * @param mixed $defaultValue - */ + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ private function setIfExists(string $variableName, array $fields, $defaultValue): void { if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { diff --git a/lib/SysAdmin/SearchTeam200Response.php b/lib/SysAdmin/SearchTeam200Response.php index d2f450f8..8e1802a0 100644 --- a/lib/SysAdmin/SearchTeam200Response.php +++ b/lib/SysAdmin/SearchTeam200Response.php @@ -44,17 +44,17 @@ class SearchTeam200Response implements ModelInterface, ArrayAccess, \JsonSeriali public const DISCRIMINATOR = null; /** - * The original name of the model. - * - * @var string - */ + * The original name of the model. + * + * @var string + */ protected static $openAPIModelName = 'searchTeam_200_response'; /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ protected static $openAPITypes = [ 'org_id' => 'int', 'org_name' => 'string', @@ -76,12 +76,12 @@ class SearchTeam200Response implements ModelInterface, ArrayAccess, \JsonSeriali ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - * @phpstan-var array - * @psalm-var array - */ + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ protected static $openAPIFormats = [ 'org_id' => null, 'org_name' => null, @@ -103,10 +103,10 @@ class SearchTeam200Response implements ModelInterface, ArrayAccess, \JsonSeriali ]; /** - * Array of nullable properties. Used for (de)serialization - * - * @var boolean[] - */ + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ protected static array $openAPINullables = [ 'org_id' => false, 'org_name' => false, @@ -128,10 +128,10 @@ class SearchTeam200Response implements ModelInterface, ArrayAccess, \JsonSeriali ]; /** - * If a nullable field gets set to null, insert it here - * - * @var boolean[] - */ + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ protected array $openAPINullablesSetToNull = []; /** @@ -359,14 +359,14 @@ public function __construct(?array $data = null) } /** - * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName - * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the - * $this->openAPINullablesSetToNull array - * - * @param string $variableName - * @param array $fields - * @param mixed $defaultValue - */ + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ private function setIfExists(string $variableName, array $fields, $defaultValue): void { if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { diff --git a/lib/SysAdmin/SharingLinksApi.php b/lib/SysAdmin/SharingLinksApi.php index 50520442..642274dd 100644 --- a/lib/SysAdmin/SharingLinksApi.php +++ b/lib/SysAdmin/SharingLinksApi.php @@ -28,11 +28,11 @@ use GuzzleHttp\Client; use GuzzleHttp\ClientInterface; -use GuzzleHttp\Exception\ConnectException; use GuzzleHttp\Exception\RequestException; use GuzzleHttp\Psr7\MultipartStream; use GuzzleHttp\Psr7\Request; use GuzzleHttp\RequestOptions; +use Psr\Http\Client\NetworkExceptionInterface; use Psr\Http\Message\RequestInterface; use Psr\Http\Message\ResponseInterface; use SeaTable\Client\ApiException; @@ -175,13 +175,14 @@ public function deleteBaseExternalLinkWithHttpInfo($external_link_token, string try { $response = $this->client->send($request, $options); } catch (RequestException $e) { + $eResponse = $this->getExceptionResponse($e); throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), - $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? (string) $e->getResponse()->getBody() : null + $eResponse ? $eResponse->getHeaders() : null, + $eResponse ? (string) $eResponse->getBody() : null ); - } catch (ConnectException $e) { + } catch (NetworkExceptionInterface $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), @@ -296,7 +297,15 @@ function ($response) use ($returnType) { ]; }, function ($exception) { - $response = $exception->getResponse(); + $response = $this->getExceptionResponse($exception); + if ($response === null) { + throw new ApiException( + "[{$exception->getCode()}] {$exception->getMessage()}", + (int) $exception->getCode(), + null, + null + ); + } $statusCode = $response->getStatusCode(); throw new ApiException( sprintf( @@ -344,7 +353,7 @@ public function deleteBaseExternalLinkRequest($external_link_token, string $cont // path params if ($external_link_token !== null) { $resourcePath = str_replace( - '{' . 'external_link_token' . '}', + '{external_link_token}', ObjectSerializer::toPathValue($external_link_token), $resourcePath ); @@ -375,7 +384,11 @@ public function deleteBaseExternalLinkRequest($external_link_token, string $cont } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + try { + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + } catch (\JsonException $e) { + throw new \InvalidArgumentException('json_encode error: ' . $e->getMessage(), 0, $e); + } } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -447,13 +460,14 @@ public function deleteViewExternalLinkWithHttpInfo($view_external_link_token, st try { $response = $this->client->send($request, $options); } catch (RequestException $e) { + $eResponse = $this->getExceptionResponse($e); throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), - $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? (string) $e->getResponse()->getBody() : null + $eResponse ? $eResponse->getHeaders() : null, + $eResponse ? (string) $eResponse->getBody() : null ); - } catch (ConnectException $e) { + } catch (NetworkExceptionInterface $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), @@ -568,7 +582,15 @@ function ($response) use ($returnType) { ]; }, function ($exception) { - $response = $exception->getResponse(); + $response = $this->getExceptionResponse($exception); + if ($response === null) { + throw new ApiException( + "[{$exception->getCode()}] {$exception->getMessage()}", + (int) $exception->getCode(), + null, + null + ); + } $statusCode = $response->getStatusCode(); throw new ApiException( sprintf( @@ -616,7 +638,7 @@ public function deleteViewExternalLinkRequest($view_external_link_token, string // path params if ($view_external_link_token !== null) { $resourcePath = str_replace( - '{' . 'view_external_link_token' . '}', + '{view_external_link_token}', ObjectSerializer::toPathValue($view_external_link_token), $resourcePath ); @@ -647,7 +669,11 @@ public function deleteViewExternalLinkRequest($view_external_link_token, string } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + try { + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + } catch (\JsonException $e) { + throw new \InvalidArgumentException('json_encode error: ' . $e->getMessage(), 0, $e); + } } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -719,13 +745,14 @@ public function listBaseExternalLinksWithHttpInfo($base_id, string $contentType try { $response = $this->client->send($request, $options); } catch (RequestException $e) { + $eResponse = $this->getExceptionResponse($e); throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), - $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? (string) $e->getResponse()->getBody() : null + $eResponse ? $eResponse->getHeaders() : null, + $eResponse ? (string) $eResponse->getBody() : null ); - } catch (ConnectException $e) { + } catch (NetworkExceptionInterface $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), @@ -840,7 +867,15 @@ function ($response) use ($returnType) { ]; }, function ($exception) { - $response = $exception->getResponse(); + $response = $this->getExceptionResponse($exception); + if ($response === null) { + throw new ApiException( + "[{$exception->getCode()}] {$exception->getMessage()}", + (int) $exception->getCode(), + null, + null + ); + } $statusCode = $response->getStatusCode(); throw new ApiException( sprintf( @@ -888,7 +923,7 @@ public function listBaseExternalLinksRequest($base_id, string $contentType = sel // path params if ($base_id !== null) { $resourcePath = str_replace( - '{' . 'base_id' . '}', + '{base_id}', ObjectSerializer::toPathValue($base_id), $resourcePath ); @@ -919,7 +954,11 @@ public function listBaseExternalLinksRequest($base_id, string $contentType = sel } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + try { + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + } catch (\JsonException $e) { + throw new \InvalidArgumentException('json_encode error: ' . $e->getMessage(), 0, $e); + } } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -993,13 +1032,14 @@ public function listExternalLinksWithHttpInfo($page = null, $per_page = null, st try { $response = $this->client->send($request, $options); } catch (RequestException $e) { + $eResponse = $this->getExceptionResponse($e); throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), - $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? (string) $e->getResponse()->getBody() : null + $eResponse ? $eResponse->getHeaders() : null, + $eResponse ? (string) $eResponse->getBody() : null ); - } catch (ConnectException $e) { + } catch (NetworkExceptionInterface $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), @@ -1116,7 +1156,15 @@ function ($response) use ($returnType) { ]; }, function ($exception) { - $response = $exception->getResponse(); + $response = $this->getExceptionResponse($exception); + if ($response === null) { + throw new ApiException( + "[{$exception->getCode()}] {$exception->getMessage()}", + (int) $exception->getCode(), + null, + null + ); + } $statusCode = $response->getStatusCode(); throw new ApiException( sprintf( @@ -1207,7 +1255,11 @@ public function listExternalLinksRequest($page = null, $per_page = null, string } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + try { + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + } catch (\JsonException $e) { + throw new \InvalidArgumentException('json_encode error: ' . $e->getMessage(), 0, $e); + } } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -1277,13 +1329,14 @@ public function listViewExternalLinksWithHttpInfo(string $contentType = self::co try { $response = $this->client->send($request, $options); } catch (RequestException $e) { + $eResponse = $this->getExceptionResponse($e); throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), - $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? (string) $e->getResponse()->getBody() : null + $eResponse ? $eResponse->getHeaders() : null, + $eResponse ? (string) $eResponse->getBody() : null ); - } catch (ConnectException $e) { + } catch (NetworkExceptionInterface $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), @@ -1396,7 +1449,15 @@ function ($response) use ($returnType) { ]; }, function ($exception) { - $response = $exception->getResponse(); + $response = $this->getExceptionResponse($exception); + if ($response === null) { + throw new ApiException( + "[{$exception->getCode()}] {$exception->getMessage()}", + (int) $exception->getCode(), + null, + null + ); + } $statusCode = $response->getStatusCode(); throw new ApiException( sprintf( @@ -1459,7 +1520,11 @@ public function listViewExternalLinksRequest(string $contentType = self::content } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + try { + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + } catch (\JsonException $e) { + throw new \InvalidArgumentException('json_encode error: ' . $e->getMessage(), 0, $e); + } } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -1519,6 +1584,21 @@ protected function createHttpClientOption() return $options; } + /** + * Returns the response attached to a Guzzle exception, if there is one. + * + * Guzzle 7 exposes getResponse() on RequestException, while Guzzle 8 only + * exposes it on ResponseException and its subclasses. + * + * @param \Throwable $exception + * + * @return ResponseInterface|null + */ + private function getExceptionResponse(\Throwable $exception): ?ResponseInterface + { + return method_exists($exception, 'getResponse') ? $exception->getResponse() : null; + } + private function handleResponseWithDataType( string $dataType, RequestInterface $request, diff --git a/lib/SysAdmin/StatisticsApi.php b/lib/SysAdmin/StatisticsApi.php index c10e1c9d..96900026 100644 --- a/lib/SysAdmin/StatisticsApi.php +++ b/lib/SysAdmin/StatisticsApi.php @@ -28,11 +28,11 @@ use GuzzleHttp\Client; use GuzzleHttp\ClientInterface; -use GuzzleHttp\Exception\ConnectException; use GuzzleHttp\Exception\RequestException; use GuzzleHttp\Psr7\MultipartStream; use GuzzleHttp\Psr7\Request; use GuzzleHttp\RequestOptions; +use Psr\Http\Client\NetworkExceptionInterface; use Psr\Http\Message\RequestInterface; use Psr\Http\Message\ResponseInterface; use SeaTable\Client\ApiException; @@ -183,13 +183,14 @@ public function getActiveUsersPerDayWithHttpInfo($start = null, $end = null, str try { $response = $this->client->send($request, $options); } catch (RequestException $e) { + $eResponse = $this->getExceptionResponse($e); throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), - $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? (string) $e->getResponse()->getBody() : null + $eResponse ? $eResponse->getHeaders() : null, + $eResponse ? (string) $eResponse->getBody() : null ); - } catch (ConnectException $e) { + } catch (NetworkExceptionInterface $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), @@ -306,7 +307,15 @@ function ($response) use ($returnType) { ]; }, function ($exception) { - $response = $exception->getResponse(); + $response = $this->getExceptionResponse($exception); + if ($response === null) { + throw new ApiException( + "[{$exception->getCode()}] {$exception->getMessage()}", + (int) $exception->getCode(), + null, + null + ); + } $statusCode = $response->getStatusCode(); throw new ApiException( sprintf( @@ -397,7 +406,11 @@ public function getActiveUsersPerDayRequest($start = null, $end = null, string $ } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + try { + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + } catch (\JsonException $e) { + throw new \InvalidArgumentException('json_encode error: ' . $e->getMessage(), 0, $e); + } } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -471,13 +484,14 @@ public function getAutomationRulesWithHttpInfo($is_user, $month = null, string $ try { $response = $this->client->send($request, $options); } catch (RequestException $e) { + $eResponse = $this->getExceptionResponse($e); throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), - $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? (string) $e->getResponse()->getBody() : null + $eResponse ? $eResponse->getHeaders() : null, + $eResponse ? (string) $eResponse->getBody() : null ); - } catch (ConnectException $e) { + } catch (NetworkExceptionInterface $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), @@ -594,7 +608,15 @@ function ($response) use ($returnType) { ]; }, function ($exception) { - $response = $exception->getResponse(); + $response = $this->getExceptionResponse($exception); + if ($response === null) { + throw new ApiException( + "[{$exception->getCode()}] {$exception->getMessage()}", + (int) $exception->getCode(), + null, + null + ); + } $statusCode = $response->getStatusCode(); throw new ApiException( sprintf( @@ -688,7 +710,11 @@ public function getAutomationRulesRequest($is_user, $month = null, string $conte } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + try { + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + } catch (\JsonException $e) { + throw new \InvalidArgumentException('json_encode error: ' . $e->getMessage(), 0, $e); + } } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -766,13 +792,14 @@ public function getExternalAppsWithHttpInfo($is_user, $month = null, $page = nul try { $response = $this->client->send($request, $options); } catch (RequestException $e) { + $eResponse = $this->getExceptionResponse($e); throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), - $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? (string) $e->getResponse()->getBody() : null + $eResponse ? $eResponse->getHeaders() : null, + $eResponse ? (string) $eResponse->getBody() : null ); - } catch (ConnectException $e) { + } catch (NetworkExceptionInterface $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), @@ -893,7 +920,15 @@ function ($response) use ($returnType) { ]; }, function ($exception) { - $response = $exception->getResponse(); + $response = $this->getExceptionResponse($exception); + if ($response === null) { + throw new ApiException( + "[{$exception->getCode()}] {$exception->getMessage()}", + (int) $exception->getCode(), + null, + null + ); + } $statusCode = $response->getStatusCode(); throw new ApiException( sprintf( @@ -1015,7 +1050,11 @@ public function getExternalAppsRequest($is_user, $month = null, $page = null, $p } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + try { + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + } catch (\JsonException $e) { + throw new \InvalidArgumentException('json_encode error: ' . $e->getMessage(), 0, $e); + } } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -1093,13 +1132,14 @@ public function getOwnerOrTeamAIStatisticsWithHttpInfo($group_by, $date, $page = try { $response = $this->client->send($request, $options); } catch (RequestException $e) { + $eResponse = $this->getExceptionResponse($e); throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), - $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? (string) $e->getResponse()->getBody() : null + $eResponse ? $eResponse->getHeaders() : null, + $eResponse ? (string) $eResponse->getBody() : null ); - } catch (ConnectException $e) { + } catch (NetworkExceptionInterface $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), @@ -1220,7 +1260,15 @@ function ($response) use ($returnType) { ]; }, function ($exception) { - $response = $exception->getResponse(); + $response = $this->getExceptionResponse($exception); + if ($response === null) { + throw new ApiException( + "[{$exception->getCode()}] {$exception->getMessage()}", + (int) $exception->getCode(), + null, + null + ); + } $statusCode = $response->getStatusCode(); throw new ApiException( sprintf( @@ -1345,7 +1393,11 @@ public function getOwnerOrTeamAIStatisticsRequest($group_by, $date, $page = null } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + try { + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + } catch (\JsonException $e) { + throw new \InvalidArgumentException('json_encode error: ' . $e->getMessage(), 0, $e); + } } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -1421,13 +1473,14 @@ public function getScriptRunningCountByUserWithHttpInfo($is_user, $owner = null, try { $response = $this->client->send($request, $options); } catch (RequestException $e) { + $eResponse = $this->getExceptionResponse($e); throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), - $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? (string) $e->getResponse()->getBody() : null + $eResponse ? $eResponse->getHeaders() : null, + $eResponse ? (string) $eResponse->getBody() : null ); - } catch (ConnectException $e) { + } catch (NetworkExceptionInterface $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), @@ -1546,7 +1599,15 @@ function ($response) use ($returnType) { ]; }, function ($exception) { - $response = $exception->getResponse(); + $response = $this->getExceptionResponse($exception); + if ($response === null) { + throw new ApiException( + "[{$exception->getCode()}] {$exception->getMessage()}", + (int) $exception->getCode(), + null, + null + ); + } $statusCode = $response->getStatusCode(); throw new ApiException( sprintf( @@ -1654,7 +1715,11 @@ public function getScriptRunningCountByUserRequest($is_user, $owner = null, $mon } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + try { + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + } catch (\JsonException $e) { + throw new \InvalidArgumentException('json_encode error: ' . $e->getMessage(), 0, $e); + } } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -1730,13 +1795,14 @@ public function listActiveUsersByDayWithHttpInfo($date = null, $page = null, $pe try { $response = $this->client->send($request, $options); } catch (RequestException $e) { + $eResponse = $this->getExceptionResponse($e); throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), - $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? (string) $e->getResponse()->getBody() : null + $eResponse ? $eResponse->getHeaders() : null, + $eResponse ? (string) $eResponse->getBody() : null ); - } catch (ConnectException $e) { + } catch (NetworkExceptionInterface $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), @@ -1855,7 +1921,15 @@ function ($response) use ($returnType) { ]; }, function ($exception) { - $response = $exception->getResponse(); + $response = $this->getExceptionResponse($exception); + if ($response === null) { + throw new ApiException( + "[{$exception->getCode()}] {$exception->getMessage()}", + (int) $exception->getCode(), + null, + null + ); + } $statusCode = $response->getStatusCode(); throw new ApiException( sprintf( @@ -1960,7 +2034,11 @@ public function listActiveUsersByDayRequest($date = null, $page = null, $per_pag } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + try { + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + } catch (\JsonException $e) { + throw new \InvalidArgumentException('json_encode error: ' . $e->getMessage(), 0, $e); + } } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -2034,13 +2112,14 @@ public function listScriptTasksWithHttpInfo($page = null, $per_page = null, stri try { $response = $this->client->send($request, $options); } catch (RequestException $e) { + $eResponse = $this->getExceptionResponse($e); throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), - $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? (string) $e->getResponse()->getBody() : null + $eResponse ? $eResponse->getHeaders() : null, + $eResponse ? (string) $eResponse->getBody() : null ); - } catch (ConnectException $e) { + } catch (NetworkExceptionInterface $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), @@ -2157,7 +2236,15 @@ function ($response) use ($returnType) { ]; }, function ($exception) { - $response = $exception->getResponse(); + $response = $this->getExceptionResponse($exception); + if ($response === null) { + throw new ApiException( + "[{$exception->getCode()}] {$exception->getMessage()}", + (int) $exception->getCode(), + null, + null + ); + } $statusCode = $response->getStatusCode(); throw new ApiException( sprintf( @@ -2248,7 +2335,11 @@ public function listScriptTasksRequest($page = null, $per_page = null, string $c } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + try { + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + } catch (\JsonException $e) { + throw new \InvalidArgumentException('json_encode error: ' . $e->getMessage(), 0, $e); + } } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -2308,6 +2399,21 @@ protected function createHttpClientOption() return $options; } + /** + * Returns the response attached to a Guzzle exception, if there is one. + * + * Guzzle 7 exposes getResponse() on RequestException, while Guzzle 8 only + * exposes it on ResponseException and its subclasses. + * + * @param \Throwable $exception + * + * @return ResponseInterface|null + */ + private function getExceptionResponse(\Throwable $exception): ?ResponseInterface + { + return method_exists($exception, 'getResponse') ? $exception->getResponse() : null; + } + private function handleResponseWithDataType( string $dataType, RequestInterface $request, diff --git a/lib/SysAdmin/SystemInfoCustomizingApi.php b/lib/SysAdmin/SystemInfoCustomizingApi.php index 6058822b..5b85d67b 100644 --- a/lib/SysAdmin/SystemInfoCustomizingApi.php +++ b/lib/SysAdmin/SystemInfoCustomizingApi.php @@ -28,11 +28,11 @@ use GuzzleHttp\Client; use GuzzleHttp\ClientInterface; -use GuzzleHttp\Exception\ConnectException; use GuzzleHttp\Exception\RequestException; use GuzzleHttp\Psr7\MultipartStream; use GuzzleHttp\Psr7\Request; use GuzzleHttp\RequestOptions; +use Psr\Http\Client\NetworkExceptionInterface; use Psr\Http\Message\RequestInterface; use Psr\Http\Message\ResponseInterface; use SeaTable\Client\ApiException; @@ -173,13 +173,14 @@ public function getSystemInformationWithHttpInfo(string $contentType = self::con try { $response = $this->client->send($request, $options); } catch (RequestException $e) { + $eResponse = $this->getExceptionResponse($e); throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), - $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? (string) $e->getResponse()->getBody() : null + $eResponse ? $eResponse->getHeaders() : null, + $eResponse ? (string) $eResponse->getBody() : null ); - } catch (ConnectException $e) { + } catch (NetworkExceptionInterface $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), @@ -292,7 +293,15 @@ function ($response) use ($returnType) { ]; }, function ($exception) { - $response = $exception->getResponse(); + $response = $this->getExceptionResponse($exception); + if ($response === null) { + throw new ApiException( + "[{$exception->getCode()}] {$exception->getMessage()}", + (int) $exception->getCode(), + null, + null + ); + } $statusCode = $response->getStatusCode(); throw new ApiException( sprintf( @@ -355,7 +364,11 @@ public function getSystemInformationRequest(string $contentType = self::contentT } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + try { + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + } catch (\JsonException $e) { + throw new \InvalidArgumentException('json_encode error: ' . $e->getMessage(), 0, $e); + } } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -429,13 +442,14 @@ public function updateFaviconWithHttpInfo($favicon, $with_notify = null, string try { $response = $this->client->send($request, $options); } catch (RequestException $e) { + $eResponse = $this->getExceptionResponse($e); throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), - $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? (string) $e->getResponse()->getBody() : null + $eResponse ? $eResponse->getHeaders() : null, + $eResponse ? (string) $eResponse->getBody() : null ); - } catch (ConnectException $e) { + } catch (NetworkExceptionInterface $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), @@ -552,7 +566,15 @@ function ($response) use ($returnType) { ]; }, function ($exception) { - $response = $exception->getResponse(); + $response = $this->getExceptionResponse($exception); + if ($response === null) { + throw new ApiException( + "[{$exception->getCode()}] {$exception->getMessage()}", + (int) $exception->getCode(), + null, + null + ); + } $statusCode = $response->getStatusCode(); throw new ApiException( sprintf( @@ -636,7 +658,11 @@ public function updateFaviconRequest($favicon, $with_notify = null, string $cont } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + try { + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + } catch (\JsonException $e) { + throw new \InvalidArgumentException('json_encode error: ' . $e->getMessage(), 0, $e); + } } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -708,13 +734,14 @@ public function updateGeneralSettingsWithHttpInfo($update_general_settings_reque try { $response = $this->client->send($request, $options); } catch (RequestException $e) { + $eResponse = $this->getExceptionResponse($e); throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), - $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? (string) $e->getResponse()->getBody() : null + $eResponse ? $eResponse->getHeaders() : null, + $eResponse ? (string) $eResponse->getBody() : null ); - } catch (ConnectException $e) { + } catch (NetworkExceptionInterface $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), @@ -829,7 +856,15 @@ function ($response) use ($returnType) { ]; }, function ($exception) { - $response = $exception->getResponse(); + $response = $this->getExceptionResponse($exception); + if ($response === null) { + throw new ApiException( + "[{$exception->getCode()}] {$exception->getMessage()}", + (int) $exception->getCode(), + null, + null + ); + } $statusCode = $response->getStatusCode(); throw new ApiException( sprintf( @@ -880,7 +915,11 @@ public function updateGeneralSettingsRequest($update_general_settings_request = if (isset($update_general_settings_request)) { if (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the body - $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($update_general_settings_request)); + try { + $httpBody = json_encode(ObjectSerializer::sanitizeForSerialization($update_general_settings_request), JSON_THROW_ON_ERROR); + } catch (\JsonException $e) { + throw new \InvalidArgumentException('json_encode error: ' . $e->getMessage(), 0, $e); + } } else { $httpBody = $update_general_settings_request; } @@ -901,7 +940,11 @@ public function updateGeneralSettingsRequest($update_general_settings_request = } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + try { + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + } catch (\JsonException $e) { + throw new \InvalidArgumentException('json_encode error: ' . $e->getMessage(), 0, $e); + } } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -973,13 +1016,14 @@ public function updateLoginBackgroundImageWithHttpInfo($login_bg_image, string $ try { $response = $this->client->send($request, $options); } catch (RequestException $e) { + $eResponse = $this->getExceptionResponse($e); throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), - $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? (string) $e->getResponse()->getBody() : null + $eResponse ? $eResponse->getHeaders() : null, + $eResponse ? (string) $eResponse->getBody() : null ); - } catch (ConnectException $e) { + } catch (NetworkExceptionInterface $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), @@ -1094,7 +1138,15 @@ function ($response) use ($returnType) { ]; }, function ($exception) { - $response = $exception->getResponse(); + $response = $this->getExceptionResponse($exception); + if ($response === null) { + throw new ApiException( + "[{$exception->getCode()}] {$exception->getMessage()}", + (int) $exception->getCode(), + null, + null + ); + } $statusCode = $response->getStatusCode(); throw new ApiException( sprintf( @@ -1175,7 +1227,11 @@ public function updateLoginBackgroundImageRequest($login_bg_image, string $conte } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + try { + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + } catch (\JsonException $e) { + throw new \InvalidArgumentException('json_encode error: ' . $e->getMessage(), 0, $e); + } } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -1247,13 +1303,14 @@ public function updateLogoWithHttpInfo($logo, string $contentType = self::conten try { $response = $this->client->send($request, $options); } catch (RequestException $e) { + $eResponse = $this->getExceptionResponse($e); throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), - $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? (string) $e->getResponse()->getBody() : null + $eResponse ? $eResponse->getHeaders() : null, + $eResponse ? (string) $eResponse->getBody() : null ); - } catch (ConnectException $e) { + } catch (NetworkExceptionInterface $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), @@ -1368,7 +1425,15 @@ function ($response) use ($returnType) { ]; }, function ($exception) { - $response = $exception->getResponse(); + $response = $this->getExceptionResponse($exception); + if ($response === null) { + throw new ApiException( + "[{$exception->getCode()}] {$exception->getMessage()}", + (int) $exception->getCode(), + null, + null + ); + } $statusCode = $response->getStatusCode(); throw new ApiException( sprintf( @@ -1449,7 +1514,11 @@ public function updateLogoRequest($logo, string $contentType = self::contentType } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + try { + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + } catch (\JsonException $e) { + throw new \InvalidArgumentException('json_encode error: ' . $e->getMessage(), 0, $e); + } } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -1509,6 +1578,21 @@ protected function createHttpClientOption() return $options; } + /** + * Returns the response attached to a Guzzle exception, if there is one. + * + * Guzzle 7 exposes getResponse() on RequestException, while Guzzle 8 only + * exposes it on ResponseException and its subclasses. + * + * @param \Throwable $exception + * + * @return ResponseInterface|null + */ + private function getExceptionResponse(\Throwable $exception): ?ResponseInterface + { + return method_exists($exception, 'getResponse') ? $exception->getResponse() : null; + } + private function handleResponseWithDataType( string $dataType, RequestInterface $request, diff --git a/lib/SysAdmin/SystemNotificationsApi.php b/lib/SysAdmin/SystemNotificationsApi.php index 5ffd191d..8e11ff2d 100644 --- a/lib/SysAdmin/SystemNotificationsApi.php +++ b/lib/SysAdmin/SystemNotificationsApi.php @@ -28,11 +28,11 @@ use GuzzleHttp\Client; use GuzzleHttp\ClientInterface; -use GuzzleHttp\Exception\ConnectException; use GuzzleHttp\Exception\RequestException; use GuzzleHttp\Psr7\MultipartStream; use GuzzleHttp\Psr7\Request; use GuzzleHttp\RequestOptions; +use Psr\Http\Client\NetworkExceptionInterface; use Psr\Http\Message\RequestInterface; use Psr\Http\Message\ResponseInterface; use SeaTable\Client\ApiException; @@ -169,13 +169,14 @@ public function addNotificationToUserWithHttpInfo($add_notification_to_user_requ try { $response = $this->client->send($request, $options); } catch (RequestException $e) { + $eResponse = $this->getExceptionResponse($e); throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), - $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? (string) $e->getResponse()->getBody() : null + $eResponse ? $eResponse->getHeaders() : null, + $eResponse ? (string) $eResponse->getBody() : null ); - } catch (ConnectException $e) { + } catch (NetworkExceptionInterface $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), @@ -290,7 +291,15 @@ function ($response) use ($returnType) { ]; }, function ($exception) { - $response = $exception->getResponse(); + $response = $this->getExceptionResponse($exception); + if ($response === null) { + throw new ApiException( + "[{$exception->getCode()}] {$exception->getMessage()}", + (int) $exception->getCode(), + null, + null + ); + } $statusCode = $response->getStatusCode(); throw new ApiException( sprintf( @@ -341,7 +350,11 @@ public function addNotificationToUserRequest($add_notification_to_user_request = if (isset($add_notification_to_user_request)) { if (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the body - $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($add_notification_to_user_request)); + try { + $httpBody = json_encode(ObjectSerializer::sanitizeForSerialization($add_notification_to_user_request), JSON_THROW_ON_ERROR); + } catch (\JsonException $e) { + throw new \InvalidArgumentException('json_encode error: ' . $e->getMessage(), 0, $e); + } } else { $httpBody = $add_notification_to_user_request; } @@ -362,7 +375,11 @@ public function addNotificationToUserRequest($add_notification_to_user_request = } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + try { + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + } catch (\JsonException $e) { + throw new \InvalidArgumentException('json_encode error: ' . $e->getMessage(), 0, $e); + } } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -434,13 +451,14 @@ public function deleteNotificationWithHttpInfo($sys_notification_id, string $con try { $response = $this->client->send($request, $options); } catch (RequestException $e) { + $eResponse = $this->getExceptionResponse($e); throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), - $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? (string) $e->getResponse()->getBody() : null + $eResponse ? $eResponse->getHeaders() : null, + $eResponse ? (string) $eResponse->getBody() : null ); - } catch (ConnectException $e) { + } catch (NetworkExceptionInterface $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), @@ -555,7 +573,15 @@ function ($response) use ($returnType) { ]; }, function ($exception) { - $response = $exception->getResponse(); + $response = $this->getExceptionResponse($exception); + if ($response === null) { + throw new ApiException( + "[{$exception->getCode()}] {$exception->getMessage()}", + (int) $exception->getCode(), + null, + null + ); + } $statusCode = $response->getStatusCode(); throw new ApiException( sprintf( @@ -603,7 +629,7 @@ public function deleteNotificationRequest($sys_notification_id, string $contentT // path params if ($sys_notification_id !== null) { $resourcePath = str_replace( - '{' . 'sys_notification_id' . '}', + '{sys_notification_id}', ObjectSerializer::toPathValue($sys_notification_id), $resourcePath ); @@ -634,7 +660,11 @@ public function deleteNotificationRequest($sys_notification_id, string $contentT } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + try { + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + } catch (\JsonException $e) { + throw new \InvalidArgumentException('json_encode error: ' . $e->getMessage(), 0, $e); + } } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -708,13 +738,14 @@ public function listNotificationsWithHttpInfo($page = null, $per_page = null, st try { $response = $this->client->send($request, $options); } catch (RequestException $e) { + $eResponse = $this->getExceptionResponse($e); throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), - $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? (string) $e->getResponse()->getBody() : null + $eResponse ? $eResponse->getHeaders() : null, + $eResponse ? (string) $eResponse->getBody() : null ); - } catch (ConnectException $e) { + } catch (NetworkExceptionInterface $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), @@ -831,7 +862,15 @@ function ($response) use ($returnType) { ]; }, function ($exception) { - $response = $exception->getResponse(); + $response = $this->getExceptionResponse($exception); + if ($response === null) { + throw new ApiException( + "[{$exception->getCode()}] {$exception->getMessage()}", + (int) $exception->getCode(), + null, + null + ); + } $statusCode = $response->getStatusCode(); throw new ApiException( sprintf( @@ -922,7 +961,11 @@ public function listNotificationsRequest($page = null, $per_page = null, string } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + try { + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + } catch (\JsonException $e) { + throw new \InvalidArgumentException('json_encode error: ' . $e->getMessage(), 0, $e); + } } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -982,6 +1025,21 @@ protected function createHttpClientOption() return $options; } + /** + * Returns the response attached to a Guzzle exception, if there is one. + * + * Guzzle 7 exposes getResponse() on RequestException, while Guzzle 8 only + * exposes it on ResponseException and its subclasses. + * + * @param \Throwable $exception + * + * @return ResponseInterface|null + */ + private function getExceptionResponse(\Throwable $exception): ?ResponseInterface + { + return method_exists($exception, 'getResponse') ? $exception->getResponse() : null; + } + private function handleResponseWithDataType( string $dataType, RequestInterface $request, diff --git a/lib/SysAdmin/TeamsApi.php b/lib/SysAdmin/TeamsApi.php index 012b2de0..356f9939 100644 --- a/lib/SysAdmin/TeamsApi.php +++ b/lib/SysAdmin/TeamsApi.php @@ -28,11 +28,11 @@ use GuzzleHttp\Client; use GuzzleHttp\ClientInterface; -use GuzzleHttp\Exception\ConnectException; use GuzzleHttp\Exception\RequestException; use GuzzleHttp\Psr7\MultipartStream; use GuzzleHttp\Psr7\Request; use GuzzleHttp\RequestOptions; +use Psr\Http\Client\NetworkExceptionInterface; use Psr\Http\Message\RequestInterface; use Psr\Http\Message\ResponseInterface; use SeaTable\Client\ApiException; @@ -199,13 +199,14 @@ public function addTeamWithHttpInfo($add_team_request = null, string $contentTyp try { $response = $this->client->send($request, $options); } catch (RequestException $e) { + $eResponse = $this->getExceptionResponse($e); throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), - $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? (string) $e->getResponse()->getBody() : null + $eResponse ? $eResponse->getHeaders() : null, + $eResponse ? (string) $eResponse->getBody() : null ); - } catch (ConnectException $e) { + } catch (NetworkExceptionInterface $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), @@ -320,7 +321,15 @@ function ($response) use ($returnType) { ]; }, function ($exception) { - $response = $exception->getResponse(); + $response = $this->getExceptionResponse($exception); + if ($response === null) { + throw new ApiException( + "[{$exception->getCode()}] {$exception->getMessage()}", + (int) $exception->getCode(), + null, + null + ); + } $statusCode = $response->getStatusCode(); throw new ApiException( sprintf( @@ -371,7 +380,11 @@ public function addTeamRequest($add_team_request = null, string $contentType = s if (isset($add_team_request)) { if (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the body - $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($add_team_request)); + try { + $httpBody = json_encode(ObjectSerializer::sanitizeForSerialization($add_team_request), JSON_THROW_ON_ERROR); + } catch (\JsonException $e) { + throw new \InvalidArgumentException('json_encode error: ' . $e->getMessage(), 0, $e); + } } else { $httpBody = $add_team_request; } @@ -392,7 +405,11 @@ public function addTeamRequest($add_team_request = null, string $contentType = s } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + try { + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + } catch (\JsonException $e) { + throw new \InvalidArgumentException('json_encode error: ' . $e->getMessage(), 0, $e); + } } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -472,13 +489,14 @@ public function addTeamUserWithHttpInfo($org_id, $email, $password, $name = null try { $response = $this->client->send($request, $options); } catch (RequestException $e) { + $eResponse = $this->getExceptionResponse($e); throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), - $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? (string) $e->getResponse()->getBody() : null + $eResponse ? $eResponse->getHeaders() : null, + $eResponse ? (string) $eResponse->getBody() : null ); - } catch (ConnectException $e) { + } catch (NetworkExceptionInterface $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), @@ -601,7 +619,15 @@ function ($response) use ($returnType) { ]; }, function ($exception) { - $response = $exception->getResponse(); + $response = $this->getExceptionResponse($exception); + if ($response === null) { + throw new ApiException( + "[{$exception->getCode()}] {$exception->getMessage()}", + (int) $exception->getCode(), + null, + null + ); + } $statusCode = $response->getStatusCode(); throw new ApiException( sprintf( @@ -672,7 +698,7 @@ public function addTeamUserRequest($org_id, $email, $password, $name = null, $wi // path params if ($org_id !== null) { $resourcePath = str_replace( - '{' . 'org_id' . '}', + '{org_id}', ObjectSerializer::toPathValue($org_id), $resourcePath ); @@ -716,7 +742,11 @@ public function addTeamUserRequest($org_id, $email, $password, $name = null, $wi } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + try { + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + } catch (\JsonException $e) { + throw new \InvalidArgumentException('json_encode error: ' . $e->getMessage(), 0, $e); + } } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -788,13 +818,14 @@ public function deleteTeamWithHttpInfo($org_id, string $contentType = self::cont try { $response = $this->client->send($request, $options); } catch (RequestException $e) { + $eResponse = $this->getExceptionResponse($e); throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), - $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? (string) $e->getResponse()->getBody() : null + $eResponse ? $eResponse->getHeaders() : null, + $eResponse ? (string) $eResponse->getBody() : null ); - } catch (ConnectException $e) { + } catch (NetworkExceptionInterface $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), @@ -909,7 +940,15 @@ function ($response) use ($returnType) { ]; }, function ($exception) { - $response = $exception->getResponse(); + $response = $this->getExceptionResponse($exception); + if ($response === null) { + throw new ApiException( + "[{$exception->getCode()}] {$exception->getMessage()}", + (int) $exception->getCode(), + null, + null + ); + } $statusCode = $response->getStatusCode(); throw new ApiException( sprintf( @@ -960,7 +999,7 @@ public function deleteTeamRequest($org_id, string $contentType = self::contentTy // path params if ($org_id !== null) { $resourcePath = str_replace( - '{' . 'org_id' . '}', + '{org_id}', ObjectSerializer::toPathValue($org_id), $resourcePath ); @@ -991,7 +1030,11 @@ public function deleteTeamRequest($org_id, string $contentType = self::contentTy } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + try { + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + } catch (\JsonException $e) { + throw new \InvalidArgumentException('json_encode error: ' . $e->getMessage(), 0, $e); + } } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -1065,13 +1108,14 @@ public function deleteTeamGroupWithHttpInfo($org_id, $group_id, string $contentT try { $response = $this->client->send($request, $options); } catch (RequestException $e) { + $eResponse = $this->getExceptionResponse($e); throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), - $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? (string) $e->getResponse()->getBody() : null + $eResponse ? $eResponse->getHeaders() : null, + $eResponse ? (string) $eResponse->getBody() : null ); - } catch (ConnectException $e) { + } catch (NetworkExceptionInterface $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), @@ -1188,7 +1232,15 @@ function ($response) use ($returnType) { ]; }, function ($exception) { - $response = $exception->getResponse(); + $response = $this->getExceptionResponse($exception); + if ($response === null) { + throw new ApiException( + "[{$exception->getCode()}] {$exception->getMessage()}", + (int) $exception->getCode(), + null, + null + ); + } $statusCode = $response->getStatusCode(); throw new ApiException( sprintf( @@ -1250,7 +1302,7 @@ public function deleteTeamGroupRequest($org_id, $group_id, string $contentType = // path params if ($org_id !== null) { $resourcePath = str_replace( - '{' . 'org_id' . '}', + '{org_id}', ObjectSerializer::toPathValue($org_id), $resourcePath ); @@ -1258,7 +1310,7 @@ public function deleteTeamGroupRequest($org_id, $group_id, string $contentType = // path params if ($group_id !== null) { $resourcePath = str_replace( - '{' . 'group_id' . '}', + '{group_id}', ObjectSerializer::toPathValue($group_id), $resourcePath ); @@ -1289,7 +1341,11 @@ public function deleteTeamGroupRequest($org_id, $group_id, string $contentType = } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + try { + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + } catch (\JsonException $e) { + throw new \InvalidArgumentException('json_encode error: ' . $e->getMessage(), 0, $e); + } } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -1363,13 +1419,14 @@ public function deleteTeamUserWithHttpInfo($org_id, $user_id, string $contentTyp try { $response = $this->client->send($request, $options); } catch (RequestException $e) { + $eResponse = $this->getExceptionResponse($e); throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), - $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? (string) $e->getResponse()->getBody() : null + $eResponse ? $eResponse->getHeaders() : null, + $eResponse ? (string) $eResponse->getBody() : null ); - } catch (ConnectException $e) { + } catch (NetworkExceptionInterface $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), @@ -1486,7 +1543,15 @@ function ($response) use ($returnType) { ]; }, function ($exception) { - $response = $exception->getResponse(); + $response = $this->getExceptionResponse($exception); + if ($response === null) { + throw new ApiException( + "[{$exception->getCode()}] {$exception->getMessage()}", + (int) $exception->getCode(), + null, + null + ); + } $statusCode = $response->getStatusCode(); throw new ApiException( sprintf( @@ -1548,7 +1613,7 @@ public function deleteTeamUserRequest($org_id, $user_id, string $contentType = s // path params if ($org_id !== null) { $resourcePath = str_replace( - '{' . 'org_id' . '}', + '{org_id}', ObjectSerializer::toPathValue($org_id), $resourcePath ); @@ -1556,7 +1621,7 @@ public function deleteTeamUserRequest($org_id, $user_id, string $contentType = s // path params if ($user_id !== null) { $resourcePath = str_replace( - '{' . 'user_id' . '}', + '{user_id}', ObjectSerializer::toPathValue($user_id), $resourcePath ); @@ -1587,7 +1652,11 @@ public function deleteTeamUserRequest($org_id, $user_id, string $contentType = s } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + try { + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + } catch (\JsonException $e) { + throw new \InvalidArgumentException('json_encode error: ' . $e->getMessage(), 0, $e); + } } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -1659,13 +1728,14 @@ public function getOrganizationNamesWithHttpInfo($org_ids = null, string $conten try { $response = $this->client->send($request, $options); } catch (RequestException $e) { + $eResponse = $this->getExceptionResponse($e); throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), - $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? (string) $e->getResponse()->getBody() : null + $eResponse ? $eResponse->getHeaders() : null, + $eResponse ? (string) $eResponse->getBody() : null ); - } catch (ConnectException $e) { + } catch (NetworkExceptionInterface $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), @@ -1780,7 +1850,15 @@ function ($response) use ($returnType) { ]; }, function ($exception) { - $response = $exception->getResponse(); + $response = $this->getExceptionResponse($exception); + if ($response === null) { + throw new ApiException( + "[{$exception->getCode()}] {$exception->getMessage()}", + (int) $exception->getCode(), + null, + null + ); + } $statusCode = $response->getStatusCode(); throw new ApiException( sprintf( @@ -1854,7 +1932,11 @@ public function getOrganizationNamesRequest($org_ids = null, string $contentType } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + try { + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + } catch (\JsonException $e) { + throw new \InvalidArgumentException('json_encode error: ' . $e->getMessage(), 0, $e); + } } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -1930,13 +2012,14 @@ public function listTeamBasesWithHttpInfo($org_id, $page = null, $per_page = nul try { $response = $this->client->send($request, $options); } catch (RequestException $e) { + $eResponse = $this->getExceptionResponse($e); throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), - $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? (string) $e->getResponse()->getBody() : null + $eResponse ? $eResponse->getHeaders() : null, + $eResponse ? (string) $eResponse->getBody() : null ); - } catch (ConnectException $e) { + } catch (NetworkExceptionInterface $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), @@ -2055,7 +2138,15 @@ function ($response) use ($returnType) { ]; }, function ($exception) { - $response = $exception->getResponse(); + $response = $this->getExceptionResponse($exception); + if ($response === null) { + throw new ApiException( + "[{$exception->getCode()}] {$exception->getMessage()}", + (int) $exception->getCode(), + null, + null + ); + } $statusCode = $response->getStatusCode(); throw new ApiException( sprintf( @@ -2134,7 +2225,7 @@ public function listTeamBasesRequest($org_id, $page = null, $per_page = null, st // path params if ($org_id !== null) { $resourcePath = str_replace( - '{' . 'org_id' . '}', + '{org_id}', ObjectSerializer::toPathValue($org_id), $resourcePath ); @@ -2165,7 +2256,11 @@ public function listTeamBasesRequest($org_id, $page = null, $per_page = null, st } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + try { + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + } catch (\JsonException $e) { + throw new \InvalidArgumentException('json_encode error: ' . $e->getMessage(), 0, $e); + } } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -2237,13 +2332,14 @@ public function listTeamGroupsWithHttpInfo($org_id, string $contentType = self:: try { $response = $this->client->send($request, $options); } catch (RequestException $e) { + $eResponse = $this->getExceptionResponse($e); throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), - $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? (string) $e->getResponse()->getBody() : null + $eResponse ? $eResponse->getHeaders() : null, + $eResponse ? (string) $eResponse->getBody() : null ); - } catch (ConnectException $e) { + } catch (NetworkExceptionInterface $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), @@ -2358,7 +2454,15 @@ function ($response) use ($returnType) { ]; }, function ($exception) { - $response = $exception->getResponse(); + $response = $this->getExceptionResponse($exception); + if ($response === null) { + throw new ApiException( + "[{$exception->getCode()}] {$exception->getMessage()}", + (int) $exception->getCode(), + null, + null + ); + } $statusCode = $response->getStatusCode(); throw new ApiException( sprintf( @@ -2409,7 +2513,7 @@ public function listTeamGroupsRequest($org_id, string $contentType = self::conte // path params if ($org_id !== null) { $resourcePath = str_replace( - '{' . 'org_id' . '}', + '{org_id}', ObjectSerializer::toPathValue($org_id), $resourcePath ); @@ -2440,7 +2544,11 @@ public function listTeamGroupsRequest($org_id, string $contentType = self::conte } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + try { + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + } catch (\JsonException $e) { + throw new \InvalidArgumentException('json_encode error: ' . $e->getMessage(), 0, $e); + } } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -2512,13 +2620,14 @@ public function listTeamUsersWithHttpInfo($org_id, string $contentType = self::c try { $response = $this->client->send($request, $options); } catch (RequestException $e) { + $eResponse = $this->getExceptionResponse($e); throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), - $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? (string) $e->getResponse()->getBody() : null + $eResponse ? $eResponse->getHeaders() : null, + $eResponse ? (string) $eResponse->getBody() : null ); - } catch (ConnectException $e) { + } catch (NetworkExceptionInterface $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), @@ -2633,7 +2742,15 @@ function ($response) use ($returnType) { ]; }, function ($exception) { - $response = $exception->getResponse(); + $response = $this->getExceptionResponse($exception); + if ($response === null) { + throw new ApiException( + "[{$exception->getCode()}] {$exception->getMessage()}", + (int) $exception->getCode(), + null, + null + ); + } $statusCode = $response->getStatusCode(); throw new ApiException( sprintf( @@ -2684,7 +2801,7 @@ public function listTeamUsersRequest($org_id, string $contentType = self::conten // path params if ($org_id !== null) { $resourcePath = str_replace( - '{' . 'org_id' . '}', + '{org_id}', ObjectSerializer::toPathValue($org_id), $resourcePath ); @@ -2715,7 +2832,11 @@ public function listTeamUsersRequest($org_id, string $contentType = self::conten } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + try { + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + } catch (\JsonException $e) { + throw new \InvalidArgumentException('json_encode error: ' . $e->getMessage(), 0, $e); + } } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -2791,13 +2912,14 @@ public function listTeamsWithHttpInfo($page = null, $per_page = null, $role = nu try { $response = $this->client->send($request, $options); } catch (RequestException $e) { + $eResponse = $this->getExceptionResponse($e); throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), - $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? (string) $e->getResponse()->getBody() : null + $eResponse ? $eResponse->getHeaders() : null, + $eResponse ? (string) $eResponse->getBody() : null ); - } catch (ConnectException $e) { + } catch (NetworkExceptionInterface $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), @@ -2916,7 +3038,15 @@ function ($response) use ($returnType) { ]; }, function ($exception) { - $response = $exception->getResponse(); + $response = $this->getExceptionResponse($exception); + if ($response === null) { + throw new ApiException( + "[{$exception->getCode()}] {$exception->getMessage()}", + (int) $exception->getCode(), + null, + null + ); + } $statusCode = $response->getStatusCode(); throw new ApiException( sprintf( @@ -3018,7 +3148,11 @@ public function listTeamsRequest($page = null, $per_page = null, $role = null, s } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + try { + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + } catch (\JsonException $e) { + throw new \InvalidArgumentException('json_encode error: ' . $e->getMessage(), 0, $e); + } } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -3090,13 +3224,14 @@ public function searchTeamWithHttpInfo($org_id, string $contentType = self::cont try { $response = $this->client->send($request, $options); } catch (RequestException $e) { + $eResponse = $this->getExceptionResponse($e); throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), - $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? (string) $e->getResponse()->getBody() : null + $eResponse ? $eResponse->getHeaders() : null, + $eResponse ? (string) $eResponse->getBody() : null ); - } catch (ConnectException $e) { + } catch (NetworkExceptionInterface $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), @@ -3211,7 +3346,15 @@ function ($response) use ($returnType) { ]; }, function ($exception) { - $response = $exception->getResponse(); + $response = $this->getExceptionResponse($exception); + if ($response === null) { + throw new ApiException( + "[{$exception->getCode()}] {$exception->getMessage()}", + (int) $exception->getCode(), + null, + null + ); + } $statusCode = $response->getStatusCode(); throw new ApiException( sprintf( @@ -3262,7 +3405,7 @@ public function searchTeamRequest($org_id, string $contentType = self::contentTy // path params if ($org_id !== null) { $resourcePath = str_replace( - '{' . 'org_id' . '}', + '{org_id}', ObjectSerializer::toPathValue($org_id), $resourcePath ); @@ -3293,7 +3436,11 @@ public function searchTeamRequest($org_id, string $contentType = self::contentTy } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + try { + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + } catch (\JsonException $e) { + throw new \InvalidArgumentException('json_encode error: ' . $e->getMessage(), 0, $e); + } } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -3367,13 +3514,14 @@ public function updateTeamWithHttpInfo($org_id, $update_team_request = null, str try { $response = $this->client->send($request, $options); } catch (RequestException $e) { + $eResponse = $this->getExceptionResponse($e); throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), - $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? (string) $e->getResponse()->getBody() : null + $eResponse ? $eResponse->getHeaders() : null, + $eResponse ? (string) $eResponse->getBody() : null ); - } catch (ConnectException $e) { + } catch (NetworkExceptionInterface $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), @@ -3490,7 +3638,15 @@ function ($response) use ($returnType) { ]; }, function ($exception) { - $response = $exception->getResponse(); + $response = $this->getExceptionResponse($exception); + if ($response === null) { + throw new ApiException( + "[{$exception->getCode()}] {$exception->getMessage()}", + (int) $exception->getCode(), + null, + null + ); + } $statusCode = $response->getStatusCode(); throw new ApiException( sprintf( @@ -3543,7 +3699,7 @@ public function updateTeamRequest($org_id, $update_team_request = null, string $ // path params if ($org_id !== null) { $resourcePath = str_replace( - '{' . 'org_id' . '}', + '{org_id}', ObjectSerializer::toPathValue($org_id), $resourcePath ); @@ -3560,7 +3716,11 @@ public function updateTeamRequest($org_id, $update_team_request = null, string $ if (isset($update_team_request)) { if (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the body - $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($update_team_request)); + try { + $httpBody = json_encode(ObjectSerializer::sanitizeForSerialization($update_team_request), JSON_THROW_ON_ERROR); + } catch (\JsonException $e) { + throw new \InvalidArgumentException('json_encode error: ' . $e->getMessage(), 0, $e); + } } else { $httpBody = $update_team_request; } @@ -3581,7 +3741,11 @@ public function updateTeamRequest($org_id, $update_team_request = null, string $ } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + try { + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + } catch (\JsonException $e) { + throw new \InvalidArgumentException('json_encode error: ' . $e->getMessage(), 0, $e); + } } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -3657,13 +3821,14 @@ public function updateTeamUserWithHttpInfo($org_id, $user_id, $update_team_user_ try { $response = $this->client->send($request, $options); } catch (RequestException $e) { + $eResponse = $this->getExceptionResponse($e); throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), - $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? (string) $e->getResponse()->getBody() : null + $eResponse ? $eResponse->getHeaders() : null, + $eResponse ? (string) $eResponse->getBody() : null ); - } catch (ConnectException $e) { + } catch (NetworkExceptionInterface $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), @@ -3782,7 +3947,15 @@ function ($response) use ($returnType) { ]; }, function ($exception) { - $response = $exception->getResponse(); + $response = $this->getExceptionResponse($exception); + if ($response === null) { + throw new ApiException( + "[{$exception->getCode()}] {$exception->getMessage()}", + (int) $exception->getCode(), + null, + null + ); + } $statusCode = $response->getStatusCode(); throw new ApiException( sprintf( @@ -3846,7 +4019,7 @@ public function updateTeamUserRequest($org_id, $user_id, $update_team_user_reque // path params if ($org_id !== null) { $resourcePath = str_replace( - '{' . 'org_id' . '}', + '{org_id}', ObjectSerializer::toPathValue($org_id), $resourcePath ); @@ -3854,7 +4027,7 @@ public function updateTeamUserRequest($org_id, $user_id, $update_team_user_reque // path params if ($user_id !== null) { $resourcePath = str_replace( - '{' . 'user_id' . '}', + '{user_id}', ObjectSerializer::toPathValue($user_id), $resourcePath ); @@ -3871,7 +4044,11 @@ public function updateTeamUserRequest($org_id, $user_id, $update_team_user_reque if (isset($update_team_user_request)) { if (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the body - $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($update_team_user_request)); + try { + $httpBody = json_encode(ObjectSerializer::sanitizeForSerialization($update_team_user_request), JSON_THROW_ON_ERROR); + } catch (\JsonException $e) { + throw new \InvalidArgumentException('json_encode error: ' . $e->getMessage(), 0, $e); + } } else { $httpBody = $update_team_user_request; } @@ -3892,7 +4069,11 @@ public function updateTeamUserRequest($org_id, $user_id, $update_team_user_reque } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + try { + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + } catch (\JsonException $e) { + throw new \InvalidArgumentException('json_encode error: ' . $e->getMessage(), 0, $e); + } } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -3952,6 +4133,21 @@ protected function createHttpClientOption() return $options; } + /** + * Returns the response attached to a Guzzle exception, if there is one. + * + * Guzzle 7 exposes getResponse() on RequestException, while Guzzle 8 only + * exposes it on ResponseException and its subclasses. + * + * @param \Throwable $exception + * + * @return ResponseInterface|null + */ + private function getExceptionResponse(\Throwable $exception): ?ResponseInterface + { + return method_exists($exception, 'getResponse') ? $exception->getResponse() : null; + } + private function handleResponseWithDataType( string $dataType, RequestInterface $request, diff --git a/lib/SysAdmin/TransferGroup200Response.php b/lib/SysAdmin/TransferGroup200Response.php index 2d163691..de75a54b 100644 --- a/lib/SysAdmin/TransferGroup200Response.php +++ b/lib/SysAdmin/TransferGroup200Response.php @@ -44,17 +44,17 @@ class TransferGroup200Response implements ModelInterface, ArrayAccess, \JsonSeri public const DISCRIMINATOR = null; /** - * The original name of the model. - * - * @var string - */ + * The original name of the model. + * + * @var string + */ protected static $openAPIModelName = 'transferGroup_200_response'; /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ protected static $openAPITypes = [ 'id' => 'int', 'parent_group_id' => 'int', @@ -66,12 +66,12 @@ class TransferGroup200Response implements ModelInterface, ArrayAccess, \JsonSeri ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - * @phpstan-var array - * @psalm-var array - */ + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ protected static $openAPIFormats = [ 'id' => null, 'parent_group_id' => null, @@ -83,10 +83,10 @@ class TransferGroup200Response implements ModelInterface, ArrayAccess, \JsonSeri ]; /** - * Array of nullable properties. Used for (de)serialization - * - * @var boolean[] - */ + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ protected static array $openAPINullables = [ 'id' => false, 'parent_group_id' => false, @@ -98,10 +98,10 @@ class TransferGroup200Response implements ModelInterface, ArrayAccess, \JsonSeri ]; /** - * If a nullable field gets set to null, insert it here - * - * @var boolean[] - */ + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ protected array $openAPINullablesSetToNull = []; /** @@ -289,14 +289,14 @@ public function __construct(?array $data = null) } /** - * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName - * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the - * $this->openAPINullablesSetToNull array - * - * @param string $variableName - * @param array $fields - * @param mixed $defaultValue - */ + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ private function setIfExists(string $variableName, array $fields, $defaultValue): void { if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { diff --git a/lib/SysAdmin/TransferGroupRequest.php b/lib/SysAdmin/TransferGroupRequest.php index c2cd6b47..b7632412 100644 --- a/lib/SysAdmin/TransferGroupRequest.php +++ b/lib/SysAdmin/TransferGroupRequest.php @@ -44,46 +44,46 @@ class TransferGroupRequest implements ModelInterface, ArrayAccess, \JsonSerializ public const DISCRIMINATOR = null; /** - * The original name of the model. - * - * @var string - */ + * The original name of the model. + * + * @var string + */ protected static $openAPIModelName = 'transferGroup_request'; /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ protected static $openAPITypes = [ 'new_owner' => 'string' ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - * @phpstan-var array - * @psalm-var array - */ + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ protected static $openAPIFormats = [ 'new_owner' => null ]; /** - * Array of nullable properties. Used for (de)serialization - * - * @var boolean[] - */ + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ protected static array $openAPINullables = [ 'new_owner' => false ]; /** - * If a nullable field gets set to null, insert it here - * - * @var boolean[] - */ + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ protected array $openAPINullablesSetToNull = []; /** @@ -247,14 +247,14 @@ public function __construct(?array $data = null) } /** - * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName - * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the - * $this->openAPINullablesSetToNull array - * - * @param string $variableName - * @param array $fields - * @param mixed $defaultValue - */ + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ private function setIfExists(string $variableName, array $fields, $defaultValue): void { if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { diff --git a/lib/SysAdmin/UpdateAbuseReport200Response.php b/lib/SysAdmin/UpdateAbuseReport200Response.php index 5142db6e..87d0d37d 100644 --- a/lib/SysAdmin/UpdateAbuseReport200Response.php +++ b/lib/SysAdmin/UpdateAbuseReport200Response.php @@ -44,17 +44,17 @@ class UpdateAbuseReport200Response implements ModelInterface, ArrayAccess, \Json public const DISCRIMINATOR = null; /** - * The original name of the model. - * - * @var string - */ + * The original name of the model. + * + * @var string + */ protected static $openAPIModelName = 'updateAbuseReport_200_response'; /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ protected static $openAPITypes = [ 'id' => 'int', 'dtable_uuid' => 'string', @@ -68,12 +68,12 @@ class UpdateAbuseReport200Response implements ModelInterface, ArrayAccess, \Json ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - * @phpstan-var array - * @psalm-var array - */ + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ protected static $openAPIFormats = [ 'id' => null, 'dtable_uuid' => null, @@ -87,10 +87,10 @@ class UpdateAbuseReport200Response implements ModelInterface, ArrayAccess, \Json ]; /** - * Array of nullable properties. Used for (de)serialization - * - * @var boolean[] - */ + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ protected static array $openAPINullables = [ 'id' => false, 'dtable_uuid' => false, @@ -104,10 +104,10 @@ class UpdateAbuseReport200Response implements ModelInterface, ArrayAccess, \Json ]; /** - * If a nullable field gets set to null, insert it here - * - * @var boolean[] - */ + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ protected array $openAPINullablesSetToNull = []; /** @@ -303,14 +303,14 @@ public function __construct(?array $data = null) } /** - * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName - * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the - * $this->openAPINullablesSetToNull array - * - * @param string $variableName - * @param array $fields - * @param mixed $defaultValue - */ + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ private function setIfExists(string $variableName, array $fields, $defaultValue): void { if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { diff --git a/lib/SysAdmin/UpdateAbuseReportRequest.php b/lib/SysAdmin/UpdateAbuseReportRequest.php index 0c383e55..1b6f745b 100644 --- a/lib/SysAdmin/UpdateAbuseReportRequest.php +++ b/lib/SysAdmin/UpdateAbuseReportRequest.php @@ -44,46 +44,46 @@ class UpdateAbuseReportRequest implements ModelInterface, ArrayAccess, \JsonSeri public const DISCRIMINATOR = null; /** - * The original name of the model. - * - * @var string - */ + * The original name of the model. + * + * @var string + */ protected static $openAPIModelName = 'updateAbuseReport_request'; /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ protected static $openAPITypes = [ 'handled' => 'bool' ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - * @phpstan-var array - * @psalm-var array - */ + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ protected static $openAPIFormats = [ 'handled' => null ]; /** - * Array of nullable properties. Used for (de)serialization - * - * @var boolean[] - */ + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ protected static array $openAPINullables = [ 'handled' => false ]; /** - * If a nullable field gets set to null, insert it here - * - * @var boolean[] - */ + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ protected array $openAPINullablesSetToNull = []; /** @@ -247,14 +247,14 @@ public function __construct(?array $data = null) } /** - * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName - * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the - * $this->openAPINullablesSetToNull array - * - * @param string $variableName - * @param array $fields - * @param mixed $defaultValue - */ + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ private function setIfExists(string $variableName, array $fields, $defaultValue): void { if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { diff --git a/lib/SysAdmin/UpdateAdminsRole.php b/lib/SysAdmin/UpdateAdminsRole.php index 482a6eeb..37dc68a6 100644 --- a/lib/SysAdmin/UpdateAdminsRole.php +++ b/lib/SysAdmin/UpdateAdminsRole.php @@ -44,49 +44,49 @@ class UpdateAdminsRole implements ModelInterface, ArrayAccess, \JsonSerializable public const DISCRIMINATOR = null; /** - * The original name of the model. - * - * @var string - */ + * The original name of the model. + * + * @var string + */ protected static $openAPIModelName = 'update_admins_role'; /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ protected static $openAPITypes = [ 'email' => 'string', 'role' => 'string' ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - * @phpstan-var array - * @psalm-var array - */ + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ protected static $openAPIFormats = [ 'email' => null, 'role' => null ]; /** - * Array of nullable properties. Used for (de)serialization - * - * @var boolean[] - */ + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ protected static array $openAPINullables = [ 'email' => false, 'role' => false ]; /** - * If a nullable field gets set to null, insert it here - * - * @var boolean[] - */ + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ protected array $openAPINullablesSetToNull = []; /** @@ -254,14 +254,14 @@ public function __construct(?array $data = null) } /** - * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName - * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the - * $this->openAPINullablesSetToNull array - * - * @param string $variableName - * @param array $fields - * @param mixed $defaultValue - */ + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ private function setIfExists(string $variableName, array $fields, $defaultValue): void { if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { diff --git a/lib/SysAdmin/UpdateDepartmentMember200Response.php b/lib/SysAdmin/UpdateDepartmentMember200Response.php index ef9169dc..a8bdd072 100644 --- a/lib/SysAdmin/UpdateDepartmentMember200Response.php +++ b/lib/SysAdmin/UpdateDepartmentMember200Response.php @@ -44,46 +44,46 @@ class UpdateDepartmentMember200Response implements ModelInterface, ArrayAccess, public const DISCRIMINATOR = null; /** - * The original name of the model. - * - * @var string - */ + * The original name of the model. + * + * @var string + */ protected static $openAPIModelName = 'updateDepartmentMember_200_response'; /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ protected static $openAPITypes = [ 'member' => '\SeaTable\Client\SysAdmin\UpdateDepartmentMember200ResponseMember' ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - * @phpstan-var array - * @psalm-var array - */ + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ protected static $openAPIFormats = [ 'member' => null ]; /** - * Array of nullable properties. Used for (de)serialization - * - * @var boolean[] - */ + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ protected static array $openAPINullables = [ 'member' => false ]; /** - * If a nullable field gets set to null, insert it here - * - * @var boolean[] - */ + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ protected array $openAPINullablesSetToNull = []; /** @@ -247,14 +247,14 @@ public function __construct(?array $data = null) } /** - * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName - * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the - * $this->openAPINullablesSetToNull array - * - * @param string $variableName - * @param array $fields - * @param mixed $defaultValue - */ + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ private function setIfExists(string $variableName, array $fields, $defaultValue): void { if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { diff --git a/lib/SysAdmin/UpdateDepartmentMember200ResponseMember.php b/lib/SysAdmin/UpdateDepartmentMember200ResponseMember.php index 4f6298a4..fabe79a0 100644 --- a/lib/SysAdmin/UpdateDepartmentMember200ResponseMember.php +++ b/lib/SysAdmin/UpdateDepartmentMember200ResponseMember.php @@ -44,17 +44,17 @@ class UpdateDepartmentMember200ResponseMember implements ModelInterface, ArrayAc public const DISCRIMINATOR = null; /** - * The original name of the model. - * - * @var string - */ + * The original name of the model. + * + * @var string + */ protected static $openAPIModelName = 'updateDepartmentMember_200_response_member'; /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ protected static $openAPITypes = [ 'email' => 'string', 'name' => 'string', @@ -64,12 +64,12 @@ class UpdateDepartmentMember200ResponseMember implements ModelInterface, ArrayAc ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - * @phpstan-var array - * @psalm-var array - */ + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ protected static $openAPIFormats = [ 'email' => null, 'name' => null, @@ -79,10 +79,10 @@ class UpdateDepartmentMember200ResponseMember implements ModelInterface, ArrayAc ]; /** - * Array of nullable properties. Used for (de)serialization - * - * @var boolean[] - */ + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ protected static array $openAPINullables = [ 'email' => false, 'name' => false, @@ -92,10 +92,10 @@ class UpdateDepartmentMember200ResponseMember implements ModelInterface, ArrayAc ]; /** - * If a nullable field gets set to null, insert it here - * - * @var boolean[] - */ + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ protected array $openAPINullablesSetToNull = []; /** @@ -275,14 +275,14 @@ public function __construct(?array $data = null) } /** - * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName - * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the - * $this->openAPINullablesSetToNull array - * - * @param string $variableName - * @param array $fields - * @param mixed $defaultValue - */ + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ private function setIfExists(string $variableName, array $fields, $defaultValue): void { if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { diff --git a/lib/SysAdmin/UpdateDepartmentMemberRequest.php b/lib/SysAdmin/UpdateDepartmentMemberRequest.php index 21bc4576..b024a881 100644 --- a/lib/SysAdmin/UpdateDepartmentMemberRequest.php +++ b/lib/SysAdmin/UpdateDepartmentMemberRequest.php @@ -44,46 +44,46 @@ class UpdateDepartmentMemberRequest implements ModelInterface, ArrayAccess, \Jso public const DISCRIMINATOR = null; /** - * The original name of the model. - * - * @var string - */ + * The original name of the model. + * + * @var string + */ protected static $openAPIModelName = 'updateDepartmentMember_request'; /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ protected static $openAPITypes = [ 'is_staff' => 'bool' ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - * @phpstan-var array - * @psalm-var array - */ + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ protected static $openAPIFormats = [ 'is_staff' => null ]; /** - * Array of nullable properties. Used for (de)serialization - * - * @var boolean[] - */ + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ protected static array $openAPINullables = [ 'is_staff' => false ]; /** - * If a nullable field gets set to null, insert it here - * - * @var boolean[] - */ + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ protected array $openAPINullablesSetToNull = []; /** @@ -247,14 +247,14 @@ public function __construct(?array $data = null) } /** - * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName - * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the - * $this->openAPINullablesSetToNull array - * - * @param string $variableName - * @param array $fields - * @param mixed $defaultValue - */ + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ private function setIfExists(string $variableName, array $fields, $defaultValue): void { if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { diff --git a/lib/SysAdmin/UpdateDepartmentRequest.php b/lib/SysAdmin/UpdateDepartmentRequest.php index 6174dc8f..8262c158 100644 --- a/lib/SysAdmin/UpdateDepartmentRequest.php +++ b/lib/SysAdmin/UpdateDepartmentRequest.php @@ -44,46 +44,46 @@ class UpdateDepartmentRequest implements ModelInterface, ArrayAccess, \JsonSeria public const DISCRIMINATOR = null; /** - * The original name of the model. - * - * @var string - */ + * The original name of the model. + * + * @var string + */ protected static $openAPIModelName = 'updateDepartment_request'; /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ protected static $openAPITypes = [ 'name' => 'string' ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - * @phpstan-var array - * @psalm-var array - */ + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ protected static $openAPIFormats = [ 'name' => null ]; /** - * Array of nullable properties. Used for (de)serialization - * - * @var boolean[] - */ + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ protected static array $openAPINullables = [ 'name' => false ]; /** - * If a nullable field gets set to null, insert it here - * - * @var boolean[] - */ + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ protected array $openAPINullablesSetToNull = []; /** @@ -247,14 +247,14 @@ public function __construct(?array $data = null) } /** - * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName - * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the - * $this->openAPINullablesSetToNull array - * - * @param string $variableName - * @param array $fields - * @param mixed $defaultValue - */ + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ private function setIfExists(string $variableName, array $fields, $defaultValue): void { if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { diff --git a/lib/SysAdmin/UpdateGeneralSettings200Response.php b/lib/SysAdmin/UpdateGeneralSettings200Response.php index 376ad283..9d84a384 100644 --- a/lib/SysAdmin/UpdateGeneralSettings200Response.php +++ b/lib/SysAdmin/UpdateGeneralSettings200Response.php @@ -44,17 +44,17 @@ class UpdateGeneralSettings200Response implements ModelInterface, ArrayAccess, \ public const DISCRIMINATOR = null; /** - * The original name of the model. - * - * @var string - */ + * The original name of the model. + * + * @var string + */ protected static $openAPIModelName = 'updateGeneralSettings_200_response'; /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ protected static $openAPITypes = [ 'enable_signup' => 'int', 'activate_after_registration' => 'int', @@ -74,12 +74,12 @@ class UpdateGeneralSettings200Response implements ModelInterface, ArrayAccess, \ ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - * @phpstan-var array - * @psalm-var array - */ + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ protected static $openAPIFormats = [ 'enable_signup' => null, 'activate_after_registration' => null, @@ -99,10 +99,10 @@ class UpdateGeneralSettings200Response implements ModelInterface, ArrayAccess, \ ]; /** - * Array of nullable properties. Used for (de)serialization - * - * @var boolean[] - */ + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ protected static array $openAPINullables = [ 'enable_signup' => false, 'activate_after_registration' => false, @@ -122,10 +122,10 @@ class UpdateGeneralSettings200Response implements ModelInterface, ArrayAccess, \ ]; /** - * If a nullable field gets set to null, insert it here - * - * @var boolean[] - */ + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ protected array $openAPINullablesSetToNull = []; /** @@ -345,14 +345,14 @@ public function __construct(?array $data = null) } /** - * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName - * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the - * $this->openAPINullablesSetToNull array - * - * @param string $variableName - * @param array $fields - * @param mixed $defaultValue - */ + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ private function setIfExists(string $variableName, array $fields, $defaultValue): void { if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { diff --git a/lib/SysAdmin/UpdateGeneralSettingsRequest.php b/lib/SysAdmin/UpdateGeneralSettingsRequest.php index 3432db25..a965c5df 100644 --- a/lib/SysAdmin/UpdateGeneralSettingsRequest.php +++ b/lib/SysAdmin/UpdateGeneralSettingsRequest.php @@ -44,17 +44,17 @@ class UpdateGeneralSettingsRequest implements ModelInterface, ArrayAccess, \Json public const DISCRIMINATOR = null; /** - * The original name of the model. - * - * @var string - */ + * The original name of the model. + * + * @var string + */ protected static $openAPIModelName = 'updateGeneralSettings_request'; /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ protected static $openAPITypes = [ 'site_title' => 'string', 'site_name' => 'string', @@ -74,12 +74,12 @@ class UpdateGeneralSettingsRequest implements ModelInterface, ArrayAccess, \Json ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - * @phpstan-var array - * @psalm-var array - */ + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ protected static $openAPIFormats = [ 'site_title' => null, 'site_name' => null, @@ -99,10 +99,10 @@ class UpdateGeneralSettingsRequest implements ModelInterface, ArrayAccess, \Json ]; /** - * Array of nullable properties. Used for (de)serialization - * - * @var boolean[] - */ + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ protected static array $openAPINullables = [ 'site_title' => false, 'site_name' => false, @@ -122,10 +122,10 @@ class UpdateGeneralSettingsRequest implements ModelInterface, ArrayAccess, \Json ]; /** - * If a nullable field gets set to null, insert it here - * - * @var boolean[] - */ + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ protected array $openAPINullablesSetToNull = []; /** @@ -345,14 +345,14 @@ public function __construct(?array $data = null) } /** - * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName - * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the - * $this->openAPINullablesSetToNull array - * - * @param string $variableName - * @param array $fields - * @param mixed $defaultValue - */ + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ private function setIfExists(string $variableName, array $fields, $defaultValue): void { if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { diff --git a/lib/SysAdmin/UpdateTeam200Response.php b/lib/SysAdmin/UpdateTeam200Response.php index 7d558672..1d3aa0a4 100644 --- a/lib/SysAdmin/UpdateTeam200Response.php +++ b/lib/SysAdmin/UpdateTeam200Response.php @@ -44,17 +44,17 @@ class UpdateTeam200Response implements ModelInterface, ArrayAccess, \JsonSeriali public const DISCRIMINATOR = null; /** - * The original name of the model. - * - * @var string - */ + * The original name of the model. + * + * @var string + */ protected static $openAPIModelName = 'updateTeam_200_response'; /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ protected static $openAPITypes = [ 'org_id' => 'int', 'org_name' => 'string', @@ -74,12 +74,12 @@ class UpdateTeam200Response implements ModelInterface, ArrayAccess, \JsonSeriali ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - * @phpstan-var array - * @psalm-var array - */ + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ protected static $openAPIFormats = [ 'org_id' => null, 'org_name' => null, @@ -99,10 +99,10 @@ class UpdateTeam200Response implements ModelInterface, ArrayAccess, \JsonSeriali ]; /** - * Array of nullable properties. Used for (de)serialization - * - * @var boolean[] - */ + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ protected static array $openAPINullables = [ 'org_id' => false, 'org_name' => false, @@ -122,10 +122,10 @@ class UpdateTeam200Response implements ModelInterface, ArrayAccess, \JsonSeriali ]; /** - * If a nullable field gets set to null, insert it here - * - * @var boolean[] - */ + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ protected array $openAPINullablesSetToNull = []; /** @@ -345,14 +345,14 @@ public function __construct(?array $data = null) } /** - * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName - * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the - * $this->openAPINullablesSetToNull array - * - * @param string $variableName - * @param array $fields - * @param mixed $defaultValue - */ + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ private function setIfExists(string $variableName, array $fields, $defaultValue): void { if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { diff --git a/lib/SysAdmin/UpdateTeamRequest.php b/lib/SysAdmin/UpdateTeamRequest.php index 9cb5b251..90178abc 100644 --- a/lib/SysAdmin/UpdateTeamRequest.php +++ b/lib/SysAdmin/UpdateTeamRequest.php @@ -44,17 +44,17 @@ class UpdateTeamRequest implements ModelInterface, ArrayAccess, \JsonSerializabl public const DISCRIMINATOR = null; /** - * The original name of the model. - * - * @var string - */ + * The original name of the model. + * + * @var string + */ protected static $openAPIModelName = 'updateTeam_request'; /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ protected static $openAPITypes = [ 'org_name' => 'string', 'role' => 'string', @@ -65,12 +65,12 @@ class UpdateTeamRequest implements ModelInterface, ArrayAccess, \JsonSerializabl ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - * @phpstan-var array - * @psalm-var array - */ + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ protected static $openAPIFormats = [ 'org_name' => null, 'role' => null, @@ -81,10 +81,10 @@ class UpdateTeamRequest implements ModelInterface, ArrayAccess, \JsonSerializabl ]; /** - * Array of nullable properties. Used for (de)serialization - * - * @var boolean[] - */ + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ protected static array $openAPINullables = [ 'org_name' => false, 'role' => false, @@ -95,10 +95,10 @@ class UpdateTeamRequest implements ModelInterface, ArrayAccess, \JsonSerializabl ]; /** - * If a nullable field gets set to null, insert it here - * - * @var boolean[] - */ + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ protected array $openAPINullablesSetToNull = []; /** @@ -282,14 +282,14 @@ public function __construct(?array $data = null) } /** - * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName - * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the - * $this->openAPINullablesSetToNull array - * - * @param string $variableName - * @param array $fields - * @param mixed $defaultValue - */ + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ private function setIfExists(string $variableName, array $fields, $defaultValue): void { if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { diff --git a/lib/SysAdmin/UpdateTeamUserRequest.php b/lib/SysAdmin/UpdateTeamUserRequest.php index 18997b3a..c9875bf8 100644 --- a/lib/SysAdmin/UpdateTeamUserRequest.php +++ b/lib/SysAdmin/UpdateTeamUserRequest.php @@ -44,17 +44,17 @@ class UpdateTeamUserRequest implements ModelInterface, ArrayAccess, \JsonSeriali public const DISCRIMINATOR = null; /** - * The original name of the model. - * - * @var string - */ + * The original name of the model. + * + * @var string + */ protected static $openAPIModelName = 'updateTeamUser_request'; /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ protected static $openAPITypes = [ 'is_admin' => 'bool', 'active' => 'bool', @@ -64,12 +64,12 @@ class UpdateTeamUserRequest implements ModelInterface, ArrayAccess, \JsonSeriali ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - * @phpstan-var array - * @psalm-var array - */ + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ protected static $openAPIFormats = [ 'is_admin' => null, 'active' => null, @@ -79,10 +79,10 @@ class UpdateTeamUserRequest implements ModelInterface, ArrayAccess, \JsonSeriali ]; /** - * Array of nullable properties. Used for (de)serialization - * - * @var boolean[] - */ + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ protected static array $openAPINullables = [ 'is_admin' => false, 'active' => false, @@ -92,10 +92,10 @@ class UpdateTeamUserRequest implements ModelInterface, ArrayAccess, \JsonSeriali ]; /** - * If a nullable field gets set to null, insert it here - * - * @var boolean[] - */ + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ protected array $openAPINullablesSetToNull = []; /** @@ -275,14 +275,14 @@ public function __construct(?array $data = null) } /** - * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName - * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the - * $this->openAPINullablesSetToNull array - * - * @param string $variableName - * @param array $fields - * @param mixed $defaultValue - */ + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ private function setIfExists(string $variableName, array $fields, $defaultValue): void { if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { diff --git a/lib/SysAdmin/UpdateUser200Response.php b/lib/SysAdmin/UpdateUser200Response.php index defa23c6..d0bf0ef9 100644 --- a/lib/SysAdmin/UpdateUser200Response.php +++ b/lib/SysAdmin/UpdateUser200Response.php @@ -44,17 +44,17 @@ class UpdateUser200Response implements ModelInterface, ArrayAccess, \JsonSeriali public const DISCRIMINATOR = null; /** - * The original name of the model. - * - * @var string - */ + * The original name of the model. + * + * @var string + */ protected static $openAPIModelName = 'updateUser_200_response'; /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ protected static $openAPITypes = [ 'email' => 'string', 'name' => 'string', @@ -74,12 +74,12 @@ class UpdateUser200Response implements ModelInterface, ArrayAccess, \JsonSeriali ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - * @phpstan-var array - * @psalm-var array - */ + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ protected static $openAPIFormats = [ 'email' => null, 'name' => null, @@ -99,10 +99,10 @@ class UpdateUser200Response implements ModelInterface, ArrayAccess, \JsonSeriali ]; /** - * Array of nullable properties. Used for (de)serialization - * - * @var boolean[] - */ + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ protected static array $openAPINullables = [ 'email' => false, 'name' => false, @@ -122,10 +122,10 @@ class UpdateUser200Response implements ModelInterface, ArrayAccess, \JsonSeriali ]; /** - * If a nullable field gets set to null, insert it here - * - * @var boolean[] - */ + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ protected array $openAPINullablesSetToNull = []; /** @@ -345,14 +345,14 @@ public function __construct(?array $data = null) } /** - * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName - * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the - * $this->openAPINullablesSetToNull array - * - * @param string $variableName - * @param array $fields - * @param mixed $defaultValue - */ + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ private function setIfExists(string $variableName, array $fields, $defaultValue): void { if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { diff --git a/lib/SysAdmin/UpdateUserRequest.php b/lib/SysAdmin/UpdateUserRequest.php index 32f43c1b..4253b929 100644 --- a/lib/SysAdmin/UpdateUserRequest.php +++ b/lib/SysAdmin/UpdateUserRequest.php @@ -44,17 +44,17 @@ class UpdateUserRequest implements ModelInterface, ArrayAccess, \JsonSerializabl public const DISCRIMINATOR = null; /** - * The original name of the model. - * - * @var string - */ + * The original name of the model. + * + * @var string + */ protected static $openAPIModelName = 'updateUser_request'; /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ protected static $openAPITypes = [ 'is_staff' => 'bool', 'is_active' => 'bool', @@ -73,12 +73,12 @@ class UpdateUserRequest implements ModelInterface, ArrayAccess, \JsonSerializabl ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - * @phpstan-var array - * @psalm-var array - */ + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ protected static $openAPIFormats = [ 'is_staff' => null, 'is_active' => null, @@ -97,10 +97,10 @@ class UpdateUserRequest implements ModelInterface, ArrayAccess, \JsonSerializabl ]; /** - * Array of nullable properties. Used for (de)serialization - * - * @var boolean[] - */ + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ protected static array $openAPINullables = [ 'is_staff' => false, 'is_active' => false, @@ -119,10 +119,10 @@ class UpdateUserRequest implements ModelInterface, ArrayAccess, \JsonSerializabl ]; /** - * If a nullable field gets set to null, insert it here - * - * @var boolean[] - */ + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ protected array $openAPINullablesSetToNull = []; /** @@ -338,14 +338,14 @@ public function __construct(?array $data = null) } /** - * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName - * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the - * $this->openAPINullablesSetToNull array - * - * @param string $variableName - * @param array $fields - * @param mixed $defaultValue - */ + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ private function setIfExists(string $variableName, array $fields, $defaultValue): void { if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { diff --git a/lib/SysAdmin/UsersApi.php b/lib/SysAdmin/UsersApi.php index 5bd7aed3..5b6561f0 100644 --- a/lib/SysAdmin/UsersApi.php +++ b/lib/SysAdmin/UsersApi.php @@ -28,11 +28,11 @@ use GuzzleHttp\Client; use GuzzleHttp\ClientInterface; -use GuzzleHttp\Exception\ConnectException; use GuzzleHttp\Exception\RequestException; use GuzzleHttp\Psr7\MultipartStream; use GuzzleHttp\Psr7\Request; use GuzzleHttp\RequestOptions; +use Psr\Http\Client\NetworkExceptionInterface; use Psr\Http\Message\RequestInterface; use Psr\Http\Message\ResponseInterface; use SeaTable\Client\ApiException; @@ -205,13 +205,14 @@ public function addNewUserWithHttpInfo($add_new_user_request = null, string $con try { $response = $this->client->send($request, $options); } catch (RequestException $e) { + $eResponse = $this->getExceptionResponse($e); throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), - $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? (string) $e->getResponse()->getBody() : null + $eResponse ? $eResponse->getHeaders() : null, + $eResponse ? (string) $eResponse->getBody() : null ); - } catch (ConnectException $e) { + } catch (NetworkExceptionInterface $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), @@ -326,7 +327,15 @@ function ($response) use ($returnType) { ]; }, function ($exception) { - $response = $exception->getResponse(); + $response = $this->getExceptionResponse($exception); + if ($response === null) { + throw new ApiException( + "[{$exception->getCode()}] {$exception->getMessage()}", + (int) $exception->getCode(), + null, + null + ); + } $statusCode = $response->getStatusCode(); throw new ApiException( sprintf( @@ -377,7 +386,11 @@ public function addNewUserRequest($add_new_user_request = null, string $contentT if (isset($add_new_user_request)) { if (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the body - $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($add_new_user_request)); + try { + $httpBody = json_encode(ObjectSerializer::sanitizeForSerialization($add_new_user_request), JSON_THROW_ON_ERROR); + } catch (\JsonException $e) { + throw new \InvalidArgumentException('json_encode error: ' . $e->getMessage(), 0, $e); + } } else { $httpBody = $add_new_user_request; } @@ -398,7 +411,11 @@ public function addNewUserRequest($add_new_user_request = null, string $contentT } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + try { + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + } catch (\JsonException $e) { + throw new \InvalidArgumentException('json_encode error: ' . $e->getMessage(), 0, $e); + } } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -470,13 +487,14 @@ public function deleteUserWithHttpInfo($user_id, string $contentType = self::con try { $response = $this->client->send($request, $options); } catch (RequestException $e) { + $eResponse = $this->getExceptionResponse($e); throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), - $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? (string) $e->getResponse()->getBody() : null + $eResponse ? $eResponse->getHeaders() : null, + $eResponse ? (string) $eResponse->getBody() : null ); - } catch (ConnectException $e) { + } catch (NetworkExceptionInterface $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), @@ -591,7 +609,15 @@ function ($response) use ($returnType) { ]; }, function ($exception) { - $response = $exception->getResponse(); + $response = $this->getExceptionResponse($exception); + if ($response === null) { + throw new ApiException( + "[{$exception->getCode()}] {$exception->getMessage()}", + (int) $exception->getCode(), + null, + null + ); + } $statusCode = $response->getStatusCode(); throw new ApiException( sprintf( @@ -642,7 +668,7 @@ public function deleteUserRequest($user_id, string $contentType = self::contentT // path params if ($user_id !== null) { $resourcePath = str_replace( - '{' . 'user_id' . '}', + '{user_id}', ObjectSerializer::toPathValue($user_id), $resourcePath ); @@ -673,7 +699,11 @@ public function deleteUserRequest($user_id, string $contentType = self::contentT } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + try { + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + } catch (\JsonException $e) { + throw new \InvalidArgumentException('json_encode error: ' . $e->getMessage(), 0, $e); + } } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -745,13 +775,14 @@ public function disableTwoFactorWithHttpInfo($user_id, string $contentType = sel try { $response = $this->client->send($request, $options); } catch (RequestException $e) { + $eResponse = $this->getExceptionResponse($e); throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), - $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? (string) $e->getResponse()->getBody() : null + $eResponse ? $eResponse->getHeaders() : null, + $eResponse ? (string) $eResponse->getBody() : null ); - } catch (ConnectException $e) { + } catch (NetworkExceptionInterface $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), @@ -866,7 +897,15 @@ function ($response) use ($returnType) { ]; }, function ($exception) { - $response = $exception->getResponse(); + $response = $this->getExceptionResponse($exception); + if ($response === null) { + throw new ApiException( + "[{$exception->getCode()}] {$exception->getMessage()}", + (int) $exception->getCode(), + null, + null + ); + } $statusCode = $response->getStatusCode(); throw new ApiException( sprintf( @@ -917,7 +956,7 @@ public function disableTwoFactorRequest($user_id, string $contentType = self::co // path params if ($user_id !== null) { $resourcePath = str_replace( - '{' . 'user_id' . '}', + '{user_id}', ObjectSerializer::toPathValue($user_id), $resourcePath ); @@ -948,7 +987,11 @@ public function disableTwoFactorRequest($user_id, string $contentType = self::co } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + try { + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + } catch (\JsonException $e) { + throw new \InvalidArgumentException('json_encode error: ' . $e->getMessage(), 0, $e); + } } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -1022,13 +1065,14 @@ public function enforceTwoFactorWithHttpInfo($user_id, $enforce_two_factor_reque try { $response = $this->client->send($request, $options); } catch (RequestException $e) { + $eResponse = $this->getExceptionResponse($e); throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), - $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? (string) $e->getResponse()->getBody() : null + $eResponse ? $eResponse->getHeaders() : null, + $eResponse ? (string) $eResponse->getBody() : null ); - } catch (ConnectException $e) { + } catch (NetworkExceptionInterface $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), @@ -1145,7 +1189,15 @@ function ($response) use ($returnType) { ]; }, function ($exception) { - $response = $exception->getResponse(); + $response = $this->getExceptionResponse($exception); + if ($response === null) { + throw new ApiException( + "[{$exception->getCode()}] {$exception->getMessage()}", + (int) $exception->getCode(), + null, + null + ); + } $statusCode = $response->getStatusCode(); throw new ApiException( sprintf( @@ -1198,7 +1250,7 @@ public function enforceTwoFactorRequest($user_id, $enforce_two_factor_request = // path params if ($user_id !== null) { $resourcePath = str_replace( - '{' . 'user_id' . '}', + '{user_id}', ObjectSerializer::toPathValue($user_id), $resourcePath ); @@ -1215,7 +1267,11 @@ public function enforceTwoFactorRequest($user_id, $enforce_two_factor_request = if (isset($enforce_two_factor_request)) { if (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the body - $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($enforce_two_factor_request)); + try { + $httpBody = json_encode(ObjectSerializer::sanitizeForSerialization($enforce_two_factor_request), JSON_THROW_ON_ERROR); + } catch (\JsonException $e) { + throw new \InvalidArgumentException('json_encode error: ' . $e->getMessage(), 0, $e); + } } else { $httpBody = $enforce_two_factor_request; } @@ -1236,7 +1292,11 @@ public function enforceTwoFactorRequest($user_id, $enforce_two_factor_request = } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + try { + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + } catch (\JsonException $e) { + throw new \InvalidArgumentException('json_encode error: ' . $e->getMessage(), 0, $e); + } } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -1308,13 +1368,14 @@ public function getUserWithHttpInfo($user_id, string $contentType = self::conten try { $response = $this->client->send($request, $options); } catch (RequestException $e) { + $eResponse = $this->getExceptionResponse($e); throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), - $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? (string) $e->getResponse()->getBody() : null + $eResponse ? $eResponse->getHeaders() : null, + $eResponse ? (string) $eResponse->getBody() : null ); - } catch (ConnectException $e) { + } catch (NetworkExceptionInterface $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), @@ -1429,7 +1490,15 @@ function ($response) use ($returnType) { ]; }, function ($exception) { - $response = $exception->getResponse(); + $response = $this->getExceptionResponse($exception); + if ($response === null) { + throw new ApiException( + "[{$exception->getCode()}] {$exception->getMessage()}", + (int) $exception->getCode(), + null, + null + ); + } $statusCode = $response->getStatusCode(); throw new ApiException( sprintf( @@ -1480,7 +1549,7 @@ public function getUserRequest($user_id, string $contentType = self::contentType // path params if ($user_id !== null) { $resourcePath = str_replace( - '{' . 'user_id' . '}', + '{user_id}', ObjectSerializer::toPathValue($user_id), $resourcePath ); @@ -1511,7 +1580,11 @@ public function getUserRequest($user_id, string $contentType = self::contentType } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + try { + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + } catch (\JsonException $e) { + throw new \InvalidArgumentException('json_encode error: ' . $e->getMessage(), 0, $e); + } } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -1583,13 +1656,14 @@ public function importUsersWithHttpInfo($file, string $contentType = self::conte try { $response = $this->client->send($request, $options); } catch (RequestException $e) { + $eResponse = $this->getExceptionResponse($e); throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), - $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? (string) $e->getResponse()->getBody() : null + $eResponse ? $eResponse->getHeaders() : null, + $eResponse ? (string) $eResponse->getBody() : null ); - } catch (ConnectException $e) { + } catch (NetworkExceptionInterface $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), @@ -1704,7 +1778,15 @@ function ($response) use ($returnType) { ]; }, function ($exception) { - $response = $exception->getResponse(); + $response = $this->getExceptionResponse($exception); + if ($response === null) { + throw new ApiException( + "[{$exception->getCode()}] {$exception->getMessage()}", + (int) $exception->getCode(), + null, + null + ); + } $statusCode = $response->getStatusCode(); throw new ApiException( sprintf( @@ -1785,7 +1867,11 @@ public function importUsersRequest($file, string $contentType = self::contentTyp } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + try { + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + } catch (\JsonException $e) { + throw new \InvalidArgumentException('json_encode error: ' . $e->getMessage(), 0, $e); + } } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -1855,13 +1941,14 @@ public function listAdminUsersWithHttpInfo(string $contentType = self::contentTy try { $response = $this->client->send($request, $options); } catch (RequestException $e) { + $eResponse = $this->getExceptionResponse($e); throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), - $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? (string) $e->getResponse()->getBody() : null + $eResponse ? $eResponse->getHeaders() : null, + $eResponse ? (string) $eResponse->getBody() : null ); - } catch (ConnectException $e) { + } catch (NetworkExceptionInterface $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), @@ -1974,7 +2061,15 @@ function ($response) use ($returnType) { ]; }, function ($exception) { - $response = $exception->getResponse(); + $response = $this->getExceptionResponse($exception); + if ($response === null) { + throw new ApiException( + "[{$exception->getCode()}] {$exception->getMessage()}", + (int) $exception->getCode(), + null, + null + ); + } $statusCode = $response->getStatusCode(); throw new ApiException( sprintf( @@ -2037,7 +2132,11 @@ public function listAdminUsersRequest(string $contentType = self::contentTypes[' } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + try { + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + } catch (\JsonException $e) { + throw new \InvalidArgumentException('json_encode error: ' . $e->getMessage(), 0, $e); + } } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -2113,13 +2212,14 @@ public function listBasesSharedToUserWithHttpInfo($user_id, $page = null, $per_p try { $response = $this->client->send($request, $options); } catch (RequestException $e) { + $eResponse = $this->getExceptionResponse($e); throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), - $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? (string) $e->getResponse()->getBody() : null + $eResponse ? $eResponse->getHeaders() : null, + $eResponse ? (string) $eResponse->getBody() : null ); - } catch (ConnectException $e) { + } catch (NetworkExceptionInterface $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), @@ -2238,7 +2338,15 @@ function ($response) use ($returnType) { ]; }, function ($exception) { - $response = $exception->getResponse(); + $response = $this->getExceptionResponse($exception); + if ($response === null) { + throw new ApiException( + "[{$exception->getCode()}] {$exception->getMessage()}", + (int) $exception->getCode(), + null, + null + ); + } $statusCode = $response->getStatusCode(); throw new ApiException( sprintf( @@ -2317,7 +2425,7 @@ public function listBasesSharedToUserRequest($user_id, $page = null, $per_page = // path params if ($user_id !== null) { $resourcePath = str_replace( - '{' . 'user_id' . '}', + '{user_id}', ObjectSerializer::toPathValue($user_id), $resourcePath ); @@ -2348,7 +2456,11 @@ public function listBasesSharedToUserRequest($user_id, $page = null, $per_page = } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + try { + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + } catch (\JsonException $e) { + throw new \InvalidArgumentException('json_encode error: ' . $e->getMessage(), 0, $e); + } } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -2422,13 +2534,14 @@ public function listUserStorageObjectsWithHttpInfo($user_id, $parent_dir = null, try { $response = $this->client->send($request, $options); } catch (RequestException $e) { + $eResponse = $this->getExceptionResponse($e); throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), - $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? (string) $e->getResponse()->getBody() : null + $eResponse ? $eResponse->getHeaders() : null, + $eResponse ? (string) $eResponse->getBody() : null ); - } catch (ConnectException $e) { + } catch (NetworkExceptionInterface $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), @@ -2545,7 +2658,15 @@ function ($response) use ($returnType) { ]; }, function ($exception) { - $response = $exception->getResponse(); + $response = $this->getExceptionResponse($exception); + if ($response === null) { + throw new ApiException( + "[{$exception->getCode()}] {$exception->getMessage()}", + (int) $exception->getCode(), + null, + null + ); + } $statusCode = $response->getStatusCode(); throw new ApiException( sprintf( @@ -2607,7 +2728,7 @@ public function listUserStorageObjectsRequest($user_id, $parent_dir = null, stri // path params if ($user_id !== null) { $resourcePath = str_replace( - '{' . 'user_id' . '}', + '{user_id}', ObjectSerializer::toPathValue($user_id), $resourcePath ); @@ -2638,7 +2759,11 @@ public function listUserStorageObjectsRequest($user_id, $parent_dir = null, stri } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + try { + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + } catch (\JsonException $e) { + throw new \InvalidArgumentException('json_encode error: ' . $e->getMessage(), 0, $e); + } } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -2712,13 +2837,14 @@ public function listUsersWithHttpInfo($page = null, $per_page = null, string $co try { $response = $this->client->send($request, $options); } catch (RequestException $e) { + $eResponse = $this->getExceptionResponse($e); throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), - $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? (string) $e->getResponse()->getBody() : null + $eResponse ? $eResponse->getHeaders() : null, + $eResponse ? (string) $eResponse->getBody() : null ); - } catch (ConnectException $e) { + } catch (NetworkExceptionInterface $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), @@ -2849,7 +2975,15 @@ function ($response) use ($returnType) { ]; }, function ($exception) { - $response = $exception->getResponse(); + $response = $this->getExceptionResponse($exception); + if ($response === null) { + throw new ApiException( + "[{$exception->getCode()}] {$exception->getMessage()}", + (int) $exception->getCode(), + null, + null + ); + } $statusCode = $response->getStatusCode(); throw new ApiException( sprintf( @@ -2940,7 +3074,11 @@ public function listUsersRequest($page = null, $per_page = null, string $content } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + try { + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + } catch (\JsonException $e) { + throw new \InvalidArgumentException('json_encode error: ' . $e->getMessage(), 0, $e); + } } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -3012,13 +3150,14 @@ public function resetUserPasswordWithHttpInfo($user_id, string $contentType = se try { $response = $this->client->send($request, $options); } catch (RequestException $e) { + $eResponse = $this->getExceptionResponse($e); throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), - $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? (string) $e->getResponse()->getBody() : null + $eResponse ? $eResponse->getHeaders() : null, + $eResponse ? (string) $eResponse->getBody() : null ); - } catch (ConnectException $e) { + } catch (NetworkExceptionInterface $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), @@ -3133,7 +3272,15 @@ function ($response) use ($returnType) { ]; }, function ($exception) { - $response = $exception->getResponse(); + $response = $this->getExceptionResponse($exception); + if ($response === null) { + throw new ApiException( + "[{$exception->getCode()}] {$exception->getMessage()}", + (int) $exception->getCode(), + null, + null + ); + } $statusCode = $response->getStatusCode(); throw new ApiException( sprintf( @@ -3184,7 +3331,7 @@ public function resetUserPasswordRequest($user_id, string $contentType = self::c // path params if ($user_id !== null) { $resourcePath = str_replace( - '{' . 'user_id' . '}', + '{user_id}', ObjectSerializer::toPathValue($user_id), $resourcePath ); @@ -3215,7 +3362,11 @@ public function resetUserPasswordRequest($user_id, string $contentType = self::c } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + try { + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + } catch (\JsonException $e) { + throw new \InvalidArgumentException('json_encode error: ' . $e->getMessage(), 0, $e); + } } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -3287,13 +3438,14 @@ public function searchUserWithHttpInfo($query = null, string $contentType = self try { $response = $this->client->send($request, $options); } catch (RequestException $e) { + $eResponse = $this->getExceptionResponse($e); throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), - $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? (string) $e->getResponse()->getBody() : null + $eResponse ? $eResponse->getHeaders() : null, + $eResponse ? (string) $eResponse->getBody() : null ); - } catch (ConnectException $e) { + } catch (NetworkExceptionInterface $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), @@ -3408,7 +3560,15 @@ function ($response) use ($returnType) { ]; }, function ($exception) { - $response = $exception->getResponse(); + $response = $this->getExceptionResponse($exception); + if ($response === null) { + throw new ApiException( + "[{$exception->getCode()}] {$exception->getMessage()}", + (int) $exception->getCode(), + null, + null + ); + } $statusCode = $response->getStatusCode(); throw new ApiException( sprintf( @@ -3485,7 +3645,11 @@ public function searchUserRequest($query = null, string $contentType = self::con } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + try { + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + } catch (\JsonException $e) { + throw new \InvalidArgumentException('json_encode error: ' . $e->getMessage(), 0, $e); + } } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -3560,13 +3724,14 @@ public function searchUserByOrgIdWithHttpInfo($query = null, $org_id = null, $li try { $response = $this->client->send($request, $options); } catch (RequestException $e) { + $eResponse = $this->getExceptionResponse($e); throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), - $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? (string) $e->getResponse()->getBody() : null + $eResponse ? $eResponse->getHeaders() : null, + $eResponse ? (string) $eResponse->getBody() : null ); - } catch (ConnectException $e) { + } catch (NetworkExceptionInterface $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), @@ -3636,7 +3801,15 @@ function ($response) use ($returnType) { return [null, $response->getStatusCode(), $response->getHeaders()]; }, function ($exception) { - $response = $exception->getResponse(); + $response = $this->getExceptionResponse($exception); + if ($response === null) { + throw new ApiException( + "[{$exception->getCode()}] {$exception->getMessage()}", + (int) $exception->getCode(), + null, + null + ); + } $statusCode = $response->getStatusCode(); throw new ApiException( sprintf( @@ -3738,7 +3911,11 @@ public function searchUserByOrgIdRequest($query = null, $org_id = null, $limit = } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + try { + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + } catch (\JsonException $e) { + throw new \InvalidArgumentException('json_encode error: ' . $e->getMessage(), 0, $e); + } } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -3810,13 +3987,14 @@ public function updateAdminRoleWithHttpInfo($update_admins_role = null, string $ try { $response = $this->client->send($request, $options); } catch (RequestException $e) { + $eResponse = $this->getExceptionResponse($e); throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), - $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? (string) $e->getResponse()->getBody() : null + $eResponse ? $eResponse->getHeaders() : null, + $eResponse ? (string) $eResponse->getBody() : null ); - } catch (ConnectException $e) { + } catch (NetworkExceptionInterface $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), @@ -3931,7 +4109,15 @@ function ($response) use ($returnType) { ]; }, function ($exception) { - $response = $exception->getResponse(); + $response = $this->getExceptionResponse($exception); + if ($response === null) { + throw new ApiException( + "[{$exception->getCode()}] {$exception->getMessage()}", + (int) $exception->getCode(), + null, + null + ); + } $statusCode = $response->getStatusCode(); throw new ApiException( sprintf( @@ -3982,7 +4168,11 @@ public function updateAdminRoleRequest($update_admins_role = null, string $conte if (isset($update_admins_role)) { if (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the body - $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($update_admins_role)); + try { + $httpBody = json_encode(ObjectSerializer::sanitizeForSerialization($update_admins_role), JSON_THROW_ON_ERROR); + } catch (\JsonException $e) { + throw new \InvalidArgumentException('json_encode error: ' . $e->getMessage(), 0, $e); + } } else { $httpBody = $update_admins_role; } @@ -4003,7 +4193,11 @@ public function updateAdminRoleRequest($update_admins_role = null, string $conte } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + try { + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + } catch (\JsonException $e) { + throw new \InvalidArgumentException('json_encode error: ' . $e->getMessage(), 0, $e); + } } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -4077,13 +4271,14 @@ public function updateUserWithHttpInfo($user_id, $update_user_request = null, st try { $response = $this->client->send($request, $options); } catch (RequestException $e) { + $eResponse = $this->getExceptionResponse($e); throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), - $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? (string) $e->getResponse()->getBody() : null + $eResponse ? $eResponse->getHeaders() : null, + $eResponse ? (string) $eResponse->getBody() : null ); - } catch (ConnectException $e) { + } catch (NetworkExceptionInterface $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), @@ -4200,7 +4395,15 @@ function ($response) use ($returnType) { ]; }, function ($exception) { - $response = $exception->getResponse(); + $response = $this->getExceptionResponse($exception); + if ($response === null) { + throw new ApiException( + "[{$exception->getCode()}] {$exception->getMessage()}", + (int) $exception->getCode(), + null, + null + ); + } $statusCode = $response->getStatusCode(); throw new ApiException( sprintf( @@ -4253,7 +4456,7 @@ public function updateUserRequest($user_id, $update_user_request = null, string // path params if ($user_id !== null) { $resourcePath = str_replace( - '{' . 'user_id' . '}', + '{user_id}', ObjectSerializer::toPathValue($user_id), $resourcePath ); @@ -4270,7 +4473,11 @@ public function updateUserRequest($user_id, $update_user_request = null, string if (isset($update_user_request)) { if (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the body - $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($update_user_request)); + try { + $httpBody = json_encode(ObjectSerializer::sanitizeForSerialization($update_user_request), JSON_THROW_ON_ERROR); + } catch (\JsonException $e) { + throw new \InvalidArgumentException('json_encode error: ' . $e->getMessage(), 0, $e); + } } else { $httpBody = $update_user_request; } @@ -4291,7 +4498,11 @@ public function updateUserRequest($user_id, $update_user_request = null, string } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + try { + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + } catch (\JsonException $e) { + throw new \InvalidArgumentException('json_encode error: ' . $e->getMessage(), 0, $e); + } } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -4351,6 +4562,21 @@ protected function createHttpClientOption() return $options; } + /** + * Returns the response attached to a Guzzle exception, if there is one. + * + * Guzzle 7 exposes getResponse() on RequestException, while Guzzle 8 only + * exposes it on ResponseException and its subclasses. + * + * @param \Throwable $exception + * + * @return ResponseInterface|null + */ + private function getExceptionResponse(\Throwable $exception): ?ResponseInterface + { + return method_exists($exception, 'getResponse') ? $exception->getResponse() : null; + } + private function handleResponseWithDataType( string $dataType, RequestInterface $request, diff --git a/lib/TeamAdmin/ActivitiesLogsApi.php b/lib/TeamAdmin/ActivitiesLogsApi.php index b8d8e6ce..dcd170f9 100644 --- a/lib/TeamAdmin/ActivitiesLogsApi.php +++ b/lib/TeamAdmin/ActivitiesLogsApi.php @@ -28,11 +28,11 @@ use GuzzleHttp\Client; use GuzzleHttp\ClientInterface; -use GuzzleHttp\Exception\ConnectException; use GuzzleHttp\Exception\RequestException; use GuzzleHttp\Psr7\MultipartStream; use GuzzleHttp\Psr7\Request; use GuzzleHttp\RequestOptions; +use Psr\Http\Client\NetworkExceptionInterface; use Psr\Http\Message\RequestInterface; use Psr\Http\Message\ResponseInterface; use SeaTable\Client\ApiException; @@ -191,13 +191,14 @@ public function listAutomationLogsWithHttpInfo($org_id, $dtable_uuid = null, $st try { $response = $this->client->send($request, $options); } catch (RequestException $e) { + $eResponse = $this->getExceptionResponse($e); throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), - $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? (string) $e->getResponse()->getBody() : null + $eResponse ? $eResponse->getHeaders() : null, + $eResponse ? (string) $eResponse->getBody() : null ); - } catch (ConnectException $e) { + } catch (NetworkExceptionInterface $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), @@ -322,7 +323,15 @@ function ($response) use ($returnType) { ]; }, function ($exception) { - $response = $exception->getResponse(); + $response = $this->getExceptionResponse($exception); + if ($response === null) { + throw new ApiException( + "[{$exception->getCode()}] {$exception->getMessage()}", + (int) $exception->getCode(), + null, + null + ); + } $statusCode = $response->getStatusCode(); throw new ApiException( sprintf( @@ -437,7 +446,7 @@ public function listAutomationLogsRequest($org_id, $dtable_uuid = null, $start = // path params if ($org_id !== null) { $resourcePath = str_replace( - '{' . 'org_id' . '}', + '{org_id}', ObjectSerializer::toPathValue($org_id), $resourcePath ); @@ -468,7 +477,11 @@ public function listAutomationLogsRequest($org_id, $dtable_uuid = null, $start = } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + try { + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + } catch (\JsonException $e) { + throw new \InvalidArgumentException('json_encode error: ' . $e->getMessage(), 0, $e); + } } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -544,13 +557,14 @@ public function listFileAccessLogsWithHttpInfo($org_id, $page = null, $per_page try { $response = $this->client->send($request, $options); } catch (RequestException $e) { + $eResponse = $this->getExceptionResponse($e); throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), - $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? (string) $e->getResponse()->getBody() : null + $eResponse ? $eResponse->getHeaders() : null, + $eResponse ? (string) $eResponse->getBody() : null ); - } catch (ConnectException $e) { + } catch (NetworkExceptionInterface $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), @@ -669,7 +683,15 @@ function ($response) use ($returnType) { ]; }, function ($exception) { - $response = $exception->getResponse(); + $response = $this->getExceptionResponse($exception); + if ($response === null) { + throw new ApiException( + "[{$exception->getCode()}] {$exception->getMessage()}", + (int) $exception->getCode(), + null, + null + ); + } $statusCode = $response->getStatusCode(); throw new ApiException( sprintf( @@ -748,7 +770,7 @@ public function listFileAccessLogsRequest($org_id, $page = null, $per_page = nul // path params if ($org_id !== null) { $resourcePath = str_replace( - '{' . 'org_id' . '}', + '{org_id}', ObjectSerializer::toPathValue($org_id), $resourcePath ); @@ -779,7 +801,11 @@ public function listFileAccessLogsRequest($org_id, $page = null, $per_page = nul } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + try { + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + } catch (\JsonException $e) { + throw new \InvalidArgumentException('json_encode error: ' . $e->getMessage(), 0, $e); + } } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -855,13 +881,14 @@ public function listGroupMemberAuditLogsWithHttpInfo($org_id, $page = null, $per try { $response = $this->client->send($request, $options); } catch (RequestException $e) { + $eResponse = $this->getExceptionResponse($e); throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), - $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? (string) $e->getResponse()->getBody() : null + $eResponse ? $eResponse->getHeaders() : null, + $eResponse ? (string) $eResponse->getBody() : null ); - } catch (ConnectException $e) { + } catch (NetworkExceptionInterface $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), @@ -980,7 +1007,15 @@ function ($response) use ($returnType) { ]; }, function ($exception) { - $response = $exception->getResponse(); + $response = $this->getExceptionResponse($exception); + if ($response === null) { + throw new ApiException( + "[{$exception->getCode()}] {$exception->getMessage()}", + (int) $exception->getCode(), + null, + null + ); + } $statusCode = $response->getStatusCode(); throw new ApiException( sprintf( @@ -1059,7 +1094,7 @@ public function listGroupMemberAuditLogsRequest($org_id, $page = null, $per_page // path params if ($org_id !== null) { $resourcePath = str_replace( - '{' . 'org_id' . '}', + '{org_id}', ObjectSerializer::toPathValue($org_id), $resourcePath ); @@ -1090,7 +1125,11 @@ public function listGroupMemberAuditLogsRequest($org_id, $page = null, $per_page } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + try { + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + } catch (\JsonException $e) { + throw new \InvalidArgumentException('json_encode error: ' . $e->getMessage(), 0, $e); + } } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -1172,13 +1211,14 @@ public function listPythonRunsWithHttpInfo($org_id, $dtable_uuid = null, $start try { $response = $this->client->send($request, $options); } catch (RequestException $e) { + $eResponse = $this->getExceptionResponse($e); throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), - $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? (string) $e->getResponse()->getBody() : null + $eResponse ? $eResponse->getHeaders() : null, + $eResponse ? (string) $eResponse->getBody() : null ); - } catch (ConnectException $e) { + } catch (NetworkExceptionInterface $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), @@ -1303,7 +1343,15 @@ function ($response) use ($returnType) { ]; }, function ($exception) { - $response = $exception->getResponse(); + $response = $this->getExceptionResponse($exception); + if ($response === null) { + throw new ApiException( + "[{$exception->getCode()}] {$exception->getMessage()}", + (int) $exception->getCode(), + null, + null + ); + } $statusCode = $response->getStatusCode(); throw new ApiException( sprintf( @@ -1418,7 +1466,7 @@ public function listPythonRunsRequest($org_id, $dtable_uuid = null, $start = nul // path params if ($org_id !== null) { $resourcePath = str_replace( - '{' . 'org_id' . '}', + '{org_id}', ObjectSerializer::toPathValue($org_id), $resourcePath ); @@ -1449,7 +1497,11 @@ public function listPythonRunsRequest($org_id, $dtable_uuid = null, $start = nul } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + try { + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + } catch (\JsonException $e) { + throw new \InvalidArgumentException('json_encode error: ' . $e->getMessage(), 0, $e); + } } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -1531,13 +1583,14 @@ public function listTeamLoginsWithHttpInfo($org_id, $page = null, $per_page = nu try { $response = $this->client->send($request, $options); } catch (RequestException $e) { + $eResponse = $this->getExceptionResponse($e); throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), - $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? (string) $e->getResponse()->getBody() : null + $eResponse ? $eResponse->getHeaders() : null, + $eResponse ? (string) $eResponse->getBody() : null ); - } catch (ConnectException $e) { + } catch (NetworkExceptionInterface $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), @@ -1662,7 +1715,15 @@ function ($response) use ($returnType) { ]; }, function ($exception) { - $response = $exception->getResponse(); + $response = $this->getExceptionResponse($exception); + if ($response === null) { + throw new ApiException( + "[{$exception->getCode()}] {$exception->getMessage()}", + (int) $exception->getCode(), + null, + null + ); + } $statusCode = $response->getStatusCode(); throw new ApiException( sprintf( @@ -1774,7 +1835,7 @@ public function listTeamLoginsRequest($org_id, $page = null, $per_page = null, $ // path params if ($org_id !== null) { $resourcePath = str_replace( - '{' . 'org_id' . '}', + '{org_id}', ObjectSerializer::toPathValue($org_id), $resourcePath ); @@ -1805,7 +1866,11 @@ public function listTeamLoginsRequest($org_id, $page = null, $per_page = null, $ } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + try { + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + } catch (\JsonException $e) { + throw new \InvalidArgumentException('json_encode error: ' . $e->getMessage(), 0, $e); + } } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -1887,13 +1952,14 @@ public function listTeamOperationLogWithHttpInfo($org_id, $page = null, $per_pag try { $response = $this->client->send($request, $options); } catch (RequestException $e) { + $eResponse = $this->getExceptionResponse($e); throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), - $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? (string) $e->getResponse()->getBody() : null + $eResponse ? $eResponse->getHeaders() : null, + $eResponse ? (string) $eResponse->getBody() : null ); - } catch (ConnectException $e) { + } catch (NetworkExceptionInterface $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), @@ -2018,7 +2084,15 @@ function ($response) use ($returnType) { ]; }, function ($exception) { - $response = $exception->getResponse(); + $response = $this->getExceptionResponse($exception); + if ($response === null) { + throw new ApiException( + "[{$exception->getCode()}] {$exception->getMessage()}", + (int) $exception->getCode(), + null, + null + ); + } $statusCode = $response->getStatusCode(); throw new ApiException( sprintf( @@ -2130,7 +2204,7 @@ public function listTeamOperationLogRequest($org_id, $page = null, $per_page = n // path params if ($org_id !== null) { $resourcePath = str_replace( - '{' . 'org_id' . '}', + '{org_id}', ObjectSerializer::toPathValue($org_id), $resourcePath ); @@ -2161,7 +2235,11 @@ public function listTeamOperationLogRequest($org_id, $page = null, $per_page = n } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + try { + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + } catch (\JsonException $e) { + throw new \InvalidArgumentException('json_encode error: ' . $e->getMessage(), 0, $e); + } } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -2239,13 +2317,14 @@ public function listUserLoginsWithHttpInfo($org_id, $user_id, $page = null, $per try { $response = $this->client->send($request, $options); } catch (RequestException $e) { + $eResponse = $this->getExceptionResponse($e); throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), - $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? (string) $e->getResponse()->getBody() : null + $eResponse ? $eResponse->getHeaders() : null, + $eResponse ? (string) $eResponse->getBody() : null ); - } catch (ConnectException $e) { + } catch (NetworkExceptionInterface $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), @@ -2366,7 +2445,15 @@ function ($response) use ($returnType) { ]; }, function ($exception) { - $response = $exception->getResponse(); + $response = $this->getExceptionResponse($exception); + if ($response === null) { + throw new ApiException( + "[{$exception->getCode()}] {$exception->getMessage()}", + (int) $exception->getCode(), + null, + null + ); + } $statusCode = $response->getStatusCode(); throw new ApiException( sprintf( @@ -2456,7 +2543,7 @@ public function listUserLoginsRequest($org_id, $user_id, $page = null, $per_page // path params if ($org_id !== null) { $resourcePath = str_replace( - '{' . 'org_id' . '}', + '{org_id}', ObjectSerializer::toPathValue($org_id), $resourcePath ); @@ -2464,7 +2551,7 @@ public function listUserLoginsRequest($org_id, $user_id, $page = null, $per_page // path params if ($user_id !== null) { $resourcePath = str_replace( - '{' . 'user_id' . '}', + '{user_id}', ObjectSerializer::toPathValue($user_id), $resourcePath ); @@ -2495,7 +2582,11 @@ public function listUserLoginsRequest($org_id, $user_id, $page = null, $per_page } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + try { + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + } catch (\JsonException $e) { + throw new \InvalidArgumentException('json_encode error: ' . $e->getMessage(), 0, $e); + } } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -2555,6 +2646,21 @@ protected function createHttpClientOption() return $options; } + /** + * Returns the response attached to a Guzzle exception, if there is one. + * + * Guzzle 7 exposes getResponse() on RequestException, while Guzzle 8 only + * exposes it on ResponseException and its subclasses. + * + * @param \Throwable $exception + * + * @return ResponseInterface|null + */ + private function getExceptionResponse(\Throwable $exception): ?ResponseInterface + { + return method_exists($exception, 'getResponse') ? $exception->getResponse() : null; + } + private function handleResponseWithDataType( string $dataType, RequestInterface $request, diff --git a/lib/TeamAdmin/AddGroup200Response.php b/lib/TeamAdmin/AddGroup200Response.php index 5640cf12..3dedaf81 100644 --- a/lib/TeamAdmin/AddGroup200Response.php +++ b/lib/TeamAdmin/AddGroup200Response.php @@ -44,17 +44,17 @@ class AddGroup200Response implements ModelInterface, ArrayAccess, \JsonSerializa public const DISCRIMINATOR = null; /** - * The original name of the model. - * - * @var string - */ + * The original name of the model. + * + * @var string + */ protected static $openAPIModelName = 'addGroup_200_response'; /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ protected static $openAPITypes = [ 'id' => 'int', 'group_name' => 'string', @@ -65,12 +65,12 @@ class AddGroup200Response implements ModelInterface, ArrayAccess, \JsonSerializa ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - * @phpstan-var array - * @psalm-var array - */ + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ protected static $openAPIFormats = [ 'id' => null, 'group_name' => null, @@ -81,10 +81,10 @@ class AddGroup200Response implements ModelInterface, ArrayAccess, \JsonSerializa ]; /** - * Array of nullable properties. Used for (de)serialization - * - * @var boolean[] - */ + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ protected static array $openAPINullables = [ 'id' => false, 'group_name' => false, @@ -95,10 +95,10 @@ class AddGroup200Response implements ModelInterface, ArrayAccess, \JsonSerializa ]; /** - * If a nullable field gets set to null, insert it here - * - * @var boolean[] - */ + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ protected array $openAPINullablesSetToNull = []; /** @@ -282,14 +282,14 @@ public function __construct(?array $data = null) } /** - * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName - * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the - * $this->openAPINullablesSetToNull array - * - * @param string $variableName - * @param array $fields - * @param mixed $defaultValue - */ + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ private function setIfExists(string $variableName, array $fields, $defaultValue): void { if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { diff --git a/lib/TeamAdmin/AddUser200Response.php b/lib/TeamAdmin/AddUser200Response.php index 85cf142e..119ac7cd 100644 --- a/lib/TeamAdmin/AddUser200Response.php +++ b/lib/TeamAdmin/AddUser200Response.php @@ -44,17 +44,17 @@ class AddUser200Response implements ModelInterface, ArrayAccess, \JsonSerializab public const DISCRIMINATOR = null; /** - * The original name of the model. - * - * @var string - */ + * The original name of the model. + * + * @var string + */ protected static $openAPIModelName = 'addUser_200_response'; /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ protected static $openAPITypes = [ 'id' => 'int', 'is_active' => 'bool', @@ -69,12 +69,12 @@ class AddUser200Response implements ModelInterface, ArrayAccess, \JsonSerializab ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - * @phpstan-var array - * @psalm-var array - */ + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ protected static $openAPIFormats = [ 'id' => null, 'is_active' => null, @@ -89,10 +89,10 @@ class AddUser200Response implements ModelInterface, ArrayAccess, \JsonSerializab ]; /** - * Array of nullable properties. Used for (de)serialization - * - * @var boolean[] - */ + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ protected static array $openAPINullables = [ 'id' => false, 'is_active' => false, @@ -107,10 +107,10 @@ class AddUser200Response implements ModelInterface, ArrayAccess, \JsonSerializab ]; /** - * If a nullable field gets set to null, insert it here - * - * @var boolean[] - */ + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ protected array $openAPINullablesSetToNull = []; /** @@ -310,14 +310,14 @@ public function __construct(?array $data = null) } /** - * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName - * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the - * $this->openAPINullablesSetToNull array - * - * @param string $variableName - * @param array $fields - * @param mixed $defaultValue - */ + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ private function setIfExists(string $variableName, array $fields, $defaultValue): void { if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { diff --git a/lib/TeamAdmin/BasesApi.php b/lib/TeamAdmin/BasesApi.php index 98df3758..f87d9a5f 100644 --- a/lib/TeamAdmin/BasesApi.php +++ b/lib/TeamAdmin/BasesApi.php @@ -28,11 +28,11 @@ use GuzzleHttp\Client; use GuzzleHttp\ClientInterface; -use GuzzleHttp\Exception\ConnectException; use GuzzleHttp\Exception\RequestException; use GuzzleHttp\Psr7\MultipartStream; use GuzzleHttp\Psr7\Request; use GuzzleHttp\RequestOptions; +use Psr\Http\Client\NetworkExceptionInterface; use Psr\Http\Message\RequestInterface; use Psr\Http\Message\ResponseInterface; use SeaTable\Client\ApiException; @@ -199,13 +199,14 @@ public function clearTeamTrashBinWithHttpInfo($org_id, string $contentType = sel try { $response = $this->client->send($request, $options); } catch (RequestException $e) { + $eResponse = $this->getExceptionResponse($e); throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), - $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? (string) $e->getResponse()->getBody() : null + $eResponse ? $eResponse->getHeaders() : null, + $eResponse ? (string) $eResponse->getBody() : null ); - } catch (ConnectException $e) { + } catch (NetworkExceptionInterface $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), @@ -320,7 +321,15 @@ function ($response) use ($returnType) { ]; }, function ($exception) { - $response = $exception->getResponse(); + $response = $this->getExceptionResponse($exception); + if ($response === null) { + throw new ApiException( + "[{$exception->getCode()}] {$exception->getMessage()}", + (int) $exception->getCode(), + null, + null + ); + } $statusCode = $response->getStatusCode(); throw new ApiException( sprintf( @@ -371,7 +380,7 @@ public function clearTeamTrashBinRequest($org_id, string $contentType = self::co // path params if ($org_id !== null) { $resourcePath = str_replace( - '{' . 'org_id' . '}', + '{org_id}', ObjectSerializer::toPathValue($org_id), $resourcePath ); @@ -402,7 +411,11 @@ public function clearTeamTrashBinRequest($org_id, string $contentType = self::co } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + try { + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + } catch (\JsonException $e) { + throw new \InvalidArgumentException('json_encode error: ' . $e->getMessage(), 0, $e); + } } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -478,13 +491,14 @@ public function deleteApiTokenWithHttpInfo($org_id, $base_uuid, $app_name, strin try { $response = $this->client->send($request, $options); } catch (RequestException $e) { + $eResponse = $this->getExceptionResponse($e); throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), - $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? (string) $e->getResponse()->getBody() : null + $eResponse ? $eResponse->getHeaders() : null, + $eResponse ? (string) $eResponse->getBody() : null ); - } catch (ConnectException $e) { + } catch (NetworkExceptionInterface $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), @@ -603,7 +617,15 @@ function ($response) use ($returnType) { ]; }, function ($exception) { - $response = $exception->getResponse(); + $response = $this->getExceptionResponse($exception); + if ($response === null) { + throw new ApiException( + "[{$exception->getCode()}] {$exception->getMessage()}", + (int) $exception->getCode(), + null, + null + ); + } $statusCode = $response->getStatusCode(); throw new ApiException( sprintf( @@ -673,7 +695,7 @@ public function deleteApiTokenRequest($org_id, $base_uuid, $app_name, string $co // path params if ($org_id !== null) { $resourcePath = str_replace( - '{' . 'org_id' . '}', + '{org_id}', ObjectSerializer::toPathValue($org_id), $resourcePath ); @@ -681,7 +703,7 @@ public function deleteApiTokenRequest($org_id, $base_uuid, $app_name, string $co // path params if ($base_uuid !== null) { $resourcePath = str_replace( - '{' . 'base_uuid' . '}', + '{base_uuid}', ObjectSerializer::toPathValue($base_uuid), $resourcePath ); @@ -689,7 +711,7 @@ public function deleteApiTokenRequest($org_id, $base_uuid, $app_name, string $co // path params if ($app_name !== null) { $resourcePath = str_replace( - '{' . 'app_name' . '}', + '{app_name}', ObjectSerializer::toPathValue($app_name), $resourcePath ); @@ -720,7 +742,11 @@ public function deleteApiTokenRequest($org_id, $base_uuid, $app_name, string $co } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + try { + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + } catch (\JsonException $e) { + throw new \InvalidArgumentException('json_encode error: ' . $e->getMessage(), 0, $e); + } } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -794,13 +820,14 @@ public function deleteBaseWithHttpInfo($org_id, $base_uuid, string $contentType try { $response = $this->client->send($request, $options); } catch (RequestException $e) { + $eResponse = $this->getExceptionResponse($e); throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), - $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? (string) $e->getResponse()->getBody() : null + $eResponse ? $eResponse->getHeaders() : null, + $eResponse ? (string) $eResponse->getBody() : null ); - } catch (ConnectException $e) { + } catch (NetworkExceptionInterface $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), @@ -917,7 +944,15 @@ function ($response) use ($returnType) { ]; }, function ($exception) { - $response = $exception->getResponse(); + $response = $this->getExceptionResponse($exception); + if ($response === null) { + throw new ApiException( + "[{$exception->getCode()}] {$exception->getMessage()}", + (int) $exception->getCode(), + null, + null + ); + } $statusCode = $response->getStatusCode(); throw new ApiException( sprintf( @@ -979,7 +1014,7 @@ public function deleteBaseRequest($org_id, $base_uuid, string $contentType = sel // path params if ($org_id !== null) { $resourcePath = str_replace( - '{' . 'org_id' . '}', + '{org_id}', ObjectSerializer::toPathValue($org_id), $resourcePath ); @@ -987,7 +1022,7 @@ public function deleteBaseRequest($org_id, $base_uuid, string $contentType = sel // path params if ($base_uuid !== null) { $resourcePath = str_replace( - '{' . 'base_uuid' . '}', + '{base_uuid}', ObjectSerializer::toPathValue($base_uuid), $resourcePath ); @@ -1018,7 +1053,11 @@ public function deleteBaseRequest($org_id, $base_uuid, string $contentType = sel } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + try { + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + } catch (\JsonException $e) { + throw new \InvalidArgumentException('json_encode error: ' . $e->getMessage(), 0, $e); + } } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -1092,13 +1131,14 @@ public function getBaseWithHttpInfo($org_id, $base_uuid, string $contentType = s try { $response = $this->client->send($request, $options); } catch (RequestException $e) { + $eResponse = $this->getExceptionResponse($e); throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), - $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? (string) $e->getResponse()->getBody() : null + $eResponse ? $eResponse->getHeaders() : null, + $eResponse ? (string) $eResponse->getBody() : null ); - } catch (ConnectException $e) { + } catch (NetworkExceptionInterface $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), @@ -1215,7 +1255,15 @@ function ($response) use ($returnType) { ]; }, function ($exception) { - $response = $exception->getResponse(); + $response = $this->getExceptionResponse($exception); + if ($response === null) { + throw new ApiException( + "[{$exception->getCode()}] {$exception->getMessage()}", + (int) $exception->getCode(), + null, + null + ); + } $statusCode = $response->getStatusCode(); throw new ApiException( sprintf( @@ -1277,7 +1325,7 @@ public function getBaseRequest($org_id, $base_uuid, string $contentType = self:: // path params if ($org_id !== null) { $resourcePath = str_replace( - '{' . 'org_id' . '}', + '{org_id}', ObjectSerializer::toPathValue($org_id), $resourcePath ); @@ -1285,7 +1333,7 @@ public function getBaseRequest($org_id, $base_uuid, string $contentType = self:: // path params if ($base_uuid !== null) { $resourcePath = str_replace( - '{' . 'base_uuid' . '}', + '{base_uuid}', ObjectSerializer::toPathValue($base_uuid), $resourcePath ); @@ -1316,7 +1364,11 @@ public function getBaseRequest($org_id, $base_uuid, string $contentType = self:: } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + try { + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + } catch (\JsonException $e) { + throw new \InvalidArgumentException('json_encode error: ' . $e->getMessage(), 0, $e); + } } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -1390,13 +1442,14 @@ public function listApiTokensWithHttpInfo($org_id, $base_uuid, string $contentTy try { $response = $this->client->send($request, $options); } catch (RequestException $e) { + $eResponse = $this->getExceptionResponse($e); throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), - $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? (string) $e->getResponse()->getBody() : null + $eResponse ? $eResponse->getHeaders() : null, + $eResponse ? (string) $eResponse->getBody() : null ); - } catch (ConnectException $e) { + } catch (NetworkExceptionInterface $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), @@ -1513,7 +1566,15 @@ function ($response) use ($returnType) { ]; }, function ($exception) { - $response = $exception->getResponse(); + $response = $this->getExceptionResponse($exception); + if ($response === null) { + throw new ApiException( + "[{$exception->getCode()}] {$exception->getMessage()}", + (int) $exception->getCode(), + null, + null + ); + } $statusCode = $response->getStatusCode(); throw new ApiException( sprintf( @@ -1575,7 +1636,7 @@ public function listApiTokensRequest($org_id, $base_uuid, string $contentType = // path params if ($org_id !== null) { $resourcePath = str_replace( - '{' . 'org_id' . '}', + '{org_id}', ObjectSerializer::toPathValue($org_id), $resourcePath ); @@ -1583,7 +1644,7 @@ public function listApiTokensRequest($org_id, $base_uuid, string $contentType = // path params if ($base_uuid !== null) { $resourcePath = str_replace( - '{' . 'base_uuid' . '}', + '{base_uuid}', ObjectSerializer::toPathValue($base_uuid), $resourcePath ); @@ -1614,7 +1675,11 @@ public function listApiTokensRequest($org_id, $base_uuid, string $contentType = } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + try { + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + } catch (\JsonException $e) { + throw new \InvalidArgumentException('json_encode error: ' . $e->getMessage(), 0, $e); + } } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -1690,13 +1755,14 @@ public function listApiTokensOfAllBasesWithHttpInfo($org_id, $page = null, $per_ try { $response = $this->client->send($request, $options); } catch (RequestException $e) { + $eResponse = $this->getExceptionResponse($e); throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), - $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? (string) $e->getResponse()->getBody() : null + $eResponse ? $eResponse->getHeaders() : null, + $eResponse ? (string) $eResponse->getBody() : null ); - } catch (ConnectException $e) { + } catch (NetworkExceptionInterface $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), @@ -1815,7 +1881,15 @@ function ($response) use ($returnType) { ]; }, function ($exception) { - $response = $exception->getResponse(); + $response = $this->getExceptionResponse($exception); + if ($response === null) { + throw new ApiException( + "[{$exception->getCode()}] {$exception->getMessage()}", + (int) $exception->getCode(), + null, + null + ); + } $statusCode = $response->getStatusCode(); throw new ApiException( sprintf( @@ -1894,7 +1968,7 @@ public function listApiTokensOfAllBasesRequest($org_id, $page = null, $per_page // path params if ($org_id !== null) { $resourcePath = str_replace( - '{' . 'org_id' . '}', + '{org_id}', ObjectSerializer::toPathValue($org_id), $resourcePath ); @@ -1925,7 +1999,11 @@ public function listApiTokensOfAllBasesRequest($org_id, $page = null, $per_page } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + try { + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + } catch (\JsonException $e) { + throw new \InvalidArgumentException('json_encode error: ' . $e->getMessage(), 0, $e); + } } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -1999,13 +2077,14 @@ public function listBaseSharingsWithHttpInfo($org_id, $base_uuid, string $conten try { $response = $this->client->send($request, $options); } catch (RequestException $e) { + $eResponse = $this->getExceptionResponse($e); throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), - $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? (string) $e->getResponse()->getBody() : null + $eResponse ? $eResponse->getHeaders() : null, + $eResponse ? (string) $eResponse->getBody() : null ); - } catch (ConnectException $e) { + } catch (NetworkExceptionInterface $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), @@ -2122,7 +2201,15 @@ function ($response) use ($returnType) { ]; }, function ($exception) { - $response = $exception->getResponse(); + $response = $this->getExceptionResponse($exception); + if ($response === null) { + throw new ApiException( + "[{$exception->getCode()}] {$exception->getMessage()}", + (int) $exception->getCode(), + null, + null + ); + } $statusCode = $response->getStatusCode(); throw new ApiException( sprintf( @@ -2184,7 +2271,7 @@ public function listBaseSharingsRequest($org_id, $base_uuid, string $contentType // path params if ($org_id !== null) { $resourcePath = str_replace( - '{' . 'org_id' . '}', + '{org_id}', ObjectSerializer::toPathValue($org_id), $resourcePath ); @@ -2192,7 +2279,7 @@ public function listBaseSharingsRequest($org_id, $base_uuid, string $contentType // path params if ($base_uuid !== null) { $resourcePath = str_replace( - '{' . 'base_uuid' . '}', + '{base_uuid}', ObjectSerializer::toPathValue($base_uuid), $resourcePath ); @@ -2223,7 +2310,11 @@ public function listBaseSharingsRequest($org_id, $base_uuid, string $contentType } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + try { + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + } catch (\JsonException $e) { + throw new \InvalidArgumentException('json_encode error: ' . $e->getMessage(), 0, $e); + } } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -2299,13 +2390,14 @@ public function listBasesWithHttpInfo($org_id, $page = null, $per_page = null, s try { $response = $this->client->send($request, $options); } catch (RequestException $e) { + $eResponse = $this->getExceptionResponse($e); throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), - $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? (string) $e->getResponse()->getBody() : null + $eResponse ? $eResponse->getHeaders() : null, + $eResponse ? (string) $eResponse->getBody() : null ); - } catch (ConnectException $e) { + } catch (NetworkExceptionInterface $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), @@ -2424,7 +2516,15 @@ function ($response) use ($returnType) { ]; }, function ($exception) { - $response = $exception->getResponse(); + $response = $this->getExceptionResponse($exception); + if ($response === null) { + throw new ApiException( + "[{$exception->getCode()}] {$exception->getMessage()}", + (int) $exception->getCode(), + null, + null + ); + } $statusCode = $response->getStatusCode(); throw new ApiException( sprintf( @@ -2503,7 +2603,7 @@ public function listBasesRequest($org_id, $page = null, $per_page = null, string // path params if ($org_id !== null) { $resourcePath = str_replace( - '{' . 'org_id' . '}', + '{org_id}', ObjectSerializer::toPathValue($org_id), $resourcePath ); @@ -2534,7 +2634,11 @@ public function listBasesRequest($org_id, $page = null, $per_page = null, string } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + try { + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + } catch (\JsonException $e) { + throw new \InvalidArgumentException('json_encode error: ' . $e->getMessage(), 0, $e); + } } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -2612,13 +2716,14 @@ public function listBasesSharedToUserWithHttpInfo($org_id, $user_id, $page = nul try { $response = $this->client->send($request, $options); } catch (RequestException $e) { + $eResponse = $this->getExceptionResponse($e); throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), - $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? (string) $e->getResponse()->getBody() : null + $eResponse ? $eResponse->getHeaders() : null, + $eResponse ? (string) $eResponse->getBody() : null ); - } catch (ConnectException $e) { + } catch (NetworkExceptionInterface $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), @@ -2739,7 +2844,15 @@ function ($response) use ($returnType) { ]; }, function ($exception) { - $response = $exception->getResponse(); + $response = $this->getExceptionResponse($exception); + if ($response === null) { + throw new ApiException( + "[{$exception->getCode()}] {$exception->getMessage()}", + (int) $exception->getCode(), + null, + null + ); + } $statusCode = $response->getStatusCode(); throw new ApiException( sprintf( @@ -2829,7 +2942,7 @@ public function listBasesSharedToUserRequest($org_id, $user_id, $page = null, $p // path params if ($org_id !== null) { $resourcePath = str_replace( - '{' . 'org_id' . '}', + '{org_id}', ObjectSerializer::toPathValue($org_id), $resourcePath ); @@ -2837,7 +2950,7 @@ public function listBasesSharedToUserRequest($org_id, $user_id, $page = null, $p // path params if ($user_id !== null) { $resourcePath = str_replace( - '{' . 'user_id' . '}', + '{user_id}', ObjectSerializer::toPathValue($user_id), $resourcePath ); @@ -2868,7 +2981,11 @@ public function listBasesSharedToUserRequest($org_id, $user_id, $page = null, $p } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + try { + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + } catch (\JsonException $e) { + throw new \InvalidArgumentException('json_encode error: ' . $e->getMessage(), 0, $e); + } } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -2944,13 +3061,14 @@ public function listTrashBasesWithHttpInfo($org_id, $page = null, $per_page = nu try { $response = $this->client->send($request, $options); } catch (RequestException $e) { + $eResponse = $this->getExceptionResponse($e); throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), - $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? (string) $e->getResponse()->getBody() : null + $eResponse ? $eResponse->getHeaders() : null, + $eResponse ? (string) $eResponse->getBody() : null ); - } catch (ConnectException $e) { + } catch (NetworkExceptionInterface $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), @@ -3069,7 +3187,15 @@ function ($response) use ($returnType) { ]; }, function ($exception) { - $response = $exception->getResponse(); + $response = $this->getExceptionResponse($exception); + if ($response === null) { + throw new ApiException( + "[{$exception->getCode()}] {$exception->getMessage()}", + (int) $exception->getCode(), + null, + null + ); + } $statusCode = $response->getStatusCode(); throw new ApiException( sprintf( @@ -3148,7 +3274,7 @@ public function listTrashBasesRequest($org_id, $page = null, $per_page = null, s // path params if ($org_id !== null) { $resourcePath = str_replace( - '{' . 'org_id' . '}', + '{org_id}', ObjectSerializer::toPathValue($org_id), $resourcePath ); @@ -3179,7 +3305,11 @@ public function listTrashBasesRequest($org_id, $page = null, $per_page = null, s } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + try { + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + } catch (\JsonException $e) { + throw new \InvalidArgumentException('json_encode error: ' . $e->getMessage(), 0, $e); + } } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -3257,13 +3387,14 @@ public function listUsersBasesWithHttpInfo($org_id, $user_id, $page = null, $per try { $response = $this->client->send($request, $options); } catch (RequestException $e) { + $eResponse = $this->getExceptionResponse($e); throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), - $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? (string) $e->getResponse()->getBody() : null + $eResponse ? $eResponse->getHeaders() : null, + $eResponse ? (string) $eResponse->getBody() : null ); - } catch (ConnectException $e) { + } catch (NetworkExceptionInterface $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), @@ -3384,7 +3515,15 @@ function ($response) use ($returnType) { ]; }, function ($exception) { - $response = $exception->getResponse(); + $response = $this->getExceptionResponse($exception); + if ($response === null) { + throw new ApiException( + "[{$exception->getCode()}] {$exception->getMessage()}", + (int) $exception->getCode(), + null, + null + ); + } $statusCode = $response->getStatusCode(); throw new ApiException( sprintf( @@ -3474,7 +3613,7 @@ public function listUsersBasesRequest($org_id, $user_id, $page = null, $per_page // path params if ($org_id !== null) { $resourcePath = str_replace( - '{' . 'org_id' . '}', + '{org_id}', ObjectSerializer::toPathValue($org_id), $resourcePath ); @@ -3482,7 +3621,7 @@ public function listUsersBasesRequest($org_id, $user_id, $page = null, $per_page // path params if ($user_id !== null) { $resourcePath = str_replace( - '{' . 'user_id' . '}', + '{user_id}', ObjectSerializer::toPathValue($user_id), $resourcePath ); @@ -3513,7 +3652,11 @@ public function listUsersBasesRequest($org_id, $user_id, $page = null, $per_page } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + try { + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + } catch (\JsonException $e) { + throw new \InvalidArgumentException('json_encode error: ' . $e->getMessage(), 0, $e); + } } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -3587,13 +3730,14 @@ public function restoreBaseFromTrashWithHttpInfo($org_id, $base_uuid, string $co try { $response = $this->client->send($request, $options); } catch (RequestException $e) { + $eResponse = $this->getExceptionResponse($e); throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), - $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? (string) $e->getResponse()->getBody() : null + $eResponse ? $eResponse->getHeaders() : null, + $eResponse ? (string) $eResponse->getBody() : null ); - } catch (ConnectException $e) { + } catch (NetworkExceptionInterface $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), @@ -3710,7 +3854,15 @@ function ($response) use ($returnType) { ]; }, function ($exception) { - $response = $exception->getResponse(); + $response = $this->getExceptionResponse($exception); + if ($response === null) { + throw new ApiException( + "[{$exception->getCode()}] {$exception->getMessage()}", + (int) $exception->getCode(), + null, + null + ); + } $statusCode = $response->getStatusCode(); throw new ApiException( sprintf( @@ -3772,7 +3924,7 @@ public function restoreBaseFromTrashRequest($org_id, $base_uuid, string $content // path params if ($org_id !== null) { $resourcePath = str_replace( - '{' . 'org_id' . '}', + '{org_id}', ObjectSerializer::toPathValue($org_id), $resourcePath ); @@ -3780,7 +3932,7 @@ public function restoreBaseFromTrashRequest($org_id, $base_uuid, string $content // path params if ($base_uuid !== null) { $resourcePath = str_replace( - '{' . 'base_uuid' . '}', + '{base_uuid}', ObjectSerializer::toPathValue($base_uuid), $resourcePath ); @@ -3811,7 +3963,11 @@ public function restoreBaseFromTrashRequest($org_id, $base_uuid, string $content } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + try { + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + } catch (\JsonException $e) { + throw new \InvalidArgumentException('json_encode error: ' . $e->getMessage(), 0, $e); + } } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -3885,13 +4041,14 @@ public function searchBaseWithHttpInfo($org_id, $query = null, string $contentTy try { $response = $this->client->send($request, $options); } catch (RequestException $e) { + $eResponse = $this->getExceptionResponse($e); throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), - $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? (string) $e->getResponse()->getBody() : null + $eResponse ? $eResponse->getHeaders() : null, + $eResponse ? (string) $eResponse->getBody() : null ); - } catch (ConnectException $e) { + } catch (NetworkExceptionInterface $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), @@ -4008,7 +4165,15 @@ function ($response) use ($returnType) { ]; }, function ($exception) { - $response = $exception->getResponse(); + $response = $this->getExceptionResponse($exception); + if ($response === null) { + throw new ApiException( + "[{$exception->getCode()}] {$exception->getMessage()}", + (int) $exception->getCode(), + null, + null + ); + } $statusCode = $response->getStatusCode(); throw new ApiException( sprintf( @@ -4070,7 +4235,7 @@ public function searchBaseRequest($org_id, $query = null, string $contentType = // path params if ($org_id !== null) { $resourcePath = str_replace( - '{' . 'org_id' . '}', + '{org_id}', ObjectSerializer::toPathValue($org_id), $resourcePath ); @@ -4101,7 +4266,11 @@ public function searchBaseRequest($org_id, $query = null, string $contentType = } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + try { + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + } catch (\JsonException $e) { + throw new \InvalidArgumentException('json_encode error: ' . $e->getMessage(), 0, $e); + } } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -4161,6 +4330,21 @@ protected function createHttpClientOption() return $options; } + /** + * Returns the response attached to a Guzzle exception, if there is one. + * + * Guzzle 7 exposes getResponse() on RequestException, while Guzzle 8 only + * exposes it on ResponseException and its subclasses. + * + * @param \Throwable $exception + * + * @return ResponseInterface|null + */ + private function getExceptionResponse(\Throwable $exception): ?ResponseInterface + { + return method_exists($exception, 'getResponse') ? $exception->getResponse() : null; + } + private function handleResponseWithDataType( string $dataType, RequestInterface $request, diff --git a/lib/TeamAdmin/CustomizingApi.php b/lib/TeamAdmin/CustomizingApi.php index 715cb09c..d380d9e5 100644 --- a/lib/TeamAdmin/CustomizingApi.php +++ b/lib/TeamAdmin/CustomizingApi.php @@ -28,11 +28,11 @@ use GuzzleHttp\Client; use GuzzleHttp\ClientInterface; -use GuzzleHttp\Exception\ConnectException; use GuzzleHttp\Exception\RequestException; use GuzzleHttp\Psr7\MultipartStream; use GuzzleHttp\Psr7\Request; use GuzzleHttp\RequestOptions; +use Psr\Http\Client\NetworkExceptionInterface; use Psr\Http\Message\RequestInterface; use Psr\Http\Message\ResponseInterface; use SeaTable\Client\ApiException; @@ -168,13 +168,14 @@ public function deleteTeamLogoWithHttpInfo($org_id, string $contentType = self:: try { $response = $this->client->send($request, $options); } catch (RequestException $e) { + $eResponse = $this->getExceptionResponse($e); throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), - $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? (string) $e->getResponse()->getBody() : null + $eResponse ? $eResponse->getHeaders() : null, + $eResponse ? (string) $eResponse->getBody() : null ); - } catch (ConnectException $e) { + } catch (NetworkExceptionInterface $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), @@ -240,7 +241,15 @@ function ($response) use ($returnType) { return [null, $response->getStatusCode(), $response->getHeaders()]; }, function ($exception) { - $response = $exception->getResponse(); + $response = $this->getExceptionResponse($exception); + if ($response === null) { + throw new ApiException( + "[{$exception->getCode()}] {$exception->getMessage()}", + (int) $exception->getCode(), + null, + null + ); + } $statusCode = $response->getStatusCode(); throw new ApiException( sprintf( @@ -291,7 +300,7 @@ public function deleteTeamLogoRequest($org_id, string $contentType = self::conte // path params if ($org_id !== null) { $resourcePath = str_replace( - '{' . 'org_id' . '}', + '{org_id}', ObjectSerializer::toPathValue($org_id), $resourcePath ); @@ -322,7 +331,11 @@ public function deleteTeamLogoRequest($org_id, string $contentType = self::conte } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + try { + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + } catch (\JsonException $e) { + throw new \InvalidArgumentException('json_encode error: ' . $e->getMessage(), 0, $e); + } } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -394,13 +407,14 @@ public function getTeamLogoWithHttpInfo($org_id, string $contentType = self::con try { $response = $this->client->send($request, $options); } catch (RequestException $e) { + $eResponse = $this->getExceptionResponse($e); throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), - $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? (string) $e->getResponse()->getBody() : null + $eResponse ? $eResponse->getHeaders() : null, + $eResponse ? (string) $eResponse->getBody() : null ); - } catch (ConnectException $e) { + } catch (NetworkExceptionInterface $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), @@ -515,7 +529,15 @@ function ($response) use ($returnType) { ]; }, function ($exception) { - $response = $exception->getResponse(); + $response = $this->getExceptionResponse($exception); + if ($response === null) { + throw new ApiException( + "[{$exception->getCode()}] {$exception->getMessage()}", + (int) $exception->getCode(), + null, + null + ); + } $statusCode = $response->getStatusCode(); throw new ApiException( sprintf( @@ -566,7 +588,7 @@ public function getTeamLogoRequest($org_id, string $contentType = self::contentT // path params if ($org_id !== null) { $resourcePath = str_replace( - '{' . 'org_id' . '}', + '{org_id}', ObjectSerializer::toPathValue($org_id), $resourcePath ); @@ -597,7 +619,11 @@ public function getTeamLogoRequest($org_id, string $contentType = self::contentT } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + try { + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + } catch (\JsonException $e) { + throw new \InvalidArgumentException('json_encode error: ' . $e->getMessage(), 0, $e); + } } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -670,13 +696,14 @@ public function updateTeamLogoWithHttpInfo($org_id, $file = null, string $conten try { $response = $this->client->send($request, $options); } catch (RequestException $e) { + $eResponse = $this->getExceptionResponse($e); throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), - $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? (string) $e->getResponse()->getBody() : null + $eResponse ? $eResponse->getHeaders() : null, + $eResponse ? (string) $eResponse->getBody() : null ); - } catch (ConnectException $e) { + } catch (NetworkExceptionInterface $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), @@ -744,7 +771,15 @@ function ($response) use ($returnType) { return [null, $response->getStatusCode(), $response->getHeaders()]; }, function ($exception) { - $response = $exception->getResponse(); + $response = $this->getExceptionResponse($exception); + if ($response === null) { + throw new ApiException( + "[{$exception->getCode()}] {$exception->getMessage()}", + (int) $exception->getCode(), + null, + null + ); + } $statusCode = $response->getStatusCode(); throw new ApiException( sprintf( @@ -797,7 +832,7 @@ public function updateTeamLogoRequest($org_id, $file = null, string $contentType // path params if ($org_id !== null) { $resourcePath = str_replace( - '{' . 'org_id' . '}', + '{org_id}', ObjectSerializer::toPathValue($org_id), $resourcePath ); @@ -838,7 +873,11 @@ public function updateTeamLogoRequest($org_id, $file = null, string $contentType } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + try { + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + } catch (\JsonException $e) { + throw new \InvalidArgumentException('json_encode error: ' . $e->getMessage(), 0, $e); + } } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -898,6 +937,21 @@ protected function createHttpClientOption() return $options; } + /** + * Returns the response attached to a Guzzle exception, if there is one. + * + * Guzzle 7 exposes getResponse() on RequestException, while Guzzle 8 only + * exposes it on ResponseException and its subclasses. + * + * @param \Throwable $exception + * + * @return ResponseInterface|null + */ + private function getExceptionResponse(\Throwable $exception): ?ResponseInterface + { + return method_exists($exception, 'getResponse') ? $exception->getResponse() : null; + } + private function handleResponseWithDataType( string $dataType, RequestInterface $request, diff --git a/lib/TeamAdmin/EnforceTwofactorRequest.php b/lib/TeamAdmin/EnforceTwofactorRequest.php index 9822d0c1..be1e8981 100644 --- a/lib/TeamAdmin/EnforceTwofactorRequest.php +++ b/lib/TeamAdmin/EnforceTwofactorRequest.php @@ -44,46 +44,46 @@ class EnforceTwofactorRequest implements ModelInterface, ArrayAccess, \JsonSeria public const DISCRIMINATOR = null; /** - * The original name of the model. - * - * @var string - */ + * The original name of the model. + * + * @var string + */ protected static $openAPIModelName = 'enforceTwofactor_request'; /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ protected static $openAPITypes = [ 'force_2fa' => 'bool' ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - * @phpstan-var array - * @psalm-var array - */ + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ protected static $openAPIFormats = [ 'force_2fa' => null ]; /** - * Array of nullable properties. Used for (de)serialization - * - * @var boolean[] - */ + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ protected static array $openAPINullables = [ 'force_2fa' => false ]; /** - * If a nullable field gets set to null, insert it here - * - * @var boolean[] - */ + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ protected array $openAPINullablesSetToNull = []; /** @@ -247,14 +247,14 @@ public function __construct(?array $data = null) } /** - * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName - * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the - * $this->openAPINullablesSetToNull array - * - * @param string $variableName - * @param array $fields - * @param mixed $defaultValue - */ + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ private function setIfExists(string $variableName, array $fields, $defaultValue): void { if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { diff --git a/lib/TeamAdmin/GetBase200Response.php b/lib/TeamAdmin/GetBase200Response.php index 4c6a62ca..229b6696 100644 --- a/lib/TeamAdmin/GetBase200Response.php +++ b/lib/TeamAdmin/GetBase200Response.php @@ -44,17 +44,17 @@ class GetBase200Response implements ModelInterface, ArrayAccess, \JsonSerializab public const DISCRIMINATOR = null; /** - * The original name of the model. - * - * @var string - */ + * The original name of the model. + * + * @var string + */ protected static $openAPIModelName = 'getBase_200_response'; /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ protected static $openAPITypes = [ 'id' => 'int', 'workspace_id' => 'int', @@ -76,12 +76,12 @@ class GetBase200Response implements ModelInterface, ArrayAccess, \JsonSerializab ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - * @phpstan-var array - * @psalm-var array - */ + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ protected static $openAPIFormats = [ 'id' => null, 'workspace_id' => null, @@ -103,10 +103,10 @@ class GetBase200Response implements ModelInterface, ArrayAccess, \JsonSerializab ]; /** - * Array of nullable properties. Used for (de)serialization - * - * @var boolean[] - */ + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ protected static array $openAPINullables = [ 'id' => false, 'workspace_id' => false, @@ -128,10 +128,10 @@ class GetBase200Response implements ModelInterface, ArrayAccess, \JsonSerializab ]; /** - * If a nullable field gets set to null, insert it here - * - * @var boolean[] - */ + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ protected array $openAPINullablesSetToNull = []; /** @@ -359,14 +359,14 @@ public function __construct(?array $data = null) } /** - * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName - * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the - * $this->openAPINullablesSetToNull array - * - * @param string $variableName - * @param array $fields - * @param mixed $defaultValue - */ + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ private function setIfExists(string $variableName, array $fields, $defaultValue): void { if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { diff --git a/lib/TeamAdmin/GetTeamInfo200Response.php b/lib/TeamAdmin/GetTeamInfo200Response.php index f4f151e1..336668b0 100644 --- a/lib/TeamAdmin/GetTeamInfo200Response.php +++ b/lib/TeamAdmin/GetTeamInfo200Response.php @@ -44,17 +44,17 @@ class GetTeamInfo200Response implements ModelInterface, ArrayAccess, \JsonSerial public const DISCRIMINATOR = null; /** - * The original name of the model. - * - * @var string - */ + * The original name of the model. + * + * @var string + */ protected static $openAPIModelName = 'getTeamInfo_200_response'; /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ protected static $openAPITypes = [ 'org_id' => 'int', 'org_name' => 'string', @@ -81,12 +81,12 @@ class GetTeamInfo200Response implements ModelInterface, ArrayAccess, \JsonSerial ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - * @phpstan-var array - * @psalm-var array - */ + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ protected static $openAPIFormats = [ 'org_id' => null, 'org_name' => null, @@ -113,10 +113,10 @@ class GetTeamInfo200Response implements ModelInterface, ArrayAccess, \JsonSerial ]; /** - * Array of nullable properties. Used for (de)serialization - * - * @var boolean[] - */ + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ protected static array $openAPINullables = [ 'org_id' => false, 'org_name' => false, @@ -143,10 +143,10 @@ class GetTeamInfo200Response implements ModelInterface, ArrayAccess, \JsonSerial ]; /** - * If a nullable field gets set to null, insert it here - * - * @var boolean[] - */ + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ protected array $openAPINullablesSetToNull = []; /** @@ -394,14 +394,14 @@ public function __construct(?array $data = null) } /** - * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName - * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the - * $this->openAPINullablesSetToNull array - * - * @param string $variableName - * @param array $fields - * @param mixed $defaultValue - */ + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ private function setIfExists(string $variableName, array $fields, $defaultValue): void { if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { diff --git a/lib/TeamAdmin/GetTeamSettings200Response.php b/lib/TeamAdmin/GetTeamSettings200Response.php index e1e7edf4..e641ced9 100644 --- a/lib/TeamAdmin/GetTeamSettings200Response.php +++ b/lib/TeamAdmin/GetTeamSettings200Response.php @@ -44,17 +44,17 @@ class GetTeamSettings200Response implements ModelInterface, ArrayAccess, \JsonSe public const DISCRIMINATOR = null; /** - * The original name of the model. - * - * @var string - */ + * The original name of the model. + * + * @var string + */ protected static $openAPIModelName = 'getTeamSettings_200_response'; /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ protected static $openAPITypes = [ 'enable_force_2fa' => 'bool', 'enable_force_sso_login' => 'bool', @@ -64,12 +64,12 @@ class GetTeamSettings200Response implements ModelInterface, ArrayAccess, \JsonSe ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - * @phpstan-var array - * @psalm-var array - */ + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ protected static $openAPIFormats = [ 'enable_force_2fa' => null, 'enable_force_sso_login' => null, @@ -79,10 +79,10 @@ class GetTeamSettings200Response implements ModelInterface, ArrayAccess, \JsonSe ]; /** - * Array of nullable properties. Used for (de)serialization - * - * @var boolean[] - */ + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ protected static array $openAPINullables = [ 'enable_force_2fa' => false, 'enable_force_sso_login' => false, @@ -92,10 +92,10 @@ class GetTeamSettings200Response implements ModelInterface, ArrayAccess, \JsonSe ]; /** - * If a nullable field gets set to null, insert it here - * - * @var boolean[] - */ + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ protected array $openAPINullablesSetToNull = []; /** @@ -275,14 +275,14 @@ public function __construct(?array $data = null) } /** - * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName - * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the - * $this->openAPINullablesSetToNull array - * - * @param string $variableName - * @param array $fields - * @param mixed $defaultValue - */ + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ private function setIfExists(string $variableName, array $fields, $defaultValue): void { if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { diff --git a/lib/TeamAdmin/GetUser200Response.php b/lib/TeamAdmin/GetUser200Response.php index edd6a3d4..a658524f 100644 --- a/lib/TeamAdmin/GetUser200Response.php +++ b/lib/TeamAdmin/GetUser200Response.php @@ -44,17 +44,17 @@ class GetUser200Response implements ModelInterface, ArrayAccess, \JsonSerializab public const DISCRIMINATOR = null; /** - * The original name of the model. - * - * @var string - */ + * The original name of the model. + * + * @var string + */ protected static $openAPIModelName = 'getUser_200_response'; /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ protected static $openAPITypes = [ 'email' => 'string', 'name' => 'string', @@ -70,12 +70,12 @@ class GetUser200Response implements ModelInterface, ArrayAccess, \JsonSerializab ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - * @phpstan-var array - * @psalm-var array - */ + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ protected static $openAPIFormats = [ 'email' => null, 'name' => null, @@ -91,10 +91,10 @@ class GetUser200Response implements ModelInterface, ArrayAccess, \JsonSerializab ]; /** - * Array of nullable properties. Used for (de)serialization - * - * @var boolean[] - */ + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ protected static array $openAPINullables = [ 'email' => false, 'name' => false, @@ -110,10 +110,10 @@ class GetUser200Response implements ModelInterface, ArrayAccess, \JsonSerializab ]; /** - * If a nullable field gets set to null, insert it here - * - * @var boolean[] - */ + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ protected array $openAPINullablesSetToNull = []; /** @@ -317,14 +317,14 @@ public function __construct(?array $data = null) } /** - * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName - * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the - * $this->openAPINullablesSetToNull array - * - * @param string $variableName - * @param array $fields - * @param mixed $defaultValue - */ + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ private function setIfExists(string $variableName, array $fields, $defaultValue): void { if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { diff --git a/lib/TeamAdmin/GroupsApi.php b/lib/TeamAdmin/GroupsApi.php index bed8db33..1cdc738b 100644 --- a/lib/TeamAdmin/GroupsApi.php +++ b/lib/TeamAdmin/GroupsApi.php @@ -28,11 +28,11 @@ use GuzzleHttp\Client; use GuzzleHttp\ClientInterface; -use GuzzleHttp\Exception\ConnectException; use GuzzleHttp\Exception\RequestException; use GuzzleHttp\Psr7\MultipartStream; use GuzzleHttp\Psr7\Request; use GuzzleHttp\RequestOptions; +use Psr\Http\Client\NetworkExceptionInterface; use Psr\Http\Message\RequestInterface; use Psr\Http\Message\ResponseInterface; use SeaTable\Client\ApiException; @@ -197,13 +197,14 @@ public function addGroupWithHttpInfo($org_id, $group_name = null, $group_owner = try { $response = $this->client->send($request, $options); } catch (RequestException $e) { + $eResponse = $this->getExceptionResponse($e); throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), - $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? (string) $e->getResponse()->getBody() : null + $eResponse ? $eResponse->getHeaders() : null, + $eResponse ? (string) $eResponse->getBody() : null ); - } catch (ConnectException $e) { + } catch (NetworkExceptionInterface $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), @@ -322,7 +323,15 @@ function ($response) use ($returnType) { ]; }, function ($exception) { - $response = $exception->getResponse(); + $response = $this->getExceptionResponse($exception); + if ($response === null) { + throw new ApiException( + "[{$exception->getCode()}] {$exception->getMessage()}", + (int) $exception->getCode(), + null, + null + ); + } $statusCode = $response->getStatusCode(); throw new ApiException( sprintf( @@ -377,7 +386,7 @@ public function addGroupRequest($org_id, $group_name = null, $group_owner = null // path params if ($org_id !== null) { $resourcePath = str_replace( - '{' . 'org_id' . '}', + '{org_id}', ObjectSerializer::toPathValue($org_id), $resourcePath ); @@ -419,7 +428,11 @@ public function addGroupRequest($org_id, $group_name = null, $group_owner = null } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + try { + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + } catch (\JsonException $e) { + throw new \InvalidArgumentException('json_encode error: ' . $e->getMessage(), 0, $e); + } } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -495,13 +508,14 @@ public function addGroupMembersWithHttpInfo($org_id, $group_id, $email = null, s try { $response = $this->client->send($request, $options); } catch (RequestException $e) { + $eResponse = $this->getExceptionResponse($e); throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), - $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? (string) $e->getResponse()->getBody() : null + $eResponse ? $eResponse->getHeaders() : null, + $eResponse ? (string) $eResponse->getBody() : null ); - } catch (ConnectException $e) { + } catch (NetworkExceptionInterface $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), @@ -620,7 +634,15 @@ function ($response) use ($returnType) { ]; }, function ($exception) { - $response = $exception->getResponse(); + $response = $this->getExceptionResponse($exception); + if ($response === null) { + throw new ApiException( + "[{$exception->getCode()}] {$exception->getMessage()}", + (int) $exception->getCode(), + null, + null + ); + } $statusCode = $response->getStatusCode(); throw new ApiException( sprintf( @@ -684,7 +706,7 @@ public function addGroupMembersRequest($org_id, $group_id, $email = null, string // path params if ($org_id !== null) { $resourcePath = str_replace( - '{' . 'org_id' . '}', + '{org_id}', ObjectSerializer::toPathValue($org_id), $resourcePath ); @@ -692,7 +714,7 @@ public function addGroupMembersRequest($org_id, $group_id, $email = null, string // path params if ($group_id !== null) { $resourcePath = str_replace( - '{' . 'group_id' . '}', + '{group_id}', ObjectSerializer::toPathValue($group_id), $resourcePath ); @@ -733,7 +755,11 @@ public function addGroupMembersRequest($org_id, $group_id, $email = null, string } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + try { + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + } catch (\JsonException $e) { + throw new \InvalidArgumentException('json_encode error: ' . $e->getMessage(), 0, $e); + } } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -807,13 +833,14 @@ public function deleteGroupWithHttpInfo($org_id, $group_id, string $contentType try { $response = $this->client->send($request, $options); } catch (RequestException $e) { + $eResponse = $this->getExceptionResponse($e); throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), - $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? (string) $e->getResponse()->getBody() : null + $eResponse ? $eResponse->getHeaders() : null, + $eResponse ? (string) $eResponse->getBody() : null ); - } catch (ConnectException $e) { + } catch (NetworkExceptionInterface $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), @@ -930,7 +957,15 @@ function ($response) use ($returnType) { ]; }, function ($exception) { - $response = $exception->getResponse(); + $response = $this->getExceptionResponse($exception); + if ($response === null) { + throw new ApiException( + "[{$exception->getCode()}] {$exception->getMessage()}", + (int) $exception->getCode(), + null, + null + ); + } $statusCode = $response->getStatusCode(); throw new ApiException( sprintf( @@ -992,7 +1027,7 @@ public function deleteGroupRequest($org_id, $group_id, string $contentType = sel // path params if ($org_id !== null) { $resourcePath = str_replace( - '{' . 'org_id' . '}', + '{org_id}', ObjectSerializer::toPathValue($org_id), $resourcePath ); @@ -1000,7 +1035,7 @@ public function deleteGroupRequest($org_id, $group_id, string $contentType = sel // path params if ($group_id !== null) { $resourcePath = str_replace( - '{' . 'group_id' . '}', + '{group_id}', ObjectSerializer::toPathValue($group_id), $resourcePath ); @@ -1031,7 +1066,11 @@ public function deleteGroupRequest($org_id, $group_id, string $contentType = sel } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + try { + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + } catch (\JsonException $e) { + throw new \InvalidArgumentException('json_encode error: ' . $e->getMessage(), 0, $e); + } } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -1105,13 +1144,14 @@ public function getGroupWithHttpInfo($org_id, $group_id, string $contentType = s try { $response = $this->client->send($request, $options); } catch (RequestException $e) { + $eResponse = $this->getExceptionResponse($e); throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), - $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? (string) $e->getResponse()->getBody() : null + $eResponse ? $eResponse->getHeaders() : null, + $eResponse ? (string) $eResponse->getBody() : null ); - } catch (ConnectException $e) { + } catch (NetworkExceptionInterface $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), @@ -1228,7 +1268,15 @@ function ($response) use ($returnType) { ]; }, function ($exception) { - $response = $exception->getResponse(); + $response = $this->getExceptionResponse($exception); + if ($response === null) { + throw new ApiException( + "[{$exception->getCode()}] {$exception->getMessage()}", + (int) $exception->getCode(), + null, + null + ); + } $statusCode = $response->getStatusCode(); throw new ApiException( sprintf( @@ -1290,7 +1338,7 @@ public function getGroupRequest($org_id, $group_id, string $contentType = self:: // path params if ($org_id !== null) { $resourcePath = str_replace( - '{' . 'org_id' . '}', + '{org_id}', ObjectSerializer::toPathValue($org_id), $resourcePath ); @@ -1298,7 +1346,7 @@ public function getGroupRequest($org_id, $group_id, string $contentType = self:: // path params if ($group_id !== null) { $resourcePath = str_replace( - '{' . 'group_id' . '}', + '{group_id}', ObjectSerializer::toPathValue($group_id), $resourcePath ); @@ -1329,7 +1377,11 @@ public function getGroupRequest($org_id, $group_id, string $contentType = self:: } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + try { + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + } catch (\JsonException $e) { + throw new \InvalidArgumentException('json_encode error: ' . $e->getMessage(), 0, $e); + } } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -1403,13 +1455,14 @@ public function listGroupBasesWithHttpInfo($org_id, $group_id, string $contentTy try { $response = $this->client->send($request, $options); } catch (RequestException $e) { + $eResponse = $this->getExceptionResponse($e); throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), - $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? (string) $e->getResponse()->getBody() : null + $eResponse ? $eResponse->getHeaders() : null, + $eResponse ? (string) $eResponse->getBody() : null ); - } catch (ConnectException $e) { + } catch (NetworkExceptionInterface $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), @@ -1526,7 +1579,15 @@ function ($response) use ($returnType) { ]; }, function ($exception) { - $response = $exception->getResponse(); + $response = $this->getExceptionResponse($exception); + if ($response === null) { + throw new ApiException( + "[{$exception->getCode()}] {$exception->getMessage()}", + (int) $exception->getCode(), + null, + null + ); + } $statusCode = $response->getStatusCode(); throw new ApiException( sprintf( @@ -1588,7 +1649,7 @@ public function listGroupBasesRequest($org_id, $group_id, string $contentType = // path params if ($org_id !== null) { $resourcePath = str_replace( - '{' . 'org_id' . '}', + '{org_id}', ObjectSerializer::toPathValue($org_id), $resourcePath ); @@ -1596,7 +1657,7 @@ public function listGroupBasesRequest($org_id, $group_id, string $contentType = // path params if ($group_id !== null) { $resourcePath = str_replace( - '{' . 'group_id' . '}', + '{group_id}', ObjectSerializer::toPathValue($group_id), $resourcePath ); @@ -1627,7 +1688,11 @@ public function listGroupBasesRequest($org_id, $group_id, string $contentType = } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + try { + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + } catch (\JsonException $e) { + throw new \InvalidArgumentException('json_encode error: ' . $e->getMessage(), 0, $e); + } } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -1701,13 +1766,14 @@ public function listGroupMembersWithHttpInfo($org_id, $group_id, string $content try { $response = $this->client->send($request, $options); } catch (RequestException $e) { + $eResponse = $this->getExceptionResponse($e); throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), - $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? (string) $e->getResponse()->getBody() : null + $eResponse ? $eResponse->getHeaders() : null, + $eResponse ? (string) $eResponse->getBody() : null ); - } catch (ConnectException $e) { + } catch (NetworkExceptionInterface $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), @@ -1824,7 +1890,15 @@ function ($response) use ($returnType) { ]; }, function ($exception) { - $response = $exception->getResponse(); + $response = $this->getExceptionResponse($exception); + if ($response === null) { + throw new ApiException( + "[{$exception->getCode()}] {$exception->getMessage()}", + (int) $exception->getCode(), + null, + null + ); + } $statusCode = $response->getStatusCode(); throw new ApiException( sprintf( @@ -1886,7 +1960,7 @@ public function listGroupMembersRequest($org_id, $group_id, string $contentType // path params if ($org_id !== null) { $resourcePath = str_replace( - '{' . 'org_id' . '}', + '{org_id}', ObjectSerializer::toPathValue($org_id), $resourcePath ); @@ -1894,7 +1968,7 @@ public function listGroupMembersRequest($org_id, $group_id, string $contentType // path params if ($group_id !== null) { $resourcePath = str_replace( - '{' . 'group_id' . '}', + '{group_id}', ObjectSerializer::toPathValue($group_id), $resourcePath ); @@ -1925,7 +1999,11 @@ public function listGroupMembersRequest($org_id, $group_id, string $contentType } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + try { + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + } catch (\JsonException $e) { + throw new \InvalidArgumentException('json_encode error: ' . $e->getMessage(), 0, $e); + } } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -2001,13 +2079,14 @@ public function listGroupsWithHttpInfo($org_id, $page = null, $per_page = null, try { $response = $this->client->send($request, $options); } catch (RequestException $e) { + $eResponse = $this->getExceptionResponse($e); throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), - $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? (string) $e->getResponse()->getBody() : null + $eResponse ? $eResponse->getHeaders() : null, + $eResponse ? (string) $eResponse->getBody() : null ); - } catch (ConnectException $e) { + } catch (NetworkExceptionInterface $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), @@ -2126,7 +2205,15 @@ function ($response) use ($returnType) { ]; }, function ($exception) { - $response = $exception->getResponse(); + $response = $this->getExceptionResponse($exception); + if ($response === null) { + throw new ApiException( + "[{$exception->getCode()}] {$exception->getMessage()}", + (int) $exception->getCode(), + null, + null + ); + } $statusCode = $response->getStatusCode(); throw new ApiException( sprintf( @@ -2205,7 +2292,7 @@ public function listGroupsRequest($org_id, $page = null, $per_page = null, strin // path params if ($org_id !== null) { $resourcePath = str_replace( - '{' . 'org_id' . '}', + '{org_id}', ObjectSerializer::toPathValue($org_id), $resourcePath ); @@ -2236,7 +2323,11 @@ public function listGroupsRequest($org_id, $page = null, $per_page = null, strin } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + try { + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + } catch (\JsonException $e) { + throw new \InvalidArgumentException('json_encode error: ' . $e->getMessage(), 0, $e); + } } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -2312,13 +2403,14 @@ public function orderGroupsWithHttpInfo($group_id = null, $anchor_group_id = nul try { $response = $this->client->send($request, $options); } catch (RequestException $e) { + $eResponse = $this->getExceptionResponse($e); throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), - $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? (string) $e->getResponse()->getBody() : null + $eResponse ? $eResponse->getHeaders() : null, + $eResponse ? (string) $eResponse->getBody() : null ); - } catch (ConnectException $e) { + } catch (NetworkExceptionInterface $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), @@ -2437,7 +2529,15 @@ function ($response) use ($returnType) { ]; }, function ($exception) { - $response = $exception->getResponse(); + $response = $this->getExceptionResponse($exception); + if ($response === null) { + throw new ApiException( + "[{$exception->getCode()}] {$exception->getMessage()}", + (int) $exception->getCode(), + null, + null + ); + } $statusCode = $response->getStatusCode(); throw new ApiException( sprintf( @@ -2518,7 +2618,11 @@ public function orderGroupsRequest($group_id = null, $anchor_group_id = null, $t } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + try { + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + } catch (\JsonException $e) { + throw new \InvalidArgumentException('json_encode error: ' . $e->getMessage(), 0, $e); + } } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -2594,13 +2698,14 @@ public function removeGroupMembersWithHttpInfo($org_id, $group_id, $user_id, str try { $response = $this->client->send($request, $options); } catch (RequestException $e) { + $eResponse = $this->getExceptionResponse($e); throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), - $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? (string) $e->getResponse()->getBody() : null + $eResponse ? $eResponse->getHeaders() : null, + $eResponse ? (string) $eResponse->getBody() : null ); - } catch (ConnectException $e) { + } catch (NetworkExceptionInterface $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), @@ -2719,7 +2824,15 @@ function ($response) use ($returnType) { ]; }, function ($exception) { - $response = $exception->getResponse(); + $response = $this->getExceptionResponse($exception); + if ($response === null) { + throw new ApiException( + "[{$exception->getCode()}] {$exception->getMessage()}", + (int) $exception->getCode(), + null, + null + ); + } $statusCode = $response->getStatusCode(); throw new ApiException( sprintf( @@ -2792,7 +2905,7 @@ public function removeGroupMembersRequest($org_id, $group_id, $user_id, string $ // path params if ($org_id !== null) { $resourcePath = str_replace( - '{' . 'org_id' . '}', + '{org_id}', ObjectSerializer::toPathValue($org_id), $resourcePath ); @@ -2800,7 +2913,7 @@ public function removeGroupMembersRequest($org_id, $group_id, $user_id, string $ // path params if ($group_id !== null) { $resourcePath = str_replace( - '{' . 'group_id' . '}', + '{group_id}', ObjectSerializer::toPathValue($group_id), $resourcePath ); @@ -2808,7 +2921,7 @@ public function removeGroupMembersRequest($org_id, $group_id, $user_id, string $ // path params if ($user_id !== null) { $resourcePath = str_replace( - '{' . 'user_id' . '}', + '{user_id}', ObjectSerializer::toPathValue($user_id), $resourcePath ); @@ -2839,7 +2952,11 @@ public function removeGroupMembersRequest($org_id, $group_id, $user_id, string $ } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + try { + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + } catch (\JsonException $e) { + throw new \InvalidArgumentException('json_encode error: ' . $e->getMessage(), 0, $e); + } } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -2915,13 +3032,14 @@ public function updateGroupWithHttpInfo($org_id, $group_id, $update_group_reques try { $response = $this->client->send($request, $options); } catch (RequestException $e) { + $eResponse = $this->getExceptionResponse($e); throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), - $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? (string) $e->getResponse()->getBody() : null + $eResponse ? $eResponse->getHeaders() : null, + $eResponse ? (string) $eResponse->getBody() : null ); - } catch (ConnectException $e) { + } catch (NetworkExceptionInterface $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), @@ -3040,7 +3158,15 @@ function ($response) use ($returnType) { ]; }, function ($exception) { - $response = $exception->getResponse(); + $response = $this->getExceptionResponse($exception); + if ($response === null) { + throw new ApiException( + "[{$exception->getCode()}] {$exception->getMessage()}", + (int) $exception->getCode(), + null, + null + ); + } $statusCode = $response->getStatusCode(); throw new ApiException( sprintf( @@ -3104,7 +3230,7 @@ public function updateGroupRequest($org_id, $group_id, $update_group_request = n // path params if ($org_id !== null) { $resourcePath = str_replace( - '{' . 'org_id' . '}', + '{org_id}', ObjectSerializer::toPathValue($org_id), $resourcePath ); @@ -3112,7 +3238,7 @@ public function updateGroupRequest($org_id, $group_id, $update_group_request = n // path params if ($group_id !== null) { $resourcePath = str_replace( - '{' . 'group_id' . '}', + '{group_id}', ObjectSerializer::toPathValue($group_id), $resourcePath ); @@ -3129,7 +3255,11 @@ public function updateGroupRequest($org_id, $group_id, $update_group_request = n if (isset($update_group_request)) { if (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the body - $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($update_group_request)); + try { + $httpBody = json_encode(ObjectSerializer::sanitizeForSerialization($update_group_request), JSON_THROW_ON_ERROR); + } catch (\JsonException $e) { + throw new \InvalidArgumentException('json_encode error: ' . $e->getMessage(), 0, $e); + } } else { $httpBody = $update_group_request; } @@ -3150,7 +3280,11 @@ public function updateGroupRequest($org_id, $group_id, $update_group_request = n } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + try { + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + } catch (\JsonException $e) { + throw new \InvalidArgumentException('json_encode error: ' . $e->getMessage(), 0, $e); + } } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -3228,13 +3362,14 @@ public function updateGroupMemberRoleWithHttpInfo($org_id, $group_id, $user_id, try { $response = $this->client->send($request, $options); } catch (RequestException $e) { + $eResponse = $this->getExceptionResponse($e); throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), - $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? (string) $e->getResponse()->getBody() : null + $eResponse ? $eResponse->getHeaders() : null, + $eResponse ? (string) $eResponse->getBody() : null ); - } catch (ConnectException $e) { + } catch (NetworkExceptionInterface $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), @@ -3355,7 +3490,15 @@ function ($response) use ($returnType) { ]; }, function ($exception) { - $response = $exception->getResponse(); + $response = $this->getExceptionResponse($exception); + if ($response === null) { + throw new ApiException( + "[{$exception->getCode()}] {$exception->getMessage()}", + (int) $exception->getCode(), + null, + null + ); + } $statusCode = $response->getStatusCode(); throw new ApiException( sprintf( @@ -3430,7 +3573,7 @@ public function updateGroupMemberRoleRequest($org_id, $group_id, $user_id, $upda // path params if ($org_id !== null) { $resourcePath = str_replace( - '{' . 'org_id' . '}', + '{org_id}', ObjectSerializer::toPathValue($org_id), $resourcePath ); @@ -3438,7 +3581,7 @@ public function updateGroupMemberRoleRequest($org_id, $group_id, $user_id, $upda // path params if ($group_id !== null) { $resourcePath = str_replace( - '{' . 'group_id' . '}', + '{group_id}', ObjectSerializer::toPathValue($group_id), $resourcePath ); @@ -3446,7 +3589,7 @@ public function updateGroupMemberRoleRequest($org_id, $group_id, $user_id, $upda // path params if ($user_id !== null) { $resourcePath = str_replace( - '{' . 'user_id' . '}', + '{user_id}', ObjectSerializer::toPathValue($user_id), $resourcePath ); @@ -3463,7 +3606,11 @@ public function updateGroupMemberRoleRequest($org_id, $group_id, $user_id, $upda if (isset($update_group_member_role_request)) { if (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the body - $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($update_group_member_role_request)); + try { + $httpBody = json_encode(ObjectSerializer::sanitizeForSerialization($update_group_member_role_request), JSON_THROW_ON_ERROR); + } catch (\JsonException $e) { + throw new \InvalidArgumentException('json_encode error: ' . $e->getMessage(), 0, $e); + } } else { $httpBody = $update_group_member_role_request; } @@ -3484,7 +3631,11 @@ public function updateGroupMemberRoleRequest($org_id, $group_id, $user_id, $upda } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + try { + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + } catch (\JsonException $e) { + throw new \InvalidArgumentException('json_encode error: ' . $e->getMessage(), 0, $e); + } } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -3544,6 +3695,21 @@ protected function createHttpClientOption() return $options; } + /** + * Returns the response attached to a Guzzle exception, if there is one. + * + * Guzzle 7 exposes getResponse() on RequestException, while Guzzle 8 only + * exposes it on ResponseException and its subclasses. + * + * @param \Throwable $exception + * + * @return ResponseInterface|null + */ + private function getExceptionResponse(\Throwable $exception): ?ResponseInterface + { + return method_exists($exception, 'getResponse') ? $exception->getResponse() : null; + } + private function handleResponseWithDataType( string $dataType, RequestInterface $request, diff --git a/lib/TeamAdmin/InfoSettingsApi.php b/lib/TeamAdmin/InfoSettingsApi.php index 14e273c9..d44b89b3 100644 --- a/lib/TeamAdmin/InfoSettingsApi.php +++ b/lib/TeamAdmin/InfoSettingsApi.php @@ -28,11 +28,11 @@ use GuzzleHttp\Client; use GuzzleHttp\ClientInterface; -use GuzzleHttp\Exception\ConnectException; use GuzzleHttp\Exception\RequestException; use GuzzleHttp\Psr7\MultipartStream; use GuzzleHttp\Psr7\Request; use GuzzleHttp\RequestOptions; +use Psr\Http\Client\NetworkExceptionInterface; use Psr\Http\Message\RequestInterface; use Psr\Http\Message\ResponseInterface; use SeaTable\Client\ApiException; @@ -173,13 +173,14 @@ public function deleteTeamWithHttpInfo(string $contentType = self::contentTypes[ try { $response = $this->client->send($request, $options); } catch (RequestException $e) { + $eResponse = $this->getExceptionResponse($e); throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), - $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? (string) $e->getResponse()->getBody() : null + $eResponse ? $eResponse->getHeaders() : null, + $eResponse ? (string) $eResponse->getBody() : null ); - } catch (ConnectException $e) { + } catch (NetworkExceptionInterface $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), @@ -292,7 +293,15 @@ function ($response) use ($returnType) { ]; }, function ($exception) { - $response = $exception->getResponse(); + $response = $this->getExceptionResponse($exception); + if ($response === null) { + throw new ApiException( + "[{$exception->getCode()}] {$exception->getMessage()}", + (int) $exception->getCode(), + null, + null + ); + } $statusCode = $response->getStatusCode(); throw new ApiException( sprintf( @@ -355,7 +364,11 @@ public function deleteTeamRequest(string $contentType = self::contentTypes['dele } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + try { + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + } catch (\JsonException $e) { + throw new \InvalidArgumentException('json_encode error: ' . $e->getMessage(), 0, $e); + } } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -425,13 +438,14 @@ public function getTeamInfoWithHttpInfo(string $contentType = self::contentTypes try { $response = $this->client->send($request, $options); } catch (RequestException $e) { + $eResponse = $this->getExceptionResponse($e); throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), - $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? (string) $e->getResponse()->getBody() : null + $eResponse ? $eResponse->getHeaders() : null, + $eResponse ? (string) $eResponse->getBody() : null ); - } catch (ConnectException $e) { + } catch (NetworkExceptionInterface $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), @@ -544,7 +558,15 @@ function ($response) use ($returnType) { ]; }, function ($exception) { - $response = $exception->getResponse(); + $response = $this->getExceptionResponse($exception); + if ($response === null) { + throw new ApiException( + "[{$exception->getCode()}] {$exception->getMessage()}", + (int) $exception->getCode(), + null, + null + ); + } $statusCode = $response->getStatusCode(); throw new ApiException( sprintf( @@ -607,7 +629,11 @@ public function getTeamInfoRequest(string $contentType = self::contentTypes['get } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + try { + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + } catch (\JsonException $e) { + throw new \InvalidArgumentException('json_encode error: ' . $e->getMessage(), 0, $e); + } } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -677,13 +703,14 @@ public function getTeamSettingsWithHttpInfo(string $contentType = self::contentT try { $response = $this->client->send($request, $options); } catch (RequestException $e) { + $eResponse = $this->getExceptionResponse($e); throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), - $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? (string) $e->getResponse()->getBody() : null + $eResponse ? $eResponse->getHeaders() : null, + $eResponse ? (string) $eResponse->getBody() : null ); - } catch (ConnectException $e) { + } catch (NetworkExceptionInterface $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), @@ -796,7 +823,15 @@ function ($response) use ($returnType) { ]; }, function ($exception) { - $response = $exception->getResponse(); + $response = $this->getExceptionResponse($exception); + if ($response === null) { + throw new ApiException( + "[{$exception->getCode()}] {$exception->getMessage()}", + (int) $exception->getCode(), + null, + null + ); + } $statusCode = $response->getStatusCode(); throw new ApiException( sprintf( @@ -859,7 +894,11 @@ public function getTeamSettingsRequest(string $contentType = self::contentTypes[ } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + try { + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + } catch (\JsonException $e) { + throw new \InvalidArgumentException('json_encode error: ' . $e->getMessage(), 0, $e); + } } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -931,13 +970,14 @@ public function updateTeamWithHttpInfo($new_org_name = null, string $contentType try { $response = $this->client->send($request, $options); } catch (RequestException $e) { + $eResponse = $this->getExceptionResponse($e); throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), - $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? (string) $e->getResponse()->getBody() : null + $eResponse ? $eResponse->getHeaders() : null, + $eResponse ? (string) $eResponse->getBody() : null ); - } catch (ConnectException $e) { + } catch (NetworkExceptionInterface $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), @@ -1052,7 +1092,15 @@ function ($response) use ($returnType) { ]; }, function ($exception) { - $response = $exception->getResponse(); + $response = $this->getExceptionResponse($exception); + if ($response === null) { + throw new ApiException( + "[{$exception->getCode()}] {$exception->getMessage()}", + (int) $exception->getCode(), + null, + null + ); + } $statusCode = $response->getStatusCode(); throw new ApiException( sprintf( @@ -1127,7 +1175,11 @@ public function updateTeamRequest($new_org_name = null, string $contentType = se } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + try { + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + } catch (\JsonException $e) { + throw new \InvalidArgumentException('json_encode error: ' . $e->getMessage(), 0, $e); + } } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -1207,13 +1259,14 @@ public function updateTeamSettingsWithHttpInfo($enable_force_2fa = null, $enable try { $response = $this->client->send($request, $options); } catch (RequestException $e) { + $eResponse = $this->getExceptionResponse($e); throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), - $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? (string) $e->getResponse()->getBody() : null + $eResponse ? $eResponse->getHeaders() : null, + $eResponse ? (string) $eResponse->getBody() : null ); - } catch (ConnectException $e) { + } catch (NetworkExceptionInterface $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), @@ -1336,7 +1389,15 @@ function ($response) use ($returnType) { ]; }, function ($exception) { - $response = $exception->getResponse(); + $response = $this->getExceptionResponse($exception); + if ($response === null) { + throw new ApiException( + "[{$exception->getCode()}] {$exception->getMessage()}", + (int) $exception->getCode(), + null, + null + ); + } $statusCode = $response->getStatusCode(); throw new ApiException( sprintf( @@ -1423,7 +1484,11 @@ public function updateTeamSettingsRequest($enable_force_2fa = null, $enable_forc } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + try { + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + } catch (\JsonException $e) { + throw new \InvalidArgumentException('json_encode error: ' . $e->getMessage(), 0, $e); + } } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -1483,6 +1548,21 @@ protected function createHttpClientOption() return $options; } + /** + * Returns the response attached to a Guzzle exception, if there is one. + * + * Guzzle 7 exposes getResponse() on RequestException, while Guzzle 8 only + * exposes it on ResponseException and its subclasses. + * + * @param \Throwable $exception + * + * @return ResponseInterface|null + */ + private function getExceptionResponse(\Throwable $exception): ?ResponseInterface + { + return method_exists($exception, 'getResponse') ? $exception->getResponse() : null; + } + private function handleResponseWithDataType( string $dataType, RequestInterface $request, diff --git a/lib/TeamAdmin/ListGroupMembers200Response.php b/lib/TeamAdmin/ListGroupMembers200Response.php index bdcabc4d..d27b5dca 100644 --- a/lib/TeamAdmin/ListGroupMembers200Response.php +++ b/lib/TeamAdmin/ListGroupMembers200Response.php @@ -44,17 +44,17 @@ class ListGroupMembers200Response implements ModelInterface, ArrayAccess, \JsonS public const DISCRIMINATOR = null; /** - * The original name of the model. - * - * @var string - */ + * The original name of the model. + * + * @var string + */ protected static $openAPIModelName = 'listGroupMembers_200_response'; /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ protected static $openAPITypes = [ 'org_id' => 'int', 'group_id' => 'int', @@ -63,12 +63,12 @@ class ListGroupMembers200Response implements ModelInterface, ArrayAccess, \JsonS ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - * @phpstan-var array - * @psalm-var array - */ + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ protected static $openAPIFormats = [ 'org_id' => null, 'group_id' => null, @@ -77,10 +77,10 @@ class ListGroupMembers200Response implements ModelInterface, ArrayAccess, \JsonS ]; /** - * Array of nullable properties. Used for (de)serialization - * - * @var boolean[] - */ + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ protected static array $openAPINullables = [ 'org_id' => false, 'group_id' => false, @@ -89,10 +89,10 @@ class ListGroupMembers200Response implements ModelInterface, ArrayAccess, \JsonS ]; /** - * If a nullable field gets set to null, insert it here - * - * @var boolean[] - */ + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ protected array $openAPINullablesSetToNull = []; /** @@ -268,14 +268,14 @@ public function __construct(?array $data = null) } /** - * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName - * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the - * $this->openAPINullablesSetToNull array - * - * @param string $variableName - * @param array $fields - * @param mixed $defaultValue - */ + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ private function setIfExists(string $variableName, array $fields, $defaultValue): void { if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { diff --git a/lib/TeamAdmin/ListGroupMembers200ResponseMembersInner.php b/lib/TeamAdmin/ListGroupMembers200ResponseMembersInner.php index df2faf2f..26a89ec0 100644 --- a/lib/TeamAdmin/ListGroupMembers200ResponseMembersInner.php +++ b/lib/TeamAdmin/ListGroupMembers200ResponseMembersInner.php @@ -44,17 +44,17 @@ class ListGroupMembers200ResponseMembersInner implements ModelInterface, ArrayAc public const DISCRIMINATOR = null; /** - * The original name of the model. - * - * @var string - */ + * The original name of the model. + * + * @var string + */ protected static $openAPIModelName = 'listGroupMembers_200_response_members_inner'; /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ protected static $openAPITypes = [ 'name' => 'string', 'email' => 'string', @@ -65,12 +65,12 @@ class ListGroupMembers200ResponseMembersInner implements ModelInterface, ArrayAc ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - * @phpstan-var array - * @psalm-var array - */ + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ protected static $openAPIFormats = [ 'name' => null, 'email' => null, @@ -81,10 +81,10 @@ class ListGroupMembers200ResponseMembersInner implements ModelInterface, ArrayAc ]; /** - * Array of nullable properties. Used for (de)serialization - * - * @var boolean[] - */ + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ protected static array $openAPINullables = [ 'name' => false, 'email' => false, @@ -95,10 +95,10 @@ class ListGroupMembers200ResponseMembersInner implements ModelInterface, ArrayAc ]; /** - * If a nullable field gets set to null, insert it here - * - * @var boolean[] - */ + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ protected array $openAPINullablesSetToNull = []; /** @@ -282,14 +282,14 @@ public function __construct(?array $data = null) } /** - * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName - * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the - * $this->openAPINullablesSetToNull array - * - * @param string $variableName - * @param array $fields - * @param mixed $defaultValue - */ + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ private function setIfExists(string $variableName, array $fields, $defaultValue): void { if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { diff --git a/lib/TeamAdmin/ListGroups200Response.php b/lib/TeamAdmin/ListGroups200Response.php index 6e4ea73e..87e64105 100644 --- a/lib/TeamAdmin/ListGroups200Response.php +++ b/lib/TeamAdmin/ListGroups200Response.php @@ -44,17 +44,17 @@ class ListGroups200Response implements ModelInterface, ArrayAccess, \JsonSeriali public const DISCRIMINATOR = null; /** - * The original name of the model. - * - * @var string - */ + * The original name of the model. + * + * @var string + */ protected static $openAPIModelName = 'listGroups_200_response'; /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ protected static $openAPITypes = [ 'groups' => '\SeaTable\Client\TeamAdmin\ListGroups200ResponseGroupsInner[]', 'page' => 'int', @@ -63,12 +63,12 @@ class ListGroups200Response implements ModelInterface, ArrayAccess, \JsonSeriali ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - * @phpstan-var array - * @psalm-var array - */ + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ protected static $openAPIFormats = [ 'groups' => null, 'page' => null, @@ -77,10 +77,10 @@ class ListGroups200Response implements ModelInterface, ArrayAccess, \JsonSeriali ]; /** - * Array of nullable properties. Used for (de)serialization - * - * @var boolean[] - */ + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ protected static array $openAPINullables = [ 'groups' => false, 'page' => false, @@ -89,10 +89,10 @@ class ListGroups200Response implements ModelInterface, ArrayAccess, \JsonSeriali ]; /** - * If a nullable field gets set to null, insert it here - * - * @var boolean[] - */ + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ protected array $openAPINullablesSetToNull = []; /** @@ -268,14 +268,14 @@ public function __construct(?array $data = null) } /** - * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName - * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the - * $this->openAPINullablesSetToNull array - * - * @param string $variableName - * @param array $fields - * @param mixed $defaultValue - */ + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ private function setIfExists(string $variableName, array $fields, $defaultValue): void { if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { diff --git a/lib/TeamAdmin/ListGroups200ResponseGroupsInner.php b/lib/TeamAdmin/ListGroups200ResponseGroupsInner.php index c797487e..86e3d6a6 100644 --- a/lib/TeamAdmin/ListGroups200ResponseGroupsInner.php +++ b/lib/TeamAdmin/ListGroups200ResponseGroupsInner.php @@ -44,17 +44,17 @@ class ListGroups200ResponseGroupsInner implements ModelInterface, ArrayAccess, \ public const DISCRIMINATOR = null; /** - * The original name of the model. - * - * @var string - */ + * The original name of the model. + * + * @var string + */ protected static $openAPIModelName = 'listGroups_200_response_groups_inner'; /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ protected static $openAPITypes = [ 'id' => 'int', 'group_name' => 'string', @@ -66,12 +66,12 @@ class ListGroups200ResponseGroupsInner implements ModelInterface, ArrayAccess, \ ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - * @phpstan-var array - * @psalm-var array - */ + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ protected static $openAPIFormats = [ 'id' => null, 'group_name' => null, @@ -83,10 +83,10 @@ class ListGroups200ResponseGroupsInner implements ModelInterface, ArrayAccess, \ ]; /** - * Array of nullable properties. Used for (de)serialization - * - * @var boolean[] - */ + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ protected static array $openAPINullables = [ 'id' => false, 'group_name' => false, @@ -98,10 +98,10 @@ class ListGroups200ResponseGroupsInner implements ModelInterface, ArrayAccess, \ ]; /** - * If a nullable field gets set to null, insert it here - * - * @var boolean[] - */ + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ protected array $openAPINullablesSetToNull = []; /** @@ -289,14 +289,14 @@ public function __construct(?array $data = null) } /** - * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName - * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the - * $this->openAPINullablesSetToNull array - * - * @param string $variableName - * @param array $fields - * @param mixed $defaultValue - */ + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ private function setIfExists(string $variableName, array $fields, $defaultValue): void { if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { diff --git a/lib/TeamAdmin/ListShares200Response.php b/lib/TeamAdmin/ListShares200Response.php index 1f79a9dc..5a351f95 100644 --- a/lib/TeamAdmin/ListShares200Response.php +++ b/lib/TeamAdmin/ListShares200Response.php @@ -44,17 +44,17 @@ class ListShares200Response implements ModelInterface, ArrayAccess, \JsonSeriali public const DISCRIMINATOR = null; /** - * The original name of the model. - * - * @var string - */ + * The original name of the model. + * + * @var string + */ protected static $openAPIModelName = 'listShares_200_response'; /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ protected static $openAPITypes = [ 'dtable_user_shares' => 'object[]', 'dtable_group_shares' => 'object[]', @@ -63,12 +63,12 @@ class ListShares200Response implements ModelInterface, ArrayAccess, \JsonSeriali ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - * @phpstan-var array - * @psalm-var array - */ + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ protected static $openAPIFormats = [ 'dtable_user_shares' => null, 'dtable_group_shares' => null, @@ -77,10 +77,10 @@ class ListShares200Response implements ModelInterface, ArrayAccess, \JsonSeriali ]; /** - * Array of nullable properties. Used for (de)serialization - * - * @var boolean[] - */ + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ protected static array $openAPINullables = [ 'dtable_user_shares' => false, 'dtable_group_shares' => false, @@ -89,10 +89,10 @@ class ListShares200Response implements ModelInterface, ArrayAccess, \JsonSeriali ]; /** - * If a nullable field gets set to null, insert it here - * - * @var boolean[] - */ + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ protected array $openAPINullablesSetToNull = []; /** @@ -268,14 +268,14 @@ public function __construct(?array $data = null) } /** - * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName - * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the - * $this->openAPINullablesSetToNull array - * - * @param string $variableName - * @param array $fields - * @param mixed $defaultValue - */ + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ private function setIfExists(string $variableName, array $fields, $defaultValue): void { if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { diff --git a/lib/TeamAdmin/SAMLApi.php b/lib/TeamAdmin/SAMLApi.php index e40d138f..1f1dcdfc 100644 --- a/lib/TeamAdmin/SAMLApi.php +++ b/lib/TeamAdmin/SAMLApi.php @@ -28,11 +28,11 @@ use GuzzleHttp\Client; use GuzzleHttp\ClientInterface; -use GuzzleHttp\Exception\ConnectException; use GuzzleHttp\Exception\RequestException; use GuzzleHttp\Psr7\MultipartStream; use GuzzleHttp\Psr7\Request; use GuzzleHttp\RequestOptions; +use Psr\Http\Client\NetworkExceptionInterface; use Psr\Http\Message\RequestInterface; use Psr\Http\Message\ResponseInterface; use SeaTable\Client\ApiException; @@ -172,13 +172,14 @@ public function deleteSamlConfigWithHttpInfo($org_id, string $contentType = self try { $response = $this->client->send($request, $options); } catch (RequestException $e) { + $eResponse = $this->getExceptionResponse($e); throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), - $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? (string) $e->getResponse()->getBody() : null + $eResponse ? $eResponse->getHeaders() : null, + $eResponse ? (string) $eResponse->getBody() : null ); - } catch (ConnectException $e) { + } catch (NetworkExceptionInterface $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), @@ -293,7 +294,15 @@ function ($response) use ($returnType) { ]; }, function ($exception) { - $response = $exception->getResponse(); + $response = $this->getExceptionResponse($exception); + if ($response === null) { + throw new ApiException( + "[{$exception->getCode()}] {$exception->getMessage()}", + (int) $exception->getCode(), + null, + null + ); + } $statusCode = $response->getStatusCode(); throw new ApiException( sprintf( @@ -344,7 +353,7 @@ public function deleteSamlConfigRequest($org_id, string $contentType = self::con // path params if ($org_id !== null) { $resourcePath = str_replace( - '{' . 'org_id' . '}', + '{org_id}', ObjectSerializer::toPathValue($org_id), $resourcePath ); @@ -375,7 +384,11 @@ public function deleteSamlConfigRequest($org_id, string $contentType = self::con } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + try { + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + } catch (\JsonException $e) { + throw new \InvalidArgumentException('json_encode error: ' . $e->getMessage(), 0, $e); + } } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -447,13 +460,14 @@ public function getSamlConfigWithHttpInfo($org_id, string $contentType = self::c try { $response = $this->client->send($request, $options); } catch (RequestException $e) { + $eResponse = $this->getExceptionResponse($e); throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), - $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? (string) $e->getResponse()->getBody() : null + $eResponse ? $eResponse->getHeaders() : null, + $eResponse ? (string) $eResponse->getBody() : null ); - } catch (ConnectException $e) { + } catch (NetworkExceptionInterface $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), @@ -568,7 +582,15 @@ function ($response) use ($returnType) { ]; }, function ($exception) { - $response = $exception->getResponse(); + $response = $this->getExceptionResponse($exception); + if ($response === null) { + throw new ApiException( + "[{$exception->getCode()}] {$exception->getMessage()}", + (int) $exception->getCode(), + null, + null + ); + } $statusCode = $response->getStatusCode(); throw new ApiException( sprintf( @@ -619,7 +641,7 @@ public function getSamlConfigRequest($org_id, string $contentType = self::conten // path params if ($org_id !== null) { $resourcePath = str_replace( - '{' . 'org_id' . '}', + '{org_id}', ObjectSerializer::toPathValue($org_id), $resourcePath ); @@ -650,7 +672,11 @@ public function getSamlConfigRequest($org_id, string $contentType = self::conten } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + try { + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + } catch (\JsonException $e) { + throw new \InvalidArgumentException('json_encode error: ' . $e->getMessage(), 0, $e); + } } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -727,13 +753,14 @@ public function updateSamlConfigWithHttpInfo($org_id, $metadata_url = null, $dom try { $response = $this->client->send($request, $options); } catch (RequestException $e) { + $eResponse = $this->getExceptionResponse($e); throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), - $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? (string) $e->getResponse()->getBody() : null + $eResponse ? $eResponse->getHeaders() : null, + $eResponse ? (string) $eResponse->getBody() : null ); - } catch (ConnectException $e) { + } catch (NetworkExceptionInterface $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), @@ -805,7 +832,15 @@ function ($response) use ($returnType) { return [null, $response->getStatusCode(), $response->getHeaders()]; }, function ($exception) { - $response = $exception->getResponse(); + $response = $this->getExceptionResponse($exception); + if ($response === null) { + throw new ApiException( + "[{$exception->getCode()}] {$exception->getMessage()}", + (int) $exception->getCode(), + null, + null + ); + } $statusCode = $response->getStatusCode(); throw new ApiException( sprintf( @@ -862,7 +897,7 @@ public function updateSamlConfigRequest($org_id, $metadata_url = null, $domain = // path params if ($org_id !== null) { $resourcePath = str_replace( - '{' . 'org_id' . '}', + '{org_id}', ObjectSerializer::toPathValue($org_id), $resourcePath ); @@ -905,7 +940,11 @@ public function updateSamlConfigRequest($org_id, $metadata_url = null, $domain = } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + try { + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + } catch (\JsonException $e) { + throw new \InvalidArgumentException('json_encode error: ' . $e->getMessage(), 0, $e); + } } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -978,13 +1017,14 @@ public function verifySamlDomainWithHttpInfo($org_id, $domain = null, string $co try { $response = $this->client->send($request, $options); } catch (RequestException $e) { + $eResponse = $this->getExceptionResponse($e); throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), - $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? (string) $e->getResponse()->getBody() : null + $eResponse ? $eResponse->getHeaders() : null, + $eResponse ? (string) $eResponse->getBody() : null ); - } catch (ConnectException $e) { + } catch (NetworkExceptionInterface $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), @@ -1052,7 +1092,15 @@ function ($response) use ($returnType) { return [null, $response->getStatusCode(), $response->getHeaders()]; }, function ($exception) { - $response = $exception->getResponse(); + $response = $this->getExceptionResponse($exception); + if ($response === null) { + throw new ApiException( + "[{$exception->getCode()}] {$exception->getMessage()}", + (int) $exception->getCode(), + null, + null + ); + } $statusCode = $response->getStatusCode(); throw new ApiException( sprintf( @@ -1105,7 +1153,7 @@ public function verifySamlDomainRequest($org_id, $domain = null, string $content // path params if ($org_id !== null) { $resourcePath = str_replace( - '{' . 'org_id' . '}', + '{org_id}', ObjectSerializer::toPathValue($org_id), $resourcePath ); @@ -1146,7 +1194,11 @@ public function verifySamlDomainRequest($org_id, $domain = null, string $content } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + try { + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + } catch (\JsonException $e) { + throw new \InvalidArgumentException('json_encode error: ' . $e->getMessage(), 0, $e); + } } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -1206,6 +1258,21 @@ protected function createHttpClientOption() return $options; } + /** + * Returns the response attached to a Guzzle exception, if there is one. + * + * Guzzle 7 exposes getResponse() on RequestException, while Guzzle 8 only + * exposes it on ResponseException and its subclasses. + * + * @param \Throwable $exception + * + * @return ResponseInterface|null + */ + private function getExceptionResponse(\Throwable $exception): ?ResponseInterface + { + return method_exists($exception, 'getResponse') ? $exception->getResponse() : null; + } + private function handleResponseWithDataType( string $dataType, RequestInterface $request, diff --git a/lib/TeamAdmin/SharingLinksApi.php b/lib/TeamAdmin/SharingLinksApi.php index 807fc677..aa754184 100644 --- a/lib/TeamAdmin/SharingLinksApi.php +++ b/lib/TeamAdmin/SharingLinksApi.php @@ -28,11 +28,11 @@ use GuzzleHttp\Client; use GuzzleHttp\ClientInterface; -use GuzzleHttp\Exception\ConnectException; use GuzzleHttp\Exception\RequestException; use GuzzleHttp\Psr7\MultipartStream; use GuzzleHttp\Psr7\Request; use GuzzleHttp\RequestOptions; +use Psr\Http\Client\NetworkExceptionInterface; use Psr\Http\Message\RequestInterface; use Psr\Http\Message\ResponseInterface; use SeaTable\Client\ApiException; @@ -186,13 +186,14 @@ public function deleteExternalLinkWithHttpInfo($org_id, $external_link_token, st try { $response = $this->client->send($request, $options); } catch (RequestException $e) { + $eResponse = $this->getExceptionResponse($e); throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), - $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? (string) $e->getResponse()->getBody() : null + $eResponse ? $eResponse->getHeaders() : null, + $eResponse ? (string) $eResponse->getBody() : null ); - } catch (ConnectException $e) { + } catch (NetworkExceptionInterface $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), @@ -309,7 +310,15 @@ function ($response) use ($returnType) { ]; }, function ($exception) { - $response = $exception->getResponse(); + $response = $this->getExceptionResponse($exception); + if ($response === null) { + throw new ApiException( + "[{$exception->getCode()}] {$exception->getMessage()}", + (int) $exception->getCode(), + null, + null + ); + } $statusCode = $response->getStatusCode(); throw new ApiException( sprintf( @@ -368,7 +377,7 @@ public function deleteExternalLinkRequest($org_id, $external_link_token, string // path params if ($org_id !== null) { $resourcePath = str_replace( - '{' . 'org_id' . '}', + '{org_id}', ObjectSerializer::toPathValue($org_id), $resourcePath ); @@ -376,7 +385,7 @@ public function deleteExternalLinkRequest($org_id, $external_link_token, string // path params if ($external_link_token !== null) { $resourcePath = str_replace( - '{' . 'external_link_token' . '}', + '{external_link_token}', ObjectSerializer::toPathValue($external_link_token), $resourcePath ); @@ -407,7 +416,11 @@ public function deleteExternalLinkRequest($org_id, $external_link_token, string } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + try { + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + } catch (\JsonException $e) { + throw new \InvalidArgumentException('json_encode error: ' . $e->getMessage(), 0, $e); + } } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -481,13 +494,14 @@ public function deleteInviteLinkWithHttpInfo($org_id, $invite_link_token, string try { $response = $this->client->send($request, $options); } catch (RequestException $e) { + $eResponse = $this->getExceptionResponse($e); throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), - $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? (string) $e->getResponse()->getBody() : null + $eResponse ? $eResponse->getHeaders() : null, + $eResponse ? (string) $eResponse->getBody() : null ); - } catch (ConnectException $e) { + } catch (NetworkExceptionInterface $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), @@ -604,7 +618,15 @@ function ($response) use ($returnType) { ]; }, function ($exception) { - $response = $exception->getResponse(); + $response = $this->getExceptionResponse($exception); + if ($response === null) { + throw new ApiException( + "[{$exception->getCode()}] {$exception->getMessage()}", + (int) $exception->getCode(), + null, + null + ); + } $statusCode = $response->getStatusCode(); throw new ApiException( sprintf( @@ -666,7 +688,7 @@ public function deleteInviteLinkRequest($org_id, $invite_link_token, string $con // path params if ($org_id !== null) { $resourcePath = str_replace( - '{' . 'org_id' . '}', + '{org_id}', ObjectSerializer::toPathValue($org_id), $resourcePath ); @@ -674,7 +696,7 @@ public function deleteInviteLinkRequest($org_id, $invite_link_token, string $con // path params if ($invite_link_token !== null) { $resourcePath = str_replace( - '{' . 'invite_link_token' . '}', + '{invite_link_token}', ObjectSerializer::toPathValue($invite_link_token), $resourcePath ); @@ -705,7 +727,11 @@ public function deleteInviteLinkRequest($org_id, $invite_link_token, string $con } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + try { + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + } catch (\JsonException $e) { + throw new \InvalidArgumentException('json_encode error: ' . $e->getMessage(), 0, $e); + } } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -779,13 +805,14 @@ public function deleteViewExternalLinkWithHttpInfo($org_id, $view_external_link_ try { $response = $this->client->send($request, $options); } catch (RequestException $e) { + $eResponse = $this->getExceptionResponse($e); throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), - $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? (string) $e->getResponse()->getBody() : null + $eResponse ? $eResponse->getHeaders() : null, + $eResponse ? (string) $eResponse->getBody() : null ); - } catch (ConnectException $e) { + } catch (NetworkExceptionInterface $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), @@ -902,7 +929,15 @@ function ($response) use ($returnType) { ]; }, function ($exception) { - $response = $exception->getResponse(); + $response = $this->getExceptionResponse($exception); + if ($response === null) { + throw new ApiException( + "[{$exception->getCode()}] {$exception->getMessage()}", + (int) $exception->getCode(), + null, + null + ); + } $statusCode = $response->getStatusCode(); throw new ApiException( sprintf( @@ -961,7 +996,7 @@ public function deleteViewExternalLinkRequest($org_id, $view_external_link_token // path params if ($org_id !== null) { $resourcePath = str_replace( - '{' . 'org_id' . '}', + '{org_id}', ObjectSerializer::toPathValue($org_id), $resourcePath ); @@ -969,7 +1004,7 @@ public function deleteViewExternalLinkRequest($org_id, $view_external_link_token // path params if ($view_external_link_token !== null) { $resourcePath = str_replace( - '{' . 'view_external_link_token' . '}', + '{view_external_link_token}', ObjectSerializer::toPathValue($view_external_link_token), $resourcePath ); @@ -1000,7 +1035,11 @@ public function deleteViewExternalLinkRequest($org_id, $view_external_link_token } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + try { + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + } catch (\JsonException $e) { + throw new \InvalidArgumentException('json_encode error: ' . $e->getMessage(), 0, $e); + } } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -1072,13 +1111,14 @@ public function listBaseExternalLinksWithHttpInfo($org_id, string $contentType = try { $response = $this->client->send($request, $options); } catch (RequestException $e) { + $eResponse = $this->getExceptionResponse($e); throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), - $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? (string) $e->getResponse()->getBody() : null + $eResponse ? $eResponse->getHeaders() : null, + $eResponse ? (string) $eResponse->getBody() : null ); - } catch (ConnectException $e) { + } catch (NetworkExceptionInterface $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), @@ -1193,7 +1233,15 @@ function ($response) use ($returnType) { ]; }, function ($exception) { - $response = $exception->getResponse(); + $response = $this->getExceptionResponse($exception); + if ($response === null) { + throw new ApiException( + "[{$exception->getCode()}] {$exception->getMessage()}", + (int) $exception->getCode(), + null, + null + ); + } $statusCode = $response->getStatusCode(); throw new ApiException( sprintf( @@ -1244,7 +1292,7 @@ public function listBaseExternalLinksRequest($org_id, string $contentType = self // path params if ($org_id !== null) { $resourcePath = str_replace( - '{' . 'org_id' . '}', + '{org_id}', ObjectSerializer::toPathValue($org_id), $resourcePath ); @@ -1275,7 +1323,11 @@ public function listBaseExternalLinksRequest($org_id, string $contentType = self } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + try { + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + } catch (\JsonException $e) { + throw new \InvalidArgumentException('json_encode error: ' . $e->getMessage(), 0, $e); + } } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -1351,13 +1403,14 @@ public function listInviteLinksWithHttpInfo($org_id, $page = null, $per_page = n try { $response = $this->client->send($request, $options); } catch (RequestException $e) { + $eResponse = $this->getExceptionResponse($e); throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), - $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? (string) $e->getResponse()->getBody() : null + $eResponse ? $eResponse->getHeaders() : null, + $eResponse ? (string) $eResponse->getBody() : null ); - } catch (ConnectException $e) { + } catch (NetworkExceptionInterface $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), @@ -1476,7 +1529,15 @@ function ($response) use ($returnType) { ]; }, function ($exception) { - $response = $exception->getResponse(); + $response = $this->getExceptionResponse($exception); + if ($response === null) { + throw new ApiException( + "[{$exception->getCode()}] {$exception->getMessage()}", + (int) $exception->getCode(), + null, + null + ); + } $statusCode = $response->getStatusCode(); throw new ApiException( sprintf( @@ -1555,7 +1616,7 @@ public function listInviteLinksRequest($org_id, $page = null, $per_page = null, // path params if ($org_id !== null) { $resourcePath = str_replace( - '{' . 'org_id' . '}', + '{org_id}', ObjectSerializer::toPathValue($org_id), $resourcePath ); @@ -1586,7 +1647,11 @@ public function listInviteLinksRequest($org_id, $page = null, $per_page = null, } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + try { + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + } catch (\JsonException $e) { + throw new \InvalidArgumentException('json_encode error: ' . $e->getMessage(), 0, $e); + } } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -1658,13 +1723,14 @@ public function listSharesWithHttpInfo($org_id, string $contentType = self::cont try { $response = $this->client->send($request, $options); } catch (RequestException $e) { + $eResponse = $this->getExceptionResponse($e); throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), - $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? (string) $e->getResponse()->getBody() : null + $eResponse ? $eResponse->getHeaders() : null, + $eResponse ? (string) $eResponse->getBody() : null ); - } catch (ConnectException $e) { + } catch (NetworkExceptionInterface $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), @@ -1779,7 +1845,15 @@ function ($response) use ($returnType) { ]; }, function ($exception) { - $response = $exception->getResponse(); + $response = $this->getExceptionResponse($exception); + if ($response === null) { + throw new ApiException( + "[{$exception->getCode()}] {$exception->getMessage()}", + (int) $exception->getCode(), + null, + null + ); + } $statusCode = $response->getStatusCode(); throw new ApiException( sprintf( @@ -1830,7 +1904,7 @@ public function listSharesRequest($org_id, string $contentType = self::contentTy // path params if ($org_id !== null) { $resourcePath = str_replace( - '{' . 'org_id' . '}', + '{org_id}', ObjectSerializer::toPathValue($org_id), $resourcePath ); @@ -1861,7 +1935,11 @@ public function listSharesRequest($org_id, string $contentType = self::contentTy } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + try { + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + } catch (\JsonException $e) { + throw new \InvalidArgumentException('json_encode error: ' . $e->getMessage(), 0, $e); + } } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -1933,13 +2011,14 @@ public function listViewExternalLinksWithHttpInfo($org_id, string $contentType = try { $response = $this->client->send($request, $options); } catch (RequestException $e) { + $eResponse = $this->getExceptionResponse($e); throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), - $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? (string) $e->getResponse()->getBody() : null + $eResponse ? $eResponse->getHeaders() : null, + $eResponse ? (string) $eResponse->getBody() : null ); - } catch (ConnectException $e) { + } catch (NetworkExceptionInterface $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), @@ -2054,7 +2133,15 @@ function ($response) use ($returnType) { ]; }, function ($exception) { - $response = $exception->getResponse(); + $response = $this->getExceptionResponse($exception); + if ($response === null) { + throw new ApiException( + "[{$exception->getCode()}] {$exception->getMessage()}", + (int) $exception->getCode(), + null, + null + ); + } $statusCode = $response->getStatusCode(); throw new ApiException( sprintf( @@ -2105,7 +2192,7 @@ public function listViewExternalLinksRequest($org_id, string $contentType = self // path params if ($org_id !== null) { $resourcePath = str_replace( - '{' . 'org_id' . '}', + '{org_id}', ObjectSerializer::toPathValue($org_id), $resourcePath ); @@ -2136,7 +2223,11 @@ public function listViewExternalLinksRequest($org_id, string $contentType = self } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + try { + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + } catch (\JsonException $e) { + throw new \InvalidArgumentException('json_encode error: ' . $e->getMessage(), 0, $e); + } } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -2212,13 +2303,14 @@ public function updateInviteLinkWithHttpInfo($org_id, $invite_link_token, $updat try { $response = $this->client->send($request, $options); } catch (RequestException $e) { + $eResponse = $this->getExceptionResponse($e); throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), - $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? (string) $e->getResponse()->getBody() : null + $eResponse ? $eResponse->getHeaders() : null, + $eResponse ? (string) $eResponse->getBody() : null ); - } catch (ConnectException $e) { + } catch (NetworkExceptionInterface $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), @@ -2337,7 +2429,15 @@ function ($response) use ($returnType) { ]; }, function ($exception) { - $response = $exception->getResponse(); + $response = $this->getExceptionResponse($exception); + if ($response === null) { + throw new ApiException( + "[{$exception->getCode()}] {$exception->getMessage()}", + (int) $exception->getCode(), + null, + null + ); + } $statusCode = $response->getStatusCode(); throw new ApiException( sprintf( @@ -2401,7 +2501,7 @@ public function updateInviteLinkRequest($org_id, $invite_link_token, $update_inv // path params if ($org_id !== null) { $resourcePath = str_replace( - '{' . 'org_id' . '}', + '{org_id}', ObjectSerializer::toPathValue($org_id), $resourcePath ); @@ -2409,7 +2509,7 @@ public function updateInviteLinkRequest($org_id, $invite_link_token, $update_inv // path params if ($invite_link_token !== null) { $resourcePath = str_replace( - '{' . 'invite_link_token' . '}', + '{invite_link_token}', ObjectSerializer::toPathValue($invite_link_token), $resourcePath ); @@ -2426,7 +2526,11 @@ public function updateInviteLinkRequest($org_id, $invite_link_token, $update_inv if (isset($update_invite_link_request)) { if (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the body - $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($update_invite_link_request)); + try { + $httpBody = json_encode(ObjectSerializer::sanitizeForSerialization($update_invite_link_request), JSON_THROW_ON_ERROR); + } catch (\JsonException $e) { + throw new \InvalidArgumentException('json_encode error: ' . $e->getMessage(), 0, $e); + } } else { $httpBody = $update_invite_link_request; } @@ -2447,7 +2551,11 @@ public function updateInviteLinkRequest($org_id, $invite_link_token, $update_inv } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + try { + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + } catch (\JsonException $e) { + throw new \InvalidArgumentException('json_encode error: ' . $e->getMessage(), 0, $e); + } } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -2507,6 +2615,21 @@ protected function createHttpClientOption() return $options; } + /** + * Returns the response attached to a Guzzle exception, if there is one. + * + * Guzzle 7 exposes getResponse() on RequestException, while Guzzle 8 only + * exposes it on ResponseException and its subclasses. + * + * @param \Throwable $exception + * + * @return ResponseInterface|null + */ + private function getExceptionResponse(\Throwable $exception): ?ResponseInterface + { + return method_exists($exception, 'getResponse') ? $exception->getResponse() : null; + } + private function handleResponseWithDataType( string $dataType, RequestInterface $request, diff --git a/lib/TeamAdmin/StatisticsApi.php b/lib/TeamAdmin/StatisticsApi.php index 0cceeebf..9728b70a 100644 --- a/lib/TeamAdmin/StatisticsApi.php +++ b/lib/TeamAdmin/StatisticsApi.php @@ -28,11 +28,11 @@ use GuzzleHttp\Client; use GuzzleHttp\ClientInterface; -use GuzzleHttp\Exception\ConnectException; use GuzzleHttp\Exception\RequestException; use GuzzleHttp\Psr7\MultipartStream; use GuzzleHttp\Psr7\Request; use GuzzleHttp\RequestOptions; +use Psr\Http\Client\NetworkExceptionInterface; use Psr\Http\Message\RequestInterface; use Psr\Http\Message\ResponseInterface; use SeaTable\Client\ApiException; @@ -189,13 +189,14 @@ public function getAdminLogStatisticsByDayWithHttpInfo($org_id, $start = null, $ try { $response = $this->client->send($request, $options); } catch (RequestException $e) { + $eResponse = $this->getExceptionResponse($e); throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), - $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? (string) $e->getResponse()->getBody() : null + $eResponse ? $eResponse->getHeaders() : null, + $eResponse ? (string) $eResponse->getBody() : null ); - } catch (ConnectException $e) { + } catch (NetworkExceptionInterface $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), @@ -318,7 +319,15 @@ function ($response) use ($returnType) { ]; }, function ($exception) { - $response = $exception->getResponse(); + $response = $this->getExceptionResponse($exception); + if ($response === null) { + throw new ApiException( + "[{$exception->getCode()}] {$exception->getMessage()}", + (int) $exception->getCode(), + null, + null + ); + } $statusCode = $response->getStatusCode(); throw new ApiException( sprintf( @@ -419,7 +428,7 @@ public function getAdminLogStatisticsByDayRequest($org_id, $start = null, $end = // path params if ($org_id !== null) { $resourcePath = str_replace( - '{' . 'org_id' . '}', + '{org_id}', ObjectSerializer::toPathValue($org_id), $resourcePath ); @@ -450,7 +459,11 @@ public function getAdminLogStatisticsByDayRequest($org_id, $start = null, $end = } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + try { + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + } catch (\JsonException $e) { + throw new \InvalidArgumentException('json_encode error: ' . $e->getMessage(), 0, $e); + } } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -530,13 +543,14 @@ public function getAutomationLogStatisticsByBaseWithHttpInfo($org_id, $start = n try { $response = $this->client->send($request, $options); } catch (RequestException $e) { + $eResponse = $this->getExceptionResponse($e); throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), - $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? (string) $e->getResponse()->getBody() : null + $eResponse ? $eResponse->getHeaders() : null, + $eResponse ? (string) $eResponse->getBody() : null ); - } catch (ConnectException $e) { + } catch (NetworkExceptionInterface $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), @@ -659,7 +673,15 @@ function ($response) use ($returnType) { ]; }, function ($exception) { - $response = $exception->getResponse(); + $response = $this->getExceptionResponse($exception); + if ($response === null) { + throw new ApiException( + "[{$exception->getCode()}] {$exception->getMessage()}", + (int) $exception->getCode(), + null, + null + ); + } $statusCode = $response->getStatusCode(); throw new ApiException( sprintf( @@ -760,7 +782,7 @@ public function getAutomationLogStatisticsByBaseRequest($org_id, $start = null, // path params if ($org_id !== null) { $resourcePath = str_replace( - '{' . 'org_id' . '}', + '{org_id}', ObjectSerializer::toPathValue($org_id), $resourcePath ); @@ -791,7 +813,11 @@ public function getAutomationLogStatisticsByBaseRequest($org_id, $start = null, } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + try { + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + } catch (\JsonException $e) { + throw new \InvalidArgumentException('json_encode error: ' . $e->getMessage(), 0, $e); + } } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -873,13 +899,14 @@ public function getAutomationLogStatisticsByDayWithHttpInfo($org_id, $dtable_uui try { $response = $this->client->send($request, $options); } catch (RequestException $e) { + $eResponse = $this->getExceptionResponse($e); throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), - $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? (string) $e->getResponse()->getBody() : null + $eResponse ? $eResponse->getHeaders() : null, + $eResponse ? (string) $eResponse->getBody() : null ); - } catch (ConnectException $e) { + } catch (NetworkExceptionInterface $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), @@ -1004,7 +1031,15 @@ function ($response) use ($returnType) { ]; }, function ($exception) { - $response = $exception->getResponse(); + $response = $this->getExceptionResponse($exception); + if ($response === null) { + throw new ApiException( + "[{$exception->getCode()}] {$exception->getMessage()}", + (int) $exception->getCode(), + null, + null + ); + } $statusCode = $response->getStatusCode(); throw new ApiException( sprintf( @@ -1119,7 +1154,7 @@ public function getAutomationLogStatisticsByDayRequest($org_id, $dtable_uuid = n // path params if ($org_id !== null) { $resourcePath = str_replace( - '{' . 'org_id' . '}', + '{org_id}', ObjectSerializer::toPathValue($org_id), $resourcePath ); @@ -1150,7 +1185,11 @@ public function getAutomationLogStatisticsByDayRequest($org_id, $dtable_uuid = n } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + try { + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + } catch (\JsonException $e) { + throw new \InvalidArgumentException('json_encode error: ' . $e->getMessage(), 0, $e); + } } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -1230,13 +1269,14 @@ public function getLoginLogStatisticsByDayWithHttpInfo($org_id, $start = null, $ try { $response = $this->client->send($request, $options); } catch (RequestException $e) { + $eResponse = $this->getExceptionResponse($e); throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), - $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? (string) $e->getResponse()->getBody() : null + $eResponse ? $eResponse->getHeaders() : null, + $eResponse ? (string) $eResponse->getBody() : null ); - } catch (ConnectException $e) { + } catch (NetworkExceptionInterface $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), @@ -1359,7 +1399,15 @@ function ($response) use ($returnType) { ]; }, function ($exception) { - $response = $exception->getResponse(); + $response = $this->getExceptionResponse($exception); + if ($response === null) { + throw new ApiException( + "[{$exception->getCode()}] {$exception->getMessage()}", + (int) $exception->getCode(), + null, + null + ); + } $statusCode = $response->getStatusCode(); throw new ApiException( sprintf( @@ -1460,7 +1508,7 @@ public function getLoginLogStatisticsByDayRequest($org_id, $start = null, $end = // path params if ($org_id !== null) { $resourcePath = str_replace( - '{' . 'org_id' . '}', + '{org_id}', ObjectSerializer::toPathValue($org_id), $resourcePath ); @@ -1491,7 +1539,11 @@ public function getLoginLogStatisticsByDayRequest($org_id, $start = null, $end = } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + try { + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + } catch (\JsonException $e) { + throw new \InvalidArgumentException('json_encode error: ' . $e->getMessage(), 0, $e); + } } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -1571,13 +1623,14 @@ public function getPythonRunStatisticsByBaseWithHttpInfo($org_id, $start = null, try { $response = $this->client->send($request, $options); } catch (RequestException $e) { + $eResponse = $this->getExceptionResponse($e); throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), - $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? (string) $e->getResponse()->getBody() : null + $eResponse ? $eResponse->getHeaders() : null, + $eResponse ? (string) $eResponse->getBody() : null ); - } catch (ConnectException $e) { + } catch (NetworkExceptionInterface $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), @@ -1700,7 +1753,15 @@ function ($response) use ($returnType) { ]; }, function ($exception) { - $response = $exception->getResponse(); + $response = $this->getExceptionResponse($exception); + if ($response === null) { + throw new ApiException( + "[{$exception->getCode()}] {$exception->getMessage()}", + (int) $exception->getCode(), + null, + null + ); + } $statusCode = $response->getStatusCode(); throw new ApiException( sprintf( @@ -1801,7 +1862,7 @@ public function getPythonRunStatisticsByBaseRequest($org_id, $start = null, $end // path params if ($org_id !== null) { $resourcePath = str_replace( - '{' . 'org_id' . '}', + '{org_id}', ObjectSerializer::toPathValue($org_id), $resourcePath ); @@ -1832,7 +1893,11 @@ public function getPythonRunStatisticsByBaseRequest($org_id, $start = null, $end } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + try { + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + } catch (\JsonException $e) { + throw new \InvalidArgumentException('json_encode error: ' . $e->getMessage(), 0, $e); + } } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -1914,13 +1979,14 @@ public function getPythonRunStatisticsByDayWithHttpInfo($org_id, $dtable_uuid = try { $response = $this->client->send($request, $options); } catch (RequestException $e) { + $eResponse = $this->getExceptionResponse($e); throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), - $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? (string) $e->getResponse()->getBody() : null + $eResponse ? $eResponse->getHeaders() : null, + $eResponse ? (string) $eResponse->getBody() : null ); - } catch (ConnectException $e) { + } catch (NetworkExceptionInterface $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), @@ -2045,7 +2111,15 @@ function ($response) use ($returnType) { ]; }, function ($exception) { - $response = $exception->getResponse(); + $response = $this->getExceptionResponse($exception); + if ($response === null) { + throw new ApiException( + "[{$exception->getCode()}] {$exception->getMessage()}", + (int) $exception->getCode(), + null, + null + ); + } $statusCode = $response->getStatusCode(); throw new ApiException( sprintf( @@ -2160,7 +2234,7 @@ public function getPythonRunStatisticsByDayRequest($org_id, $dtable_uuid = null, // path params if ($org_id !== null) { $resourcePath = str_replace( - '{' . 'org_id' . '}', + '{org_id}', ObjectSerializer::toPathValue($org_id), $resourcePath ); @@ -2191,7 +2265,11 @@ public function getPythonRunStatisticsByDayRequest($org_id, $dtable_uuid = null, } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + try { + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + } catch (\JsonException $e) { + throw new \InvalidArgumentException('json_encode error: ' . $e->getMessage(), 0, $e); + } } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -2271,13 +2349,14 @@ public function getUserOrBaseAIStatisticsWithHttpInfo($group_by, $date, $org_id, try { $response = $this->client->send($request, $options); } catch (RequestException $e) { + $eResponse = $this->getExceptionResponse($e); throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), - $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? (string) $e->getResponse()->getBody() : null + $eResponse ? $eResponse->getHeaders() : null, + $eResponse ? (string) $eResponse->getBody() : null ); - } catch (ConnectException $e) { + } catch (NetworkExceptionInterface $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), @@ -2400,7 +2479,15 @@ function ($response) use ($returnType) { ]; }, function ($exception) { - $response = $exception->getResponse(); + $response = $this->getExceptionResponse($exception); + if ($response === null) { + throw new ApiException( + "[{$exception->getCode()}] {$exception->getMessage()}", + (int) $exception->getCode(), + null, + null + ); + } $statusCode = $response->getStatusCode(); throw new ApiException( sprintf( @@ -2513,7 +2600,7 @@ public function getUserOrBaseAIStatisticsRequest($group_by, $date, $org_id, $pag // path params if ($org_id !== null) { $resourcePath = str_replace( - '{' . 'org_id' . '}', + '{org_id}', ObjectSerializer::toPathValue($org_id), $resourcePath ); @@ -2544,7 +2631,11 @@ public function getUserOrBaseAIStatisticsRequest($group_by, $date, $org_id, $pag } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + try { + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + } catch (\JsonException $e) { + throw new \InvalidArgumentException('json_encode error: ' . $e->getMessage(), 0, $e); + } } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -2604,6 +2695,21 @@ protected function createHttpClientOption() return $options; } + /** + * Returns the response attached to a Guzzle exception, if there is one. + * + * Guzzle 7 exposes getResponse() on RequestException, while Guzzle 8 only + * exposes it on ResponseException and its subclasses. + * + * @param \Throwable $exception + * + * @return ResponseInterface|null + */ + private function getExceptionResponse(\Throwable $exception): ?ResponseInterface + { + return method_exists($exception, 'getResponse') ? $exception->getResponse() : null; + } + private function handleResponseWithDataType( string $dataType, RequestInterface $request, diff --git a/lib/TeamAdmin/UpdateGroup200Response.php b/lib/TeamAdmin/UpdateGroup200Response.php index 6721a3cb..0baef93d 100644 --- a/lib/TeamAdmin/UpdateGroup200Response.php +++ b/lib/TeamAdmin/UpdateGroup200Response.php @@ -44,17 +44,17 @@ class UpdateGroup200Response implements ModelInterface, ArrayAccess, \JsonSerial public const DISCRIMINATOR = null; /** - * The original name of the model. - * - * @var string - */ + * The original name of the model. + * + * @var string + */ protected static $openAPIModelName = 'updateGroup_200_response'; /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ protected static $openAPITypes = [ 'id' => 'int', 'group_name' => 'string', @@ -66,12 +66,12 @@ class UpdateGroup200Response implements ModelInterface, ArrayAccess, \JsonSerial ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - * @phpstan-var array - * @psalm-var array - */ + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ protected static $openAPIFormats = [ 'id' => null, 'group_name' => null, @@ -83,10 +83,10 @@ class UpdateGroup200Response implements ModelInterface, ArrayAccess, \JsonSerial ]; /** - * Array of nullable properties. Used for (de)serialization - * - * @var boolean[] - */ + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ protected static array $openAPINullables = [ 'id' => false, 'group_name' => false, @@ -98,10 +98,10 @@ class UpdateGroup200Response implements ModelInterface, ArrayAccess, \JsonSerial ]; /** - * If a nullable field gets set to null, insert it here - * - * @var boolean[] - */ + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ protected array $openAPINullablesSetToNull = []; /** @@ -289,14 +289,14 @@ public function __construct(?array $data = null) } /** - * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName - * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the - * $this->openAPINullablesSetToNull array - * - * @param string $variableName - * @param array $fields - * @param mixed $defaultValue - */ + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ private function setIfExists(string $variableName, array $fields, $defaultValue): void { if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { diff --git a/lib/TeamAdmin/UpdateGroupMemberRoleRequest.php b/lib/TeamAdmin/UpdateGroupMemberRoleRequest.php index eabd85f0..0ba7def3 100644 --- a/lib/TeamAdmin/UpdateGroupMemberRoleRequest.php +++ b/lib/TeamAdmin/UpdateGroupMemberRoleRequest.php @@ -44,46 +44,46 @@ class UpdateGroupMemberRoleRequest implements ModelInterface, ArrayAccess, \Json public const DISCRIMINATOR = null; /** - * The original name of the model. - * - * @var string - */ + * The original name of the model. + * + * @var string + */ protected static $openAPIModelName = 'updateGroupMemberRole_request'; /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ protected static $openAPITypes = [ 'is_admin' => 'bool' ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - * @phpstan-var array - * @psalm-var array - */ + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ protected static $openAPIFormats = [ 'is_admin' => null ]; /** - * Array of nullable properties. Used for (de)serialization - * - * @var boolean[] - */ + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ protected static array $openAPINullables = [ 'is_admin' => false ]; /** - * If a nullable field gets set to null, insert it here - * - * @var boolean[] - */ + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ protected array $openAPINullablesSetToNull = []; /** @@ -247,14 +247,14 @@ public function __construct(?array $data = null) } /** - * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName - * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the - * $this->openAPINullablesSetToNull array - * - * @param string $variableName - * @param array $fields - * @param mixed $defaultValue - */ + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ private function setIfExists(string $variableName, array $fields, $defaultValue): void { if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { diff --git a/lib/TeamAdmin/UpdateGroupRequest.php b/lib/TeamAdmin/UpdateGroupRequest.php index 1b06498d..3c54eea0 100644 --- a/lib/TeamAdmin/UpdateGroupRequest.php +++ b/lib/TeamAdmin/UpdateGroupRequest.php @@ -44,49 +44,49 @@ class UpdateGroupRequest implements ModelInterface, ArrayAccess, \JsonSerializab public const DISCRIMINATOR = null; /** - * The original name of the model. - * - * @var string - */ + * The original name of the model. + * + * @var string + */ protected static $openAPIModelName = 'updateGroup_request'; /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ protected static $openAPITypes = [ 'new_owner' => 'string', 'new_group_name' => 'string' ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - * @phpstan-var array - * @psalm-var array - */ + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ protected static $openAPIFormats = [ 'new_owner' => null, 'new_group_name' => null ]; /** - * Array of nullable properties. Used for (de)serialization - * - * @var boolean[] - */ + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ protected static array $openAPINullables = [ 'new_owner' => false, 'new_group_name' => false ]; /** - * If a nullable field gets set to null, insert it here - * - * @var boolean[] - */ + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ protected array $openAPINullablesSetToNull = []; /** @@ -254,14 +254,14 @@ public function __construct(?array $data = null) } /** - * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName - * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the - * $this->openAPINullablesSetToNull array - * - * @param string $variableName - * @param array $fields - * @param mixed $defaultValue - */ + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ private function setIfExists(string $variableName, array $fields, $defaultValue): void { if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { diff --git a/lib/TeamAdmin/UpdateInviteLink200Response.php b/lib/TeamAdmin/UpdateInviteLink200Response.php index 52cf5651..53b45bd9 100644 --- a/lib/TeamAdmin/UpdateInviteLink200Response.php +++ b/lib/TeamAdmin/UpdateInviteLink200Response.php @@ -44,17 +44,17 @@ class UpdateInviteLink200Response implements ModelInterface, ArrayAccess, \JsonS public const DISCRIMINATOR = null; /** - * The original name of the model. - * - * @var string - */ + * The original name of the model. + * + * @var string + */ protected static $openAPIModelName = 'updateInviteLink_200_response'; /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ protected static $openAPITypes = [ 'username' => 'string', 'permission' => 'string', @@ -68,12 +68,12 @@ class UpdateInviteLink200Response implements ModelInterface, ArrayAccess, \JsonS ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - * @phpstan-var array - * @psalm-var array - */ + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ protected static $openAPIFormats = [ 'username' => null, 'permission' => null, @@ -87,10 +87,10 @@ class UpdateInviteLink200Response implements ModelInterface, ArrayAccess, \JsonS ]; /** - * Array of nullable properties. Used for (de)serialization - * - * @var boolean[] - */ + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ protected static array $openAPINullables = [ 'username' => false, 'permission' => false, @@ -104,10 +104,10 @@ class UpdateInviteLink200Response implements ModelInterface, ArrayAccess, \JsonS ]; /** - * If a nullable field gets set to null, insert it here - * - * @var boolean[] - */ + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ protected array $openAPINullablesSetToNull = []; /** @@ -303,14 +303,14 @@ public function __construct(?array $data = null) } /** - * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName - * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the - * $this->openAPINullablesSetToNull array - * - * @param string $variableName - * @param array $fields - * @param mixed $defaultValue - */ + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ private function setIfExists(string $variableName, array $fields, $defaultValue): void { if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { diff --git a/lib/TeamAdmin/UpdateInviteLinkRequest.php b/lib/TeamAdmin/UpdateInviteLinkRequest.php index 28efa6e2..a71d4b63 100644 --- a/lib/TeamAdmin/UpdateInviteLinkRequest.php +++ b/lib/TeamAdmin/UpdateInviteLinkRequest.php @@ -44,17 +44,17 @@ class UpdateInviteLinkRequest implements ModelInterface, ArrayAccess, \JsonSeria public const DISCRIMINATOR = null; /** - * The original name of the model. - * - * @var string - */ + * The original name of the model. + * + * @var string + */ protected static $openAPIModelName = 'updateInviteLink_request'; /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ protected static $openAPITypes = [ 'permission' => '\SeaTable\Client\TeamAdmin\TeamAdminPermission', 'password' => 'string', @@ -62,12 +62,12 @@ class UpdateInviteLinkRequest implements ModelInterface, ArrayAccess, \JsonSeria ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - * @phpstan-var array - * @psalm-var array - */ + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ protected static $openAPIFormats = [ 'permission' => null, 'password' => null, @@ -75,10 +75,10 @@ class UpdateInviteLinkRequest implements ModelInterface, ArrayAccess, \JsonSeria ]; /** - * Array of nullable properties. Used for (de)serialization - * - * @var boolean[] - */ + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ protected static array $openAPINullables = [ 'permission' => false, 'password' => false, @@ -86,10 +86,10 @@ class UpdateInviteLinkRequest implements ModelInterface, ArrayAccess, \JsonSeria ]; /** - * If a nullable field gets set to null, insert it here - * - * @var boolean[] - */ + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ protected array $openAPINullablesSetToNull = []; /** @@ -261,14 +261,14 @@ public function __construct(?array $data = null) } /** - * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName - * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the - * $this->openAPINullablesSetToNull array - * - * @param string $variableName - * @param array $fields - * @param mixed $defaultValue - */ + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ private function setIfExists(string $variableName, array $fields, $defaultValue): void { if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { diff --git a/lib/TeamAdmin/UpdateUser200Response.php b/lib/TeamAdmin/UpdateUser200Response.php index 7d69224b..9adb0b1a 100644 --- a/lib/TeamAdmin/UpdateUser200Response.php +++ b/lib/TeamAdmin/UpdateUser200Response.php @@ -44,17 +44,17 @@ class UpdateUser200Response implements ModelInterface, ArrayAccess, \JsonSeriali public const DISCRIMINATOR = null; /** - * The original name of the model. - * - * @var string - */ + * The original name of the model. + * + * @var string + */ protected static $openAPIModelName = 'updateUser_200_response'; /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ protected static $openAPITypes = [ 'email' => 'string', 'name' => 'string', @@ -71,12 +71,12 @@ class UpdateUser200Response implements ModelInterface, ArrayAccess, \JsonSeriali ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - * @phpstan-var array - * @psalm-var array - */ + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ protected static $openAPIFormats = [ 'email' => null, 'name' => null, @@ -93,10 +93,10 @@ class UpdateUser200Response implements ModelInterface, ArrayAccess, \JsonSeriali ]; /** - * Array of nullable properties. Used for (de)serialization - * - * @var boolean[] - */ + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ protected static array $openAPINullables = [ 'email' => false, 'name' => false, @@ -113,10 +113,10 @@ class UpdateUser200Response implements ModelInterface, ArrayAccess, \JsonSeriali ]; /** - * If a nullable field gets set to null, insert it here - * - * @var boolean[] - */ + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ protected array $openAPINullablesSetToNull = []; /** @@ -324,14 +324,14 @@ public function __construct(?array $data = null) } /** - * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName - * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the - * $this->openAPINullablesSetToNull array - * - * @param string $variableName - * @param array $fields - * @param mixed $defaultValue - */ + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ private function setIfExists(string $variableName, array $fields, $defaultValue): void { if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { diff --git a/lib/TeamAdmin/UsersApi.php b/lib/TeamAdmin/UsersApi.php index 0fc27dcb..1b952558 100644 --- a/lib/TeamAdmin/UsersApi.php +++ b/lib/TeamAdmin/UsersApi.php @@ -28,11 +28,11 @@ use GuzzleHttp\Client; use GuzzleHttp\ClientInterface; -use GuzzleHttp\Exception\ConnectException; use GuzzleHttp\Exception\RequestException; use GuzzleHttp\Psr7\MultipartStream; use GuzzleHttp\Psr7\Request; use GuzzleHttp\RequestOptions; +use Psr\Http\Client\NetworkExceptionInterface; use Psr\Http\Message\RequestInterface; use Psr\Http\Message\ResponseInterface; use SeaTable\Client\ApiException; @@ -198,13 +198,14 @@ public function addUserWithHttpInfo($org_id, $email = null, $name = null, $passw try { $response = $this->client->send($request, $options); } catch (RequestException $e) { + $eResponse = $this->getExceptionResponse($e); throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), - $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? (string) $e->getResponse()->getBody() : null + $eResponse ? $eResponse->getHeaders() : null, + $eResponse ? (string) $eResponse->getBody() : null ); - } catch (ConnectException $e) { + } catch (NetworkExceptionInterface $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), @@ -327,7 +328,15 @@ function ($response) use ($returnType) { ]; }, function ($exception) { - $response = $exception->getResponse(); + $response = $this->getExceptionResponse($exception); + if ($response === null) { + throw new ApiException( + "[{$exception->getCode()}] {$exception->getMessage()}", + (int) $exception->getCode(), + null, + null + ); + } $statusCode = $response->getStatusCode(); throw new ApiException( sprintf( @@ -386,7 +395,7 @@ public function addUserRequest($org_id, $email = null, $name = null, $password = // path params if ($org_id !== null) { $resourcePath = str_replace( - '{' . 'org_id' . '}', + '{org_id}', ObjectSerializer::toPathValue($org_id), $resourcePath ); @@ -430,7 +439,11 @@ public function addUserRequest($org_id, $email = null, $name = null, $password = } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + try { + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + } catch (\JsonException $e) { + throw new \InvalidArgumentException('json_encode error: ' . $e->getMessage(), 0, $e); + } } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -504,13 +517,14 @@ public function deleteUserWithHttpInfo($org_id, $user_id, string $contentType = try { $response = $this->client->send($request, $options); } catch (RequestException $e) { + $eResponse = $this->getExceptionResponse($e); throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), - $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? (string) $e->getResponse()->getBody() : null + $eResponse ? $eResponse->getHeaders() : null, + $eResponse ? (string) $eResponse->getBody() : null ); - } catch (ConnectException $e) { + } catch (NetworkExceptionInterface $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), @@ -627,7 +641,15 @@ function ($response) use ($returnType) { ]; }, function ($exception) { - $response = $exception->getResponse(); + $response = $this->getExceptionResponse($exception); + if ($response === null) { + throw new ApiException( + "[{$exception->getCode()}] {$exception->getMessage()}", + (int) $exception->getCode(), + null, + null + ); + } $statusCode = $response->getStatusCode(); throw new ApiException( sprintf( @@ -689,7 +711,7 @@ public function deleteUserRequest($org_id, $user_id, string $contentType = self: // path params if ($org_id !== null) { $resourcePath = str_replace( - '{' . 'org_id' . '}', + '{org_id}', ObjectSerializer::toPathValue($org_id), $resourcePath ); @@ -697,7 +719,7 @@ public function deleteUserRequest($org_id, $user_id, string $contentType = self: // path params if ($user_id !== null) { $resourcePath = str_replace( - '{' . 'user_id' . '}', + '{user_id}', ObjectSerializer::toPathValue($user_id), $resourcePath ); @@ -728,7 +750,11 @@ public function deleteUserRequest($org_id, $user_id, string $contentType = self: } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + try { + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + } catch (\JsonException $e) { + throw new \InvalidArgumentException('json_encode error: ' . $e->getMessage(), 0, $e); + } } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -802,13 +828,14 @@ public function disableTwoFactorWithHttpInfo($org_id, $user_id, string $contentT try { $response = $this->client->send($request, $options); } catch (RequestException $e) { + $eResponse = $this->getExceptionResponse($e); throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), - $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? (string) $e->getResponse()->getBody() : null + $eResponse ? $eResponse->getHeaders() : null, + $eResponse ? (string) $eResponse->getBody() : null ); - } catch (ConnectException $e) { + } catch (NetworkExceptionInterface $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), @@ -925,7 +952,15 @@ function ($response) use ($returnType) { ]; }, function ($exception) { - $response = $exception->getResponse(); + $response = $this->getExceptionResponse($exception); + if ($response === null) { + throw new ApiException( + "[{$exception->getCode()}] {$exception->getMessage()}", + (int) $exception->getCode(), + null, + null + ); + } $statusCode = $response->getStatusCode(); throw new ApiException( sprintf( @@ -987,7 +1022,7 @@ public function disableTwoFactorRequest($org_id, $user_id, string $contentType = // path params if ($org_id !== null) { $resourcePath = str_replace( - '{' . 'org_id' . '}', + '{org_id}', ObjectSerializer::toPathValue($org_id), $resourcePath ); @@ -995,7 +1030,7 @@ public function disableTwoFactorRequest($org_id, $user_id, string $contentType = // path params if ($user_id !== null) { $resourcePath = str_replace( - '{' . 'user_id' . '}', + '{user_id}', ObjectSerializer::toPathValue($user_id), $resourcePath ); @@ -1026,7 +1061,11 @@ public function disableTwoFactorRequest($org_id, $user_id, string $contentType = } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + try { + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + } catch (\JsonException $e) { + throw new \InvalidArgumentException('json_encode error: ' . $e->getMessage(), 0, $e); + } } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -1102,13 +1141,14 @@ public function enforceTwofactorWithHttpInfo($org_id, $user_id, $enforce_twofact try { $response = $this->client->send($request, $options); } catch (RequestException $e) { + $eResponse = $this->getExceptionResponse($e); throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), - $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? (string) $e->getResponse()->getBody() : null + $eResponse ? $eResponse->getHeaders() : null, + $eResponse ? (string) $eResponse->getBody() : null ); - } catch (ConnectException $e) { + } catch (NetworkExceptionInterface $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), @@ -1227,7 +1267,15 @@ function ($response) use ($returnType) { ]; }, function ($exception) { - $response = $exception->getResponse(); + $response = $this->getExceptionResponse($exception); + if ($response === null) { + throw new ApiException( + "[{$exception->getCode()}] {$exception->getMessage()}", + (int) $exception->getCode(), + null, + null + ); + } $statusCode = $response->getStatusCode(); throw new ApiException( sprintf( @@ -1291,7 +1339,7 @@ public function enforceTwofactorRequest($org_id, $user_id, $enforce_twofactor_re // path params if ($org_id !== null) { $resourcePath = str_replace( - '{' . 'org_id' . '}', + '{org_id}', ObjectSerializer::toPathValue($org_id), $resourcePath ); @@ -1299,7 +1347,7 @@ public function enforceTwofactorRequest($org_id, $user_id, $enforce_twofactor_re // path params if ($user_id !== null) { $resourcePath = str_replace( - '{' . 'user_id' . '}', + '{user_id}', ObjectSerializer::toPathValue($user_id), $resourcePath ); @@ -1316,7 +1364,11 @@ public function enforceTwofactorRequest($org_id, $user_id, $enforce_twofactor_re if (isset($enforce_twofactor_request)) { if (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the body - $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($enforce_twofactor_request)); + try { + $httpBody = json_encode(ObjectSerializer::sanitizeForSerialization($enforce_twofactor_request), JSON_THROW_ON_ERROR); + } catch (\JsonException $e) { + throw new \InvalidArgumentException('json_encode error: ' . $e->getMessage(), 0, $e); + } } else { $httpBody = $enforce_twofactor_request; } @@ -1337,7 +1389,11 @@ public function enforceTwofactorRequest($org_id, $user_id, $enforce_twofactor_re } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + try { + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + } catch (\JsonException $e) { + throw new \InvalidArgumentException('json_encode error: ' . $e->getMessage(), 0, $e); + } } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -1411,13 +1467,14 @@ public function getUserWithHttpInfo($org_id, $user_id, string $contentType = sel try { $response = $this->client->send($request, $options); } catch (RequestException $e) { + $eResponse = $this->getExceptionResponse($e); throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), - $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? (string) $e->getResponse()->getBody() : null + $eResponse ? $eResponse->getHeaders() : null, + $eResponse ? (string) $eResponse->getBody() : null ); - } catch (ConnectException $e) { + } catch (NetworkExceptionInterface $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), @@ -1534,7 +1591,15 @@ function ($response) use ($returnType) { ]; }, function ($exception) { - $response = $exception->getResponse(); + $response = $this->getExceptionResponse($exception); + if ($response === null) { + throw new ApiException( + "[{$exception->getCode()}] {$exception->getMessage()}", + (int) $exception->getCode(), + null, + null + ); + } $statusCode = $response->getStatusCode(); throw new ApiException( sprintf( @@ -1596,7 +1661,7 @@ public function getUserRequest($org_id, $user_id, string $contentType = self::co // path params if ($org_id !== null) { $resourcePath = str_replace( - '{' . 'org_id' . '}', + '{org_id}', ObjectSerializer::toPathValue($org_id), $resourcePath ); @@ -1604,7 +1669,7 @@ public function getUserRequest($org_id, $user_id, string $contentType = self::co // path params if ($user_id !== null) { $resourcePath = str_replace( - '{' . 'user_id' . '}', + '{user_id}', ObjectSerializer::toPathValue($user_id), $resourcePath ); @@ -1635,7 +1700,11 @@ public function getUserRequest($org_id, $user_id, string $contentType = self::co } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + try { + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + } catch (\JsonException $e) { + throw new \InvalidArgumentException('json_encode error: ' . $e->getMessage(), 0, $e); + } } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -1713,13 +1782,14 @@ public function listManagedAppsWithHttpInfo($org_id, $user_id, $page = null, $pe try { $response = $this->client->send($request, $options); } catch (RequestException $e) { + $eResponse = $this->getExceptionResponse($e); throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), - $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? (string) $e->getResponse()->getBody() : null + $eResponse ? $eResponse->getHeaders() : null, + $eResponse ? (string) $eResponse->getBody() : null ); - } catch (ConnectException $e) { + } catch (NetworkExceptionInterface $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), @@ -1840,7 +1910,15 @@ function ($response) use ($returnType) { ]; }, function ($exception) { - $response = $exception->getResponse(); + $response = $this->getExceptionResponse($exception); + if ($response === null) { + throw new ApiException( + "[{$exception->getCode()}] {$exception->getMessage()}", + (int) $exception->getCode(), + null, + null + ); + } $statusCode = $response->getStatusCode(); throw new ApiException( sprintf( @@ -1930,7 +2008,7 @@ public function listManagedAppsRequest($org_id, $user_id, $page = null, $per_pag // path params if ($org_id !== null) { $resourcePath = str_replace( - '{' . 'org_id' . '}', + '{org_id}', ObjectSerializer::toPathValue($org_id), $resourcePath ); @@ -1938,7 +2016,7 @@ public function listManagedAppsRequest($org_id, $user_id, $page = null, $per_pag // path params if ($user_id !== null) { $resourcePath = str_replace( - '{' . 'user_id' . '}', + '{user_id}', ObjectSerializer::toPathValue($user_id), $resourcePath ); @@ -1969,7 +2047,11 @@ public function listManagedAppsRequest($org_id, $user_id, $page = null, $per_pag } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + try { + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + } catch (\JsonException $e) { + throw new \InvalidArgumentException('json_encode error: ' . $e->getMessage(), 0, $e); + } } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -2045,13 +2127,14 @@ public function listTeamUsersWithHttpInfo($org_id, $page = null, $per_page = nul try { $response = $this->client->send($request, $options); } catch (RequestException $e) { + $eResponse = $this->getExceptionResponse($e); throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), - $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? (string) $e->getResponse()->getBody() : null + $eResponse ? $eResponse->getHeaders() : null, + $eResponse ? (string) $eResponse->getBody() : null ); - } catch (ConnectException $e) { + } catch (NetworkExceptionInterface $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), @@ -2170,7 +2253,15 @@ function ($response) use ($returnType) { ]; }, function ($exception) { - $response = $exception->getResponse(); + $response = $this->getExceptionResponse($exception); + if ($response === null) { + throw new ApiException( + "[{$exception->getCode()}] {$exception->getMessage()}", + (int) $exception->getCode(), + null, + null + ); + } $statusCode = $response->getStatusCode(); throw new ApiException( sprintf( @@ -2249,7 +2340,7 @@ public function listTeamUsersRequest($org_id, $page = null, $per_page = null, st // path params if ($org_id !== null) { $resourcePath = str_replace( - '{' . 'org_id' . '}', + '{org_id}', ObjectSerializer::toPathValue($org_id), $resourcePath ); @@ -2280,7 +2371,11 @@ public function listTeamUsersRequest($org_id, $page = null, $per_page = null, st } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + try { + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + } catch (\JsonException $e) { + throw new \InvalidArgumentException('json_encode error: ' . $e->getMessage(), 0, $e); + } } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -2358,13 +2453,14 @@ public function listUsableAppsWithHttpInfo($org_id, $user_id, $page = null, $per try { $response = $this->client->send($request, $options); } catch (RequestException $e) { + $eResponse = $this->getExceptionResponse($e); throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), - $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? (string) $e->getResponse()->getBody() : null + $eResponse ? $eResponse->getHeaders() : null, + $eResponse ? (string) $eResponse->getBody() : null ); - } catch (ConnectException $e) { + } catch (NetworkExceptionInterface $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), @@ -2485,7 +2581,15 @@ function ($response) use ($returnType) { ]; }, function ($exception) { - $response = $exception->getResponse(); + $response = $this->getExceptionResponse($exception); + if ($response === null) { + throw new ApiException( + "[{$exception->getCode()}] {$exception->getMessage()}", + (int) $exception->getCode(), + null, + null + ); + } $statusCode = $response->getStatusCode(); throw new ApiException( sprintf( @@ -2575,7 +2679,7 @@ public function listUsableAppsRequest($org_id, $user_id, $page = null, $per_page // path params if ($org_id !== null) { $resourcePath = str_replace( - '{' . 'org_id' . '}', + '{org_id}', ObjectSerializer::toPathValue($org_id), $resourcePath ); @@ -2583,7 +2687,7 @@ public function listUsableAppsRequest($org_id, $user_id, $page = null, $per_page // path params if ($user_id !== null) { $resourcePath = str_replace( - '{' . 'user_id' . '}', + '{user_id}', ObjectSerializer::toPathValue($user_id), $resourcePath ); @@ -2614,7 +2718,11 @@ public function listUsableAppsRequest($org_id, $user_id, $page = null, $per_page } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + try { + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + } catch (\JsonException $e) { + throw new \InvalidArgumentException('json_encode error: ' . $e->getMessage(), 0, $e); + } } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -2688,13 +2796,14 @@ public function resetUserPasswordWithHttpInfo($org_id, $user_id, string $content try { $response = $this->client->send($request, $options); } catch (RequestException $e) { + $eResponse = $this->getExceptionResponse($e); throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), - $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? (string) $e->getResponse()->getBody() : null + $eResponse ? $eResponse->getHeaders() : null, + $eResponse ? (string) $eResponse->getBody() : null ); - } catch (ConnectException $e) { + } catch (NetworkExceptionInterface $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), @@ -2811,7 +2920,15 @@ function ($response) use ($returnType) { ]; }, function ($exception) { - $response = $exception->getResponse(); + $response = $this->getExceptionResponse($exception); + if ($response === null) { + throw new ApiException( + "[{$exception->getCode()}] {$exception->getMessage()}", + (int) $exception->getCode(), + null, + null + ); + } $statusCode = $response->getStatusCode(); throw new ApiException( sprintf( @@ -2873,7 +2990,7 @@ public function resetUserPasswordRequest($org_id, $user_id, string $contentType // path params if ($org_id !== null) { $resourcePath = str_replace( - '{' . 'org_id' . '}', + '{org_id}', ObjectSerializer::toPathValue($org_id), $resourcePath ); @@ -2881,7 +2998,7 @@ public function resetUserPasswordRequest($org_id, $user_id, string $contentType // path params if ($user_id !== null) { $resourcePath = str_replace( - '{' . 'user_id' . '}', + '{user_id}', ObjectSerializer::toPathValue($user_id), $resourcePath ); @@ -2912,7 +3029,11 @@ public function resetUserPasswordRequest($org_id, $user_id, string $contentType } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + try { + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + } catch (\JsonException $e) { + throw new \InvalidArgumentException('json_encode error: ' . $e->getMessage(), 0, $e); + } } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -2998,13 +3119,14 @@ public function updateUserWithHttpInfo($org_id, $user_id, $name = null, $contact try { $response = $this->client->send($request, $options); } catch (RequestException $e) { + $eResponse = $this->getExceptionResponse($e); throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), - $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? (string) $e->getResponse()->getBody() : null + $eResponse ? $eResponse->getHeaders() : null, + $eResponse ? (string) $eResponse->getBody() : null ); - } catch (ConnectException $e) { + } catch (NetworkExceptionInterface $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), @@ -3133,7 +3255,15 @@ function ($response) use ($returnType) { ]; }, function ($exception) { - $response = $exception->getResponse(); + $response = $this->getExceptionResponse($exception); + if ($response === null) { + throw new ApiException( + "[{$exception->getCode()}] {$exception->getMessage()}", + (int) $exception->getCode(), + null, + null + ); + } $statusCode = $response->getStatusCode(); throw new ApiException( sprintf( @@ -3207,7 +3337,7 @@ public function updateUserRequest($org_id, $user_id, $name = null, $contact_emai // path params if ($org_id !== null) { $resourcePath = str_replace( - '{' . 'org_id' . '}', + '{org_id}', ObjectSerializer::toPathValue($org_id), $resourcePath ); @@ -3215,7 +3345,7 @@ public function updateUserRequest($org_id, $user_id, $name = null, $contact_emai // path params if ($user_id !== null) { $resourcePath = str_replace( - '{' . 'user_id' . '}', + '{user_id}', ObjectSerializer::toPathValue($user_id), $resourcePath ); @@ -3261,7 +3391,11 @@ public function updateUserRequest($org_id, $user_id, $name = null, $contact_emai } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + try { + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + } catch (\JsonException $e) { + throw new \InvalidArgumentException('json_encode error: ' . $e->getMessage(), 0, $e); + } } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -3321,6 +3455,21 @@ protected function createHttpClientOption() return $options; } + /** + * Returns the response attached to a Guzzle exception, if there is one. + * + * Guzzle 7 exposes getResponse() on RequestException, while Guzzle 8 only + * exposes it on ResponseException and its subclasses. + * + * @param \Throwable $exception + * + * @return ResponseInterface|null + */ + private function getExceptionResponse(\Throwable $exception): ?ResponseInterface + { + return method_exists($exception, 'getResponse') ? $exception->getResponse() : null; + } + private function handleResponseWithDataType( string $dataType, RequestInterface $request, diff --git a/lib/User/Action.php b/lib/User/Action.php index eef1f4d7..21ad3b38 100644 --- a/lib/User/Action.php +++ b/lib/User/Action.php @@ -44,49 +44,49 @@ class Action implements ModelInterface, ArrayAccess, \JsonSerializable public const DISCRIMINATOR = null; /** - * The original name of the model. - * - * @var string - */ + * The original name of the model. + * + * @var string + */ protected static $openAPIModelName = 'action'; /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ protected static $openAPITypes = [ 'type' => 'string', 'users' => 'string[]' ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - * @phpstan-var array - * @psalm-var array - */ + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ protected static $openAPIFormats = [ 'type' => null, 'users' => null ]; /** - * Array of nullable properties. Used for (de)serialization - * - * @var boolean[] - */ + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ protected static array $openAPINullables = [ 'type' => false, 'users' => false ]; /** - * If a nullable field gets set to null, insert it here - * - * @var boolean[] - */ + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ protected array $openAPINullablesSetToNull = []; /** @@ -254,14 +254,14 @@ public function __construct(?array $data = null) } /** - * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName - * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the - * $this->openAPINullablesSetToNull array - * - * @param string $variableName - * @param array $fields - * @param mixed $defaultValue - */ + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ private function setIfExists(string $variableName, array $fields, $defaultValue): void { if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { diff --git a/lib/User/ActionAddRecord.php b/lib/User/ActionAddRecord.php index 5e3ef683..02779f46 100644 --- a/lib/User/ActionAddRecord.php +++ b/lib/User/ActionAddRecord.php @@ -44,17 +44,17 @@ class ActionAddRecord implements ModelInterface, ArrayAccess, \JsonSerializable public const DISCRIMINATOR = null; /** - * The original name of the model. - * - * @var string - */ + * The original name of the model. + * + * @var string + */ protected static $openAPIModelName = 'action_add_record'; /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ protected static $openAPITypes = [ 'type' => 'string', 'row' => 'array', @@ -62,12 +62,12 @@ class ActionAddRecord implements ModelInterface, ArrayAccess, \JsonSerializable ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - * @phpstan-var array - * @psalm-var array - */ + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ protected static $openAPIFormats = [ 'type' => null, 'row' => null, @@ -75,10 +75,10 @@ class ActionAddRecord implements ModelInterface, ArrayAccess, \JsonSerializable ]; /** - * Array of nullable properties. Used for (de)serialization - * - * @var boolean[] - */ + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ protected static array $openAPINullables = [ 'type' => false, 'row' => false, @@ -86,10 +86,10 @@ class ActionAddRecord implements ModelInterface, ArrayAccess, \JsonSerializable ]; /** - * If a nullable field gets set to null, insert it here - * - * @var boolean[] - */ + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ protected array $openAPINullablesSetToNull = []; /** @@ -274,14 +274,14 @@ public function __construct(?array $data = null) } /** - * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName - * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the - * $this->openAPINullablesSetToNull array - * - * @param string $variableName - * @param array $fields - * @param mixed $defaultValue - */ + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ private function setIfExists(string $variableName, array $fields, $defaultValue): void { if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { diff --git a/lib/User/ActionAddRecordToOtherTable.php b/lib/User/ActionAddRecordToOtherTable.php index 9202596e..7d7edca2 100644 --- a/lib/User/ActionAddRecordToOtherTable.php +++ b/lib/User/ActionAddRecordToOtherTable.php @@ -44,17 +44,17 @@ class ActionAddRecordToOtherTable implements ModelInterface, ArrayAccess, \JsonS public const DISCRIMINATOR = null; /** - * The original name of the model. - * - * @var string - */ + * The original name of the model. + * + * @var string + */ protected static $openAPIModelName = 'action_add_record_to_other_table'; /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ protected static $openAPITypes = [ 'type' => 'string', '_id' => 'string', @@ -63,12 +63,12 @@ class ActionAddRecordToOtherTable implements ModelInterface, ArrayAccess, \JsonS ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - * @phpstan-var array - * @psalm-var array - */ + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ protected static $openAPIFormats = [ 'type' => null, '_id' => null, @@ -77,10 +77,10 @@ class ActionAddRecordToOtherTable implements ModelInterface, ArrayAccess, \JsonS ]; /** - * Array of nullable properties. Used for (de)serialization - * - * @var boolean[] - */ + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ protected static array $openAPINullables = [ 'type' => false, '_id' => false, @@ -89,10 +89,10 @@ class ActionAddRecordToOtherTable implements ModelInterface, ArrayAccess, \JsonS ]; /** - * If a nullable field gets set to null, insert it here - * - * @var boolean[] - */ + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ protected array $openAPINullablesSetToNull = []; /** @@ -281,14 +281,14 @@ public function __construct(?array $data = null) } /** - * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName - * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the - * $this->openAPINullablesSetToNull array - * - * @param string $variableName - * @param array $fields - * @param mixed $defaultValue - */ + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ private function setIfExists(string $variableName, array $fields, $defaultValue): void { if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { diff --git a/lib/User/ActionAddRecordToOtherTableRow.php b/lib/User/ActionAddRecordToOtherTableRow.php index 9e836b7b..1d7b841e 100644 --- a/lib/User/ActionAddRecordToOtherTableRow.php +++ b/lib/User/ActionAddRecordToOtherTableRow.php @@ -44,46 +44,46 @@ class ActionAddRecordToOtherTableRow implements ModelInterface, ArrayAccess, \Js public const DISCRIMINATOR = null; /** - * The original name of the model. - * - * @var string - */ + * The original name of the model. + * + * @var string + */ protected static $openAPIModelName = 'action_add_record_to_other_table_row'; /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ protected static $openAPITypes = [ ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - * @phpstan-var array - * @psalm-var array - */ + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ protected static $openAPIFormats = [ ]; /** - * Array of nullable properties. Used for (de)serialization - * - * @var boolean[] - */ + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ protected static array $openAPINullables = [ ]; /** - * If a nullable field gets set to null, insert it here - * - * @var boolean[] - */ + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ protected array $openAPINullablesSetToNull = []; /** @@ -246,14 +246,14 @@ public function __construct(?array $data = null) } /** - * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName - * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the - * $this->openAPINullablesSetToNull array - * - * @param string $variableName - * @param array $fields - * @param mixed $defaultValue - */ + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ private function setIfExists(string $variableName, array $fields, $defaultValue): void { if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { diff --git a/lib/User/ActionCalculateAccumulatedValue.php b/lib/User/ActionCalculateAccumulatedValue.php index c24504ea..a2972c04 100644 --- a/lib/User/ActionCalculateAccumulatedValue.php +++ b/lib/User/ActionCalculateAccumulatedValue.php @@ -44,17 +44,17 @@ class ActionCalculateAccumulatedValue implements ModelInterface, ArrayAccess, \J public const DISCRIMINATOR = null; /** - * The original name of the model. - * - * @var string - */ + * The original name of the model. + * + * @var string + */ protected static $openAPIModelName = 'action_calculate_accumulated_value'; /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ protected static $openAPITypes = [ 'type' => 'string', '_id' => 'string', @@ -63,12 +63,12 @@ class ActionCalculateAccumulatedValue implements ModelInterface, ArrayAccess, \J ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - * @phpstan-var array - * @psalm-var array - */ + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ protected static $openAPIFormats = [ 'type' => null, '_id' => null, @@ -77,10 +77,10 @@ class ActionCalculateAccumulatedValue implements ModelInterface, ArrayAccess, \J ]; /** - * Array of nullable properties. Used for (de)serialization - * - * @var boolean[] - */ + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ protected static array $openAPINullables = [ 'type' => false, '_id' => false, @@ -89,10 +89,10 @@ class ActionCalculateAccumulatedValue implements ModelInterface, ArrayAccess, \J ]; /** - * If a nullable field gets set to null, insert it here - * - * @var boolean[] - */ + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ protected array $openAPINullablesSetToNull = []; /** @@ -281,14 +281,14 @@ public function __construct(?array $data = null) } /** - * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName - * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the - * $this->openAPINullablesSetToNull array - * - * @param string $variableName - * @param array $fields - * @param mixed $defaultValue - */ + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ private function setIfExists(string $variableName, array $fields, $defaultValue): void { if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { diff --git a/lib/User/ActionCalculateDelta.php b/lib/User/ActionCalculateDelta.php index 142ed369..141cc3c0 100644 --- a/lib/User/ActionCalculateDelta.php +++ b/lib/User/ActionCalculateDelta.php @@ -44,17 +44,17 @@ class ActionCalculateDelta implements ModelInterface, ArrayAccess, \JsonSerializ public const DISCRIMINATOR = null; /** - * The original name of the model. - * - * @var string - */ + * The original name of the model. + * + * @var string + */ protected static $openAPIModelName = 'action_calculate_delta'; /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ protected static $openAPITypes = [ 'type' => 'string', '_id' => 'string', @@ -63,12 +63,12 @@ class ActionCalculateDelta implements ModelInterface, ArrayAccess, \JsonSerializ ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - * @phpstan-var array - * @psalm-var array - */ + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ protected static $openAPIFormats = [ 'type' => null, '_id' => null, @@ -77,10 +77,10 @@ class ActionCalculateDelta implements ModelInterface, ArrayAccess, \JsonSerializ ]; /** - * Array of nullable properties. Used for (de)serialization - * - * @var boolean[] - */ + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ protected static array $openAPINullables = [ 'type' => false, '_id' => false, @@ -89,10 +89,10 @@ class ActionCalculateDelta implements ModelInterface, ArrayAccess, \JsonSerializ ]; /** - * If a nullable field gets set to null, insert it here - * - * @var boolean[] - */ + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ protected array $openAPINullablesSetToNull = []; /** @@ -281,14 +281,14 @@ public function __construct(?array $data = null) } /** - * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName - * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the - * $this->openAPINullablesSetToNull array - * - * @param string $variableName - * @param array $fields - * @param mixed $defaultValue - */ + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ private function setIfExists(string $variableName, array $fields, $defaultValue): void { if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { diff --git a/lib/User/ActionCalculatePercentage.php b/lib/User/ActionCalculatePercentage.php index c391d5bc..946cd90d 100644 --- a/lib/User/ActionCalculatePercentage.php +++ b/lib/User/ActionCalculatePercentage.php @@ -44,17 +44,17 @@ class ActionCalculatePercentage implements ModelInterface, ArrayAccess, \JsonSer public const DISCRIMINATOR = null; /** - * The original name of the model. - * - * @var string - */ + * The original name of the model. + * + * @var string + */ protected static $openAPIModelName = 'action_calculate_percentage'; /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ protected static $openAPITypes = [ 'type' => 'string', '_id' => 'string', @@ -63,12 +63,12 @@ class ActionCalculatePercentage implements ModelInterface, ArrayAccess, \JsonSer ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - * @phpstan-var array - * @psalm-var array - */ + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ protected static $openAPIFormats = [ 'type' => null, '_id' => null, @@ -77,10 +77,10 @@ class ActionCalculatePercentage implements ModelInterface, ArrayAccess, \JsonSer ]; /** - * Array of nullable properties. Used for (de)serialization - * - * @var boolean[] - */ + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ protected static array $openAPINullables = [ 'type' => false, '_id' => false, @@ -89,10 +89,10 @@ class ActionCalculatePercentage implements ModelInterface, ArrayAccess, \JsonSer ]; /** - * If a nullable field gets set to null, insert it here - * - * @var boolean[] - */ + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ protected array $openAPINullablesSetToNull = []; /** @@ -281,14 +281,14 @@ public function __construct(?array $data = null) } /** - * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName - * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the - * $this->openAPINullablesSetToNull array - * - * @param string $variableName - * @param array $fields - * @param mixed $defaultValue - */ + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ private function setIfExists(string $variableName, array $fields, $defaultValue): void { if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { diff --git a/lib/User/ActionCalculateRank.php b/lib/User/ActionCalculateRank.php index 74b1913d..c3e0143f 100644 --- a/lib/User/ActionCalculateRank.php +++ b/lib/User/ActionCalculateRank.php @@ -44,17 +44,17 @@ class ActionCalculateRank implements ModelInterface, ArrayAccess, \JsonSerializa public const DISCRIMINATOR = null; /** - * The original name of the model. - * - * @var string - */ + * The original name of the model. + * + * @var string + */ protected static $openAPIModelName = 'action_calculate_rank'; /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ protected static $openAPITypes = [ 'type' => 'string', '_id' => 'string', @@ -63,12 +63,12 @@ class ActionCalculateRank implements ModelInterface, ArrayAccess, \JsonSerializa ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - * @phpstan-var array - * @psalm-var array - */ + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ protected static $openAPIFormats = [ 'type' => null, '_id' => null, @@ -77,10 +77,10 @@ class ActionCalculateRank implements ModelInterface, ArrayAccess, \JsonSerializa ]; /** - * Array of nullable properties. Used for (de)serialization - * - * @var boolean[] - */ + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ protected static array $openAPINullables = [ 'type' => false, '_id' => false, @@ -89,10 +89,10 @@ class ActionCalculateRank implements ModelInterface, ArrayAccess, \JsonSerializa ]; /** - * If a nullable field gets set to null, insert it here - * - * @var boolean[] - */ + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ protected array $openAPINullablesSetToNull = []; /** @@ -281,14 +281,14 @@ public function __construct(?array $data = null) } /** - * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName - * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the - * $this->openAPINullablesSetToNull array - * - * @param string $variableName - * @param array $fields - * @param mixed $defaultValue - */ + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ private function setIfExists(string $variableName, array $fields, $defaultValue): void { if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { diff --git a/lib/User/ActionExtractUserName.php b/lib/User/ActionExtractUserName.php index 3bd90fb2..691da0f7 100644 --- a/lib/User/ActionExtractUserName.php +++ b/lib/User/ActionExtractUserName.php @@ -44,17 +44,17 @@ class ActionExtractUserName implements ModelInterface, ArrayAccess, \JsonSeriali public const DISCRIMINATOR = null; /** - * The original name of the model. - * - * @var string - */ + * The original name of the model. + * + * @var string + */ protected static $openAPIModelName = 'action_extract_user_name'; /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ protected static $openAPITypes = [ 'type' => 'string', '_id' => 'string', @@ -63,12 +63,12 @@ class ActionExtractUserName implements ModelInterface, ArrayAccess, \JsonSeriali ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - * @phpstan-var array - * @psalm-var array - */ + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ protected static $openAPIFormats = [ 'type' => null, '_id' => null, @@ -77,10 +77,10 @@ class ActionExtractUserName implements ModelInterface, ArrayAccess, \JsonSeriali ]; /** - * Array of nullable properties. Used for (de)serialization - * - * @var boolean[] - */ + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ protected static array $openAPINullables = [ 'type' => false, '_id' => false, @@ -89,10 +89,10 @@ class ActionExtractUserName implements ModelInterface, ArrayAccess, \JsonSeriali ]; /** - * If a nullable field gets set to null, insert it here - * - * @var boolean[] - */ + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ protected array $openAPINullablesSetToNull = []; /** @@ -281,14 +281,14 @@ public function __construct(?array $data = null) } /** - * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName - * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the - * $this->openAPINullablesSetToNull array - * - * @param string $variableName - * @param array $fields - * @param mixed $defaultValue - */ + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ private function setIfExists(string $variableName, array $fields, $defaultValue): void { if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { diff --git a/lib/User/ActionLinkRecord.php b/lib/User/ActionLinkRecord.php index c989c9e9..f3d29a6d 100644 --- a/lib/User/ActionLinkRecord.php +++ b/lib/User/ActionLinkRecord.php @@ -44,17 +44,17 @@ class ActionLinkRecord implements ModelInterface, ArrayAccess, \JsonSerializable public const DISCRIMINATOR = null; /** - * The original name of the model. - * - * @var string - */ + * The original name of the model. + * + * @var string + */ protected static $openAPIModelName = 'action_link_record'; /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ protected static $openAPITypes = [ 'type' => 'string', '_id' => 'string', @@ -64,12 +64,12 @@ class ActionLinkRecord implements ModelInterface, ArrayAccess, \JsonSerializable ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - * @phpstan-var array - * @psalm-var array - */ + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ protected static $openAPIFormats = [ 'type' => null, '_id' => null, @@ -79,10 +79,10 @@ class ActionLinkRecord implements ModelInterface, ArrayAccess, \JsonSerializable ]; /** - * Array of nullable properties. Used for (de)serialization - * - * @var boolean[] - */ + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ protected static array $openAPINullables = [ 'type' => false, '_id' => false, @@ -92,10 +92,10 @@ class ActionLinkRecord implements ModelInterface, ArrayAccess, \JsonSerializable ]; /** - * If a nullable field gets set to null, insert it here - * - * @var boolean[] - */ + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ protected array $openAPINullablesSetToNull = []; /** @@ -288,14 +288,14 @@ public function __construct(?array $data = null) } /** - * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName - * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the - * $this->openAPINullablesSetToNull array - * - * @param string $variableName - * @param array $fields - * @param mixed $defaultValue - */ + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ private function setIfExists(string $variableName, array $fields, $defaultValue): void { if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { diff --git a/lib/User/ActionLinkRecordMatchConditionsInner.php b/lib/User/ActionLinkRecordMatchConditionsInner.php index 730461f6..3d7646b0 100644 --- a/lib/User/ActionLinkRecordMatchConditionsInner.php +++ b/lib/User/ActionLinkRecordMatchConditionsInner.php @@ -44,49 +44,49 @@ class ActionLinkRecordMatchConditionsInner implements ModelInterface, ArrayAcces public const DISCRIMINATOR = null; /** - * The original name of the model. - * - * @var string - */ + * The original name of the model. + * + * @var string + */ protected static $openAPIModelName = 'action_link_record_match_conditions_inner'; /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ protected static $openAPITypes = [ 'column_key' => 'string', 'other_column_key' => 'string' ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - * @phpstan-var array - * @psalm-var array - */ + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ protected static $openAPIFormats = [ 'column_key' => null, 'other_column_key' => null ]; /** - * Array of nullable properties. Used for (de)serialization - * - * @var boolean[] - */ + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ protected static array $openAPINullables = [ 'column_key' => false, 'other_column_key' => false ]; /** - * If a nullable field gets set to null, insert it here - * - * @var boolean[] - */ + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ protected array $openAPINullablesSetToNull = []; /** @@ -254,14 +254,14 @@ public function __construct(?array $data = null) } /** - * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName - * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the - * $this->openAPINullablesSetToNull array - * - * @param string $variableName - * @param array $fields - * @param mixed $defaultValue - */ + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ private function setIfExists(string $variableName, array $fields, $defaultValue): void { if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { diff --git a/lib/User/ActionLockRecord.php b/lib/User/ActionLockRecord.php index c3240881..4b58c3c4 100644 --- a/lib/User/ActionLockRecord.php +++ b/lib/User/ActionLockRecord.php @@ -44,17 +44,17 @@ class ActionLockRecord implements ModelInterface, ArrayAccess, \JsonSerializable public const DISCRIMINATOR = null; /** - * The original name of the model. - * - * @var string - */ + * The original name of the model. + * + * @var string + */ protected static $openAPIModelName = 'action_lock_record'; /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ protected static $openAPITypes = [ 'type' => 'string', 'is_locked' => 'string', @@ -62,12 +62,12 @@ class ActionLockRecord implements ModelInterface, ArrayAccess, \JsonSerializable ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - * @phpstan-var array - * @psalm-var array - */ + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ protected static $openAPIFormats = [ 'type' => null, 'is_locked' => null, @@ -75,10 +75,10 @@ class ActionLockRecord implements ModelInterface, ArrayAccess, \JsonSerializable ]; /** - * Array of nullable properties. Used for (de)serialization - * - * @var boolean[] - */ + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ protected static array $openAPINullables = [ 'type' => false, 'is_locked' => false, @@ -86,10 +86,10 @@ class ActionLockRecord implements ModelInterface, ArrayAccess, \JsonSerializable ]; /** - * If a nullable field gets set to null, insert it here - * - * @var boolean[] - */ + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ protected array $openAPINullablesSetToNull = []; /** @@ -287,14 +287,14 @@ public function __construct(?array $data = null) } /** - * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName - * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the - * $this->openAPINullablesSetToNull array - * - * @param string $variableName - * @param array $fields - * @param mixed $defaultValue - */ + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ private function setIfExists(string $variableName, array $fields, $defaultValue): void { if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { diff --git a/lib/User/ActionLookupAndCopy.php b/lib/User/ActionLookupAndCopy.php index 0bacf396..0d540f40 100644 --- a/lib/User/ActionLookupAndCopy.php +++ b/lib/User/ActionLookupAndCopy.php @@ -44,17 +44,17 @@ class ActionLookupAndCopy implements ModelInterface, ArrayAccess, \JsonSerializa public const DISCRIMINATOR = null; /** - * The original name of the model. - * - * @var string - */ + * The original name of the model. + * + * @var string + */ protected static $openAPIModelName = 'action_lookup_and_copy'; /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ protected static $openAPITypes = [ 'type' => 'string', '_id' => 'string', @@ -64,12 +64,12 @@ class ActionLookupAndCopy implements ModelInterface, ArrayAccess, \JsonSerializa ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - * @phpstan-var array - * @psalm-var array - */ + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ protected static $openAPIFormats = [ 'type' => null, '_id' => null, @@ -79,10 +79,10 @@ class ActionLookupAndCopy implements ModelInterface, ArrayAccess, \JsonSerializa ]; /** - * Array of nullable properties. Used for (de)serialization - * - * @var boolean[] - */ + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ protected static array $openAPINullables = [ 'type' => false, '_id' => false, @@ -92,10 +92,10 @@ class ActionLookupAndCopy implements ModelInterface, ArrayAccess, \JsonSerializa ]; /** - * If a nullable field gets set to null, insert it here - * - * @var boolean[] - */ + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ protected array $openAPINullablesSetToNull = []; /** @@ -288,14 +288,14 @@ public function __construct(?array $data = null) } /** - * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName - * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the - * $this->openAPINullablesSetToNull array - * - * @param string $variableName - * @param array $fields - * @param mixed $defaultValue - */ + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ private function setIfExists(string $variableName, array $fields, $defaultValue): void { if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { diff --git a/lib/User/ActionLookupAndCopyEqualColumnConditionsInner.php b/lib/User/ActionLookupAndCopyEqualColumnConditionsInner.php index e3631aa5..1d59bc79 100644 --- a/lib/User/ActionLookupAndCopyEqualColumnConditionsInner.php +++ b/lib/User/ActionLookupAndCopyEqualColumnConditionsInner.php @@ -44,49 +44,49 @@ class ActionLookupAndCopyEqualColumnConditionsInner implements ModelInterface, A public const DISCRIMINATOR = null; /** - * The original name of the model. - * - * @var string - */ + * The original name of the model. + * + * @var string + */ protected static $openAPIModelName = 'action_lookup_and_copy_equal_column_conditions_inner'; /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ protected static $openAPITypes = [ 'from_column_key' => 'string', 'copy_to_column_key' => 'string' ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - * @phpstan-var array - * @psalm-var array - */ + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ protected static $openAPIFormats = [ 'from_column_key' => null, 'copy_to_column_key' => null ]; /** - * Array of nullable properties. Used for (de)serialization - * - * @var boolean[] - */ + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ protected static array $openAPINullables = [ 'from_column_key' => false, 'copy_to_column_key' => false ]; /** - * If a nullable field gets set to null, insert it here - * - * @var boolean[] - */ + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ protected array $openAPINullablesSetToNull = []; /** @@ -254,14 +254,14 @@ public function __construct(?array $data = null) } /** - * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName - * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the - * $this->openAPINullablesSetToNull array - * - * @param string $variableName - * @param array $fields - * @param mixed $defaultValue - */ + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ private function setIfExists(string $variableName, array $fields, $defaultValue): void { if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { diff --git a/lib/User/ActionLookupAndCopyTableCondition.php b/lib/User/ActionLookupAndCopyTableCondition.php index be38afb2..a9a91247 100644 --- a/lib/User/ActionLookupAndCopyTableCondition.php +++ b/lib/User/ActionLookupAndCopyTableCondition.php @@ -44,49 +44,49 @@ class ActionLookupAndCopyTableCondition implements ModelInterface, ArrayAccess, public const DISCRIMINATOR = null; /** - * The original name of the model. - * - * @var string - */ + * The original name of the model. + * + * @var string + */ protected static $openAPIModelName = 'action_lookup_and_copy_table_condition'; /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ protected static $openAPITypes = [ 'from_table_id' => 'string', 'copy_to_table_id' => 'string' ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - * @phpstan-var array - * @psalm-var array - */ + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ protected static $openAPIFormats = [ 'from_table_id' => null, 'copy_to_table_id' => null ]; /** - * Array of nullable properties. Used for (de)serialization - * - * @var boolean[] - */ + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ protected static array $openAPINullables = [ 'from_table_id' => false, 'copy_to_table_id' => false ]; /** - * If a nullable field gets set to null, insert it here - * - * @var boolean[] - */ + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ protected array $openAPINullablesSetToNull = []; /** @@ -254,14 +254,14 @@ public function __construct(?array $data = null) } /** - * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName - * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the - * $this->openAPINullablesSetToNull array - * - * @param string $variableName - * @param array $fields - * @param mixed $defaultValue - */ + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ private function setIfExists(string $variableName, array $fields, $defaultValue): void { if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { diff --git a/lib/User/ActionNotify.php b/lib/User/ActionNotify.php index d84137bc..ea306a22 100644 --- a/lib/User/ActionNotify.php +++ b/lib/User/ActionNotify.php @@ -44,17 +44,17 @@ class ActionNotify implements ModelInterface, ArrayAccess, \JsonSerializable public const DISCRIMINATOR = null; /** - * The original name of the model. - * - * @var string - */ + * The original name of the model. + * + * @var string + */ protected static $openAPIModelName = 'action_notify'; /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ protected static $openAPITypes = [ 'type' => 'string', 'users' => 'string[]', @@ -64,12 +64,12 @@ class ActionNotify implements ModelInterface, ArrayAccess, \JsonSerializable ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - * @phpstan-var array - * @psalm-var array - */ + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ protected static $openAPIFormats = [ 'type' => null, 'users' => null, @@ -79,10 +79,10 @@ class ActionNotify implements ModelInterface, ArrayAccess, \JsonSerializable ]; /** - * Array of nullable properties. Used for (de)serialization - * - * @var boolean[] - */ + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ protected static array $openAPINullables = [ 'type' => false, 'users' => false, @@ -92,10 +92,10 @@ class ActionNotify implements ModelInterface, ArrayAccess, \JsonSerializable ]; /** - * If a nullable field gets set to null, insert it here - * - * @var boolean[] - */ + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ protected array $openAPINullablesSetToNull = []; /** @@ -288,14 +288,14 @@ public function __construct(?array $data = null) } /** - * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName - * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the - * $this->openAPINullablesSetToNull array - * - * @param string $variableName - * @param array $fields - * @param mixed $defaultValue - */ + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ private function setIfExists(string $variableName, array $fields, $defaultValue): void { if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { diff --git a/lib/User/ActionRecordsMeetSpecificConditionsAfterModificationInner.php b/lib/User/ActionRecordsMeetSpecificConditionsAfterModificationInner.php index 9d6717bf..8a37bb5b 100644 --- a/lib/User/ActionRecordsMeetSpecificConditionsAfterModificationInner.php +++ b/lib/User/ActionRecordsMeetSpecificConditionsAfterModificationInner.php @@ -44,17 +44,17 @@ class ActionRecordsMeetSpecificConditionsAfterModificationInner implements Model public const DISCRIMINATOR = null; /** - * The original name of the model. - * - * @var string - */ + * The original name of the model. + * + * @var string + */ protected static $openAPIModelName = 'action_records_meet_specific_conditions_after_modification_inner'; /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ protected static $openAPITypes = [ 'type' => 'string', 'users' => 'string[]', @@ -80,12 +80,12 @@ class ActionRecordsMeetSpecificConditionsAfterModificationInner implements Model ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - * @phpstan-var array - * @psalm-var array - */ + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ protected static $openAPIFormats = [ 'type' => null, 'users' => null, @@ -111,10 +111,10 @@ class ActionRecordsMeetSpecificConditionsAfterModificationInner implements Model ]; /** - * Array of nullable properties. Used for (de)serialization - * - * @var boolean[] - */ + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ protected static array $openAPINullables = [ 'type' => false, 'users' => false, @@ -140,10 +140,10 @@ class ActionRecordsMeetSpecificConditionsAfterModificationInner implements Model ]; /** - * If a nullable field gets set to null, insert it here - * - * @var boolean[] - */ + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ protected array $openAPINullablesSetToNull = []; /** @@ -427,14 +427,14 @@ public function __construct(?array $data = null) } /** - * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName - * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the - * $this->openAPINullablesSetToNull array - * - * @param string $variableName - * @param array $fields - * @param mixed $defaultValue - */ + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ private function setIfExists(string $variableName, array $fields, $defaultValue): void { if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { diff --git a/lib/User/ActionRunPeriodicallyInner.php b/lib/User/ActionRunPeriodicallyInner.php index 4fcff21c..afbf63c6 100644 --- a/lib/User/ActionRunPeriodicallyInner.php +++ b/lib/User/ActionRunPeriodicallyInner.php @@ -44,17 +44,17 @@ class ActionRunPeriodicallyInner implements ModelInterface, ArrayAccess, \JsonSe public const DISCRIMINATOR = null; /** - * The original name of the model. - * - * @var string - */ + * The original name of the model. + * + * @var string + */ protected static $openAPIModelName = 'action_run_periodically_inner'; /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ protected static $openAPITypes = [ 'type' => 'string', 'users' => 'string[]', @@ -84,12 +84,12 @@ class ActionRunPeriodicallyInner implements ModelInterface, ArrayAccess, \JsonSe ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - * @phpstan-var array - * @psalm-var array - */ + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ protected static $openAPIFormats = [ 'type' => null, 'users' => null, @@ -119,10 +119,10 @@ class ActionRunPeriodicallyInner implements ModelInterface, ArrayAccess, \JsonSe ]; /** - * Array of nullable properties. Used for (de)serialization - * - * @var boolean[] - */ + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ protected static array $openAPINullables = [ 'type' => false, 'users' => false, @@ -152,10 +152,10 @@ class ActionRunPeriodicallyInner implements ModelInterface, ArrayAccess, \JsonSe ]; /** - * If a nullable field gets set to null, insert it here - * - * @var boolean[] - */ + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ protected array $openAPINullablesSetToNull = []; /** @@ -448,14 +448,14 @@ public function __construct(?array $data = null) } /** - * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName - * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the - * $this->openAPINullablesSetToNull array - * - * @param string $variableName - * @param array $fields - * @param mixed $defaultValue - */ + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ private function setIfExists(string $variableName, array $fields, $defaultValue): void { if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { diff --git a/lib/User/ActionRunPeriodicallyOnRecordsInner.php b/lib/User/ActionRunPeriodicallyOnRecordsInner.php index 41707a2a..b8af2ff5 100644 --- a/lib/User/ActionRunPeriodicallyOnRecordsInner.php +++ b/lib/User/ActionRunPeriodicallyOnRecordsInner.php @@ -44,17 +44,17 @@ class ActionRunPeriodicallyOnRecordsInner implements ModelInterface, ArrayAccess public const DISCRIMINATOR = null; /** - * The original name of the model. - * - * @var string - */ + * The original name of the model. + * + * @var string + */ protected static $openAPIModelName = 'action_run_periodically_on_records_inner'; /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ protected static $openAPITypes = [ 'type' => 'string', 'users' => 'string[]', @@ -69,12 +69,12 @@ class ActionRunPeriodicallyOnRecordsInner implements ModelInterface, ArrayAccess ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - * @phpstan-var array - * @psalm-var array - */ + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ protected static $openAPIFormats = [ 'type' => null, 'users' => null, @@ -89,10 +89,10 @@ class ActionRunPeriodicallyOnRecordsInner implements ModelInterface, ArrayAccess ]; /** - * Array of nullable properties. Used for (de)serialization - * - * @var boolean[] - */ + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ protected static array $openAPINullables = [ 'type' => false, 'users' => false, @@ -107,10 +107,10 @@ class ActionRunPeriodicallyOnRecordsInner implements ModelInterface, ArrayAccess ]; /** - * If a nullable field gets set to null, insert it here - * - * @var boolean[] - */ + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ protected array $openAPINullablesSetToNull = []; /** @@ -340,14 +340,14 @@ public function __construct(?array $data = null) } /** - * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName - * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the - * $this->openAPINullablesSetToNull array - * - * @param string $variableName - * @param array $fields - * @param mixed $defaultValue - */ + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ private function setIfExists(string $variableName, array $fields, $defaultValue): void { if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { diff --git a/lib/User/ActionRunPythonScript.php b/lib/User/ActionRunPythonScript.php index c5522b65..6a738b9a 100644 --- a/lib/User/ActionRunPythonScript.php +++ b/lib/User/ActionRunPythonScript.php @@ -44,17 +44,17 @@ class ActionRunPythonScript implements ModelInterface, ArrayAccess, \JsonSeriali public const DISCRIMINATOR = null; /** - * The original name of the model. - * - * @var string - */ + * The original name of the model. + * + * @var string + */ protected static $openAPIModelName = 'action_run_python_script'; /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ protected static $openAPITypes = [ 'type' => 'string', 'script_name' => 'string', @@ -66,12 +66,12 @@ class ActionRunPythonScript implements ModelInterface, ArrayAccess, \JsonSeriali ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - * @phpstan-var array - * @psalm-var array - */ + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ protected static $openAPIFormats = [ 'type' => null, 'script_name' => null, @@ -83,10 +83,10 @@ class ActionRunPythonScript implements ModelInterface, ArrayAccess, \JsonSeriali ]; /** - * Array of nullable properties. Used for (de)serialization - * - * @var boolean[] - */ + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ protected static array $openAPINullables = [ 'type' => false, 'script_name' => false, @@ -98,10 +98,10 @@ class ActionRunPythonScript implements ModelInterface, ArrayAccess, \JsonSeriali ]; /** - * If a nullable field gets set to null, insert it here - * - * @var boolean[] - */ + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ protected array $openAPINullablesSetToNull = []; /** @@ -302,14 +302,14 @@ public function __construct(?array $data = null) } /** - * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName - * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the - * $this->openAPINullablesSetToNull array - * - * @param string $variableName - * @param array $fields - * @param mixed $defaultValue - */ + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ private function setIfExists(string $variableName, array $fields, $defaultValue): void { if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { diff --git a/lib/User/ActionSendEmail.php b/lib/User/ActionSendEmail.php index 566f025e..ccc82bf1 100644 --- a/lib/User/ActionSendEmail.php +++ b/lib/User/ActionSendEmail.php @@ -44,17 +44,17 @@ class ActionSendEmail implements ModelInterface, ArrayAccess, \JsonSerializable public const DISCRIMINATOR = null; /** - * The original name of the model. - * - * @var string - */ + * The original name of the model. + * + * @var string + */ protected static $openAPIModelName = 'action_send_email'; /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ protected static $openAPITypes = [ 'type' => 'string', 'default_msg' => 'string', @@ -66,12 +66,12 @@ class ActionSendEmail implements ModelInterface, ArrayAccess, \JsonSerializable ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - * @phpstan-var array - * @psalm-var array - */ + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ protected static $openAPIFormats = [ 'type' => null, 'default_msg' => null, @@ -83,10 +83,10 @@ class ActionSendEmail implements ModelInterface, ArrayAccess, \JsonSerializable ]; /** - * Array of nullable properties. Used for (de)serialization - * - * @var boolean[] - */ + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ protected static array $openAPINullables = [ 'type' => false, 'default_msg' => false, @@ -98,10 +98,10 @@ class ActionSendEmail implements ModelInterface, ArrayAccess, \JsonSerializable ]; /** - * If a nullable field gets set to null, insert it here - * - * @var boolean[] - */ + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ protected array $openAPINullablesSetToNull = []; /** @@ -302,14 +302,14 @@ public function __construct(?array $data = null) } /** - * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName - * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the - * $this->openAPINullablesSetToNull array - * - * @param string $variableName - * @param array $fields - * @param mixed $defaultValue - */ + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ private function setIfExists(string $variableName, array $fields, $defaultValue): void { if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { diff --git a/lib/User/ActionUpdateRecord.php b/lib/User/ActionUpdateRecord.php index 3d7eee50..830925b6 100644 --- a/lib/User/ActionUpdateRecord.php +++ b/lib/User/ActionUpdateRecord.php @@ -44,17 +44,17 @@ class ActionUpdateRecord implements ModelInterface, ArrayAccess, \JsonSerializab public const DISCRIMINATOR = null; /** - * The original name of the model. - * - * @var string - */ + * The original name of the model. + * + * @var string + */ protected static $openAPIModelName = 'action_update_record'; /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ protected static $openAPITypes = [ 'type' => 'string', 'updates' => 'array', @@ -62,12 +62,12 @@ class ActionUpdateRecord implements ModelInterface, ArrayAccess, \JsonSerializab ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - * @phpstan-var array - * @psalm-var array - */ + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ protected static $openAPIFormats = [ 'type' => null, 'updates' => null, @@ -75,10 +75,10 @@ class ActionUpdateRecord implements ModelInterface, ArrayAccess, \JsonSerializab ]; /** - * Array of nullable properties. Used for (de)serialization - * - * @var boolean[] - */ + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ protected static array $openAPINullables = [ 'type' => false, 'updates' => false, @@ -86,10 +86,10 @@ class ActionUpdateRecord implements ModelInterface, ArrayAccess, \JsonSerializab ]; /** - * If a nullable field gets set to null, insert it here - * - * @var boolean[] - */ + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ protected array $openAPINullablesSetToNull = []; /** @@ -274,14 +274,14 @@ public function __construct(?array $data = null) } /** - * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName - * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the - * $this->openAPINullablesSetToNull array - * - * @param string $variableName - * @param array $fields - * @param mixed $defaultValue - */ + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ private function setIfExists(string $variableName, array $fields, $defaultValue): void { if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { diff --git a/lib/User/ActivitiesLogsApi.php b/lib/User/ActivitiesLogsApi.php index 28a62c37..51e4a0ce 100644 --- a/lib/User/ActivitiesLogsApi.php +++ b/lib/User/ActivitiesLogsApi.php @@ -28,11 +28,11 @@ use GuzzleHttp\Client; use GuzzleHttp\ClientInterface; -use GuzzleHttp\Exception\ConnectException; use GuzzleHttp\Exception\RequestException; use GuzzleHttp\Psr7\MultipartStream; use GuzzleHttp\Psr7\Request; use GuzzleHttp\RequestOptions; +use Psr\Http\Client\NetworkExceptionInterface; use Psr\Http\Message\RequestInterface; use Psr\Http\Message\ResponseInterface; use SeaTable\Client\ApiException; @@ -173,13 +173,14 @@ public function getBaseActivitiesWithHttpInfo($page = null, $per_page = null, $t try { $response = $this->client->send($request, $options); } catch (RequestException $e) { + $eResponse = $this->getExceptionResponse($e); throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), - $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? (string) $e->getResponse()->getBody() : null + $eResponse ? $eResponse->getHeaders() : null, + $eResponse ? (string) $eResponse->getBody() : null ); - } catch (ConnectException $e) { + } catch (NetworkExceptionInterface $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), @@ -298,7 +299,15 @@ function ($response) use ($returnType) { ]; }, function ($exception) { - $response = $exception->getResponse(); + $response = $this->getExceptionResponse($exception); + if ($response === null) { + throw new ApiException( + "[{$exception->getCode()}] {$exception->getMessage()}", + (int) $exception->getCode(), + null, + null + ); + } $statusCode = $response->getStatusCode(); throw new ApiException( sprintf( @@ -403,7 +412,11 @@ public function getBaseActivitiesRequest($page = null, $per_page = null, $to_tz } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + try { + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + } catch (\JsonException $e) { + throw new \InvalidArgumentException('json_encode error: ' . $e->getMessage(), 0, $e); + } } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -481,13 +494,14 @@ public function getBaseActivityDetailsWithHttpInfo($dtable_uuid, $op_date, $page try { $response = $this->client->send($request, $options); } catch (RequestException $e) { + $eResponse = $this->getExceptionResponse($e); throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), - $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? (string) $e->getResponse()->getBody() : null + $eResponse ? $eResponse->getHeaders() : null, + $eResponse ? (string) $eResponse->getBody() : null ); - } catch (ConnectException $e) { + } catch (NetworkExceptionInterface $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), @@ -608,7 +622,15 @@ function ($response) use ($returnType) { ]; }, function ($exception) { - $response = $exception->getResponse(); + $response = $this->getExceptionResponse($exception); + if ($response === null) { + throw new ApiException( + "[{$exception->getCode()}] {$exception->getMessage()}", + (int) $exception->getCode(), + null, + null + ); + } $statusCode = $response->getStatusCode(); throw new ApiException( sprintf( @@ -739,7 +761,11 @@ public function getBaseActivityDetailsRequest($dtable_uuid, $op_date, $page = nu } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + try { + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + } catch (\JsonException $e) { + throw new \InvalidArgumentException('json_encode error: ' . $e->getMessage(), 0, $e); + } } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -815,13 +841,14 @@ public function getBigDataOperationLogsWithHttpInfo($base_uuid, $page = null, $p try { $response = $this->client->send($request, $options); } catch (RequestException $e) { + $eResponse = $this->getExceptionResponse($e); throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), - $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? (string) $e->getResponse()->getBody() : null + $eResponse ? $eResponse->getHeaders() : null, + $eResponse ? (string) $eResponse->getBody() : null ); - } catch (ConnectException $e) { + } catch (NetworkExceptionInterface $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), @@ -940,7 +967,15 @@ function ($response) use ($returnType) { ]; }, function ($exception) { - $response = $exception->getResponse(); + $response = $this->getExceptionResponse($exception); + if ($response === null) { + throw new ApiException( + "[{$exception->getCode()}] {$exception->getMessage()}", + (int) $exception->getCode(), + null, + null + ); + } $statusCode = $response->getStatusCode(); throw new ApiException( sprintf( @@ -1019,7 +1054,7 @@ public function getBigDataOperationLogsRequest($base_uuid, $page = null, $per_pa // path params if ($base_uuid !== null) { $resourcePath = str_replace( - '{' . 'base_uuid' . '}', + '{base_uuid}', ObjectSerializer::toPathValue($base_uuid), $resourcePath ); @@ -1050,7 +1085,11 @@ public function getBigDataOperationLogsRequest($base_uuid, $page = null, $per_pa } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + try { + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + } catch (\JsonException $e) { + throw new \InvalidArgumentException('json_encode error: ' . $e->getMessage(), 0, $e); + } } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -1110,6 +1149,21 @@ protected function createHttpClientOption() return $options; } + /** + * Returns the response attached to a Guzzle exception, if there is one. + * + * Guzzle 7 exposes getResponse() on RequestException, while Guzzle 8 only + * exposes it on ResponseException and its subclasses. + * + * @param \Throwable $exception + * + * @return ResponseInterface|null + */ + private function getExceptionResponse(\Throwable $exception): ?ResponseInterface + { + return method_exists($exception, 'getResponse') ? $exception->getResponse() : null; + } + private function handleResponseWithDataType( string $dataType, RequestInterface $request, diff --git a/lib/User/AddDepartmentMembers200Response.php b/lib/User/AddDepartmentMembers200Response.php index 10542f49..6e13d815 100644 --- a/lib/User/AddDepartmentMembers200Response.php +++ b/lib/User/AddDepartmentMembers200Response.php @@ -44,49 +44,49 @@ class AddDepartmentMembers200Response implements ModelInterface, ArrayAccess, \J public const DISCRIMINATOR = null; /** - * The original name of the model. - * - * @var string - */ + * The original name of the model. + * + * @var string + */ protected static $openAPIModelName = 'addDepartmentMembers_200_response'; /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ protected static $openAPITypes = [ 'success' => 'object[]', 'failed' => 'object[]' ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - * @phpstan-var array - * @psalm-var array - */ + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ protected static $openAPIFormats = [ 'success' => null, 'failed' => null ]; /** - * Array of nullable properties. Used for (de)serialization - * - * @var boolean[] - */ + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ protected static array $openAPINullables = [ 'success' => false, 'failed' => false ]; /** - * If a nullable field gets set to null, insert it here - * - * @var boolean[] - */ + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ protected array $openAPINullablesSetToNull = []; /** @@ -254,14 +254,14 @@ public function __construct(?array $data = null) } /** - * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName - * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the - * $this->openAPINullablesSetToNull array - * - * @param string $variableName - * @param array $fields - * @param mixed $defaultValue - */ + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ private function setIfExists(string $variableName, array $fields, $defaultValue): void { if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { diff --git a/lib/User/AddDepartmentMembersRequest.php b/lib/User/AddDepartmentMembersRequest.php index a7955c0b..ec672b76 100644 --- a/lib/User/AddDepartmentMembersRequest.php +++ b/lib/User/AddDepartmentMembersRequest.php @@ -44,46 +44,46 @@ class AddDepartmentMembersRequest implements ModelInterface, ArrayAccess, \JsonS public const DISCRIMINATOR = null; /** - * The original name of the model. - * - * @var string - */ + * The original name of the model. + * + * @var string + */ protected static $openAPIModelName = 'addDepartmentMembers_request'; /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ protected static $openAPITypes = [ 'emails' => 'string' ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - * @phpstan-var array - * @psalm-var array - */ + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ protected static $openAPIFormats = [ 'emails' => null ]; /** - * Array of nullable properties. Used for (de)serialization - * - * @var boolean[] - */ + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ protected static array $openAPINullables = [ 'emails' => false ]; /** - * If a nullable field gets set to null, insert it here - * - * @var boolean[] - */ + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ protected array $openAPINullablesSetToNull = []; /** @@ -247,14 +247,14 @@ public function __construct(?array $data = null) } /** - * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName - * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the - * $this->openAPINullablesSetToNull array - * - * @param string $variableName - * @param array $fields - * @param mixed $defaultValue - */ + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ private function setIfExists(string $variableName, array $fields, $defaultValue): void { if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { diff --git a/lib/User/AddEmailAccountRequest.php b/lib/User/AddEmailAccountRequest.php index bac708db..70947ad7 100644 --- a/lib/User/AddEmailAccountRequest.php +++ b/lib/User/AddEmailAccountRequest.php @@ -44,17 +44,17 @@ class AddEmailAccountRequest implements ModelInterface, ArrayAccess, \JsonSerial public const DISCRIMINATOR = null; /** - * The original name of the model. - * - * @var string - */ + * The original name of the model. + * + * @var string + */ protected static $openAPIModelName = 'addEmailAccount_request'; /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ protected static $openAPITypes = [ 'account_name' => 'string', 'account_type' => 'string', @@ -62,12 +62,12 @@ class AddEmailAccountRequest implements ModelInterface, ArrayAccess, \JsonSerial ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - * @phpstan-var array - * @psalm-var array - */ + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ protected static $openAPIFormats = [ 'account_name' => null, 'account_type' => null, @@ -75,10 +75,10 @@ class AddEmailAccountRequest implements ModelInterface, ArrayAccess, \JsonSerial ]; /** - * Array of nullable properties. Used for (de)serialization - * - * @var boolean[] - */ + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ protected static array $openAPINullables = [ 'account_name' => false, 'account_type' => false, @@ -86,10 +86,10 @@ class AddEmailAccountRequest implements ModelInterface, ArrayAccess, \JsonSerial ]; /** - * If a nullable field gets set to null, insert it here - * - * @var boolean[] - */ + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ protected array $openAPINullablesSetToNull = []; /** @@ -261,14 +261,14 @@ public function __construct(?array $data = null) } /** - * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName - * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the - * $this->openAPINullablesSetToNull array - * - * @param string $variableName - * @param array $fields - * @param mixed $defaultValue - */ + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ private function setIfExists(string $variableName, array $fields, $defaultValue): void { if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { diff --git a/lib/User/AddGroupMember201Response.php b/lib/User/AddGroupMember201Response.php index 0af383cb..79f4d6a3 100644 --- a/lib/User/AddGroupMember201Response.php +++ b/lib/User/AddGroupMember201Response.php @@ -44,17 +44,17 @@ class AddGroupMember201Response implements ModelInterface, ArrayAccess, \JsonSer public const DISCRIMINATOR = null; /** - * The original name of the model. - * - * @var string - */ + * The original name of the model. + * + * @var string + */ protected static $openAPIModelName = 'addGroupMember_201_response'; /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ protected static $openAPITypes = [ 'group_id' => 'int', 'name' => 'string', @@ -66,12 +66,12 @@ class AddGroupMember201Response implements ModelInterface, ArrayAccess, \JsonSer ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - * @phpstan-var array - * @psalm-var array - */ + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ protected static $openAPIFormats = [ 'group_id' => null, 'name' => null, @@ -83,10 +83,10 @@ class AddGroupMember201Response implements ModelInterface, ArrayAccess, \JsonSer ]; /** - * Array of nullable properties. Used for (de)serialization - * - * @var boolean[] - */ + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ protected static array $openAPINullables = [ 'group_id' => false, 'name' => false, @@ -98,10 +98,10 @@ class AddGroupMember201Response implements ModelInterface, ArrayAccess, \JsonSer ]; /** - * If a nullable field gets set to null, insert it here - * - * @var boolean[] - */ + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ protected array $openAPINullablesSetToNull = []; /** @@ -289,14 +289,14 @@ public function __construct(?array $data = null) } /** - * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName - * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the - * $this->openAPINullablesSetToNull array - * - * @param string $variableName - * @param array $fields - * @param mixed $defaultValue - */ + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ private function setIfExists(string $variableName, array $fields, $defaultValue): void { if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { diff --git a/lib/User/AddGroupMemberRequest.php b/lib/User/AddGroupMemberRequest.php index 2ede4aeb..f3afb0b3 100644 --- a/lib/User/AddGroupMemberRequest.php +++ b/lib/User/AddGroupMemberRequest.php @@ -44,46 +44,46 @@ class AddGroupMemberRequest implements ModelInterface, ArrayAccess, \JsonSeriali public const DISCRIMINATOR = null; /** - * The original name of the model. - * - * @var string - */ + * The original name of the model. + * + * @var string + */ protected static $openAPIModelName = 'addGroupMember_request'; /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ protected static $openAPITypes = [ 'email' => 'string' ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - * @phpstan-var array - * @psalm-var array - */ + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ protected static $openAPIFormats = [ 'email' => null ]; /** - * Array of nullable properties. Used for (de)serialization - * - * @var boolean[] - */ + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ protected static array $openAPINullables = [ 'email' => false ]; /** - * If a nullable field gets set to null, insert it here - * - * @var boolean[] - */ + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ protected array $openAPINullablesSetToNull = []; /** @@ -247,14 +247,14 @@ public function __construct(?array $data = null) } /** - * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName - * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the - * $this->openAPINullablesSetToNull array - * - * @param string $variableName - * @param array $fields - * @param mixed $defaultValue - */ + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ private function setIfExists(string $variableName, array $fields, $defaultValue): void { if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { diff --git a/lib/User/AddNotificationRule200Response.php b/lib/User/AddNotificationRule200Response.php index d12745e1..e2fbe469 100644 --- a/lib/User/AddNotificationRule200Response.php +++ b/lib/User/AddNotificationRule200Response.php @@ -44,17 +44,17 @@ class AddNotificationRule200Response implements ModelInterface, ArrayAccess, \Js public const DISCRIMINATOR = null; /** - * The original name of the model. - * - * @var string - */ + * The original name of the model. + * + * @var string + */ protected static $openAPIModelName = 'addNotificationRule_200_response'; /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ protected static $openAPITypes = [ 'id' => 'int', 'run_condition' => 'string', @@ -66,12 +66,12 @@ class AddNotificationRule200Response implements ModelInterface, ArrayAccess, \Js ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - * @phpstan-var array - * @psalm-var array - */ + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ protected static $openAPIFormats = [ 'id' => null, 'run_condition' => null, @@ -83,10 +83,10 @@ class AddNotificationRule200Response implements ModelInterface, ArrayAccess, \Js ]; /** - * Array of nullable properties. Used for (de)serialization - * - * @var boolean[] - */ + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ protected static array $openAPINullables = [ 'id' => false, 'run_condition' => false, @@ -98,10 +98,10 @@ class AddNotificationRule200Response implements ModelInterface, ArrayAccess, \Js ]; /** - * If a nullable field gets set to null, insert it here - * - * @var boolean[] - */ + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ protected array $openAPINullablesSetToNull = []; /** @@ -289,14 +289,14 @@ public function __construct(?array $data = null) } /** - * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName - * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the - * $this->openAPINullablesSetToNull array - * - * @param string $variableName - * @param array $fields - * @param mixed $defaultValue - */ + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ private function setIfExists(string $variableName, array $fields, $defaultValue): void { if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { diff --git a/lib/User/AddNotificationRuleRequest.php b/lib/User/AddNotificationRuleRequest.php index b628e6df..49059d81 100644 --- a/lib/User/AddNotificationRuleRequest.php +++ b/lib/User/AddNotificationRuleRequest.php @@ -44,17 +44,17 @@ class AddNotificationRuleRequest implements ModelInterface, ArrayAccess, \JsonSe public const DISCRIMINATOR = null; /** - * The original name of the model. - * - * @var string - */ + * The original name of the model. + * + * @var string + */ protected static $openAPIModelName = 'addNotificationRule_request'; /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ protected static $openAPITypes = [ 'run_condition' => 'string', 'trigger' => '\SeaTable\Client\User\AddNotificationRuleRequestTrigger', @@ -62,12 +62,12 @@ class AddNotificationRuleRequest implements ModelInterface, ArrayAccess, \JsonSe ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - * @phpstan-var array - * @psalm-var array - */ + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ protected static $openAPIFormats = [ 'run_condition' => null, 'trigger' => null, @@ -75,10 +75,10 @@ class AddNotificationRuleRequest implements ModelInterface, ArrayAccess, \JsonSe ]; /** - * Array of nullable properties. Used for (de)serialization - * - * @var boolean[] - */ + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ protected static array $openAPINullables = [ 'run_condition' => false, 'trigger' => false, @@ -86,10 +86,10 @@ class AddNotificationRuleRequest implements ModelInterface, ArrayAccess, \JsonSe ]; /** - * If a nullable field gets set to null, insert it here - * - * @var boolean[] - */ + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ protected array $openAPINullablesSetToNull = []; /** @@ -276,14 +276,14 @@ public function __construct(?array $data = null) } /** - * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName - * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the - * $this->openAPINullablesSetToNull array - * - * @param string $variableName - * @param array $fields - * @param mixed $defaultValue - */ + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ private function setIfExists(string $variableName, array $fields, $defaultValue): void { if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { diff --git a/lib/User/AddNotificationRuleRequestAction.php b/lib/User/AddNotificationRuleRequestAction.php index 23294a5f..1a2d59d8 100644 --- a/lib/User/AddNotificationRuleRequestAction.php +++ b/lib/User/AddNotificationRuleRequestAction.php @@ -44,17 +44,17 @@ class AddNotificationRuleRequestAction implements ModelInterface, ArrayAccess, \ public const DISCRIMINATOR = null; /** - * The original name of the model. - * - * @var string - */ + * The original name of the model. + * + * @var string + */ protected static $openAPIModelName = 'addNotificationRule_request_action'; /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ protected static $openAPITypes = [ 'type' => 'string', 'users' => 'string[]', @@ -63,12 +63,12 @@ class AddNotificationRuleRequestAction implements ModelInterface, ArrayAccess, \ ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - * @phpstan-var array - * @psalm-var array - */ + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ protected static $openAPIFormats = [ 'type' => null, 'users' => null, @@ -77,10 +77,10 @@ class AddNotificationRuleRequestAction implements ModelInterface, ArrayAccess, \ ]; /** - * Array of nullable properties. Used for (de)serialization - * - * @var boolean[] - */ + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ protected static array $openAPINullables = [ 'type' => false, 'users' => false, @@ -89,10 +89,10 @@ class AddNotificationRuleRequestAction implements ModelInterface, ArrayAccess, \ ]; /** - * If a nullable field gets set to null, insert it here - * - * @var boolean[] - */ + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ protected array $openAPINullablesSetToNull = []; /** @@ -281,14 +281,14 @@ public function __construct(?array $data = null) } /** - * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName - * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the - * $this->openAPINullablesSetToNull array - * - * @param string $variableName - * @param array $fields - * @param mixed $defaultValue - */ + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ private function setIfExists(string $variableName, array $fields, $defaultValue): void { if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { diff --git a/lib/User/AddNotificationRuleRequestTrigger.php b/lib/User/AddNotificationRuleRequestTrigger.php index 0af03c69..313ce9ae 100644 --- a/lib/User/AddNotificationRuleRequestTrigger.php +++ b/lib/User/AddNotificationRuleRequestTrigger.php @@ -44,17 +44,17 @@ class AddNotificationRuleRequestTrigger implements ModelInterface, ArrayAccess, public const DISCRIMINATOR = null; /** - * The original name of the model. - * - * @var string - */ + * The original name of the model. + * + * @var string + */ protected static $openAPIModelName = 'addNotificationRule_request_trigger'; /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ protected static $openAPITypes = [ 'rule_name' => 'string', 'table_id' => 'string', @@ -70,12 +70,12 @@ class AddNotificationRuleRequestTrigger implements ModelInterface, ArrayAccess, ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - * @phpstan-var array - * @psalm-var array - */ + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ protected static $openAPIFormats = [ 'rule_name' => null, 'table_id' => null, @@ -91,10 +91,10 @@ class AddNotificationRuleRequestTrigger implements ModelInterface, ArrayAccess, ]; /** - * Array of nullable properties. Used for (de)serialization - * - * @var boolean[] - */ + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ protected static array $openAPINullables = [ 'rule_name' => false, 'table_id' => false, @@ -110,10 +110,10 @@ class AddNotificationRuleRequestTrigger implements ModelInterface, ArrayAccess, ]; /** - * If a nullable field gets set to null, insert it here - * - * @var boolean[] - */ + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ protected array $openAPINullablesSetToNull = []; /** @@ -349,14 +349,14 @@ public function __construct(?array $data = null) } /** - * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName - * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the - * $this->openAPINullablesSetToNull array - * - * @param string $variableName - * @param array $fields - * @param mixed $defaultValue - */ + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ private function setIfExists(string $variableName, array $fields, $defaultValue): void { if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { @@ -636,7 +636,6 @@ public function setNotifyHour($notify_hour) $this->setOpenAPINullablesSetToNull($nullablesSetToNull); } } - if (!is_null($notify_hour) && ($notify_hour > 23)) { throw new \InvalidArgumentException('invalid value for $notify_hour when calling AddNotificationRuleRequestTrigger., must be smaller than or equal to 23.'); } diff --git a/lib/User/AddPassword.php b/lib/User/AddPassword.php index 6e927b26..b2541be5 100644 --- a/lib/User/AddPassword.php +++ b/lib/User/AddPassword.php @@ -44,17 +44,17 @@ class AddPassword implements ModelInterface, ArrayAccess, \JsonSerializable public const DISCRIMINATOR = null; /** - * The original name of the model. - * - * @var string - */ + * The original name of the model. + * + * @var string + */ protected static $openAPIModelName = 'add_password'; /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ protected static $openAPITypes = [ 'name' => 'string', 'operation' => 'string', @@ -62,12 +62,12 @@ class AddPassword implements ModelInterface, ArrayAccess, \JsonSerializable ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - * @phpstan-var array - * @psalm-var array - */ + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ protected static $openAPIFormats = [ 'name' => null, 'operation' => null, @@ -75,10 +75,10 @@ class AddPassword implements ModelInterface, ArrayAccess, \JsonSerializable ]; /** - * Array of nullable properties. Used for (de)serialization - * - * @var boolean[] - */ + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ protected static array $openAPINullables = [ 'name' => false, 'operation' => false, @@ -86,10 +86,10 @@ class AddPassword implements ModelInterface, ArrayAccess, \JsonSerializable ]; /** - * If a nullable field gets set to null, insert it here - * - * @var boolean[] - */ + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ protected array $openAPINullablesSetToNull = []; /** @@ -274,14 +274,14 @@ public function __construct(?array $data = null) } /** - * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName - * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the - * $this->openAPINullablesSetToNull array - * - * @param string $variableName - * @param array $fields - * @param mixed $defaultValue - */ + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ private function setIfExists(string $variableName, array $fields, $defaultValue): void { if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { diff --git a/lib/User/AddRecordToOtherTableRowDate.php b/lib/User/AddRecordToOtherTableRowDate.php index aa63092f..24ff1f3e 100644 --- a/lib/User/AddRecordToOtherTableRowDate.php +++ b/lib/User/AddRecordToOtherTableRowDate.php @@ -44,46 +44,46 @@ class AddRecordToOtherTableRowDate implements ModelInterface, ArrayAccess, \Json public const DISCRIMINATOR = null; /** - * The original name of the model. - * - * @var string - */ + * The original name of the model. + * + * @var string + */ protected static $openAPIModelName = 'add_record_to_other_table_row_date'; /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ protected static $openAPITypes = [ ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - * @phpstan-var array - * @psalm-var array - */ + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ protected static $openAPIFormats = [ ]; /** - * Array of nullable properties. Used for (de)serialization - * - * @var boolean[] - */ + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ protected static array $openAPINullables = [ ]; /** - * If a nullable field gets set to null, insert it here - * - * @var boolean[] - */ + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ protected array $openAPINullablesSetToNull = []; /** @@ -246,14 +246,14 @@ public function __construct(?array $data = null) } /** - * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName - * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the - * $this->openAPINullablesSetToNull array - * - * @param string $variableName - * @param array $fields - * @param mixed $defaultValue - */ + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ private function setIfExists(string $variableName, array $fields, $defaultValue): void { if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { diff --git a/lib/User/AddRecordToOtherTableRowDateTime.php b/lib/User/AddRecordToOtherTableRowDateTime.php index 5026a375..5723d0a6 100644 --- a/lib/User/AddRecordToOtherTableRowDateTime.php +++ b/lib/User/AddRecordToOtherTableRowDateTime.php @@ -44,46 +44,46 @@ class AddRecordToOtherTableRowDateTime implements ModelInterface, ArrayAccess, \ public const DISCRIMINATOR = null; /** - * The original name of the model. - * - * @var string - */ + * The original name of the model. + * + * @var string + */ protected static $openAPIModelName = 'add_record_to_other_table_row_date-time'; /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ protected static $openAPITypes = [ ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - * @phpstan-var array - * @psalm-var array - */ + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ protected static $openAPIFormats = [ ]; /** - * Array of nullable properties. Used for (de)serialization - * - * @var boolean[] - */ + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ protected static array $openAPINullables = [ ]; /** - * If a nullable field gets set to null, insert it here - * - * @var boolean[] - */ + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ protected array $openAPINullablesSetToNull = []; /** @@ -246,14 +246,14 @@ public function __construct(?array $data = null) } /** - * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName - * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the - * $this->openAPINullablesSetToNull array - * - * @param string $variableName - * @param array $fields - * @param mixed $defaultValue - */ + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ private function setIfExists(string $variableName, array $fields, $defaultValue): void { if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { diff --git a/lib/User/AppsApi.php b/lib/User/AppsApi.php index d8c8f4ac..1b08f946 100644 --- a/lib/User/AppsApi.php +++ b/lib/User/AppsApi.php @@ -28,11 +28,11 @@ use GuzzleHttp\Client; use GuzzleHttp\ClientInterface; -use GuzzleHttp\Exception\ConnectException; use GuzzleHttp\Exception\RequestException; use GuzzleHttp\Psr7\MultipartStream; use GuzzleHttp\Psr7\Request; use GuzzleHttp\RequestOptions; +use Psr\Http\Client\NetworkExceptionInterface; use Psr\Http\Message\RequestInterface; use Psr\Http\Message\ResponseInterface; use SeaTable\Client\ApiException; @@ -176,13 +176,14 @@ public function changeAppStatusWithHttpInfo($app_token, $is_inactive = null, str try { $response = $this->client->send($request, $options); } catch (RequestException $e) { + $eResponse = $this->getExceptionResponse($e); throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), - $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? (string) $e->getResponse()->getBody() : null + $eResponse ? $eResponse->getHeaders() : null, + $eResponse ? (string) $eResponse->getBody() : null ); - } catch (ConnectException $e) { + } catch (NetworkExceptionInterface $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), @@ -250,7 +251,15 @@ function ($response) use ($returnType) { return [null, $response->getStatusCode(), $response->getHeaders()]; }, function ($exception) { - $response = $exception->getResponse(); + $response = $this->getExceptionResponse($exception); + if ($response === null) { + throw new ApiException( + "[{$exception->getCode()}] {$exception->getMessage()}", + (int) $exception->getCode(), + null, + null + ); + } $statusCode = $response->getStatusCode(); throw new ApiException( sprintf( @@ -303,7 +312,7 @@ public function changeAppStatusRequest($app_token, $is_inactive = null, string $ // path params if ($app_token !== null) { $resourcePath = str_replace( - '{' . 'app_token' . '}', + '{app_token}', ObjectSerializer::toPathValue($app_token), $resourcePath ); @@ -320,7 +329,11 @@ public function changeAppStatusRequest($app_token, $is_inactive = null, string $ if (isset($is_inactive)) { if (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the body - $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($is_inactive)); + try { + $httpBody = json_encode(ObjectSerializer::sanitizeForSerialization($is_inactive), JSON_THROW_ON_ERROR); + } catch (\JsonException $e) { + throw new \InvalidArgumentException('json_encode error: ' . $e->getMessage(), 0, $e); + } } else { $httpBody = $is_inactive; } @@ -341,7 +354,11 @@ public function changeAppStatusRequest($app_token, $is_inactive = null, string $ } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + try { + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + } catch (\JsonException $e) { + throw new \InvalidArgumentException('json_encode error: ' . $e->getMessage(), 0, $e); + } } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -414,13 +431,14 @@ public function importUsersToAppWithHttpInfo($app_token, $import_users_to_app_re try { $response = $this->client->send($request, $options); } catch (RequestException $e) { + $eResponse = $this->getExceptionResponse($e); throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), - $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? (string) $e->getResponse()->getBody() : null + $eResponse ? $eResponse->getHeaders() : null, + $eResponse ? (string) $eResponse->getBody() : null ); - } catch (ConnectException $e) { + } catch (NetworkExceptionInterface $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), @@ -488,7 +506,15 @@ function ($response) use ($returnType) { return [null, $response->getStatusCode(), $response->getHeaders()]; }, function ($exception) { - $response = $exception->getResponse(); + $response = $this->getExceptionResponse($exception); + if ($response === null) { + throw new ApiException( + "[{$exception->getCode()}] {$exception->getMessage()}", + (int) $exception->getCode(), + null, + null + ); + } $statusCode = $response->getStatusCode(); throw new ApiException( sprintf( @@ -541,7 +567,7 @@ public function importUsersToAppRequest($app_token, $import_users_to_app_request // path params if ($app_token !== null) { $resourcePath = str_replace( - '{' . 'app_token' . '}', + '{app_token}', ObjectSerializer::toPathValue($app_token), $resourcePath ); @@ -558,7 +584,11 @@ public function importUsersToAppRequest($app_token, $import_users_to_app_request if (isset($import_users_to_app_request)) { if (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the body - $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($import_users_to_app_request)); + try { + $httpBody = json_encode(ObjectSerializer::sanitizeForSerialization($import_users_to_app_request), JSON_THROW_ON_ERROR); + } catch (\JsonException $e) { + throw new \InvalidArgumentException('json_encode error: ' . $e->getMessage(), 0, $e); + } } else { $httpBody = $import_users_to_app_request; } @@ -579,7 +609,11 @@ public function importUsersToAppRequest($app_token, $import_users_to_app_request } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + try { + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + } catch (\JsonException $e) { + throw new \InvalidArgumentException('json_encode error: ' . $e->getMessage(), 0, $e); + } } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -650,13 +684,14 @@ public function listAppInviteLinksWithHttpInfo($app_token, string $contentType = try { $response = $this->client->send($request, $options); } catch (RequestException $e) { + $eResponse = $this->getExceptionResponse($e); throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), - $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? (string) $e->getResponse()->getBody() : null + $eResponse ? $eResponse->getHeaders() : null, + $eResponse ? (string) $eResponse->getBody() : null ); - } catch (ConnectException $e) { + } catch (NetworkExceptionInterface $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), @@ -722,7 +757,15 @@ function ($response) use ($returnType) { return [null, $response->getStatusCode(), $response->getHeaders()]; }, function ($exception) { - $response = $exception->getResponse(); + $response = $this->getExceptionResponse($exception); + if ($response === null) { + throw new ApiException( + "[{$exception->getCode()}] {$exception->getMessage()}", + (int) $exception->getCode(), + null, + null + ); + } $statusCode = $response->getStatusCode(); throw new ApiException( sprintf( @@ -773,7 +816,7 @@ public function listAppInviteLinksRequest($app_token, string $contentType = self // path params if ($app_token !== null) { $resourcePath = str_replace( - '{' . 'app_token' . '}', + '{app_token}', ObjectSerializer::toPathValue($app_token), $resourcePath ); @@ -804,7 +847,11 @@ public function listAppInviteLinksRequest($app_token, string $contentType = self } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + try { + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + } catch (\JsonException $e) { + throw new \InvalidArgumentException('json_encode error: ' . $e->getMessage(), 0, $e); + } } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -874,13 +921,14 @@ public function listAppsWithHttpInfo(string $contentType = self::contentTypes['l try { $response = $this->client->send($request, $options); } catch (RequestException $e) { + $eResponse = $this->getExceptionResponse($e); throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), - $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? (string) $e->getResponse()->getBody() : null + $eResponse ? $eResponse->getHeaders() : null, + $eResponse ? (string) $eResponse->getBody() : null ); - } catch (ConnectException $e) { + } catch (NetworkExceptionInterface $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), @@ -993,7 +1041,15 @@ function ($response) use ($returnType) { ]; }, function ($exception) { - $response = $exception->getResponse(); + $response = $this->getExceptionResponse($exception); + if ($response === null) { + throw new ApiException( + "[{$exception->getCode()}] {$exception->getMessage()}", + (int) $exception->getCode(), + null, + null + ); + } $statusCode = $response->getStatusCode(); throw new ApiException( sprintf( @@ -1056,7 +1112,11 @@ public function listAppsRequest(string $contentType = self::contentTypes['listAp } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + try { + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + } catch (\JsonException $e) { + throw new \InvalidArgumentException('json_encode error: ' . $e->getMessage(), 0, $e); + } } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -1127,13 +1187,14 @@ public function listUniversalAppUsersWithHttpInfo($app_token, string $contentTyp try { $response = $this->client->send($request, $options); } catch (RequestException $e) { + $eResponse = $this->getExceptionResponse($e); throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), - $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? (string) $e->getResponse()->getBody() : null + $eResponse ? $eResponse->getHeaders() : null, + $eResponse ? (string) $eResponse->getBody() : null ); - } catch (ConnectException $e) { + } catch (NetworkExceptionInterface $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), @@ -1199,7 +1260,15 @@ function ($response) use ($returnType) { return [null, $response->getStatusCode(), $response->getHeaders()]; }, function ($exception) { - $response = $exception->getResponse(); + $response = $this->getExceptionResponse($exception); + if ($response === null) { + throw new ApiException( + "[{$exception->getCode()}] {$exception->getMessage()}", + (int) $exception->getCode(), + null, + null + ); + } $statusCode = $response->getStatusCode(); throw new ApiException( sprintf( @@ -1250,7 +1319,7 @@ public function listUniversalAppUsersRequest($app_token, string $contentType = s // path params if ($app_token !== null) { $resourcePath = str_replace( - '{' . 'app_token' . '}', + '{app_token}', ObjectSerializer::toPathValue($app_token), $resourcePath ); @@ -1281,7 +1350,11 @@ public function listUniversalAppUsersRequest($app_token, string $contentType = s } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + try { + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + } catch (\JsonException $e) { + throw new \InvalidArgumentException('json_encode error: ' . $e->getMessage(), 0, $e); + } } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -1341,6 +1414,21 @@ protected function createHttpClientOption() return $options; } + /** + * Returns the response attached to a Guzzle exception, if there is one. + * + * Guzzle 7 exposes getResponse() on RequestException, while Guzzle 8 only + * exposes it on ResponseException and its subclasses. + * + * @param \Throwable $exception + * + * @return ResponseInterface|null + */ + private function getExceptionResponse(\Throwable $exception): ?ResponseInterface + { + return method_exists($exception, 'getResponse') ? $exception->getResponse() : null; + } + private function handleResponseWithDataType( string $dataType, RequestInterface $request, diff --git a/lib/User/AttachmentApi.php b/lib/User/AttachmentApi.php index 3d07032c..195ed96d 100644 --- a/lib/User/AttachmentApi.php +++ b/lib/User/AttachmentApi.php @@ -28,11 +28,11 @@ use GuzzleHttp\Client; use GuzzleHttp\ClientInterface; -use GuzzleHttp\Exception\ConnectException; use GuzzleHttp\Exception\RequestException; use GuzzleHttp\Psr7\MultipartStream; use GuzzleHttp\Psr7\Request; use GuzzleHttp\RequestOptions; +use Psr\Http\Client\NetworkExceptionInterface; use Psr\Http\Message\RequestInterface; use Psr\Http\Message\ResponseInterface; use SeaTable\Client\ApiException; @@ -188,13 +188,14 @@ public function checkIfAssetExistsWithHttpInfo($workspace_id, $base_name, $path try { $response = $this->client->send($request, $options); } catch (RequestException $e) { + $eResponse = $this->getExceptionResponse($e); throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), - $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? (string) $e->getResponse()->getBody() : null + $eResponse ? $eResponse->getHeaders() : null, + $eResponse ? (string) $eResponse->getBody() : null ); - } catch (ConnectException $e) { + } catch (NetworkExceptionInterface $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), @@ -313,7 +314,15 @@ function ($response) use ($returnType) { ]; }, function ($exception) { - $response = $exception->getResponse(); + $response = $this->getExceptionResponse($exception); + if ($response === null) { + throw new ApiException( + "[{$exception->getCode()}] {$exception->getMessage()}", + (int) $exception->getCode(), + null, + null + ); + } $statusCode = $response->getStatusCode(); throw new ApiException( sprintf( @@ -383,7 +392,7 @@ public function checkIfAssetExistsRequest($workspace_id, $base_name, $path = nul // path params if ($workspace_id !== null) { $resourcePath = str_replace( - '{' . 'workspace_id' . '}', + '{workspace_id}', ObjectSerializer::toPathValue($workspace_id), $resourcePath ); @@ -391,7 +400,7 @@ public function checkIfAssetExistsRequest($workspace_id, $base_name, $path = nul // path params if ($base_name !== null) { $resourcePath = str_replace( - '{' . 'base_name' . '}', + '{base_name}', ObjectSerializer::toPathValue($base_name), $resourcePath ); @@ -422,7 +431,11 @@ public function checkIfAssetExistsRequest($workspace_id, $base_name, $path = nul } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + try { + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + } catch (\JsonException $e) { + throw new \InvalidArgumentException('json_encode error: ' . $e->getMessage(), 0, $e); + } } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -496,13 +509,14 @@ public function deleteBaseAssetWithHttpInfo($base_uuid, $path = null, string $co try { $response = $this->client->send($request, $options); } catch (RequestException $e) { + $eResponse = $this->getExceptionResponse($e); throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), - $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? (string) $e->getResponse()->getBody() : null + $eResponse ? $eResponse->getHeaders() : null, + $eResponse ? (string) $eResponse->getBody() : null ); - } catch (ConnectException $e) { + } catch (NetworkExceptionInterface $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), @@ -619,7 +633,15 @@ function ($response) use ($returnType) { ]; }, function ($exception) { - $response = $exception->getResponse(); + $response = $this->getExceptionResponse($exception); + if ($response === null) { + throw new ApiException( + "[{$exception->getCode()}] {$exception->getMessage()}", + (int) $exception->getCode(), + null, + null + ); + } $statusCode = $response->getStatusCode(); throw new ApiException( sprintf( @@ -681,7 +703,7 @@ public function deleteBaseAssetRequest($base_uuid, $path = null, string $content // path params if ($base_uuid !== null) { $resourcePath = str_replace( - '{' . 'base_uuid' . '}', + '{base_uuid}', ObjectSerializer::toPathValue($base_uuid), $resourcePath ); @@ -712,7 +734,11 @@ public function deleteBaseAssetRequest($base_uuid, $path = null, string $content } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + try { + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + } catch (\JsonException $e) { + throw new \InvalidArgumentException('json_encode error: ' . $e->getMessage(), 0, $e); + } } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -784,13 +810,14 @@ public function deleteBaseAssetsWithHttpInfo($base_uuid, string $contentType = s try { $response = $this->client->send($request, $options); } catch (RequestException $e) { + $eResponse = $this->getExceptionResponse($e); throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), - $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? (string) $e->getResponse()->getBody() : null + $eResponse ? $eResponse->getHeaders() : null, + $eResponse ? (string) $eResponse->getBody() : null ); - } catch (ConnectException $e) { + } catch (NetworkExceptionInterface $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), @@ -905,7 +932,15 @@ function ($response) use ($returnType) { ]; }, function ($exception) { - $response = $exception->getResponse(); + $response = $this->getExceptionResponse($exception); + if ($response === null) { + throw new ApiException( + "[{$exception->getCode()}] {$exception->getMessage()}", + (int) $exception->getCode(), + null, + null + ); + } $statusCode = $response->getStatusCode(); throw new ApiException( sprintf( @@ -956,7 +991,7 @@ public function deleteBaseAssetsRequest($base_uuid, string $contentType = self:: // path params if ($base_uuid !== null) { $resourcePath = str_replace( - '{' . 'base_uuid' . '}', + '{base_uuid}', ObjectSerializer::toPathValue($base_uuid), $resourcePath ); @@ -987,7 +1022,11 @@ public function deleteBaseAssetsRequest($base_uuid, string $contentType = self:: } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + try { + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + } catch (\JsonException $e) { + throw new \InvalidArgumentException('json_encode error: ' . $e->getMessage(), 0, $e); + } } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -1059,13 +1098,14 @@ public function getBaseAssetSizeWithHttpInfo($base_uuid, string $contentType = s try { $response = $this->client->send($request, $options); } catch (RequestException $e) { + $eResponse = $this->getExceptionResponse($e); throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), - $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? (string) $e->getResponse()->getBody() : null + $eResponse ? $eResponse->getHeaders() : null, + $eResponse ? (string) $eResponse->getBody() : null ); - } catch (ConnectException $e) { + } catch (NetworkExceptionInterface $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), @@ -1180,7 +1220,15 @@ function ($response) use ($returnType) { ]; }, function ($exception) { - $response = $exception->getResponse(); + $response = $this->getExceptionResponse($exception); + if ($response === null) { + throw new ApiException( + "[{$exception->getCode()}] {$exception->getMessage()}", + (int) $exception->getCode(), + null, + null + ); + } $statusCode = $response->getStatusCode(); throw new ApiException( sprintf( @@ -1231,7 +1279,7 @@ public function getBaseAssetSizeRequest($base_uuid, string $contentType = self:: // path params if ($base_uuid !== null) { $resourcePath = str_replace( - '{' . 'base_uuid' . '}', + '{base_uuid}', ObjectSerializer::toPathValue($base_uuid), $resourcePath ); @@ -1262,7 +1310,11 @@ public function getBaseAssetSizeRequest($base_uuid, string $contentType = self:: } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + try { + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + } catch (\JsonException $e) { + throw new \InvalidArgumentException('json_encode error: ' . $e->getMessage(), 0, $e); + } } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -1336,13 +1388,14 @@ public function getBaseAttachmentUploadLinkWithHttpInfo($workspace_id, $base_nam try { $response = $this->client->send($request, $options); } catch (RequestException $e) { + $eResponse = $this->getExceptionResponse($e); throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), - $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? (string) $e->getResponse()->getBody() : null + $eResponse ? $eResponse->getHeaders() : null, + $eResponse ? (string) $eResponse->getBody() : null ); - } catch (ConnectException $e) { + } catch (NetworkExceptionInterface $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), @@ -1459,7 +1512,15 @@ function ($response) use ($returnType) { ]; }, function ($exception) { - $response = $exception->getResponse(); + $response = $this->getExceptionResponse($exception); + if ($response === null) { + throw new ApiException( + "[{$exception->getCode()}] {$exception->getMessage()}", + (int) $exception->getCode(), + null, + null + ); + } $statusCode = $response->getStatusCode(); throw new ApiException( sprintf( @@ -1527,7 +1588,7 @@ public function getBaseAttachmentUploadLinkRequest($workspace_id, $base_name, st // path params if ($workspace_id !== null) { $resourcePath = str_replace( - '{' . 'workspace_id' . '}', + '{workspace_id}', ObjectSerializer::toPathValue($workspace_id), $resourcePath ); @@ -1558,7 +1619,11 @@ public function getBaseAttachmentUploadLinkRequest($workspace_id, $base_name, st } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + try { + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + } catch (\JsonException $e) { + throw new \InvalidArgumentException('json_encode error: ' . $e->getMessage(), 0, $e); + } } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -1632,13 +1697,14 @@ public function listBaseAssetsWithHttpInfo($base_uuid, $parent_dir = null, strin try { $response = $this->client->send($request, $options); } catch (RequestException $e) { + $eResponse = $this->getExceptionResponse($e); throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), - $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? (string) $e->getResponse()->getBody() : null + $eResponse ? $eResponse->getHeaders() : null, + $eResponse ? (string) $eResponse->getBody() : null ); - } catch (ConnectException $e) { + } catch (NetworkExceptionInterface $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), @@ -1755,7 +1821,15 @@ function ($response) use ($returnType) { ]; }, function ($exception) { - $response = $exception->getResponse(); + $response = $this->getExceptionResponse($exception); + if ($response === null) { + throw new ApiException( + "[{$exception->getCode()}] {$exception->getMessage()}", + (int) $exception->getCode(), + null, + null + ); + } $statusCode = $response->getStatusCode(); throw new ApiException( sprintf( @@ -1817,7 +1891,7 @@ public function listBaseAssetsRequest($base_uuid, $parent_dir = null, string $co // path params if ($base_uuid !== null) { $resourcePath = str_replace( - '{' . 'base_uuid' . '}', + '{base_uuid}', ObjectSerializer::toPathValue($base_uuid), $resourcePath ); @@ -1848,7 +1922,11 @@ public function listBaseAssetsRequest($base_uuid, $parent_dir = null, string $co } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + try { + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + } catch (\JsonException $e) { + throw new \InvalidArgumentException('json_encode error: ' . $e->getMessage(), 0, $e); + } } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -1922,13 +2000,14 @@ public function listRecentlyUploadedFilesWithHttpInfo($base_uuid, $months = null try { $response = $this->client->send($request, $options); } catch (RequestException $e) { + $eResponse = $this->getExceptionResponse($e); throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), - $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? (string) $e->getResponse()->getBody() : null + $eResponse ? $eResponse->getHeaders() : null, + $eResponse ? (string) $eResponse->getBody() : null ); - } catch (ConnectException $e) { + } catch (NetworkExceptionInterface $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), @@ -2045,7 +2124,15 @@ function ($response) use ($returnType) { ]; }, function ($exception) { - $response = $exception->getResponse(); + $response = $this->getExceptionResponse($exception); + if ($response === null) { + throw new ApiException( + "[{$exception->getCode()}] {$exception->getMessage()}", + (int) $exception->getCode(), + null, + null + ); + } $statusCode = $response->getStatusCode(); throw new ApiException( sprintf( @@ -2113,7 +2200,7 @@ public function listRecentlyUploadedFilesRequest($base_uuid, $months = null, str // path params if ($base_uuid !== null) { $resourcePath = str_replace( - '{' . 'base_uuid' . '}', + '{base_uuid}', ObjectSerializer::toPathValue($base_uuid), $resourcePath ); @@ -2144,7 +2231,11 @@ public function listRecentlyUploadedFilesRequest($base_uuid, $months = null, str } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + try { + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + } catch (\JsonException $e) { + throw new \InvalidArgumentException('json_encode error: ' . $e->getMessage(), 0, $e); + } } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -2220,13 +2311,14 @@ public function renameBaseAssetWithHttpInfo($base_uuid, $path = null, $new_name try { $response = $this->client->send($request, $options); } catch (RequestException $e) { + $eResponse = $this->getExceptionResponse($e); throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), - $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? (string) $e->getResponse()->getBody() : null + $eResponse ? $eResponse->getHeaders() : null, + $eResponse ? (string) $eResponse->getBody() : null ); - } catch (ConnectException $e) { + } catch (NetworkExceptionInterface $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), @@ -2345,7 +2437,15 @@ function ($response) use ($returnType) { ]; }, function ($exception) { - $response = $exception->getResponse(); + $response = $this->getExceptionResponse($exception); + if ($response === null) { + throw new ApiException( + "[{$exception->getCode()}] {$exception->getMessage()}", + (int) $exception->getCode(), + null, + null + ); + } $statusCode = $response->getStatusCode(); throw new ApiException( sprintf( @@ -2400,7 +2500,7 @@ public function renameBaseAssetRequest($base_uuid, $path = null, $new_name = nul // path params if ($base_uuid !== null) { $resourcePath = str_replace( - '{' . 'base_uuid' . '}', + '{base_uuid}', ObjectSerializer::toPathValue($base_uuid), $resourcePath ); @@ -2442,7 +2542,11 @@ public function renameBaseAssetRequest($base_uuid, $path = null, $new_name = nul } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + try { + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + } catch (\JsonException $e) { + throw new \InvalidArgumentException('json_encode error: ' . $e->getMessage(), 0, $e); + } } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -2502,6 +2606,21 @@ protected function createHttpClientOption() return $options; } + /** + * Returns the response attached to a Guzzle exception, if there is one. + * + * Guzzle 7 exposes getResponse() on RequestException, while Guzzle 8 only + * exposes it on ResponseException and its subclasses. + * + * @param \Throwable $exception + * + * @return ResponseInterface|null + */ + private function getExceptionResponse(\Throwable $exception): ?ResponseInterface + { + return method_exists($exception, 'getResponse') ? $exception->getResponse() : null; + } + private function handleResponseWithDataType( string $dataType, RequestInterface $request, diff --git a/lib/User/AutomationsApi.php b/lib/User/AutomationsApi.php index 0fd823b4..74171e96 100644 --- a/lib/User/AutomationsApi.php +++ b/lib/User/AutomationsApi.php @@ -28,11 +28,11 @@ use GuzzleHttp\Client; use GuzzleHttp\ClientInterface; -use GuzzleHttp\Exception\ConnectException; use GuzzleHttp\Exception\RequestException; use GuzzleHttp\Psr7\MultipartStream; use GuzzleHttp\Psr7\Request; use GuzzleHttp\RequestOptions; +use Psr\Http\Client\NetworkExceptionInterface; use Psr\Http\Message\RequestInterface; use Psr\Http\Message\ResponseInterface; use SeaTable\Client\ApiException; @@ -176,13 +176,14 @@ public function createAutomationRuleWithHttpInfo($workspace_id, $base_name, $cre try { $response = $this->client->send($request, $options); } catch (RequestException $e) { + $eResponse = $this->getExceptionResponse($e); throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), - $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? (string) $e->getResponse()->getBody() : null + $eResponse ? $eResponse->getHeaders() : null, + $eResponse ? (string) $eResponse->getBody() : null ); - } catch (ConnectException $e) { + } catch (NetworkExceptionInterface $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), @@ -301,7 +302,15 @@ function ($response) use ($returnType) { ]; }, function ($exception) { - $response = $exception->getResponse(); + $response = $this->getExceptionResponse($exception); + if ($response === null) { + throw new ApiException( + "[{$exception->getCode()}] {$exception->getMessage()}", + (int) $exception->getCode(), + null, + null + ); + } $statusCode = $response->getStatusCode(); throw new ApiException( sprintf( @@ -362,7 +371,7 @@ public function createAutomationRuleRequest($workspace_id, $base_name, $create_a // path params if ($workspace_id !== null) { $resourcePath = str_replace( - '{' . 'workspace_id' . '}', + '{workspace_id}', ObjectSerializer::toPathValue($workspace_id), $resourcePath ); @@ -370,7 +379,7 @@ public function createAutomationRuleRequest($workspace_id, $base_name, $create_a // path params if ($base_name !== null) { $resourcePath = str_replace( - '{' . 'base_name' . '}', + '{base_name}', ObjectSerializer::toPathValue($base_name), $resourcePath ); @@ -387,7 +396,11 @@ public function createAutomationRuleRequest($workspace_id, $base_name, $create_a if (isset($create_automation_rule_request)) { if (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the body - $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($create_automation_rule_request)); + try { + $httpBody = json_encode(ObjectSerializer::sanitizeForSerialization($create_automation_rule_request), JSON_THROW_ON_ERROR); + } catch (\JsonException $e) { + throw new \InvalidArgumentException('json_encode error: ' . $e->getMessage(), 0, $e); + } } else { $httpBody = $create_automation_rule_request; } @@ -408,7 +421,11 @@ public function createAutomationRuleRequest($workspace_id, $base_name, $create_a } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + try { + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + } catch (\JsonException $e) { + throw new \InvalidArgumentException('json_encode error: ' . $e->getMessage(), 0, $e); + } } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -484,13 +501,14 @@ public function deleteAutomationRuleWithHttpInfo($workspace_id, $base_name, $aut try { $response = $this->client->send($request, $options); } catch (RequestException $e) { + $eResponse = $this->getExceptionResponse($e); throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), - $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? (string) $e->getResponse()->getBody() : null + $eResponse ? $eResponse->getHeaders() : null, + $eResponse ? (string) $eResponse->getBody() : null ); - } catch (ConnectException $e) { + } catch (NetworkExceptionInterface $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), @@ -609,7 +627,15 @@ function ($response) use ($returnType) { ]; }, function ($exception) { - $response = $exception->getResponse(); + $response = $this->getExceptionResponse($exception); + if ($response === null) { + throw new ApiException( + "[{$exception->getCode()}] {$exception->getMessage()}", + (int) $exception->getCode(), + null, + null + ); + } $statusCode = $response->getStatusCode(); throw new ApiException( sprintf( @@ -679,7 +705,7 @@ public function deleteAutomationRuleRequest($workspace_id, $base_name, $automati // path params if ($workspace_id !== null) { $resourcePath = str_replace( - '{' . 'workspace_id' . '}', + '{workspace_id}', ObjectSerializer::toPathValue($workspace_id), $resourcePath ); @@ -687,7 +713,7 @@ public function deleteAutomationRuleRequest($workspace_id, $base_name, $automati // path params if ($base_name !== null) { $resourcePath = str_replace( - '{' . 'base_name' . '}', + '{base_name}', ObjectSerializer::toPathValue($base_name), $resourcePath ); @@ -695,7 +721,7 @@ public function deleteAutomationRuleRequest($workspace_id, $base_name, $automati // path params if ($automation_rule_id !== null) { $resourcePath = str_replace( - '{' . 'automation_rule_id' . '}', + '{automation_rule_id}', ObjectSerializer::toPathValue($automation_rule_id), $resourcePath ); @@ -726,7 +752,11 @@ public function deleteAutomationRuleRequest($workspace_id, $base_name, $automati } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + try { + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + } catch (\JsonException $e) { + throw new \InvalidArgumentException('json_encode error: ' . $e->getMessage(), 0, $e); + } } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -800,13 +830,14 @@ public function listAutomationRulesWithHttpInfo($workspace_id, $base_name, strin try { $response = $this->client->send($request, $options); } catch (RequestException $e) { + $eResponse = $this->getExceptionResponse($e); throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), - $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? (string) $e->getResponse()->getBody() : null + $eResponse ? $eResponse->getHeaders() : null, + $eResponse ? (string) $eResponse->getBody() : null ); - } catch (ConnectException $e) { + } catch (NetworkExceptionInterface $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), @@ -923,7 +954,15 @@ function ($response) use ($returnType) { ]; }, function ($exception) { - $response = $exception->getResponse(); + $response = $this->getExceptionResponse($exception); + if ($response === null) { + throw new ApiException( + "[{$exception->getCode()}] {$exception->getMessage()}", + (int) $exception->getCode(), + null, + null + ); + } $statusCode = $response->getStatusCode(); throw new ApiException( sprintf( @@ -982,7 +1021,7 @@ public function listAutomationRulesRequest($workspace_id, $base_name, string $co // path params if ($workspace_id !== null) { $resourcePath = str_replace( - '{' . 'workspace_id' . '}', + '{workspace_id}', ObjectSerializer::toPathValue($workspace_id), $resourcePath ); @@ -990,7 +1029,7 @@ public function listAutomationRulesRequest($workspace_id, $base_name, string $co // path params if ($base_name !== null) { $resourcePath = str_replace( - '{' . 'base_name' . '}', + '{base_name}', ObjectSerializer::toPathValue($base_name), $resourcePath ); @@ -1021,7 +1060,11 @@ public function listAutomationRulesRequest($workspace_id, $base_name, string $co } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + try { + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + } catch (\JsonException $e) { + throw new \InvalidArgumentException('json_encode error: ' . $e->getMessage(), 0, $e); + } } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -1099,13 +1142,14 @@ public function updateAutomationRuleWithHttpInfo($workspace_id, $base_name, $aut try { $response = $this->client->send($request, $options); } catch (RequestException $e) { + $eResponse = $this->getExceptionResponse($e); throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), - $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? (string) $e->getResponse()->getBody() : null + $eResponse ? $eResponse->getHeaders() : null, + $eResponse ? (string) $eResponse->getBody() : null ); - } catch (ConnectException $e) { + } catch (NetworkExceptionInterface $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), @@ -1226,7 +1270,15 @@ function ($response) use ($returnType) { ]; }, function ($exception) { - $response = $exception->getResponse(); + $response = $this->getExceptionResponse($exception); + if ($response === null) { + throw new ApiException( + "[{$exception->getCode()}] {$exception->getMessage()}", + (int) $exception->getCode(), + null, + null + ); + } $statusCode = $response->getStatusCode(); throw new ApiException( sprintf( @@ -1298,7 +1350,7 @@ public function updateAutomationRuleRequest($workspace_id, $base_name, $automati // path params if ($workspace_id !== null) { $resourcePath = str_replace( - '{' . 'workspace_id' . '}', + '{workspace_id}', ObjectSerializer::toPathValue($workspace_id), $resourcePath ); @@ -1306,7 +1358,7 @@ public function updateAutomationRuleRequest($workspace_id, $base_name, $automati // path params if ($base_name !== null) { $resourcePath = str_replace( - '{' . 'base_name' . '}', + '{base_name}', ObjectSerializer::toPathValue($base_name), $resourcePath ); @@ -1314,7 +1366,7 @@ public function updateAutomationRuleRequest($workspace_id, $base_name, $automati // path params if ($automation_rule_id !== null) { $resourcePath = str_replace( - '{' . 'automation_rule_id' . '}', + '{automation_rule_id}', ObjectSerializer::toPathValue($automation_rule_id), $resourcePath ); @@ -1331,7 +1383,11 @@ public function updateAutomationRuleRequest($workspace_id, $base_name, $automati if (isset($create_automation_rule_request)) { if (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the body - $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($create_automation_rule_request)); + try { + $httpBody = json_encode(ObjectSerializer::sanitizeForSerialization($create_automation_rule_request), JSON_THROW_ON_ERROR); + } catch (\JsonException $e) { + throw new \InvalidArgumentException('json_encode error: ' . $e->getMessage(), 0, $e); + } } else { $httpBody = $create_automation_rule_request; } @@ -1352,7 +1408,11 @@ public function updateAutomationRuleRequest($workspace_id, $base_name, $automati } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + try { + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + } catch (\JsonException $e) { + throw new \InvalidArgumentException('json_encode error: ' . $e->getMessage(), 0, $e); + } } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -1412,6 +1472,21 @@ protected function createHttpClientOption() return $options; } + /** + * Returns the response attached to a Guzzle exception, if there is one. + * + * Guzzle 7 exposes getResponse() on RequestException, while Guzzle 8 only + * exposes it on ResponseException and its subclasses. + * + * @param \Throwable $exception + * + * @return ResponseInterface|null + */ + private function getExceptionResponse(\Throwable $exception): ?ResponseInterface + { + return method_exists($exception, 'getResponse') ? $exception->getResponse() : null; + } + private function handleResponseWithDataType( string $dataType, RequestInterface $request, diff --git a/lib/User/Base.php b/lib/User/Base.php index 5b4f5135..b88c5593 100644 --- a/lib/User/Base.php +++ b/lib/User/Base.php @@ -44,46 +44,46 @@ class Base implements ModelInterface, ArrayAccess, \JsonSerializable public const DISCRIMINATOR = null; /** - * The original name of the model. - * - * @var string - */ + * The original name of the model. + * + * @var string + */ protected static $openAPIModelName = 'Base'; /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ protected static $openAPITypes = [ 'table' => '\SeaTable\Client\User\BaseTable' ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - * @phpstan-var array - * @psalm-var array - */ + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ protected static $openAPIFormats = [ 'table' => null ]; /** - * Array of nullable properties. Used for (de)serialization - * - * @var boolean[] - */ + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ protected static array $openAPINullables = [ 'table' => false ]; /** - * If a nullable field gets set to null, insert it here - * - * @var boolean[] - */ + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ protected array $openAPINullablesSetToNull = []; /** @@ -247,14 +247,14 @@ public function __construct(?array $data = null) } /** - * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName - * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the - * $this->openAPINullablesSetToNull array - * - * @param string $variableName - * @param array $fields - * @param mixed $defaultValue - */ + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ private function setIfExists(string $variableName, array $fields, $defaultValue): void { if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { diff --git a/lib/User/BasePasswordRequest.php b/lib/User/BasePasswordRequest.php index 383c0898..002c9d56 100644 --- a/lib/User/BasePasswordRequest.php +++ b/lib/User/BasePasswordRequest.php @@ -44,17 +44,17 @@ class BasePasswordRequest implements ModelInterface, ArrayAccess, \JsonSerializa public const DISCRIMINATOR = null; /** - * The original name of the model. - * - * @var string - */ + * The original name of the model. + * + * @var string + */ protected static $openAPIModelName = 'basePassword_request'; /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ protected static $openAPITypes = [ 'name' => 'string', 'operation' => 'string', @@ -63,12 +63,12 @@ class BasePasswordRequest implements ModelInterface, ArrayAccess, \JsonSerializa ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - * @phpstan-var array - * @psalm-var array - */ + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ protected static $openAPIFormats = [ 'name' => null, 'operation' => null, @@ -77,10 +77,10 @@ class BasePasswordRequest implements ModelInterface, ArrayAccess, \JsonSerializa ]; /** - * Array of nullable properties. Used for (de)serialization - * - * @var boolean[] - */ + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ protected static array $openAPINullables = [ 'name' => false, 'operation' => false, @@ -89,10 +89,10 @@ class BasePasswordRequest implements ModelInterface, ArrayAccess, \JsonSerializa ]; /** - * If a nullable field gets set to null, insert it here - * - * @var boolean[] - */ + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ protected array $openAPINullablesSetToNull = []; /** @@ -281,14 +281,14 @@ public function __construct(?array $data = null) } /** - * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName - * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the - * $this->openAPINullablesSetToNull array - * - * @param string $variableName - * @param array $fields - * @param mixed $defaultValue - */ + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ private function setIfExists(string $variableName, array $fields, $defaultValue): void { if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { diff --git a/lib/User/BaseTable.php b/lib/User/BaseTable.php index 8fe0d8c6..58d73de4 100644 --- a/lib/User/BaseTable.php +++ b/lib/User/BaseTable.php @@ -44,17 +44,17 @@ class BaseTable implements ModelInterface, ArrayAccess, \JsonSerializable public const DISCRIMINATOR = null; /** - * The original name of the model. - * - * @var string - */ + * The original name of the model. + * + * @var string + */ protected static $openAPIModelName = 'Base_table'; /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ protected static $openAPITypes = [ 'id' => 'int', 'workspace_id' => 'int', @@ -70,12 +70,12 @@ class BaseTable implements ModelInterface, ArrayAccess, \JsonSerializable ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - * @phpstan-var array - * @psalm-var array - */ + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ protected static $openAPIFormats = [ 'id' => null, 'workspace_id' => null, @@ -91,10 +91,10 @@ class BaseTable implements ModelInterface, ArrayAccess, \JsonSerializable ]; /** - * Array of nullable properties. Used for (de)serialization - * - * @var boolean[] - */ + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ protected static array $openAPINullables = [ 'id' => false, 'workspace_id' => false, @@ -110,10 +110,10 @@ class BaseTable implements ModelInterface, ArrayAccess, \JsonSerializable ]; /** - * If a nullable field gets set to null, insert it here - * - * @var boolean[] - */ + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ protected array $openAPINullablesSetToNull = []; /** @@ -317,14 +317,14 @@ public function __construct(?array $data = null) } /** - * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName - * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the - * $this->openAPINullablesSetToNull array - * - * @param string $variableName - * @param array $fields - * @param mixed $defaultValue - */ + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ private function setIfExists(string $variableName, array $fields, $defaultValue): void { if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { diff --git a/lib/User/BasesApi.php b/lib/User/BasesApi.php index f44d064b..f4407cdc 100644 --- a/lib/User/BasesApi.php +++ b/lib/User/BasesApi.php @@ -28,11 +28,11 @@ use GuzzleHttp\Client; use GuzzleHttp\ClientInterface; -use GuzzleHttp\Exception\ConnectException; use GuzzleHttp\Exception\RequestException; use GuzzleHttp\Psr7\MultipartStream; use GuzzleHttp\Psr7\Request; use GuzzleHttp\RequestOptions; +use Psr\Http\Client\NetworkExceptionInterface; use Psr\Http\Message\RequestInterface; use Psr\Http\Message\ResponseInterface; use SeaTable\Client\ApiException; @@ -221,13 +221,14 @@ public function basePasswordWithHttpInfo($workspace_id, $base_name, $base_passwo try { $response = $this->client->send($request, $options); } catch (RequestException $e) { + $eResponse = $this->getExceptionResponse($e); throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), - $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? (string) $e->getResponse()->getBody() : null + $eResponse ? $eResponse->getHeaders() : null, + $eResponse ? (string) $eResponse->getBody() : null ); - } catch (ConnectException $e) { + } catch (NetworkExceptionInterface $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), @@ -346,7 +347,15 @@ function ($response) use ($returnType) { ]; }, function ($exception) { - $response = $exception->getResponse(); + $response = $this->getExceptionResponse($exception); + if ($response === null) { + throw new ApiException( + "[{$exception->getCode()}] {$exception->getMessage()}", + (int) $exception->getCode(), + null, + null + ); + } $statusCode = $response->getStatusCode(); throw new ApiException( sprintf( @@ -407,7 +416,7 @@ public function basePasswordRequest($workspace_id, $base_name, $base_password_re // path params if ($workspace_id !== null) { $resourcePath = str_replace( - '{' . 'workspace_id' . '}', + '{workspace_id}', ObjectSerializer::toPathValue($workspace_id), $resourcePath ); @@ -415,7 +424,7 @@ public function basePasswordRequest($workspace_id, $base_name, $base_password_re // path params if ($base_name !== null) { $resourcePath = str_replace( - '{' . 'base_name' . '}', + '{base_name}', ObjectSerializer::toPathValue($base_name), $resourcePath ); @@ -432,7 +441,11 @@ public function basePasswordRequest($workspace_id, $base_name, $base_password_re if (isset($base_password_request)) { if (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the body - $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($base_password_request)); + try { + $httpBody = json_encode(ObjectSerializer::sanitizeForSerialization($base_password_request), JSON_THROW_ON_ERROR); + } catch (\JsonException $e) { + throw new \InvalidArgumentException('json_encode error: ' . $e->getMessage(), 0, $e); + } } else { $httpBody = $base_password_request; } @@ -453,7 +466,11 @@ public function basePasswordRequest($workspace_id, $base_name, $base_password_re } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + try { + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + } catch (\JsonException $e) { + throw new \InvalidArgumentException('json_encode error: ' . $e->getMessage(), 0, $e); + } } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -523,13 +540,14 @@ public function clearTrashWithHttpInfo(string $contentType = self::contentTypes[ try { $response = $this->client->send($request, $options); } catch (RequestException $e) { + $eResponse = $this->getExceptionResponse($e); throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), - $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? (string) $e->getResponse()->getBody() : null + $eResponse ? $eResponse->getHeaders() : null, + $eResponse ? (string) $eResponse->getBody() : null ); - } catch (ConnectException $e) { + } catch (NetworkExceptionInterface $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), @@ -642,7 +660,15 @@ function ($response) use ($returnType) { ]; }, function ($exception) { - $response = $exception->getResponse(); + $response = $this->getExceptionResponse($exception); + if ($response === null) { + throw new ApiException( + "[{$exception->getCode()}] {$exception->getMessage()}", + (int) $exception->getCode(), + null, + null + ); + } $statusCode = $response->getStatusCode(); throw new ApiException( sprintf( @@ -705,7 +731,11 @@ public function clearTrashRequest(string $contentType = self::contentTypes['clea } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + try { + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + } catch (\JsonException $e) { + throw new \InvalidArgumentException('json_encode error: ' . $e->getMessage(), 0, $e); + } } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -783,13 +813,14 @@ public function createBaseWithHttpInfo($name = null, $workspace_id = null, $icon try { $response = $this->client->send($request, $options); } catch (RequestException $e) { + $eResponse = $this->getExceptionResponse($e); throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), - $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? (string) $e->getResponse()->getBody() : null + $eResponse ? $eResponse->getHeaders() : null, + $eResponse ? (string) $eResponse->getBody() : null ); - } catch (ConnectException $e) { + } catch (NetworkExceptionInterface $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), @@ -910,7 +941,15 @@ function ($response) use ($returnType) { ]; }, function ($exception) { - $response = $exception->getResponse(); + $response = $this->getExceptionResponse($exception); + if ($response === null) { + throw new ApiException( + "[{$exception->getCode()}] {$exception->getMessage()}", + (int) $exception->getCode(), + null, + null + ); + } $statusCode = $response->getStatusCode(); throw new ApiException( sprintf( @@ -994,7 +1033,11 @@ public function createBaseRequest($name = null, $workspace_id = null, $icon = nu } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + try { + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + } catch (\JsonException $e) { + throw new \InvalidArgumentException('json_encode error: ' . $e->getMessage(), 0, $e); + } } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -1068,13 +1111,14 @@ public function createFolderWithHttpInfo($workspace_id, $name = null, string $co try { $response = $this->client->send($request, $options); } catch (RequestException $e) { + $eResponse = $this->getExceptionResponse($e); throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), - $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? (string) $e->getResponse()->getBody() : null + $eResponse ? $eResponse->getHeaders() : null, + $eResponse ? (string) $eResponse->getBody() : null ); - } catch (ConnectException $e) { + } catch (NetworkExceptionInterface $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), @@ -1191,7 +1235,15 @@ function ($response) use ($returnType) { ]; }, function ($exception) { - $response = $exception->getResponse(); + $response = $this->getExceptionResponse($exception); + if ($response === null) { + throw new ApiException( + "[{$exception->getCode()}] {$exception->getMessage()}", + (int) $exception->getCode(), + null, + null + ); + } $statusCode = $response->getStatusCode(); throw new ApiException( sprintf( @@ -1244,7 +1296,7 @@ public function createFolderRequest($workspace_id, $name = null, string $content // path params if ($workspace_id !== null) { $resourcePath = str_replace( - '{' . 'workspace_id' . '}', + '{workspace_id}', ObjectSerializer::toPathValue($workspace_id), $resourcePath ); @@ -1285,7 +1337,11 @@ public function createFolderRequest($workspace_id, $name = null, string $content } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + try { + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + } catch (\JsonException $e) { + throw new \InvalidArgumentException('json_encode error: ' . $e->getMessage(), 0, $e); + } } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -1359,13 +1415,14 @@ public function deleteBaseWithHttpInfo($workspace_id, $name = null, string $cont try { $response = $this->client->send($request, $options); } catch (RequestException $e) { + $eResponse = $this->getExceptionResponse($e); throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), - $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? (string) $e->getResponse()->getBody() : null + $eResponse ? $eResponse->getHeaders() : null, + $eResponse ? (string) $eResponse->getBody() : null ); - } catch (ConnectException $e) { + } catch (NetworkExceptionInterface $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), @@ -1482,7 +1539,15 @@ function ($response) use ($returnType) { ]; }, function ($exception) { - $response = $exception->getResponse(); + $response = $this->getExceptionResponse($exception); + if ($response === null) { + throw new ApiException( + "[{$exception->getCode()}] {$exception->getMessage()}", + (int) $exception->getCode(), + null, + null + ); + } $statusCode = $response->getStatusCode(); throw new ApiException( sprintf( @@ -1535,7 +1600,7 @@ public function deleteBaseRequest($workspace_id, $name = null, string $contentTy // path params if ($workspace_id !== null) { $resourcePath = str_replace( - '{' . 'workspace_id' . '}', + '{workspace_id}', ObjectSerializer::toPathValue($workspace_id), $resourcePath ); @@ -1576,7 +1641,11 @@ public function deleteBaseRequest($workspace_id, $name = null, string $contentTy } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + try { + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + } catch (\JsonException $e) { + throw new \InvalidArgumentException('json_encode error: ' . $e->getMessage(), 0, $e); + } } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -1650,13 +1719,14 @@ public function deleteFolderWithHttpInfo($workspace_id, $folder_id, string $cont try { $response = $this->client->send($request, $options); } catch (RequestException $e) { + $eResponse = $this->getExceptionResponse($e); throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), - $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? (string) $e->getResponse()->getBody() : null + $eResponse ? $eResponse->getHeaders() : null, + $eResponse ? (string) $eResponse->getBody() : null ); - } catch (ConnectException $e) { + } catch (NetworkExceptionInterface $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), @@ -1773,7 +1843,15 @@ function ($response) use ($returnType) { ]; }, function ($exception) { - $response = $exception->getResponse(); + $response = $this->getExceptionResponse($exception); + if ($response === null) { + throw new ApiException( + "[{$exception->getCode()}] {$exception->getMessage()}", + (int) $exception->getCode(), + null, + null + ); + } $statusCode = $response->getStatusCode(); throw new ApiException( sprintf( @@ -1832,7 +1910,7 @@ public function deleteFolderRequest($workspace_id, $folder_id, string $contentTy // path params if ($workspace_id !== null) { $resourcePath = str_replace( - '{' . 'workspace_id' . '}', + '{workspace_id}', ObjectSerializer::toPathValue($workspace_id), $resourcePath ); @@ -1840,7 +1918,7 @@ public function deleteFolderRequest($workspace_id, $folder_id, string $contentTy // path params if ($folder_id !== null) { $resourcePath = str_replace( - '{' . 'folder_id' . '}', + '{folder_id}', ObjectSerializer::toPathValue($folder_id), $resourcePath ); @@ -1871,7 +1949,11 @@ public function deleteFolderRequest($workspace_id, $folder_id, string $contentTy } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + try { + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + } catch (\JsonException $e) { + throw new \InvalidArgumentException('json_encode error: ' . $e->getMessage(), 0, $e); + } } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -1943,13 +2025,14 @@ public function favoriteBaseWithHttpInfo($dtable_uuid = null, string $contentTyp try { $response = $this->client->send($request, $options); } catch (RequestException $e) { + $eResponse = $this->getExceptionResponse($e); throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), - $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? (string) $e->getResponse()->getBody() : null + $eResponse ? $eResponse->getHeaders() : null, + $eResponse ? (string) $eResponse->getBody() : null ); - } catch (ConnectException $e) { + } catch (NetworkExceptionInterface $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), @@ -2064,7 +2147,15 @@ function ($response) use ($returnType) { ]; }, function ($exception) { - $response = $exception->getResponse(); + $response = $this->getExceptionResponse($exception); + if ($response === null) { + throw new ApiException( + "[{$exception->getCode()}] {$exception->getMessage()}", + (int) $exception->getCode(), + null, + null + ); + } $statusCode = $response->getStatusCode(); throw new ApiException( sprintf( @@ -2139,7 +2230,11 @@ public function favoriteBaseRequest($dtable_uuid = null, string $contentType = s } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + try { + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + } catch (\JsonException $e) { + throw new \InvalidArgumentException('json_encode error: ' . $e->getMessage(), 0, $e); + } } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -2211,13 +2306,14 @@ public function getBaseSizeWithHttpInfo($base_uuid, string $contentType = self:: try { $response = $this->client->send($request, $options); } catch (RequestException $e) { + $eResponse = $this->getExceptionResponse($e); throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), - $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? (string) $e->getResponse()->getBody() : null + $eResponse ? $eResponse->getHeaders() : null, + $eResponse ? (string) $eResponse->getBody() : null ); - } catch (ConnectException $e) { + } catch (NetworkExceptionInterface $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), @@ -2332,7 +2428,15 @@ function ($response) use ($returnType) { ]; }, function ($exception) { - $response = $exception->getResponse(); + $response = $this->getExceptionResponse($exception); + if ($response === null) { + throw new ApiException( + "[{$exception->getCode()}] {$exception->getMessage()}", + (int) $exception->getCode(), + null, + null + ); + } $statusCode = $response->getStatusCode(); throw new ApiException( sprintf( @@ -2383,7 +2487,7 @@ public function getBaseSizeRequest($base_uuid, string $contentType = self::conte // path params if ($base_uuid !== null) { $resourcePath = str_replace( - '{' . 'base_uuid' . '}', + '{base_uuid}', ObjectSerializer::toPathValue($base_uuid), $resourcePath ); @@ -2414,7 +2518,11 @@ public function getBaseSizeRequest($base_uuid, string $contentType = self::conte } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + try { + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + } catch (\JsonException $e) { + throw new \InvalidArgumentException('json_encode error: ' . $e->getMessage(), 0, $e); + } } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -2484,13 +2592,14 @@ public function listBasesWithHttpInfo(string $contentType = self::contentTypes[' try { $response = $this->client->send($request, $options); } catch (RequestException $e) { + $eResponse = $this->getExceptionResponse($e); throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), - $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? (string) $e->getResponse()->getBody() : null + $eResponse ? $eResponse->getHeaders() : null, + $eResponse ? (string) $eResponse->getBody() : null ); - } catch (ConnectException $e) { + } catch (NetworkExceptionInterface $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), @@ -2603,7 +2712,15 @@ function ($response) use ($returnType) { ]; }, function ($exception) { - $response = $exception->getResponse(); + $response = $this->getExceptionResponse($exception); + if ($response === null) { + throw new ApiException( + "[{$exception->getCode()}] {$exception->getMessage()}", + (int) $exception->getCode(), + null, + null + ); + } $statusCode = $response->getStatusCode(); throw new ApiException( sprintf( @@ -2666,7 +2783,11 @@ public function listBasesRequest(string $contentType = self::contentTypes['listB } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + try { + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + } catch (\JsonException $e) { + throw new \InvalidArgumentException('json_encode error: ' . $e->getMessage(), 0, $e); + } } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -2736,13 +2857,14 @@ public function listFavoritesWithHttpInfo(string $contentType = self::contentTyp try { $response = $this->client->send($request, $options); } catch (RequestException $e) { + $eResponse = $this->getExceptionResponse($e); throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), - $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? (string) $e->getResponse()->getBody() : null + $eResponse ? $eResponse->getHeaders() : null, + $eResponse ? (string) $eResponse->getBody() : null ); - } catch (ConnectException $e) { + } catch (NetworkExceptionInterface $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), @@ -2855,7 +2977,15 @@ function ($response) use ($returnType) { ]; }, function ($exception) { - $response = $exception->getResponse(); + $response = $this->getExceptionResponse($exception); + if ($response === null) { + throw new ApiException( + "[{$exception->getCode()}] {$exception->getMessage()}", + (int) $exception->getCode(), + null, + null + ); + } $statusCode = $response->getStatusCode(); throw new ApiException( sprintf( @@ -2918,7 +3048,11 @@ public function listFavoritesRequest(string $contentType = self::contentTypes['l } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + try { + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + } catch (\JsonException $e) { + throw new \InvalidArgumentException('json_encode error: ' . $e->getMessage(), 0, $e); + } } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -2990,13 +3124,14 @@ public function listGroupTrashedBasesWithHttpInfo($group_id, string $contentType try { $response = $this->client->send($request, $options); } catch (RequestException $e) { + $eResponse = $this->getExceptionResponse($e); throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), - $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? (string) $e->getResponse()->getBody() : null + $eResponse ? $eResponse->getHeaders() : null, + $eResponse ? (string) $eResponse->getBody() : null ); - } catch (ConnectException $e) { + } catch (NetworkExceptionInterface $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), @@ -3111,7 +3246,15 @@ function ($response) use ($returnType) { ]; }, function ($exception) { - $response = $exception->getResponse(); + $response = $this->getExceptionResponse($exception); + if ($response === null) { + throw new ApiException( + "[{$exception->getCode()}] {$exception->getMessage()}", + (int) $exception->getCode(), + null, + null + ); + } $statusCode = $response->getStatusCode(); throw new ApiException( sprintf( @@ -3162,7 +3305,7 @@ public function listGroupTrashedBasesRequest($group_id, string $contentType = se // path params if ($group_id !== null) { $resourcePath = str_replace( - '{' . 'group_id' . '}', + '{group_id}', ObjectSerializer::toPathValue($group_id), $resourcePath ); @@ -3193,7 +3336,11 @@ public function listGroupTrashedBasesRequest($group_id, string $contentType = se } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + try { + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + } catch (\JsonException $e) { + throw new \InvalidArgumentException('json_encode error: ' . $e->getMessage(), 0, $e); + } } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -3267,13 +3414,14 @@ public function listTrashedBasesWithHttpInfo($page = null, $per_page = null, str try { $response = $this->client->send($request, $options); } catch (RequestException $e) { + $eResponse = $this->getExceptionResponse($e); throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), - $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? (string) $e->getResponse()->getBody() : null + $eResponse ? $eResponse->getHeaders() : null, + $eResponse ? (string) $eResponse->getBody() : null ); - } catch (ConnectException $e) { + } catch (NetworkExceptionInterface $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), @@ -3390,7 +3538,15 @@ function ($response) use ($returnType) { ]; }, function ($exception) { - $response = $exception->getResponse(); + $response = $this->getExceptionResponse($exception); + if ($response === null) { + throw new ApiException( + "[{$exception->getCode()}] {$exception->getMessage()}", + (int) $exception->getCode(), + null, + null + ); + } $statusCode = $response->getStatusCode(); throw new ApiException( sprintf( @@ -3481,7 +3637,11 @@ public function listTrashedBasesRequest($page = null, $per_page = null, string $ } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + try { + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + } catch (\JsonException $e) { + throw new \InvalidArgumentException('json_encode error: ' . $e->getMessage(), 0, $e); + } } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -3561,13 +3721,14 @@ public function moveBaseIntoFolderWithHttpInfo($workspace_id, $item_type = null, try { $response = $this->client->send($request, $options); } catch (RequestException $e) { + $eResponse = $this->getExceptionResponse($e); throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), - $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? (string) $e->getResponse()->getBody() : null + $eResponse ? $eResponse->getHeaders() : null, + $eResponse ? (string) $eResponse->getBody() : null ); - } catch (ConnectException $e) { + } catch (NetworkExceptionInterface $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), @@ -3690,7 +3851,15 @@ function ($response) use ($returnType) { ]; }, function ($exception) { - $response = $exception->getResponse(); + $response = $this->getExceptionResponse($exception); + if ($response === null) { + throw new ApiException( + "[{$exception->getCode()}] {$exception->getMessage()}", + (int) $exception->getCode(), + null, + null + ); + } $statusCode = $response->getStatusCode(); throw new ApiException( sprintf( @@ -3749,7 +3918,7 @@ public function moveBaseIntoFolderRequest($workspace_id, $item_type = null, $ite // path params if ($workspace_id !== null) { $resourcePath = str_replace( - '{' . 'workspace_id' . '}', + '{workspace_id}', ObjectSerializer::toPathValue($workspace_id), $resourcePath ); @@ -3793,7 +3962,11 @@ public function moveBaseIntoFolderRequest($workspace_id, $item_type = null, $ite } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + try { + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + } catch (\JsonException $e) { + throw new \InvalidArgumentException('json_encode error: ' . $e->getMessage(), 0, $e); + } } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -3867,13 +4040,14 @@ public function restoreGroupTrashedBaseWithHttpInfo($group_id, $base_uuid, strin try { $response = $this->client->send($request, $options); } catch (RequestException $e) { + $eResponse = $this->getExceptionResponse($e); throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), - $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? (string) $e->getResponse()->getBody() : null + $eResponse ? $eResponse->getHeaders() : null, + $eResponse ? (string) $eResponse->getBody() : null ); - } catch (ConnectException $e) { + } catch (NetworkExceptionInterface $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), @@ -3990,7 +4164,15 @@ function ($response) use ($returnType) { ]; }, function ($exception) { - $response = $exception->getResponse(); + $response = $this->getExceptionResponse($exception); + if ($response === null) { + throw new ApiException( + "[{$exception->getCode()}] {$exception->getMessage()}", + (int) $exception->getCode(), + null, + null + ); + } $statusCode = $response->getStatusCode(); throw new ApiException( sprintf( @@ -4052,7 +4234,7 @@ public function restoreGroupTrashedBaseRequest($group_id, $base_uuid, string $co // path params if ($group_id !== null) { $resourcePath = str_replace( - '{' . 'group_id' . '}', + '{group_id}', ObjectSerializer::toPathValue($group_id), $resourcePath ); @@ -4060,7 +4242,7 @@ public function restoreGroupTrashedBaseRequest($group_id, $base_uuid, string $co // path params if ($base_uuid !== null) { $resourcePath = str_replace( - '{' . 'base_uuid' . '}', + '{base_uuid}', ObjectSerializer::toPathValue($base_uuid), $resourcePath ); @@ -4091,7 +4273,11 @@ public function restoreGroupTrashedBaseRequest($group_id, $base_uuid, string $co } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + try { + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + } catch (\JsonException $e) { + throw new \InvalidArgumentException('json_encode error: ' . $e->getMessage(), 0, $e); + } } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -4163,13 +4349,14 @@ public function restoreTrashedBaseWithHttpInfo($trashed_base_id, string $content try { $response = $this->client->send($request, $options); } catch (RequestException $e) { + $eResponse = $this->getExceptionResponse($e); throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), - $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? (string) $e->getResponse()->getBody() : null + $eResponse ? $eResponse->getHeaders() : null, + $eResponse ? (string) $eResponse->getBody() : null ); - } catch (ConnectException $e) { + } catch (NetworkExceptionInterface $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), @@ -4284,7 +4471,15 @@ function ($response) use ($returnType) { ]; }, function ($exception) { - $response = $exception->getResponse(); + $response = $this->getExceptionResponse($exception); + if ($response === null) { + throw new ApiException( + "[{$exception->getCode()}] {$exception->getMessage()}", + (int) $exception->getCode(), + null, + null + ); + } $statusCode = $response->getStatusCode(); throw new ApiException( sprintf( @@ -4332,7 +4527,7 @@ public function restoreTrashedBaseRequest($trashed_base_id, string $contentType // path params if ($trashed_base_id !== null) { $resourcePath = str_replace( - '{' . 'trashed_base_id' . '}', + '{trashed_base_id}', ObjectSerializer::toPathValue($trashed_base_id), $resourcePath ); @@ -4363,7 +4558,11 @@ public function restoreTrashedBaseRequest($trashed_base_id, string $contentType } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + try { + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + } catch (\JsonException $e) { + throw new \InvalidArgumentException('json_encode error: ' . $e->getMessage(), 0, $e); + } } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -4437,13 +4636,14 @@ public function searchBaseOrAppsWithHttpInfo($query_str = null, $query_type = nu try { $response = $this->client->send($request, $options); } catch (RequestException $e) { + $eResponse = $this->getExceptionResponse($e); throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), - $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? (string) $e->getResponse()->getBody() : null + $eResponse ? $eResponse->getHeaders() : null, + $eResponse ? (string) $eResponse->getBody() : null ); - } catch (ConnectException $e) { + } catch (NetworkExceptionInterface $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), @@ -4560,7 +4760,15 @@ function ($response) use ($returnType) { ]; }, function ($exception) { - $response = $exception->getResponse(); + $response = $this->getExceptionResponse($exception); + if ($response === null) { + throw new ApiException( + "[{$exception->getCode()}] {$exception->getMessage()}", + (int) $exception->getCode(), + null, + null + ); + } $statusCode = $response->getStatusCode(); throw new ApiException( sprintf( @@ -4645,7 +4853,11 @@ public function searchBaseOrAppsRequest($query_str = null, $query_type = null, s } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + try { + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + } catch (\JsonException $e) { + throw new \InvalidArgumentException('json_encode error: ' . $e->getMessage(), 0, $e); + } } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -4717,13 +4929,14 @@ public function unfavoriteBaseWithHttpInfo($dtable_uuid, string $contentType = s try { $response = $this->client->send($request, $options); } catch (RequestException $e) { + $eResponse = $this->getExceptionResponse($e); throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), - $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? (string) $e->getResponse()->getBody() : null + $eResponse ? $eResponse->getHeaders() : null, + $eResponse ? (string) $eResponse->getBody() : null ); - } catch (ConnectException $e) { + } catch (NetworkExceptionInterface $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), @@ -4838,7 +5051,15 @@ function ($response) use ($returnType) { ]; }, function ($exception) { - $response = $exception->getResponse(); + $response = $this->getExceptionResponse($exception); + if ($response === null) { + throw new ApiException( + "[{$exception->getCode()}] {$exception->getMessage()}", + (int) $exception->getCode(), + null, + null + ); + } $statusCode = $response->getStatusCode(); throw new ApiException( sprintf( @@ -4921,7 +5142,11 @@ public function unfavoriteBaseRequest($dtable_uuid, string $contentType = self:: } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + try { + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + } catch (\JsonException $e) { + throw new \InvalidArgumentException('json_encode error: ' . $e->getMessage(), 0, $e); + } } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -5001,13 +5226,14 @@ public function updateBaseWithHttpInfo($workspace_id, $name = null, $new_name = try { $response = $this->client->send($request, $options); } catch (RequestException $e) { + $eResponse = $this->getExceptionResponse($e); throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), - $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? (string) $e->getResponse()->getBody() : null + $eResponse ? $eResponse->getHeaders() : null, + $eResponse ? (string) $eResponse->getBody() : null ); - } catch (ConnectException $e) { + } catch (NetworkExceptionInterface $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), @@ -5130,7 +5356,15 @@ function ($response) use ($returnType) { ]; }, function ($exception) { - $response = $exception->getResponse(); + $response = $this->getExceptionResponse($exception); + if ($response === null) { + throw new ApiException( + "[{$exception->getCode()}] {$exception->getMessage()}", + (int) $exception->getCode(), + null, + null + ); + } $statusCode = $response->getStatusCode(); throw new ApiException( sprintf( @@ -5189,7 +5423,7 @@ public function updateBaseRequest($workspace_id, $name = null, $new_name = null, // path params if ($workspace_id !== null) { $resourcePath = str_replace( - '{' . 'workspace_id' . '}', + '{workspace_id}', ObjectSerializer::toPathValue($workspace_id), $resourcePath ); @@ -5233,7 +5467,11 @@ public function updateBaseRequest($workspace_id, $name = null, $new_name = null, } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + try { + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + } catch (\JsonException $e) { + throw new \InvalidArgumentException('json_encode error: ' . $e->getMessage(), 0, $e); + } } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -5309,13 +5547,14 @@ public function updateFolderWithHttpInfo($workspace_id, $folder_id, $name = null try { $response = $this->client->send($request, $options); } catch (RequestException $e) { + $eResponse = $this->getExceptionResponse($e); throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), - $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? (string) $e->getResponse()->getBody() : null + $eResponse ? $eResponse->getHeaders() : null, + $eResponse ? (string) $eResponse->getBody() : null ); - } catch (ConnectException $e) { + } catch (NetworkExceptionInterface $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), @@ -5434,7 +5673,15 @@ function ($response) use ($returnType) { ]; }, function ($exception) { - $response = $exception->getResponse(); + $response = $this->getExceptionResponse($exception); + if ($response === null) { + throw new ApiException( + "[{$exception->getCode()}] {$exception->getMessage()}", + (int) $exception->getCode(), + null, + null + ); + } $statusCode = $response->getStatusCode(); throw new ApiException( sprintf( @@ -5495,7 +5742,7 @@ public function updateFolderRequest($workspace_id, $folder_id, $name = null, str // path params if ($workspace_id !== null) { $resourcePath = str_replace( - '{' . 'workspace_id' . '}', + '{workspace_id}', ObjectSerializer::toPathValue($workspace_id), $resourcePath ); @@ -5503,7 +5750,7 @@ public function updateFolderRequest($workspace_id, $folder_id, $name = null, str // path params if ($folder_id !== null) { $resourcePath = str_replace( - '{' . 'folder_id' . '}', + '{folder_id}', ObjectSerializer::toPathValue($folder_id), $resourcePath ); @@ -5544,7 +5791,11 @@ public function updateFolderRequest($workspace_id, $folder_id, $name = null, str } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + try { + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + } catch (\JsonException $e) { + throw new \InvalidArgumentException('json_encode error: ' . $e->getMessage(), 0, $e); + } } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -5604,6 +5855,21 @@ protected function createHttpClientOption() return $options; } + /** + * Returns the response attached to a Guzzle exception, if there is one. + * + * Guzzle 7 exposes getResponse() on RequestException, while Guzzle 8 only + * exposes it on ResponseException and its subclasses. + * + * @param \Throwable $exception + * + * @return ResponseInterface|null + */ + private function getExceptionResponse(\Throwable $exception): ?ResponseInterface + { + return method_exists($exception, 'getResponse') ? $exception->getResponse() : null; + } + private function handleResponseWithDataType( string $dataType, RequestInterface $request, diff --git a/lib/User/ChooseADateColumnValue.php b/lib/User/ChooseADateColumnValue.php index 3723b48c..287f47a5 100644 --- a/lib/User/ChooseADateColumnValue.php +++ b/lib/User/ChooseADateColumnValue.php @@ -44,49 +44,49 @@ class ChooseADateColumnValue implements ModelInterface, ArrayAccess, \JsonSerial public const DISCRIMINATOR = null; /** - * The original name of the model. - * - * @var string - */ + * The original name of the model. + * + * @var string + */ protected static $openAPIModelName = 'choose_a_date_column_value'; /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ protected static $openAPITypes = [ 'set_type' => 'string', 'date_column_key' => 'string' ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - * @phpstan-var array - * @psalm-var array - */ + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ protected static $openAPIFormats = [ 'set_type' => null, 'date_column_key' => null ]; /** - * Array of nullable properties. Used for (de)serialization - * - * @var boolean[] - */ + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ protected static array $openAPINullables = [ 'set_type' => false, 'date_column_key' => false ]; /** - * If a nullable field gets set to null, insert it here - * - * @var boolean[] - */ + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ protected array $openAPINullablesSetToNull = []; /** @@ -267,14 +267,14 @@ public function __construct(?array $data = null) } /** - * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName - * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the - * $this->openAPINullablesSetToNull array - * - * @param string $variableName - * @param array $fields - * @param mixed $defaultValue - */ + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ private function setIfExists(string $variableName, array $fields, $defaultValue): void { if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { diff --git a/lib/User/CommonDatasetApi.php b/lib/User/CommonDatasetApi.php index 56842423..95cb7d6f 100644 --- a/lib/User/CommonDatasetApi.php +++ b/lib/User/CommonDatasetApi.php @@ -28,11 +28,11 @@ use GuzzleHttp\Client; use GuzzleHttp\ClientInterface; -use GuzzleHttp\Exception\ConnectException; use GuzzleHttp\Exception\RequestException; use GuzzleHttp\Psr7\MultipartStream; use GuzzleHttp\Psr7\Request; use GuzzleHttp\RequestOptions; +use Psr\Http\Client\NetworkExceptionInterface; use Psr\Http\Message\RequestInterface; use Psr\Http\Message\ResponseInterface; use SeaTable\Client\ApiException; @@ -190,13 +190,14 @@ public function deleteCommonDatasetWithHttpInfo($dataset_id, string $contentType try { $response = $this->client->send($request, $options); } catch (RequestException $e) { + $eResponse = $this->getExceptionResponse($e); throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), - $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? (string) $e->getResponse()->getBody() : null + $eResponse ? $eResponse->getHeaders() : null, + $eResponse ? (string) $eResponse->getBody() : null ); - } catch (ConnectException $e) { + } catch (NetworkExceptionInterface $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), @@ -311,7 +312,15 @@ function ($response) use ($returnType) { ]; }, function ($exception) { - $response = $exception->getResponse(); + $response = $this->getExceptionResponse($exception); + if ($response === null) { + throw new ApiException( + "[{$exception->getCode()}] {$exception->getMessage()}", + (int) $exception->getCode(), + null, + null + ); + } $statusCode = $response->getStatusCode(); throw new ApiException( sprintf( @@ -362,7 +371,7 @@ public function deleteCommonDatasetRequest($dataset_id, string $contentType = se // path params if ($dataset_id !== null) { $resourcePath = str_replace( - '{' . 'dataset_id' . '}', + '{dataset_id}', ObjectSerializer::toPathValue($dataset_id), $resourcePath ); @@ -393,7 +402,11 @@ public function deleteCommonDatasetRequest($dataset_id, string $contentType = se } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + try { + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + } catch (\JsonException $e) { + throw new \InvalidArgumentException('json_encode error: ' . $e->getMessage(), 0, $e); + } } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -465,13 +478,14 @@ public function getCommonDatasetWithHttpInfo($dataset_id, string $contentType = try { $response = $this->client->send($request, $options); } catch (RequestException $e) { + $eResponse = $this->getExceptionResponse($e); throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), - $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? (string) $e->getResponse()->getBody() : null + $eResponse ? $eResponse->getHeaders() : null, + $eResponse ? (string) $eResponse->getBody() : null ); - } catch (ConnectException $e) { + } catch (NetworkExceptionInterface $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), @@ -586,7 +600,15 @@ function ($response) use ($returnType) { ]; }, function ($exception) { - $response = $exception->getResponse(); + $response = $this->getExceptionResponse($exception); + if ($response === null) { + throw new ApiException( + "[{$exception->getCode()}] {$exception->getMessage()}", + (int) $exception->getCode(), + null, + null + ); + } $statusCode = $response->getStatusCode(); throw new ApiException( sprintf( @@ -637,7 +659,7 @@ public function getCommonDatasetRequest($dataset_id, string $contentType = self: // path params if ($dataset_id !== null) { $resourcePath = str_replace( - '{' . 'dataset_id' . '}', + '{dataset_id}', ObjectSerializer::toPathValue($dataset_id), $resourcePath ); @@ -668,7 +690,11 @@ public function getCommonDatasetRequest($dataset_id, string $contentType = self: } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + try { + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + } catch (\JsonException $e) { + throw new \InvalidArgumentException('json_encode error: ' . $e->getMessage(), 0, $e); + } } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -740,13 +766,14 @@ public function getCommonDatasetInfoWithHttpInfo($dataset_id, string $contentTyp try { $response = $this->client->send($request, $options); } catch (RequestException $e) { + $eResponse = $this->getExceptionResponse($e); throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), - $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? (string) $e->getResponse()->getBody() : null + $eResponse ? $eResponse->getHeaders() : null, + $eResponse ? (string) $eResponse->getBody() : null ); - } catch (ConnectException $e) { + } catch (NetworkExceptionInterface $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), @@ -861,7 +888,15 @@ function ($response) use ($returnType) { ]; }, function ($exception) { - $response = $exception->getResponse(); + $response = $this->getExceptionResponse($exception); + if ($response === null) { + throw new ApiException( + "[{$exception->getCode()}] {$exception->getMessage()}", + (int) $exception->getCode(), + null, + null + ); + } $statusCode = $response->getStatusCode(); throw new ApiException( sprintf( @@ -912,7 +947,7 @@ public function getCommonDatasetInfoRequest($dataset_id, string $contentType = s // path params if ($dataset_id !== null) { $resourcePath = str_replace( - '{' . 'dataset_id' . '}', + '{dataset_id}', ObjectSerializer::toPathValue($dataset_id), $resourcePath ); @@ -943,7 +978,11 @@ public function getCommonDatasetInfoRequest($dataset_id, string $contentType = s } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + try { + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + } catch (\JsonException $e) { + throw new \InvalidArgumentException('json_encode error: ' . $e->getMessage(), 0, $e); + } } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -1017,13 +1056,14 @@ public function importCommonDatasetWithHttpInfo($dataset_id, $dst_dtable_uuid = try { $response = $this->client->send($request, $options); } catch (RequestException $e) { + $eResponse = $this->getExceptionResponse($e); throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), - $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? (string) $e->getResponse()->getBody() : null + $eResponse ? $eResponse->getHeaders() : null, + $eResponse ? (string) $eResponse->getBody() : null ); - } catch (ConnectException $e) { + } catch (NetworkExceptionInterface $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), @@ -1140,7 +1180,15 @@ function ($response) use ($returnType) { ]; }, function ($exception) { - $response = $exception->getResponse(); + $response = $this->getExceptionResponse($exception); + if ($response === null) { + throw new ApiException( + "[{$exception->getCode()}] {$exception->getMessage()}", + (int) $exception->getCode(), + null, + null + ); + } $statusCode = $response->getStatusCode(); throw new ApiException( sprintf( @@ -1193,7 +1241,7 @@ public function importCommonDatasetRequest($dataset_id, $dst_dtable_uuid = null, // path params if ($dataset_id !== null) { $resourcePath = str_replace( - '{' . 'dataset_id' . '}', + '{dataset_id}', ObjectSerializer::toPathValue($dataset_id), $resourcePath ); @@ -1234,7 +1282,11 @@ public function importCommonDatasetRequest($dataset_id, $dst_dtable_uuid = null, } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + try { + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + } catch (\JsonException $e) { + throw new \InvalidArgumentException('json_encode error: ' . $e->getMessage(), 0, $e); + } } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -1308,13 +1360,14 @@ public function listCommonDatasetWithHttpInfo($dtable_uuid, $by_group = null, st try { $response = $this->client->send($request, $options); } catch (RequestException $e) { + $eResponse = $this->getExceptionResponse($e); throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), - $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? (string) $e->getResponse()->getBody() : null + $eResponse ? $eResponse->getHeaders() : null, + $eResponse ? (string) $eResponse->getBody() : null ); - } catch (ConnectException $e) { + } catch (NetworkExceptionInterface $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), @@ -1431,7 +1484,15 @@ function ($response) use ($returnType) { ]; }, function ($exception) { - $response = $exception->getResponse(); + $response = $this->getExceptionResponse($exception); + if ($response === null) { + throw new ApiException( + "[{$exception->getCode()}] {$exception->getMessage()}", + (int) $exception->getCode(), + null, + null + ); + } $statusCode = $response->getStatusCode(); throw new ApiException( sprintf( @@ -1525,7 +1586,11 @@ public function listCommonDatasetRequest($dtable_uuid, $by_group = null, string } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + try { + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + } catch (\JsonException $e) { + throw new \InvalidArgumentException('json_encode error: ' . $e->getMessage(), 0, $e); + } } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -1597,13 +1662,14 @@ public function listSyncHistoryWithHttpInfo($dtable_uuid, string $contentType = try { $response = $this->client->send($request, $options); } catch (RequestException $e) { + $eResponse = $this->getExceptionResponse($e); throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), - $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? (string) $e->getResponse()->getBody() : null + $eResponse ? $eResponse->getHeaders() : null, + $eResponse ? (string) $eResponse->getBody() : null ); - } catch (ConnectException $e) { + } catch (NetworkExceptionInterface $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), @@ -1718,7 +1784,15 @@ function ($response) use ($returnType) { ]; }, function ($exception) { - $response = $exception->getResponse(); + $response = $this->getExceptionResponse($exception); + if ($response === null) { + throw new ApiException( + "[{$exception->getCode()}] {$exception->getMessage()}", + (int) $exception->getCode(), + null, + null + ); + } $statusCode = $response->getStatusCode(); throw new ApiException( sprintf( @@ -1801,7 +1875,11 @@ public function listSyncHistoryRequest($dtable_uuid, string $contentType = self: } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + try { + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + } catch (\JsonException $e) { + throw new \InvalidArgumentException('json_encode error: ' . $e->getMessage(), 0, $e); + } } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -1881,13 +1959,14 @@ public function publishCommonDatasetWithHttpInfo($dataset_name = null, $workspac try { $response = $this->client->send($request, $options); } catch (RequestException $e) { + $eResponse = $this->getExceptionResponse($e); throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), - $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? (string) $e->getResponse()->getBody() : null + $eResponse ? $eResponse->getHeaders() : null, + $eResponse ? (string) $eResponse->getBody() : null ); - } catch (ConnectException $e) { + } catch (NetworkExceptionInterface $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), @@ -2010,7 +2089,15 @@ function ($response) use ($returnType) { ]; }, function ($exception) { - $response = $exception->getResponse(); + $response = $this->getExceptionResponse($exception); + if ($response === null) { + throw new ApiException( + "[{$exception->getCode()}] {$exception->getMessage()}", + (int) $exception->getCode(), + null, + null + ); + } $statusCode = $response->getStatusCode(); throw new ApiException( sprintf( @@ -2096,7 +2183,11 @@ public function publishCommonDatasetRequest($dataset_name = null, $workspace_id } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + try { + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + } catch (\JsonException $e) { + throw new \InvalidArgumentException('json_encode error: ' . $e->getMessage(), 0, $e); + } } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -2170,13 +2261,14 @@ public function renameCommonDatasetWithHttpInfo($dataset_id, $dataset_name = nul try { $response = $this->client->send($request, $options); } catch (RequestException $e) { + $eResponse = $this->getExceptionResponse($e); throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), - $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? (string) $e->getResponse()->getBody() : null + $eResponse ? $eResponse->getHeaders() : null, + $eResponse ? (string) $eResponse->getBody() : null ); - } catch (ConnectException $e) { + } catch (NetworkExceptionInterface $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), @@ -2293,7 +2385,15 @@ function ($response) use ($returnType) { ]; }, function ($exception) { - $response = $exception->getResponse(); + $response = $this->getExceptionResponse($exception); + if ($response === null) { + throw new ApiException( + "[{$exception->getCode()}] {$exception->getMessage()}", + (int) $exception->getCode(), + null, + null + ); + } $statusCode = $response->getStatusCode(); throw new ApiException( sprintf( @@ -2346,7 +2446,7 @@ public function renameCommonDatasetRequest($dataset_id, $dataset_name = null, st // path params if ($dataset_id !== null) { $resourcePath = str_replace( - '{' . 'dataset_id' . '}', + '{dataset_id}', ObjectSerializer::toPathValue($dataset_id), $resourcePath ); @@ -2387,7 +2487,11 @@ public function renameCommonDatasetRequest($dataset_id, $dataset_name = null, st } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + try { + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + } catch (\JsonException $e) { + throw new \InvalidArgumentException('json_encode error: ' . $e->getMessage(), 0, $e); + } } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -2467,13 +2571,14 @@ public function syncCommonDatasetWithHttpInfo($dataset_id, $dst_dtable_uuid = nu try { $response = $this->client->send($request, $options); } catch (RequestException $e) { + $eResponse = $this->getExceptionResponse($e); throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), - $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? (string) $e->getResponse()->getBody() : null + $eResponse ? $eResponse->getHeaders() : null, + $eResponse ? (string) $eResponse->getBody() : null ); - } catch (ConnectException $e) { + } catch (NetworkExceptionInterface $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), @@ -2596,7 +2701,15 @@ function ($response) use ($returnType) { ]; }, function ($exception) { - $response = $exception->getResponse(); + $response = $this->getExceptionResponse($exception); + if ($response === null) { + throw new ApiException( + "[{$exception->getCode()}] {$exception->getMessage()}", + (int) $exception->getCode(), + null, + null + ); + } $statusCode = $response->getStatusCode(); throw new ApiException( sprintf( @@ -2655,7 +2768,7 @@ public function syncCommonDatasetRequest($dataset_id, $dst_dtable_uuid = null, $ // path params if ($dataset_id !== null) { $resourcePath = str_replace( - '{' . 'dataset_id' . '}', + '{dataset_id}', ObjectSerializer::toPathValue($dataset_id), $resourcePath ); @@ -2699,7 +2812,11 @@ public function syncCommonDatasetRequest($dataset_id, $dst_dtable_uuid = null, $ } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + try { + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + } catch (\JsonException $e) { + throw new \InvalidArgumentException('json_encode error: ' . $e->getMessage(), 0, $e); + } } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -2773,13 +2890,14 @@ public function updateCommonDatasetSyncWithHttpInfo($dataset_id, $update_common_ try { $response = $this->client->send($request, $options); } catch (RequestException $e) { + $eResponse = $this->getExceptionResponse($e); throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), - $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? (string) $e->getResponse()->getBody() : null + $eResponse ? $eResponse->getHeaders() : null, + $eResponse ? (string) $eResponse->getBody() : null ); - } catch (ConnectException $e) { + } catch (NetworkExceptionInterface $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), @@ -2896,7 +3014,15 @@ function ($response) use ($returnType) { ]; }, function ($exception) { - $response = $exception->getResponse(); + $response = $this->getExceptionResponse($exception); + if ($response === null) { + throw new ApiException( + "[{$exception->getCode()}] {$exception->getMessage()}", + (int) $exception->getCode(), + null, + null + ); + } $statusCode = $response->getStatusCode(); throw new ApiException( sprintf( @@ -2949,7 +3075,7 @@ public function updateCommonDatasetSyncRequest($dataset_id, $update_common_datas // path params if ($dataset_id !== null) { $resourcePath = str_replace( - '{' . 'dataset_id' . '}', + '{dataset_id}', ObjectSerializer::toPathValue($dataset_id), $resourcePath ); @@ -2966,7 +3092,11 @@ public function updateCommonDatasetSyncRequest($dataset_id, $update_common_datas if (isset($update_common_dataset_sync_request)) { if (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the body - $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($update_common_dataset_sync_request)); + try { + $httpBody = json_encode(ObjectSerializer::sanitizeForSerialization($update_common_dataset_sync_request), JSON_THROW_ON_ERROR); + } catch (\JsonException $e) { + throw new \InvalidArgumentException('json_encode error: ' . $e->getMessage(), 0, $e); + } } else { $httpBody = $update_common_dataset_sync_request; } @@ -2987,7 +3117,11 @@ public function updateCommonDatasetSyncRequest($dataset_id, $update_common_datas } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + try { + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + } catch (\JsonException $e) { + throw new \InvalidArgumentException('json_encode error: ' . $e->getMessage(), 0, $e); + } } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -3047,6 +3181,21 @@ protected function createHttpClientOption() return $options; } + /** + * Returns the response attached to a Guzzle exception, if there is one. + * + * Guzzle 7 exposes getResponse() on RequestException, while Guzzle 8 only + * exposes it on ResponseException and its subclasses. + * + * @param \Throwable $exception + * + * @return ResponseInterface|null + */ + private function getExceptionResponse(\Throwable $exception): ?ResponseInterface + { + return method_exists($exception, 'getResponse') ? $exception->getResponse() : null; + } + private function handleResponseWithDataType( string $dataType, RequestInterface $request, diff --git a/lib/User/Contains.php b/lib/User/Contains.php index c5e64ceb..b9b2b535 100644 --- a/lib/User/Contains.php +++ b/lib/User/Contains.php @@ -44,17 +44,17 @@ class Contains implements ModelInterface, ArrayAccess, \JsonSerializable public const DISCRIMINATOR = null; /** - * The original name of the model. - * - * @var string - */ + * The original name of the model. + * + * @var string + */ protected static $openAPIModelName = 'contains'; /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ protected static $openAPITypes = [ 'column_key' => 'string', 'filter_predicate' => 'string', @@ -62,12 +62,12 @@ class Contains implements ModelInterface, ArrayAccess, \JsonSerializable ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - * @phpstan-var array - * @psalm-var array - */ + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ protected static $openAPIFormats = [ 'column_key' => null, 'filter_predicate' => null, @@ -75,10 +75,10 @@ class Contains implements ModelInterface, ArrayAccess, \JsonSerializable ]; /** - * Array of nullable properties. Used for (de)serialization - * - * @var boolean[] - */ + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ protected static array $openAPINullables = [ 'column_key' => false, 'filter_predicate' => false, @@ -86,10 +86,10 @@ class Contains implements ModelInterface, ArrayAccess, \JsonSerializable ]; /** - * If a nullable field gets set to null, insert it here - * - * @var boolean[] - */ + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ protected array $openAPINullablesSetToNull = []; /** @@ -274,14 +274,14 @@ public function __construct(?array $data = null) } /** - * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName - * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the - * $this->openAPINullablesSetToNull array - * - * @param string $variableName - * @param array $fields - * @param mixed $defaultValue - */ + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ private function setIfExists(string $variableName, array $fields, $defaultValue): void { if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { diff --git a/lib/User/ContainsFilterTerm.php b/lib/User/ContainsFilterTerm.php index 7335b968..afe15eff 100644 --- a/lib/User/ContainsFilterTerm.php +++ b/lib/User/ContainsFilterTerm.php @@ -44,46 +44,46 @@ class ContainsFilterTerm implements ModelInterface, ArrayAccess, \JsonSerializab public const DISCRIMINATOR = null; /** - * The original name of the model. - * - * @var string - */ + * The original name of the model. + * + * @var string + */ protected static $openAPIModelName = 'contains_filter_term'; /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ protected static $openAPITypes = [ ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - * @phpstan-var array - * @psalm-var array - */ + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ protected static $openAPIFormats = [ ]; /** - * Array of nullable properties. Used for (de)serialization - * - * @var boolean[] - */ + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ protected static array $openAPINullables = [ ]; /** - * If a nullable field gets set to null, insert it here - * - * @var boolean[] - */ + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ protected array $openAPINullablesSetToNull = []; /** @@ -246,14 +246,14 @@ public function __construct(?array $data = null) } /** - * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName - * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the - * $this->openAPINullablesSetToNull array - * - * @param string $variableName - * @param array $fields - * @param mixed $defaultValue - */ + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ private function setIfExists(string $variableName, array $fields, $defaultValue): void { if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { diff --git a/lib/User/CreateAutomationRule200Response.php b/lib/User/CreateAutomationRule200Response.php index 9aa7d5ce..4eeba0dd 100644 --- a/lib/User/CreateAutomationRule200Response.php +++ b/lib/User/CreateAutomationRule200Response.php @@ -44,17 +44,17 @@ class CreateAutomationRule200Response implements ModelInterface, ArrayAccess, \J public const DISCRIMINATOR = null; /** - * The original name of the model. - * - * @var string - */ + * The original name of the model. + * + * @var string + */ protected static $openAPIModelName = 'createAutomationRule_200_response'; /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ protected static $openAPITypes = [ 'id' => 'int', 'dtable_uuid' => 'string', @@ -69,12 +69,12 @@ class CreateAutomationRule200Response implements ModelInterface, ArrayAccess, \J ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - * @phpstan-var array - * @psalm-var array - */ + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ protected static $openAPIFormats = [ 'id' => null, 'dtable_uuid' => null, @@ -89,10 +89,10 @@ class CreateAutomationRule200Response implements ModelInterface, ArrayAccess, \J ]; /** - * Array of nullable properties. Used for (de)serialization - * - * @var boolean[] - */ + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ protected static array $openAPINullables = [ 'id' => false, 'dtable_uuid' => false, @@ -107,10 +107,10 @@ class CreateAutomationRule200Response implements ModelInterface, ArrayAccess, \J ]; /** - * If a nullable field gets set to null, insert it here - * - * @var boolean[] - */ + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ protected array $openAPINullablesSetToNull = []; /** @@ -310,14 +310,14 @@ public function __construct(?array $data = null) } /** - * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName - * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the - * $this->openAPINullablesSetToNull array - * - * @param string $variableName - * @param array $fields - * @param mixed $defaultValue - */ + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ private function setIfExists(string $variableName, array $fields, $defaultValue): void { if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { diff --git a/lib/User/CreateAutomationRuleRequest.php b/lib/User/CreateAutomationRuleRequest.php index bbd9ab25..48572a5f 100644 --- a/lib/User/CreateAutomationRuleRequest.php +++ b/lib/User/CreateAutomationRuleRequest.php @@ -44,17 +44,17 @@ class CreateAutomationRuleRequest implements ModelInterface, ArrayAccess, \JsonS public const DISCRIMINATOR = null; /** - * The original name of the model. - * - * @var string - */ + * The original name of the model. + * + * @var string + */ protected static $openAPIModelName = 'createAutomationRule_request'; /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ protected static $openAPITypes = [ 'run_condition' => 'string', 'trigger' => '\SeaTable\Client\User\TriggerRunPeriodicallyOnRecordsMeetPerMonthTrigger', @@ -62,12 +62,12 @@ class CreateAutomationRuleRequest implements ModelInterface, ArrayAccess, \JsonS ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - * @phpstan-var array - * @psalm-var array - */ + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ protected static $openAPIFormats = [ 'run_condition' => null, 'trigger' => null, @@ -75,10 +75,10 @@ class CreateAutomationRuleRequest implements ModelInterface, ArrayAccess, \JsonS ]; /** - * Array of nullable properties. Used for (de)serialization - * - * @var boolean[] - */ + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ protected static array $openAPINullables = [ 'run_condition' => false, 'trigger' => false, @@ -86,10 +86,10 @@ class CreateAutomationRuleRequest implements ModelInterface, ArrayAccess, \JsonS ]; /** - * If a nullable field gets set to null, insert it here - * - * @var boolean[] - */ + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ protected array $openAPINullablesSetToNull = []; /** @@ -274,14 +274,14 @@ public function __construct(?array $data = null) } /** - * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName - * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the - * $this->openAPINullablesSetToNull array - * - * @param string $variableName - * @param array $fields - * @param mixed $defaultValue - */ + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ private function setIfExists(string $variableName, array $fields, $defaultValue): void { if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { diff --git a/lib/User/CreateBaseExternalLink200Response.php b/lib/User/CreateBaseExternalLink200Response.php index 22495949..422d62ab 100644 --- a/lib/User/CreateBaseExternalLink200Response.php +++ b/lib/User/CreateBaseExternalLink200Response.php @@ -44,17 +44,17 @@ class CreateBaseExternalLink200Response implements ModelInterface, ArrayAccess, public const DISCRIMINATOR = null; /** - * The original name of the model. - * - * @var string - */ + * The original name of the model. + * + * @var string + */ protected static $openAPIModelName = 'createBaseExternalLink_200_response'; /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ protected static $openAPITypes = [ 'url' => 'string', 'token' => 'string', @@ -65,12 +65,12 @@ class CreateBaseExternalLink200Response implements ModelInterface, ArrayAccess, ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - * @phpstan-var array - * @psalm-var array - */ + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ protected static $openAPIFormats = [ 'url' => null, 'token' => null, @@ -81,10 +81,10 @@ class CreateBaseExternalLink200Response implements ModelInterface, ArrayAccess, ]; /** - * Array of nullable properties. Used for (de)serialization - * - * @var boolean[] - */ + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ protected static array $openAPINullables = [ 'url' => false, 'token' => false, @@ -95,10 +95,10 @@ class CreateBaseExternalLink200Response implements ModelInterface, ArrayAccess, ]; /** - * If a nullable field gets set to null, insert it here - * - * @var boolean[] - */ + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ protected array $openAPINullablesSetToNull = []; /** @@ -282,14 +282,14 @@ public function __construct(?array $data = null) } /** - * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName - * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the - * $this->openAPINullablesSetToNull array - * - * @param string $variableName - * @param array $fields - * @param mixed $defaultValue - */ + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ private function setIfExists(string $variableName, array $fields, $defaultValue): void { if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { diff --git a/lib/User/CreateGroupRequest.php b/lib/User/CreateGroupRequest.php index fa01021a..d01c13e4 100644 --- a/lib/User/CreateGroupRequest.php +++ b/lib/User/CreateGroupRequest.php @@ -44,46 +44,46 @@ class CreateGroupRequest implements ModelInterface, ArrayAccess, \JsonSerializab public const DISCRIMINATOR = null; /** - * The original name of the model. - * - * @var string - */ + * The original name of the model. + * + * @var string + */ protected static $openAPIModelName = 'createGroup_request'; /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ protected static $openAPITypes = [ 'name' => 'string' ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - * @phpstan-var array - * @psalm-var array - */ + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ protected static $openAPIFormats = [ 'name' => null ]; /** - * Array of nullable properties. Used for (de)serialization - * - * @var boolean[] - */ + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ protected static array $openAPINullables = [ 'name' => false ]; /** - * If a nullable field gets set to null, insert it here - * - * @var boolean[] - */ + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ protected array $openAPINullablesSetToNull = []; /** @@ -247,14 +247,14 @@ public function __construct(?array $data = null) } /** - * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName - * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the - * $this->openAPINullablesSetToNull array - * - * @param string $variableName - * @param array $fields - * @param mixed $defaultValue - */ + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ private function setIfExists(string $variableName, array $fields, $defaultValue): void { if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { diff --git a/lib/User/CreateGroupViewShare200Response.php b/lib/User/CreateGroupViewShare200Response.php index 36298f11..105e57af 100644 --- a/lib/User/CreateGroupViewShare200Response.php +++ b/lib/User/CreateGroupViewShare200Response.php @@ -44,17 +44,17 @@ class CreateGroupViewShare200Response implements ModelInterface, ArrayAccess, \J public const DISCRIMINATOR = null; /** - * The original name of the model. - * - * @var string - */ + * The original name of the model. + * + * @var string + */ protected static $openAPIModelName = 'createGroupViewShare_200_response'; /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ protected static $openAPITypes = [ 'id' => 'int', 'dtable_name' => 'string', @@ -68,12 +68,12 @@ class CreateGroupViewShare200Response implements ModelInterface, ArrayAccess, \J ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - * @phpstan-var array - * @psalm-var array - */ + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ protected static $openAPIFormats = [ 'id' => null, 'dtable_name' => null, @@ -87,10 +87,10 @@ class CreateGroupViewShare200Response implements ModelInterface, ArrayAccess, \J ]; /** - * Array of nullable properties. Used for (de)serialization - * - * @var boolean[] - */ + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ protected static array $openAPINullables = [ 'id' => false, 'dtable_name' => false, @@ -104,10 +104,10 @@ class CreateGroupViewShare200Response implements ModelInterface, ArrayAccess, \J ]; /** - * If a nullable field gets set to null, insert it here - * - * @var boolean[] - */ + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ protected array $openAPINullablesSetToNull = []; /** @@ -303,14 +303,14 @@ public function __construct(?array $data = null) } /** - * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName - * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the - * $this->openAPINullablesSetToNull array - * - * @param string $variableName - * @param array $fields - * @param mixed $defaultValue - */ + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ private function setIfExists(string $variableName, array $fields, $defaultValue): void { if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { diff --git a/lib/User/CreateInviteLink200Response.php b/lib/User/CreateInviteLink200Response.php index c766c592..8ca854bb 100644 --- a/lib/User/CreateInviteLink200Response.php +++ b/lib/User/CreateInviteLink200Response.php @@ -44,17 +44,17 @@ class CreateInviteLink200Response implements ModelInterface, ArrayAccess, \JsonS public const DISCRIMINATOR = null; /** - * The original name of the model. - * - * @var string - */ + * The original name of the model. + * + * @var string + */ protected static $openAPIModelName = 'createInviteLink_200_response'; /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ protected static $openAPITypes = [ 'username' => 'string', 'permission' => 'string', @@ -68,12 +68,12 @@ class CreateInviteLink200Response implements ModelInterface, ArrayAccess, \JsonS ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - * @phpstan-var array - * @psalm-var array - */ + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ protected static $openAPIFormats = [ 'username' => null, 'permission' => null, @@ -87,10 +87,10 @@ class CreateInviteLink200Response implements ModelInterface, ArrayAccess, \JsonS ]; /** - * Array of nullable properties. Used for (de)serialization - * - * @var boolean[] - */ + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ protected static array $openAPINullables = [ 'username' => false, 'permission' => false, @@ -104,10 +104,10 @@ class CreateInviteLink200Response implements ModelInterface, ArrayAccess, \JsonS ]; /** - * If a nullable field gets set to null, insert it here - * - * @var boolean[] - */ + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ protected array $openAPINullablesSetToNull = []; /** @@ -303,14 +303,14 @@ public function __construct(?array $data = null) } /** - * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName - * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the - * $this->openAPINullablesSetToNull array - * - * @param string $variableName - * @param array $fields - * @param mixed $defaultValue - */ + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ private function setIfExists(string $variableName, array $fields, $defaultValue): void { if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { diff --git a/lib/User/CreateUserViewShare200Response.php b/lib/User/CreateUserViewShare200Response.php index a4330824..9740d6ba 100644 --- a/lib/User/CreateUserViewShare200Response.php +++ b/lib/User/CreateUserViewShare200Response.php @@ -44,17 +44,17 @@ class CreateUserViewShare200Response implements ModelInterface, ArrayAccess, \Js public const DISCRIMINATOR = null; /** - * The original name of the model. - * - * @var string - */ + * The original name of the model. + * + * @var string + */ protected static $openAPIModelName = 'createUserViewShare_200_response'; /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ protected static $openAPITypes = [ 'id' => 'int', 'dtable_name' => 'string', @@ -69,12 +69,12 @@ class CreateUserViewShare200Response implements ModelInterface, ArrayAccess, \Js ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - * @phpstan-var array - * @psalm-var array - */ + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ protected static $openAPIFormats = [ 'id' => null, 'dtable_name' => null, @@ -89,10 +89,10 @@ class CreateUserViewShare200Response implements ModelInterface, ArrayAccess, \Js ]; /** - * Array of nullable properties. Used for (de)serialization - * - * @var boolean[] - */ + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ protected static array $openAPINullables = [ 'id' => false, 'dtable_name' => false, @@ -107,10 +107,10 @@ class CreateUserViewShare200Response implements ModelInterface, ArrayAccess, \Js ]; /** - * If a nullable field gets set to null, insert it here - * - * @var boolean[] - */ + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ protected array $openAPINullablesSetToNull = []; /** @@ -310,14 +310,14 @@ public function __construct(?array $data = null) } /** - * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName - * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the - * $this->openAPINullablesSetToNull array - * - * @param string $variableName - * @param array $fields - * @param mixed $defaultValue - */ + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ private function setIfExists(string $variableName, array $fields, $defaultValue): void { if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { diff --git a/lib/User/CreateViewExternalLink200Response.php b/lib/User/CreateViewExternalLink200Response.php index 00030eaa..9a295cef 100644 --- a/lib/User/CreateViewExternalLink200Response.php +++ b/lib/User/CreateViewExternalLink200Response.php @@ -44,17 +44,17 @@ class CreateViewExternalLink200Response implements ModelInterface, ArrayAccess, public const DISCRIMINATOR = null; /** - * The original name of the model. - * - * @var string - */ + * The original name of the model. + * + * @var string + */ protected static $openAPIModelName = 'createViewExternalLink_200_response'; /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ protected static $openAPITypes = [ 'id' => 'int', 'from_dtable' => 'string', @@ -72,12 +72,12 @@ class CreateViewExternalLink200Response implements ModelInterface, ArrayAccess, ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - * @phpstan-var array - * @psalm-var array - */ + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ protected static $openAPIFormats = [ 'id' => null, 'from_dtable' => null, @@ -95,10 +95,10 @@ class CreateViewExternalLink200Response implements ModelInterface, ArrayAccess, ]; /** - * Array of nullable properties. Used for (de)serialization - * - * @var boolean[] - */ + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ protected static array $openAPINullables = [ 'id' => false, 'from_dtable' => false, @@ -116,10 +116,10 @@ class CreateViewExternalLink200Response implements ModelInterface, ArrayAccess, ]; /** - * If a nullable field gets set to null, insert it here - * - * @var boolean[] - */ + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ protected array $openAPINullablesSetToNull = []; /** @@ -331,14 +331,14 @@ public function __construct(?array $data = null) } /** - * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName - * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the - * $this->openAPINullablesSetToNull array - * - * @param string $variableName - * @param array $fields - * @param mixed $defaultValue - */ + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ private function setIfExists(string $variableName, array $fields, $defaultValue): void { if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { diff --git a/lib/User/DepartmentsApi.php b/lib/User/DepartmentsApi.php index 92b3ae98..e12b03da 100644 --- a/lib/User/DepartmentsApi.php +++ b/lib/User/DepartmentsApi.php @@ -28,11 +28,11 @@ use GuzzleHttp\Client; use GuzzleHttp\ClientInterface; -use GuzzleHttp\Exception\ConnectException; use GuzzleHttp\Exception\RequestException; use GuzzleHttp\Psr7\MultipartStream; use GuzzleHttp\Psr7\Request; use GuzzleHttp\RequestOptions; +use Psr\Http\Client\NetworkExceptionInterface; use Psr\Http\Message\RequestInterface; use Psr\Http\Message\ResponseInterface; use SeaTable\Client\ApiException; @@ -189,13 +189,14 @@ public function addDepartmentMembersWithHttpInfo($department_id, $add_department try { $response = $this->client->send($request, $options); } catch (RequestException $e) { + $eResponse = $this->getExceptionResponse($e); throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), - $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? (string) $e->getResponse()->getBody() : null + $eResponse ? $eResponse->getHeaders() : null, + $eResponse ? (string) $eResponse->getBody() : null ); - } catch (ConnectException $e) { + } catch (NetworkExceptionInterface $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), @@ -312,7 +313,15 @@ function ($response) use ($returnType) { ]; }, function ($exception) { - $response = $exception->getResponse(); + $response = $this->getExceptionResponse($exception); + if ($response === null) { + throw new ApiException( + "[{$exception->getCode()}] {$exception->getMessage()}", + (int) $exception->getCode(), + null, + null + ); + } $statusCode = $response->getStatusCode(); throw new ApiException( sprintf( @@ -365,7 +374,7 @@ public function addDepartmentMembersRequest($department_id, $add_department_memb // path params if ($department_id !== null) { $resourcePath = str_replace( - '{' . 'department_id' . '}', + '{department_id}', ObjectSerializer::toPathValue($department_id), $resourcePath ); @@ -382,7 +391,11 @@ public function addDepartmentMembersRequest($department_id, $add_department_memb if (isset($add_department_members_request)) { if (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the body - $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($add_department_members_request)); + try { + $httpBody = json_encode(ObjectSerializer::sanitizeForSerialization($add_department_members_request), JSON_THROW_ON_ERROR); + } catch (\JsonException $e) { + throw new \InvalidArgumentException('json_encode error: ' . $e->getMessage(), 0, $e); + } } else { $httpBody = $add_department_members_request; } @@ -403,7 +416,11 @@ public function addDepartmentMembersRequest($department_id, $add_department_memb } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + try { + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + } catch (\JsonException $e) { + throw new \InvalidArgumentException('json_encode error: ' . $e->getMessage(), 0, $e); + } } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -475,13 +492,14 @@ public function getDepartmentGroupMembersCountWithHttpInfo($group_id, string $co try { $response = $this->client->send($request, $options); } catch (RequestException $e) { + $eResponse = $this->getExceptionResponse($e); throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), - $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? (string) $e->getResponse()->getBody() : null + $eResponse ? $eResponse->getHeaders() : null, + $eResponse ? (string) $eResponse->getBody() : null ); - } catch (ConnectException $e) { + } catch (NetworkExceptionInterface $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), @@ -596,7 +614,15 @@ function ($response) use ($returnType) { ]; }, function ($exception) { - $response = $exception->getResponse(); + $response = $this->getExceptionResponse($exception); + if ($response === null) { + throw new ApiException( + "[{$exception->getCode()}] {$exception->getMessage()}", + (int) $exception->getCode(), + null, + null + ); + } $statusCode = $response->getStatusCode(); throw new ApiException( sprintf( @@ -647,7 +673,7 @@ public function getDepartmentGroupMembersCountRequest($group_id, string $content // path params if ($group_id !== null) { $resourcePath = str_replace( - '{' . 'group_id' . '}', + '{group_id}', ObjectSerializer::toPathValue($group_id), $resourcePath ); @@ -678,7 +704,11 @@ public function getDepartmentGroupMembersCountRequest($group_id, string $content } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + try { + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + } catch (\JsonException $e) { + throw new \InvalidArgumentException('json_encode error: ' . $e->getMessage(), 0, $e); + } } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -752,13 +782,14 @@ public function listDepartmentMemberBasesWithHttpInfo($department_id, $user_id, try { $response = $this->client->send($request, $options); } catch (RequestException $e) { + $eResponse = $this->getExceptionResponse($e); throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), - $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? (string) $e->getResponse()->getBody() : null + $eResponse ? $eResponse->getHeaders() : null, + $eResponse ? (string) $eResponse->getBody() : null ); - } catch (ConnectException $e) { + } catch (NetworkExceptionInterface $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), @@ -875,7 +906,15 @@ function ($response) use ($returnType) { ]; }, function ($exception) { - $response = $exception->getResponse(); + $response = $this->getExceptionResponse($exception); + if ($response === null) { + throw new ApiException( + "[{$exception->getCode()}] {$exception->getMessage()}", + (int) $exception->getCode(), + null, + null + ); + } $statusCode = $response->getStatusCode(); throw new ApiException( sprintf( @@ -937,7 +976,7 @@ public function listDepartmentMemberBasesRequest($department_id, $user_id, strin // path params if ($department_id !== null) { $resourcePath = str_replace( - '{' . 'department_id' . '}', + '{department_id}', ObjectSerializer::toPathValue($department_id), $resourcePath ); @@ -945,7 +984,7 @@ public function listDepartmentMemberBasesRequest($department_id, $user_id, strin // path params if ($user_id !== null) { $resourcePath = str_replace( - '{' . 'user_id' . '}', + '{user_id}', ObjectSerializer::toPathValue($user_id), $resourcePath ); @@ -976,7 +1015,11 @@ public function listDepartmentMemberBasesRequest($department_id, $user_id, strin } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + try { + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + } catch (\JsonException $e) { + throw new \InvalidArgumentException('json_encode error: ' . $e->getMessage(), 0, $e); + } } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -1048,13 +1091,14 @@ public function listDepartmentMembersWithHttpInfo($department_id, string $conten try { $response = $this->client->send($request, $options); } catch (RequestException $e) { + $eResponse = $this->getExceptionResponse($e); throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), - $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? (string) $e->getResponse()->getBody() : null + $eResponse ? $eResponse->getHeaders() : null, + $eResponse ? (string) $eResponse->getBody() : null ); - } catch (ConnectException $e) { + } catch (NetworkExceptionInterface $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), @@ -1169,7 +1213,15 @@ function ($response) use ($returnType) { ]; }, function ($exception) { - $response = $exception->getResponse(); + $response = $this->getExceptionResponse($exception); + if ($response === null) { + throw new ApiException( + "[{$exception->getCode()}] {$exception->getMessage()}", + (int) $exception->getCode(), + null, + null + ); + } $statusCode = $response->getStatusCode(); throw new ApiException( sprintf( @@ -1220,7 +1272,7 @@ public function listDepartmentMembersRequest($department_id, string $contentType // path params if ($department_id !== null) { $resourcePath = str_replace( - '{' . 'department_id' . '}', + '{department_id}', ObjectSerializer::toPathValue($department_id), $resourcePath ); @@ -1251,7 +1303,11 @@ public function listDepartmentMembersRequest($department_id, string $contentType } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + try { + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + } catch (\JsonException $e) { + throw new \InvalidArgumentException('json_encode error: ' . $e->getMessage(), 0, $e); + } } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -1321,13 +1377,14 @@ public function listDepartmentsWithHttpInfo(string $contentType = self::contentT try { $response = $this->client->send($request, $options); } catch (RequestException $e) { + $eResponse = $this->getExceptionResponse($e); throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), - $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? (string) $e->getResponse()->getBody() : null + $eResponse ? $eResponse->getHeaders() : null, + $eResponse ? (string) $eResponse->getBody() : null ); - } catch (ConnectException $e) { + } catch (NetworkExceptionInterface $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), @@ -1440,7 +1497,15 @@ function ($response) use ($returnType) { ]; }, function ($exception) { - $response = $exception->getResponse(); + $response = $this->getExceptionResponse($exception); + if ($response === null) { + throw new ApiException( + "[{$exception->getCode()}] {$exception->getMessage()}", + (int) $exception->getCode(), + null, + null + ); + } $statusCode = $response->getStatusCode(); throw new ApiException( sprintf( @@ -1503,7 +1568,11 @@ public function listDepartmentsRequest(string $contentType = self::contentTypes[ } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + try { + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + } catch (\JsonException $e) { + throw new \InvalidArgumentException('json_encode error: ' . $e->getMessage(), 0, $e); + } } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -1575,13 +1644,14 @@ public function listSubDepartmentsWithHttpInfo($department_id, string $contentTy try { $response = $this->client->send($request, $options); } catch (RequestException $e) { + $eResponse = $this->getExceptionResponse($e); throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), - $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? (string) $e->getResponse()->getBody() : null + $eResponse ? $eResponse->getHeaders() : null, + $eResponse ? (string) $eResponse->getBody() : null ); - } catch (ConnectException $e) { + } catch (NetworkExceptionInterface $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), @@ -1696,7 +1766,15 @@ function ($response) use ($returnType) { ]; }, function ($exception) { - $response = $exception->getResponse(); + $response = $this->getExceptionResponse($exception); + if ($response === null) { + throw new ApiException( + "[{$exception->getCode()}] {$exception->getMessage()}", + (int) $exception->getCode(), + null, + null + ); + } $statusCode = $response->getStatusCode(); throw new ApiException( sprintf( @@ -1747,7 +1825,7 @@ public function listSubDepartmentsRequest($department_id, string $contentType = // path params if ($department_id !== null) { $resourcePath = str_replace( - '{' . 'department_id' . '}', + '{department_id}', ObjectSerializer::toPathValue($department_id), $resourcePath ); @@ -1778,7 +1856,11 @@ public function listSubDepartmentsRequest($department_id, string $contentType = } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + try { + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + } catch (\JsonException $e) { + throw new \InvalidArgumentException('json_encode error: ' . $e->getMessage(), 0, $e); + } } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -1848,13 +1930,14 @@ public function listUserDepartmentsWithHttpInfo(string $contentType = self::cont try { $response = $this->client->send($request, $options); } catch (RequestException $e) { + $eResponse = $this->getExceptionResponse($e); throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), - $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? (string) $e->getResponse()->getBody() : null + $eResponse ? $eResponse->getHeaders() : null, + $eResponse ? (string) $eResponse->getBody() : null ); - } catch (ConnectException $e) { + } catch (NetworkExceptionInterface $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), @@ -1967,7 +2050,15 @@ function ($response) use ($returnType) { ]; }, function ($exception) { - $response = $exception->getResponse(); + $response = $this->getExceptionResponse($exception); + if ($response === null) { + throw new ApiException( + "[{$exception->getCode()}] {$exception->getMessage()}", + (int) $exception->getCode(), + null, + null + ); + } $statusCode = $response->getStatusCode(); throw new ApiException( sprintf( @@ -2030,7 +2121,11 @@ public function listUserDepartmentsRequest(string $contentType = self::contentTy } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + try { + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + } catch (\JsonException $e) { + throw new \InvalidArgumentException('json_encode error: ' . $e->getMessage(), 0, $e); + } } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -2104,13 +2199,14 @@ public function removeDepartmentMemberWithHttpInfo($department_id, $user_id, str try { $response = $this->client->send($request, $options); } catch (RequestException $e) { + $eResponse = $this->getExceptionResponse($e); throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), - $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? (string) $e->getResponse()->getBody() : null + $eResponse ? $eResponse->getHeaders() : null, + $eResponse ? (string) $eResponse->getBody() : null ); - } catch (ConnectException $e) { + } catch (NetworkExceptionInterface $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), @@ -2227,7 +2323,15 @@ function ($response) use ($returnType) { ]; }, function ($exception) { - $response = $exception->getResponse(); + $response = $this->getExceptionResponse($exception); + if ($response === null) { + throw new ApiException( + "[{$exception->getCode()}] {$exception->getMessage()}", + (int) $exception->getCode(), + null, + null + ); + } $statusCode = $response->getStatusCode(); throw new ApiException( sprintf( @@ -2289,7 +2393,7 @@ public function removeDepartmentMemberRequest($department_id, $user_id, string $ // path params if ($department_id !== null) { $resourcePath = str_replace( - '{' . 'department_id' . '}', + '{department_id}', ObjectSerializer::toPathValue($department_id), $resourcePath ); @@ -2297,7 +2401,7 @@ public function removeDepartmentMemberRequest($department_id, $user_id, string $ // path params if ($user_id !== null) { $resourcePath = str_replace( - '{' . 'user_id' . '}', + '{user_id}', ObjectSerializer::toPathValue($user_id), $resourcePath ); @@ -2328,7 +2432,11 @@ public function removeDepartmentMemberRequest($department_id, $user_id, string $ } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + try { + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + } catch (\JsonException $e) { + throw new \InvalidArgumentException('json_encode error: ' . $e->getMessage(), 0, $e); + } } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -2404,13 +2512,14 @@ public function updateDepartmentMemberWithHttpInfo($department_id, $user_id, $up try { $response = $this->client->send($request, $options); } catch (RequestException $e) { + $eResponse = $this->getExceptionResponse($e); throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), - $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? (string) $e->getResponse()->getBody() : null + $eResponse ? $eResponse->getHeaders() : null, + $eResponse ? (string) $eResponse->getBody() : null ); - } catch (ConnectException $e) { + } catch (NetworkExceptionInterface $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), @@ -2529,7 +2638,15 @@ function ($response) use ($returnType) { ]; }, function ($exception) { - $response = $exception->getResponse(); + $response = $this->getExceptionResponse($exception); + if ($response === null) { + throw new ApiException( + "[{$exception->getCode()}] {$exception->getMessage()}", + (int) $exception->getCode(), + null, + null + ); + } $statusCode = $response->getStatusCode(); throw new ApiException( sprintf( @@ -2593,7 +2710,7 @@ public function updateDepartmentMemberRequest($department_id, $user_id, $update_ // path params if ($department_id !== null) { $resourcePath = str_replace( - '{' . 'department_id' . '}', + '{department_id}', ObjectSerializer::toPathValue($department_id), $resourcePath ); @@ -2601,7 +2718,7 @@ public function updateDepartmentMemberRequest($department_id, $user_id, $update_ // path params if ($user_id !== null) { $resourcePath = str_replace( - '{' . 'user_id' . '}', + '{user_id}', ObjectSerializer::toPathValue($user_id), $resourcePath ); @@ -2618,7 +2735,11 @@ public function updateDepartmentMemberRequest($department_id, $user_id, $update_ if (isset($update_group_role_request)) { if (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the body - $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($update_group_role_request)); + try { + $httpBody = json_encode(ObjectSerializer::sanitizeForSerialization($update_group_role_request), JSON_THROW_ON_ERROR); + } catch (\JsonException $e) { + throw new \InvalidArgumentException('json_encode error: ' . $e->getMessage(), 0, $e); + } } else { $httpBody = $update_group_role_request; } @@ -2639,7 +2760,11 @@ public function updateDepartmentMemberRequest($department_id, $user_id, $update_ } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + try { + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + } catch (\JsonException $e) { + throw new \InvalidArgumentException('json_encode error: ' . $e->getMessage(), 0, $e); + } } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -2699,6 +2824,21 @@ protected function createHttpClientOption() return $options; } + /** + * Returns the response attached to a Guzzle exception, if there is one. + * + * Guzzle 7 exposes getResponse() on RequestException, while Guzzle 8 only + * exposes it on ResponseException and its subclasses. + * + * @param \Throwable $exception + * + * @return ResponseInterface|null + */ + private function getExceptionResponse(\Throwable $exception): ?ResponseInterface + { + return method_exists($exception, 'getResponse') ? $exception->getResponse() : null; + } + private function handleResponseWithDataType( string $dataType, RequestInterface $request, diff --git a/lib/User/Detail.php b/lib/User/Detail.php index 11f61af7..9e6c1533 100644 --- a/lib/User/Detail.php +++ b/lib/User/Detail.php @@ -44,17 +44,17 @@ class Detail implements ModelInterface, ArrayAccess, \JsonSerializable public const DISCRIMINATOR = null; /** - * The original name of the model. - * - * @var string - */ + * The original name of the model. + * + * @var string + */ protected static $openAPIModelName = 'detail'; /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ protected static $openAPITypes = [ 'email_host' => 'string', 'email_port' => 'int', @@ -63,12 +63,12 @@ class Detail implements ModelInterface, ArrayAccess, \JsonSerializable ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - * @phpstan-var array - * @psalm-var array - */ + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ protected static $openAPIFormats = [ 'email_host' => null, 'email_port' => null, @@ -77,10 +77,10 @@ class Detail implements ModelInterface, ArrayAccess, \JsonSerializable ]; /** - * Array of nullable properties. Used for (de)serialization - * - * @var boolean[] - */ + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ protected static array $openAPINullables = [ 'email_host' => false, 'email_port' => false, @@ -89,10 +89,10 @@ class Detail implements ModelInterface, ArrayAccess, \JsonSerializable ]; /** - * If a nullable field gets set to null, insert it here - * - * @var boolean[] - */ + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ protected array $openAPINullablesSetToNull = []; /** @@ -268,14 +268,14 @@ public function __construct(?array $data = null) } /** - * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName - * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the - * $this->openAPINullablesSetToNull array - * - * @param string $variableName - * @param array $fields - * @param mixed $defaultValue - */ + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ private function setIfExists(string $variableName, array $fields, $defaultValue): void { if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { diff --git a/lib/User/DoesNotContain.php b/lib/User/DoesNotContain.php index a9eae9b6..20111cc4 100644 --- a/lib/User/DoesNotContain.php +++ b/lib/User/DoesNotContain.php @@ -44,17 +44,17 @@ class DoesNotContain implements ModelInterface, ArrayAccess, \JsonSerializable public const DISCRIMINATOR = null; /** - * The original name of the model. - * - * @var string - */ + * The original name of the model. + * + * @var string + */ protected static $openAPIModelName = 'does_not_contain'; /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ protected static $openAPITypes = [ 'column_key' => 'string', 'filter_predicate' => 'string', @@ -62,12 +62,12 @@ class DoesNotContain implements ModelInterface, ArrayAccess, \JsonSerializable ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - * @phpstan-var array - * @psalm-var array - */ + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ protected static $openAPIFormats = [ 'column_key' => null, 'filter_predicate' => null, @@ -75,10 +75,10 @@ class DoesNotContain implements ModelInterface, ArrayAccess, \JsonSerializable ]; /** - * Array of nullable properties. Used for (de)serialization - * - * @var boolean[] - */ + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ protected static array $openAPINullables = [ 'column_key' => false, 'filter_predicate' => false, @@ -86,10 +86,10 @@ class DoesNotContain implements ModelInterface, ArrayAccess, \JsonSerializable ]; /** - * If a nullable field gets set to null, insert it here - * - * @var boolean[] - */ + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ protected array $openAPINullablesSetToNull = []; /** @@ -274,14 +274,14 @@ public function __construct(?array $data = null) } /** - * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName - * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the - * $this->openAPINullablesSetToNull array - * - * @param string $variableName - * @param array $fields - * @param mixed $defaultValue - */ + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ private function setIfExists(string $variableName, array $fields, $defaultValue): void { if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { diff --git a/lib/User/EmailAccountsApi.php b/lib/User/EmailAccountsApi.php index c622ad5d..85376ff6 100644 --- a/lib/User/EmailAccountsApi.php +++ b/lib/User/EmailAccountsApi.php @@ -28,11 +28,11 @@ use GuzzleHttp\Client; use GuzzleHttp\ClientInterface; -use GuzzleHttp\Exception\ConnectException; use GuzzleHttp\Exception\RequestException; use GuzzleHttp\Psr7\MultipartStream; use GuzzleHttp\Psr7\Request; use GuzzleHttp\RequestOptions; +use Psr\Http\Client\NetworkExceptionInterface; use Psr\Http\Message\RequestInterface; use Psr\Http\Message\ResponseInterface; use SeaTable\Client\ApiException; @@ -180,13 +180,14 @@ public function addEmailAccountWithHttpInfo($base_uuid, $add_email_account_reque try { $response = $this->client->send($request, $options); } catch (RequestException $e) { + $eResponse = $this->getExceptionResponse($e); throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), - $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? (string) $e->getResponse()->getBody() : null + $eResponse ? $eResponse->getHeaders() : null, + $eResponse ? (string) $eResponse->getBody() : null ); - } catch (ConnectException $e) { + } catch (NetworkExceptionInterface $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), @@ -303,7 +304,15 @@ function ($response) use ($returnType) { ]; }, function ($exception) { - $response = $exception->getResponse(); + $response = $this->getExceptionResponse($exception); + if ($response === null) { + throw new ApiException( + "[{$exception->getCode()}] {$exception->getMessage()}", + (int) $exception->getCode(), + null, + null + ); + } $statusCode = $response->getStatusCode(); throw new ApiException( sprintf( @@ -356,7 +365,7 @@ public function addEmailAccountRequest($base_uuid, $add_email_account_request = // path params if ($base_uuid !== null) { $resourcePath = str_replace( - '{' . 'base_uuid' . '}', + '{base_uuid}', ObjectSerializer::toPathValue($base_uuid), $resourcePath ); @@ -373,7 +382,11 @@ public function addEmailAccountRequest($base_uuid, $add_email_account_request = if (isset($add_email_account_request)) { if (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the body - $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($add_email_account_request)); + try { + $httpBody = json_encode(ObjectSerializer::sanitizeForSerialization($add_email_account_request), JSON_THROW_ON_ERROR); + } catch (\JsonException $e) { + throw new \InvalidArgumentException('json_encode error: ' . $e->getMessage(), 0, $e); + } } else { $httpBody = $add_email_account_request; } @@ -394,7 +407,11 @@ public function addEmailAccountRequest($base_uuid, $add_email_account_request = } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + try { + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + } catch (\JsonException $e) { + throw new \InvalidArgumentException('json_encode error: ' . $e->getMessage(), 0, $e); + } } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -468,13 +485,14 @@ public function deleteEmailAccountWithHttpInfo($base_uuid, $_3rd_party_account_i try { $response = $this->client->send($request, $options); } catch (RequestException $e) { + $eResponse = $this->getExceptionResponse($e); throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), - $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? (string) $e->getResponse()->getBody() : null + $eResponse ? $eResponse->getHeaders() : null, + $eResponse ? (string) $eResponse->getBody() : null ); - } catch (ConnectException $e) { + } catch (NetworkExceptionInterface $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), @@ -591,7 +609,15 @@ function ($response) use ($returnType) { ]; }, function ($exception) { - $response = $exception->getResponse(); + $response = $this->getExceptionResponse($exception); + if ($response === null) { + throw new ApiException( + "[{$exception->getCode()}] {$exception->getMessage()}", + (int) $exception->getCode(), + null, + null + ); + } $statusCode = $response->getStatusCode(); throw new ApiException( sprintf( @@ -650,7 +676,7 @@ public function deleteEmailAccountRequest($base_uuid, $_3rd_party_account_id, st // path params if ($base_uuid !== null) { $resourcePath = str_replace( - '{' . 'base_uuid' . '}', + '{base_uuid}', ObjectSerializer::toPathValue($base_uuid), $resourcePath ); @@ -658,7 +684,7 @@ public function deleteEmailAccountRequest($base_uuid, $_3rd_party_account_id, st // path params if ($_3rd_party_account_id !== null) { $resourcePath = str_replace( - '{' . '3rd_party_account_id' . '}', + '{3rd_party_account_id}', ObjectSerializer::toPathValue($_3rd_party_account_id), $resourcePath ); @@ -689,7 +715,11 @@ public function deleteEmailAccountRequest($base_uuid, $_3rd_party_account_id, st } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + try { + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + } catch (\JsonException $e) { + throw new \InvalidArgumentException('json_encode error: ' . $e->getMessage(), 0, $e); + } } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -763,13 +793,14 @@ public function getEmailAccountWithHttpInfo($base_uuid, $account_name = null, st try { $response = $this->client->send($request, $options); } catch (RequestException $e) { + $eResponse = $this->getExceptionResponse($e); throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), - $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? (string) $e->getResponse()->getBody() : null + $eResponse ? $eResponse->getHeaders() : null, + $eResponse ? (string) $eResponse->getBody() : null ); - } catch (ConnectException $e) { + } catch (NetworkExceptionInterface $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), @@ -886,7 +917,15 @@ function ($response) use ($returnType) { ]; }, function ($exception) { - $response = $exception->getResponse(); + $response = $this->getExceptionResponse($exception); + if ($response === null) { + throw new ApiException( + "[{$exception->getCode()}] {$exception->getMessage()}", + (int) $exception->getCode(), + null, + null + ); + } $statusCode = $response->getStatusCode(); throw new ApiException( sprintf( @@ -948,7 +987,7 @@ public function getEmailAccountRequest($base_uuid, $account_name = null, string // path params if ($base_uuid !== null) { $resourcePath = str_replace( - '{' . 'base_uuid' . '}', + '{base_uuid}', ObjectSerializer::toPathValue($base_uuid), $resourcePath ); @@ -979,7 +1018,11 @@ public function getEmailAccountRequest($base_uuid, $account_name = null, string } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + try { + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + } catch (\JsonException $e) { + throw new \InvalidArgumentException('json_encode error: ' . $e->getMessage(), 0, $e); + } } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -1051,13 +1094,14 @@ public function getEmailSendingStatusWithHttpInfo($task_id = null, string $conte try { $response = $this->client->send($request, $options); } catch (RequestException $e) { + $eResponse = $this->getExceptionResponse($e); throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), - $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? (string) $e->getResponse()->getBody() : null + $eResponse ? $eResponse->getHeaders() : null, + $eResponse ? (string) $eResponse->getBody() : null ); - } catch (ConnectException $e) { + } catch (NetworkExceptionInterface $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), @@ -1172,7 +1216,15 @@ function ($response) use ($returnType) { ]; }, function ($exception) { - $response = $exception->getResponse(); + $response = $this->getExceptionResponse($exception); + if ($response === null) { + throw new ApiException( + "[{$exception->getCode()}] {$exception->getMessage()}", + (int) $exception->getCode(), + null, + null + ); + } $statusCode = $response->getStatusCode(); throw new ApiException( sprintf( @@ -1246,7 +1298,11 @@ public function getEmailSendingStatusRequest($task_id = null, string $contentTyp } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + try { + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + } catch (\JsonException $e) { + throw new \InvalidArgumentException('json_encode error: ' . $e->getMessage(), 0, $e); + } } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -1318,13 +1374,14 @@ public function listEmailAccountsWithHttpInfo($base_uuid, string $contentType = try { $response = $this->client->send($request, $options); } catch (RequestException $e) { + $eResponse = $this->getExceptionResponse($e); throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), - $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? (string) $e->getResponse()->getBody() : null + $eResponse ? $eResponse->getHeaders() : null, + $eResponse ? (string) $eResponse->getBody() : null ); - } catch (ConnectException $e) { + } catch (NetworkExceptionInterface $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), @@ -1439,7 +1496,15 @@ function ($response) use ($returnType) { ]; }, function ($exception) { - $response = $exception->getResponse(); + $response = $this->getExceptionResponse($exception); + if ($response === null) { + throw new ApiException( + "[{$exception->getCode()}] {$exception->getMessage()}", + (int) $exception->getCode(), + null, + null + ); + } $statusCode = $response->getStatusCode(); throw new ApiException( sprintf( @@ -1490,7 +1555,7 @@ public function listEmailAccountsRequest($base_uuid, string $contentType = self: // path params if ($base_uuid !== null) { $resourcePath = str_replace( - '{' . 'base_uuid' . '}', + '{base_uuid}', ObjectSerializer::toPathValue($base_uuid), $resourcePath ); @@ -1521,7 +1586,11 @@ public function listEmailAccountsRequest($base_uuid, string $contentType = self: } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + try { + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + } catch (\JsonException $e) { + throw new \InvalidArgumentException('json_encode error: ' . $e->getMessage(), 0, $e); + } } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -1597,13 +1666,14 @@ public function updateEmailAccountWithHttpInfo($base_uuid, $_3rd_party_account_i try { $response = $this->client->send($request, $options); } catch (RequestException $e) { + $eResponse = $this->getExceptionResponse($e); throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), - $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? (string) $e->getResponse()->getBody() : null + $eResponse ? $eResponse->getHeaders() : null, + $eResponse ? (string) $eResponse->getBody() : null ); - } catch (ConnectException $e) { + } catch (NetworkExceptionInterface $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), @@ -1722,7 +1792,15 @@ function ($response) use ($returnType) { ]; }, function ($exception) { - $response = $exception->getResponse(); + $response = $this->getExceptionResponse($exception); + if ($response === null) { + throw new ApiException( + "[{$exception->getCode()}] {$exception->getMessage()}", + (int) $exception->getCode(), + null, + null + ); + } $statusCode = $response->getStatusCode(); throw new ApiException( sprintf( @@ -1783,7 +1861,7 @@ public function updateEmailAccountRequest($base_uuid, $_3rd_party_account_id, $a // path params if ($base_uuid !== null) { $resourcePath = str_replace( - '{' . 'base_uuid' . '}', + '{base_uuid}', ObjectSerializer::toPathValue($base_uuid), $resourcePath ); @@ -1791,7 +1869,7 @@ public function updateEmailAccountRequest($base_uuid, $_3rd_party_account_id, $a // path params if ($_3rd_party_account_id !== null) { $resourcePath = str_replace( - '{' . '3rd_party_account_id' . '}', + '{3rd_party_account_id}', ObjectSerializer::toPathValue($_3rd_party_account_id), $resourcePath ); @@ -1808,7 +1886,11 @@ public function updateEmailAccountRequest($base_uuid, $_3rd_party_account_id, $a if (isset($add_email_account_request)) { if (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the body - $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($add_email_account_request)); + try { + $httpBody = json_encode(ObjectSerializer::sanitizeForSerialization($add_email_account_request), JSON_THROW_ON_ERROR); + } catch (\JsonException $e) { + throw new \InvalidArgumentException('json_encode error: ' . $e->getMessage(), 0, $e); + } } else { $httpBody = $add_email_account_request; } @@ -1829,7 +1911,11 @@ public function updateEmailAccountRequest($base_uuid, $_3rd_party_account_id, $a } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + try { + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + } catch (\JsonException $e) { + throw new \InvalidArgumentException('json_encode error: ' . $e->getMessage(), 0, $e); + } } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -1889,6 +1975,21 @@ protected function createHttpClientOption() return $options; } + /** + * Returns the response attached to a Guzzle exception, if there is one. + * + * Guzzle 7 exposes getResponse() on RequestException, while Guzzle 8 only + * exposes it on ResponseException and its subclasses. + * + * @param \Throwable $exception + * + * @return ResponseInterface|null + */ + private function getExceptionResponse(\Throwable $exception): ?ResponseInterface + { + return method_exists($exception, 'getResponse') ? $exception->getResponse() : null; + } + private function handleResponseWithDataType( string $dataType, RequestInterface $request, diff --git a/lib/User/Equal.php b/lib/User/Equal.php index 09017773..98ce5c35 100644 --- a/lib/User/Equal.php +++ b/lib/User/Equal.php @@ -44,17 +44,17 @@ class Equal implements ModelInterface, ArrayAccess, \JsonSerializable public const DISCRIMINATOR = null; /** - * The original name of the model. - * - * @var string - */ + * The original name of the model. + * + * @var string + */ protected static $openAPIModelName = 'equal'; /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ protected static $openAPITypes = [ 'column_key' => 'string', 'filter_predicate' => 'string', @@ -62,12 +62,12 @@ class Equal implements ModelInterface, ArrayAccess, \JsonSerializable ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - * @phpstan-var array - * @psalm-var array - */ + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ protected static $openAPIFormats = [ 'column_key' => null, 'filter_predicate' => null, @@ -75,10 +75,10 @@ class Equal implements ModelInterface, ArrayAccess, \JsonSerializable ]; /** - * Array of nullable properties. Used for (de)serialization - * - * @var boolean[] - */ + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ protected static array $openAPINullables = [ 'column_key' => false, 'filter_predicate' => false, @@ -86,10 +86,10 @@ class Equal implements ModelInterface, ArrayAccess, \JsonSerializable ]; /** - * If a nullable field gets set to null, insert it here - * - * @var boolean[] - */ + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ protected array $openAPINullablesSetToNull = []; /** @@ -274,14 +274,14 @@ public function __construct(?array $data = null) } /** - * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName - * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the - * $this->openAPINullablesSetToNull array - * - * @param string $variableName - * @param array $fields - * @param mixed $defaultValue - */ + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ private function setIfExists(string $variableName, array $fields, $defaultValue): void { if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { diff --git a/lib/User/FiltersInner.php b/lib/User/FiltersInner.php index bb007bd2..b401fd0c 100644 --- a/lib/User/FiltersInner.php +++ b/lib/User/FiltersInner.php @@ -44,17 +44,17 @@ class FiltersInner implements ModelInterface, ArrayAccess, \JsonSerializable public const DISCRIMINATOR = null; /** - * The original name of the model. - * - * @var string - */ + * The original name of the model. + * + * @var string + */ protected static $openAPIModelName = 'filters_inner'; /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ protected static $openAPITypes = [ 'column_key' => 'string', 'filter_predicate' => 'string', @@ -63,12 +63,12 @@ class FiltersInner implements ModelInterface, ArrayAccess, \JsonSerializable ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - * @phpstan-var array - * @psalm-var array - */ + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ protected static $openAPIFormats = [ 'column_key' => null, 'filter_predicate' => null, @@ -77,10 +77,10 @@ class FiltersInner implements ModelInterface, ArrayAccess, \JsonSerializable ]; /** - * Array of nullable properties. Used for (de)serialization - * - * @var boolean[] - */ + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ protected static array $openAPINullables = [ 'column_key' => false, 'filter_predicate' => false, @@ -89,10 +89,10 @@ class FiltersInner implements ModelInterface, ArrayAccess, \JsonSerializable ]; /** - * If a nullable field gets set to null, insert it here - * - * @var boolean[] - */ + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ protected array $openAPINullablesSetToNull = []; /** @@ -294,14 +294,14 @@ public function __construct(?array $data = null) } /** - * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName - * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the - * $this->openAPINullablesSetToNull array - * - * @param string $variableName - * @param array $fields - * @param mixed $defaultValue - */ + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ private function setIfExists(string $variableName, array $fields, $defaultValue): void { if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { diff --git a/lib/User/FormsApi.php b/lib/User/FormsApi.php index 6714a591..71f80a2b 100644 --- a/lib/User/FormsApi.php +++ b/lib/User/FormsApi.php @@ -28,11 +28,11 @@ use GuzzleHttp\Client; use GuzzleHttp\ClientInterface; -use GuzzleHttp\Exception\ConnectException; use GuzzleHttp\Exception\RequestException; use GuzzleHttp\Psr7\MultipartStream; use GuzzleHttp\Psr7\Request; use GuzzleHttp\RequestOptions; +use Psr\Http\Client\NetworkExceptionInterface; use Psr\Http\Message\RequestInterface; use Psr\Http\Message\ResponseInterface; use SeaTable\Client\ApiException; @@ -185,13 +185,14 @@ public function createFormWithHttpInfo($workspace_id = null, $name = null, $form try { $response = $this->client->send($request, $options); } catch (RequestException $e) { + $eResponse = $this->getExceptionResponse($e); throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), - $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? (string) $e->getResponse()->getBody() : null + $eResponse ? $eResponse->getHeaders() : null, + $eResponse ? (string) $eResponse->getBody() : null ); - } catch (ConnectException $e) { + } catch (NetworkExceptionInterface $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), @@ -310,7 +311,15 @@ function ($response) use ($returnType) { ]; }, function ($exception) { - $response = $exception->getResponse(); + $response = $this->getExceptionResponse($exception); + if ($response === null) { + throw new ApiException( + "[{$exception->getCode()}] {$exception->getMessage()}", + (int) $exception->getCode(), + null, + null + ); + } $statusCode = $response->getStatusCode(); throw new ApiException( sprintf( @@ -391,7 +400,11 @@ public function createFormRequest($workspace_id = null, $name = null, $form_conf } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + try { + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + } catch (\JsonException $e) { + throw new \InvalidArgumentException('json_encode error: ' . $e->getMessage(), 0, $e); + } } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -463,13 +476,14 @@ public function deleteFormWithHttpInfo($form_token, string $contentType = self:: try { $response = $this->client->send($request, $options); } catch (RequestException $e) { + $eResponse = $this->getExceptionResponse($e); throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), - $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? (string) $e->getResponse()->getBody() : null + $eResponse ? $eResponse->getHeaders() : null, + $eResponse ? (string) $eResponse->getBody() : null ); - } catch (ConnectException $e) { + } catch (NetworkExceptionInterface $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), @@ -584,7 +598,15 @@ function ($response) use ($returnType) { ]; }, function ($exception) { - $response = $exception->getResponse(); + $response = $this->getExceptionResponse($exception); + if ($response === null) { + throw new ApiException( + "[{$exception->getCode()}] {$exception->getMessage()}", + (int) $exception->getCode(), + null, + null + ); + } $statusCode = $response->getStatusCode(); throw new ApiException( sprintf( @@ -635,7 +657,7 @@ public function deleteFormRequest($form_token, string $contentType = self::conte // path params if ($form_token !== null) { $resourcePath = str_replace( - '{' . 'form_token' . '}', + '{form_token}', ObjectSerializer::toPathValue($form_token), $resourcePath ); @@ -666,7 +688,11 @@ public function deleteFormRequest($form_token, string $contentType = self::conte } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + try { + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + } catch (\JsonException $e) { + throw new \InvalidArgumentException('json_encode error: ' . $e->getMessage(), 0, $e); + } } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -738,13 +764,14 @@ public function duplicateFormWithHttpInfo($form_token, string $contentType = sel try { $response = $this->client->send($request, $options); } catch (RequestException $e) { + $eResponse = $this->getExceptionResponse($e); throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), - $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? (string) $e->getResponse()->getBody() : null + $eResponse ? $eResponse->getHeaders() : null, + $eResponse ? (string) $eResponse->getBody() : null ); - } catch (ConnectException $e) { + } catch (NetworkExceptionInterface $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), @@ -859,7 +886,15 @@ function ($response) use ($returnType) { ]; }, function ($exception) { - $response = $exception->getResponse(); + $response = $this->getExceptionResponse($exception); + if ($response === null) { + throw new ApiException( + "[{$exception->getCode()}] {$exception->getMessage()}", + (int) $exception->getCode(), + null, + null + ); + } $statusCode = $response->getStatusCode(); throw new ApiException( sprintf( @@ -910,7 +945,7 @@ public function duplicateFormRequest($form_token, string $contentType = self::co // path params if ($form_token !== null) { $resourcePath = str_replace( - '{' . 'form_token' . '}', + '{form_token}', ObjectSerializer::toPathValue($form_token), $resourcePath ); @@ -941,7 +976,11 @@ public function duplicateFormRequest($form_token, string $contentType = self::co } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + try { + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + } catch (\JsonException $e) { + throw new \InvalidArgumentException('json_encode error: ' . $e->getMessage(), 0, $e); + } } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -1015,13 +1054,14 @@ public function listFormsWithHttpInfo($workspace_id_query, $base_name, string $c try { $response = $this->client->send($request, $options); } catch (RequestException $e) { + $eResponse = $this->getExceptionResponse($e); throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), - $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? (string) $e->getResponse()->getBody() : null + $eResponse ? $eResponse->getHeaders() : null, + $eResponse ? (string) $eResponse->getBody() : null ); - } catch (ConnectException $e) { + } catch (NetworkExceptionInterface $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), @@ -1138,7 +1178,15 @@ function ($response) use ($returnType) { ]; }, function ($exception) { - $response = $exception->getResponse(); + $response = $this->getExceptionResponse($exception); + if ($response === null) { + throw new ApiException( + "[{$exception->getCode()}] {$exception->getMessage()}", + (int) $exception->getCode(), + null, + null + ); + } $statusCode = $response->getStatusCode(); throw new ApiException( sprintf( @@ -1238,7 +1286,11 @@ public function listFormsRequest($workspace_id_query, $base_name, string $conten } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + try { + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + } catch (\JsonException $e) { + throw new \InvalidArgumentException('json_encode error: ' . $e->getMessage(), 0, $e); + } } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -1308,13 +1360,14 @@ public function listSharedFormsWithHttpInfo(string $contentType = self::contentT try { $response = $this->client->send($request, $options); } catch (RequestException $e) { + $eResponse = $this->getExceptionResponse($e); throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), - $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? (string) $e->getResponse()->getBody() : null + $eResponse ? $eResponse->getHeaders() : null, + $eResponse ? (string) $eResponse->getBody() : null ); - } catch (ConnectException $e) { + } catch (NetworkExceptionInterface $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), @@ -1427,7 +1480,15 @@ function ($response) use ($returnType) { ]; }, function ($exception) { - $response = $exception->getResponse(); + $response = $this->getExceptionResponse($exception); + if ($response === null) { + throw new ApiException( + "[{$exception->getCode()}] {$exception->getMessage()}", + (int) $exception->getCode(), + null, + null + ); + } $statusCode = $response->getStatusCode(); throw new ApiException( sprintf( @@ -1490,7 +1551,11 @@ public function listSharedFormsRequest(string $contentType = self::contentTypes[ } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + try { + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + } catch (\JsonException $e) { + throw new \InvalidArgumentException('json_encode error: ' . $e->getMessage(), 0, $e); + } } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -1564,13 +1629,14 @@ public function updateFormWithHttpInfo($form_token, $form_config = null, string try { $response = $this->client->send($request, $options); } catch (RequestException $e) { + $eResponse = $this->getExceptionResponse($e); throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), - $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? (string) $e->getResponse()->getBody() : null + $eResponse ? $eResponse->getHeaders() : null, + $eResponse ? (string) $eResponse->getBody() : null ); - } catch (ConnectException $e) { + } catch (NetworkExceptionInterface $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), @@ -1687,7 +1753,15 @@ function ($response) use ($returnType) { ]; }, function ($exception) { - $response = $exception->getResponse(); + $response = $this->getExceptionResponse($exception); + if ($response === null) { + throw new ApiException( + "[{$exception->getCode()}] {$exception->getMessage()}", + (int) $exception->getCode(), + null, + null + ); + } $statusCode = $response->getStatusCode(); throw new ApiException( sprintf( @@ -1740,7 +1814,7 @@ public function updateFormRequest($form_token, $form_config = null, string $cont // path params if ($form_token !== null) { $resourcePath = str_replace( - '{' . 'form_token' . '}', + '{form_token}', ObjectSerializer::toPathValue($form_token), $resourcePath ); @@ -1781,7 +1855,11 @@ public function updateFormRequest($form_token, $form_config = null, string $cont } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + try { + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + } catch (\JsonException $e) { + throw new \InvalidArgumentException('json_encode error: ' . $e->getMessage(), 0, $e); + } } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -1855,13 +1933,14 @@ public function uploadFormLogoWithHttpInfo($form_token, $form_logo = null, strin try { $response = $this->client->send($request, $options); } catch (RequestException $e) { + $eResponse = $this->getExceptionResponse($e); throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), - $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? (string) $e->getResponse()->getBody() : null + $eResponse ? $eResponse->getHeaders() : null, + $eResponse ? (string) $eResponse->getBody() : null ); - } catch (ConnectException $e) { + } catch (NetworkExceptionInterface $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), @@ -1978,7 +2057,15 @@ function ($response) use ($returnType) { ]; }, function ($exception) { - $response = $exception->getResponse(); + $response = $this->getExceptionResponse($exception); + if ($response === null) { + throw new ApiException( + "[{$exception->getCode()}] {$exception->getMessage()}", + (int) $exception->getCode(), + null, + null + ); + } $statusCode = $response->getStatusCode(); throw new ApiException( sprintf( @@ -2031,7 +2118,7 @@ public function uploadFormLogoRequest($form_token, $form_logo = null, string $co // path params if ($form_token !== null) { $resourcePath = str_replace( - '{' . 'form_token' . '}', + '{form_token}', ObjectSerializer::toPathValue($form_token), $resourcePath ); @@ -2072,7 +2159,11 @@ public function uploadFormLogoRequest($form_token, $form_logo = null, string $co } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + try { + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + } catch (\JsonException $e) { + throw new \InvalidArgumentException('json_encode error: ' . $e->getMessage(), 0, $e); + } } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -2132,6 +2223,21 @@ protected function createHttpClientOption() return $options; } + /** + * Returns the response attached to a Guzzle exception, if there is one. + * + * Guzzle 7 exposes getResponse() on RequestException, while Guzzle 8 only + * exposes it on ResponseException and its subclasses. + * + * @param \Throwable $exception + * + * @return ResponseInterface|null + */ + private function getExceptionResponse(\Throwable $exception): ?ResponseInterface + { + return method_exists($exception, 'getResponse') ? $exception->getResponse() : null; + } + private function handleResponseWithDataType( string $dataType, RequestInterface $request, diff --git a/lib/User/GetAccountInfo200Response.php b/lib/User/GetAccountInfo200Response.php index 937b1d5b..50d941ec 100644 --- a/lib/User/GetAccountInfo200Response.php +++ b/lib/User/GetAccountInfo200Response.php @@ -44,17 +44,17 @@ class GetAccountInfo200Response implements ModelInterface, ArrayAccess, \JsonSer public const DISCRIMINATOR = null; /** - * The original name of the model. - * - * @var string - */ + * The original name of the model. + * + * @var string + */ protected static $openAPIModelName = 'getAccountInfo_200_response'; /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ protected static $openAPITypes = [ 'org_id' => 'int', 'is_org_staff' => 'int', @@ -78,12 +78,12 @@ class GetAccountInfo200Response implements ModelInterface, ArrayAccess, \JsonSer ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - * @phpstan-var array - * @psalm-var array - */ + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ protected static $openAPIFormats = [ 'org_id' => null, 'is_org_staff' => null, @@ -107,10 +107,10 @@ class GetAccountInfo200Response implements ModelInterface, ArrayAccess, \JsonSer ]; /** - * Array of nullable properties. Used for (de)serialization - * - * @var boolean[] - */ + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ protected static array $openAPINullables = [ 'org_id' => false, 'is_org_staff' => false, @@ -134,10 +134,10 @@ class GetAccountInfo200Response implements ModelInterface, ArrayAccess, \JsonSer ]; /** - * If a nullable field gets set to null, insert it here - * - * @var boolean[] - */ + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ protected array $openAPINullablesSetToNull = []; /** @@ -373,14 +373,14 @@ public function __construct(?array $data = null) } /** - * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName - * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the - * $this->openAPINullablesSetToNull array - * - * @param string $variableName - * @param array $fields - * @param mixed $defaultValue - */ + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ private function setIfExists(string $variableName, array $fields, $defaultValue): void { if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { diff --git a/lib/User/GetBaseAssetSize200Response.php b/lib/User/GetBaseAssetSize200Response.php index 2d112d39..fe79ccda 100644 --- a/lib/User/GetBaseAssetSize200Response.php +++ b/lib/User/GetBaseAssetSize200Response.php @@ -44,17 +44,17 @@ class GetBaseAssetSize200Response implements ModelInterface, ArrayAccess, \JsonS public const DISCRIMINATOR = null; /** - * The original name of the model. - * - * @var string - */ + * The original name of the model. + * + * @var string + */ protected static $openAPIModelName = 'getBaseAssetSize_200_response'; /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ protected static $openAPITypes = [ 'asset_size' => 'int', 'max_size_of_export' => 'int', @@ -63,12 +63,12 @@ class GetBaseAssetSize200Response implements ModelInterface, ArrayAccess, \JsonS ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - * @phpstan-var array - * @psalm-var array - */ + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ protected static $openAPIFormats = [ 'asset_size' => null, 'max_size_of_export' => null, @@ -77,10 +77,10 @@ class GetBaseAssetSize200Response implements ModelInterface, ArrayAccess, \JsonS ]; /** - * Array of nullable properties. Used for (de)serialization - * - * @var boolean[] - */ + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ protected static array $openAPINullables = [ 'asset_size' => false, 'max_size_of_export' => false, @@ -89,10 +89,10 @@ class GetBaseAssetSize200Response implements ModelInterface, ArrayAccess, \JsonS ]; /** - * If a nullable field gets set to null, insert it here - * - * @var boolean[] - */ + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ protected array $openAPINullablesSetToNull = []; /** @@ -268,14 +268,14 @@ public function __construct(?array $data = null) } /** - * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName - * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the - * $this->openAPINullablesSetToNull array - * - * @param string $variableName - * @param array $fields - * @param mixed $defaultValue - */ + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ private function setIfExists(string $variableName, array $fields, $defaultValue): void { if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { diff --git a/lib/User/GetBaseAttachmentUploadLink200Response.php b/lib/User/GetBaseAttachmentUploadLink200Response.php index 481779f3..f2bb37c2 100644 --- a/lib/User/GetBaseAttachmentUploadLink200Response.php +++ b/lib/User/GetBaseAttachmentUploadLink200Response.php @@ -44,17 +44,17 @@ class GetBaseAttachmentUploadLink200Response implements ModelInterface, ArrayAcc public const DISCRIMINATOR = null; /** - * The original name of the model. - * - * @var string - */ + * The original name of the model. + * + * @var string + */ protected static $openAPIModelName = 'getBaseAttachmentUploadLink_200_response'; /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ protected static $openAPITypes = [ 'upload_link' => 'string', 'parent_path' => 'string', @@ -63,12 +63,12 @@ class GetBaseAttachmentUploadLink200Response implements ModelInterface, ArrayAcc ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - * @phpstan-var array - * @psalm-var array - */ + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ protected static $openAPIFormats = [ 'upload_link' => null, 'parent_path' => null, @@ -77,10 +77,10 @@ class GetBaseAttachmentUploadLink200Response implements ModelInterface, ArrayAcc ]; /** - * Array of nullable properties. Used for (de)serialization - * - * @var boolean[] - */ + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ protected static array $openAPINullables = [ 'upload_link' => false, 'parent_path' => false, @@ -89,10 +89,10 @@ class GetBaseAttachmentUploadLink200Response implements ModelInterface, ArrayAcc ]; /** - * If a nullable field gets set to null, insert it here - * - * @var boolean[] - */ + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ protected array $openAPINullablesSetToNull = []; /** @@ -268,14 +268,14 @@ public function __construct(?array $data = null) } /** - * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName - * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the - * $this->openAPINullablesSetToNull array - * - * @param string $variableName - * @param array $fields - * @param mixed $defaultValue - */ + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ private function setIfExists(string $variableName, array $fields, $defaultValue): void { if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { diff --git a/lib/User/GetBigDataOperationLogs200Response.php b/lib/User/GetBigDataOperationLogs200Response.php index 0ef7271f..bf2016f7 100644 --- a/lib/User/GetBigDataOperationLogs200Response.php +++ b/lib/User/GetBigDataOperationLogs200Response.php @@ -44,46 +44,46 @@ class GetBigDataOperationLogs200Response implements ModelInterface, ArrayAccess, public const DISCRIMINATOR = null; /** - * The original name of the model. - * - * @var string - */ + * The original name of the model. + * + * @var string + */ protected static $openAPIModelName = 'getBigDataOperationLogs_200_response'; /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ protected static $openAPITypes = [ 'operations' => '\SeaTable\Client\User\GetBigDataOperationLogs200ResponseOperationsInner[]' ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - * @phpstan-var array - * @psalm-var array - */ + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ protected static $openAPIFormats = [ 'operations' => null ]; /** - * Array of nullable properties. Used for (de)serialization - * - * @var boolean[] - */ + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ protected static array $openAPINullables = [ 'operations' => false ]; /** - * If a nullable field gets set to null, insert it here - * - * @var boolean[] - */ + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ protected array $openAPINullablesSetToNull = []; /** @@ -247,14 +247,14 @@ public function __construct(?array $data = null) } /** - * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName - * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the - * $this->openAPINullablesSetToNull array - * - * @param string $variableName - * @param array $fields - * @param mixed $defaultValue - */ + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ private function setIfExists(string $variableName, array $fields, $defaultValue): void { if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { diff --git a/lib/User/GetBigDataOperationLogs200ResponseOperationsInner.php b/lib/User/GetBigDataOperationLogs200ResponseOperationsInner.php index dda212a6..842dcd8f 100644 --- a/lib/User/GetBigDataOperationLogs200ResponseOperationsInner.php +++ b/lib/User/GetBigDataOperationLogs200ResponseOperationsInner.php @@ -44,17 +44,17 @@ class GetBigDataOperationLogs200ResponseOperationsInner implements ModelInterfac public const DISCRIMINATOR = null; /** - * The original name of the model. - * - * @var string - */ + * The original name of the model. + * + * @var string + */ protected static $openAPIModelName = 'getBigDataOperationLogs_200_response_operations_inner'; /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ protected static $openAPITypes = [ 'dtable_uuid' => 'string', 'id' => 'int', @@ -64,12 +64,12 @@ class GetBigDataOperationLogs200ResponseOperationsInner implements ModelInterfac ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - * @phpstan-var array - * @psalm-var array - */ + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ protected static $openAPIFormats = [ 'dtable_uuid' => 'uuid', 'id' => null, @@ -79,10 +79,10 @@ class GetBigDataOperationLogs200ResponseOperationsInner implements ModelInterfac ]; /** - * Array of nullable properties. Used for (de)serialization - * - * @var boolean[] - */ + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ protected static array $openAPINullables = [ 'dtable_uuid' => false, 'id' => false, @@ -92,10 +92,10 @@ class GetBigDataOperationLogs200ResponseOperationsInner implements ModelInterfac ]; /** - * If a nullable field gets set to null, insert it here - * - * @var boolean[] - */ + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ protected array $openAPINullablesSetToNull = []; /** @@ -275,14 +275,14 @@ public function __construct(?array $data = null) } /** - * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName - * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the - * $this->openAPINullablesSetToNull array - * - * @param string $variableName - * @param array $fields - * @param mixed $defaultValue - */ + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ private function setIfExists(string $variableName, array $fields, $defaultValue): void { if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { diff --git a/lib/User/GetBigDataOperationLogs200ResponseOperationsInnerOperation.php b/lib/User/GetBigDataOperationLogs200ResponseOperationsInnerOperation.php index f24bad0a..2d5f7950 100644 --- a/lib/User/GetBigDataOperationLogs200ResponseOperationsInnerOperation.php +++ b/lib/User/GetBigDataOperationLogs200ResponseOperationsInnerOperation.php @@ -45,17 +45,17 @@ class GetBigDataOperationLogs200ResponseOperationsInnerOperation implements Mode public const DISCRIMINATOR = null; /** - * The original name of the model. - * - * @var string - */ + * The original name of the model. + * + * @var string + */ protected static $openAPIModelName = 'getBigDataOperationLogs_200_response_operations_inner_operation'; /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ protected static $openAPITypes = [ 'row_id' => 'string', 'table_id' => 'string', @@ -66,12 +66,12 @@ class GetBigDataOperationLogs200ResponseOperationsInnerOperation implements Mode ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - * @phpstan-var array - * @psalm-var array - */ + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ protected static $openAPIFormats = [ 'row_id' => null, 'table_id' => null, @@ -82,10 +82,10 @@ class GetBigDataOperationLogs200ResponseOperationsInnerOperation implements Mode ]; /** - * Array of nullable properties. Used for (de)serialization - * - * @var boolean[] - */ + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ protected static array $openAPINullables = [ 'row_id' => false, 'table_id' => false, @@ -96,10 +96,10 @@ class GetBigDataOperationLogs200ResponseOperationsInnerOperation implements Mode ]; /** - * If a nullable field gets set to null, insert it here - * - * @var boolean[] - */ + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ protected array $openAPINullablesSetToNull = []; /** @@ -283,14 +283,14 @@ public function __construct(?array $data = null) } /** - * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName - * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the - * $this->openAPINullablesSetToNull array - * - * @param string $variableName - * @param array $fields - * @param mixed $defaultValue - */ + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ private function setIfExists(string $variableName, array $fields, $defaultValue): void { if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { diff --git a/lib/User/GetCommonDataset200Response.php b/lib/User/GetCommonDataset200Response.php index 462a4815..02129790 100644 --- a/lib/User/GetCommonDataset200Response.php +++ b/lib/User/GetCommonDataset200Response.php @@ -44,17 +44,17 @@ class GetCommonDataset200Response implements ModelInterface, ArrayAccess, \JsonS public const DISCRIMINATOR = null; /** - * The original name of the model. - * - * @var string - */ + * The original name of the model. + * + * @var string + */ protected static $openAPIModelName = 'getCommonDataset_200_response'; /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ protected static $openAPITypes = [ 'rows' => 'object[]', 'columns' => 'object[]', @@ -62,12 +62,12 @@ class GetCommonDataset200Response implements ModelInterface, ArrayAccess, \JsonS ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - * @phpstan-var array - * @psalm-var array - */ + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ protected static $openAPIFormats = [ 'rows' => null, 'columns' => null, @@ -75,10 +75,10 @@ class GetCommonDataset200Response implements ModelInterface, ArrayAccess, \JsonS ]; /** - * Array of nullable properties. Used for (de)serialization - * - * @var boolean[] - */ + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ protected static array $openAPINullables = [ 'rows' => false, 'columns' => false, @@ -86,10 +86,10 @@ class GetCommonDataset200Response implements ModelInterface, ArrayAccess, \JsonS ]; /** - * If a nullable field gets set to null, insert it here - * - * @var boolean[] - */ + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ protected array $openAPINullablesSetToNull = []; /** @@ -261,14 +261,14 @@ public function __construct(?array $data = null) } /** - * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName - * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the - * $this->openAPINullablesSetToNull array - * - * @param string $variableName - * @param array $fields - * @param mixed $defaultValue - */ + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ private function setIfExists(string $variableName, array $fields, $defaultValue): void { if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { diff --git a/lib/User/GetDepartmentGroupMembersCount200Response.php b/lib/User/GetDepartmentGroupMembersCount200Response.php index e470bab9..b4e044a3 100644 --- a/lib/User/GetDepartmentGroupMembersCount200Response.php +++ b/lib/User/GetDepartmentGroupMembersCount200Response.php @@ -44,46 +44,46 @@ class GetDepartmentGroupMembersCount200Response implements ModelInterface, Array public const DISCRIMINATOR = null; /** - * The original name of the model. - * - * @var string - */ + * The original name of the model. + * + * @var string + */ protected static $openAPIModelName = 'getDepartmentGroupMembersCount_200_response'; /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ protected static $openAPITypes = [ 'count' => 'int' ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - * @phpstan-var array - * @psalm-var array - */ + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ protected static $openAPIFormats = [ 'count' => null ]; /** - * Array of nullable properties. Used for (de)serialization - * - * @var boolean[] - */ + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ protected static array $openAPINullables = [ 'count' => false ]; /** - * If a nullable field gets set to null, insert it here - * - * @var boolean[] - */ + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ protected array $openAPINullablesSetToNull = []; /** @@ -247,14 +247,14 @@ public function __construct(?array $data = null) } /** - * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName - * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the - * $this->openAPINullablesSetToNull array - * - * @param string $variableName - * @param array $fields - * @param mixed $defaultValue - */ + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ private function setIfExists(string $variableName, array $fields, $defaultValue): void { if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { diff --git a/lib/User/GetGroupMembers200ResponseInner.php b/lib/User/GetGroupMembers200ResponseInner.php index e2a08113..1b4807d8 100644 --- a/lib/User/GetGroupMembers200ResponseInner.php +++ b/lib/User/GetGroupMembers200ResponseInner.php @@ -44,17 +44,17 @@ class GetGroupMembers200ResponseInner implements ModelInterface, ArrayAccess, \J public const DISCRIMINATOR = null; /** - * The original name of the model. - * - * @var string - */ + * The original name of the model. + * + * @var string + */ protected static $openAPIModelName = 'getGroupMembers_200_response_inner'; /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ protected static $openAPITypes = [ 'name' => 'string', 'email' => 'string', @@ -65,12 +65,12 @@ class GetGroupMembers200ResponseInner implements ModelInterface, ArrayAccess, \J ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - * @phpstan-var array - * @psalm-var array - */ + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ protected static $openAPIFormats = [ 'name' => null, 'email' => null, @@ -81,10 +81,10 @@ class GetGroupMembers200ResponseInner implements ModelInterface, ArrayAccess, \J ]; /** - * Array of nullable properties. Used for (de)serialization - * - * @var boolean[] - */ + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ protected static array $openAPINullables = [ 'name' => false, 'email' => false, @@ -95,10 +95,10 @@ class GetGroupMembers200ResponseInner implements ModelInterface, ArrayAccess, \J ]; /** - * If a nullable field gets set to null, insert it here - * - * @var boolean[] - */ + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ protected array $openAPINullablesSetToNull = []; /** @@ -282,14 +282,14 @@ public function __construct(?array $data = null) } /** - * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName - * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the - * $this->openAPINullablesSetToNull array - * - * @param string $variableName - * @param array $fields - * @param mixed $defaultValue - */ + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ private function setIfExists(string $variableName, array $fields, $defaultValue): void { if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { diff --git a/lib/User/GetPublicUserInfo200Response.php b/lib/User/GetPublicUserInfo200Response.php index cbb0e004..d930f957 100644 --- a/lib/User/GetPublicUserInfo200Response.php +++ b/lib/User/GetPublicUserInfo200Response.php @@ -44,17 +44,17 @@ class GetPublicUserInfo200Response implements ModelInterface, ArrayAccess, \Json public const DISCRIMINATOR = null; /** - * The original name of the model. - * - * @var string - */ + * The original name of the model. + * + * @var string + */ protected static $openAPIModelName = 'getPublicUserInfo_200_response'; /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ protected static $openAPITypes = [ 'email' => 'string', 'name' => 'string', @@ -63,12 +63,12 @@ class GetPublicUserInfo200Response implements ModelInterface, ArrayAccess, \Json ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - * @phpstan-var array - * @psalm-var array - */ + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ protected static $openAPIFormats = [ 'email' => null, 'name' => null, @@ -77,10 +77,10 @@ class GetPublicUserInfo200Response implements ModelInterface, ArrayAccess, \Json ]; /** - * Array of nullable properties. Used for (de)serialization - * - * @var boolean[] - */ + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ protected static array $openAPINullables = [ 'email' => false, 'name' => false, @@ -89,10 +89,10 @@ class GetPublicUserInfo200Response implements ModelInterface, ArrayAccess, \Json ]; /** - * If a nullable field gets set to null, insert it here - * - * @var boolean[] - */ + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ protected array $openAPINullablesSetToNull = []; /** @@ -268,14 +268,14 @@ public function __construct(?array $data = null) } /** - * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName - * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the - * $this->openAPINullablesSetToNull array - * - * @param string $variableName - * @param array $fields - * @param mixed $defaultValue - */ + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ private function setIfExists(string $variableName, array $fields, $defaultValue): void { if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { diff --git a/lib/User/Greater.php b/lib/User/Greater.php index bafc66db..dea07c1f 100644 --- a/lib/User/Greater.php +++ b/lib/User/Greater.php @@ -44,17 +44,17 @@ class Greater implements ModelInterface, ArrayAccess, \JsonSerializable public const DISCRIMINATOR = null; /** - * The original name of the model. - * - * @var string - */ + * The original name of the model. + * + * @var string + */ protected static $openAPIModelName = 'greater'; /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ protected static $openAPITypes = [ 'column_key' => 'string', 'filter_predicate' => 'string', @@ -62,12 +62,12 @@ class Greater implements ModelInterface, ArrayAccess, \JsonSerializable ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - * @phpstan-var array - * @psalm-var array - */ + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ protected static $openAPIFormats = [ 'column_key' => null, 'filter_predicate' => null, @@ -75,10 +75,10 @@ class Greater implements ModelInterface, ArrayAccess, \JsonSerializable ]; /** - * Array of nullable properties. Used for (de)serialization - * - * @var boolean[] - */ + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ protected static array $openAPINullables = [ 'column_key' => false, 'filter_predicate' => false, @@ -86,10 +86,10 @@ class Greater implements ModelInterface, ArrayAccess, \JsonSerializable ]; /** - * If a nullable field gets set to null, insert it here - * - * @var boolean[] - */ + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ protected array $openAPINullablesSetToNull = []; /** @@ -274,14 +274,14 @@ public function __construct(?array $data = null) } /** - * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName - * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the - * $this->openAPINullablesSetToNull array - * - * @param string $variableName - * @param array $fields - * @param mixed $defaultValue - */ + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ private function setIfExists(string $variableName, array $fields, $defaultValue): void { if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { diff --git a/lib/User/GreaterOrEqual.php b/lib/User/GreaterOrEqual.php index 32a2b95f..c0afacb5 100644 --- a/lib/User/GreaterOrEqual.php +++ b/lib/User/GreaterOrEqual.php @@ -44,17 +44,17 @@ class GreaterOrEqual implements ModelInterface, ArrayAccess, \JsonSerializable public const DISCRIMINATOR = null; /** - * The original name of the model. - * - * @var string - */ + * The original name of the model. + * + * @var string + */ protected static $openAPIModelName = 'greater_or_equal'; /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ protected static $openAPITypes = [ 'column_key' => 'string', 'filter_predicate' => 'string', @@ -62,12 +62,12 @@ class GreaterOrEqual implements ModelInterface, ArrayAccess, \JsonSerializable ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - * @phpstan-var array - * @psalm-var array - */ + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ protected static $openAPIFormats = [ 'column_key' => null, 'filter_predicate' => null, @@ -75,10 +75,10 @@ class GreaterOrEqual implements ModelInterface, ArrayAccess, \JsonSerializable ]; /** - * Array of nullable properties. Used for (de)serialization - * - * @var boolean[] - */ + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ protected static array $openAPINullables = [ 'column_key' => false, 'filter_predicate' => false, @@ -86,10 +86,10 @@ class GreaterOrEqual implements ModelInterface, ArrayAccess, \JsonSerializable ]; /** - * If a nullable field gets set to null, insert it here - * - * @var boolean[] - */ + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ protected array $openAPINullablesSetToNull = []; /** @@ -274,14 +274,14 @@ public function __construct(?array $data = null) } /** - * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName - * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the - * $this->openAPINullablesSetToNull array - * - * @param string $variableName - * @param array $fields - * @param mixed $defaultValue - */ + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ private function setIfExists(string $variableName, array $fields, $defaultValue): void { if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { diff --git a/lib/User/GroupsWorkspacesApi.php b/lib/User/GroupsWorkspacesApi.php index 34c6f451..aaeaf8af 100644 --- a/lib/User/GroupsWorkspacesApi.php +++ b/lib/User/GroupsWorkspacesApi.php @@ -28,11 +28,11 @@ use GuzzleHttp\Client; use GuzzleHttp\ClientInterface; -use GuzzleHttp\Exception\ConnectException; use GuzzleHttp\Exception\RequestException; use GuzzleHttp\Psr7\MultipartStream; use GuzzleHttp\Psr7\Request; use GuzzleHttp\RequestOptions; +use Psr\Http\Client\NetworkExceptionInterface; use Psr\Http\Message\RequestInterface; use Psr\Http\Message\ResponseInterface; use SeaTable\Client\ApiException; @@ -204,13 +204,14 @@ public function addGroupMemberWithHttpInfo($group_id, $add_group_member_request try { $response = $this->client->send($request, $options); } catch (RequestException $e) { + $eResponse = $this->getExceptionResponse($e); throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), - $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? (string) $e->getResponse()->getBody() : null + $eResponse ? $eResponse->getHeaders() : null, + $eResponse ? (string) $eResponse->getBody() : null ); - } catch (ConnectException $e) { + } catch (NetworkExceptionInterface $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), @@ -327,7 +328,15 @@ function ($response) use ($returnType) { ]; }, function ($exception) { - $response = $exception->getResponse(); + $response = $this->getExceptionResponse($exception); + if ($response === null) { + throw new ApiException( + "[{$exception->getCode()}] {$exception->getMessage()}", + (int) $exception->getCode(), + null, + null + ); + } $statusCode = $response->getStatusCode(); throw new ApiException( sprintf( @@ -380,7 +389,7 @@ public function addGroupMemberRequest($group_id, $add_group_member_request = nul // path params if ($group_id !== null) { $resourcePath = str_replace( - '{' . 'group_id' . '}', + '{group_id}', ObjectSerializer::toPathValue($group_id), $resourcePath ); @@ -397,7 +406,11 @@ public function addGroupMemberRequest($group_id, $add_group_member_request = nul if (isset($add_group_member_request)) { if (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the body - $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($add_group_member_request)); + try { + $httpBody = json_encode(ObjectSerializer::sanitizeForSerialization($add_group_member_request), JSON_THROW_ON_ERROR); + } catch (\JsonException $e) { + throw new \InvalidArgumentException('json_encode error: ' . $e->getMessage(), 0, $e); + } } else { $httpBody = $add_group_member_request; } @@ -418,7 +431,11 @@ public function addGroupMemberRequest($group_id, $add_group_member_request = nul } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + try { + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + } catch (\JsonException $e) { + throw new \InvalidArgumentException('json_encode error: ' . $e->getMessage(), 0, $e); + } } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -492,13 +509,14 @@ public function copyBaseFromExternalLinkWithHttpInfo($link = null, $dst_workspac try { $response = $this->client->send($request, $options); } catch (RequestException $e) { + $eResponse = $this->getExceptionResponse($e); throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), - $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? (string) $e->getResponse()->getBody() : null + $eResponse ? $eResponse->getHeaders() : null, + $eResponse ? (string) $eResponse->getBody() : null ); - } catch (ConnectException $e) { + } catch (NetworkExceptionInterface $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), @@ -615,7 +633,15 @@ function ($response) use ($returnType) { ]; }, function ($exception) { - $response = $exception->getResponse(); + $response = $this->getExceptionResponse($exception); + if ($response === null) { + throw new ApiException( + "[{$exception->getCode()}] {$exception->getMessage()}", + (int) $exception->getCode(), + null, + null + ); + } $statusCode = $response->getStatusCode(); throw new ApiException( sprintf( @@ -693,7 +719,11 @@ public function copyBaseFromExternalLinkRequest($link = null, $dst_workspace_id } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + try { + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + } catch (\JsonException $e) { + throw new \InvalidArgumentException('json_encode error: ' . $e->getMessage(), 0, $e); + } } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -771,13 +801,14 @@ public function copyBaseFromWorkspaceWithHttpInfo($src_workspace_id, $name, $dst try { $response = $this->client->send($request, $options); } catch (RequestException $e) { + $eResponse = $this->getExceptionResponse($e); throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), - $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? (string) $e->getResponse()->getBody() : null + $eResponse ? $eResponse->getHeaders() : null, + $eResponse ? (string) $eResponse->getBody() : null ); - } catch (ConnectException $e) { + } catch (NetworkExceptionInterface $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), @@ -898,7 +929,15 @@ function ($response) use ($returnType) { ]; }, function ($exception) { - $response = $exception->getResponse(); + $response = $this->getExceptionResponse($exception); + if ($response === null) { + throw new ApiException( + "[{$exception->getCode()}] {$exception->getMessage()}", + (int) $exception->getCode(), + null, + null + ); + } $statusCode = $response->getStatusCode(); throw new ApiException( sprintf( @@ -1000,7 +1039,11 @@ public function copyBaseFromWorkspaceRequest($src_workspace_id, $name, $dst_work } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + try { + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + } catch (\JsonException $e) { + throw new \InvalidArgumentException('json_encode error: ' . $e->getMessage(), 0, $e); + } } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -1072,13 +1115,14 @@ public function createGroupWithHttpInfo($create_group_request = null, string $co try { $response = $this->client->send($request, $options); } catch (RequestException $e) { + $eResponse = $this->getExceptionResponse($e); throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), - $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? (string) $e->getResponse()->getBody() : null + $eResponse ? $eResponse->getHeaders() : null, + $eResponse ? (string) $eResponse->getBody() : null ); - } catch (ConnectException $e) { + } catch (NetworkExceptionInterface $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), @@ -1193,7 +1237,15 @@ function ($response) use ($returnType) { ]; }, function ($exception) { - $response = $exception->getResponse(); + $response = $this->getExceptionResponse($exception); + if ($response === null) { + throw new ApiException( + "[{$exception->getCode()}] {$exception->getMessage()}", + (int) $exception->getCode(), + null, + null + ); + } $statusCode = $response->getStatusCode(); throw new ApiException( sprintf( @@ -1244,7 +1296,11 @@ public function createGroupRequest($create_group_request = null, string $content if (isset($create_group_request)) { if (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the body - $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($create_group_request)); + try { + $httpBody = json_encode(ObjectSerializer::sanitizeForSerialization($create_group_request), JSON_THROW_ON_ERROR); + } catch (\JsonException $e) { + throw new \InvalidArgumentException('json_encode error: ' . $e->getMessage(), 0, $e); + } } else { $httpBody = $create_group_request; } @@ -1265,7 +1321,11 @@ public function createGroupRequest($create_group_request = null, string $content } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + try { + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + } catch (\JsonException $e) { + throw new \InvalidArgumentException('json_encode error: ' . $e->getMessage(), 0, $e); + } } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -1337,13 +1397,14 @@ public function deleteGroupWithHttpInfo($group_id, string $contentType = self::c try { $response = $this->client->send($request, $options); } catch (RequestException $e) { + $eResponse = $this->getExceptionResponse($e); throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), - $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? (string) $e->getResponse()->getBody() : null + $eResponse ? $eResponse->getHeaders() : null, + $eResponse ? (string) $eResponse->getBody() : null ); - } catch (ConnectException $e) { + } catch (NetworkExceptionInterface $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), @@ -1458,7 +1519,15 @@ function ($response) use ($returnType) { ]; }, function ($exception) { - $response = $exception->getResponse(); + $response = $this->getExceptionResponse($exception); + if ($response === null) { + throw new ApiException( + "[{$exception->getCode()}] {$exception->getMessage()}", + (int) $exception->getCode(), + null, + null + ); + } $statusCode = $response->getStatusCode(); throw new ApiException( sprintf( @@ -1509,7 +1578,7 @@ public function deleteGroupRequest($group_id, string $contentType = self::conten // path params if ($group_id !== null) { $resourcePath = str_replace( - '{' . 'group_id' . '}', + '{group_id}', ObjectSerializer::toPathValue($group_id), $resourcePath ); @@ -1540,7 +1609,11 @@ public function deleteGroupRequest($group_id, string $contentType = self::conten } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + try { + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + } catch (\JsonException $e) { + throw new \InvalidArgumentException('json_encode error: ' . $e->getMessage(), 0, $e); + } } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -1612,13 +1685,14 @@ public function getGroupWithHttpInfo($group_id, string $contentType = self::cont try { $response = $this->client->send($request, $options); } catch (RequestException $e) { + $eResponse = $this->getExceptionResponse($e); throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), - $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? (string) $e->getResponse()->getBody() : null + $eResponse ? $eResponse->getHeaders() : null, + $eResponse ? (string) $eResponse->getBody() : null ); - } catch (ConnectException $e) { + } catch (NetworkExceptionInterface $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), @@ -1733,7 +1807,15 @@ function ($response) use ($returnType) { ]; }, function ($exception) { - $response = $exception->getResponse(); + $response = $this->getExceptionResponse($exception); + if ($response === null) { + throw new ApiException( + "[{$exception->getCode()}] {$exception->getMessage()}", + (int) $exception->getCode(), + null, + null + ); + } $statusCode = $response->getStatusCode(); throw new ApiException( sprintf( @@ -1784,7 +1866,7 @@ public function getGroupRequest($group_id, string $contentType = self::contentTy // path params if ($group_id !== null) { $resourcePath = str_replace( - '{' . 'group_id' . '}', + '{group_id}', ObjectSerializer::toPathValue($group_id), $resourcePath ); @@ -1815,7 +1897,11 @@ public function getGroupRequest($group_id, string $contentType = self::contentTy } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + try { + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + } catch (\JsonException $e) { + throw new \InvalidArgumentException('json_encode error: ' . $e->getMessage(), 0, $e); + } } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -1887,13 +1973,14 @@ public function getGroupMembersWithHttpInfo($group_id, string $contentType = sel try { $response = $this->client->send($request, $options); } catch (RequestException $e) { + $eResponse = $this->getExceptionResponse($e); throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), - $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? (string) $e->getResponse()->getBody() : null + $eResponse ? $eResponse->getHeaders() : null, + $eResponse ? (string) $eResponse->getBody() : null ); - } catch (ConnectException $e) { + } catch (NetworkExceptionInterface $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), @@ -2008,7 +2095,15 @@ function ($response) use ($returnType) { ]; }, function ($exception) { - $response = $exception->getResponse(); + $response = $this->getExceptionResponse($exception); + if ($response === null) { + throw new ApiException( + "[{$exception->getCode()}] {$exception->getMessage()}", + (int) $exception->getCode(), + null, + null + ); + } $statusCode = $response->getStatusCode(); throw new ApiException( sprintf( @@ -2059,7 +2154,7 @@ public function getGroupMembersRequest($group_id, string $contentType = self::co // path params if ($group_id !== null) { $resourcePath = str_replace( - '{' . 'group_id' . '}', + '{group_id}', ObjectSerializer::toPathValue($group_id), $resourcePath ); @@ -2090,7 +2185,11 @@ public function getGroupMembersRequest($group_id, string $contentType = self::co } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + try { + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + } catch (\JsonException $e) { + throw new \InvalidArgumentException('json_encode error: ' . $e->getMessage(), 0, $e); + } } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -2160,13 +2259,14 @@ public function listGroupsWithHttpInfo(string $contentType = self::contentTypes[ try { $response = $this->client->send($request, $options); } catch (RequestException $e) { + $eResponse = $this->getExceptionResponse($e); throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), - $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? (string) $e->getResponse()->getBody() : null + $eResponse ? $eResponse->getHeaders() : null, + $eResponse ? (string) $eResponse->getBody() : null ); - } catch (ConnectException $e) { + } catch (NetworkExceptionInterface $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), @@ -2279,7 +2379,15 @@ function ($response) use ($returnType) { ]; }, function ($exception) { - $response = $exception->getResponse(); + $response = $this->getExceptionResponse($exception); + if ($response === null) { + throw new ApiException( + "[{$exception->getCode()}] {$exception->getMessage()}", + (int) $exception->getCode(), + null, + null + ); + } $statusCode = $response->getStatusCode(); throw new ApiException( sprintf( @@ -2342,7 +2450,11 @@ public function listGroupsRequest(string $contentType = self::contentTypes['list } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + try { + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + } catch (\JsonException $e) { + throw new \InvalidArgumentException('json_encode error: ' . $e->getMessage(), 0, $e); + } } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -2414,13 +2526,14 @@ public function listWorkspacesWithHttpInfo($detail = null, string $contentType = try { $response = $this->client->send($request, $options); } catch (RequestException $e) { + $eResponse = $this->getExceptionResponse($e); throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), - $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? (string) $e->getResponse()->getBody() : null + $eResponse ? $eResponse->getHeaders() : null, + $eResponse ? (string) $eResponse->getBody() : null ); - } catch (ConnectException $e) { + } catch (NetworkExceptionInterface $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), @@ -2535,7 +2648,15 @@ function ($response) use ($returnType) { ]; }, function ($exception) { - $response = $exception->getResponse(); + $response = $this->getExceptionResponse($exception); + if ($response === null) { + throw new ApiException( + "[{$exception->getCode()}] {$exception->getMessage()}", + (int) $exception->getCode(), + null, + null + ); + } $statusCode = $response->getStatusCode(); throw new ApiException( sprintf( @@ -2609,7 +2730,11 @@ public function listWorkspacesRequest($detail = null, string $contentType = self } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + try { + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + } catch (\JsonException $e) { + throw new \InvalidArgumentException('json_encode error: ' . $e->getMessage(), 0, $e); + } } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -2683,13 +2808,14 @@ public function removeGroupMemberWithHttpInfo($group_id, $group_member, string $ try { $response = $this->client->send($request, $options); } catch (RequestException $e) { + $eResponse = $this->getExceptionResponse($e); throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), - $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? (string) $e->getResponse()->getBody() : null + $eResponse ? $eResponse->getHeaders() : null, + $eResponse ? (string) $eResponse->getBody() : null ); - } catch (ConnectException $e) { + } catch (NetworkExceptionInterface $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), @@ -2806,7 +2932,15 @@ function ($response) use ($returnType) { ]; }, function ($exception) { - $response = $exception->getResponse(); + $response = $this->getExceptionResponse($exception); + if ($response === null) { + throw new ApiException( + "[{$exception->getCode()}] {$exception->getMessage()}", + (int) $exception->getCode(), + null, + null + ); + } $statusCode = $response->getStatusCode(); throw new ApiException( sprintf( @@ -2868,7 +3002,7 @@ public function removeGroupMemberRequest($group_id, $group_member, string $conte // path params if ($group_id !== null) { $resourcePath = str_replace( - '{' . 'group_id' . '}', + '{group_id}', ObjectSerializer::toPathValue($group_id), $resourcePath ); @@ -2876,7 +3010,7 @@ public function removeGroupMemberRequest($group_id, $group_member, string $conte // path params if ($group_member !== null) { $resourcePath = str_replace( - '{' . 'group_member' . '}', + '{group_member}', ObjectSerializer::toPathValue($group_member), $resourcePath ); @@ -2907,7 +3041,11 @@ public function removeGroupMemberRequest($group_id, $group_member, string $conte } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + try { + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + } catch (\JsonException $e) { + throw new \InvalidArgumentException('json_encode error: ' . $e->getMessage(), 0, $e); + } } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -2979,13 +3117,14 @@ public function searchGroupWithHttpInfo($q = null, string $contentType = self::c try { $response = $this->client->send($request, $options); } catch (RequestException $e) { + $eResponse = $this->getExceptionResponse($e); throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), - $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? (string) $e->getResponse()->getBody() : null + $eResponse ? $eResponse->getHeaders() : null, + $eResponse ? (string) $eResponse->getBody() : null ); - } catch (ConnectException $e) { + } catch (NetworkExceptionInterface $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), @@ -3100,7 +3239,15 @@ function ($response) use ($returnType) { ]; }, function ($exception) { - $response = $exception->getResponse(); + $response = $this->getExceptionResponse($exception); + if ($response === null) { + throw new ApiException( + "[{$exception->getCode()}] {$exception->getMessage()}", + (int) $exception->getCode(), + null, + null + ); + } $statusCode = $response->getStatusCode(); throw new ApiException( sprintf( @@ -3174,7 +3321,11 @@ public function searchGroupRequest($q = null, string $contentType = self::conten } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + try { + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + } catch (\JsonException $e) { + throw new \InvalidArgumentException('json_encode error: ' . $e->getMessage(), 0, $e); + } } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -3248,13 +3399,14 @@ public function searchGroupMembersWithHttpInfo($group_id, $q = null, string $con try { $response = $this->client->send($request, $options); } catch (RequestException $e) { + $eResponse = $this->getExceptionResponse($e); throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), - $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? (string) $e->getResponse()->getBody() : null + $eResponse ? $eResponse->getHeaders() : null, + $eResponse ? (string) $eResponse->getBody() : null ); - } catch (ConnectException $e) { + } catch (NetworkExceptionInterface $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), @@ -3371,7 +3523,15 @@ function ($response) use ($returnType) { ]; }, function ($exception) { - $response = $exception->getResponse(); + $response = $this->getExceptionResponse($exception); + if ($response === null) { + throw new ApiException( + "[{$exception->getCode()}] {$exception->getMessage()}", + (int) $exception->getCode(), + null, + null + ); + } $statusCode = $response->getStatusCode(); throw new ApiException( sprintf( @@ -3433,7 +3593,7 @@ public function searchGroupMembersRequest($group_id, $q = null, string $contentT // path params if ($group_id !== null) { $resourcePath = str_replace( - '{' . 'group_id' . '}', + '{group_id}', ObjectSerializer::toPathValue($group_id), $resourcePath ); @@ -3464,7 +3624,11 @@ public function searchGroupMembersRequest($group_id, $q = null, string $contentT } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + try { + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + } catch (\JsonException $e) { + throw new \InvalidArgumentException('json_encode error: ' . $e->getMessage(), 0, $e); + } } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -3538,13 +3702,14 @@ public function updateGroupWithHttpInfo($group_id, $update_group_request = null, try { $response = $this->client->send($request, $options); } catch (RequestException $e) { + $eResponse = $this->getExceptionResponse($e); throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), - $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? (string) $e->getResponse()->getBody() : null + $eResponse ? $eResponse->getHeaders() : null, + $eResponse ? (string) $eResponse->getBody() : null ); - } catch (ConnectException $e) { + } catch (NetworkExceptionInterface $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), @@ -3661,7 +3826,15 @@ function ($response) use ($returnType) { ]; }, function ($exception) { - $response = $exception->getResponse(); + $response = $this->getExceptionResponse($exception); + if ($response === null) { + throw new ApiException( + "[{$exception->getCode()}] {$exception->getMessage()}", + (int) $exception->getCode(), + null, + null + ); + } $statusCode = $response->getStatusCode(); throw new ApiException( sprintf( @@ -3714,7 +3887,7 @@ public function updateGroupRequest($group_id, $update_group_request = null, stri // path params if ($group_id !== null) { $resourcePath = str_replace( - '{' . 'group_id' . '}', + '{group_id}', ObjectSerializer::toPathValue($group_id), $resourcePath ); @@ -3731,7 +3904,11 @@ public function updateGroupRequest($group_id, $update_group_request = null, stri if (isset($update_group_request)) { if (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the body - $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($update_group_request)); + try { + $httpBody = json_encode(ObjectSerializer::sanitizeForSerialization($update_group_request), JSON_THROW_ON_ERROR); + } catch (\JsonException $e) { + throw new \InvalidArgumentException('json_encode error: ' . $e->getMessage(), 0, $e); + } } else { $httpBody = $update_group_request; } @@ -3752,7 +3929,11 @@ public function updateGroupRequest($group_id, $update_group_request = null, stri } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + try { + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + } catch (\JsonException $e) { + throw new \InvalidArgumentException('json_encode error: ' . $e->getMessage(), 0, $e); + } } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -3828,13 +4009,14 @@ public function updateGroupRoleWithHttpInfo($group_id, $group_member, $update_gr try { $response = $this->client->send($request, $options); } catch (RequestException $e) { + $eResponse = $this->getExceptionResponse($e); throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), - $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? (string) $e->getResponse()->getBody() : null + $eResponse ? $eResponse->getHeaders() : null, + $eResponse ? (string) $eResponse->getBody() : null ); - } catch (ConnectException $e) { + } catch (NetworkExceptionInterface $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), @@ -3953,7 +4135,15 @@ function ($response) use ($returnType) { ]; }, function ($exception) { - $response = $exception->getResponse(); + $response = $this->getExceptionResponse($exception); + if ($response === null) { + throw new ApiException( + "[{$exception->getCode()}] {$exception->getMessage()}", + (int) $exception->getCode(), + null, + null + ); + } $statusCode = $response->getStatusCode(); throw new ApiException( sprintf( @@ -4017,7 +4207,7 @@ public function updateGroupRoleRequest($group_id, $group_member, $update_group_r // path params if ($group_id !== null) { $resourcePath = str_replace( - '{' . 'group_id' . '}', + '{group_id}', ObjectSerializer::toPathValue($group_id), $resourcePath ); @@ -4025,7 +4215,7 @@ public function updateGroupRoleRequest($group_id, $group_member, $update_group_r // path params if ($group_member !== null) { $resourcePath = str_replace( - '{' . 'group_member' . '}', + '{group_member}', ObjectSerializer::toPathValue($group_member), $resourcePath ); @@ -4042,7 +4232,11 @@ public function updateGroupRoleRequest($group_id, $group_member, $update_group_r if (isset($update_group_role_request)) { if (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the body - $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($update_group_role_request)); + try { + $httpBody = json_encode(ObjectSerializer::sanitizeForSerialization($update_group_role_request), JSON_THROW_ON_ERROR); + } catch (\JsonException $e) { + throw new \InvalidArgumentException('json_encode error: ' . $e->getMessage(), 0, $e); + } } else { $httpBody = $update_group_role_request; } @@ -4063,7 +4257,11 @@ public function updateGroupRoleRequest($group_id, $group_member, $update_group_r } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + try { + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + } catch (\JsonException $e) { + throw new \InvalidArgumentException('json_encode error: ' . $e->getMessage(), 0, $e); + } } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -4123,6 +4321,21 @@ protected function createHttpClientOption() return $options; } + /** + * Returns the response attached to a Guzzle exception, if there is one. + * + * Guzzle 7 exposes getResponse() on RequestException, while Guzzle 8 only + * exposes it on ResponseException and its subclasses. + * + * @param \Throwable $exception + * + * @return ResponseInterface|null + */ + private function getExceptionResponse(\Throwable $exception): ?ResponseInterface + { + return method_exists($exception, 'getResponse') ? $exception->getResponse() : null; + } + private function handleResponseWithDataType( string $dataType, RequestInterface $request, diff --git a/lib/User/HasAllOf.php b/lib/User/HasAllOf.php index 5cc26be5..ce717a0a 100644 --- a/lib/User/HasAllOf.php +++ b/lib/User/HasAllOf.php @@ -44,17 +44,17 @@ class HasAllOf implements ModelInterface, ArrayAccess, \JsonSerializable public const DISCRIMINATOR = null; /** - * The original name of the model. - * - * @var string - */ + * The original name of the model. + * + * @var string + */ protected static $openAPIModelName = 'has_all_of'; /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ protected static $openAPITypes = [ 'column_key' => 'string', 'filter_predicate' => 'string', @@ -62,12 +62,12 @@ class HasAllOf implements ModelInterface, ArrayAccess, \JsonSerializable ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - * @phpstan-var array - * @psalm-var array - */ + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ protected static $openAPIFormats = [ 'column_key' => null, 'filter_predicate' => null, @@ -75,10 +75,10 @@ class HasAllOf implements ModelInterface, ArrayAccess, \JsonSerializable ]; /** - * Array of nullable properties. Used for (de)serialization - * - * @var boolean[] - */ + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ protected static array $openAPINullables = [ 'column_key' => false, 'filter_predicate' => false, @@ -86,10 +86,10 @@ class HasAllOf implements ModelInterface, ArrayAccess, \JsonSerializable ]; /** - * If a nullable field gets set to null, insert it here - * - * @var boolean[] - */ + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ protected array $openAPINullablesSetToNull = []; /** @@ -274,14 +274,14 @@ public function __construct(?array $data = null) } /** - * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName - * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the - * $this->openAPINullablesSetToNull array - * - * @param string $variableName - * @param array $fields - * @param mixed $defaultValue - */ + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ private function setIfExists(string $variableName, array $fields, $defaultValue): void { if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { diff --git a/lib/User/HasAnyOf.php b/lib/User/HasAnyOf.php index eb9f7e6c..2438e00a 100644 --- a/lib/User/HasAnyOf.php +++ b/lib/User/HasAnyOf.php @@ -44,17 +44,17 @@ class HasAnyOf implements ModelInterface, ArrayAccess, \JsonSerializable public const DISCRIMINATOR = null; /** - * The original name of the model. - * - * @var string - */ + * The original name of the model. + * + * @var string + */ protected static $openAPIModelName = 'has_any_of'; /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ protected static $openAPITypes = [ 'column_key' => 'string', 'filter_predicate' => 'string', @@ -62,12 +62,12 @@ class HasAnyOf implements ModelInterface, ArrayAccess, \JsonSerializable ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - * @phpstan-var array - * @psalm-var array - */ + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ protected static $openAPIFormats = [ 'column_key' => null, 'filter_predicate' => null, @@ -75,10 +75,10 @@ class HasAnyOf implements ModelInterface, ArrayAccess, \JsonSerializable ]; /** - * Array of nullable properties. Used for (de)serialization - * - * @var boolean[] - */ + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ protected static array $openAPINullables = [ 'column_key' => false, 'filter_predicate' => false, @@ -86,10 +86,10 @@ class HasAnyOf implements ModelInterface, ArrayAccess, \JsonSerializable ]; /** - * If a nullable field gets set to null, insert it here - * - * @var boolean[] - */ + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ protected array $openAPINullablesSetToNull = []; /** @@ -274,14 +274,14 @@ public function __construct(?array $data = null) } /** - * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName - * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the - * $this->openAPINullablesSetToNull array - * - * @param string $variableName - * @param array $fields - * @param mixed $defaultValue - */ + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ private function setIfExists(string $variableName, array $fields, $defaultValue): void { if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { diff --git a/lib/User/HasNoneOf.php b/lib/User/HasNoneOf.php index 388be440..ec461149 100644 --- a/lib/User/HasNoneOf.php +++ b/lib/User/HasNoneOf.php @@ -44,17 +44,17 @@ class HasNoneOf implements ModelInterface, ArrayAccess, \JsonSerializable public const DISCRIMINATOR = null; /** - * The original name of the model. - * - * @var string - */ + * The original name of the model. + * + * @var string + */ protected static $openAPIModelName = 'has_none_of'; /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ protected static $openAPITypes = [ 'column_key' => 'string', 'filter_predicate' => 'string', @@ -62,12 +62,12 @@ class HasNoneOf implements ModelInterface, ArrayAccess, \JsonSerializable ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - * @phpstan-var array - * @psalm-var array - */ + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ protected static $openAPIFormats = [ 'column_key' => null, 'filter_predicate' => null, @@ -75,10 +75,10 @@ class HasNoneOf implements ModelInterface, ArrayAccess, \JsonSerializable ]; /** - * Array of nullable properties. Used for (de)serialization - * - * @var boolean[] - */ + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ protected static array $openAPINullables = [ 'column_key' => false, 'filter_predicate' => false, @@ -86,10 +86,10 @@ class HasNoneOf implements ModelInterface, ArrayAccess, \JsonSerializable ]; /** - * If a nullable field gets set to null, insert it here - * - * @var boolean[] - */ + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ protected array $openAPINullablesSetToNull = []; /** @@ -274,14 +274,14 @@ public function __construct(?array $data = null) } /** - * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName - * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the - * $this->openAPINullablesSetToNull array - * - * @param string $variableName - * @param array $fields - * @param mixed $defaultValue - */ + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ private function setIfExists(string $variableName, array $fields, $defaultValue): void { if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { diff --git a/lib/User/ImportBasefromDTableFile200Response.php b/lib/User/ImportBasefromDTableFile200Response.php index 1cf6bcf9..12951c84 100644 --- a/lib/User/ImportBasefromDTableFile200Response.php +++ b/lib/User/ImportBasefromDTableFile200Response.php @@ -44,49 +44,49 @@ class ImportBasefromDTableFile200Response implements ModelInterface, ArrayAccess public const DISCRIMINATOR = null; /** - * The original name of the model. - * - * @var string - */ + * The original name of the model. + * + * @var string + */ protected static $openAPIModelName = 'importBasefromDTableFile_200_response'; /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ protected static $openAPITypes = [ 'task_id' => 'string', 'table' => '\SeaTable\Client\User\ImportBasefromDTableFile200ResponseTable' ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - * @phpstan-var array - * @psalm-var array - */ + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ protected static $openAPIFormats = [ 'task_id' => 'uuid', 'table' => null ]; /** - * Array of nullable properties. Used for (de)serialization - * - * @var boolean[] - */ + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ protected static array $openAPINullables = [ 'task_id' => false, 'table' => false ]; /** - * If a nullable field gets set to null, insert it here - * - * @var boolean[] - */ + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ protected array $openAPINullablesSetToNull = []; /** @@ -254,14 +254,14 @@ public function __construct(?array $data = null) } /** - * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName - * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the - * $this->openAPINullablesSetToNull array - * - * @param string $variableName - * @param array $fields - * @param mixed $defaultValue - */ + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ private function setIfExists(string $variableName, array $fields, $defaultValue): void { if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { diff --git a/lib/User/ImportBasefromDTableFile200ResponseTable.php b/lib/User/ImportBasefromDTableFile200ResponseTable.php index a379a454..697025f9 100644 --- a/lib/User/ImportBasefromDTableFile200ResponseTable.php +++ b/lib/User/ImportBasefromDTableFile200ResponseTable.php @@ -44,17 +44,17 @@ class ImportBasefromDTableFile200ResponseTable implements ModelInterface, ArrayA public const DISCRIMINATOR = null; /** - * The original name of the model. - * - * @var string - */ + * The original name of the model. + * + * @var string + */ protected static $openAPIModelName = 'importBasefromDTableFile_200_response_table'; /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ protected static $openAPITypes = [ 'id' => 'int', 'workspace_id' => 'int', @@ -70,12 +70,12 @@ class ImportBasefromDTableFile200ResponseTable implements ModelInterface, ArrayA ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - * @phpstan-var array - * @psalm-var array - */ + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ protected static $openAPIFormats = [ 'id' => null, 'workspace_id' => null, @@ -91,10 +91,10 @@ class ImportBasefromDTableFile200ResponseTable implements ModelInterface, ArrayA ]; /** - * Array of nullable properties. Used for (de)serialization - * - * @var boolean[] - */ + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ protected static array $openAPINullables = [ 'id' => false, 'workspace_id' => false, @@ -110,10 +110,10 @@ class ImportBasefromDTableFile200ResponseTable implements ModelInterface, ArrayA ]; /** - * If a nullable field gets set to null, insert it here - * - * @var boolean[] - */ + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ protected array $openAPINullablesSetToNull = []; /** @@ -317,14 +317,14 @@ public function __construct(?array $data = null) } /** - * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName - * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the - * $this->openAPINullablesSetToNull array - * - * @param string $variableName - * @param array $fields - * @param mixed $defaultValue - */ + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ private function setIfExists(string $variableName, array $fields, $defaultValue): void { if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { diff --git a/lib/User/ImportExportApi.php b/lib/User/ImportExportApi.php index 201e3c37..6d6e1811 100644 --- a/lib/User/ImportExportApi.php +++ b/lib/User/ImportExportApi.php @@ -28,11 +28,11 @@ use GuzzleHttp\Client; use GuzzleHttp\ClientInterface; -use GuzzleHttp\Exception\ConnectException; use GuzzleHttp\Exception\RequestException; use GuzzleHttp\Psr7\MultipartStream; use GuzzleHttp\Psr7\Request; use GuzzleHttp\RequestOptions; +use Psr\Http\Client\NetworkExceptionInterface; use Psr\Http\Message\RequestInterface; use Psr\Http\Message\ResponseInterface; use SeaTable\Client\ApiException; @@ -196,13 +196,14 @@ public function appendToTableFromFileWithHttpInfo($workspace_id, $file = null, $ try { $response = $this->client->send($request, $options); } catch (RequestException $e) { + $eResponse = $this->getExceptionResponse($e); throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), - $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? (string) $e->getResponse()->getBody() : null + $eResponse ? $eResponse->getHeaders() : null, + $eResponse ? (string) $eResponse->getBody() : null ); - } catch (ConnectException $e) { + } catch (NetworkExceptionInterface $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), @@ -323,7 +324,15 @@ function ($response) use ($returnType) { ]; }, function ($exception) { - $response = $exception->getResponse(); + $response = $this->getExceptionResponse($exception); + if ($response === null) { + throw new ApiException( + "[{$exception->getCode()}] {$exception->getMessage()}", + (int) $exception->getCode(), + null, + null + ); + } $statusCode = $response->getStatusCode(); throw new ApiException( sprintf( @@ -380,7 +389,7 @@ public function appendToTableFromFileRequest($workspace_id, $file = null, $dtabl // path params if ($workspace_id !== null) { $resourcePath = str_replace( - '{' . 'workspace_id' . '}', + '{workspace_id}', ObjectSerializer::toPathValue($workspace_id), $resourcePath ); @@ -423,7 +432,11 @@ public function appendToTableFromFileRequest($workspace_id, $file = null, $dtabl } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + try { + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + } catch (\JsonException $e) { + throw new \InvalidArgumentException('json_encode error: ' . $e->getMessage(), 0, $e); + } } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -500,13 +513,14 @@ public function exportBaseWithHttpInfo($dtable_name, $workspace_id, $password = try { $response = $this->client->send($request, $options); } catch (RequestException $e) { + $eResponse = $this->getExceptionResponse($e); throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), - $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? (string) $e->getResponse()->getBody() : null + $eResponse ? $eResponse->getHeaders() : null, + $eResponse ? (string) $eResponse->getBody() : null ); - } catch (ConnectException $e) { + } catch (NetworkExceptionInterface $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), @@ -578,7 +592,15 @@ function ($response) use ($returnType) { return [null, $response->getStatusCode(), $response->getHeaders()]; }, function ($exception) { - $response = $exception->getResponse(); + $response = $this->getExceptionResponse($exception); + if ($response === null) { + throw new ApiException( + "[{$exception->getCode()}] {$exception->getMessage()}", + (int) $exception->getCode(), + null, + null + ); + } $statusCode = $response->getStatusCode(); throw new ApiException( sprintf( @@ -668,7 +690,7 @@ public function exportBaseRequest($dtable_name, $workspace_id, $password = null, // path params if ($workspace_id !== null) { $resourcePath = str_replace( - '{' . 'workspace_id' . '}', + '{workspace_id}', ObjectSerializer::toPathValue($workspace_id), $resourcePath ); @@ -699,7 +721,11 @@ public function exportBaseRequest($dtable_name, $workspace_id, $password = null, } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + try { + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + } catch (\JsonException $e) { + throw new \InvalidArgumentException('json_encode error: ' . $e->getMessage(), 0, $e); + } } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -770,13 +796,14 @@ public function exportBaseFromExternalLinkWithHttpInfo($external_link_token, str try { $response = $this->client->send($request, $options); } catch (RequestException $e) { + $eResponse = $this->getExceptionResponse($e); throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), - $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? (string) $e->getResponse()->getBody() : null + $eResponse ? $eResponse->getHeaders() : null, + $eResponse ? (string) $eResponse->getBody() : null ); - } catch (ConnectException $e) { + } catch (NetworkExceptionInterface $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), @@ -842,7 +869,15 @@ function ($response) use ($returnType) { return [null, $response->getStatusCode(), $response->getHeaders()]; }, function ($exception) { - $response = $exception->getResponse(); + $response = $this->getExceptionResponse($exception); + if ($response === null) { + throw new ApiException( + "[{$exception->getCode()}] {$exception->getMessage()}", + (int) $exception->getCode(), + null, + null + ); + } $statusCode = $response->getStatusCode(); throw new ApiException( sprintf( @@ -890,7 +925,7 @@ public function exportBaseFromExternalLinkRequest($external_link_token, string $ // path params if ($external_link_token !== null) { $resourcePath = str_replace( - '{' . 'external_link_token' . '}', + '{external_link_token}', ObjectSerializer::toPathValue($external_link_token), $resourcePath ); @@ -921,7 +956,11 @@ public function exportBaseFromExternalLinkRequest($external_link_token, string $ } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + try { + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + } catch (\JsonException $e) { + throw new \InvalidArgumentException('json_encode error: ' . $e->getMessage(), 0, $e); + } } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -994,13 +1033,14 @@ public function exportBigDataViewWithHttpInfo($workspace_id, $base_name, $table_ try { $response = $this->client->send($request, $options); } catch (RequestException $e) { + $eResponse = $this->getExceptionResponse($e); throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), - $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? (string) $e->getResponse()->getBody() : null + $eResponse ? $eResponse->getHeaders() : null, + $eResponse ? (string) $eResponse->getBody() : null ); - } catch (ConnectException $e) { + } catch (NetworkExceptionInterface $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), @@ -1072,7 +1112,15 @@ function ($response) use ($returnType) { return [null, $response->getStatusCode(), $response->getHeaders()]; }, function ($exception) { - $response = $exception->getResponse(); + $response = $this->getExceptionResponse($exception); + if ($response === null) { + throw new ApiException( + "[{$exception->getCode()}] {$exception->getMessage()}", + (int) $exception->getCode(), + null, + null + ); + } $statusCode = $response->getStatusCode(); throw new ApiException( sprintf( @@ -1171,7 +1219,7 @@ public function exportBigDataViewRequest($workspace_id, $base_name, $table_id, $ // path params if ($workspace_id !== null) { $resourcePath = str_replace( - '{' . 'workspace_id' . '}', + '{workspace_id}', ObjectSerializer::toPathValue($workspace_id), $resourcePath ); @@ -1179,7 +1227,7 @@ public function exportBigDataViewRequest($workspace_id, $base_name, $table_id, $ // path params if ($base_name !== null) { $resourcePath = str_replace( - '{' . 'base_name' . '}', + '{base_name}', ObjectSerializer::toPathValue($base_name), $resourcePath ); @@ -1210,7 +1258,11 @@ public function exportBigDataViewRequest($workspace_id, $base_name, $table_id, $ } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + try { + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + } catch (\JsonException $e) { + throw new \InvalidArgumentException('json_encode error: ' . $e->getMessage(), 0, $e); + } } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -1287,13 +1339,14 @@ public function exportTableWithHttpInfo($table_id, $table_name, $dtable_name, $w try { $response = $this->client->send($request, $options); } catch (RequestException $e) { + $eResponse = $this->getExceptionResponse($e); throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), - $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? (string) $e->getResponse()->getBody() : null + $eResponse ? $eResponse->getHeaders() : null, + $eResponse ? (string) $eResponse->getBody() : null ); - } catch (ConnectException $e) { + } catch (NetworkExceptionInterface $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), @@ -1365,7 +1418,15 @@ function ($response) use ($returnType) { return [null, $response->getStatusCode(), $response->getHeaders()]; }, function ($exception) { - $response = $exception->getResponse(); + $response = $this->getExceptionResponse($exception); + if ($response === null) { + throw new ApiException( + "[{$exception->getCode()}] {$exception->getMessage()}", + (int) $exception->getCode(), + null, + null + ); + } $statusCode = $response->getStatusCode(); throw new ApiException( sprintf( @@ -1470,7 +1531,7 @@ public function exportTableRequest($table_id, $table_name, $dtable_name, $worksp // path params if ($workspace_id !== null) { $resourcePath = str_replace( - '{' . 'workspace_id' . '}', + '{workspace_id}', ObjectSerializer::toPathValue($workspace_id), $resourcePath ); @@ -1501,7 +1562,11 @@ public function exportTableRequest($table_id, $table_name, $dtable_name, $worksp } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + try { + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + } catch (\JsonException $e) { + throw new \InvalidArgumentException('json_encode error: ' . $e->getMessage(), 0, $e); + } } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -1582,13 +1647,14 @@ public function exportViewWithHttpInfo($table_id, $table_name, $dtable_name, $vi try { $response = $this->client->send($request, $options); } catch (RequestException $e) { + $eResponse = $this->getExceptionResponse($e); throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), - $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? (string) $e->getResponse()->getBody() : null + $eResponse ? $eResponse->getHeaders() : null, + $eResponse ? (string) $eResponse->getBody() : null ); - } catch (ConnectException $e) { + } catch (NetworkExceptionInterface $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), @@ -1664,7 +1730,15 @@ function ($response) use ($returnType) { return [null, $response->getStatusCode(), $response->getHeaders()]; }, function ($exception) { - $response = $exception->getResponse(); + $response = $this->getExceptionResponse($exception); + if ($response === null) { + throw new ApiException( + "[{$exception->getCode()}] {$exception->getMessage()}", + (int) $exception->getCode(), + null, + null + ); + } $statusCode = $response->getStatusCode(); throw new ApiException( sprintf( @@ -1806,7 +1880,7 @@ public function exportViewRequest($table_id, $table_name, $dtable_name, $view_id // path params if ($workspace_id !== null) { $resourcePath = str_replace( - '{' . 'workspace_id' . '}', + '{workspace_id}', ObjectSerializer::toPathValue($workspace_id), $resourcePath ); @@ -1837,7 +1911,11 @@ public function exportViewRequest($table_id, $table_name, $dtable_name, $view_id } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + try { + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + } catch (\JsonException $e) { + throw new \InvalidArgumentException('json_encode error: ' . $e->getMessage(), 0, $e); + } } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -1911,13 +1989,14 @@ public function importBasefromDTableFileWithHttpInfo($workspace_id, $dtable = nu try { $response = $this->client->send($request, $options); } catch (RequestException $e) { + $eResponse = $this->getExceptionResponse($e); throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), - $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? (string) $e->getResponse()->getBody() : null + $eResponse ? $eResponse->getHeaders() : null, + $eResponse ? (string) $eResponse->getBody() : null ); - } catch (ConnectException $e) { + } catch (NetworkExceptionInterface $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), @@ -2034,7 +2113,15 @@ function ($response) use ($returnType) { ]; }, function ($exception) { - $response = $exception->getResponse(); + $response = $this->getExceptionResponse($exception); + if ($response === null) { + throw new ApiException( + "[{$exception->getCode()}] {$exception->getMessage()}", + (int) $exception->getCode(), + null, + null + ); + } $statusCode = $response->getStatusCode(); throw new ApiException( sprintf( @@ -2087,7 +2174,7 @@ public function importBasefromDTableFileRequest($workspace_id, $dtable = null, s // path params if ($workspace_id !== null) { $resourcePath = str_replace( - '{' . 'workspace_id' . '}', + '{workspace_id}', ObjectSerializer::toPathValue($workspace_id), $resourcePath ); @@ -2128,7 +2215,11 @@ public function importBasefromDTableFileRequest($workspace_id, $dtable = null, s } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + try { + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + } catch (\JsonException $e) { + throw new \InvalidArgumentException('json_encode error: ' . $e->getMessage(), 0, $e); + } } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -2204,13 +2295,14 @@ public function importBasefromFileWithHttpInfo($workspace_id, $dtable = null, $f try { $response = $this->client->send($request, $options); } catch (RequestException $e) { + $eResponse = $this->getExceptionResponse($e); throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), - $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? (string) $e->getResponse()->getBody() : null + $eResponse ? $eResponse->getHeaders() : null, + $eResponse ? (string) $eResponse->getBody() : null ); - } catch (ConnectException $e) { + } catch (NetworkExceptionInterface $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), @@ -2329,7 +2421,15 @@ function ($response) use ($returnType) { ]; }, function ($exception) { - $response = $exception->getResponse(); + $response = $this->getExceptionResponse($exception); + if ($response === null) { + throw new ApiException( + "[{$exception->getCode()}] {$exception->getMessage()}", + (int) $exception->getCode(), + null, + null + ); + } $statusCode = $response->getStatusCode(); throw new ApiException( sprintf( @@ -2384,7 +2484,7 @@ public function importBasefromFileRequest($workspace_id, $dtable = null, $folder // path params if ($workspace_id !== null) { $resourcePath = str_replace( - '{' . 'workspace_id' . '}', + '{workspace_id}', ObjectSerializer::toPathValue($workspace_id), $resourcePath ); @@ -2426,7 +2526,11 @@ public function importBasefromFileRequest($workspace_id, $dtable = null, $folder } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + try { + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + } catch (\JsonException $e) { + throw new \InvalidArgumentException('json_encode error: ' . $e->getMessage(), 0, $e); + } } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -2502,13 +2606,14 @@ public function importTableFromFileWithHttpInfo($workspace_id, $file = null, $dt try { $response = $this->client->send($request, $options); } catch (RequestException $e) { + $eResponse = $this->getExceptionResponse($e); throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), - $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? (string) $e->getResponse()->getBody() : null + $eResponse ? $eResponse->getHeaders() : null, + $eResponse ? (string) $eResponse->getBody() : null ); - } catch (ConnectException $e) { + } catch (NetworkExceptionInterface $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), @@ -2627,7 +2732,15 @@ function ($response) use ($returnType) { ]; }, function ($exception) { - $response = $exception->getResponse(); + $response = $this->getExceptionResponse($exception); + if ($response === null) { + throw new ApiException( + "[{$exception->getCode()}] {$exception->getMessage()}", + (int) $exception->getCode(), + null, + null + ); + } $statusCode = $response->getStatusCode(); throw new ApiException( sprintf( @@ -2682,7 +2795,7 @@ public function importTableFromFileRequest($workspace_id, $file = null, $dtable_ // path params if ($workspace_id !== null) { $resourcePath = str_replace( - '{' . 'workspace_id' . '}', + '{workspace_id}', ObjectSerializer::toPathValue($workspace_id), $resourcePath ); @@ -2724,7 +2837,11 @@ public function importTableFromFileRequest($workspace_id, $file = null, $dtable_ } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + try { + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + } catch (\JsonException $e) { + throw new \InvalidArgumentException('json_encode error: ' . $e->getMessage(), 0, $e); + } } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -2804,13 +2921,14 @@ public function updateFromFileWithHttpInfo($workspace_id, $file, $dtable_uuid, $ try { $response = $this->client->send($request, $options); } catch (RequestException $e) { + $eResponse = $this->getExceptionResponse($e); throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), - $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? (string) $e->getResponse()->getBody() : null + $eResponse ? $eResponse->getHeaders() : null, + $eResponse ? (string) $eResponse->getBody() : null ); - } catch (ConnectException $e) { + } catch (NetworkExceptionInterface $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), @@ -2933,7 +3051,15 @@ function ($response) use ($returnType) { ]; }, function ($exception) { - $response = $exception->getResponse(); + $response = $this->getExceptionResponse($exception); + if ($response === null) { + throw new ApiException( + "[{$exception->getCode()}] {$exception->getMessage()}", + (int) $exception->getCode(), + null, + null + ); + } $statusCode = $response->getStatusCode(); throw new ApiException( sprintf( @@ -3016,7 +3142,7 @@ public function updateFromFileRequest($workspace_id, $file, $dtable_uuid, $table // path params if ($workspace_id !== null) { $resourcePath = str_replace( - '{' . 'workspace_id' . '}', + '{workspace_id}', ObjectSerializer::toPathValue($workspace_id), $resourcePath ); @@ -3060,7 +3186,11 @@ public function updateFromFileRequest($workspace_id, $file, $dtable_uuid, $table } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + try { + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + } catch (\JsonException $e) { + throw new \InvalidArgumentException('json_encode error: ' . $e->getMessage(), 0, $e); + } } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -3120,6 +3250,21 @@ protected function createHttpClientOption() return $options; } + /** + * Returns the response attached to a Guzzle exception, if there is one. + * + * Guzzle 7 exposes getResponse() on RequestException, while Guzzle 8 only + * exposes it on ResponseException and its subclasses. + * + * @param \Throwable $exception + * + * @return ResponseInterface|null + */ + private function getExceptionResponse(\Throwable $exception): ?ResponseInterface + { + return method_exists($exception, 'getResponse') ? $exception->getResponse() : null; + } + private function handleResponseWithDataType( string $dataType, RequestInterface $request, diff --git a/lib/User/ImportUsersToAppRequest.php b/lib/User/ImportUsersToAppRequest.php index 9a1d8fc3..4d89b410 100644 --- a/lib/User/ImportUsersToAppRequest.php +++ b/lib/User/ImportUsersToAppRequest.php @@ -44,46 +44,46 @@ class ImportUsersToAppRequest implements ModelInterface, ArrayAccess, \JsonSeria public const DISCRIMINATOR = null; /** - * The original name of the model. - * - * @var string - */ + * The original name of the model. + * + * @var string + */ protected static $openAPIModelName = 'importUsersToApp_request'; /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ protected static $openAPITypes = [ 'users_info' => '\SeaTable\Client\User\UsersInfo[]' ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - * @phpstan-var array - * @psalm-var array - */ + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ protected static $openAPIFormats = [ 'users_info' => null ]; /** - * Array of nullable properties. Used for (de)serialization - * - * @var boolean[] - */ + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ protected static array $openAPINullables = [ 'users_info' => false ]; /** - * If a nullable field gets set to null, insert it here - * - * @var boolean[] - */ + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ protected array $openAPINullablesSetToNull = []; /** @@ -247,14 +247,14 @@ public function __construct(?array $data = null) } /** - * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName - * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the - * $this->openAPINullablesSetToNull array - * - * @param string $variableName - * @param array $fields - * @param mixed $defaultValue - */ + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ private function setIfExists(string $variableName, array $fields, $defaultValue): void { if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { diff --git a/lib/User/IncludeMe.php b/lib/User/IncludeMe.php index d0b9808a..4138bb67 100644 --- a/lib/User/IncludeMe.php +++ b/lib/User/IncludeMe.php @@ -44,17 +44,17 @@ class IncludeMe implements ModelInterface, ArrayAccess, \JsonSerializable public const DISCRIMINATOR = null; /** - * The original name of the model. - * - * @var string - */ + * The original name of the model. + * + * @var string + */ protected static $openAPIModelName = 'include_me'; /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ protected static $openAPITypes = [ 'column_key' => 'string', 'filter_predicate' => 'string', @@ -62,12 +62,12 @@ class IncludeMe implements ModelInterface, ArrayAccess, \JsonSerializable ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - * @phpstan-var array - * @psalm-var array - */ + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ protected static $openAPIFormats = [ 'column_key' => null, 'filter_predicate' => null, @@ -75,10 +75,10 @@ class IncludeMe implements ModelInterface, ArrayAccess, \JsonSerializable ]; /** - * Array of nullable properties. Used for (de)serialization - * - * @var boolean[] - */ + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ protected static array $openAPINullables = [ 'column_key' => false, 'filter_predicate' => false, @@ -86,10 +86,10 @@ class IncludeMe implements ModelInterface, ArrayAccess, \JsonSerializable ]; /** - * If a nullable field gets set to null, insert it here - * - * @var boolean[] - */ + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ protected array $openAPINullablesSetToNull = []; /** @@ -274,14 +274,14 @@ public function __construct(?array $data = null) } /** - * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName - * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the - * $this->openAPINullablesSetToNull array - * - * @param string $variableName - * @param array $fields - * @param mixed $defaultValue - */ + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ private function setIfExists(string $variableName, array $fields, $defaultValue): void { if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { diff --git a/lib/User/Is.php b/lib/User/Is.php index 1acc59ca..5087376f 100644 --- a/lib/User/Is.php +++ b/lib/User/Is.php @@ -44,17 +44,17 @@ class Is implements ModelInterface, ArrayAccess, \JsonSerializable public const DISCRIMINATOR = null; /** - * The original name of the model. - * - * @var string - */ + * The original name of the model. + * + * @var string + */ protected static $openAPIModelName = 'is'; /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ protected static $openAPITypes = [ 'column_key' => 'string', 'filter_predicate' => 'string', @@ -62,12 +62,12 @@ class Is implements ModelInterface, ArrayAccess, \JsonSerializable ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - * @phpstan-var array - * @psalm-var array - */ + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ protected static $openAPIFormats = [ 'column_key' => null, 'filter_predicate' => null, @@ -75,10 +75,10 @@ class Is implements ModelInterface, ArrayAccess, \JsonSerializable ]; /** - * Array of nullable properties. Used for (de)serialization - * - * @var boolean[] - */ + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ protected static array $openAPINullables = [ 'column_key' => false, 'filter_predicate' => false, @@ -86,10 +86,10 @@ class Is implements ModelInterface, ArrayAccess, \JsonSerializable ]; /** - * If a nullable field gets set to null, insert it here - * - * @var boolean[] - */ + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ protected array $openAPINullablesSetToNull = []; /** @@ -274,14 +274,14 @@ public function __construct(?array $data = null) } /** - * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName - * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the - * $this->openAPINullablesSetToNull array - * - * @param string $variableName - * @param array $fields - * @param mixed $defaultValue - */ + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ private function setIfExists(string $variableName, array $fields, $defaultValue): void { if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { diff --git a/lib/User/IsAnyOf.php b/lib/User/IsAnyOf.php index f87ca34d..fcc1f5e6 100644 --- a/lib/User/IsAnyOf.php +++ b/lib/User/IsAnyOf.php @@ -44,17 +44,17 @@ class IsAnyOf implements ModelInterface, ArrayAccess, \JsonSerializable public const DISCRIMINATOR = null; /** - * The original name of the model. - * - * @var string - */ + * The original name of the model. + * + * @var string + */ protected static $openAPIModelName = 'is_any_of'; /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ protected static $openAPITypes = [ 'column_key' => 'string', 'filter_predicate' => 'string', @@ -62,12 +62,12 @@ class IsAnyOf implements ModelInterface, ArrayAccess, \JsonSerializable ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - * @phpstan-var array - * @psalm-var array - */ + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ protected static $openAPIFormats = [ 'column_key' => null, 'filter_predicate' => null, @@ -75,10 +75,10 @@ class IsAnyOf implements ModelInterface, ArrayAccess, \JsonSerializable ]; /** - * Array of nullable properties. Used for (de)serialization - * - * @var boolean[] - */ + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ protected static array $openAPINullables = [ 'column_key' => false, 'filter_predicate' => false, @@ -86,10 +86,10 @@ class IsAnyOf implements ModelInterface, ArrayAccess, \JsonSerializable ]; /** - * If a nullable field gets set to null, insert it here - * - * @var boolean[] - */ + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ protected array $openAPINullablesSetToNull = []; /** @@ -274,14 +274,14 @@ public function __construct(?array $data = null) } /** - * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName - * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the - * $this->openAPINullablesSetToNull array - * - * @param string $variableName - * @param array $fields - * @param mixed $defaultValue - */ + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ private function setIfExists(string $variableName, array $fields, $defaultValue): void { if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { diff --git a/lib/User/IsCurrentUserID.php b/lib/User/IsCurrentUserID.php index bd871a04..4cb2fdfd 100644 --- a/lib/User/IsCurrentUserID.php +++ b/lib/User/IsCurrentUserID.php @@ -44,17 +44,17 @@ class IsCurrentUserID implements ModelInterface, ArrayAccess, \JsonSerializable public const DISCRIMINATOR = null; /** - * The original name of the model. - * - * @var string - */ + * The original name of the model. + * + * @var string + */ protected static $openAPIModelName = 'is_current_user_ID'; /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ protected static $openAPITypes = [ 'column_key' => 'string', 'filter_predicate' => 'string', @@ -62,12 +62,12 @@ class IsCurrentUserID implements ModelInterface, ArrayAccess, \JsonSerializable ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - * @phpstan-var array - * @psalm-var array - */ + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ protected static $openAPIFormats = [ 'column_key' => null, 'filter_predicate' => null, @@ -75,10 +75,10 @@ class IsCurrentUserID implements ModelInterface, ArrayAccess, \JsonSerializable ]; /** - * Array of nullable properties. Used for (de)serialization - * - * @var boolean[] - */ + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ protected static array $openAPINullables = [ 'column_key' => false, 'filter_predicate' => false, @@ -86,10 +86,10 @@ class IsCurrentUserID implements ModelInterface, ArrayAccess, \JsonSerializable ]; /** - * If a nullable field gets set to null, insert it here - * - * @var boolean[] - */ + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ protected array $openAPINullablesSetToNull = []; /** @@ -274,14 +274,14 @@ public function __construct(?array $data = null) } /** - * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName - * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the - * $this->openAPINullablesSetToNull array - * - * @param string $variableName - * @param array $fields - * @param mixed $defaultValue - */ + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ private function setIfExists(string $variableName, array $fields, $defaultValue): void { if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { diff --git a/lib/User/IsEmpty.php b/lib/User/IsEmpty.php index 19983b87..aaa94213 100644 --- a/lib/User/IsEmpty.php +++ b/lib/User/IsEmpty.php @@ -44,17 +44,17 @@ class IsEmpty implements ModelInterface, ArrayAccess, \JsonSerializable public const DISCRIMINATOR = null; /** - * The original name of the model. - * - * @var string - */ + * The original name of the model. + * + * @var string + */ protected static $openAPIModelName = 'is_empty'; /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ protected static $openAPITypes = [ 'column_key' => 'string', 'filter_predicate' => 'string', @@ -62,12 +62,12 @@ class IsEmpty implements ModelInterface, ArrayAccess, \JsonSerializable ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - * @phpstan-var array - * @psalm-var array - */ + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ protected static $openAPIFormats = [ 'column_key' => null, 'filter_predicate' => null, @@ -75,10 +75,10 @@ class IsEmpty implements ModelInterface, ArrayAccess, \JsonSerializable ]; /** - * Array of nullable properties. Used for (de)serialization - * - * @var boolean[] - */ + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ protected static array $openAPINullables = [ 'column_key' => false, 'filter_predicate' => false, @@ -86,10 +86,10 @@ class IsEmpty implements ModelInterface, ArrayAccess, \JsonSerializable ]; /** - * If a nullable field gets set to null, insert it here - * - * @var boolean[] - */ + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ protected array $openAPINullablesSetToNull = []; /** @@ -274,14 +274,14 @@ public function __construct(?array $data = null) } /** - * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName - * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the - * $this->openAPINullablesSetToNull array - * - * @param string $variableName - * @param array $fields - * @param mixed $defaultValue - */ + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ private function setIfExists(string $variableName, array $fields, $defaultValue): void { if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { diff --git a/lib/User/IsExactly.php b/lib/User/IsExactly.php index 595eb01a..1d74130e 100644 --- a/lib/User/IsExactly.php +++ b/lib/User/IsExactly.php @@ -44,17 +44,17 @@ class IsExactly implements ModelInterface, ArrayAccess, \JsonSerializable public const DISCRIMINATOR = null; /** - * The original name of the model. - * - * @var string - */ + * The original name of the model. + * + * @var string + */ protected static $openAPIModelName = 'is_exactly'; /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ protected static $openAPITypes = [ 'column_key' => 'string', 'filter_predicate' => 'string', @@ -62,12 +62,12 @@ class IsExactly implements ModelInterface, ArrayAccess, \JsonSerializable ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - * @phpstan-var array - * @psalm-var array - */ + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ protected static $openAPIFormats = [ 'column_key' => null, 'filter_predicate' => null, @@ -75,10 +75,10 @@ class IsExactly implements ModelInterface, ArrayAccess, \JsonSerializable ]; /** - * Array of nullable properties. Used for (de)serialization - * - * @var boolean[] - */ + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ protected static array $openAPINullables = [ 'column_key' => false, 'filter_predicate' => false, @@ -86,10 +86,10 @@ class IsExactly implements ModelInterface, ArrayAccess, \JsonSerializable ]; /** - * If a nullable field gets set to null, insert it here - * - * @var boolean[] - */ + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ protected array $openAPINullablesSetToNull = []; /** @@ -274,14 +274,14 @@ public function __construct(?array $data = null) } /** - * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName - * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the - * $this->openAPINullablesSetToNull array - * - * @param string $variableName - * @param array $fields - * @param mixed $defaultValue - */ + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ private function setIfExists(string $variableName, array $fields, $defaultValue): void { if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { diff --git a/lib/User/IsInactive.php b/lib/User/IsInactive.php index 85221de7..fd722c2b 100644 --- a/lib/User/IsInactive.php +++ b/lib/User/IsInactive.php @@ -44,46 +44,46 @@ class IsInactive implements ModelInterface, ArrayAccess, \JsonSerializable public const DISCRIMINATOR = null; /** - * The original name of the model. - * - * @var string - */ + * The original name of the model. + * + * @var string + */ protected static $openAPIModelName = 'is_inactive'; /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ protected static $openAPITypes = [ 'is_inactive' => 'bool' ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - * @phpstan-var array - * @psalm-var array - */ + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ protected static $openAPIFormats = [ 'is_inactive' => null ]; /** - * Array of nullable properties. Used for (de)serialization - * - * @var boolean[] - */ + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ protected static array $openAPINullables = [ 'is_inactive' => false ]; /** - * If a nullable field gets set to null, insert it here - * - * @var boolean[] - */ + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ protected array $openAPINullablesSetToNull = []; /** @@ -247,14 +247,14 @@ public function __construct(?array $data = null) } /** - * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName - * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the - * $this->openAPINullablesSetToNull array - * - * @param string $variableName - * @param array $fields - * @param mixed $defaultValue - */ + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ private function setIfExists(string $variableName, array $fields, $defaultValue): void { if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { diff --git a/lib/User/IsNoneOf.php b/lib/User/IsNoneOf.php index e7c70fba..ea7410db 100644 --- a/lib/User/IsNoneOf.php +++ b/lib/User/IsNoneOf.php @@ -44,17 +44,17 @@ class IsNoneOf implements ModelInterface, ArrayAccess, \JsonSerializable public const DISCRIMINATOR = null; /** - * The original name of the model. - * - * @var string - */ + * The original name of the model. + * + * @var string + */ protected static $openAPIModelName = 'is_none_of'; /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ protected static $openAPITypes = [ 'column_key' => 'string', 'filter_predicate' => 'string', @@ -62,12 +62,12 @@ class IsNoneOf implements ModelInterface, ArrayAccess, \JsonSerializable ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - * @phpstan-var array - * @psalm-var array - */ + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ protected static $openAPIFormats = [ 'column_key' => null, 'filter_predicate' => null, @@ -75,10 +75,10 @@ class IsNoneOf implements ModelInterface, ArrayAccess, \JsonSerializable ]; /** - * Array of nullable properties. Used for (de)serialization - * - * @var boolean[] - */ + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ protected static array $openAPINullables = [ 'column_key' => false, 'filter_predicate' => false, @@ -86,10 +86,10 @@ class IsNoneOf implements ModelInterface, ArrayAccess, \JsonSerializable ]; /** - * If a nullable field gets set to null, insert it here - * - * @var boolean[] - */ + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ protected array $openAPINullablesSetToNull = []; /** @@ -274,14 +274,14 @@ public function __construct(?array $data = null) } /** - * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName - * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the - * $this->openAPINullablesSetToNull array - * - * @param string $variableName - * @param array $fields - * @param mixed $defaultValue - */ + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ private function setIfExists(string $variableName, array $fields, $defaultValue): void { if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { diff --git a/lib/User/IsNot.php b/lib/User/IsNot.php index 2222083e..147f0470 100644 --- a/lib/User/IsNot.php +++ b/lib/User/IsNot.php @@ -44,17 +44,17 @@ class IsNot implements ModelInterface, ArrayAccess, \JsonSerializable public const DISCRIMINATOR = null; /** - * The original name of the model. - * - * @var string - */ + * The original name of the model. + * + * @var string + */ protected static $openAPIModelName = 'is_not'; /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ protected static $openAPITypes = [ 'column_key' => 'string', 'filter_predicate' => 'string', @@ -62,12 +62,12 @@ class IsNot implements ModelInterface, ArrayAccess, \JsonSerializable ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - * @phpstan-var array - * @psalm-var array - */ + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ protected static $openAPIFormats = [ 'column_key' => null, 'filter_predicate' => null, @@ -75,10 +75,10 @@ class IsNot implements ModelInterface, ArrayAccess, \JsonSerializable ]; /** - * Array of nullable properties. Used for (de)serialization - * - * @var boolean[] - */ + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ protected static array $openAPINullables = [ 'column_key' => false, 'filter_predicate' => false, @@ -86,10 +86,10 @@ class IsNot implements ModelInterface, ArrayAccess, \JsonSerializable ]; /** - * If a nullable field gets set to null, insert it here - * - * @var boolean[] - */ + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ protected array $openAPINullablesSetToNull = []; /** @@ -274,14 +274,14 @@ public function __construct(?array $data = null) } /** - * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName - * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the - * $this->openAPINullablesSetToNull array - * - * @param string $variableName - * @param array $fields - * @param mixed $defaultValue - */ + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ private function setIfExists(string $variableName, array $fields, $defaultValue): void { if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { diff --git a/lib/User/IsNotEmpty.php b/lib/User/IsNotEmpty.php index b5f0cbb6..c7829abc 100644 --- a/lib/User/IsNotEmpty.php +++ b/lib/User/IsNotEmpty.php @@ -44,17 +44,17 @@ class IsNotEmpty implements ModelInterface, ArrayAccess, \JsonSerializable public const DISCRIMINATOR = null; /** - * The original name of the model. - * - * @var string - */ + * The original name of the model. + * + * @var string + */ protected static $openAPIModelName = 'is_not_empty'; /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ protected static $openAPITypes = [ 'column_key' => 'string', 'filter_predicate' => 'string', @@ -62,12 +62,12 @@ class IsNotEmpty implements ModelInterface, ArrayAccess, \JsonSerializable ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - * @phpstan-var array - * @psalm-var array - */ + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ protected static $openAPIFormats = [ 'column_key' => null, 'filter_predicate' => null, @@ -75,10 +75,10 @@ class IsNotEmpty implements ModelInterface, ArrayAccess, \JsonSerializable ]; /** - * Array of nullable properties. Used for (de)serialization - * - * @var boolean[] - */ + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ protected static array $openAPINullables = [ 'column_key' => false, 'filter_predicate' => false, @@ -86,10 +86,10 @@ class IsNotEmpty implements ModelInterface, ArrayAccess, \JsonSerializable ]; /** - * If a nullable field gets set to null, insert it here - * - * @var boolean[] - */ + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ protected array $openAPINullablesSetToNull = []; /** @@ -274,14 +274,14 @@ public function __construct(?array $data = null) } /** - * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName - * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the - * $this->openAPINullablesSetToNull array - * - * @param string $variableName - * @param array $fields - * @param mixed $defaultValue - */ + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ private function setIfExists(string $variableName, array $fields, $defaultValue): void { if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { diff --git a/lib/User/IsWithinTheNextMonth.php b/lib/User/IsWithinTheNextMonth.php index bbfa76e7..5bb2de20 100644 --- a/lib/User/IsWithinTheNextMonth.php +++ b/lib/User/IsWithinTheNextMonth.php @@ -44,17 +44,17 @@ class IsWithinTheNextMonth implements ModelInterface, ArrayAccess, \JsonSerializ public const DISCRIMINATOR = null; /** - * The original name of the model. - * - * @var string - */ + * The original name of the model. + * + * @var string + */ protected static $openAPIModelName = 'is_within_the_next_month'; /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ protected static $openAPITypes = [ 'column_key' => 'string', 'filter_predicate' => 'string', @@ -63,12 +63,12 @@ class IsWithinTheNextMonth implements ModelInterface, ArrayAccess, \JsonSerializ ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - * @phpstan-var array - * @psalm-var array - */ + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ protected static $openAPIFormats = [ 'column_key' => null, 'filter_predicate' => null, @@ -77,10 +77,10 @@ class IsWithinTheNextMonth implements ModelInterface, ArrayAccess, \JsonSerializ ]; /** - * Array of nullable properties. Used for (de)serialization - * - * @var boolean[] - */ + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ protected static array $openAPINullables = [ 'column_key' => false, 'filter_predicate' => false, @@ -89,10 +89,10 @@ class IsWithinTheNextMonth implements ModelInterface, ArrayAccess, \JsonSerializ ]; /** - * If a nullable field gets set to null, insert it here - * - * @var boolean[] - */ + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ protected array $openAPINullablesSetToNull = []; /** @@ -294,14 +294,14 @@ public function __construct(?array $data = null) } /** - * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName - * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the - * $this->openAPINullablesSetToNull array - * - * @param string $variableName - * @param array $fields - * @param mixed $defaultValue - */ + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ private function setIfExists(string $variableName, array $fields, $defaultValue): void { if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { diff --git a/lib/User/IsWithinTheNextNumberOfDays.php b/lib/User/IsWithinTheNextNumberOfDays.php index 8f05b38f..196b0824 100644 --- a/lib/User/IsWithinTheNextNumberOfDays.php +++ b/lib/User/IsWithinTheNextNumberOfDays.php @@ -44,17 +44,17 @@ class IsWithinTheNextNumberOfDays implements ModelInterface, ArrayAccess, \JsonS public const DISCRIMINATOR = null; /** - * The original name of the model. - * - * @var string - */ + * The original name of the model. + * + * @var string + */ protected static $openAPIModelName = 'is_within_the_next_number_of_days'; /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ protected static $openAPITypes = [ 'column_key' => 'string', 'filter_predicate' => 'string', @@ -63,12 +63,12 @@ class IsWithinTheNextNumberOfDays implements ModelInterface, ArrayAccess, \JsonS ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - * @phpstan-var array - * @psalm-var array - */ + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ protected static $openAPIFormats = [ 'column_key' => null, 'filter_predicate' => null, @@ -77,10 +77,10 @@ class IsWithinTheNextNumberOfDays implements ModelInterface, ArrayAccess, \JsonS ]; /** - * Array of nullable properties. Used for (de)serialization - * - * @var boolean[] - */ + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ protected static array $openAPINullables = [ 'column_key' => false, 'filter_predicate' => false, @@ -89,10 +89,10 @@ class IsWithinTheNextNumberOfDays implements ModelInterface, ArrayAccess, \JsonS ]; /** - * If a nullable field gets set to null, insert it here - * - * @var boolean[] - */ + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ protected array $openAPINullablesSetToNull = []; /** @@ -294,14 +294,14 @@ public function __construct(?array $data = null) } /** - * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName - * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the - * $this->openAPINullablesSetToNull array - * - * @param string $variableName - * @param array $fields - * @param mixed $defaultValue - */ + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ private function setIfExists(string $variableName, array $fields, $defaultValue): void { if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { diff --git a/lib/User/IsWithinTheNextWeek.php b/lib/User/IsWithinTheNextWeek.php index a99d86e4..60b90121 100644 --- a/lib/User/IsWithinTheNextWeek.php +++ b/lib/User/IsWithinTheNextWeek.php @@ -44,17 +44,17 @@ class IsWithinTheNextWeek implements ModelInterface, ArrayAccess, \JsonSerializa public const DISCRIMINATOR = null; /** - * The original name of the model. - * - * @var string - */ + * The original name of the model. + * + * @var string + */ protected static $openAPIModelName = 'is_within_the_next_week'; /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ protected static $openAPITypes = [ 'column_key' => 'string', 'filter_predicate' => 'string', @@ -63,12 +63,12 @@ class IsWithinTheNextWeek implements ModelInterface, ArrayAccess, \JsonSerializa ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - * @phpstan-var array - * @psalm-var array - */ + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ protected static $openAPIFormats = [ 'column_key' => null, 'filter_predicate' => null, @@ -77,10 +77,10 @@ class IsWithinTheNextWeek implements ModelInterface, ArrayAccess, \JsonSerializa ]; /** - * Array of nullable properties. Used for (de)serialization - * - * @var boolean[] - */ + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ protected static array $openAPINullables = [ 'column_key' => false, 'filter_predicate' => false, @@ -89,10 +89,10 @@ class IsWithinTheNextWeek implements ModelInterface, ArrayAccess, \JsonSerializa ]; /** - * If a nullable field gets set to null, insert it here - * - * @var boolean[] - */ + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ protected array $openAPINullablesSetToNull = []; /** @@ -294,14 +294,14 @@ public function __construct(?array $data = null) } /** - * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName - * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the - * $this->openAPINullablesSetToNull array - * - * @param string $variableName - * @param array $fields - * @param mixed $defaultValue - */ + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ private function setIfExists(string $variableName, array $fields, $defaultValue): void { if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { diff --git a/lib/User/IsWithinTheNextYear.php b/lib/User/IsWithinTheNextYear.php index e2f1370c..9a79fe86 100644 --- a/lib/User/IsWithinTheNextYear.php +++ b/lib/User/IsWithinTheNextYear.php @@ -44,17 +44,17 @@ class IsWithinTheNextYear implements ModelInterface, ArrayAccess, \JsonSerializa public const DISCRIMINATOR = null; /** - * The original name of the model. - * - * @var string - */ + * The original name of the model. + * + * @var string + */ protected static $openAPIModelName = 'is_within_the_next_year'; /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ protected static $openAPITypes = [ 'column_key' => 'string', 'filter_predicate' => 'string', @@ -63,12 +63,12 @@ class IsWithinTheNextYear implements ModelInterface, ArrayAccess, \JsonSerializa ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - * @phpstan-var array - * @psalm-var array - */ + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ protected static $openAPIFormats = [ 'column_key' => null, 'filter_predicate' => null, @@ -77,10 +77,10 @@ class IsWithinTheNextYear implements ModelInterface, ArrayAccess, \JsonSerializa ]; /** - * Array of nullable properties. Used for (de)serialization - * - * @var boolean[] - */ + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ protected static array $openAPINullables = [ 'column_key' => false, 'filter_predicate' => false, @@ -89,10 +89,10 @@ class IsWithinTheNextYear implements ModelInterface, ArrayAccess, \JsonSerializa ]; /** - * If a nullable field gets set to null, insert it here - * - * @var boolean[] - */ + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ protected array $openAPINullablesSetToNull = []; /** @@ -294,14 +294,14 @@ public function __construct(?array $data = null) } /** - * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName - * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the - * $this->openAPINullablesSetToNull array - * - * @param string $variableName - * @param array $fields - * @param mixed $defaultValue - */ + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ private function setIfExists(string $variableName, array $fields, $defaultValue): void { if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { diff --git a/lib/User/IsWithinThePastMonth.php b/lib/User/IsWithinThePastMonth.php index 4cc0765a..34e40715 100644 --- a/lib/User/IsWithinThePastMonth.php +++ b/lib/User/IsWithinThePastMonth.php @@ -44,17 +44,17 @@ class IsWithinThePastMonth implements ModelInterface, ArrayAccess, \JsonSerializ public const DISCRIMINATOR = null; /** - * The original name of the model. - * - * @var string - */ + * The original name of the model. + * + * @var string + */ protected static $openAPIModelName = 'is_within_the_past_month'; /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ protected static $openAPITypes = [ 'column_key' => 'string', 'filter_predicate' => 'string', @@ -63,12 +63,12 @@ class IsWithinThePastMonth implements ModelInterface, ArrayAccess, \JsonSerializ ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - * @phpstan-var array - * @psalm-var array - */ + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ protected static $openAPIFormats = [ 'column_key' => null, 'filter_predicate' => null, @@ -77,10 +77,10 @@ class IsWithinThePastMonth implements ModelInterface, ArrayAccess, \JsonSerializ ]; /** - * Array of nullable properties. Used for (de)serialization - * - * @var boolean[] - */ + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ protected static array $openAPINullables = [ 'column_key' => false, 'filter_predicate' => false, @@ -89,10 +89,10 @@ class IsWithinThePastMonth implements ModelInterface, ArrayAccess, \JsonSerializ ]; /** - * If a nullable field gets set to null, insert it here - * - * @var boolean[] - */ + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ protected array $openAPINullablesSetToNull = []; /** @@ -294,14 +294,14 @@ public function __construct(?array $data = null) } /** - * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName - * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the - * $this->openAPINullablesSetToNull array - * - * @param string $variableName - * @param array $fields - * @param mixed $defaultValue - */ + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ private function setIfExists(string $variableName, array $fields, $defaultValue): void { if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { diff --git a/lib/User/IsWithinThePastNumberOfDays.php b/lib/User/IsWithinThePastNumberOfDays.php index d6f395b2..1cf73abf 100644 --- a/lib/User/IsWithinThePastNumberOfDays.php +++ b/lib/User/IsWithinThePastNumberOfDays.php @@ -44,17 +44,17 @@ class IsWithinThePastNumberOfDays implements ModelInterface, ArrayAccess, \JsonS public const DISCRIMINATOR = null; /** - * The original name of the model. - * - * @var string - */ + * The original name of the model. + * + * @var string + */ protected static $openAPIModelName = 'is_within_the_past_number_of_days'; /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ protected static $openAPITypes = [ 'column_key' => 'string', 'filter_predicate' => 'string', @@ -63,12 +63,12 @@ class IsWithinThePastNumberOfDays implements ModelInterface, ArrayAccess, \JsonS ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - * @phpstan-var array - * @psalm-var array - */ + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ protected static $openAPIFormats = [ 'column_key' => null, 'filter_predicate' => null, @@ -77,10 +77,10 @@ class IsWithinThePastNumberOfDays implements ModelInterface, ArrayAccess, \JsonS ]; /** - * Array of nullable properties. Used for (de)serialization - * - * @var boolean[] - */ + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ protected static array $openAPINullables = [ 'column_key' => false, 'filter_predicate' => false, @@ -89,10 +89,10 @@ class IsWithinThePastNumberOfDays implements ModelInterface, ArrayAccess, \JsonS ]; /** - * If a nullable field gets set to null, insert it here - * - * @var boolean[] - */ + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ protected array $openAPINullablesSetToNull = []; /** @@ -294,14 +294,14 @@ public function __construct(?array $data = null) } /** - * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName - * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the - * $this->openAPINullablesSetToNull array - * - * @param string $variableName - * @param array $fields - * @param mixed $defaultValue - */ + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ private function setIfExists(string $variableName, array $fields, $defaultValue): void { if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { diff --git a/lib/User/IsWithinThePastWeek.php b/lib/User/IsWithinThePastWeek.php index 5446b8ab..8c8d61fb 100644 --- a/lib/User/IsWithinThePastWeek.php +++ b/lib/User/IsWithinThePastWeek.php @@ -44,17 +44,17 @@ class IsWithinThePastWeek implements ModelInterface, ArrayAccess, \JsonSerializa public const DISCRIMINATOR = null; /** - * The original name of the model. - * - * @var string - */ + * The original name of the model. + * + * @var string + */ protected static $openAPIModelName = 'is_within_the_past_week'; /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ protected static $openAPITypes = [ 'column_key' => 'string', 'filter_predicate' => 'string', @@ -63,12 +63,12 @@ class IsWithinThePastWeek implements ModelInterface, ArrayAccess, \JsonSerializa ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - * @phpstan-var array - * @psalm-var array - */ + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ protected static $openAPIFormats = [ 'column_key' => null, 'filter_predicate' => null, @@ -77,10 +77,10 @@ class IsWithinThePastWeek implements ModelInterface, ArrayAccess, \JsonSerializa ]; /** - * Array of nullable properties. Used for (de)serialization - * - * @var boolean[] - */ + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ protected static array $openAPINullables = [ 'column_key' => false, 'filter_predicate' => false, @@ -89,10 +89,10 @@ class IsWithinThePastWeek implements ModelInterface, ArrayAccess, \JsonSerializa ]; /** - * If a nullable field gets set to null, insert it here - * - * @var boolean[] - */ + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ protected array $openAPINullablesSetToNull = []; /** @@ -294,14 +294,14 @@ public function __construct(?array $data = null) } /** - * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName - * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the - * $this->openAPINullablesSetToNull array - * - * @param string $variableName - * @param array $fields - * @param mixed $defaultValue - */ + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ private function setIfExists(string $variableName, array $fields, $defaultValue): void { if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { diff --git a/lib/User/IsWithinThePastYear.php b/lib/User/IsWithinThePastYear.php index 652e96e5..ec0cae28 100644 --- a/lib/User/IsWithinThePastYear.php +++ b/lib/User/IsWithinThePastYear.php @@ -44,17 +44,17 @@ class IsWithinThePastYear implements ModelInterface, ArrayAccess, \JsonSerializa public const DISCRIMINATOR = null; /** - * The original name of the model. - * - * @var string - */ + * The original name of the model. + * + * @var string + */ protected static $openAPIModelName = 'is_within_the_past_year'; /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ protected static $openAPITypes = [ 'column_key' => 'string', 'filter_predicate' => 'string', @@ -63,12 +63,12 @@ class IsWithinThePastYear implements ModelInterface, ArrayAccess, \JsonSerializa ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - * @phpstan-var array - * @psalm-var array - */ + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ protected static $openAPIFormats = [ 'column_key' => null, 'filter_predicate' => null, @@ -77,10 +77,10 @@ class IsWithinThePastYear implements ModelInterface, ArrayAccess, \JsonSerializa ]; /** - * Array of nullable properties. Used for (de)serialization - * - * @var boolean[] - */ + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ protected static array $openAPINullables = [ 'column_key' => false, 'filter_predicate' => false, @@ -89,10 +89,10 @@ class IsWithinThePastYear implements ModelInterface, ArrayAccess, \JsonSerializa ]; /** - * If a nullable field gets set to null, insert it here - * - * @var boolean[] - */ + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ protected array $openAPINullablesSetToNull = []; /** @@ -294,14 +294,14 @@ public function __construct(?array $data = null) } /** - * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName - * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the - * $this->openAPINullablesSetToNull array - * - * @param string $variableName - * @param array $fields - * @param mixed $defaultValue - */ + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ private function setIfExists(string $variableName, array $fields, $defaultValue): void { if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { diff --git a/lib/User/IsWithinThisMonth.php b/lib/User/IsWithinThisMonth.php index b56d052b..33108270 100644 --- a/lib/User/IsWithinThisMonth.php +++ b/lib/User/IsWithinThisMonth.php @@ -44,17 +44,17 @@ class IsWithinThisMonth implements ModelInterface, ArrayAccess, \JsonSerializabl public const DISCRIMINATOR = null; /** - * The original name of the model. - * - * @var string - */ + * The original name of the model. + * + * @var string + */ protected static $openAPIModelName = 'is_within_this_month'; /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ protected static $openAPITypes = [ 'column_key' => 'string', 'filter_predicate' => 'string', @@ -63,12 +63,12 @@ class IsWithinThisMonth implements ModelInterface, ArrayAccess, \JsonSerializabl ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - * @phpstan-var array - * @psalm-var array - */ + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ protected static $openAPIFormats = [ 'column_key' => null, 'filter_predicate' => null, @@ -77,10 +77,10 @@ class IsWithinThisMonth implements ModelInterface, ArrayAccess, \JsonSerializabl ]; /** - * Array of nullable properties. Used for (de)serialization - * - * @var boolean[] - */ + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ protected static array $openAPINullables = [ 'column_key' => false, 'filter_predicate' => false, @@ -89,10 +89,10 @@ class IsWithinThisMonth implements ModelInterface, ArrayAccess, \JsonSerializabl ]; /** - * If a nullable field gets set to null, insert it here - * - * @var boolean[] - */ + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ protected array $openAPINullablesSetToNull = []; /** @@ -294,14 +294,14 @@ public function __construct(?array $data = null) } /** - * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName - * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the - * $this->openAPINullablesSetToNull array - * - * @param string $variableName - * @param array $fields - * @param mixed $defaultValue - */ + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ private function setIfExists(string $variableName, array $fields, $defaultValue): void { if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { diff --git a/lib/User/IsWithinThisWeek.php b/lib/User/IsWithinThisWeek.php index b578d57a..601e639b 100644 --- a/lib/User/IsWithinThisWeek.php +++ b/lib/User/IsWithinThisWeek.php @@ -44,17 +44,17 @@ class IsWithinThisWeek implements ModelInterface, ArrayAccess, \JsonSerializable public const DISCRIMINATOR = null; /** - * The original name of the model. - * - * @var string - */ + * The original name of the model. + * + * @var string + */ protected static $openAPIModelName = 'is_within_this_week'; /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ protected static $openAPITypes = [ 'column_key' => 'string', 'filter_predicate' => 'string', @@ -63,12 +63,12 @@ class IsWithinThisWeek implements ModelInterface, ArrayAccess, \JsonSerializable ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - * @phpstan-var array - * @psalm-var array - */ + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ protected static $openAPIFormats = [ 'column_key' => null, 'filter_predicate' => null, @@ -77,10 +77,10 @@ class IsWithinThisWeek implements ModelInterface, ArrayAccess, \JsonSerializable ]; /** - * Array of nullable properties. Used for (de)serialization - * - * @var boolean[] - */ + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ protected static array $openAPINullables = [ 'column_key' => false, 'filter_predicate' => false, @@ -89,10 +89,10 @@ class IsWithinThisWeek implements ModelInterface, ArrayAccess, \JsonSerializable ]; /** - * If a nullable field gets set to null, insert it here - * - * @var boolean[] - */ + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ protected array $openAPINullablesSetToNull = []; /** @@ -294,14 +294,14 @@ public function __construct(?array $data = null) } /** - * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName - * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the - * $this->openAPINullablesSetToNull array - * - * @param string $variableName - * @param array $fields - * @param mixed $defaultValue - */ + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ private function setIfExists(string $variableName, array $fields, $defaultValue): void { if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { diff --git a/lib/User/IsWithinThisYear.php b/lib/User/IsWithinThisYear.php index 085e7402..204554ce 100644 --- a/lib/User/IsWithinThisYear.php +++ b/lib/User/IsWithinThisYear.php @@ -44,17 +44,17 @@ class IsWithinThisYear implements ModelInterface, ArrayAccess, \JsonSerializable public const DISCRIMINATOR = null; /** - * The original name of the model. - * - * @var string - */ + * The original name of the model. + * + * @var string + */ protected static $openAPIModelName = 'is_within_this_year'; /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ protected static $openAPITypes = [ 'column_key' => 'string', 'filter_predicate' => 'string', @@ -63,12 +63,12 @@ class IsWithinThisYear implements ModelInterface, ArrayAccess, \JsonSerializable ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - * @phpstan-var array - * @psalm-var array - */ + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ protected static $openAPIFormats = [ 'column_key' => null, 'filter_predicate' => null, @@ -77,10 +77,10 @@ class IsWithinThisYear implements ModelInterface, ArrayAccess, \JsonSerializable ]; /** - * Array of nullable properties. Used for (de)serialization - * - * @var boolean[] - */ + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ protected static array $openAPINullables = [ 'column_key' => false, 'filter_predicate' => false, @@ -89,10 +89,10 @@ class IsWithinThisYear implements ModelInterface, ArrayAccess, \JsonSerializable ]; /** - * If a nullable field gets set to null, insert it here - * - * @var boolean[] - */ + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ protected array $openAPINullablesSetToNull = []; /** @@ -294,14 +294,14 @@ public function __construct(?array $data = null) } /** - * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName - * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the - * $this->openAPINullablesSetToNull array - * - * @param string $variableName - * @param array $fields - * @param mixed $defaultValue - */ + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ private function setIfExists(string $variableName, array $fields, $defaultValue): void { if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { diff --git a/lib/User/Less.php b/lib/User/Less.php index 8fd069c3..b9fb9d51 100644 --- a/lib/User/Less.php +++ b/lib/User/Less.php @@ -44,17 +44,17 @@ class Less implements ModelInterface, ArrayAccess, \JsonSerializable public const DISCRIMINATOR = null; /** - * The original name of the model. - * - * @var string - */ + * The original name of the model. + * + * @var string + */ protected static $openAPIModelName = 'less'; /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ protected static $openAPITypes = [ 'column_key' => 'string', 'filter_predicate' => 'string', @@ -62,12 +62,12 @@ class Less implements ModelInterface, ArrayAccess, \JsonSerializable ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - * @phpstan-var array - * @psalm-var array - */ + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ protected static $openAPIFormats = [ 'column_key' => null, 'filter_predicate' => null, @@ -75,10 +75,10 @@ class Less implements ModelInterface, ArrayAccess, \JsonSerializable ]; /** - * Array of nullable properties. Used for (de)serialization - * - * @var boolean[] - */ + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ protected static array $openAPINullables = [ 'column_key' => false, 'filter_predicate' => false, @@ -86,10 +86,10 @@ class Less implements ModelInterface, ArrayAccess, \JsonSerializable ]; /** - * If a nullable field gets set to null, insert it here - * - * @var boolean[] - */ + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ protected array $openAPINullablesSetToNull = []; /** @@ -274,14 +274,14 @@ public function __construct(?array $data = null) } /** - * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName - * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the - * $this->openAPINullablesSetToNull array - * - * @param string $variableName - * @param array $fields - * @param mixed $defaultValue - */ + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ private function setIfExists(string $variableName, array $fields, $defaultValue): void { if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { diff --git a/lib/User/LessOrEqual.php b/lib/User/LessOrEqual.php index 14c9b3b2..2067d4f9 100644 --- a/lib/User/LessOrEqual.php +++ b/lib/User/LessOrEqual.php @@ -44,17 +44,17 @@ class LessOrEqual implements ModelInterface, ArrayAccess, \JsonSerializable public const DISCRIMINATOR = null; /** - * The original name of the model. - * - * @var string - */ + * The original name of the model. + * + * @var string + */ protected static $openAPIModelName = 'less_or_equal'; /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ protected static $openAPITypes = [ 'column_key' => 'string', 'filter_predicate' => 'string', @@ -62,12 +62,12 @@ class LessOrEqual implements ModelInterface, ArrayAccess, \JsonSerializable ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - * @phpstan-var array - * @psalm-var array - */ + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ protected static $openAPIFormats = [ 'column_key' => null, 'filter_predicate' => null, @@ -75,10 +75,10 @@ class LessOrEqual implements ModelInterface, ArrayAccess, \JsonSerializable ]; /** - * Array of nullable properties. Used for (de)serialization - * - * @var boolean[] - */ + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ protected static array $openAPINullables = [ 'column_key' => false, 'filter_predicate' => false, @@ -86,10 +86,10 @@ class LessOrEqual implements ModelInterface, ArrayAccess, \JsonSerializable ]; /** - * If a nullable field gets set to null, insert it here - * - * @var boolean[] - */ + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ protected array $openAPINullablesSetToNull = []; /** @@ -274,14 +274,14 @@ public function __construct(?array $data = null) } /** - * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName - * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the - * $this->openAPINullablesSetToNull array - * - * @param string $variableName - * @param array $fields - * @param mixed $defaultValue - */ + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ private function setIfExists(string $variableName, array $fields, $defaultValue): void { if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { diff --git a/lib/User/ListDepartmentMemberBases200Response.php b/lib/User/ListDepartmentMemberBases200Response.php index 8fb6d621..48864411 100644 --- a/lib/User/ListDepartmentMemberBases200Response.php +++ b/lib/User/ListDepartmentMemberBases200Response.php @@ -44,46 +44,46 @@ class ListDepartmentMemberBases200Response implements ModelInterface, ArrayAcces public const DISCRIMINATOR = null; /** - * The original name of the model. - * - * @var string - */ + * The original name of the model. + * + * @var string + */ protected static $openAPIModelName = 'listDepartmentMemberBases_200_response'; /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ protected static $openAPITypes = [ 'dtable_list' => 'object[]' ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - * @phpstan-var array - * @psalm-var array - */ + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ protected static $openAPIFormats = [ 'dtable_list' => null ]; /** - * Array of nullable properties. Used for (de)serialization - * - * @var boolean[] - */ + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ protected static array $openAPINullables = [ 'dtable_list' => false ]; /** - * If a nullable field gets set to null, insert it here - * - * @var boolean[] - */ + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ protected array $openAPINullablesSetToNull = []; /** @@ -247,14 +247,14 @@ public function __construct(?array $data = null) } /** - * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName - * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the - * $this->openAPINullablesSetToNull array - * - * @param string $variableName - * @param array $fields - * @param mixed $defaultValue - */ + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ private function setIfExists(string $variableName, array $fields, $defaultValue): void { if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { diff --git a/lib/User/ListDepartmentMembers200Response.php b/lib/User/ListDepartmentMembers200Response.php index 2cf3353e..3002622e 100644 --- a/lib/User/ListDepartmentMembers200Response.php +++ b/lib/User/ListDepartmentMembers200Response.php @@ -44,46 +44,46 @@ class ListDepartmentMembers200Response implements ModelInterface, ArrayAccess, \ public const DISCRIMINATOR = null; /** - * The original name of the model. - * - * @var string - */ + * The original name of the model. + * + * @var string + */ protected static $openAPIModelName = 'listDepartmentMembers_200_response'; /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ protected static $openAPITypes = [ 'member_list' => 'object[]' ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - * @phpstan-var array - * @psalm-var array - */ + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ protected static $openAPIFormats = [ 'member_list' => null ]; /** - * Array of nullable properties. Used for (de)serialization - * - * @var boolean[] - */ + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ protected static array $openAPINullables = [ 'member_list' => false ]; /** - * If a nullable field gets set to null, insert it here - * - * @var boolean[] - */ + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ protected array $openAPINullablesSetToNull = []; /** @@ -247,14 +247,14 @@ public function __construct(?array $data = null) } /** - * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName - * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the - * $this->openAPINullablesSetToNull array - * - * @param string $variableName - * @param array $fields - * @param mixed $defaultValue - */ + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ private function setIfExists(string $variableName, array $fields, $defaultValue): void { if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { diff --git a/lib/User/ListDepartments200Response.php b/lib/User/ListDepartments200Response.php index 0df58058..c7ef9718 100644 --- a/lib/User/ListDepartments200Response.php +++ b/lib/User/ListDepartments200Response.php @@ -44,46 +44,46 @@ class ListDepartments200Response implements ModelInterface, ArrayAccess, \JsonSe public const DISCRIMINATOR = null; /** - * The original name of the model. - * - * @var string - */ + * The original name of the model. + * + * @var string + */ protected static $openAPIModelName = 'listDepartments_200_response'; /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ protected static $openAPITypes = [ 'departments' => 'object[]' ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - * @phpstan-var array - * @psalm-var array - */ + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ protected static $openAPIFormats = [ 'departments' => null ]; /** - * Array of nullable properties. Used for (de)serialization - * - * @var boolean[] - */ + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ protected static array $openAPINullables = [ 'departments' => false ]; /** - * If a nullable field gets set to null, insert it here - * - * @var boolean[] - */ + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ protected array $openAPINullablesSetToNull = []; /** @@ -247,14 +247,14 @@ public function __construct(?array $data = null) } /** - * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName - * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the - * $this->openAPINullablesSetToNull array - * - * @param string $variableName - * @param array $fields - * @param mixed $defaultValue - */ + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ private function setIfExists(string $variableName, array $fields, $defaultValue): void { if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { diff --git a/lib/User/ListPublicUserInfosRequest.php b/lib/User/ListPublicUserInfosRequest.php index 60069207..f152d167 100644 --- a/lib/User/ListPublicUserInfosRequest.php +++ b/lib/User/ListPublicUserInfosRequest.php @@ -44,46 +44,46 @@ class ListPublicUserInfosRequest implements ModelInterface, ArrayAccess, \JsonSe public const DISCRIMINATOR = null; /** - * The original name of the model. - * - * @var string - */ + * The original name of the model. + * + * @var string + */ protected static $openAPIModelName = 'listPublicUserInfos_request'; /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ protected static $openAPITypes = [ 'user_id_list' => 'string[]' ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - * @phpstan-var array - * @psalm-var array - */ + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ protected static $openAPIFormats = [ 'user_id_list' => null ]; /** - * Array of nullable properties. Used for (de)serialization - * - * @var boolean[] - */ + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ protected static array $openAPINullables = [ 'user_id_list' => false ]; /** - * If a nullable field gets set to null, insert it here - * - * @var boolean[] - */ + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ protected array $openAPINullablesSetToNull = []; /** @@ -247,14 +247,14 @@ public function __construct(?array $data = null) } /** - * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName - * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the - * $this->openAPINullablesSetToNull array - * - * @param string $variableName - * @param array $fields - * @param mixed $defaultValue - */ + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ private function setIfExists(string $variableName, array $fields, $defaultValue): void { if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { diff --git a/lib/User/ListUserDepartments200Response.php b/lib/User/ListUserDepartments200Response.php index db08efe6..c89b11bb 100644 --- a/lib/User/ListUserDepartments200Response.php +++ b/lib/User/ListUserDepartments200Response.php @@ -44,46 +44,46 @@ class ListUserDepartments200Response implements ModelInterface, ArrayAccess, \Js public const DISCRIMINATOR = null; /** - * The original name of the model. - * - * @var string - */ + * The original name of the model. + * + * @var string + */ protected static $openAPIModelName = 'listUserDepartments_200_response'; /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ protected static $openAPITypes = [ 'department_list' => 'object[]' ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - * @phpstan-var array - * @psalm-var array - */ + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ protected static $openAPIFormats = [ 'department_list' => null ]; /** - * Array of nullable properties. Used for (de)serialization - * - * @var boolean[] - */ + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ protected static array $openAPINullables = [ 'department_list' => false ]; /** - * If a nullable field gets set to null, insert it here - * - * @var boolean[] - */ + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ protected array $openAPINullablesSetToNull = []; /** @@ -247,14 +247,14 @@ public function __construct(?array $data = null) } /** - * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName - * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the - * $this->openAPINullablesSetToNull array - * - * @param string $variableName - * @param array $fields - * @param mixed $defaultValue - */ + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ private function setIfExists(string $variableName, array $fields, $defaultValue): void { if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { diff --git a/lib/User/MaintenanceApi.php b/lib/User/MaintenanceApi.php index d28c3662..e21ddbaf 100644 --- a/lib/User/MaintenanceApi.php +++ b/lib/User/MaintenanceApi.php @@ -28,11 +28,11 @@ use GuzzleHttp\Client; use GuzzleHttp\ClientInterface; -use GuzzleHttp\Exception\ConnectException; use GuzzleHttp\Exception\RequestException; use GuzzleHttp\Psr7\MultipartStream; use GuzzleHttp\Psr7\Request; use GuzzleHttp\RequestOptions; +use Psr\Http\Client\NetworkExceptionInterface; use Psr\Http\Message\RequestInterface; use Psr\Http\Message\ResponseInterface; use SeaTable\Client\ApiException; @@ -163,13 +163,14 @@ public function repairBaseWithHttpInfo($base_uuid, string $contentType = self::c try { $response = $this->client->send($request, $options); } catch (RequestException $e) { + $eResponse = $this->getExceptionResponse($e); throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), - $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? (string) $e->getResponse()->getBody() : null + $eResponse ? $eResponse->getHeaders() : null, + $eResponse ? (string) $eResponse->getBody() : null ); - } catch (ConnectException $e) { + } catch (NetworkExceptionInterface $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), @@ -284,7 +285,15 @@ function ($response) use ($returnType) { ]; }, function ($exception) { - $response = $exception->getResponse(); + $response = $this->getExceptionResponse($exception); + if ($response === null) { + throw new ApiException( + "[{$exception->getCode()}] {$exception->getMessage()}", + (int) $exception->getCode(), + null, + null + ); + } $statusCode = $response->getStatusCode(); throw new ApiException( sprintf( @@ -335,7 +344,7 @@ public function repairBaseRequest($base_uuid, string $contentType = self::conten // path params if ($base_uuid !== null) { $resourcePath = str_replace( - '{' . 'base_uuid' . '}', + '{base_uuid}', ObjectSerializer::toPathValue($base_uuid), $resourcePath ); @@ -366,7 +375,11 @@ public function repairBaseRequest($base_uuid, string $contentType = self::conten } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + try { + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + } catch (\JsonException $e) { + throw new \InvalidArgumentException('json_encode error: ' . $e->getMessage(), 0, $e); + } } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -426,6 +439,21 @@ protected function createHttpClientOption() return $options; } + /** + * Returns the response attached to a Guzzle exception, if there is one. + * + * Guzzle 7 exposes getResponse() on RequestException, while Guzzle 8 only + * exposes it on ResponseException and its subclasses. + * + * @param \Throwable $exception + * + * @return ResponseInterface|null + */ + private function getExceptionResponse(\Throwable $exception): ?ResponseInterface + { + return method_exists($exception, 'getResponse') ? $exception->getResponse() : null; + } + private function handleResponseWithDataType( string $dataType, RequestInterface $request, diff --git a/lib/User/ModifyPassword.php b/lib/User/ModifyPassword.php index 62055a30..d7c637aa 100644 --- a/lib/User/ModifyPassword.php +++ b/lib/User/ModifyPassword.php @@ -44,17 +44,17 @@ class ModifyPassword implements ModelInterface, ArrayAccess, \JsonSerializable public const DISCRIMINATOR = null; /** - * The original name of the model. - * - * @var string - */ + * The original name of the model. + * + * @var string + */ protected static $openAPIModelName = 'modify_password'; /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ protected static $openAPITypes = [ 'name' => 'string', 'operation' => 'string', @@ -63,12 +63,12 @@ class ModifyPassword implements ModelInterface, ArrayAccess, \JsonSerializable ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - * @phpstan-var array - * @psalm-var array - */ + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ protected static $openAPIFormats = [ 'name' => null, 'operation' => null, @@ -77,10 +77,10 @@ class ModifyPassword implements ModelInterface, ArrayAccess, \JsonSerializable ]; /** - * Array of nullable properties. Used for (de)serialization - * - * @var boolean[] - */ + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ protected static array $openAPINullables = [ 'name' => false, 'operation' => false, @@ -89,10 +89,10 @@ class ModifyPassword implements ModelInterface, ArrayAccess, \JsonSerializable ]; /** - * If a nullable field gets set to null, insert it here - * - * @var boolean[] - */ + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ protected array $openAPINullablesSetToNull = []; /** @@ -281,14 +281,14 @@ public function __construct(?array $data = null) } /** - * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName - * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the - * $this->openAPINullablesSetToNull array - * - * @param string $variableName - * @param array $fields - * @param mixed $defaultValue - */ + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ private function setIfExists(string $variableName, array $fields, $defaultValue): void { if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { diff --git a/lib/User/NotEqual.php b/lib/User/NotEqual.php index a32e3783..3dd47199 100644 --- a/lib/User/NotEqual.php +++ b/lib/User/NotEqual.php @@ -44,17 +44,17 @@ class NotEqual implements ModelInterface, ArrayAccess, \JsonSerializable public const DISCRIMINATOR = null; /** - * The original name of the model. - * - * @var string - */ + * The original name of the model. + * + * @var string + */ protected static $openAPIModelName = 'not_equal'; /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ protected static $openAPITypes = [ 'column_key' => 'string', 'filter_predicate' => 'string', @@ -62,12 +62,12 @@ class NotEqual implements ModelInterface, ArrayAccess, \JsonSerializable ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - * @phpstan-var array - * @psalm-var array - */ + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ protected static $openAPIFormats = [ 'column_key' => null, 'filter_predicate' => null, @@ -75,10 +75,10 @@ class NotEqual implements ModelInterface, ArrayAccess, \JsonSerializable ]; /** - * Array of nullable properties. Used for (de)serialization - * - * @var boolean[] - */ + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ protected static array $openAPINullables = [ 'column_key' => false, 'filter_predicate' => false, @@ -86,10 +86,10 @@ class NotEqual implements ModelInterface, ArrayAccess, \JsonSerializable ]; /** - * If a nullable field gets set to null, insert it here - * - * @var boolean[] - */ + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ protected array $openAPINullablesSetToNull = []; /** @@ -274,14 +274,14 @@ public function __construct(?array $data = null) } /** - * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName - * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the - * $this->openAPINullablesSetToNull array - * - * @param string $variableName - * @param array $fields - * @param mixed $defaultValue - */ + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ private function setIfExists(string $variableName, array $fields, $defaultValue): void { if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { diff --git a/lib/User/NotificationsApi.php b/lib/User/NotificationsApi.php index afe20d26..928d57eb 100644 --- a/lib/User/NotificationsApi.php +++ b/lib/User/NotificationsApi.php @@ -28,11 +28,11 @@ use GuzzleHttp\Client; use GuzzleHttp\ClientInterface; -use GuzzleHttp\Exception\ConnectException; use GuzzleHttp\Exception\RequestException; use GuzzleHttp\Psr7\MultipartStream; use GuzzleHttp\Psr7\Request; use GuzzleHttp\RequestOptions; +use Psr\Http\Client\NetworkExceptionInterface; use Psr\Http\Message\RequestInterface; use Psr\Http\Message\ResponseInterface; use SeaTable\Client\ApiException; @@ -179,13 +179,14 @@ public function addNotificationRuleWithHttpInfo($workspace_id, $base_name, $add_ try { $response = $this->client->send($request, $options); } catch (RequestException $e) { + $eResponse = $this->getExceptionResponse($e); throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), - $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? (string) $e->getResponse()->getBody() : null + $eResponse ? $eResponse->getHeaders() : null, + $eResponse ? (string) $eResponse->getBody() : null ); - } catch (ConnectException $e) { + } catch (NetworkExceptionInterface $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), @@ -304,7 +305,15 @@ function ($response) use ($returnType) { ]; }, function ($exception) { - $response = $exception->getResponse(); + $response = $this->getExceptionResponse($exception); + if ($response === null) { + throw new ApiException( + "[{$exception->getCode()}] {$exception->getMessage()}", + (int) $exception->getCode(), + null, + null + ); + } $statusCode = $response->getStatusCode(); throw new ApiException( sprintf( @@ -371,7 +380,7 @@ public function addNotificationRuleRequest($workspace_id, $base_name, $add_notif // path params if ($workspace_id !== null) { $resourcePath = str_replace( - '{' . 'workspace_id' . '}', + '{workspace_id}', ObjectSerializer::toPathValue($workspace_id), $resourcePath ); @@ -379,7 +388,7 @@ public function addNotificationRuleRequest($workspace_id, $base_name, $add_notif // path params if ($base_name !== null) { $resourcePath = str_replace( - '{' . 'base_name' . '}', + '{base_name}', ObjectSerializer::toPathValue($base_name), $resourcePath ); @@ -396,7 +405,11 @@ public function addNotificationRuleRequest($workspace_id, $base_name, $add_notif if (isset($add_notification_rule_request)) { if (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the body - $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($add_notification_rule_request)); + try { + $httpBody = json_encode(ObjectSerializer::sanitizeForSerialization($add_notification_rule_request), JSON_THROW_ON_ERROR); + } catch (\JsonException $e) { + throw new \InvalidArgumentException('json_encode error: ' . $e->getMessage(), 0, $e); + } } else { $httpBody = $add_notification_rule_request; } @@ -417,7 +430,11 @@ public function addNotificationRuleRequest($workspace_id, $base_name, $add_notif } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + try { + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + } catch (\JsonException $e) { + throw new \InvalidArgumentException('json_encode error: ' . $e->getMessage(), 0, $e); + } } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -493,13 +510,14 @@ public function deleteNotificationRuleWithHttpInfo($workspace_id, $base_name, $n try { $response = $this->client->send($request, $options); } catch (RequestException $e) { + $eResponse = $this->getExceptionResponse($e); throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), - $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? (string) $e->getResponse()->getBody() : null + $eResponse ? $eResponse->getHeaders() : null, + $eResponse ? (string) $eResponse->getBody() : null ); - } catch (ConnectException $e) { + } catch (NetworkExceptionInterface $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), @@ -618,7 +636,15 @@ function ($response) use ($returnType) { ]; }, function ($exception) { - $response = $exception->getResponse(); + $response = $this->getExceptionResponse($exception); + if ($response === null) { + throw new ApiException( + "[{$exception->getCode()}] {$exception->getMessage()}", + (int) $exception->getCode(), + null, + null + ); + } $statusCode = $response->getStatusCode(); throw new ApiException( sprintf( @@ -685,7 +711,7 @@ public function deleteNotificationRuleRequest($workspace_id, $base_name, $notifi // path params if ($workspace_id !== null) { $resourcePath = str_replace( - '{' . 'workspace_id' . '}', + '{workspace_id}', ObjectSerializer::toPathValue($workspace_id), $resourcePath ); @@ -693,7 +719,7 @@ public function deleteNotificationRuleRequest($workspace_id, $base_name, $notifi // path params if ($base_name !== null) { $resourcePath = str_replace( - '{' . 'base_name' . '}', + '{base_name}', ObjectSerializer::toPathValue($base_name), $resourcePath ); @@ -701,7 +727,7 @@ public function deleteNotificationRuleRequest($workspace_id, $base_name, $notifi // path params if ($notification_rule_id !== null) { $resourcePath = str_replace( - '{' . 'notification_rule_id' . '}', + '{notification_rule_id}', ObjectSerializer::toPathValue($notification_rule_id), $resourcePath ); @@ -732,7 +758,11 @@ public function deleteNotificationRuleRequest($workspace_id, $base_name, $notifi } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + try { + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + } catch (\JsonException $e) { + throw new \InvalidArgumentException('json_encode error: ' . $e->getMessage(), 0, $e); + } } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -806,13 +836,14 @@ public function listNotificationRulesWithHttpInfo($workspace_id, $base_name, str try { $response = $this->client->send($request, $options); } catch (RequestException $e) { + $eResponse = $this->getExceptionResponse($e); throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), - $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? (string) $e->getResponse()->getBody() : null + $eResponse ? $eResponse->getHeaders() : null, + $eResponse ? (string) $eResponse->getBody() : null ); - } catch (ConnectException $e) { + } catch (NetworkExceptionInterface $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), @@ -929,7 +960,15 @@ function ($response) use ($returnType) { ]; }, function ($exception) { - $response = $exception->getResponse(); + $response = $this->getExceptionResponse($exception); + if ($response === null) { + throw new ApiException( + "[{$exception->getCode()}] {$exception->getMessage()}", + (int) $exception->getCode(), + null, + null + ); + } $statusCode = $response->getStatusCode(); throw new ApiException( sprintf( @@ -988,7 +1027,7 @@ public function listNotificationRulesRequest($workspace_id, $base_name, string $ // path params if ($workspace_id !== null) { $resourcePath = str_replace( - '{' . 'workspace_id' . '}', + '{workspace_id}', ObjectSerializer::toPathValue($workspace_id), $resourcePath ); @@ -996,7 +1035,7 @@ public function listNotificationRulesRequest($workspace_id, $base_name, string $ // path params if ($base_name !== null) { $resourcePath = str_replace( - '{' . 'base_name' . '}', + '{base_name}', ObjectSerializer::toPathValue($base_name), $resourcePath ); @@ -1027,7 +1066,11 @@ public function listNotificationRulesRequest($workspace_id, $base_name, string $ } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + try { + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + } catch (\JsonException $e) { + throw new \InvalidArgumentException('json_encode error: ' . $e->getMessage(), 0, $e); + } } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -1097,13 +1140,14 @@ public function markNotificationAsSeenWithHttpInfo(string $contentType = self::c try { $response = $this->client->send($request, $options); } catch (RequestException $e) { + $eResponse = $this->getExceptionResponse($e); throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), - $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? (string) $e->getResponse()->getBody() : null + $eResponse ? $eResponse->getHeaders() : null, + $eResponse ? (string) $eResponse->getBody() : null ); - } catch (ConnectException $e) { + } catch (NetworkExceptionInterface $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), @@ -1216,7 +1260,15 @@ function ($response) use ($returnType) { ]; }, function ($exception) { - $response = $exception->getResponse(); + $response = $this->getExceptionResponse($exception); + if ($response === null) { + throw new ApiException( + "[{$exception->getCode()}] {$exception->getMessage()}", + (int) $exception->getCode(), + null, + null + ); + } $statusCode = $response->getStatusCode(); throw new ApiException( sprintf( @@ -1279,7 +1331,11 @@ public function markNotificationAsSeenRequest(string $contentType = self::conten } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + try { + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + } catch (\JsonException $e) { + throw new \InvalidArgumentException('json_encode error: ' . $e->getMessage(), 0, $e); + } } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -1357,13 +1413,14 @@ public function updateNotificationRuleWithHttpInfo($workspace_id, $base_name, $n try { $response = $this->client->send($request, $options); } catch (RequestException $e) { + $eResponse = $this->getExceptionResponse($e); throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), - $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? (string) $e->getResponse()->getBody() : null + $eResponse ? $eResponse->getHeaders() : null, + $eResponse ? (string) $eResponse->getBody() : null ); - } catch (ConnectException $e) { + } catch (NetworkExceptionInterface $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), @@ -1484,7 +1541,15 @@ function ($response) use ($returnType) { ]; }, function ($exception) { - $response = $exception->getResponse(); + $response = $this->getExceptionResponse($exception); + if ($response === null) { + throw new ApiException( + "[{$exception->getCode()}] {$exception->getMessage()}", + (int) $exception->getCode(), + null, + null + ); + } $statusCode = $response->getStatusCode(); throw new ApiException( sprintf( @@ -1553,7 +1618,7 @@ public function updateNotificationRuleRequest($workspace_id, $base_name, $notifi // path params if ($workspace_id !== null) { $resourcePath = str_replace( - '{' . 'workspace_id' . '}', + '{workspace_id}', ObjectSerializer::toPathValue($workspace_id), $resourcePath ); @@ -1561,7 +1626,7 @@ public function updateNotificationRuleRequest($workspace_id, $base_name, $notifi // path params if ($base_name !== null) { $resourcePath = str_replace( - '{' . 'base_name' . '}', + '{base_name}', ObjectSerializer::toPathValue($base_name), $resourcePath ); @@ -1569,7 +1634,7 @@ public function updateNotificationRuleRequest($workspace_id, $base_name, $notifi // path params if ($notification_rule_id !== null) { $resourcePath = str_replace( - '{' . 'notification_rule_id' . '}', + '{notification_rule_id}', ObjectSerializer::toPathValue($notification_rule_id), $resourcePath ); @@ -1586,7 +1651,11 @@ public function updateNotificationRuleRequest($workspace_id, $base_name, $notifi if (isset($update_notification_rule_request)) { if (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the body - $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($update_notification_rule_request)); + try { + $httpBody = json_encode(ObjectSerializer::sanitizeForSerialization($update_notification_rule_request), JSON_THROW_ON_ERROR); + } catch (\JsonException $e) { + throw new \InvalidArgumentException('json_encode error: ' . $e->getMessage(), 0, $e); + } } else { $httpBody = $update_notification_rule_request; } @@ -1607,7 +1676,11 @@ public function updateNotificationRuleRequest($workspace_id, $base_name, $notifi } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + try { + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + } catch (\JsonException $e) { + throw new \InvalidArgumentException('json_encode error: ' . $e->getMessage(), 0, $e); + } } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -1667,6 +1740,21 @@ protected function createHttpClientOption() return $options; } + /** + * Returns the response attached to a Guzzle exception, if there is one. + * + * Guzzle 7 exposes getResponse() on RequestException, while Guzzle 8 only + * exposes it on ResponseException and its subclasses. + * + * @param \Throwable $exception + * + * @return ResponseInterface|null + */ + private function getExceptionResponse(\Throwable $exception): ?ResponseInterface + { + return method_exists($exception, 'getResponse') ? $exception->getResponse() : null; + } + private function handleResponseWithDataType( string $dataType, RequestInterface $request, diff --git a/lib/User/PublishCommonDataset200Response.php b/lib/User/PublishCommonDataset200Response.php index 6f6eff72..4474807e 100644 --- a/lib/User/PublishCommonDataset200Response.php +++ b/lib/User/PublishCommonDataset200Response.php @@ -44,17 +44,17 @@ class PublishCommonDataset200Response implements ModelInterface, ArrayAccess, \J public const DISCRIMINATOR = null; /** - * The original name of the model. - * - * @var string - */ + * The original name of the model. + * + * @var string + */ protected static $openAPIModelName = 'publishCommonDataset_200_response'; /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ protected static $openAPITypes = [ 'id' => 'int', 'org_id' => 'int', @@ -68,12 +68,12 @@ class PublishCommonDataset200Response implements ModelInterface, ArrayAccess, \J ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - * @phpstan-var array - * @psalm-var array - */ + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ protected static $openAPIFormats = [ 'id' => null, 'org_id' => null, @@ -87,10 +87,10 @@ class PublishCommonDataset200Response implements ModelInterface, ArrayAccess, \J ]; /** - * Array of nullable properties. Used for (de)serialization - * - * @var boolean[] - */ + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ protected static array $openAPINullables = [ 'id' => false, 'org_id' => false, @@ -104,10 +104,10 @@ class PublishCommonDataset200Response implements ModelInterface, ArrayAccess, \J ]; /** - * If a nullable field gets set to null, insert it here - * - * @var boolean[] - */ + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ protected array $openAPINullablesSetToNull = []; /** @@ -303,14 +303,14 @@ public function __construct(?array $data = null) } /** - * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName - * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the - * $this->openAPINullablesSetToNull array - * - * @param string $variableName - * @param array $fields - * @param mixed $defaultValue - */ + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ private function setIfExists(string $variableName, array $fields, $defaultValue): void { if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { diff --git a/lib/User/RecordsMeetSpecificConditionsAfterModification.php b/lib/User/RecordsMeetSpecificConditionsAfterModification.php index 837a457b..dc39232e 100644 --- a/lib/User/RecordsMeetSpecificConditionsAfterModification.php +++ b/lib/User/RecordsMeetSpecificConditionsAfterModification.php @@ -44,17 +44,17 @@ class RecordsMeetSpecificConditionsAfterModification implements ModelInterface, public const DISCRIMINATOR = null; /** - * The original name of the model. - * - * @var string - */ + * The original name of the model. + * + * @var string + */ protected static $openAPIModelName = 'records_meet_specific_conditions_after_modification'; /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ protected static $openAPITypes = [ 'run_condition' => 'string', 'trigger' => '\SeaTable\Client\User\TriggerRecordsMeetSpecificConditionsAfterModification', @@ -62,12 +62,12 @@ class RecordsMeetSpecificConditionsAfterModification implements ModelInterface, ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - * @phpstan-var array - * @psalm-var array - */ + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ protected static $openAPIFormats = [ 'run_condition' => null, 'trigger' => null, @@ -75,10 +75,10 @@ class RecordsMeetSpecificConditionsAfterModification implements ModelInterface, ]; /** - * Array of nullable properties. Used for (de)serialization - * - * @var boolean[] - */ + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ protected static array $openAPINullables = [ 'run_condition' => false, 'trigger' => false, @@ -86,10 +86,10 @@ class RecordsMeetSpecificConditionsAfterModification implements ModelInterface, ]; /** - * If a nullable field gets set to null, insert it here - * - * @var boolean[] - */ + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ protected array $openAPINullablesSetToNull = []; /** @@ -274,14 +274,14 @@ public function __construct(?array $data = null) } /** - * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName - * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the - * $this->openAPINullablesSetToNull array - * - * @param string $variableName - * @param array $fields - * @param mixed $defaultValue - */ + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ private function setIfExists(string $variableName, array $fields, $defaultValue): void { if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { diff --git a/lib/User/RepairBase200Response.php b/lib/User/RepairBase200Response.php index e7c6a0f6..9abafa3e 100644 --- a/lib/User/RepairBase200Response.php +++ b/lib/User/RepairBase200Response.php @@ -44,46 +44,46 @@ class RepairBase200Response implements ModelInterface, ArrayAccess, \JsonSeriali public const DISCRIMINATOR = null; /** - * The original name of the model. - * - * @var string - */ + * The original name of the model. + * + * @var string + */ protected static $openAPIModelName = 'repairBase_200_response'; /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ protected static $openAPITypes = [ 'success' => 'bool' ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - * @phpstan-var array - * @psalm-var array - */ + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ protected static $openAPIFormats = [ 'success' => null ]; /** - * Array of nullable properties. Used for (de)serialization - * - * @var boolean[] - */ + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ protected static array $openAPINullables = [ 'success' => false ]; /** - * If a nullable field gets set to null, insert it here - * - * @var boolean[] - */ + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ protected array $openAPINullablesSetToNull = []; /** @@ -247,14 +247,14 @@ public function __construct(?array $data = null) } /** - * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName - * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the - * $this->openAPINullablesSetToNull array - * - * @param string $variableName - * @param array $fields - * @param mixed $defaultValue - */ + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ private function setIfExists(string $variableName, array $fields, $defaultValue): void { if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { diff --git a/lib/User/RowAdded.php b/lib/User/RowAdded.php index fa28a79c..f0c985b7 100644 --- a/lib/User/RowAdded.php +++ b/lib/User/RowAdded.php @@ -44,17 +44,17 @@ class RowAdded implements ModelInterface, ArrayAccess, \JsonSerializable public const DISCRIMINATOR = null; /** - * The original name of the model. - * - * @var string - */ + * The original name of the model. + * + * @var string + */ protected static $openAPIModelName = 'row_added'; /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ protected static $openAPITypes = [ 'run_condition' => 'string', 'trigger' => '\SeaTable\Client\User\TriggerRowAdded', @@ -62,12 +62,12 @@ class RowAdded implements ModelInterface, ArrayAccess, \JsonSerializable ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - * @phpstan-var array - * @psalm-var array - */ + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ protected static $openAPIFormats = [ 'run_condition' => null, 'trigger' => null, @@ -75,10 +75,10 @@ class RowAdded implements ModelInterface, ArrayAccess, \JsonSerializable ]; /** - * Array of nullable properties. Used for (de)serialization - * - * @var boolean[] - */ + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ protected static array $openAPINullables = [ 'run_condition' => false, 'trigger' => false, @@ -86,10 +86,10 @@ class RowAdded implements ModelInterface, ArrayAccess, \JsonSerializable ]; /** - * If a nullable field gets set to null, insert it here - * - * @var boolean[] - */ + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ protected array $openAPINullablesSetToNull = []; /** @@ -274,14 +274,14 @@ public function __construct(?array $data = null) } /** - * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName - * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the - * $this->openAPINullablesSetToNull array - * - * @param string $variableName - * @param array $fields - * @param mixed $defaultValue - */ + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ private function setIfExists(string $variableName, array $fields, $defaultValue): void { if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { diff --git a/lib/User/RunPeriodically.php b/lib/User/RunPeriodically.php index 0a6cf39d..0455554f 100644 --- a/lib/User/RunPeriodically.php +++ b/lib/User/RunPeriodically.php @@ -44,17 +44,17 @@ class RunPeriodically implements ModelInterface, ArrayAccess, \JsonSerializable public const DISCRIMINATOR = null; /** - * The original name of the model. - * - * @var string - */ + * The original name of the model. + * + * @var string + */ protected static $openAPIModelName = 'run_periodically'; /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ protected static $openAPITypes = [ 'run_condition' => 'string', 'trigger' => '\SeaTable\Client\User\TriggerRunPeriodicallyPerMonthTrigger', @@ -62,12 +62,12 @@ class RunPeriodically implements ModelInterface, ArrayAccess, \JsonSerializable ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - * @phpstan-var array - * @psalm-var array - */ + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ protected static $openAPIFormats = [ 'run_condition' => null, 'trigger' => null, @@ -75,10 +75,10 @@ class RunPeriodically implements ModelInterface, ArrayAccess, \JsonSerializable ]; /** - * Array of nullable properties. Used for (de)serialization - * - * @var boolean[] - */ + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ protected static array $openAPINullables = [ 'run_condition' => false, 'trigger' => false, @@ -86,10 +86,10 @@ class RunPeriodically implements ModelInterface, ArrayAccess, \JsonSerializable ]; /** - * If a nullable field gets set to null, insert it here - * - * @var boolean[] - */ + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ protected array $openAPINullablesSetToNull = []; /** @@ -274,14 +274,14 @@ public function __construct(?array $data = null) } /** - * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName - * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the - * $this->openAPINullablesSetToNull array - * - * @param string $variableName - * @param array $fields - * @param mixed $defaultValue - */ + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ private function setIfExists(string $variableName, array $fields, $defaultValue): void { if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { diff --git a/lib/User/RunPeriodicallyOnRecordsMeetConditions.php b/lib/User/RunPeriodicallyOnRecordsMeetConditions.php index 77445d30..b1a2817d 100644 --- a/lib/User/RunPeriodicallyOnRecordsMeetConditions.php +++ b/lib/User/RunPeriodicallyOnRecordsMeetConditions.php @@ -44,17 +44,17 @@ class RunPeriodicallyOnRecordsMeetConditions implements ModelInterface, ArrayAcc public const DISCRIMINATOR = null; /** - * The original name of the model. - * - * @var string - */ + * The original name of the model. + * + * @var string + */ protected static $openAPIModelName = 'run_periodically_on_records_meet_conditions'; /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ protected static $openAPITypes = [ 'run_condition' => 'string', 'trigger' => '\SeaTable\Client\User\TriggerRunPeriodicallyOnRecordsMeetPerMonthTrigger', @@ -62,12 +62,12 @@ class RunPeriodicallyOnRecordsMeetConditions implements ModelInterface, ArrayAcc ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - * @phpstan-var array - * @psalm-var array - */ + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ protected static $openAPIFormats = [ 'run_condition' => null, 'trigger' => null, @@ -75,10 +75,10 @@ class RunPeriodicallyOnRecordsMeetConditions implements ModelInterface, ArrayAcc ]; /** - * Array of nullable properties. Used for (de)serialization - * - * @var boolean[] - */ + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ protected static array $openAPINullables = [ 'run_condition' => false, 'trigger' => false, @@ -86,10 +86,10 @@ class RunPeriodicallyOnRecordsMeetConditions implements ModelInterface, ArrayAcc ]; /** - * If a nullable field gets set to null, insert it here - * - * @var boolean[] - */ + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ protected array $openAPINullablesSetToNull = []; /** @@ -274,14 +274,14 @@ public function __construct(?array $data = null) } /** - * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName - * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the - * $this->openAPINullablesSetToNull array - * - * @param string $variableName - * @param array $fields - * @param mixed $defaultValue - */ + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ private function setIfExists(string $variableName, array $fields, $defaultValue): void { if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { diff --git a/lib/User/SearchGroup200ResponseInner.php b/lib/User/SearchGroup200ResponseInner.php index de4ab608..d5c1395f 100644 --- a/lib/User/SearchGroup200ResponseInner.php +++ b/lib/User/SearchGroup200ResponseInner.php @@ -44,17 +44,17 @@ class SearchGroup200ResponseInner implements ModelInterface, ArrayAccess, \JsonS public const DISCRIMINATOR = null; /** - * The original name of the model. - * - * @var string - */ + * The original name of the model. + * + * @var string + */ protected static $openAPIModelName = 'searchGroup_200_response_inner'; /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ protected static $openAPITypes = [ 'id' => 'int', 'name' => 'string', @@ -63,12 +63,12 @@ class SearchGroup200ResponseInner implements ModelInterface, ArrayAccess, \JsonS ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - * @phpstan-var array - * @psalm-var array - */ + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ protected static $openAPIFormats = [ 'id' => null, 'name' => null, @@ -77,10 +77,10 @@ class SearchGroup200ResponseInner implements ModelInterface, ArrayAccess, \JsonS ]; /** - * Array of nullable properties. Used for (de)serialization - * - * @var boolean[] - */ + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ protected static array $openAPINullables = [ 'id' => false, 'name' => false, @@ -89,10 +89,10 @@ class SearchGroup200ResponseInner implements ModelInterface, ArrayAccess, \JsonS ]; /** - * If a nullable field gets set to null, insert it here - * - * @var boolean[] - */ + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ protected array $openAPINullablesSetToNull = []; /** @@ -268,14 +268,14 @@ public function __construct(?array $data = null) } /** - * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName - * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the - * $this->openAPINullablesSetToNull array - * - * @param string $variableName - * @param array $fields - * @param mixed $defaultValue - */ + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ private function setIfExists(string $variableName, array $fields, $defaultValue): void { if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { diff --git a/lib/User/SharingApi.php b/lib/User/SharingApi.php index e8ff5591..d1b17f00 100644 --- a/lib/User/SharingApi.php +++ b/lib/User/SharingApi.php @@ -28,11 +28,11 @@ use GuzzleHttp\Client; use GuzzleHttp\ClientInterface; -use GuzzleHttp\Exception\ConnectException; use GuzzleHttp\Exception\RequestException; use GuzzleHttp\Psr7\MultipartStream; use GuzzleHttp\Psr7\Request; use GuzzleHttp\RequestOptions; +use Psr\Http\Client\NetworkExceptionInterface; use Psr\Http\Message\RequestInterface; use Psr\Http\Message\ResponseInterface; use SeaTable\Client\ApiException; @@ -238,13 +238,14 @@ public function createGroupShareWithHttpInfo($workspace_id, $base_name, $group_i try { $response = $this->client->send($request, $options); } catch (RequestException $e) { + $eResponse = $this->getExceptionResponse($e); throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), - $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? (string) $e->getResponse()->getBody() : null + $eResponse ? $eResponse->getHeaders() : null, + $eResponse ? (string) $eResponse->getBody() : null ); - } catch (ConnectException $e) { + } catch (NetworkExceptionInterface $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), @@ -365,7 +366,15 @@ function ($response) use ($returnType) { ]; }, function ($exception) { - $response = $exception->getResponse(); + $response = $this->getExceptionResponse($exception); + if ($response === null) { + throw new ApiException( + "[{$exception->getCode()}] {$exception->getMessage()}", + (int) $exception->getCode(), + null, + null + ); + } $statusCode = $response->getStatusCode(); throw new ApiException( sprintf( @@ -428,7 +437,7 @@ public function createGroupShareRequest($workspace_id, $base_name, $group_id = n // path params if ($workspace_id !== null) { $resourcePath = str_replace( - '{' . 'workspace_id' . '}', + '{workspace_id}', ObjectSerializer::toPathValue($workspace_id), $resourcePath ); @@ -436,7 +445,7 @@ public function createGroupShareRequest($workspace_id, $base_name, $group_id = n // path params if ($base_name !== null) { $resourcePath = str_replace( - '{' . 'base_name' . '}', + '{base_name}', ObjectSerializer::toPathValue($base_name), $resourcePath ); @@ -478,7 +487,11 @@ public function createGroupShareRequest($workspace_id, $base_name, $group_id = n } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + try { + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + } catch (\JsonException $e) { + throw new \InvalidArgumentException('json_encode error: ' . $e->getMessage(), 0, $e); + } } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -560,13 +573,14 @@ public function createGroupViewShareWithHttpInfo($workspace_id, $base_name, $tab try { $response = $this->client->send($request, $options); } catch (RequestException $e) { + $eResponse = $this->getExceptionResponse($e); throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), - $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? (string) $e->getResponse()->getBody() : null + $eResponse ? $eResponse->getHeaders() : null, + $eResponse ? (string) $eResponse->getBody() : null ); - } catch (ConnectException $e) { + } catch (NetworkExceptionInterface $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), @@ -691,7 +705,15 @@ function ($response) use ($returnType) { ]; }, function ($exception) { - $response = $exception->getResponse(); + $response = $this->getExceptionResponse($exception); + if ($response === null) { + throw new ApiException( + "[{$exception->getCode()}] {$exception->getMessage()}", + (int) $exception->getCode(), + null, + null + ); + } $statusCode = $response->getStatusCode(); throw new ApiException( sprintf( @@ -758,7 +780,7 @@ public function createGroupViewShareRequest($workspace_id, $base_name, $table_id // path params if ($workspace_id !== null) { $resourcePath = str_replace( - '{' . 'workspace_id' . '}', + '{workspace_id}', ObjectSerializer::toPathValue($workspace_id), $resourcePath ); @@ -766,7 +788,7 @@ public function createGroupViewShareRequest($workspace_id, $base_name, $table_id // path params if ($base_name !== null) { $resourcePath = str_replace( - '{' . 'base_name' . '}', + '{base_name}', ObjectSerializer::toPathValue($base_name), $resourcePath ); @@ -810,7 +832,11 @@ public function createGroupViewShareRequest($workspace_id, $base_name, $table_id } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + try { + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + } catch (\JsonException $e) { + throw new \InvalidArgumentException('json_encode error: ' . $e->getMessage(), 0, $e); + } } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -888,13 +914,14 @@ public function createUserShareWithHttpInfo($workspace_id, $base_name, $permissi try { $response = $this->client->send($request, $options); } catch (RequestException $e) { + $eResponse = $this->getExceptionResponse($e); throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), - $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? (string) $e->getResponse()->getBody() : null + $eResponse ? $eResponse->getHeaders() : null, + $eResponse ? (string) $eResponse->getBody() : null ); - } catch (ConnectException $e) { + } catch (NetworkExceptionInterface $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), @@ -1015,7 +1042,15 @@ function ($response) use ($returnType) { ]; }, function ($exception) { - $response = $exception->getResponse(); + $response = $this->getExceptionResponse($exception); + if ($response === null) { + throw new ApiException( + "[{$exception->getCode()}] {$exception->getMessage()}", + (int) $exception->getCode(), + null, + null + ); + } $statusCode = $response->getStatusCode(); throw new ApiException( sprintf( @@ -1078,7 +1113,7 @@ public function createUserShareRequest($workspace_id, $base_name, $permission = // path params if ($workspace_id !== null) { $resourcePath = str_replace( - '{' . 'workspace_id' . '}', + '{workspace_id}', ObjectSerializer::toPathValue($workspace_id), $resourcePath ); @@ -1086,7 +1121,7 @@ public function createUserShareRequest($workspace_id, $base_name, $permission = // path params if ($base_name !== null) { $resourcePath = str_replace( - '{' . 'base_name' . '}', + '{base_name}', ObjectSerializer::toPathValue($base_name), $resourcePath ); @@ -1127,7 +1162,11 @@ public function createUserShareRequest($workspace_id, $base_name, $permission = } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + try { + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + } catch (\JsonException $e) { + throw new \InvalidArgumentException('json_encode error: ' . $e->getMessage(), 0, $e); + } } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -1209,13 +1248,14 @@ public function createUserViewShareWithHttpInfo($workspace_id, $base_name, $perm try { $response = $this->client->send($request, $options); } catch (RequestException $e) { + $eResponse = $this->getExceptionResponse($e); throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), - $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? (string) $e->getResponse()->getBody() : null + $eResponse ? $eResponse->getHeaders() : null, + $eResponse ? (string) $eResponse->getBody() : null ); - } catch (ConnectException $e) { + } catch (NetworkExceptionInterface $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), @@ -1340,7 +1380,15 @@ function ($response) use ($returnType) { ]; }, function ($exception) { - $response = $exception->getResponse(); + $response = $this->getExceptionResponse($exception); + if ($response === null) { + throw new ApiException( + "[{$exception->getCode()}] {$exception->getMessage()}", + (int) $exception->getCode(), + null, + null + ); + } $statusCode = $response->getStatusCode(); throw new ApiException( sprintf( @@ -1407,7 +1455,7 @@ public function createUserViewShareRequest($workspace_id, $base_name, $permissio // path params if ($workspace_id !== null) { $resourcePath = str_replace( - '{' . 'workspace_id' . '}', + '{workspace_id}', ObjectSerializer::toPathValue($workspace_id), $resourcePath ); @@ -1415,7 +1463,7 @@ public function createUserViewShareRequest($workspace_id, $base_name, $permissio // path params if ($base_name !== null) { $resourcePath = str_replace( - '{' . 'base_name' . '}', + '{base_name}', ObjectSerializer::toPathValue($base_name), $resourcePath ); @@ -1458,7 +1506,11 @@ public function createUserViewShareRequest($workspace_id, $base_name, $permissio } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + try { + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + } catch (\JsonException $e) { + throw new \InvalidArgumentException('json_encode error: ' . $e->getMessage(), 0, $e); + } } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -1536,13 +1588,14 @@ public function deleteGroupAllViewShareWithHttpInfo($table_id, $view_id, $worksp try { $response = $this->client->send($request, $options); } catch (RequestException $e) { + $eResponse = $this->getExceptionResponse($e); throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), - $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? (string) $e->getResponse()->getBody() : null + $eResponse ? $eResponse->getHeaders() : null, + $eResponse ? (string) $eResponse->getBody() : null ); - } catch (ConnectException $e) { + } catch (NetworkExceptionInterface $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), @@ -1663,7 +1716,15 @@ function ($response) use ($returnType) { ]; }, function ($exception) { - $response = $exception->getResponse(); + $response = $this->getExceptionResponse($exception); + if ($response === null) { + throw new ApiException( + "[{$exception->getCode()}] {$exception->getMessage()}", + (int) $exception->getCode(), + null, + null + ); + } $statusCode = $response->getStatusCode(); throw new ApiException( sprintf( @@ -1762,7 +1823,7 @@ public function deleteGroupAllViewShareRequest($table_id, $view_id, $workspace_i // path params if ($workspace_id !== null) { $resourcePath = str_replace( - '{' . 'workspace_id' . '}', + '{workspace_id}', ObjectSerializer::toPathValue($workspace_id), $resourcePath ); @@ -1770,7 +1831,7 @@ public function deleteGroupAllViewShareRequest($table_id, $view_id, $workspace_i // path params if ($base_name !== null) { $resourcePath = str_replace( - '{' . 'base_name' . '}', + '{base_name}', ObjectSerializer::toPathValue($base_name), $resourcePath ); @@ -1801,7 +1862,11 @@ public function deleteGroupAllViewShareRequest($table_id, $view_id, $workspace_i } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + try { + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + } catch (\JsonException $e) { + throw new \InvalidArgumentException('json_encode error: ' . $e->getMessage(), 0, $e); + } } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -1877,13 +1942,14 @@ public function deleteGroupShareWithHttpInfo($workspace_id, $base_name, $group_i try { $response = $this->client->send($request, $options); } catch (RequestException $e) { + $eResponse = $this->getExceptionResponse($e); throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), - $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? (string) $e->getResponse()->getBody() : null + $eResponse ? $eResponse->getHeaders() : null, + $eResponse ? (string) $eResponse->getBody() : null ); - } catch (ConnectException $e) { + } catch (NetworkExceptionInterface $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), @@ -2002,7 +2068,15 @@ function ($response) use ($returnType) { ]; }, function ($exception) { - $response = $exception->getResponse(); + $response = $this->getExceptionResponse($exception); + if ($response === null) { + throw new ApiException( + "[{$exception->getCode()}] {$exception->getMessage()}", + (int) $exception->getCode(), + null, + null + ); + } $statusCode = $response->getStatusCode(); throw new ApiException( sprintf( @@ -2072,7 +2146,7 @@ public function deleteGroupShareRequest($workspace_id, $base_name, $group_id, st // path params if ($workspace_id !== null) { $resourcePath = str_replace( - '{' . 'workspace_id' . '}', + '{workspace_id}', ObjectSerializer::toPathValue($workspace_id), $resourcePath ); @@ -2080,7 +2154,7 @@ public function deleteGroupShareRequest($workspace_id, $base_name, $group_id, st // path params if ($base_name !== null) { $resourcePath = str_replace( - '{' . 'base_name' . '}', + '{base_name}', ObjectSerializer::toPathValue($base_name), $resourcePath ); @@ -2088,7 +2162,7 @@ public function deleteGroupShareRequest($workspace_id, $base_name, $group_id, st // path params if ($group_id !== null) { $resourcePath = str_replace( - '{' . 'group_id' . '}', + '{group_id}', ObjectSerializer::toPathValue($group_id), $resourcePath ); @@ -2119,7 +2193,11 @@ public function deleteGroupShareRequest($workspace_id, $base_name, $group_id, st } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + try { + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + } catch (\JsonException $e) { + throw new \InvalidArgumentException('json_encode error: ' . $e->getMessage(), 0, $e); + } } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -2195,13 +2273,14 @@ public function deleteGroupViewShareWithHttpInfo($workspace_id, $base_name, $gro try { $response = $this->client->send($request, $options); } catch (RequestException $e) { + $eResponse = $this->getExceptionResponse($e); throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), - $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? (string) $e->getResponse()->getBody() : null + $eResponse ? $eResponse->getHeaders() : null, + $eResponse ? (string) $eResponse->getBody() : null ); - } catch (ConnectException $e) { + } catch (NetworkExceptionInterface $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), @@ -2320,7 +2399,15 @@ function ($response) use ($returnType) { ]; }, function ($exception) { - $response = $exception->getResponse(); + $response = $this->getExceptionResponse($exception); + if ($response === null) { + throw new ApiException( + "[{$exception->getCode()}] {$exception->getMessage()}", + (int) $exception->getCode(), + null, + null + ); + } $statusCode = $response->getStatusCode(); throw new ApiException( sprintf( @@ -2390,7 +2477,7 @@ public function deleteGroupViewShareRequest($workspace_id, $base_name, $group_vi // path params if ($workspace_id !== null) { $resourcePath = str_replace( - '{' . 'workspace_id' . '}', + '{workspace_id}', ObjectSerializer::toPathValue($workspace_id), $resourcePath ); @@ -2398,7 +2485,7 @@ public function deleteGroupViewShareRequest($workspace_id, $base_name, $group_vi // path params if ($base_name !== null) { $resourcePath = str_replace( - '{' . 'base_name' . '}', + '{base_name}', ObjectSerializer::toPathValue($base_name), $resourcePath ); @@ -2406,7 +2493,7 @@ public function deleteGroupViewShareRequest($workspace_id, $base_name, $group_vi // path params if ($group_view_share_id !== null) { $resourcePath = str_replace( - '{' . 'group_view_share_id' . '}', + '{group_view_share_id}', ObjectSerializer::toPathValue($group_view_share_id), $resourcePath ); @@ -2437,7 +2524,11 @@ public function deleteGroupViewShareRequest($workspace_id, $base_name, $group_vi } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + try { + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + } catch (\JsonException $e) { + throw new \InvalidArgumentException('json_encode error: ' . $e->getMessage(), 0, $e); + } } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -2515,13 +2606,14 @@ public function deleteUserAllViewShareWithHttpInfo($table_id, $view_id, $workspa try { $response = $this->client->send($request, $options); } catch (RequestException $e) { + $eResponse = $this->getExceptionResponse($e); throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), - $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? (string) $e->getResponse()->getBody() : null + $eResponse ? $eResponse->getHeaders() : null, + $eResponse ? (string) $eResponse->getBody() : null ); - } catch (ConnectException $e) { + } catch (NetworkExceptionInterface $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), @@ -2642,7 +2734,15 @@ function ($response) use ($returnType) { ]; }, function ($exception) { - $response = $exception->getResponse(); + $response = $this->getExceptionResponse($exception); + if ($response === null) { + throw new ApiException( + "[{$exception->getCode()}] {$exception->getMessage()}", + (int) $exception->getCode(), + null, + null + ); + } $statusCode = $response->getStatusCode(); throw new ApiException( sprintf( @@ -2741,7 +2841,7 @@ public function deleteUserAllViewShareRequest($table_id, $view_id, $workspace_id // path params if ($workspace_id !== null) { $resourcePath = str_replace( - '{' . 'workspace_id' . '}', + '{workspace_id}', ObjectSerializer::toPathValue($workspace_id), $resourcePath ); @@ -2749,7 +2849,7 @@ public function deleteUserAllViewShareRequest($table_id, $view_id, $workspace_id // path params if ($base_name !== null) { $resourcePath = str_replace( - '{' . 'base_name' . '}', + '{base_name}', ObjectSerializer::toPathValue($base_name), $resourcePath ); @@ -2780,7 +2880,11 @@ public function deleteUserAllViewShareRequest($table_id, $view_id, $workspace_id } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + try { + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + } catch (\JsonException $e) { + throw new \InvalidArgumentException('json_encode error: ' . $e->getMessage(), 0, $e); + } } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -2856,13 +2960,14 @@ public function deleteUserShareWithHttpInfo($workspace_id, $base_name, $email, s try { $response = $this->client->send($request, $options); } catch (RequestException $e) { + $eResponse = $this->getExceptionResponse($e); throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), - $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? (string) $e->getResponse()->getBody() : null + $eResponse ? $eResponse->getHeaders() : null, + $eResponse ? (string) $eResponse->getBody() : null ); - } catch (ConnectException $e) { + } catch (NetworkExceptionInterface $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), @@ -2981,7 +3086,15 @@ function ($response) use ($returnType) { ]; }, function ($exception) { - $response = $exception->getResponse(); + $response = $this->getExceptionResponse($exception); + if ($response === null) { + throw new ApiException( + "[{$exception->getCode()}] {$exception->getMessage()}", + (int) $exception->getCode(), + null, + null + ); + } $statusCode = $response->getStatusCode(); throw new ApiException( sprintf( @@ -3048,7 +3161,7 @@ public function deleteUserShareRequest($workspace_id, $base_name, $email, string // path params if ($workspace_id !== null) { $resourcePath = str_replace( - '{' . 'workspace_id' . '}', + '{workspace_id}', ObjectSerializer::toPathValue($workspace_id), $resourcePath ); @@ -3056,7 +3169,7 @@ public function deleteUserShareRequest($workspace_id, $base_name, $email, string // path params if ($base_name !== null) { $resourcePath = str_replace( - '{' . 'base_name' . '}', + '{base_name}', ObjectSerializer::toPathValue($base_name), $resourcePath ); @@ -3096,7 +3209,11 @@ public function deleteUserShareRequest($workspace_id, $base_name, $email, string } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + try { + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + } catch (\JsonException $e) { + throw new \InvalidArgumentException('json_encode error: ' . $e->getMessage(), 0, $e); + } } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -3172,13 +3289,14 @@ public function deleteUserViewShareWithHttpInfo($workspace_id, $base_name, $user try { $response = $this->client->send($request, $options); } catch (RequestException $e) { + $eResponse = $this->getExceptionResponse($e); throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), - $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? (string) $e->getResponse()->getBody() : null + $eResponse ? $eResponse->getHeaders() : null, + $eResponse ? (string) $eResponse->getBody() : null ); - } catch (ConnectException $e) { + } catch (NetworkExceptionInterface $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), @@ -3297,7 +3415,15 @@ function ($response) use ($returnType) { ]; }, function ($exception) { - $response = $exception->getResponse(); + $response = $this->getExceptionResponse($exception); + if ($response === null) { + throw new ApiException( + "[{$exception->getCode()}] {$exception->getMessage()}", + (int) $exception->getCode(), + null, + null + ); + } $statusCode = $response->getStatusCode(); throw new ApiException( sprintf( @@ -3367,7 +3493,7 @@ public function deleteUserViewShareRequest($workspace_id, $base_name, $user_view // path params if ($workspace_id !== null) { $resourcePath = str_replace( - '{' . 'workspace_id' . '}', + '{workspace_id}', ObjectSerializer::toPathValue($workspace_id), $resourcePath ); @@ -3375,7 +3501,7 @@ public function deleteUserViewShareRequest($workspace_id, $base_name, $user_view // path params if ($base_name !== null) { $resourcePath = str_replace( - '{' . 'base_name' . '}', + '{base_name}', ObjectSerializer::toPathValue($base_name), $resourcePath ); @@ -3383,7 +3509,7 @@ public function deleteUserViewShareRequest($workspace_id, $base_name, $user_view // path params if ($user_view_share_id !== null) { $resourcePath = str_replace( - '{' . 'user_view_share_id' . '}', + '{user_view_share_id}', ObjectSerializer::toPathValue($user_view_share_id), $resourcePath ); @@ -3414,7 +3540,11 @@ public function deleteUserViewShareRequest($workspace_id, $base_name, $user_view } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + try { + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + } catch (\JsonException $e) { + throw new \InvalidArgumentException('json_encode error: ' . $e->getMessage(), 0, $e); + } } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -3486,13 +3616,14 @@ public function leaveSharedViewWithHttpInfo($user_view_share_id, string $content try { $response = $this->client->send($request, $options); } catch (RequestException $e) { + $eResponse = $this->getExceptionResponse($e); throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), - $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? (string) $e->getResponse()->getBody() : null + $eResponse ? $eResponse->getHeaders() : null, + $eResponse ? (string) $eResponse->getBody() : null ); - } catch (ConnectException $e) { + } catch (NetworkExceptionInterface $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), @@ -3607,7 +3738,15 @@ function ($response) use ($returnType) { ]; }, function ($exception) { - $response = $exception->getResponse(); + $response = $this->getExceptionResponse($exception); + if ($response === null) { + throw new ApiException( + "[{$exception->getCode()}] {$exception->getMessage()}", + (int) $exception->getCode(), + null, + null + ); + } $statusCode = $response->getStatusCode(); throw new ApiException( sprintf( @@ -3658,7 +3797,7 @@ public function leaveSharedViewRequest($user_view_share_id, string $contentType // path params if ($user_view_share_id !== null) { $resourcePath = str_replace( - '{' . 'user_view_share_id' . '}', + '{user_view_share_id}', ObjectSerializer::toPathValue($user_view_share_id), $resourcePath ); @@ -3689,7 +3828,11 @@ public function leaveSharedViewRequest($user_view_share_id, string $contentType } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + try { + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + } catch (\JsonException $e) { + throw new \InvalidArgumentException('json_encode error: ' . $e->getMessage(), 0, $e); + } } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -3763,13 +3906,14 @@ public function listCollaboratorsAsUserWithHttpInfo($workspace_id, $base_name, s try { $response = $this->client->send($request, $options); } catch (RequestException $e) { + $eResponse = $this->getExceptionResponse($e); throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), - $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? (string) $e->getResponse()->getBody() : null + $eResponse ? $eResponse->getHeaders() : null, + $eResponse ? (string) $eResponse->getBody() : null ); - } catch (ConnectException $e) { + } catch (NetworkExceptionInterface $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), @@ -3886,7 +4030,15 @@ function ($response) use ($returnType) { ]; }, function ($exception) { - $response = $exception->getResponse(); + $response = $this->getExceptionResponse($exception); + if ($response === null) { + throw new ApiException( + "[{$exception->getCode()}] {$exception->getMessage()}", + (int) $exception->getCode(), + null, + null + ); + } $statusCode = $response->getStatusCode(); throw new ApiException( sprintf( @@ -3945,7 +4097,7 @@ public function listCollaboratorsAsUserRequest($workspace_id, $base_name, string // path params if ($workspace_id !== null) { $resourcePath = str_replace( - '{' . 'workspace_id' . '}', + '{workspace_id}', ObjectSerializer::toPathValue($workspace_id), $resourcePath ); @@ -3953,7 +4105,7 @@ public function listCollaboratorsAsUserRequest($workspace_id, $base_name, string // path params if ($base_name !== null) { $resourcePath = str_replace( - '{' . 'base_name' . '}', + '{base_name}', ObjectSerializer::toPathValue($base_name), $resourcePath ); @@ -3984,7 +4136,11 @@ public function listCollaboratorsAsUserRequest($workspace_id, $base_name, string } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + try { + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + } catch (\JsonException $e) { + throw new \InvalidArgumentException('json_encode error: ' . $e->getMessage(), 0, $e); + } } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -4058,13 +4214,14 @@ public function listGroupSharesWithHttpInfo($workspace_id, $base_name, string $c try { $response = $this->client->send($request, $options); } catch (RequestException $e) { + $eResponse = $this->getExceptionResponse($e); throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), - $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? (string) $e->getResponse()->getBody() : null + $eResponse ? $eResponse->getHeaders() : null, + $eResponse ? (string) $eResponse->getBody() : null ); - } catch (ConnectException $e) { + } catch (NetworkExceptionInterface $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), @@ -4181,7 +4338,15 @@ function ($response) use ($returnType) { ]; }, function ($exception) { - $response = $exception->getResponse(); + $response = $this->getExceptionResponse($exception); + if ($response === null) { + throw new ApiException( + "[{$exception->getCode()}] {$exception->getMessage()}", + (int) $exception->getCode(), + null, + null + ); + } $statusCode = $response->getStatusCode(); throw new ApiException( sprintf( @@ -4240,7 +4405,7 @@ public function listGroupSharesRequest($workspace_id, $base_name, string $conten // path params if ($workspace_id !== null) { $resourcePath = str_replace( - '{' . 'workspace_id' . '}', + '{workspace_id}', ObjectSerializer::toPathValue($workspace_id), $resourcePath ); @@ -4248,7 +4413,7 @@ public function listGroupSharesRequest($workspace_id, $base_name, string $conten // path params if ($base_name !== null) { $resourcePath = str_replace( - '{' . 'base_name' . '}', + '{base_name}', ObjectSerializer::toPathValue($base_name), $resourcePath ); @@ -4279,7 +4444,11 @@ public function listGroupSharesRequest($workspace_id, $base_name, string $conten } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + try { + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + } catch (\JsonException $e) { + throw new \InvalidArgumentException('json_encode error: ' . $e->getMessage(), 0, $e); + } } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -4353,13 +4522,14 @@ public function listGroupViewSharesWithHttpInfo($workspace_id, $base_name, strin try { $response = $this->client->send($request, $options); } catch (RequestException $e) { + $eResponse = $this->getExceptionResponse($e); throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), - $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? (string) $e->getResponse()->getBody() : null + $eResponse ? $eResponse->getHeaders() : null, + $eResponse ? (string) $eResponse->getBody() : null ); - } catch (ConnectException $e) { + } catch (NetworkExceptionInterface $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), @@ -4476,7 +4646,15 @@ function ($response) use ($returnType) { ]; }, function ($exception) { - $response = $exception->getResponse(); + $response = $this->getExceptionResponse($exception); + if ($response === null) { + throw new ApiException( + "[{$exception->getCode()}] {$exception->getMessage()}", + (int) $exception->getCode(), + null, + null + ); + } $statusCode = $response->getStatusCode(); throw new ApiException( sprintf( @@ -4535,7 +4713,7 @@ public function listGroupViewSharesRequest($workspace_id, $base_name, string $co // path params if ($workspace_id !== null) { $resourcePath = str_replace( - '{' . 'workspace_id' . '}', + '{workspace_id}', ObjectSerializer::toPathValue($workspace_id), $resourcePath ); @@ -4543,7 +4721,7 @@ public function listGroupViewSharesRequest($workspace_id, $base_name, string $co // path params if ($base_name !== null) { $resourcePath = str_replace( - '{' . 'base_name' . '}', + '{base_name}', ObjectSerializer::toPathValue($base_name), $resourcePath ); @@ -4574,7 +4752,11 @@ public function listGroupViewSharesRequest($workspace_id, $base_name, string $co } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + try { + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + } catch (\JsonException $e) { + throw new \InvalidArgumentException('json_encode error: ' . $e->getMessage(), 0, $e); + } } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -4644,13 +4826,14 @@ public function listMyGroupSharesWithHttpInfo(string $contentType = self::conten try { $response = $this->client->send($request, $options); } catch (RequestException $e) { + $eResponse = $this->getExceptionResponse($e); throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), - $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? (string) $e->getResponse()->getBody() : null + $eResponse ? $eResponse->getHeaders() : null, + $eResponse ? (string) $eResponse->getBody() : null ); - } catch (ConnectException $e) { + } catch (NetworkExceptionInterface $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), @@ -4763,7 +4946,15 @@ function ($response) use ($returnType) { ]; }, function ($exception) { - $response = $exception->getResponse(); + $response = $this->getExceptionResponse($exception); + if ($response === null) { + throw new ApiException( + "[{$exception->getCode()}] {$exception->getMessage()}", + (int) $exception->getCode(), + null, + null + ); + } $statusCode = $response->getStatusCode(); throw new ApiException( sprintf( @@ -4826,7 +5017,11 @@ public function listMyGroupSharesRequest(string $contentType = self::contentType } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + try { + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + } catch (\JsonException $e) { + throw new \InvalidArgumentException('json_encode error: ' . $e->getMessage(), 0, $e); + } } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -4896,13 +5091,14 @@ public function listMyGroupViewSharesWithHttpInfo(string $contentType = self::co try { $response = $this->client->send($request, $options); } catch (RequestException $e) { + $eResponse = $this->getExceptionResponse($e); throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), - $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? (string) $e->getResponse()->getBody() : null + $eResponse ? $eResponse->getHeaders() : null, + $eResponse ? (string) $eResponse->getBody() : null ); - } catch (ConnectException $e) { + } catch (NetworkExceptionInterface $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), @@ -5015,7 +5211,15 @@ function ($response) use ($returnType) { ]; }, function ($exception) { - $response = $exception->getResponse(); + $response = $this->getExceptionResponse($exception); + if ($response === null) { + throw new ApiException( + "[{$exception->getCode()}] {$exception->getMessage()}", + (int) $exception->getCode(), + null, + null + ); + } $statusCode = $response->getStatusCode(); throw new ApiException( sprintf( @@ -5078,7 +5282,11 @@ public function listMyGroupViewSharesRequest(string $contentType = self::content } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + try { + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + } catch (\JsonException $e) { + throw new \InvalidArgumentException('json_encode error: ' . $e->getMessage(), 0, $e); + } } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -5148,13 +5356,14 @@ public function listMySharesWithHttpInfo(string $contentType = self::contentType try { $response = $this->client->send($request, $options); } catch (RequestException $e) { + $eResponse = $this->getExceptionResponse($e); throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), - $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? (string) $e->getResponse()->getBody() : null + $eResponse ? $eResponse->getHeaders() : null, + $eResponse ? (string) $eResponse->getBody() : null ); - } catch (ConnectException $e) { + } catch (NetworkExceptionInterface $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), @@ -5267,7 +5476,15 @@ function ($response) use ($returnType) { ]; }, function ($exception) { - $response = $exception->getResponse(); + $response = $this->getExceptionResponse($exception); + if ($response === null) { + throw new ApiException( + "[{$exception->getCode()}] {$exception->getMessage()}", + (int) $exception->getCode(), + null, + null + ); + } $statusCode = $response->getStatusCode(); throw new ApiException( sprintf( @@ -5330,7 +5547,11 @@ public function listMySharesRequest(string $contentType = self::contentTypes['li } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + try { + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + } catch (\JsonException $e) { + throw new \InvalidArgumentException('json_encode error: ' . $e->getMessage(), 0, $e); + } } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -5400,13 +5621,14 @@ public function listMyUserViewSharesWithHttpInfo(string $contentType = self::con try { $response = $this->client->send($request, $options); } catch (RequestException $e) { + $eResponse = $this->getExceptionResponse($e); throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), - $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? (string) $e->getResponse()->getBody() : null + $eResponse ? $eResponse->getHeaders() : null, + $eResponse ? (string) $eResponse->getBody() : null ); - } catch (ConnectException $e) { + } catch (NetworkExceptionInterface $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), @@ -5519,7 +5741,15 @@ function ($response) use ($returnType) { ]; }, function ($exception) { - $response = $exception->getResponse(); + $response = $this->getExceptionResponse($exception); + if ($response === null) { + throw new ApiException( + "[{$exception->getCode()}] {$exception->getMessage()}", + (int) $exception->getCode(), + null, + null + ); + } $statusCode = $response->getStatusCode(); throw new ApiException( sprintf( @@ -5582,7 +5812,11 @@ public function listMyUserViewSharesRequest(string $contentType = self::contentT } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + try { + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + } catch (\JsonException $e) { + throw new \InvalidArgumentException('json_encode error: ' . $e->getMessage(), 0, $e); + } } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -5656,13 +5890,14 @@ public function listUserSharesWithHttpInfo($workspace_id, $base_name, string $co try { $response = $this->client->send($request, $options); } catch (RequestException $e) { + $eResponse = $this->getExceptionResponse($e); throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), - $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? (string) $e->getResponse()->getBody() : null + $eResponse ? $eResponse->getHeaders() : null, + $eResponse ? (string) $eResponse->getBody() : null ); - } catch (ConnectException $e) { + } catch (NetworkExceptionInterface $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), @@ -5779,7 +6014,15 @@ function ($response) use ($returnType) { ]; }, function ($exception) { - $response = $exception->getResponse(); + $response = $this->getExceptionResponse($exception); + if ($response === null) { + throw new ApiException( + "[{$exception->getCode()}] {$exception->getMessage()}", + (int) $exception->getCode(), + null, + null + ); + } $statusCode = $response->getStatusCode(); throw new ApiException( sprintf( @@ -5838,7 +6081,7 @@ public function listUserSharesRequest($workspace_id, $base_name, string $content // path params if ($workspace_id !== null) { $resourcePath = str_replace( - '{' . 'workspace_id' . '}', + '{workspace_id}', ObjectSerializer::toPathValue($workspace_id), $resourcePath ); @@ -5846,7 +6089,7 @@ public function listUserSharesRequest($workspace_id, $base_name, string $content // path params if ($base_name !== null) { $resourcePath = str_replace( - '{' . 'base_name' . '}', + '{base_name}', ObjectSerializer::toPathValue($base_name), $resourcePath ); @@ -5877,7 +6120,11 @@ public function listUserSharesRequest($workspace_id, $base_name, string $content } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + try { + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + } catch (\JsonException $e) { + throw new \InvalidArgumentException('json_encode error: ' . $e->getMessage(), 0, $e); + } } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -5951,13 +6198,14 @@ public function listUserViewSharesWithHttpInfo($workspace_id, $base_name, string try { $response = $this->client->send($request, $options); } catch (RequestException $e) { + $eResponse = $this->getExceptionResponse($e); throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), - $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? (string) $e->getResponse()->getBody() : null + $eResponse ? $eResponse->getHeaders() : null, + $eResponse ? (string) $eResponse->getBody() : null ); - } catch (ConnectException $e) { + } catch (NetworkExceptionInterface $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), @@ -6074,7 +6322,15 @@ function ($response) use ($returnType) { ]; }, function ($exception) { - $response = $exception->getResponse(); + $response = $this->getExceptionResponse($exception); + if ($response === null) { + throw new ApiException( + "[{$exception->getCode()}] {$exception->getMessage()}", + (int) $exception->getCode(), + null, + null + ); + } $statusCode = $response->getStatusCode(); throw new ApiException( sprintf( @@ -6133,7 +6389,7 @@ public function listUserViewSharesRequest($workspace_id, $base_name, string $con // path params if ($workspace_id !== null) { $resourcePath = str_replace( - '{' . 'workspace_id' . '}', + '{workspace_id}', ObjectSerializer::toPathValue($workspace_id), $resourcePath ); @@ -6141,7 +6397,7 @@ public function listUserViewSharesRequest($workspace_id, $base_name, string $con // path params if ($base_name !== null) { $resourcePath = str_replace( - '{' . 'base_name' . '}', + '{base_name}', ObjectSerializer::toPathValue($base_name), $resourcePath ); @@ -6172,7 +6428,11 @@ public function listUserViewSharesRequest($workspace_id, $base_name, string $con } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + try { + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + } catch (\JsonException $e) { + throw new \InvalidArgumentException('json_encode error: ' . $e->getMessage(), 0, $e); + } } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -6250,13 +6510,14 @@ public function updateGroupShareWithHttpInfo($workspace_id, $base_name, $group_i try { $response = $this->client->send($request, $options); } catch (RequestException $e) { + $eResponse = $this->getExceptionResponse($e); throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), - $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? (string) $e->getResponse()->getBody() : null + $eResponse ? $eResponse->getHeaders() : null, + $eResponse ? (string) $eResponse->getBody() : null ); - } catch (ConnectException $e) { + } catch (NetworkExceptionInterface $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), @@ -6377,7 +6638,15 @@ function ($response) use ($returnType) { ]; }, function ($exception) { - $response = $exception->getResponse(); + $response = $this->getExceptionResponse($exception); + if ($response === null) { + throw new ApiException( + "[{$exception->getCode()}] {$exception->getMessage()}", + (int) $exception->getCode(), + null, + null + ); + } $statusCode = $response->getStatusCode(); throw new ApiException( sprintf( @@ -6449,7 +6718,7 @@ public function updateGroupShareRequest($workspace_id, $base_name, $group_id, $p // path params if ($workspace_id !== null) { $resourcePath = str_replace( - '{' . 'workspace_id' . '}', + '{workspace_id}', ObjectSerializer::toPathValue($workspace_id), $resourcePath ); @@ -6457,7 +6726,7 @@ public function updateGroupShareRequest($workspace_id, $base_name, $group_id, $p // path params if ($base_name !== null) { $resourcePath = str_replace( - '{' . 'base_name' . '}', + '{base_name}', ObjectSerializer::toPathValue($base_name), $resourcePath ); @@ -6465,7 +6734,7 @@ public function updateGroupShareRequest($workspace_id, $base_name, $group_id, $p // path params if ($group_id !== null) { $resourcePath = str_replace( - '{' . 'group_id' . '}', + '{group_id}', ObjectSerializer::toPathValue($group_id), $resourcePath ); @@ -6506,7 +6775,11 @@ public function updateGroupShareRequest($workspace_id, $base_name, $group_id, $p } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + try { + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + } catch (\JsonException $e) { + throw new \InvalidArgumentException('json_encode error: ' . $e->getMessage(), 0, $e); + } } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -6584,13 +6857,14 @@ public function updateGroupViewShareWithHttpInfo($workspace_id, $base_name, $gro try { $response = $this->client->send($request, $options); } catch (RequestException $e) { + $eResponse = $this->getExceptionResponse($e); throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), - $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? (string) $e->getResponse()->getBody() : null + $eResponse ? $eResponse->getHeaders() : null, + $eResponse ? (string) $eResponse->getBody() : null ); - } catch (ConnectException $e) { + } catch (NetworkExceptionInterface $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), @@ -6711,7 +6985,15 @@ function ($response) use ($returnType) { ]; }, function ($exception) { - $response = $exception->getResponse(); + $response = $this->getExceptionResponse($exception); + if ($response === null) { + throw new ApiException( + "[{$exception->getCode()}] {$exception->getMessage()}", + (int) $exception->getCode(), + null, + null + ); + } $statusCode = $response->getStatusCode(); throw new ApiException( sprintf( @@ -6783,7 +7065,7 @@ public function updateGroupViewShareRequest($workspace_id, $base_name, $group_vi // path params if ($workspace_id !== null) { $resourcePath = str_replace( - '{' . 'workspace_id' . '}', + '{workspace_id}', ObjectSerializer::toPathValue($workspace_id), $resourcePath ); @@ -6791,7 +7073,7 @@ public function updateGroupViewShareRequest($workspace_id, $base_name, $group_vi // path params if ($base_name !== null) { $resourcePath = str_replace( - '{' . 'base_name' . '}', + '{base_name}', ObjectSerializer::toPathValue($base_name), $resourcePath ); @@ -6799,7 +7081,7 @@ public function updateGroupViewShareRequest($workspace_id, $base_name, $group_vi // path params if ($group_view_share_id !== null) { $resourcePath = str_replace( - '{' . 'group_view_share_id' . '}', + '{group_view_share_id}', ObjectSerializer::toPathValue($group_view_share_id), $resourcePath ); @@ -6839,7 +7121,11 @@ public function updateGroupViewShareRequest($workspace_id, $base_name, $group_vi } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + try { + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + } catch (\JsonException $e) { + throw new \InvalidArgumentException('json_encode error: ' . $e->getMessage(), 0, $e); + } } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -6917,13 +7203,14 @@ public function updateUserShareWithHttpInfo($workspace_id, $base_name, $permissi try { $response = $this->client->send($request, $options); } catch (RequestException $e) { + $eResponse = $this->getExceptionResponse($e); throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), - $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? (string) $e->getResponse()->getBody() : null + $eResponse ? $eResponse->getHeaders() : null, + $eResponse ? (string) $eResponse->getBody() : null ); - } catch (ConnectException $e) { + } catch (NetworkExceptionInterface $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), @@ -7044,7 +7331,15 @@ function ($response) use ($returnType) { ]; }, function ($exception) { - $response = $exception->getResponse(); + $response = $this->getExceptionResponse($exception); + if ($response === null) { + throw new ApiException( + "[{$exception->getCode()}] {$exception->getMessage()}", + (int) $exception->getCode(), + null, + null + ); + } $statusCode = $response->getStatusCode(); throw new ApiException( sprintf( @@ -7107,7 +7402,7 @@ public function updateUserShareRequest($workspace_id, $base_name, $permission = // path params if ($workspace_id !== null) { $resourcePath = str_replace( - '{' . 'workspace_id' . '}', + '{workspace_id}', ObjectSerializer::toPathValue($workspace_id), $resourcePath ); @@ -7115,7 +7410,7 @@ public function updateUserShareRequest($workspace_id, $base_name, $permission = // path params if ($base_name !== null) { $resourcePath = str_replace( - '{' . 'base_name' . '}', + '{base_name}', ObjectSerializer::toPathValue($base_name), $resourcePath ); @@ -7156,7 +7451,11 @@ public function updateUserShareRequest($workspace_id, $base_name, $permission = } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + try { + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + } catch (\JsonException $e) { + throw new \InvalidArgumentException('json_encode error: ' . $e->getMessage(), 0, $e); + } } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -7234,13 +7533,14 @@ public function updateUserViewShareWithHttpInfo($workspace_id, $base_name, $user try { $response = $this->client->send($request, $options); } catch (RequestException $e) { + $eResponse = $this->getExceptionResponse($e); throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), - $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? (string) $e->getResponse()->getBody() : null + $eResponse ? $eResponse->getHeaders() : null, + $eResponse ? (string) $eResponse->getBody() : null ); - } catch (ConnectException $e) { + } catch (NetworkExceptionInterface $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), @@ -7361,7 +7661,15 @@ function ($response) use ($returnType) { ]; }, function ($exception) { - $response = $exception->getResponse(); + $response = $this->getExceptionResponse($exception); + if ($response === null) { + throw new ApiException( + "[{$exception->getCode()}] {$exception->getMessage()}", + (int) $exception->getCode(), + null, + null + ); + } $statusCode = $response->getStatusCode(); throw new ApiException( sprintf( @@ -7433,7 +7741,7 @@ public function updateUserViewShareRequest($workspace_id, $base_name, $user_view // path params if ($workspace_id !== null) { $resourcePath = str_replace( - '{' . 'workspace_id' . '}', + '{workspace_id}', ObjectSerializer::toPathValue($workspace_id), $resourcePath ); @@ -7441,7 +7749,7 @@ public function updateUserViewShareRequest($workspace_id, $base_name, $user_view // path params if ($base_name !== null) { $resourcePath = str_replace( - '{' . 'base_name' . '}', + '{base_name}', ObjectSerializer::toPathValue($base_name), $resourcePath ); @@ -7449,7 +7757,7 @@ public function updateUserViewShareRequest($workspace_id, $base_name, $user_view // path params if ($user_view_share_id !== null) { $resourcePath = str_replace( - '{' . 'user_view_share_id' . '}', + '{user_view_share_id}', ObjectSerializer::toPathValue($user_view_share_id), $resourcePath ); @@ -7489,7 +7797,11 @@ public function updateUserViewShareRequest($workspace_id, $base_name, $user_view } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + try { + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + } catch (\JsonException $e) { + throw new \InvalidArgumentException('json_encode error: ' . $e->getMessage(), 0, $e); + } } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -7549,6 +7861,21 @@ protected function createHttpClientOption() return $options; } + /** + * Returns the response attached to a Guzzle exception, if there is one. + * + * Guzzle 7 exposes getResponse() on RequestException, while Guzzle 8 only + * exposes it on ResponseException and its subclasses. + * + * @param \Throwable $exception + * + * @return ResponseInterface|null + */ + private function getExceptionResponse(\Throwable $exception): ?ResponseInterface + { + return method_exists($exception, 'getResponse') ? $exception->getResponse() : null; + } + private function handleResponseWithDataType( string $dataType, RequestInterface $request, diff --git a/lib/User/SharingLinksApi.php b/lib/User/SharingLinksApi.php index 4496f70b..96c48e75 100644 --- a/lib/User/SharingLinksApi.php +++ b/lib/User/SharingLinksApi.php @@ -28,11 +28,11 @@ use GuzzleHttp\Client; use GuzzleHttp\ClientInterface; -use GuzzleHttp\Exception\ConnectException; use GuzzleHttp\Exception\RequestException; use GuzzleHttp\Psr7\MultipartStream; use GuzzleHttp\Psr7\Request; use GuzzleHttp\RequestOptions; +use Psr\Http\Client\NetworkExceptionInterface; use Psr\Http\Message\RequestInterface; use Psr\Http\Message\ResponseInterface; use SeaTable\Client\ApiException; @@ -192,13 +192,14 @@ public function createBaseExternalLinkWithHttpInfo($workspace_id, $base_name, $p try { $response = $this->client->send($request, $options); } catch (RequestException $e) { + $eResponse = $this->getExceptionResponse($e); throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), - $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? (string) $e->getResponse()->getBody() : null + $eResponse ? $eResponse->getHeaders() : null, + $eResponse ? (string) $eResponse->getBody() : null ); - } catch (ConnectException $e) { + } catch (NetworkExceptionInterface $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), @@ -321,7 +322,15 @@ function ($response) use ($returnType) { ]; }, function ($exception) { - $response = $exception->getResponse(); + $response = $this->getExceptionResponse($exception); + if ($response === null) { + throw new ApiException( + "[{$exception->getCode()}] {$exception->getMessage()}", + (int) $exception->getCode(), + null, + null + ); + } $statusCode = $response->getStatusCode(); throw new ApiException( sprintf( @@ -386,7 +395,7 @@ public function createBaseExternalLinkRequest($workspace_id, $base_name, $passwo // path params if ($workspace_id !== null) { $resourcePath = str_replace( - '{' . 'workspace_id' . '}', + '{workspace_id}', ObjectSerializer::toPathValue($workspace_id), $resourcePath ); @@ -394,7 +403,7 @@ public function createBaseExternalLinkRequest($workspace_id, $base_name, $passwo // path params if ($base_name !== null) { $resourcePath = str_replace( - '{' . 'base_name' . '}', + '{base_name}', ObjectSerializer::toPathValue($base_name), $resourcePath ); @@ -437,7 +446,11 @@ public function createBaseExternalLinkRequest($workspace_id, $base_name, $passwo } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + try { + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + } catch (\JsonException $e) { + throw new \InvalidArgumentException('json_encode error: ' . $e->getMessage(), 0, $e); + } } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -517,13 +530,14 @@ public function createInviteLinkWithHttpInfo($table_name = null, $workspace_id = try { $response = $this->client->send($request, $options); } catch (RequestException $e) { + $eResponse = $this->getExceptionResponse($e); throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), - $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? (string) $e->getResponse()->getBody() : null + $eResponse ? $eResponse->getHeaders() : null, + $eResponse ? (string) $eResponse->getBody() : null ); - } catch (ConnectException $e) { + } catch (NetworkExceptionInterface $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), @@ -646,7 +660,15 @@ function ($response) use ($returnType) { ]; }, function ($exception) { - $response = $exception->getResponse(); + $response = $this->getExceptionResponse($exception); + if ($response === null) { + throw new ApiException( + "[{$exception->getCode()}] {$exception->getMessage()}", + (int) $exception->getCode(), + null, + null + ); + } $statusCode = $response->getStatusCode(); throw new ApiException( sprintf( @@ -733,7 +755,11 @@ public function createInviteLinkRequest($table_name = null, $workspace_id = null } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + try { + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + } catch (\JsonException $e) { + throw new \InvalidArgumentException('json_encode error: ' . $e->getMessage(), 0, $e); + } } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -817,13 +843,14 @@ public function createViewExternalLinkWithHttpInfo($workspace_id, $base_name, $t try { $response = $this->client->send($request, $options); } catch (RequestException $e) { + $eResponse = $this->getExceptionResponse($e); throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), - $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? (string) $e->getResponse()->getBody() : null + $eResponse ? $eResponse->getHeaders() : null, + $eResponse ? (string) $eResponse->getBody() : null ); - } catch (ConnectException $e) { + } catch (NetworkExceptionInterface $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), @@ -950,7 +977,15 @@ function ($response) use ($returnType) { ]; }, function ($exception) { - $response = $exception->getResponse(); + $response = $this->getExceptionResponse($exception); + if ($response === null) { + throw new ApiException( + "[{$exception->getCode()}] {$exception->getMessage()}", + (int) $exception->getCode(), + null, + null + ); + } $statusCode = $response->getStatusCode(); throw new ApiException( sprintf( @@ -1019,7 +1054,7 @@ public function createViewExternalLinkRequest($workspace_id, $base_name, $table_ // path params if ($workspace_id !== null) { $resourcePath = str_replace( - '{' . 'workspace_id' . '}', + '{workspace_id}', ObjectSerializer::toPathValue($workspace_id), $resourcePath ); @@ -1027,7 +1062,7 @@ public function createViewExternalLinkRequest($workspace_id, $base_name, $table_ // path params if ($base_name !== null) { $resourcePath = str_replace( - '{' . 'base_name' . '}', + '{base_name}', ObjectSerializer::toPathValue($base_name), $resourcePath ); @@ -1072,7 +1107,11 @@ public function createViewExternalLinkRequest($workspace_id, $base_name, $table_ } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + try { + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + } catch (\JsonException $e) { + throw new \InvalidArgumentException('json_encode error: ' . $e->getMessage(), 0, $e); + } } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -1148,13 +1187,14 @@ public function deleteExternalLinkWithHttpInfo($workspace_id, $base_name, $exter try { $response = $this->client->send($request, $options); } catch (RequestException $e) { + $eResponse = $this->getExceptionResponse($e); throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), - $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? (string) $e->getResponse()->getBody() : null + $eResponse ? $eResponse->getHeaders() : null, + $eResponse ? (string) $eResponse->getBody() : null ); - } catch (ConnectException $e) { + } catch (NetworkExceptionInterface $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), @@ -1273,7 +1313,15 @@ function ($response) use ($returnType) { ]; }, function ($exception) { - $response = $exception->getResponse(); + $response = $this->getExceptionResponse($exception); + if ($response === null) { + throw new ApiException( + "[{$exception->getCode()}] {$exception->getMessage()}", + (int) $exception->getCode(), + null, + null + ); + } $statusCode = $response->getStatusCode(); throw new ApiException( sprintf( @@ -1340,7 +1388,7 @@ public function deleteExternalLinkRequest($workspace_id, $base_name, $external_l // path params if ($workspace_id !== null) { $resourcePath = str_replace( - '{' . 'workspace_id' . '}', + '{workspace_id}', ObjectSerializer::toPathValue($workspace_id), $resourcePath ); @@ -1348,7 +1396,7 @@ public function deleteExternalLinkRequest($workspace_id, $base_name, $external_l // path params if ($base_name !== null) { $resourcePath = str_replace( - '{' . 'base_name' . '}', + '{base_name}', ObjectSerializer::toPathValue($base_name), $resourcePath ); @@ -1356,7 +1404,7 @@ public function deleteExternalLinkRequest($workspace_id, $base_name, $external_l // path params if ($external_link_token !== null) { $resourcePath = str_replace( - '{' . 'external_link_token' . '}', + '{external_link_token}', ObjectSerializer::toPathValue($external_link_token), $resourcePath ); @@ -1387,7 +1435,11 @@ public function deleteExternalLinkRequest($workspace_id, $base_name, $external_l } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + try { + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + } catch (\JsonException $e) { + throw new \InvalidArgumentException('json_encode error: ' . $e->getMessage(), 0, $e); + } } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -1459,13 +1511,14 @@ public function deleteInviteLinkWithHttpInfo($invite_link_token, string $content try { $response = $this->client->send($request, $options); } catch (RequestException $e) { + $eResponse = $this->getExceptionResponse($e); throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), - $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? (string) $e->getResponse()->getBody() : null + $eResponse ? $eResponse->getHeaders() : null, + $eResponse ? (string) $eResponse->getBody() : null ); - } catch (ConnectException $e) { + } catch (NetworkExceptionInterface $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), @@ -1580,7 +1633,15 @@ function ($response) use ($returnType) { ]; }, function ($exception) { - $response = $exception->getResponse(); + $response = $this->getExceptionResponse($exception); + if ($response === null) { + throw new ApiException( + "[{$exception->getCode()}] {$exception->getMessage()}", + (int) $exception->getCode(), + null, + null + ); + } $statusCode = $response->getStatusCode(); throw new ApiException( sprintf( @@ -1631,7 +1692,7 @@ public function deleteInviteLinkRequest($invite_link_token, string $contentType // path params if ($invite_link_token !== null) { $resourcePath = str_replace( - '{' . 'invite_link_token' . '}', + '{invite_link_token}', ObjectSerializer::toPathValue($invite_link_token), $resourcePath ); @@ -1662,7 +1723,11 @@ public function deleteInviteLinkRequest($invite_link_token, string $contentType } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + try { + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + } catch (\JsonException $e) { + throw new \InvalidArgumentException('json_encode error: ' . $e->getMessage(), 0, $e); + } } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -1738,13 +1803,14 @@ public function deleteViewExternalLinkWithHttpInfo($workspace_id, $base_name, $v try { $response = $this->client->send($request, $options); } catch (RequestException $e) { + $eResponse = $this->getExceptionResponse($e); throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), - $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? (string) $e->getResponse()->getBody() : null + $eResponse ? $eResponse->getHeaders() : null, + $eResponse ? (string) $eResponse->getBody() : null ); - } catch (ConnectException $e) { + } catch (NetworkExceptionInterface $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), @@ -1863,7 +1929,15 @@ function ($response) use ($returnType) { ]; }, function ($exception) { - $response = $exception->getResponse(); + $response = $this->getExceptionResponse($exception); + if ($response === null) { + throw new ApiException( + "[{$exception->getCode()}] {$exception->getMessage()}", + (int) $exception->getCode(), + null, + null + ); + } $statusCode = $response->getStatusCode(); throw new ApiException( sprintf( @@ -1930,7 +2004,7 @@ public function deleteViewExternalLinkRequest($workspace_id, $base_name, $view_e // path params if ($workspace_id !== null) { $resourcePath = str_replace( - '{' . 'workspace_id' . '}', + '{workspace_id}', ObjectSerializer::toPathValue($workspace_id), $resourcePath ); @@ -1938,7 +2012,7 @@ public function deleteViewExternalLinkRequest($workspace_id, $base_name, $view_e // path params if ($base_name !== null) { $resourcePath = str_replace( - '{' . 'base_name' . '}', + '{base_name}', ObjectSerializer::toPathValue($base_name), $resourcePath ); @@ -1946,7 +2020,7 @@ public function deleteViewExternalLinkRequest($workspace_id, $base_name, $view_e // path params if ($view_external_link_token !== null) { $resourcePath = str_replace( - '{' . 'view_external_link_token' . '}', + '{view_external_link_token}', ObjectSerializer::toPathValue($view_external_link_token), $resourcePath ); @@ -1977,7 +2051,11 @@ public function deleteViewExternalLinkRequest($workspace_id, $base_name, $view_e } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + try { + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + } catch (\JsonException $e) { + throw new \InvalidArgumentException('json_encode error: ' . $e->getMessage(), 0, $e); + } } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -2051,13 +2129,14 @@ public function listBaseExternalLinksWithHttpInfo($workspace_id, $base_name, str try { $response = $this->client->send($request, $options); } catch (RequestException $e) { + $eResponse = $this->getExceptionResponse($e); throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), - $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? (string) $e->getResponse()->getBody() : null + $eResponse ? $eResponse->getHeaders() : null, + $eResponse ? (string) $eResponse->getBody() : null ); - } catch (ConnectException $e) { + } catch (NetworkExceptionInterface $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), @@ -2174,7 +2253,15 @@ function ($response) use ($returnType) { ]; }, function ($exception) { - $response = $exception->getResponse(); + $response = $this->getExceptionResponse($exception); + if ($response === null) { + throw new ApiException( + "[{$exception->getCode()}] {$exception->getMessage()}", + (int) $exception->getCode(), + null, + null + ); + } $statusCode = $response->getStatusCode(); throw new ApiException( sprintf( @@ -2233,7 +2320,7 @@ public function listBaseExternalLinksRequest($workspace_id, $base_name, string $ // path params if ($workspace_id !== null) { $resourcePath = str_replace( - '{' . 'workspace_id' . '}', + '{workspace_id}', ObjectSerializer::toPathValue($workspace_id), $resourcePath ); @@ -2241,7 +2328,7 @@ public function listBaseExternalLinksRequest($workspace_id, $base_name, string $ // path params if ($base_name !== null) { $resourcePath = str_replace( - '{' . 'base_name' . '}', + '{base_name}', ObjectSerializer::toPathValue($base_name), $resourcePath ); @@ -2272,7 +2359,11 @@ public function listBaseExternalLinksRequest($workspace_id, $base_name, string $ } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + try { + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + } catch (\JsonException $e) { + throw new \InvalidArgumentException('json_encode error: ' . $e->getMessage(), 0, $e); + } } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -2350,13 +2441,14 @@ public function listViewExternalLinksWithHttpInfo($table_id, $view_id, $workspac try { $response = $this->client->send($request, $options); } catch (RequestException $e) { + $eResponse = $this->getExceptionResponse($e); throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), - $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? (string) $e->getResponse()->getBody() : null + $eResponse ? $eResponse->getHeaders() : null, + $eResponse ? (string) $eResponse->getBody() : null ); - } catch (ConnectException $e) { + } catch (NetworkExceptionInterface $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), @@ -2477,7 +2569,15 @@ function ($response) use ($returnType) { ]; }, function ($exception) { - $response = $exception->getResponse(); + $response = $this->getExceptionResponse($exception); + if ($response === null) { + throw new ApiException( + "[{$exception->getCode()}] {$exception->getMessage()}", + (int) $exception->getCode(), + null, + null + ); + } $statusCode = $response->getStatusCode(); throw new ApiException( sprintf( @@ -2576,7 +2676,7 @@ public function listViewExternalLinksRequest($table_id, $view_id, $workspace_id, // path params if ($workspace_id !== null) { $resourcePath = str_replace( - '{' . 'workspace_id' . '}', + '{workspace_id}', ObjectSerializer::toPathValue($workspace_id), $resourcePath ); @@ -2584,7 +2684,7 @@ public function listViewExternalLinksRequest($table_id, $view_id, $workspace_id, // path params if ($base_name !== null) { $resourcePath = str_replace( - '{' . 'base_name' . '}', + '{base_name}', ObjectSerializer::toPathValue($base_name), $resourcePath ); @@ -2615,7 +2715,11 @@ public function listViewExternalLinksRequest($table_id, $view_id, $workspace_id, } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + try { + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + } catch (\JsonException $e) { + throw new \InvalidArgumentException('json_encode error: ' . $e->getMessage(), 0, $e); + } } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -2675,6 +2779,21 @@ protected function createHttpClientOption() return $options; } + /** + * Returns the response attached to a Guzzle exception, if there is one. + * + * Guzzle 7 exposes getResponse() on RequestException, while Guzzle 8 only + * exposes it on ResponseException and its subclasses. + * + * @param \Throwable $exception + * + * @return ResponseInterface|null + */ + private function getExceptionResponse(\Throwable $exception): ?ResponseInterface + { + return method_exists($exception, 'getResponse') ? $exception->getResponse() : null; + } + private function handleResponseWithDataType( string $dataType, RequestInterface $request, diff --git a/lib/User/SnapshotsApi.php b/lib/User/SnapshotsApi.php index a5af5942..678501b3 100644 --- a/lib/User/SnapshotsApi.php +++ b/lib/User/SnapshotsApi.php @@ -28,11 +28,11 @@ use GuzzleHttp\Client; use GuzzleHttp\ClientInterface; -use GuzzleHttp\Exception\ConnectException; use GuzzleHttp\Exception\RequestException; use GuzzleHttp\Psr7\MultipartStream; use GuzzleHttp\Psr7\Request; use GuzzleHttp\RequestOptions; +use Psr\Http\Client\NetworkExceptionInterface; use Psr\Http\Message\RequestInterface; use Psr\Http\Message\ResponseInterface; use SeaTable\Client\ApiException; @@ -174,13 +174,14 @@ public function getBigDataStatusWithHttpInfo($workspace_id, $base_name, string $ try { $response = $this->client->send($request, $options); } catch (RequestException $e) { + $eResponse = $this->getExceptionResponse($e); throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), - $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? (string) $e->getResponse()->getBody() : null + $eResponse ? $eResponse->getHeaders() : null, + $eResponse ? (string) $eResponse->getBody() : null ); - } catch (ConnectException $e) { + } catch (NetworkExceptionInterface $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), @@ -297,7 +298,15 @@ function ($response) use ($returnType) { ]; }, function ($exception) { - $response = $exception->getResponse(); + $response = $this->getExceptionResponse($exception); + if ($response === null) { + throw new ApiException( + "[{$exception->getCode()}] {$exception->getMessage()}", + (int) $exception->getCode(), + null, + null + ); + } $statusCode = $response->getStatusCode(); throw new ApiException( sprintf( @@ -356,7 +365,7 @@ public function getBigDataStatusRequest($workspace_id, $base_name, string $conte // path params if ($workspace_id !== null) { $resourcePath = str_replace( - '{' . 'workspace_id' . '}', + '{workspace_id}', ObjectSerializer::toPathValue($workspace_id), $resourcePath ); @@ -364,7 +373,7 @@ public function getBigDataStatusRequest($workspace_id, $base_name, string $conte // path params if ($base_name !== null) { $resourcePath = str_replace( - '{' . 'base_name' . '}', + '{base_name}', ObjectSerializer::toPathValue($base_name), $resourcePath ); @@ -395,7 +404,11 @@ public function getBigDataStatusRequest($workspace_id, $base_name, string $conte } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + try { + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + } catch (\JsonException $e) { + throw new \InvalidArgumentException('json_encode error: ' . $e->getMessage(), 0, $e); + } } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -469,13 +482,14 @@ public function listBigDataBackupsWithHttpInfo($workspace_id, $base_name, string try { $response = $this->client->send($request, $options); } catch (RequestException $e) { + $eResponse = $this->getExceptionResponse($e); throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), - $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? (string) $e->getResponse()->getBody() : null + $eResponse ? $eResponse->getHeaders() : null, + $eResponse ? (string) $eResponse->getBody() : null ); - } catch (ConnectException $e) { + } catch (NetworkExceptionInterface $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), @@ -592,7 +606,15 @@ function ($response) use ($returnType) { ]; }, function ($exception) { - $response = $exception->getResponse(); + $response = $this->getExceptionResponse($exception); + if ($response === null) { + throw new ApiException( + "[{$exception->getCode()}] {$exception->getMessage()}", + (int) $exception->getCode(), + null, + null + ); + } $statusCode = $response->getStatusCode(); throw new ApiException( sprintf( @@ -651,7 +673,7 @@ public function listBigDataBackupsRequest($workspace_id, $base_name, string $con // path params if ($workspace_id !== null) { $resourcePath = str_replace( - '{' . 'workspace_id' . '}', + '{workspace_id}', ObjectSerializer::toPathValue($workspace_id), $resourcePath ); @@ -659,7 +681,7 @@ public function listBigDataBackupsRequest($workspace_id, $base_name, string $con // path params if ($base_name !== null) { $resourcePath = str_replace( - '{' . 'base_name' . '}', + '{base_name}', ObjectSerializer::toPathValue($base_name), $resourcePath ); @@ -690,7 +712,11 @@ public function listBigDataBackupsRequest($workspace_id, $base_name, string $con } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + try { + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + } catch (\JsonException $e) { + throw new \InvalidArgumentException('json_encode error: ' . $e->getMessage(), 0, $e); + } } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -768,13 +794,14 @@ public function listSnapshotsWithHttpInfo($workspace_id, $base_name, $page = nul try { $response = $this->client->send($request, $options); } catch (RequestException $e) { + $eResponse = $this->getExceptionResponse($e); throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), - $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? (string) $e->getResponse()->getBody() : null + $eResponse ? $eResponse->getHeaders() : null, + $eResponse ? (string) $eResponse->getBody() : null ); - } catch (ConnectException $e) { + } catch (NetworkExceptionInterface $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), @@ -895,7 +922,15 @@ function ($response) use ($returnType) { ]; }, function ($exception) { - $response = $exception->getResponse(); + $response = $this->getExceptionResponse($exception); + if ($response === null) { + throw new ApiException( + "[{$exception->getCode()}] {$exception->getMessage()}", + (int) $exception->getCode(), + null, + null + ); + } $statusCode = $response->getStatusCode(); throw new ApiException( sprintf( @@ -982,7 +1017,7 @@ public function listSnapshotsRequest($workspace_id, $base_name, $page = null, $p // path params if ($workspace_id !== null) { $resourcePath = str_replace( - '{' . 'workspace_id' . '}', + '{workspace_id}', ObjectSerializer::toPathValue($workspace_id), $resourcePath ); @@ -990,7 +1025,7 @@ public function listSnapshotsRequest($workspace_id, $base_name, $page = null, $p // path params if ($base_name !== null) { $resourcePath = str_replace( - '{' . 'base_name' . '}', + '{base_name}', ObjectSerializer::toPathValue($base_name), $resourcePath ); @@ -1021,7 +1056,11 @@ public function listSnapshotsRequest($workspace_id, $base_name, $page = null, $p } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + try { + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + } catch (\JsonException $e) { + throw new \InvalidArgumentException('json_encode error: ' . $e->getMessage(), 0, $e); + } } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -1099,13 +1138,14 @@ public function restoreSnapshotWithHttpInfo($workspace_id, $base_name, $commit_i try { $response = $this->client->send($request, $options); } catch (RequestException $e) { + $eResponse = $this->getExceptionResponse($e); throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), - $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? (string) $e->getResponse()->getBody() : null + $eResponse ? $eResponse->getHeaders() : null, + $eResponse ? (string) $eResponse->getBody() : null ); - } catch (ConnectException $e) { + } catch (NetworkExceptionInterface $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), @@ -1226,7 +1266,15 @@ function ($response) use ($returnType) { ]; }, function ($exception) { - $response = $exception->getResponse(); + $response = $this->getExceptionResponse($exception); + if ($response === null) { + throw new ApiException( + "[{$exception->getCode()}] {$exception->getMessage()}", + (int) $exception->getCode(), + null, + null + ); + } $statusCode = $response->getStatusCode(); throw new ApiException( sprintf( @@ -1298,7 +1346,7 @@ public function restoreSnapshotRequest($workspace_id, $base_name, $commit_id, $s // path params if ($workspace_id !== null) { $resourcePath = str_replace( - '{' . 'workspace_id' . '}', + '{workspace_id}', ObjectSerializer::toPathValue($workspace_id), $resourcePath ); @@ -1306,7 +1354,7 @@ public function restoreSnapshotRequest($workspace_id, $base_name, $commit_id, $s // path params if ($base_name !== null) { $resourcePath = str_replace( - '{' . 'base_name' . '}', + '{base_name}', ObjectSerializer::toPathValue($base_name), $resourcePath ); @@ -1314,7 +1362,7 @@ public function restoreSnapshotRequest($workspace_id, $base_name, $commit_id, $s // path params if ($commit_id !== null) { $resourcePath = str_replace( - '{' . 'commit_id' . '}', + '{commit_id}', ObjectSerializer::toPathValue($commit_id), $resourcePath ); @@ -1355,7 +1403,11 @@ public function restoreSnapshotRequest($workspace_id, $base_name, $commit_id, $s } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + try { + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + } catch (\JsonException $e) { + throw new \InvalidArgumentException('json_encode error: ' . $e->getMessage(), 0, $e); + } } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -1415,6 +1467,21 @@ protected function createHttpClientOption() return $options; } + /** + * Returns the response attached to a Guzzle exception, if there is one. + * + * Guzzle 7 exposes getResponse() on RequestException, while Guzzle 8 only + * exposes it on ResponseException and its subclasses. + * + * @param \Throwable $exception + * + * @return ResponseInterface|null + */ + private function getExceptionResponse(\Throwable $exception): ?ResponseInterface + { + return method_exists($exception, 'getResponse') ? $exception->getResponse() : null; + } + private function handleResponseWithDataType( string $dataType, RequestInterface $request, diff --git a/lib/User/SpecificDateValue.php b/lib/User/SpecificDateValue.php index c1885534..993b3634 100644 --- a/lib/User/SpecificDateValue.php +++ b/lib/User/SpecificDateValue.php @@ -44,49 +44,49 @@ class SpecificDateValue implements ModelInterface, ArrayAccess, \JsonSerializabl public const DISCRIMINATOR = null; /** - * The original name of the model. - * - * @var string - */ + * The original name of the model. + * + * @var string + */ protected static $openAPIModelName = 'specific_date_value'; /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ protected static $openAPITypes = [ 'set_type' => 'string', 'value' => 'string' ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - * @phpstan-var array - * @psalm-var array - */ + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ protected static $openAPIFormats = [ 'set_type' => null, 'value' => null ]; /** - * Array of nullable properties. Used for (de)serialization - * - * @var boolean[] - */ + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ protected static array $openAPINullables = [ 'set_type' => false, 'value' => false ]; /** - * If a nullable field gets set to null, insert it here - * - * @var boolean[] - */ + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ protected array $openAPINullablesSetToNull = []; /** @@ -267,14 +267,14 @@ public function __construct(?array $data = null) } /** - * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName - * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the - * $this->openAPINullablesSetToNull array - * - * @param string $variableName - * @param array $fields - * @param mixed $defaultValue - */ + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ private function setIfExists(string $variableName, array $fields, $defaultValue): void { if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { diff --git a/lib/User/SystemNotificationsApi.php b/lib/User/SystemNotificationsApi.php index acc584ec..43152949 100644 --- a/lib/User/SystemNotificationsApi.php +++ b/lib/User/SystemNotificationsApi.php @@ -28,11 +28,11 @@ use GuzzleHttp\Client; use GuzzleHttp\ClientInterface; -use GuzzleHttp\Exception\ConnectException; use GuzzleHttp\Exception\RequestException; use GuzzleHttp\Psr7\MultipartStream; use GuzzleHttp\Psr7\Request; use GuzzleHttp\RequestOptions; +use Psr\Http\Client\NetworkExceptionInterface; use Psr\Http\Message\RequestInterface; use Psr\Http\Message\ResponseInterface; use SeaTable\Client\ApiException; @@ -164,13 +164,14 @@ public function listSystemNotificationsWithHttpInfo(string $contentType = self:: try { $response = $this->client->send($request, $options); } catch (RequestException $e) { + $eResponse = $this->getExceptionResponse($e); throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), - $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? (string) $e->getResponse()->getBody() : null + $eResponse ? $eResponse->getHeaders() : null, + $eResponse ? (string) $eResponse->getBody() : null ); - } catch (ConnectException $e) { + } catch (NetworkExceptionInterface $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), @@ -283,7 +284,15 @@ function ($response) use ($returnType) { ]; }, function ($exception) { - $response = $exception->getResponse(); + $response = $this->getExceptionResponse($exception); + if ($response === null) { + throw new ApiException( + "[{$exception->getCode()}] {$exception->getMessage()}", + (int) $exception->getCode(), + null, + null + ); + } $statusCode = $response->getStatusCode(); throw new ApiException( sprintf( @@ -346,7 +355,11 @@ public function listSystemNotificationsRequest(string $contentType = self::conte } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + try { + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + } catch (\JsonException $e) { + throw new \InvalidArgumentException('json_encode error: ' . $e->getMessage(), 0, $e); + } } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -418,13 +431,14 @@ public function markSystemNotificationsAsSeenWithHttpInfo($sys_notification_id, try { $response = $this->client->send($request, $options); } catch (RequestException $e) { + $eResponse = $this->getExceptionResponse($e); throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), - $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? (string) $e->getResponse()->getBody() : null + $eResponse ? $eResponse->getHeaders() : null, + $eResponse ? (string) $eResponse->getBody() : null ); - } catch (ConnectException $e) { + } catch (NetworkExceptionInterface $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), @@ -539,7 +553,15 @@ function ($response) use ($returnType) { ]; }, function ($exception) { - $response = $exception->getResponse(); + $response = $this->getExceptionResponse($exception); + if ($response === null) { + throw new ApiException( + "[{$exception->getCode()}] {$exception->getMessage()}", + (int) $exception->getCode(), + null, + null + ); + } $statusCode = $response->getStatusCode(); throw new ApiException( sprintf( @@ -587,7 +609,7 @@ public function markSystemNotificationsAsSeenRequest($sys_notification_id, strin // path params if ($sys_notification_id !== null) { $resourcePath = str_replace( - '{' . 'sys_notification_id' . '}', + '{sys_notification_id}', ObjectSerializer::toPathValue($sys_notification_id), $resourcePath ); @@ -618,7 +640,11 @@ public function markSystemNotificationsAsSeenRequest($sys_notification_id, strin } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + try { + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + } catch (\JsonException $e) { + throw new \InvalidArgumentException('json_encode error: ' . $e->getMessage(), 0, $e); + } } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -678,6 +704,21 @@ protected function createHttpClientOption() return $options; } + /** + * Returns the response attached to a Guzzle exception, if there is one. + * + * Guzzle 7 exposes getResponse() on RequestException, while Guzzle 8 only + * exposes it on ResponseException and its subclasses. + * + * @param \Throwable $exception + * + * @return ResponseInterface|null + */ + private function getExceptionResponse(\Throwable $exception): ?ResponseInterface + { + return method_exists($exception, 'getResponse') ? $exception->getResponse() : null; + } + private function handleResponseWithDataType( string $dataType, RequestInterface $request, diff --git a/lib/User/TheDayRunningTheTaskValue.php b/lib/User/TheDayRunningTheTaskValue.php index 38f00c25..68640145 100644 --- a/lib/User/TheDayRunningTheTaskValue.php +++ b/lib/User/TheDayRunningTheTaskValue.php @@ -44,17 +44,17 @@ class TheDayRunningTheTaskValue implements ModelInterface, ArrayAccess, \JsonSer public const DISCRIMINATOR = null; /** - * The original name of the model. - * - * @var string - */ + * The original name of the model. + * + * @var string + */ protected static $openAPIModelName = 'the_day_running_the_task_value'; /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ protected static $openAPITypes = [ 'set_type' => 'string', 'offset' => 'int', @@ -62,12 +62,12 @@ class TheDayRunningTheTaskValue implements ModelInterface, ArrayAccess, \JsonSer ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - * @phpstan-var array - * @psalm-var array - */ + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ protected static $openAPIFormats = [ 'set_type' => null, 'offset' => null, @@ -75,10 +75,10 @@ class TheDayRunningTheTaskValue implements ModelInterface, ArrayAccess, \JsonSer ]; /** - * Array of nullable properties. Used for (de)serialization - * - * @var boolean[] - */ + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ protected static array $openAPINullables = [ 'set_type' => false, 'offset' => false, @@ -86,10 +86,10 @@ class TheDayRunningTheTaskValue implements ModelInterface, ArrayAccess, \JsonSer ]; /** - * If a nullable field gets set to null, insert it here - * - * @var boolean[] - */ + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ protected array $openAPINullablesSetToNull = []; /** @@ -300,14 +300,14 @@ public function __construct(?array $data = null) } /** - * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName - * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the - * $this->openAPINullablesSetToNull array - * - * @param string $variableName - * @param array $fields - * @param mixed $defaultValue - */ + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ private function setIfExists(string $variableName, array $fields, $defaultValue): void { if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { diff --git a/lib/User/Trigger.php b/lib/User/Trigger.php index 8ae86f63..279f8bd3 100644 --- a/lib/User/Trigger.php +++ b/lib/User/Trigger.php @@ -44,17 +44,17 @@ class Trigger implements ModelInterface, ArrayAccess, \JsonSerializable public const DISCRIMINATOR = null; /** - * The original name of the model. - * - * @var string - */ + * The original name of the model. + * + * @var string + */ protected static $openAPIModelName = 'trigger'; /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ protected static $openAPITypes = [ 'rule_name' => 'string', 'condition' => 'string', @@ -63,12 +63,12 @@ class Trigger implements ModelInterface, ArrayAccess, \JsonSerializable ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - * @phpstan-var array - * @psalm-var array - */ + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ protected static $openAPIFormats = [ 'rule_name' => null, 'condition' => null, @@ -77,10 +77,10 @@ class Trigger implements ModelInterface, ArrayAccess, \JsonSerializable ]; /** - * Array of nullable properties. Used for (de)serialization - * - * @var boolean[] - */ + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ protected static array $openAPINullables = [ 'rule_name' => false, 'condition' => false, @@ -89,10 +89,10 @@ class Trigger implements ModelInterface, ArrayAccess, \JsonSerializable ]; /** - * If a nullable field gets set to null, insert it here - * - * @var boolean[] - */ + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ protected array $openAPINullablesSetToNull = []; /** @@ -268,14 +268,14 @@ public function __construct(?array $data = null) } /** - * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName - * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the - * $this->openAPINullablesSetToNull array - * - * @param string $variableName - * @param array $fields - * @param mixed $defaultValue - */ + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ private function setIfExists(string $variableName, array $fields, $defaultValue): void { if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { diff --git a/lib/User/TriggerRecordsMeetSpecificConditionsAfterModification.php b/lib/User/TriggerRecordsMeetSpecificConditionsAfterModification.php index 23a50014..bfbc48ad 100644 --- a/lib/User/TriggerRecordsMeetSpecificConditionsAfterModification.php +++ b/lib/User/TriggerRecordsMeetSpecificConditionsAfterModification.php @@ -44,17 +44,17 @@ class TriggerRecordsMeetSpecificConditionsAfterModification implements ModelInte public const DISCRIMINATOR = null; /** - * The original name of the model. - * - * @var string - */ + * The original name of the model. + * + * @var string + */ protected static $openAPIModelName = 'trigger_records_meet_specific_conditions_after_modification'; /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ protected static $openAPITypes = [ 'rule_name' => 'string', 'table_id' => 'string', @@ -67,12 +67,12 @@ class TriggerRecordsMeetSpecificConditionsAfterModification implements ModelInte ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - * @phpstan-var array - * @psalm-var array - */ + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ protected static $openAPIFormats = [ 'rule_name' => null, 'table_id' => null, @@ -85,10 +85,10 @@ class TriggerRecordsMeetSpecificConditionsAfterModification implements ModelInte ]; /** - * Array of nullable properties. Used for (de)serialization - * - * @var boolean[] - */ + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ protected static array $openAPINullables = [ 'rule_name' => false, 'table_id' => false, @@ -101,10 +101,10 @@ class TriggerRecordsMeetSpecificConditionsAfterModification implements ModelInte ]; /** - * If a nullable field gets set to null, insert it here - * - * @var boolean[] - */ + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ protected array $openAPINullablesSetToNull = []; /** @@ -296,14 +296,14 @@ public function __construct(?array $data = null) } /** - * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName - * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the - * $this->openAPINullablesSetToNull array - * - * @param string $variableName - * @param array $fields - * @param mixed $defaultValue - */ + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ private function setIfExists(string $variableName, array $fields, $defaultValue): void { if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { diff --git a/lib/User/TriggerRowAdded.php b/lib/User/TriggerRowAdded.php index 8d3d462f..5941e240 100644 --- a/lib/User/TriggerRowAdded.php +++ b/lib/User/TriggerRowAdded.php @@ -44,17 +44,17 @@ class TriggerRowAdded implements ModelInterface, ArrayAccess, \JsonSerializable public const DISCRIMINATOR = null; /** - * The original name of the model. - * - * @var string - */ + * The original name of the model. + * + * @var string + */ protected static $openAPIModelName = 'trigger_row_added'; /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ protected static $openAPITypes = [ 'rule_name' => 'string', 'table_id' => 'string', @@ -67,12 +67,12 @@ class TriggerRowAdded implements ModelInterface, ArrayAccess, \JsonSerializable ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - * @phpstan-var array - * @psalm-var array - */ + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ protected static $openAPIFormats = [ 'rule_name' => null, 'table_id' => null, @@ -85,10 +85,10 @@ class TriggerRowAdded implements ModelInterface, ArrayAccess, \JsonSerializable ]; /** - * Array of nullable properties. Used for (de)serialization - * - * @var boolean[] - */ + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ protected static array $openAPINullables = [ 'rule_name' => false, 'table_id' => false, @@ -101,10 +101,10 @@ class TriggerRowAdded implements ModelInterface, ArrayAccess, \JsonSerializable ]; /** - * If a nullable field gets set to null, insert it here - * - * @var boolean[] - */ + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ protected array $openAPINullablesSetToNull = []; /** @@ -309,14 +309,14 @@ public function __construct(?array $data = null) } /** - * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName - * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the - * $this->openAPINullablesSetToNull array - * - * @param string $variableName - * @param array $fields - * @param mixed $defaultValue - */ + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ private function setIfExists(string $variableName, array $fields, $defaultValue): void { if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { diff --git a/lib/User/TriggerRunPeriodicallyOnRecordsMeetPerDay.php b/lib/User/TriggerRunPeriodicallyOnRecordsMeetPerDay.php index fd2d800a..beafb931 100644 --- a/lib/User/TriggerRunPeriodicallyOnRecordsMeetPerDay.php +++ b/lib/User/TriggerRunPeriodicallyOnRecordsMeetPerDay.php @@ -44,17 +44,17 @@ class TriggerRunPeriodicallyOnRecordsMeetPerDay implements ModelInterface, Array public const DISCRIMINATOR = null; /** - * The original name of the model. - * - * @var string - */ + * The original name of the model. + * + * @var string + */ protected static $openAPIModelName = 'trigger_run_periodically_on_records_meet_per_day'; /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ protected static $openAPITypes = [ 'run_condition' => 'string', 'trigger' => '\SeaTable\Client\User\TriggerRunPeriodicallyOnRecordsMeetPerDayTrigger', @@ -62,12 +62,12 @@ class TriggerRunPeriodicallyOnRecordsMeetPerDay implements ModelInterface, Array ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - * @phpstan-var array - * @psalm-var array - */ + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ protected static $openAPIFormats = [ 'run_condition' => null, 'trigger' => null, @@ -75,10 +75,10 @@ class TriggerRunPeriodicallyOnRecordsMeetPerDay implements ModelInterface, Array ]; /** - * Array of nullable properties. Used for (de)serialization - * - * @var boolean[] - */ + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ protected static array $openAPINullables = [ 'run_condition' => false, 'trigger' => false, @@ -86,10 +86,10 @@ class TriggerRunPeriodicallyOnRecordsMeetPerDay implements ModelInterface, Array ]; /** - * If a nullable field gets set to null, insert it here - * - * @var boolean[] - */ + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ protected array $openAPINullablesSetToNull = []; /** @@ -274,14 +274,14 @@ public function __construct(?array $data = null) } /** - * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName - * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the - * $this->openAPINullablesSetToNull array - * - * @param string $variableName - * @param array $fields - * @param mixed $defaultValue - */ + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ private function setIfExists(string $variableName, array $fields, $defaultValue): void { if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { diff --git a/lib/User/TriggerRunPeriodicallyOnRecordsMeetPerDayTrigger.php b/lib/User/TriggerRunPeriodicallyOnRecordsMeetPerDayTrigger.php index 6c2405a9..8a798d85 100644 --- a/lib/User/TriggerRunPeriodicallyOnRecordsMeetPerDayTrigger.php +++ b/lib/User/TriggerRunPeriodicallyOnRecordsMeetPerDayTrigger.php @@ -44,17 +44,17 @@ class TriggerRunPeriodicallyOnRecordsMeetPerDayTrigger implements ModelInterface public const DISCRIMINATOR = null; /** - * The original name of the model. - * - * @var string - */ + * The original name of the model. + * + * @var string + */ protected static $openAPIModelName = 'trigger_run_periodically_on_records_meet_per_day_trigger'; /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ protected static $openAPITypes = [ 'rule_name' => 'string', 'table_id' => 'string', @@ -67,12 +67,12 @@ class TriggerRunPeriodicallyOnRecordsMeetPerDayTrigger implements ModelInterface ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - * @phpstan-var array - * @psalm-var array - */ + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ protected static $openAPIFormats = [ 'rule_name' => null, 'table_id' => null, @@ -85,10 +85,10 @@ class TriggerRunPeriodicallyOnRecordsMeetPerDayTrigger implements ModelInterface ]; /** - * Array of nullable properties. Used for (de)serialization - * - * @var boolean[] - */ + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ protected static array $openAPINullables = [ 'rule_name' => false, 'table_id' => false, @@ -101,10 +101,10 @@ class TriggerRunPeriodicallyOnRecordsMeetPerDayTrigger implements ModelInterface ]; /** - * If a nullable field gets set to null, insert it here - * - * @var boolean[] - */ + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ protected array $openAPINullablesSetToNull = []; /** @@ -296,14 +296,14 @@ public function __construct(?array $data = null) } /** - * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName - * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the - * $this->openAPINullablesSetToNull array - * - * @param string $variableName - * @param array $fields - * @param mixed $defaultValue - */ + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ private function setIfExists(string $variableName, array $fields, $defaultValue): void { if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { diff --git a/lib/User/TriggerRunPeriodicallyOnRecordsMeetPerMonth.php b/lib/User/TriggerRunPeriodicallyOnRecordsMeetPerMonth.php index d4fb97e6..9db8a8d6 100644 --- a/lib/User/TriggerRunPeriodicallyOnRecordsMeetPerMonth.php +++ b/lib/User/TriggerRunPeriodicallyOnRecordsMeetPerMonth.php @@ -44,17 +44,17 @@ class TriggerRunPeriodicallyOnRecordsMeetPerMonth implements ModelInterface, Arr public const DISCRIMINATOR = null; /** - * The original name of the model. - * - * @var string - */ + * The original name of the model. + * + * @var string + */ protected static $openAPIModelName = 'trigger_run_periodically_on_records_meet_per_month'; /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ protected static $openAPITypes = [ 'run_condition' => 'string', 'trigger' => '\SeaTable\Client\User\TriggerRunPeriodicallyOnRecordsMeetPerMonthTrigger', @@ -62,12 +62,12 @@ class TriggerRunPeriodicallyOnRecordsMeetPerMonth implements ModelInterface, Arr ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - * @phpstan-var array - * @psalm-var array - */ + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ protected static $openAPIFormats = [ 'run_condition' => null, 'trigger' => null, @@ -75,10 +75,10 @@ class TriggerRunPeriodicallyOnRecordsMeetPerMonth implements ModelInterface, Arr ]; /** - * Array of nullable properties. Used for (de)serialization - * - * @var boolean[] - */ + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ protected static array $openAPINullables = [ 'run_condition' => false, 'trigger' => false, @@ -86,10 +86,10 @@ class TriggerRunPeriodicallyOnRecordsMeetPerMonth implements ModelInterface, Arr ]; /** - * If a nullable field gets set to null, insert it here - * - * @var boolean[] - */ + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ protected array $openAPINullablesSetToNull = []; /** @@ -274,14 +274,14 @@ public function __construct(?array $data = null) } /** - * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName - * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the - * $this->openAPINullablesSetToNull array - * - * @param string $variableName - * @param array $fields - * @param mixed $defaultValue - */ + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ private function setIfExists(string $variableName, array $fields, $defaultValue): void { if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { diff --git a/lib/User/TriggerRunPeriodicallyOnRecordsMeetPerMonthTrigger.php b/lib/User/TriggerRunPeriodicallyOnRecordsMeetPerMonthTrigger.php index 108ee15f..f4e31474 100644 --- a/lib/User/TriggerRunPeriodicallyOnRecordsMeetPerMonthTrigger.php +++ b/lib/User/TriggerRunPeriodicallyOnRecordsMeetPerMonthTrigger.php @@ -44,17 +44,17 @@ class TriggerRunPeriodicallyOnRecordsMeetPerMonthTrigger implements ModelInterfa public const DISCRIMINATOR = null; /** - * The original name of the model. - * - * @var string - */ + * The original name of the model. + * + * @var string + */ protected static $openAPIModelName = 'trigger_run_periodically_on_records_meet_per_month_trigger'; /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ protected static $openAPITypes = [ 'rule_name' => 'string', 'table_id' => 'string', @@ -68,12 +68,12 @@ class TriggerRunPeriodicallyOnRecordsMeetPerMonthTrigger implements ModelInterfa ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - * @phpstan-var array - * @psalm-var array - */ + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ protected static $openAPIFormats = [ 'rule_name' => null, 'table_id' => null, @@ -87,10 +87,10 @@ class TriggerRunPeriodicallyOnRecordsMeetPerMonthTrigger implements ModelInterfa ]; /** - * Array of nullable properties. Used for (de)serialization - * - * @var boolean[] - */ + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ protected static array $openAPINullables = [ 'rule_name' => false, 'table_id' => false, @@ -104,10 +104,10 @@ class TriggerRunPeriodicallyOnRecordsMeetPerMonthTrigger implements ModelInterfa ]; /** - * If a nullable field gets set to null, insert it here - * - * @var boolean[] - */ + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ protected array $openAPINullablesSetToNull = []; /** @@ -303,14 +303,14 @@ public function __construct(?array $data = null) } /** - * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName - * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the - * $this->openAPINullablesSetToNull array - * - * @param string $variableName - * @param array $fields - * @param mixed $defaultValue - */ + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ private function setIfExists(string $variableName, array $fields, $defaultValue): void { if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { diff --git a/lib/User/TriggerRunPeriodicallyOnRecordsMeetPerWeek.php b/lib/User/TriggerRunPeriodicallyOnRecordsMeetPerWeek.php index 531a852e..61c2f09c 100644 --- a/lib/User/TriggerRunPeriodicallyOnRecordsMeetPerWeek.php +++ b/lib/User/TriggerRunPeriodicallyOnRecordsMeetPerWeek.php @@ -44,17 +44,17 @@ class TriggerRunPeriodicallyOnRecordsMeetPerWeek implements ModelInterface, Arra public const DISCRIMINATOR = null; /** - * The original name of the model. - * - * @var string - */ + * The original name of the model. + * + * @var string + */ protected static $openAPIModelName = 'trigger_run_periodically_on_records_meet_per_week'; /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ protected static $openAPITypes = [ 'run_condition' => 'string', 'trigger' => '\SeaTable\Client\User\TriggerRunPeriodicallyOnRecordsMeetPerWeekTrigger', @@ -62,12 +62,12 @@ class TriggerRunPeriodicallyOnRecordsMeetPerWeek implements ModelInterface, Arra ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - * @phpstan-var array - * @psalm-var array - */ + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ protected static $openAPIFormats = [ 'run_condition' => null, 'trigger' => null, @@ -75,10 +75,10 @@ class TriggerRunPeriodicallyOnRecordsMeetPerWeek implements ModelInterface, Arra ]; /** - * Array of nullable properties. Used for (de)serialization - * - * @var boolean[] - */ + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ protected static array $openAPINullables = [ 'run_condition' => false, 'trigger' => false, @@ -86,10 +86,10 @@ class TriggerRunPeriodicallyOnRecordsMeetPerWeek implements ModelInterface, Arra ]; /** - * If a nullable field gets set to null, insert it here - * - * @var boolean[] - */ + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ protected array $openAPINullablesSetToNull = []; /** @@ -274,14 +274,14 @@ public function __construct(?array $data = null) } /** - * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName - * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the - * $this->openAPINullablesSetToNull array - * - * @param string $variableName - * @param array $fields - * @param mixed $defaultValue - */ + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ private function setIfExists(string $variableName, array $fields, $defaultValue): void { if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { diff --git a/lib/User/TriggerRunPeriodicallyOnRecordsMeetPerWeekTrigger.php b/lib/User/TriggerRunPeriodicallyOnRecordsMeetPerWeekTrigger.php index 39e9e981..73a6dd71 100644 --- a/lib/User/TriggerRunPeriodicallyOnRecordsMeetPerWeekTrigger.php +++ b/lib/User/TriggerRunPeriodicallyOnRecordsMeetPerWeekTrigger.php @@ -44,17 +44,17 @@ class TriggerRunPeriodicallyOnRecordsMeetPerWeekTrigger implements ModelInterfac public const DISCRIMINATOR = null; /** - * The original name of the model. - * - * @var string - */ + * The original name of the model. + * + * @var string + */ protected static $openAPIModelName = 'trigger_run_periodically_on_records_meet_per_week_trigger'; /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ protected static $openAPITypes = [ 'rule_name' => 'string', 'table_id' => 'string', @@ -68,12 +68,12 @@ class TriggerRunPeriodicallyOnRecordsMeetPerWeekTrigger implements ModelInterfac ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - * @phpstan-var array - * @psalm-var array - */ + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ protected static $openAPIFormats = [ 'rule_name' => null, 'table_id' => null, @@ -87,10 +87,10 @@ class TriggerRunPeriodicallyOnRecordsMeetPerWeekTrigger implements ModelInterfac ]; /** - * Array of nullable properties. Used for (de)serialization - * - * @var boolean[] - */ + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ protected static array $openAPINullables = [ 'rule_name' => false, 'table_id' => false, @@ -104,10 +104,10 @@ class TriggerRunPeriodicallyOnRecordsMeetPerWeekTrigger implements ModelInterfac ]; /** - * If a nullable field gets set to null, insert it here - * - * @var boolean[] - */ + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ protected array $openAPINullablesSetToNull = []; /** @@ -303,14 +303,14 @@ public function __construct(?array $data = null) } /** - * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName - * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the - * $this->openAPINullablesSetToNull array - * - * @param string $variableName - * @param array $fields - * @param mixed $defaultValue - */ + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ private function setIfExists(string $variableName, array $fields, $defaultValue): void { if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { diff --git a/lib/User/TriggerRunPeriodicallyPerDay.php b/lib/User/TriggerRunPeriodicallyPerDay.php index 2e520031..ed1d6384 100644 --- a/lib/User/TriggerRunPeriodicallyPerDay.php +++ b/lib/User/TriggerRunPeriodicallyPerDay.php @@ -44,17 +44,17 @@ class TriggerRunPeriodicallyPerDay implements ModelInterface, ArrayAccess, \Json public const DISCRIMINATOR = null; /** - * The original name of the model. - * - * @var string - */ + * The original name of the model. + * + * @var string + */ protected static $openAPIModelName = 'trigger_run_periodically_per_day'; /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ protected static $openAPITypes = [ 'run_condition' => 'string', 'trigger' => '\SeaTable\Client\User\TriggerRunPeriodicallyPerDayTrigger', @@ -62,12 +62,12 @@ class TriggerRunPeriodicallyPerDay implements ModelInterface, ArrayAccess, \Json ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - * @phpstan-var array - * @psalm-var array - */ + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ protected static $openAPIFormats = [ 'run_condition' => null, 'trigger' => null, @@ -75,10 +75,10 @@ class TriggerRunPeriodicallyPerDay implements ModelInterface, ArrayAccess, \Json ]; /** - * Array of nullable properties. Used for (de)serialization - * - * @var boolean[] - */ + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ protected static array $openAPINullables = [ 'run_condition' => false, 'trigger' => false, @@ -86,10 +86,10 @@ class TriggerRunPeriodicallyPerDay implements ModelInterface, ArrayAccess, \Json ]; /** - * If a nullable field gets set to null, insert it here - * - * @var boolean[] - */ + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ protected array $openAPINullablesSetToNull = []; /** @@ -274,14 +274,14 @@ public function __construct(?array $data = null) } /** - * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName - * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the - * $this->openAPINullablesSetToNull array - * - * @param string $variableName - * @param array $fields - * @param mixed $defaultValue - */ + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ private function setIfExists(string $variableName, array $fields, $defaultValue): void { if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { diff --git a/lib/User/TriggerRunPeriodicallyPerDayTrigger.php b/lib/User/TriggerRunPeriodicallyPerDayTrigger.php index e0cfd713..0a6b0351 100644 --- a/lib/User/TriggerRunPeriodicallyPerDayTrigger.php +++ b/lib/User/TriggerRunPeriodicallyPerDayTrigger.php @@ -44,17 +44,17 @@ class TriggerRunPeriodicallyPerDayTrigger implements ModelInterface, ArrayAccess public const DISCRIMINATOR = null; /** - * The original name of the model. - * - * @var string - */ + * The original name of the model. + * + * @var string + */ protected static $openAPIModelName = 'trigger_run_periodically_per_day_trigger'; /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ protected static $openAPITypes = [ 'rule_name' => 'string', 'table_id' => 'string', @@ -65,12 +65,12 @@ class TriggerRunPeriodicallyPerDayTrigger implements ModelInterface, ArrayAccess ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - * @phpstan-var array - * @psalm-var array - */ + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ protected static $openAPIFormats = [ 'rule_name' => null, 'table_id' => null, @@ -81,10 +81,10 @@ class TriggerRunPeriodicallyPerDayTrigger implements ModelInterface, ArrayAccess ]; /** - * Array of nullable properties. Used for (de)serialization - * - * @var boolean[] - */ + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ protected static array $openAPINullables = [ 'rule_name' => false, 'table_id' => false, @@ -95,10 +95,10 @@ class TriggerRunPeriodicallyPerDayTrigger implements ModelInterface, ArrayAccess ]; /** - * If a nullable field gets set to null, insert it here - * - * @var boolean[] - */ + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ protected array $openAPINullablesSetToNull = []; /** @@ -282,14 +282,14 @@ public function __construct(?array $data = null) } /** - * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName - * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the - * $this->openAPINullablesSetToNull array - * - * @param string $variableName - * @param array $fields - * @param mixed $defaultValue - */ + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ private function setIfExists(string $variableName, array $fields, $defaultValue): void { if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { diff --git a/lib/User/TriggerRunPeriodicallyPerMonth.php b/lib/User/TriggerRunPeriodicallyPerMonth.php index 486b1476..57a5f0ed 100644 --- a/lib/User/TriggerRunPeriodicallyPerMonth.php +++ b/lib/User/TriggerRunPeriodicallyPerMonth.php @@ -44,17 +44,17 @@ class TriggerRunPeriodicallyPerMonth implements ModelInterface, ArrayAccess, \Js public const DISCRIMINATOR = null; /** - * The original name of the model. - * - * @var string - */ + * The original name of the model. + * + * @var string + */ protected static $openAPIModelName = 'trigger_run_periodically_per_month'; /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ protected static $openAPITypes = [ 'run_condition' => 'string', 'trigger' => '\SeaTable\Client\User\TriggerRunPeriodicallyPerMonthTrigger', @@ -62,12 +62,12 @@ class TriggerRunPeriodicallyPerMonth implements ModelInterface, ArrayAccess, \Js ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - * @phpstan-var array - * @psalm-var array - */ + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ protected static $openAPIFormats = [ 'run_condition' => null, 'trigger' => null, @@ -75,10 +75,10 @@ class TriggerRunPeriodicallyPerMonth implements ModelInterface, ArrayAccess, \Js ]; /** - * Array of nullable properties. Used for (de)serialization - * - * @var boolean[] - */ + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ protected static array $openAPINullables = [ 'run_condition' => false, 'trigger' => false, @@ -86,10 +86,10 @@ class TriggerRunPeriodicallyPerMonth implements ModelInterface, ArrayAccess, \Js ]; /** - * If a nullable field gets set to null, insert it here - * - * @var boolean[] - */ + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ protected array $openAPINullablesSetToNull = []; /** @@ -274,14 +274,14 @@ public function __construct(?array $data = null) } /** - * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName - * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the - * $this->openAPINullablesSetToNull array - * - * @param string $variableName - * @param array $fields - * @param mixed $defaultValue - */ + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ private function setIfExists(string $variableName, array $fields, $defaultValue): void { if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { diff --git a/lib/User/TriggerRunPeriodicallyPerMonthTrigger.php b/lib/User/TriggerRunPeriodicallyPerMonthTrigger.php index 9bc855f7..c954db79 100644 --- a/lib/User/TriggerRunPeriodicallyPerMonthTrigger.php +++ b/lib/User/TriggerRunPeriodicallyPerMonthTrigger.php @@ -44,17 +44,17 @@ class TriggerRunPeriodicallyPerMonthTrigger implements ModelInterface, ArrayAcce public const DISCRIMINATOR = null; /** - * The original name of the model. - * - * @var string - */ + * The original name of the model. + * + * @var string + */ protected static $openAPIModelName = 'trigger_run_periodically_per_month_trigger'; /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ protected static $openAPITypes = [ 'rule_name' => 'string', 'table_id' => 'string', @@ -66,12 +66,12 @@ class TriggerRunPeriodicallyPerMonthTrigger implements ModelInterface, ArrayAcce ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - * @phpstan-var array - * @psalm-var array - */ + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ protected static $openAPIFormats = [ 'rule_name' => null, 'table_id' => null, @@ -83,10 +83,10 @@ class TriggerRunPeriodicallyPerMonthTrigger implements ModelInterface, ArrayAcce ]; /** - * Array of nullable properties. Used for (de)serialization - * - * @var boolean[] - */ + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ protected static array $openAPINullables = [ 'rule_name' => false, 'table_id' => false, @@ -98,10 +98,10 @@ class TriggerRunPeriodicallyPerMonthTrigger implements ModelInterface, ArrayAcce ]; /** - * If a nullable field gets set to null, insert it here - * - * @var boolean[] - */ + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ protected array $openAPINullablesSetToNull = []; /** @@ -289,14 +289,14 @@ public function __construct(?array $data = null) } /** - * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName - * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the - * $this->openAPINullablesSetToNull array - * - * @param string $variableName - * @param array $fields - * @param mixed $defaultValue - */ + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ private function setIfExists(string $variableName, array $fields, $defaultValue): void { if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { diff --git a/lib/User/TriggerRunPeriodicallyPerWeek.php b/lib/User/TriggerRunPeriodicallyPerWeek.php index 677d6861..173a230f 100644 --- a/lib/User/TriggerRunPeriodicallyPerWeek.php +++ b/lib/User/TriggerRunPeriodicallyPerWeek.php @@ -44,17 +44,17 @@ class TriggerRunPeriodicallyPerWeek implements ModelInterface, ArrayAccess, \Jso public const DISCRIMINATOR = null; /** - * The original name of the model. - * - * @var string - */ + * The original name of the model. + * + * @var string + */ protected static $openAPIModelName = 'trigger_run_periodically_per_week'; /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ protected static $openAPITypes = [ 'run_condition' => 'string', 'trigger' => '\SeaTable\Client\User\TriggerRunPeriodicallyPerWeekTrigger', @@ -62,12 +62,12 @@ class TriggerRunPeriodicallyPerWeek implements ModelInterface, ArrayAccess, \Jso ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - * @phpstan-var array - * @psalm-var array - */ + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ protected static $openAPIFormats = [ 'run_condition' => null, 'trigger' => null, @@ -75,10 +75,10 @@ class TriggerRunPeriodicallyPerWeek implements ModelInterface, ArrayAccess, \Jso ]; /** - * Array of nullable properties. Used for (de)serialization - * - * @var boolean[] - */ + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ protected static array $openAPINullables = [ 'run_condition' => false, 'trigger' => false, @@ -86,10 +86,10 @@ class TriggerRunPeriodicallyPerWeek implements ModelInterface, ArrayAccess, \Jso ]; /** - * If a nullable field gets set to null, insert it here - * - * @var boolean[] - */ + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ protected array $openAPINullablesSetToNull = []; /** @@ -274,14 +274,14 @@ public function __construct(?array $data = null) } /** - * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName - * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the - * $this->openAPINullablesSetToNull array - * - * @param string $variableName - * @param array $fields - * @param mixed $defaultValue - */ + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ private function setIfExists(string $variableName, array $fields, $defaultValue): void { if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { diff --git a/lib/User/TriggerRunPeriodicallyPerWeekTrigger.php b/lib/User/TriggerRunPeriodicallyPerWeekTrigger.php index ae302efa..045e548d 100644 --- a/lib/User/TriggerRunPeriodicallyPerWeekTrigger.php +++ b/lib/User/TriggerRunPeriodicallyPerWeekTrigger.php @@ -44,17 +44,17 @@ class TriggerRunPeriodicallyPerWeekTrigger implements ModelInterface, ArrayAcces public const DISCRIMINATOR = null; /** - * The original name of the model. - * - * @var string - */ + * The original name of the model. + * + * @var string + */ protected static $openAPIModelName = 'trigger_run_periodically_per_week_trigger'; /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ protected static $openAPITypes = [ 'rule_name' => 'string', 'table_id' => 'string', @@ -66,12 +66,12 @@ class TriggerRunPeriodicallyPerWeekTrigger implements ModelInterface, ArrayAcces ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - * @phpstan-var array - * @psalm-var array - */ + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ protected static $openAPIFormats = [ 'rule_name' => null, 'table_id' => null, @@ -83,10 +83,10 @@ class TriggerRunPeriodicallyPerWeekTrigger implements ModelInterface, ArrayAcces ]; /** - * Array of nullable properties. Used for (de)serialization - * - * @var boolean[] - */ + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ protected static array $openAPINullables = [ 'rule_name' => false, 'table_id' => false, @@ -98,10 +98,10 @@ class TriggerRunPeriodicallyPerWeekTrigger implements ModelInterface, ArrayAcces ]; /** - * If a nullable field gets set to null, insert it here - * - * @var boolean[] - */ + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ protected array $openAPINullablesSetToNull = []; /** @@ -289,14 +289,14 @@ public function __construct(?array $data = null) } /** - * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName - * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the - * $this->openAPINullablesSetToNull array - * - * @param string $variableName - * @param array $fields - * @param mixed $defaultValue - */ + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ private function setIfExists(string $variableName, array $fields, $defaultValue): void { if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { diff --git a/lib/User/UnsetPassword.php b/lib/User/UnsetPassword.php index 0557a8f6..a09f7f49 100644 --- a/lib/User/UnsetPassword.php +++ b/lib/User/UnsetPassword.php @@ -44,17 +44,17 @@ class UnsetPassword implements ModelInterface, ArrayAccess, \JsonSerializable public const DISCRIMINATOR = null; /** - * The original name of the model. - * - * @var string - */ + * The original name of the model. + * + * @var string + */ protected static $openAPIModelName = 'unset_password'; /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ protected static $openAPITypes = [ 'name' => 'string', 'operation' => 'string', @@ -62,12 +62,12 @@ class UnsetPassword implements ModelInterface, ArrayAccess, \JsonSerializable ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - * @phpstan-var array - * @psalm-var array - */ + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ protected static $openAPIFormats = [ 'name' => null, 'operation' => null, @@ -75,10 +75,10 @@ class UnsetPassword implements ModelInterface, ArrayAccess, \JsonSerializable ]; /** - * Array of nullable properties. Used for (de)serialization - * - * @var boolean[] - */ + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ protected static array $openAPINullables = [ 'name' => false, 'operation' => false, @@ -86,10 +86,10 @@ class UnsetPassword implements ModelInterface, ArrayAccess, \JsonSerializable ]; /** - * If a nullable field gets set to null, insert it here - * - * @var boolean[] - */ + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ protected array $openAPINullablesSetToNull = []; /** @@ -274,14 +274,14 @@ public function __construct(?array $data = null) } /** - * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName - * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the - * $this->openAPINullablesSetToNull array - * - * @param string $variableName - * @param array $fields - * @param mixed $defaultValue - */ + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ private function setIfExists(string $variableName, array $fields, $defaultValue): void { if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { diff --git a/lib/User/UpdateCommonDatasetSyncRequest.php b/lib/User/UpdateCommonDatasetSyncRequest.php index 99c9cc2a..ad7c1404 100644 --- a/lib/User/UpdateCommonDatasetSyncRequest.php +++ b/lib/User/UpdateCommonDatasetSyncRequest.php @@ -44,17 +44,17 @@ class UpdateCommonDatasetSyncRequest implements ModelInterface, ArrayAccess, \Js public const DISCRIMINATOR = null; /** - * The original name of the model. - * - * @var string - */ + * The original name of the model. + * + * @var string + */ protected static $openAPIModelName = 'updateCommonDatasetSync_request'; /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ protected static $openAPITypes = [ 'is_sync_periodically' => 'bool', 'dst_dtable_uuid' => 'string', @@ -62,12 +62,12 @@ class UpdateCommonDatasetSyncRequest implements ModelInterface, ArrayAccess, \Js ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - * @phpstan-var array - * @psalm-var array - */ + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ protected static $openAPIFormats = [ 'is_sync_periodically' => null, 'dst_dtable_uuid' => null, @@ -75,10 +75,10 @@ class UpdateCommonDatasetSyncRequest implements ModelInterface, ArrayAccess, \Js ]; /** - * Array of nullable properties. Used for (de)serialization - * - * @var boolean[] - */ + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ protected static array $openAPINullables = [ 'is_sync_periodically' => false, 'dst_dtable_uuid' => false, @@ -86,10 +86,10 @@ class UpdateCommonDatasetSyncRequest implements ModelInterface, ArrayAccess, \Js ]; /** - * If a nullable field gets set to null, insert it here - * - * @var boolean[] - */ + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ protected array $openAPINullablesSetToNull = []; /** @@ -261,14 +261,14 @@ public function __construct(?array $data = null) } /** - * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName - * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the - * $this->openAPINullablesSetToNull array - * - * @param string $variableName - * @param array $fields - * @param mixed $defaultValue - */ + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ private function setIfExists(string $variableName, array $fields, $defaultValue): void { if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { diff --git a/lib/User/UpdateDepartmentMember200Response.php b/lib/User/UpdateDepartmentMember200Response.php index 218f3d1c..54f604ff 100644 --- a/lib/User/UpdateDepartmentMember200Response.php +++ b/lib/User/UpdateDepartmentMember200Response.php @@ -44,17 +44,17 @@ class UpdateDepartmentMember200Response implements ModelInterface, ArrayAccess, public const DISCRIMINATOR = null; /** - * The original name of the model. - * - * @var string - */ + * The original name of the model. + * + * @var string + */ protected static $openAPIModelName = 'updateDepartmentMember_200_response'; /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ protected static $openAPITypes = [ 'group_id' => 'int', 'name' => 'string', @@ -68,12 +68,12 @@ class UpdateDepartmentMember200Response implements ModelInterface, ArrayAccess, ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - * @phpstan-var array - * @psalm-var array - */ + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ protected static $openAPIFormats = [ 'group_id' => null, 'name' => null, @@ -87,10 +87,10 @@ class UpdateDepartmentMember200Response implements ModelInterface, ArrayAccess, ]; /** - * Array of nullable properties. Used for (de)serialization - * - * @var boolean[] - */ + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ protected static array $openAPINullables = [ 'group_id' => false, 'name' => false, @@ -104,10 +104,10 @@ class UpdateDepartmentMember200Response implements ModelInterface, ArrayAccess, ]; /** - * If a nullable field gets set to null, insert it here - * - * @var boolean[] - */ + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ protected array $openAPINullablesSetToNull = []; /** @@ -303,14 +303,14 @@ public function __construct(?array $data = null) } /** - * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName - * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the - * $this->openAPINullablesSetToNull array - * - * @param string $variableName - * @param array $fields - * @param mixed $defaultValue - */ + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ private function setIfExists(string $variableName, array $fields, $defaultValue): void { if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { diff --git a/lib/User/UpdateGroup200Response.php b/lib/User/UpdateGroup200Response.php index 7928b03f..bc75703f 100644 --- a/lib/User/UpdateGroup200Response.php +++ b/lib/User/UpdateGroup200Response.php @@ -44,17 +44,17 @@ class UpdateGroup200Response implements ModelInterface, ArrayAccess, \JsonSerial public const DISCRIMINATOR = null; /** - * The original name of the model. - * - * @var string - */ + * The original name of the model. + * + * @var string + */ protected static $openAPIModelName = 'updateGroup_200_response'; /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ protected static $openAPITypes = [ 'id' => 'int', 'parent_group_id' => 'int', @@ -66,12 +66,12 @@ class UpdateGroup200Response implements ModelInterface, ArrayAccess, \JsonSerial ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - * @phpstan-var array - * @psalm-var array - */ + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ protected static $openAPIFormats = [ 'id' => null, 'parent_group_id' => null, @@ -83,10 +83,10 @@ class UpdateGroup200Response implements ModelInterface, ArrayAccess, \JsonSerial ]; /** - * Array of nullable properties. Used for (de)serialization - * - * @var boolean[] - */ + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ protected static array $openAPINullables = [ 'id' => false, 'parent_group_id' => false, @@ -98,10 +98,10 @@ class UpdateGroup200Response implements ModelInterface, ArrayAccess, \JsonSerial ]; /** - * If a nullable field gets set to null, insert it here - * - * @var boolean[] - */ + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ protected array $openAPINullablesSetToNull = []; /** @@ -289,14 +289,14 @@ public function __construct(?array $data = null) } /** - * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName - * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the - * $this->openAPINullablesSetToNull array - * - * @param string $variableName - * @param array $fields - * @param mixed $defaultValue - */ + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ private function setIfExists(string $variableName, array $fields, $defaultValue): void { if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { diff --git a/lib/User/UpdateGroupRequest.php b/lib/User/UpdateGroupRequest.php index 5febca84..e140e2e0 100644 --- a/lib/User/UpdateGroupRequest.php +++ b/lib/User/UpdateGroupRequest.php @@ -44,49 +44,49 @@ class UpdateGroupRequest implements ModelInterface, ArrayAccess, \JsonSerializab public const DISCRIMINATOR = null; /** - * The original name of the model. - * - * @var string - */ + * The original name of the model. + * + * @var string + */ protected static $openAPIModelName = 'updateGroup_request'; /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ protected static $openAPITypes = [ 'name' => 'string', 'owner' => 'string' ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - * @phpstan-var array - * @psalm-var array - */ + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ protected static $openAPIFormats = [ 'name' => null, 'owner' => null ]; /** - * Array of nullable properties. Used for (de)serialization - * - * @var boolean[] - */ + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ protected static array $openAPINullables = [ 'name' => false, 'owner' => false ]; /** - * If a nullable field gets set to null, insert it here - * - * @var boolean[] - */ + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ protected array $openAPINullablesSetToNull = []; /** @@ -254,14 +254,14 @@ public function __construct(?array $data = null) } /** - * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName - * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the - * $this->openAPINullablesSetToNull array - * - * @param string $variableName - * @param array $fields - * @param mixed $defaultValue - */ + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ private function setIfExists(string $variableName, array $fields, $defaultValue): void { if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { diff --git a/lib/User/UpdateGroupRoleRequest.php b/lib/User/UpdateGroupRoleRequest.php index 3b2fc9a0..8365446c 100644 --- a/lib/User/UpdateGroupRoleRequest.php +++ b/lib/User/UpdateGroupRoleRequest.php @@ -44,46 +44,46 @@ class UpdateGroupRoleRequest implements ModelInterface, ArrayAccess, \JsonSerial public const DISCRIMINATOR = null; /** - * The original name of the model. - * - * @var string - */ + * The original name of the model. + * + * @var string + */ protected static $openAPIModelName = 'updateGroupRole_request'; /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ protected static $openAPITypes = [ 'is_admin' => '\SeaTable\Client\User\IsAdmin' ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - * @phpstan-var array - * @psalm-var array - */ + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ protected static $openAPIFormats = [ 'is_admin' => null ]; /** - * Array of nullable properties. Used for (de)serialization - * - * @var boolean[] - */ + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ protected static array $openAPINullables = [ 'is_admin' => false ]; /** - * If a nullable field gets set to null, insert it here - * - * @var boolean[] - */ + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ protected array $openAPINullablesSetToNull = []; /** @@ -247,14 +247,14 @@ public function __construct(?array $data = null) } /** - * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName - * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the - * $this->openAPINullablesSetToNull array - * - * @param string $variableName - * @param array $fields - * @param mixed $defaultValue - */ + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ private function setIfExists(string $variableName, array $fields, $defaultValue): void { if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { diff --git a/lib/User/UpdateNotificationRuleRequest.php b/lib/User/UpdateNotificationRuleRequest.php index 50dd1d44..12452be1 100644 --- a/lib/User/UpdateNotificationRuleRequest.php +++ b/lib/User/UpdateNotificationRuleRequest.php @@ -44,17 +44,17 @@ class UpdateNotificationRuleRequest implements ModelInterface, ArrayAccess, \Jso public const DISCRIMINATOR = null; /** - * The original name of the model. - * - * @var string - */ + * The original name of the model. + * + * @var string + */ protected static $openAPIModelName = 'updateNotificationRule_request'; /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ protected static $openAPITypes = [ 'run_condition' => 'string', 'trigger' => '\SeaTable\Client\User\Trigger', @@ -62,12 +62,12 @@ class UpdateNotificationRuleRequest implements ModelInterface, ArrayAccess, \Jso ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - * @phpstan-var array - * @psalm-var array - */ + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ protected static $openAPIFormats = [ 'run_condition' => null, 'trigger' => null, @@ -75,10 +75,10 @@ class UpdateNotificationRuleRequest implements ModelInterface, ArrayAccess, \Jso ]; /** - * Array of nullable properties. Used for (de)serialization - * - * @var boolean[] - */ + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ protected static array $openAPINullables = [ 'run_condition' => false, 'trigger' => false, @@ -86,10 +86,10 @@ class UpdateNotificationRuleRequest implements ModelInterface, ArrayAccess, \Jso ]; /** - * If a nullable field gets set to null, insert it here - * - * @var boolean[] - */ + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ protected array $openAPINullablesSetToNull = []; /** @@ -261,14 +261,14 @@ public function __construct(?array $data = null) } /** - * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName - * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the - * $this->openAPINullablesSetToNull array - * - * @param string $variableName - * @param array $fields - * @param mixed $defaultValue - */ + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ private function setIfExists(string $variableName, array $fields, $defaultValue): void { if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { diff --git a/lib/User/UserApi.php b/lib/User/UserApi.php index 3f2ee89d..a293b778 100644 --- a/lib/User/UserApi.php +++ b/lib/User/UserApi.php @@ -28,11 +28,11 @@ use GuzzleHttp\Client; use GuzzleHttp\ClientInterface; -use GuzzleHttp\Exception\ConnectException; use GuzzleHttp\Exception\RequestException; use GuzzleHttp\Psr7\MultipartStream; use GuzzleHttp\Psr7\Request; use GuzzleHttp\RequestOptions; +use Psr\Http\Client\NetworkExceptionInterface; use Psr\Http\Message\RequestInterface; use Psr\Http\Message\ResponseInterface; use SeaTable\Client\ApiException; @@ -180,13 +180,14 @@ public function addUserAvatarWithHttpInfo($avatar = null, $avatar_size = null, s try { $response = $this->client->send($request, $options); } catch (RequestException $e) { + $eResponse = $this->getExceptionResponse($e); throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), - $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? (string) $e->getResponse()->getBody() : null + $eResponse ? $eResponse->getHeaders() : null, + $eResponse ? (string) $eResponse->getBody() : null ); - } catch (ConnectException $e) { + } catch (NetworkExceptionInterface $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), @@ -303,7 +304,15 @@ function ($response) use ($returnType) { ]; }, function ($exception) { - $response = $exception->getResponse(); + $response = $this->getExceptionResponse($exception); + if ($response === null) { + throw new ApiException( + "[{$exception->getCode()}] {$exception->getMessage()}", + (int) $exception->getCode(), + null, + null + ); + } $statusCode = $response->getStatusCode(); throw new ApiException( sprintf( @@ -350,7 +359,7 @@ public function addUserAvatarRequest($avatar = null, $avatar_size = null, string $formData = $formDataProcessor->prepare([ 'avatar' => $avatar, - 'avatar_size' => $avatar_size, + 'Avatar_size' => $avatar_size, ]); $formParams = $formDataProcessor->flatten($formData); @@ -381,7 +390,11 @@ public function addUserAvatarRequest($avatar = null, $avatar_size = null, string } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + try { + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + } catch (\JsonException $e) { + throw new \InvalidArgumentException('json_encode error: ' . $e->getMessage(), 0, $e); + } } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -451,13 +464,14 @@ public function getAccountInfoWithHttpInfo(string $contentType = self::contentTy try { $response = $this->client->send($request, $options); } catch (RequestException $e) { + $eResponse = $this->getExceptionResponse($e); throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), - $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? (string) $e->getResponse()->getBody() : null + $eResponse ? $eResponse->getHeaders() : null, + $eResponse ? (string) $eResponse->getBody() : null ); - } catch (ConnectException $e) { + } catch (NetworkExceptionInterface $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), @@ -598,7 +612,15 @@ function ($response) use ($returnType) { ]; }, function ($exception) { - $response = $exception->getResponse(); + $response = $this->getExceptionResponse($exception); + if ($response === null) { + throw new ApiException( + "[{$exception->getCode()}] {$exception->getMessage()}", + (int) $exception->getCode(), + null, + null + ); + } $statusCode = $response->getStatusCode(); throw new ApiException( sprintf( @@ -661,7 +683,11 @@ public function getAccountInfoRequest(string $contentType = self::contentTypes[' } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + try { + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + } catch (\JsonException $e) { + throw new \InvalidArgumentException('json_encode error: ' . $e->getMessage(), 0, $e); + } } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -733,13 +759,14 @@ public function getPublicUserInfoWithHttpInfo($user_id, string $contentType = se try { $response = $this->client->send($request, $options); } catch (RequestException $e) { + $eResponse = $this->getExceptionResponse($e); throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), - $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? (string) $e->getResponse()->getBody() : null + $eResponse ? $eResponse->getHeaders() : null, + $eResponse ? (string) $eResponse->getBody() : null ); - } catch (ConnectException $e) { + } catch (NetworkExceptionInterface $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), @@ -854,7 +881,15 @@ function ($response) use ($returnType) { ]; }, function ($exception) { - $response = $exception->getResponse(); + $response = $this->getExceptionResponse($exception); + if ($response === null) { + throw new ApiException( + "[{$exception->getCode()}] {$exception->getMessage()}", + (int) $exception->getCode(), + null, + null + ); + } $statusCode = $response->getStatusCode(); throw new ApiException( sprintf( @@ -905,7 +940,7 @@ public function getPublicUserInfoRequest($user_id, string $contentType = self::c // path params if ($user_id !== null) { $resourcePath = str_replace( - '{' . 'user_id' . '}', + '{user_id}', ObjectSerializer::toPathValue($user_id), $resourcePath ); @@ -936,7 +971,11 @@ public function getPublicUserInfoRequest($user_id, string $contentType = self::c } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + try { + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + } catch (\JsonException $e) { + throw new \InvalidArgumentException('json_encode error: ' . $e->getMessage(), 0, $e); + } } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -1008,13 +1047,14 @@ public function listPublicUserInfosWithHttpInfo($list_public_user_infos_request try { $response = $this->client->send($request, $options); } catch (RequestException $e) { + $eResponse = $this->getExceptionResponse($e); throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), - $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? (string) $e->getResponse()->getBody() : null + $eResponse ? $eResponse->getHeaders() : null, + $eResponse ? (string) $eResponse->getBody() : null ); - } catch (ConnectException $e) { + } catch (NetworkExceptionInterface $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), @@ -1129,7 +1169,15 @@ function ($response) use ($returnType) { ]; }, function ($exception) { - $response = $exception->getResponse(); + $response = $this->getExceptionResponse($exception); + if ($response === null) { + throw new ApiException( + "[{$exception->getCode()}] {$exception->getMessage()}", + (int) $exception->getCode(), + null, + null + ); + } $statusCode = $response->getStatusCode(); throw new ApiException( sprintf( @@ -1180,7 +1228,11 @@ public function listPublicUserInfosRequest($list_public_user_infos_request = nul if (isset($list_public_user_infos_request)) { if (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the body - $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($list_public_user_infos_request)); + try { + $httpBody = json_encode(ObjectSerializer::sanitizeForSerialization($list_public_user_infos_request), JSON_THROW_ON_ERROR); + } catch (\JsonException $e) { + throw new \InvalidArgumentException('json_encode error: ' . $e->getMessage(), 0, $e); + } } else { $httpBody = $list_public_user_infos_request; } @@ -1201,7 +1253,11 @@ public function listPublicUserInfosRequest($list_public_user_infos_request = nul } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + try { + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + } catch (\JsonException $e) { + throw new \InvalidArgumentException('json_encode error: ' . $e->getMessage(), 0, $e); + } } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -1273,13 +1329,14 @@ public function searchUserWithHttpInfo($q = null, string $contentType = self::co try { $response = $this->client->send($request, $options); } catch (RequestException $e) { + $eResponse = $this->getExceptionResponse($e); throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), - $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? (string) $e->getResponse()->getBody() : null + $eResponse ? $eResponse->getHeaders() : null, + $eResponse ? (string) $eResponse->getBody() : null ); - } catch (ConnectException $e) { + } catch (NetworkExceptionInterface $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), @@ -1394,7 +1451,15 @@ function ($response) use ($returnType) { ]; }, function ($exception) { - $response = $exception->getResponse(); + $response = $this->getExceptionResponse($exception); + if ($response === null) { + throw new ApiException( + "[{$exception->getCode()}] {$exception->getMessage()}", + (int) $exception->getCode(), + null, + null + ); + } $statusCode = $response->getStatusCode(); throw new ApiException( sprintf( @@ -1468,7 +1533,11 @@ public function searchUserRequest($q = null, string $contentType = self::content } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + try { + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + } catch (\JsonException $e) { + throw new \InvalidArgumentException('json_encode error: ' . $e->getMessage(), 0, $e); + } } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -1540,13 +1609,14 @@ public function updateEmailAddressWithHttpInfo($new_contact_email = null, string try { $response = $this->client->send($request, $options); } catch (RequestException $e) { + $eResponse = $this->getExceptionResponse($e); throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), - $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? (string) $e->getResponse()->getBody() : null + $eResponse ? $eResponse->getHeaders() : null, + $eResponse ? (string) $eResponse->getBody() : null ); - } catch (ConnectException $e) { + } catch (NetworkExceptionInterface $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), @@ -1661,7 +1731,15 @@ function ($response) use ($returnType) { ]; }, function ($exception) { - $response = $exception->getResponse(); + $response = $this->getExceptionResponse($exception); + if ($response === null) { + throw new ApiException( + "[{$exception->getCode()}] {$exception->getMessage()}", + (int) $exception->getCode(), + null, + null + ); + } $statusCode = $response->getStatusCode(); throw new ApiException( sprintf( @@ -1736,7 +1814,11 @@ public function updateEmailAddressRequest($new_contact_email = null, string $con } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + try { + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + } catch (\JsonException $e) { + throw new \InvalidArgumentException('json_encode error: ' . $e->getMessage(), 0, $e); + } } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -1796,6 +1878,21 @@ protected function createHttpClientOption() return $options; } + /** + * Returns the response attached to a Guzzle exception, if there is one. + * + * Guzzle 7 exposes getResponse() on RequestException, while Guzzle 8 only + * exposes it on ResponseException and its subclasses. + * + * @param \Throwable $exception + * + * @return ResponseInterface|null + */ + private function getExceptionResponse(\Throwable $exception): ?ResponseInterface + { + return method_exists($exception, 'getResponse') ? $exception->getResponse() : null; + } + private function handleResponseWithDataType( string $dataType, RequestInterface $request, diff --git a/lib/User/UsersInfo.php b/lib/User/UsersInfo.php index 228e60e0..630f8d77 100644 --- a/lib/User/UsersInfo.php +++ b/lib/User/UsersInfo.php @@ -44,49 +44,49 @@ class UsersInfo implements ModelInterface, ArrayAccess, \JsonSerializable public const DISCRIMINATOR = null; /** - * The original name of the model. - * - * @var string - */ + * The original name of the model. + * + * @var string + */ protected static $openAPIModelName = 'users_info'; /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ protected static $openAPITypes = [ 'email' => 'string', 'role_id' => 'int' ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - * @phpstan-var array - * @psalm-var array - */ + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ protected static $openAPIFormats = [ 'email' => null, 'role_id' => null ]; /** - * Array of nullable properties. Used for (de)serialization - * - * @var boolean[] - */ + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ protected static array $openAPINullables = [ 'email' => false, 'role_id' => false ]; /** - * If a nullable field gets set to null, insert it here - * - * @var boolean[] - */ + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ protected array $openAPINullablesSetToNull = []; /** @@ -254,14 +254,14 @@ public function __construct(?array $data = null) } /** - * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName - * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the - * $this->openAPINullablesSetToNull array - * - * @param string $variableName - * @param array $fields - * @param mixed $defaultValue - */ + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ private function setIfExists(string $variableName, array $fields, $defaultValue): void { if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { diff --git a/lib/User/WebhooksApi.php b/lib/User/WebhooksApi.php index 761c2647..77b16545 100644 --- a/lib/User/WebhooksApi.php +++ b/lib/User/WebhooksApi.php @@ -28,11 +28,11 @@ use GuzzleHttp\Client; use GuzzleHttp\ClientInterface; -use GuzzleHttp\Exception\ConnectException; use GuzzleHttp\Exception\RequestException; use GuzzleHttp\Psr7\MultipartStream; use GuzzleHttp\Psr7\Request; use GuzzleHttp\RequestOptions; +use Psr\Http\Client\NetworkExceptionInterface; use Psr\Http\Message\RequestInterface; use Psr\Http\Message\ResponseInterface; use SeaTable\Client\ApiException; @@ -178,13 +178,14 @@ public function createWebhookWithHttpInfo($workspace_id, $base_name, $url = null try { $response = $this->client->send($request, $options); } catch (RequestException $e) { + $eResponse = $this->getExceptionResponse($e); throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), - $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? (string) $e->getResponse()->getBody() : null + $eResponse ? $eResponse->getHeaders() : null, + $eResponse ? (string) $eResponse->getBody() : null ); - } catch (ConnectException $e) { + } catch (NetworkExceptionInterface $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), @@ -305,7 +306,15 @@ function ($response) use ($returnType) { ]; }, function ($exception) { - $response = $exception->getResponse(); + $response = $this->getExceptionResponse($exception); + if ($response === null) { + throw new ApiException( + "[{$exception->getCode()}] {$exception->getMessage()}", + (int) $exception->getCode(), + null, + null + ); + } $statusCode = $response->getStatusCode(); throw new ApiException( sprintf( @@ -368,7 +377,7 @@ public function createWebhookRequest($workspace_id, $base_name, $url = null, $se // path params if ($workspace_id !== null) { $resourcePath = str_replace( - '{' . 'workspace_id' . '}', + '{workspace_id}', ObjectSerializer::toPathValue($workspace_id), $resourcePath ); @@ -376,7 +385,7 @@ public function createWebhookRequest($workspace_id, $base_name, $url = null, $se // path params if ($base_name !== null) { $resourcePath = str_replace( - '{' . 'base_name' . '}', + '{base_name}', ObjectSerializer::toPathValue($base_name), $resourcePath ); @@ -418,7 +427,11 @@ public function createWebhookRequest($workspace_id, $base_name, $url = null, $se } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + try { + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + } catch (\JsonException $e) { + throw new \InvalidArgumentException('json_encode error: ' . $e->getMessage(), 0, $e); + } } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -494,13 +507,14 @@ public function deleteWebhookWithHttpInfo($workspace_id, $base_name, $webhook_id try { $response = $this->client->send($request, $options); } catch (RequestException $e) { + $eResponse = $this->getExceptionResponse($e); throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), - $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? (string) $e->getResponse()->getBody() : null + $eResponse ? $eResponse->getHeaders() : null, + $eResponse ? (string) $eResponse->getBody() : null ); - } catch (ConnectException $e) { + } catch (NetworkExceptionInterface $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), @@ -619,7 +633,15 @@ function ($response) use ($returnType) { ]; }, function ($exception) { - $response = $exception->getResponse(); + $response = $this->getExceptionResponse($exception); + if ($response === null) { + throw new ApiException( + "[{$exception->getCode()}] {$exception->getMessage()}", + (int) $exception->getCode(), + null, + null + ); + } $statusCode = $response->getStatusCode(); throw new ApiException( sprintf( @@ -689,7 +711,7 @@ public function deleteWebhookRequest($workspace_id, $base_name, $webhook_id, str // path params if ($workspace_id !== null) { $resourcePath = str_replace( - '{' . 'workspace_id' . '}', + '{workspace_id}', ObjectSerializer::toPathValue($workspace_id), $resourcePath ); @@ -697,7 +719,7 @@ public function deleteWebhookRequest($workspace_id, $base_name, $webhook_id, str // path params if ($base_name !== null) { $resourcePath = str_replace( - '{' . 'base_name' . '}', + '{base_name}', ObjectSerializer::toPathValue($base_name), $resourcePath ); @@ -705,7 +727,7 @@ public function deleteWebhookRequest($workspace_id, $base_name, $webhook_id, str // path params if ($webhook_id !== null) { $resourcePath = str_replace( - '{' . 'webhook_id' . '}', + '{webhook_id}', ObjectSerializer::toPathValue($webhook_id), $resourcePath ); @@ -736,7 +758,11 @@ public function deleteWebhookRequest($workspace_id, $base_name, $webhook_id, str } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + try { + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + } catch (\JsonException $e) { + throw new \InvalidArgumentException('json_encode error: ' . $e->getMessage(), 0, $e); + } } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -810,13 +836,14 @@ public function listWebhooksWithHttpInfo($workspace_id, $base_name, string $cont try { $response = $this->client->send($request, $options); } catch (RequestException $e) { + $eResponse = $this->getExceptionResponse($e); throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), - $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? (string) $e->getResponse()->getBody() : null + $eResponse ? $eResponse->getHeaders() : null, + $eResponse ? (string) $eResponse->getBody() : null ); - } catch (ConnectException $e) { + } catch (NetworkExceptionInterface $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), @@ -933,7 +960,15 @@ function ($response) use ($returnType) { ]; }, function ($exception) { - $response = $exception->getResponse(); + $response = $this->getExceptionResponse($exception); + if ($response === null) { + throw new ApiException( + "[{$exception->getCode()}] {$exception->getMessage()}", + (int) $exception->getCode(), + null, + null + ); + } $statusCode = $response->getStatusCode(); throw new ApiException( sprintf( @@ -992,7 +1027,7 @@ public function listWebhooksRequest($workspace_id, $base_name, string $contentTy // path params if ($workspace_id !== null) { $resourcePath = str_replace( - '{' . 'workspace_id' . '}', + '{workspace_id}', ObjectSerializer::toPathValue($workspace_id), $resourcePath ); @@ -1000,7 +1035,7 @@ public function listWebhooksRequest($workspace_id, $base_name, string $contentTy // path params if ($base_name !== null) { $resourcePath = str_replace( - '{' . 'base_name' . '}', + '{base_name}', ObjectSerializer::toPathValue($base_name), $resourcePath ); @@ -1031,7 +1066,11 @@ public function listWebhooksRequest($workspace_id, $base_name, string $contentTy } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + try { + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + } catch (\JsonException $e) { + throw new \InvalidArgumentException('json_encode error: ' . $e->getMessage(), 0, $e); + } } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -1111,13 +1150,14 @@ public function updateWebhookWithHttpInfo($workspace_id, $base_name, $webhook_id try { $response = $this->client->send($request, $options); } catch (RequestException $e) { + $eResponse = $this->getExceptionResponse($e); throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), - $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? (string) $e->getResponse()->getBody() : null + $eResponse ? $eResponse->getHeaders() : null, + $eResponse ? (string) $eResponse->getBody() : null ); - } catch (ConnectException $e) { + } catch (NetworkExceptionInterface $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), @@ -1240,7 +1280,15 @@ function ($response) use ($returnType) { ]; }, function ($exception) { - $response = $exception->getResponse(); + $response = $this->getExceptionResponse($exception); + if ($response === null) { + throw new ApiException( + "[{$exception->getCode()}] {$exception->getMessage()}", + (int) $exception->getCode(), + null, + null + ); + } $statusCode = $response->getStatusCode(); throw new ApiException( sprintf( @@ -1314,7 +1362,7 @@ public function updateWebhookRequest($workspace_id, $base_name, $webhook_id, $ur // path params if ($workspace_id !== null) { $resourcePath = str_replace( - '{' . 'workspace_id' . '}', + '{workspace_id}', ObjectSerializer::toPathValue($workspace_id), $resourcePath ); @@ -1322,7 +1370,7 @@ public function updateWebhookRequest($workspace_id, $base_name, $webhook_id, $ur // path params if ($base_name !== null) { $resourcePath = str_replace( - '{' . 'base_name' . '}', + '{base_name}', ObjectSerializer::toPathValue($base_name), $resourcePath ); @@ -1330,7 +1378,7 @@ public function updateWebhookRequest($workspace_id, $base_name, $webhook_id, $ur // path params if ($webhook_id !== null) { $resourcePath = str_replace( - '{' . 'webhook_id' . '}', + '{webhook_id}', ObjectSerializer::toPathValue($webhook_id), $resourcePath ); @@ -1372,7 +1420,11 @@ public function updateWebhookRequest($workspace_id, $base_name, $webhook_id, $ur } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + try { + $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR); + } catch (\JsonException $e) { + throw new \InvalidArgumentException('json_encode error: ' . $e->getMessage(), 0, $e); + } } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -1432,6 +1484,21 @@ protected function createHttpClientOption() return $options; } + /** + * Returns the response attached to a Guzzle exception, if there is one. + * + * Guzzle 7 exposes getResponse() on RequestException, while Guzzle 8 only + * exposes it on ResponseException and its subclasses. + * + * @param \Throwable $exception + * + * @return ResponseInterface|null + */ + private function getExceptionResponse(\Throwable $exception): ?ResponseInterface + { + return method_exists($exception, 'getResponse') ? $exception->getResponse() : null; + } + private function handleResponseWithDataType( string $dataType, RequestInterface $request, diff --git a/lib/User/XDaysBeforeRunningTheTaskValue.php b/lib/User/XDaysBeforeRunningTheTaskValue.php index bf2dd6d0..5db8aa54 100644 --- a/lib/User/XDaysBeforeRunningTheTaskValue.php +++ b/lib/User/XDaysBeforeRunningTheTaskValue.php @@ -44,17 +44,17 @@ class XDaysBeforeRunningTheTaskValue implements ModelInterface, ArrayAccess, \Js public const DISCRIMINATOR = null; /** - * The original name of the model. - * - * @var string - */ + * The original name of the model. + * + * @var string + */ protected static $openAPIModelName = 'x_days_before_running_the_task_value'; /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ protected static $openAPITypes = [ 'set_type' => 'string', 'offset' => 'int', @@ -62,12 +62,12 @@ class XDaysBeforeRunningTheTaskValue implements ModelInterface, ArrayAccess, \Js ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - * @phpstan-var array - * @psalm-var array - */ + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ protected static $openAPIFormats = [ 'set_type' => null, 'offset' => null, @@ -75,10 +75,10 @@ class XDaysBeforeRunningTheTaskValue implements ModelInterface, ArrayAccess, \Js ]; /** - * Array of nullable properties. Used for (de)serialization - * - * @var boolean[] - */ + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ protected static array $openAPINullables = [ 'set_type' => false, 'offset' => false, @@ -86,10 +86,10 @@ class XDaysBeforeRunningTheTaskValue implements ModelInterface, ArrayAccess, \Js ]; /** - * If a nullable field gets set to null, insert it here - * - * @var boolean[] - */ + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ protected array $openAPINullablesSetToNull = []; /** @@ -287,14 +287,14 @@ public function __construct(?array $data = null) } /** - * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName - * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the - * $this->openAPINullablesSetToNull array - * - * @param string $variableName - * @param array $fields - * @param mixed $defaultValue - */ + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ private function setIfExists(string $variableName, array $fields, $defaultValue): void { if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { diff --git a/lib/User/XxxExactDate.php b/lib/User/XxxExactDate.php index 156a204e..c30b02d5 100644 --- a/lib/User/XxxExactDate.php +++ b/lib/User/XxxExactDate.php @@ -45,17 +45,17 @@ class XxxExactDate implements ModelInterface, ArrayAccess, \JsonSerializable public const DISCRIMINATOR = null; /** - * The original name of the model. - * - * @var string - */ + * The original name of the model. + * + * @var string + */ protected static $openAPIModelName = 'xxx_exact_date'; /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ protected static $openAPITypes = [ 'column_key' => 'string', 'filter_predicate' => 'string', @@ -64,12 +64,12 @@ class XxxExactDate implements ModelInterface, ArrayAccess, \JsonSerializable ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - * @phpstan-var array - * @psalm-var array - */ + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ protected static $openAPIFormats = [ 'column_key' => null, 'filter_predicate' => null, @@ -78,10 +78,10 @@ class XxxExactDate implements ModelInterface, ArrayAccess, \JsonSerializable ]; /** - * Array of nullable properties. Used for (de)serialization - * - * @var boolean[] - */ + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ protected static array $openAPINullables = [ 'column_key' => false, 'filter_predicate' => false, @@ -90,10 +90,10 @@ class XxxExactDate implements ModelInterface, ArrayAccess, \JsonSerializable ]; /** - * If a nullable field gets set to null, insert it here - * - * @var boolean[] - */ + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ protected array $openAPINullablesSetToNull = []; /** @@ -305,14 +305,14 @@ public function __construct(?array $data = null) } /** - * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName - * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the - * $this->openAPINullablesSetToNull array - * - * @param string $variableName - * @param array $fields - * @param mixed $defaultValue - */ + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ private function setIfExists(string $variableName, array $fields, $defaultValue): void { if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { diff --git a/lib/User/XxxNumberOfDaysAgo.php b/lib/User/XxxNumberOfDaysAgo.php index 4cfedd3a..3fb3a708 100644 --- a/lib/User/XxxNumberOfDaysAgo.php +++ b/lib/User/XxxNumberOfDaysAgo.php @@ -45,17 +45,17 @@ class XxxNumberOfDaysAgo implements ModelInterface, ArrayAccess, \JsonSerializab public const DISCRIMINATOR = null; /** - * The original name of the model. - * - * @var string - */ + * The original name of the model. + * + * @var string + */ protected static $openAPIModelName = 'xxx_number_of_days_ago'; /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ protected static $openAPITypes = [ 'column_key' => 'string', 'filter_predicate' => 'string', @@ -64,12 +64,12 @@ class XxxNumberOfDaysAgo implements ModelInterface, ArrayAccess, \JsonSerializab ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - * @phpstan-var array - * @psalm-var array - */ + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ protected static $openAPIFormats = [ 'column_key' => null, 'filter_predicate' => null, @@ -78,10 +78,10 @@ class XxxNumberOfDaysAgo implements ModelInterface, ArrayAccess, \JsonSerializab ]; /** - * Array of nullable properties. Used for (de)serialization - * - * @var boolean[] - */ + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ protected static array $openAPINullables = [ 'column_key' => false, 'filter_predicate' => false, @@ -90,10 +90,10 @@ class XxxNumberOfDaysAgo implements ModelInterface, ArrayAccess, \JsonSerializab ]; /** - * If a nullable field gets set to null, insert it here - * - * @var boolean[] - */ + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ protected array $openAPINullablesSetToNull = []; /** @@ -305,14 +305,14 @@ public function __construct(?array $data = null) } /** - * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName - * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the - * $this->openAPINullablesSetToNull array - * - * @param string $variableName - * @param array $fields - * @param mixed $defaultValue - */ + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ private function setIfExists(string $variableName, array $fields, $defaultValue): void { if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { diff --git a/lib/User/XxxNumberOfDaysFromNow.php b/lib/User/XxxNumberOfDaysFromNow.php index 59fd8834..e6eba8fc 100644 --- a/lib/User/XxxNumberOfDaysFromNow.php +++ b/lib/User/XxxNumberOfDaysFromNow.php @@ -45,17 +45,17 @@ class XxxNumberOfDaysFromNow implements ModelInterface, ArrayAccess, \JsonSerial public const DISCRIMINATOR = null; /** - * The original name of the model. - * - * @var string - */ + * The original name of the model. + * + * @var string + */ protected static $openAPIModelName = 'xxx_number_of_days_from_now'; /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ protected static $openAPITypes = [ 'column_key' => 'string', 'filter_predicate' => 'string', @@ -64,12 +64,12 @@ class XxxNumberOfDaysFromNow implements ModelInterface, ArrayAccess, \JsonSerial ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - * @phpstan-var array - * @psalm-var array - */ + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ protected static $openAPIFormats = [ 'column_key' => null, 'filter_predicate' => null, @@ -78,10 +78,10 @@ class XxxNumberOfDaysFromNow implements ModelInterface, ArrayAccess, \JsonSerial ]; /** - * Array of nullable properties. Used for (de)serialization - * - * @var boolean[] - */ + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ protected static array $openAPINullables = [ 'column_key' => false, 'filter_predicate' => false, @@ -90,10 +90,10 @@ class XxxNumberOfDaysFromNow implements ModelInterface, ArrayAccess, \JsonSerial ]; /** - * If a nullable field gets set to null, insert it here - * - * @var boolean[] - */ + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ protected array $openAPINullablesSetToNull = []; /** @@ -305,14 +305,14 @@ public function __construct(?array $data = null) } /** - * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName - * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the - * $this->openAPINullablesSetToNull array - * - * @param string $variableName - * @param array $fields - * @param mixed $defaultValue - */ + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ private function setIfExists(string $variableName, array $fields, $defaultValue): void { if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { diff --git a/lib/User/XxxOneMonthAgo.php b/lib/User/XxxOneMonthAgo.php index a9bce853..6f9d3c80 100644 --- a/lib/User/XxxOneMonthAgo.php +++ b/lib/User/XxxOneMonthAgo.php @@ -45,17 +45,17 @@ class XxxOneMonthAgo implements ModelInterface, ArrayAccess, \JsonSerializable public const DISCRIMINATOR = null; /** - * The original name of the model. - * - * @var string - */ + * The original name of the model. + * + * @var string + */ protected static $openAPIModelName = 'xxx_one_month_ago'; /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ protected static $openAPITypes = [ 'column_key' => 'string', 'filter_predicate' => 'string', @@ -64,12 +64,12 @@ class XxxOneMonthAgo implements ModelInterface, ArrayAccess, \JsonSerializable ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - * @phpstan-var array - * @psalm-var array - */ + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ protected static $openAPIFormats = [ 'column_key' => null, 'filter_predicate' => null, @@ -78,10 +78,10 @@ class XxxOneMonthAgo implements ModelInterface, ArrayAccess, \JsonSerializable ]; /** - * Array of nullable properties. Used for (de)serialization - * - * @var boolean[] - */ + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ protected static array $openAPINullables = [ 'column_key' => false, 'filter_predicate' => false, @@ -90,10 +90,10 @@ class XxxOneMonthAgo implements ModelInterface, ArrayAccess, \JsonSerializable ]; /** - * If a nullable field gets set to null, insert it here - * - * @var boolean[] - */ + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ protected array $openAPINullablesSetToNull = []; /** @@ -305,14 +305,14 @@ public function __construct(?array $data = null) } /** - * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName - * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the - * $this->openAPINullablesSetToNull array - * - * @param string $variableName - * @param array $fields - * @param mixed $defaultValue - */ + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ private function setIfExists(string $variableName, array $fields, $defaultValue): void { if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { diff --git a/lib/User/XxxOneMonthFromNow.php b/lib/User/XxxOneMonthFromNow.php index dc606d7c..cd35a056 100644 --- a/lib/User/XxxOneMonthFromNow.php +++ b/lib/User/XxxOneMonthFromNow.php @@ -45,17 +45,17 @@ class XxxOneMonthFromNow implements ModelInterface, ArrayAccess, \JsonSerializab public const DISCRIMINATOR = null; /** - * The original name of the model. - * - * @var string - */ + * The original name of the model. + * + * @var string + */ protected static $openAPIModelName = 'xxx_one_month_from_now'; /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ protected static $openAPITypes = [ 'column_key' => 'string', 'filter_predicate' => 'string', @@ -64,12 +64,12 @@ class XxxOneMonthFromNow implements ModelInterface, ArrayAccess, \JsonSerializab ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - * @phpstan-var array - * @psalm-var array - */ + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ protected static $openAPIFormats = [ 'column_key' => null, 'filter_predicate' => null, @@ -78,10 +78,10 @@ class XxxOneMonthFromNow implements ModelInterface, ArrayAccess, \JsonSerializab ]; /** - * Array of nullable properties. Used for (de)serialization - * - * @var boolean[] - */ + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ protected static array $openAPINullables = [ 'column_key' => false, 'filter_predicate' => false, @@ -90,10 +90,10 @@ class XxxOneMonthFromNow implements ModelInterface, ArrayAccess, \JsonSerializab ]; /** - * If a nullable field gets set to null, insert it here - * - * @var boolean[] - */ + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ protected array $openAPINullablesSetToNull = []; /** @@ -305,14 +305,14 @@ public function __construct(?array $data = null) } /** - * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName - * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the - * $this->openAPINullablesSetToNull array - * - * @param string $variableName - * @param array $fields - * @param mixed $defaultValue - */ + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ private function setIfExists(string $variableName, array $fields, $defaultValue): void { if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { diff --git a/lib/User/XxxOneWeekAgo.php b/lib/User/XxxOneWeekAgo.php index 13e3db06..b32558be 100644 --- a/lib/User/XxxOneWeekAgo.php +++ b/lib/User/XxxOneWeekAgo.php @@ -45,17 +45,17 @@ class XxxOneWeekAgo implements ModelInterface, ArrayAccess, \JsonSerializable public const DISCRIMINATOR = null; /** - * The original name of the model. - * - * @var string - */ + * The original name of the model. + * + * @var string + */ protected static $openAPIModelName = 'xxx_one_week_ago'; /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ protected static $openAPITypes = [ 'column_key' => 'string', 'filter_predicate' => 'string', @@ -64,12 +64,12 @@ class XxxOneWeekAgo implements ModelInterface, ArrayAccess, \JsonSerializable ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - * @phpstan-var array - * @psalm-var array - */ + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ protected static $openAPIFormats = [ 'column_key' => null, 'filter_predicate' => null, @@ -78,10 +78,10 @@ class XxxOneWeekAgo implements ModelInterface, ArrayAccess, \JsonSerializable ]; /** - * Array of nullable properties. Used for (de)serialization - * - * @var boolean[] - */ + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ protected static array $openAPINullables = [ 'column_key' => false, 'filter_predicate' => false, @@ -90,10 +90,10 @@ class XxxOneWeekAgo implements ModelInterface, ArrayAccess, \JsonSerializable ]; /** - * If a nullable field gets set to null, insert it here - * - * @var boolean[] - */ + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ protected array $openAPINullablesSetToNull = []; /** @@ -305,14 +305,14 @@ public function __construct(?array $data = null) } /** - * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName - * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the - * $this->openAPINullablesSetToNull array - * - * @param string $variableName - * @param array $fields - * @param mixed $defaultValue - */ + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ private function setIfExists(string $variableName, array $fields, $defaultValue): void { if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { diff --git a/lib/User/XxxOneWeekFromNow.php b/lib/User/XxxOneWeekFromNow.php index 15883c49..689bad96 100644 --- a/lib/User/XxxOneWeekFromNow.php +++ b/lib/User/XxxOneWeekFromNow.php @@ -45,17 +45,17 @@ class XxxOneWeekFromNow implements ModelInterface, ArrayAccess, \JsonSerializabl public const DISCRIMINATOR = null; /** - * The original name of the model. - * - * @var string - */ + * The original name of the model. + * + * @var string + */ protected static $openAPIModelName = 'xxx_one_week_from_now'; /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ protected static $openAPITypes = [ 'column_key' => 'string', 'filter_predicate' => 'string', @@ -64,12 +64,12 @@ class XxxOneWeekFromNow implements ModelInterface, ArrayAccess, \JsonSerializabl ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - * @phpstan-var array - * @psalm-var array - */ + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ protected static $openAPIFormats = [ 'column_key' => null, 'filter_predicate' => null, @@ -78,10 +78,10 @@ class XxxOneWeekFromNow implements ModelInterface, ArrayAccess, \JsonSerializabl ]; /** - * Array of nullable properties. Used for (de)serialization - * - * @var boolean[] - */ + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ protected static array $openAPINullables = [ 'column_key' => false, 'filter_predicate' => false, @@ -90,10 +90,10 @@ class XxxOneWeekFromNow implements ModelInterface, ArrayAccess, \JsonSerializabl ]; /** - * If a nullable field gets set to null, insert it here - * - * @var boolean[] - */ + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ protected array $openAPINullablesSetToNull = []; /** @@ -305,14 +305,14 @@ public function __construct(?array $data = null) } /** - * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName - * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the - * $this->openAPINullablesSetToNull array - * - * @param string $variableName - * @param array $fields - * @param mixed $defaultValue - */ + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ private function setIfExists(string $variableName, array $fields, $defaultValue): void { if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { diff --git a/lib/User/XxxToday.php b/lib/User/XxxToday.php index 66ce850e..cd63db68 100644 --- a/lib/User/XxxToday.php +++ b/lib/User/XxxToday.php @@ -45,17 +45,17 @@ class XxxToday implements ModelInterface, ArrayAccess, \JsonSerializable public const DISCRIMINATOR = null; /** - * The original name of the model. - * - * @var string - */ + * The original name of the model. + * + * @var string + */ protected static $openAPIModelName = 'xxx_today'; /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ protected static $openAPITypes = [ 'column_key' => 'string', 'filter_predicate' => 'string', @@ -64,12 +64,12 @@ class XxxToday implements ModelInterface, ArrayAccess, \JsonSerializable ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - * @phpstan-var array - * @psalm-var array - */ + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ protected static $openAPIFormats = [ 'column_key' => null, 'filter_predicate' => null, @@ -78,10 +78,10 @@ class XxxToday implements ModelInterface, ArrayAccess, \JsonSerializable ]; /** - * Array of nullable properties. Used for (de)serialization - * - * @var boolean[] - */ + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ protected static array $openAPINullables = [ 'column_key' => false, 'filter_predicate' => false, @@ -90,10 +90,10 @@ class XxxToday implements ModelInterface, ArrayAccess, \JsonSerializable ]; /** - * If a nullable field gets set to null, insert it here - * - * @var boolean[] - */ + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ protected array $openAPINullablesSetToNull = []; /** @@ -305,14 +305,14 @@ public function __construct(?array $data = null) } /** - * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName - * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the - * $this->openAPINullablesSetToNull array - * - * @param string $variableName - * @param array $fields - * @param mixed $defaultValue - */ + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ private function setIfExists(string $variableName, array $fields, $defaultValue): void { if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { diff --git a/lib/User/XxxTomorrow.php b/lib/User/XxxTomorrow.php index 1c4c438a..aeccb31f 100644 --- a/lib/User/XxxTomorrow.php +++ b/lib/User/XxxTomorrow.php @@ -45,17 +45,17 @@ class XxxTomorrow implements ModelInterface, ArrayAccess, \JsonSerializable public const DISCRIMINATOR = null; /** - * The original name of the model. - * - * @var string - */ + * The original name of the model. + * + * @var string + */ protected static $openAPIModelName = 'xxx_tomorrow'; /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ protected static $openAPITypes = [ 'column_key' => 'string', 'filter_predicate' => 'string', @@ -64,12 +64,12 @@ class XxxTomorrow implements ModelInterface, ArrayAccess, \JsonSerializable ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - * @phpstan-var array - * @psalm-var array - */ + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ protected static $openAPIFormats = [ 'column_key' => null, 'filter_predicate' => null, @@ -78,10 +78,10 @@ class XxxTomorrow implements ModelInterface, ArrayAccess, \JsonSerializable ]; /** - * Array of nullable properties. Used for (de)serialization - * - * @var boolean[] - */ + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ protected static array $openAPINullables = [ 'column_key' => false, 'filter_predicate' => false, @@ -90,10 +90,10 @@ class XxxTomorrow implements ModelInterface, ArrayAccess, \JsonSerializable ]; /** - * If a nullable field gets set to null, insert it here - * - * @var boolean[] - */ + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ protected array $openAPINullablesSetToNull = []; /** @@ -305,14 +305,14 @@ public function __construct(?array $data = null) } /** - * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName - * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the - * $this->openAPINullablesSetToNull array - * - * @param string $variableName - * @param array $fields - * @param mixed $defaultValue - */ + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ private function setIfExists(string $variableName, array $fields, $defaultValue): void { if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { diff --git a/lib/User/XxxYesterday.php b/lib/User/XxxYesterday.php index 297419e3..772a6d11 100644 --- a/lib/User/XxxYesterday.php +++ b/lib/User/XxxYesterday.php @@ -45,17 +45,17 @@ class XxxYesterday implements ModelInterface, ArrayAccess, \JsonSerializable public const DISCRIMINATOR = null; /** - * The original name of the model. - * - * @var string - */ + * The original name of the model. + * + * @var string + */ protected static $openAPIModelName = 'xxx_yesterday'; /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ protected static $openAPITypes = [ 'column_key' => 'string', 'filter_predicate' => 'string', @@ -64,12 +64,12 @@ class XxxYesterday implements ModelInterface, ArrayAccess, \JsonSerializable ]; /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - * @phpstan-var array - * @psalm-var array - */ + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ protected static $openAPIFormats = [ 'column_key' => null, 'filter_predicate' => null, @@ -78,10 +78,10 @@ class XxxYesterday implements ModelInterface, ArrayAccess, \JsonSerializable ]; /** - * Array of nullable properties. Used for (de)serialization - * - * @var boolean[] - */ + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ protected static array $openAPINullables = [ 'column_key' => false, 'filter_predicate' => false, @@ -90,10 +90,10 @@ class XxxYesterday implements ModelInterface, ArrayAccess, \JsonSerializable ]; /** - * If a nullable field gets set to null, insert it here - * - * @var boolean[] - */ + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ protected array $openAPINullablesSetToNull = []; /** @@ -305,14 +305,14 @@ public function __construct(?array $data = null) } /** - * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName - * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the - * $this->openAPINullablesSetToNull array - * - * @param string $variableName - * @param array $fields - * @param mixed $defaultValue - */ + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ private function setIfExists(string $variableName, array $fields, $defaultValue): void { if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) {