From 430dad6b28c797a75d6404f75bb24339843f354d Mon Sep 17 00:00:00 2001 From: Marat Shakirov Date: Thu, 2 Jan 2025 23:25:27 +0000 Subject: [PATCH] feat: update all clients --- .../.openapi-generator/FILES | 12 + .../CredentialIssuanceClient/README.md | 3 + .../docs/Api/DefaultApi.md | 8 +- .../ChangeCredentialStatus400Response.md | 13 + .../docs/Model/ChangeCredentialStatusInput.md | 4 +- .../docs/Model/ChangeStatusForbiddenError.md | 13 + .../docs/Model/RevocationForbiddenError.md | 13 + .../lib/Api/ConfigurationApi.php | 81 ++- .../lib/Api/CredentialsApi.php | 25 +- .../lib/Api/DefaultApi.php | 110 ++- .../lib/Api/IssuanceApi.php | 53 +- .../lib/Api/OfferApi.php | 25 +- .../lib/Api/WellKnownApi.php | 25 +- .../lib/InvalidJwtTokenError.php | 80 +++ .../lib/InvalidParameterError.php | 75 ++ .../ChangeCredentialStatus400Response.php | 654 ++++++++++++++++++ .../lib/Model/ChangeCredentialStatusInput.php | 68 +- .../lib/Model/ChangeStatusForbiddenError.php | 654 ++++++++++++++++++ .../lib/Model/RevocationForbiddenError.php | 654 ++++++++++++++++++ .../lib/NotFoundError.php | 73 ++ .../ChangeCredentialStatus400ResponseTest.php | 127 ++++ .../Model/ChangeStatusForbiddenErrorTest.php | 127 ++++ .../Model/RevocationForbiddenErrorTest.php | 127 ++++ .../.openapi-generator/FILES | 3 + .../lib/Api/DefaultApi.php | 39 +- .../lib/InvalidJwtTokenError.php | 80 +++ .../lib/InvalidParameterError.php | 75 ++ .../lib/NotFoundError.php | 73 ++ .../IamClient/.openapi-generator/FILES | 8 +- src/Clients/IamClient/README.md | 2 +- src/Clients/IamClient/docs/Api/ProjectsApi.md | 22 +- src/Clients/IamClient/docs/Api/TokensApi.md | 19 +- .../IamClient/docs/Model/ProjectList.md | 1 + src/Clients/IamClient/docs/Model/TokenList.md | 1 + .../IamClient/docs/Model/TypedPrincipalId.md | 9 + src/Clients/IamClient/docs/Model/UserList.md | 1 + .../IamClient/lib/Api/ConsumerAuthApi.php | 25 +- src/Clients/IamClient/lib/Api/DefaultApi.php | 151 +++- src/Clients/IamClient/lib/Api/PoliciesApi.php | 39 +- src/Clients/IamClient/lib/Api/ProjectsApi.php | 209 +++++- src/Clients/IamClient/lib/Api/StsApi.php | 39 +- src/Clients/IamClient/lib/Api/TokensApi.php | 195 +++++- .../IamClient/lib/Api/WellKnownApi.php | 39 +- .../IamClient/lib/InvalidJwtTokenError.php | 80 +++ .../IamClient/lib/InvalidParameterError.php | 75 ++ .../IamClient/lib/Model/ProjectList.php | 46 +- src/Clients/IamClient/lib/Model/TokenList.php | 46 +- .../IamClient/lib/Model/TypedPrincipalId.php | 413 +++++++++++ src/Clients/IamClient/lib/Model/UserList.php | 46 +- src/Clients/IamClient/lib/NotFoundError.php | 73 ++ .../test/Model/TypedPrincipalIdTest.php | 91 +++ .../IotaClient/.openapi-generator/FILES | 3 + .../docs/Model/FetchIOTAVPResponseOK.md | 2 + .../IotaClient/lib/Api/CallbackApi.php | 25 +- .../IotaClient/lib/Api/ConfigurationsApi.php | 95 ++- src/Clients/IotaClient/lib/Api/DefaultApi.php | 65 +- src/Clients/IotaClient/lib/Api/IotaApi.php | 81 ++- .../IotaClient/lib/Api/PexQueryApi.php | 129 +++- .../IotaClient/lib/InvalidJwtTokenError.php | 80 +++ .../IotaClient/lib/InvalidParameterError.php | 75 ++ .../lib/Model/FetchIOTAVPResponseOK.php | 4 + src/Clients/IotaClient/lib/NotFoundError.php | 73 ++ .../.openapi-generator/FILES | 3 + .../lib/Api/AllowListApi.php | 83 ++- .../lib/Api/ConfigurationApi.php | 135 +++- .../lib/Api/DenyListApi.php | 155 ++++- .../lib/Api/GroupApi.php | 139 +++- .../lib/Api/IdpApi.php | 109 ++- .../lib/InvalidJwtTokenError.php | 80 +++ .../lib/InvalidParameterError.php | 75 ++ .../lib/NotFoundError.php | 73 ++ .../WalletsClient/.openapi-generator/FILES | 3 + .../WalletsClient/lib/Api/RevocationApi.php | 53 +- .../WalletsClient/lib/Api/WalletApi.php | 129 +++- .../lib/InvalidJwtTokenError.php | 80 +++ .../lib/InvalidParameterError.php | 75 ++ .../WalletsClient/lib/NotFoundError.php | 73 ++ 77 files changed, 6471 insertions(+), 350 deletions(-) create mode 100644 src/Clients/CredentialIssuanceClient/docs/Model/ChangeCredentialStatus400Response.md create mode 100644 src/Clients/CredentialIssuanceClient/docs/Model/ChangeStatusForbiddenError.md create mode 100644 src/Clients/CredentialIssuanceClient/docs/Model/RevocationForbiddenError.md create mode 100644 src/Clients/CredentialIssuanceClient/lib/InvalidJwtTokenError.php create mode 100644 src/Clients/CredentialIssuanceClient/lib/InvalidParameterError.php create mode 100644 src/Clients/CredentialIssuanceClient/lib/Model/ChangeCredentialStatus400Response.php create mode 100644 src/Clients/CredentialIssuanceClient/lib/Model/ChangeStatusForbiddenError.php create mode 100644 src/Clients/CredentialIssuanceClient/lib/Model/RevocationForbiddenError.php create mode 100644 src/Clients/CredentialIssuanceClient/lib/NotFoundError.php create mode 100644 src/Clients/CredentialIssuanceClient/test/Model/ChangeCredentialStatus400ResponseTest.php create mode 100644 src/Clients/CredentialIssuanceClient/test/Model/ChangeStatusForbiddenErrorTest.php create mode 100644 src/Clients/CredentialIssuanceClient/test/Model/RevocationForbiddenErrorTest.php create mode 100644 src/Clients/CredentialVerificationClient/lib/InvalidJwtTokenError.php create mode 100644 src/Clients/CredentialVerificationClient/lib/InvalidParameterError.php create mode 100644 src/Clients/CredentialVerificationClient/lib/NotFoundError.php create mode 100644 src/Clients/IamClient/docs/Model/TypedPrincipalId.md create mode 100644 src/Clients/IamClient/lib/InvalidJwtTokenError.php create mode 100644 src/Clients/IamClient/lib/InvalidParameterError.php create mode 100644 src/Clients/IamClient/lib/Model/TypedPrincipalId.php create mode 100644 src/Clients/IamClient/lib/NotFoundError.php create mode 100644 src/Clients/IamClient/test/Model/TypedPrincipalIdTest.php create mode 100644 src/Clients/IotaClient/lib/InvalidJwtTokenError.php create mode 100644 src/Clients/IotaClient/lib/InvalidParameterError.php create mode 100644 src/Clients/IotaClient/lib/NotFoundError.php create mode 100644 src/Clients/LoginConfigurationClient/lib/InvalidJwtTokenError.php create mode 100644 src/Clients/LoginConfigurationClient/lib/InvalidParameterError.php create mode 100644 src/Clients/LoginConfigurationClient/lib/NotFoundError.php create mode 100644 src/Clients/WalletsClient/lib/InvalidJwtTokenError.php create mode 100644 src/Clients/WalletsClient/lib/InvalidParameterError.php create mode 100644 src/Clients/WalletsClient/lib/NotFoundError.php diff --git a/src/Clients/CredentialIssuanceClient/.openapi-generator/FILES b/src/Clients/CredentialIssuanceClient/.openapi-generator/FILES index 42ddcf4..f170da8 100644 --- a/src/Clients/CredentialIssuanceClient/.openapi-generator/FILES +++ b/src/Clients/CredentialIssuanceClient/.openapi-generator/FILES @@ -9,7 +9,9 @@ docs/Api/OfferApi.md docs/Api/WellKnownApi.md docs/Model/ActionForbiddenError.md docs/Model/ActionForbiddenErrorDetailsInner.md +docs/Model/ChangeCredentialStatus400Response.md docs/Model/ChangeCredentialStatusInput.md +docs/Model/ChangeStatusForbiddenError.md docs/Model/CorsGenerateCredentialsOK.md docs/Model/CorsGetCredentialOfferOK.md docs/Model/CorsGetWellKnownOpenIdCredentialIssuerOK.md @@ -53,6 +55,7 @@ docs/Model/MissingHolderDidError.md docs/Model/NotFoundError.md docs/Model/ProjectCredentialConfigExistError.md docs/Model/ProjectCredentialConfigNotExistError.md +docs/Model/RevocationForbiddenError.md docs/Model/StartIssuance400Response.md docs/Model/StartIssuanceInput.md docs/Model/StartIssuanceInputDataInner.md @@ -75,9 +78,13 @@ lib/Api/WellKnownApi.php lib/ApiException.php lib/Configuration.php lib/HeaderSelector.php +lib/InvalidJwtTokenError.php +lib/InvalidParameterError.php lib/Model/ActionForbiddenError.php lib/Model/ActionForbiddenErrorDetailsInner.php +lib/Model/ChangeCredentialStatus400Response.php lib/Model/ChangeCredentialStatusInput.php +lib/Model/ChangeStatusForbiddenError.php lib/Model/CorsGenerateCredentialsOK.php lib/Model/CorsGetCredentialOfferOK.php lib/Model/CorsGetWellKnownOpenIdCredentialIssuerOK.php @@ -122,6 +129,7 @@ lib/Model/ModelInterface.php lib/Model/NotFoundError.php lib/Model/ProjectCredentialConfigExistError.php lib/Model/ProjectCredentialConfigNotExistError.php +lib/Model/RevocationForbiddenError.php lib/Model/StartIssuance400Response.php lib/Model/StartIssuanceInput.php lib/Model/StartIssuanceInputDataInner.php @@ -135,5 +143,9 @@ lib/Model/UpdateIssuanceConfigInput.php lib/Model/VcClaimedError.php lib/Model/WellKnownOpenIdCredentialIssuerResponse.php lib/Model/WellKnownOpenIdCredentialIssuerResponseCredentialsSupportedInner.php +lib/NotFoundError.php lib/ObjectSerializer.php phpunit.xml.dist +test/Model/ChangeCredentialStatus400ResponseTest.php +test/Model/ChangeStatusForbiddenErrorTest.php +test/Model/RevocationForbiddenErrorTest.php diff --git a/src/Clients/CredentialIssuanceClient/README.md b/src/Clients/CredentialIssuanceClient/README.md index 91c772b..46dcafd 100644 --- a/src/Clients/CredentialIssuanceClient/README.md +++ b/src/Clients/CredentialIssuanceClient/README.md @@ -84,7 +84,9 @@ Class | Method | HTTP request | Description - [ActionForbiddenError](docs/Model/ActionForbiddenError.md) - [ActionForbiddenErrorDetailsInner](docs/Model/ActionForbiddenErrorDetailsInner.md) +- [ChangeCredentialStatus400Response](docs/Model/ChangeCredentialStatus400Response.md) - [ChangeCredentialStatusInput](docs/Model/ChangeCredentialStatusInput.md) +- [ChangeStatusForbiddenError](docs/Model/ChangeStatusForbiddenError.md) - [CorsGenerateCredentialsOK](docs/Model/CorsGenerateCredentialsOK.md) - [CorsGetCredentialOfferOK](docs/Model/CorsGetCredentialOfferOK.md) - [CorsGetWellKnownOpenIdCredentialIssuerOK](docs/Model/CorsGetWellKnownOpenIdCredentialIssuerOK.md) @@ -128,6 +130,7 @@ Class | Method | HTTP request | Description - [NotFoundError](docs/Model/NotFoundError.md) - [ProjectCredentialConfigExistError](docs/Model/ProjectCredentialConfigExistError.md) - [ProjectCredentialConfigNotExistError](docs/Model/ProjectCredentialConfigNotExistError.md) +- [RevocationForbiddenError](docs/Model/RevocationForbiddenError.md) - [StartIssuance400Response](docs/Model/StartIssuance400Response.md) - [StartIssuanceInput](docs/Model/StartIssuanceInput.md) - [StartIssuanceInputDataInner](docs/Model/StartIssuanceInputDataInner.md) diff --git a/src/Clients/CredentialIssuanceClient/docs/Api/DefaultApi.md b/src/Clients/CredentialIssuanceClient/docs/Api/DefaultApi.md index bb9d35e..fbd62d3 100644 --- a/src/Clients/CredentialIssuanceClient/docs/Api/DefaultApi.md +++ b/src/Clients/CredentialIssuanceClient/docs/Api/DefaultApi.md @@ -11,7 +11,7 @@ All URIs are relative to https://apse1.api.affinidi.io/cis, except if the operat ## `changeCredentialStatus()` ```php -changeCredentialStatus($project_id, $configuration_id): \AffinidiTdk\Clients\CredentialIssuanceClient\Model\FlowData +changeCredentialStatus($project_id, $configuration_id, $change_credential_status_input): \AffinidiTdk\Clients\CredentialIssuanceClient\Model\FlowData ``` change credential status. @@ -39,9 +39,10 @@ $apiInstance = new AffinidiTdk\Clients\CredentialIssuanceClient\Api\DefaultApi( ); $project_id = 'project_id_example'; // string | project id $configuration_id = 'configuration_id_example'; // string | configuration id +$change_credential_status_input = new \AffinidiTdk\Clients\CredentialIssuanceClient\Model\ChangeCredentialStatusInput(); // \AffinidiTdk\Clients\CredentialIssuanceClient\Model\ChangeCredentialStatusInput | Request body for changing credential status try { - $result = $apiInstance->changeCredentialStatus($project_id, $configuration_id); + $result = $apiInstance->changeCredentialStatus($project_id, $configuration_id, $change_credential_status_input); print_r($result); } catch (Exception $e) { echo 'Exception when calling DefaultApi->changeCredentialStatus: ', $e->getMessage(), PHP_EOL; @@ -54,6 +55,7 @@ try { | ------------- | ------------- | ------------- | ------------- | | **project_id** | **string**| project id | | | **configuration_id** | **string**| configuration id | | +| **change_credential_status_input** | [**\AffinidiTdk\Clients\CredentialIssuanceClient\Model\ChangeCredentialStatusInput**](../Model/ChangeCredentialStatusInput.md)| Request body for changing credential status | | ### Return type @@ -65,7 +67,7 @@ try { ### HTTP request headers -- **Content-Type**: Not defined +- **Content-Type**: `application/json` - **Accept**: `application/json` [[Back to top]](#) [[Back to API list]](../../README.md#endpoints) diff --git a/src/Clients/CredentialIssuanceClient/docs/Model/ChangeCredentialStatus400Response.md b/src/Clients/CredentialIssuanceClient/docs/Model/ChangeCredentialStatus400Response.md new file mode 100644 index 0000000..b31886f --- /dev/null +++ b/src/Clients/CredentialIssuanceClient/docs/Model/ChangeCredentialStatus400Response.md @@ -0,0 +1,13 @@ +# # ChangeCredentialStatus400Response + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**name** | **string** | | +**message** | **string** | | +**http_status_code** | **float** | | +**trace_id** | **string** | | +**details** | [**\AffinidiTdk\Clients\CredentialIssuanceClient\Model\ActionForbiddenErrorDetailsInner[]**](ActionForbiddenErrorDetailsInner.md) | | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/src/Clients/CredentialIssuanceClient/docs/Model/ChangeCredentialStatusInput.md b/src/Clients/CredentialIssuanceClient/docs/Model/ChangeCredentialStatusInput.md index e4414ab..e322d8f 100644 --- a/src/Clients/CredentialIssuanceClient/docs/Model/ChangeCredentialStatusInput.md +++ b/src/Clients/CredentialIssuanceClient/docs/Model/ChangeCredentialStatusInput.md @@ -4,7 +4,7 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**change_reason** | **string** | | [optional] -**issuance_flow_data_id** | **string** | | [optional] +**change_reason** | **string** | reason for revocation | [optional] +**issuance_record_id** | **string** | | [optional] [[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/src/Clients/CredentialIssuanceClient/docs/Model/ChangeStatusForbiddenError.md b/src/Clients/CredentialIssuanceClient/docs/Model/ChangeStatusForbiddenError.md new file mode 100644 index 0000000..c88a4e6 --- /dev/null +++ b/src/Clients/CredentialIssuanceClient/docs/Model/ChangeStatusForbiddenError.md @@ -0,0 +1,13 @@ +# # ChangeStatusForbiddenError + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**name** | **string** | | +**message** | **string** | | +**http_status_code** | **float** | | +**trace_id** | **string** | | +**details** | [**\AffinidiTdk\Clients\CredentialIssuanceClient\Model\ActionForbiddenErrorDetailsInner[]**](ActionForbiddenErrorDetailsInner.md) | | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/src/Clients/CredentialIssuanceClient/docs/Model/RevocationForbiddenError.md b/src/Clients/CredentialIssuanceClient/docs/Model/RevocationForbiddenError.md new file mode 100644 index 0000000..1cd672d --- /dev/null +++ b/src/Clients/CredentialIssuanceClient/docs/Model/RevocationForbiddenError.md @@ -0,0 +1,13 @@ +# # RevocationForbiddenError + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**name** | **string** | | +**message** | **string** | | +**http_status_code** | **float** | | +**trace_id** | **string** | | +**details** | [**\AffinidiTdk\Clients\CredentialIssuanceClient\Model\ActionForbiddenErrorDetailsInner[]**](ActionForbiddenErrorDetailsInner.md) | | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/src/Clients/CredentialIssuanceClient/lib/Api/ConfigurationApi.php b/src/Clients/CredentialIssuanceClient/lib/Api/ConfigurationApi.php index 44f3ca7..fe52418 100644 --- a/src/Clients/CredentialIssuanceClient/lib/Api/ConfigurationApi.php +++ b/src/Clients/CredentialIssuanceClient/lib/Api/ConfigurationApi.php @@ -36,6 +36,9 @@ use GuzzleHttp\Psr7\Request; use GuzzleHttp\RequestOptions; use AffinidiTdk\Clients\CredentialIssuanceClient\ApiException; +use AffinidiTdk\Clients\CredentialIssuanceClient\InvalidJwtTokenError; +use AffinidiTdk\Clients\CredentialIssuanceClient\InvalidParameterError; +use AffinidiTdk\Clients\CredentialIssuanceClient\NotFoundError; use AffinidiTdk\Clients\CredentialIssuanceClient\Configuration; use AffinidiTdk\Clients\CredentialIssuanceClient\HeaderSelector; use AffinidiTdk\Clients\CredentialIssuanceClient\ObjectSerializer; @@ -96,10 +99,10 @@ class ConfigurationApi * @param int $hostIndex (Optional) host index to select the list of hosts if defined in the OpenAPI spec */ public function __construct( - ClientInterface $client = null, - Configuration $config = null, - HeaderSelector $selector = null, - $hostIndex = 0 + ?ClientInterface $client = null, + ?Configuration $config = null, + ?HeaderSelector $selector = null, + int $hostIndex = 0 ) { $this->client = $client ?: new Client(); $this->config = $config ?: Configuration::getDefaultConfiguration(); @@ -170,6 +173,20 @@ public function createIssuanceConfigWithHttpInfo($create_issuance_config_input, try { $response = $this->client->send($request, $options); } catch (RequestException $e) { + $jsonResponse = json_decode($e->getResponse()->getBody()); + if ($jsonResponse->name === 'InvalidJwtTokenError') { + $issue = $jsonResponse->details[0]->issue; + throw new InvalidJwtTokenError($issue, $jsonResponse->traceId); + } + + if ($jsonResponse->name === 'NotFoundError') { + throw new NotFoundError($jsonResponse->message, $jsonResponse->traceId); + } + + if ($jsonResponse->name === 'InvalidParameterError') { + throw new InvalidParameterError($jsonResponse->message, $jsonResponse->details, $jsonResponse->traceId); + } + throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), @@ -508,6 +525,20 @@ public function deleteIssuanceConfigByIdWithHttpInfo($configuration_id, string $ try { $response = $this->client->send($request, $options); } catch (RequestException $e) { + $jsonResponse = json_decode($e->getResponse()->getBody()); + if ($jsonResponse->name === 'InvalidJwtTokenError') { + $issue = $jsonResponse->details[0]->issue; + throw new InvalidJwtTokenError($issue, $jsonResponse->traceId); + } + + if ($jsonResponse->name === 'NotFoundError') { + throw new NotFoundError($jsonResponse->message, $jsonResponse->traceId); + } + + if ($jsonResponse->name === 'InvalidParameterError') { + throw new InvalidParameterError($jsonResponse->message, $jsonResponse->details, $jsonResponse->traceId); + } + throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), @@ -739,6 +770,20 @@ public function getIssuanceConfigByIdWithHttpInfo($configuration_id, string $con try { $response = $this->client->send($request, $options); } catch (RequestException $e) { + $jsonResponse = json_decode($e->getResponse()->getBody()); + if ($jsonResponse->name === 'InvalidJwtTokenError') { + $issue = $jsonResponse->details[0]->issue; + throw new InvalidJwtTokenError($issue, $jsonResponse->traceId); + } + + if ($jsonResponse->name === 'NotFoundError') { + throw new NotFoundError($jsonResponse->message, $jsonResponse->traceId); + } + + if ($jsonResponse->name === 'InvalidParameterError') { + throw new InvalidParameterError($jsonResponse->message, $jsonResponse->details, $jsonResponse->traceId); + } + throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), @@ -1112,6 +1157,20 @@ public function getIssuanceConfigListWithHttpInfo(string $contentType = self::co try { $response = $this->client->send($request, $options); } catch (RequestException $e) { + $jsonResponse = json_decode($e->getResponse()->getBody()); + if ($jsonResponse->name === 'InvalidJwtTokenError') { + $issue = $jsonResponse->details[0]->issue; + throw new InvalidJwtTokenError($issue, $jsonResponse->traceId); + } + + if ($jsonResponse->name === 'NotFoundError') { + throw new NotFoundError($jsonResponse->message, $jsonResponse->traceId); + } + + if ($jsonResponse->name === 'InvalidParameterError') { + throw new InvalidParameterError($jsonResponse->message, $jsonResponse->details, $jsonResponse->traceId); + } + throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), @@ -1401,6 +1460,20 @@ public function updateIssuanceConfigByIdWithHttpInfo($configuration_id, $update_ try { $response = $this->client->send($request, $options); } catch (RequestException $e) { + $jsonResponse = json_decode($e->getResponse()->getBody()); + if ($jsonResponse->name === 'InvalidJwtTokenError') { + $issue = $jsonResponse->details[0]->issue; + throw new InvalidJwtTokenError($issue, $jsonResponse->traceId); + } + + if ($jsonResponse->name === 'NotFoundError') { + throw new NotFoundError($jsonResponse->message, $jsonResponse->traceId); + } + + if ($jsonResponse->name === 'InvalidParameterError') { + throw new InvalidParameterError($jsonResponse->message, $jsonResponse->details, $jsonResponse->traceId); + } + throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), diff --git a/src/Clients/CredentialIssuanceClient/lib/Api/CredentialsApi.php b/src/Clients/CredentialIssuanceClient/lib/Api/CredentialsApi.php index e92a463..c798de9 100644 --- a/src/Clients/CredentialIssuanceClient/lib/Api/CredentialsApi.php +++ b/src/Clients/CredentialIssuanceClient/lib/Api/CredentialsApi.php @@ -36,6 +36,9 @@ use GuzzleHttp\Psr7\Request; use GuzzleHttp\RequestOptions; use AffinidiTdk\Clients\CredentialIssuanceClient\ApiException; +use AffinidiTdk\Clients\CredentialIssuanceClient\InvalidJwtTokenError; +use AffinidiTdk\Clients\CredentialIssuanceClient\InvalidParameterError; +use AffinidiTdk\Clients\CredentialIssuanceClient\NotFoundError; use AffinidiTdk\Clients\CredentialIssuanceClient\Configuration; use AffinidiTdk\Clients\CredentialIssuanceClient\HeaderSelector; use AffinidiTdk\Clients\CredentialIssuanceClient\ObjectSerializer; @@ -84,10 +87,10 @@ class CredentialsApi * @param int $hostIndex (Optional) host index to select the list of hosts if defined in the OpenAPI spec */ public function __construct( - ClientInterface $client = null, - Configuration $config = null, - HeaderSelector $selector = null, - $hostIndex = 0 + ?ClientInterface $client = null, + ?Configuration $config = null, + ?HeaderSelector $selector = null, + int $hostIndex = 0 ) { $this->client = $client ?: new Client(); $this->config = $config ?: Configuration::getDefaultConfiguration(); @@ -160,6 +163,20 @@ public function generateCredentialsWithHttpInfo($project_id, $create_credential_ try { $response = $this->client->send($request, $options); } catch (RequestException $e) { + $jsonResponse = json_decode($e->getResponse()->getBody()); + if ($jsonResponse->name === 'InvalidJwtTokenError') { + $issue = $jsonResponse->details[0]->issue; + throw new InvalidJwtTokenError($issue, $jsonResponse->traceId); + } + + if ($jsonResponse->name === 'NotFoundError') { + throw new NotFoundError($jsonResponse->message, $jsonResponse->traceId); + } + + if ($jsonResponse->name === 'InvalidParameterError') { + throw new InvalidParameterError($jsonResponse->message, $jsonResponse->details, $jsonResponse->traceId); + } + throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), diff --git a/src/Clients/CredentialIssuanceClient/lib/Api/DefaultApi.php b/src/Clients/CredentialIssuanceClient/lib/Api/DefaultApi.php index 42cbf84..a134b35 100644 --- a/src/Clients/CredentialIssuanceClient/lib/Api/DefaultApi.php +++ b/src/Clients/CredentialIssuanceClient/lib/Api/DefaultApi.php @@ -36,6 +36,9 @@ use GuzzleHttp\Psr7\Request; use GuzzleHttp\RequestOptions; use AffinidiTdk\Clients\CredentialIssuanceClient\ApiException; +use AffinidiTdk\Clients\CredentialIssuanceClient\InvalidJwtTokenError; +use AffinidiTdk\Clients\CredentialIssuanceClient\InvalidParameterError; +use AffinidiTdk\Clients\CredentialIssuanceClient\NotFoundError; use AffinidiTdk\Clients\CredentialIssuanceClient\Configuration; use AffinidiTdk\Clients\CredentialIssuanceClient\HeaderSelector; use AffinidiTdk\Clients\CredentialIssuanceClient\ObjectSerializer; @@ -87,10 +90,10 @@ class DefaultApi * @param int $hostIndex (Optional) host index to select the list of hosts if defined in the OpenAPI spec */ public function __construct( - ClientInterface $client = null, - Configuration $config = null, - HeaderSelector $selector = null, - $hostIndex = 0 + ?ClientInterface $client = null, + ?Configuration $config = null, + ?HeaderSelector $selector = null, + int $hostIndex = 0 ) { $this->client = $client ?: new Client(); $this->config = $config ?: Configuration::getDefaultConfiguration(); @@ -133,15 +136,16 @@ public function getConfig() * * @param string $project_id project id (required) * @param string $configuration_id configuration id (required) + * @param \AffinidiTdk\Clients\CredentialIssuanceClient\Model\ChangeCredentialStatusInput $change_credential_status_input Request body for changing credential status (required) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['changeCredentialStatus'] to see the possible values for this operation * * @throws \AffinidiTdk\Clients\CredentialIssuanceClient\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException - * @return \AffinidiTdk\Clients\CredentialIssuanceClient\Model\FlowData|\AffinidiTdk\Clients\CredentialIssuanceClient\Model\InvalidParameterError|\AffinidiTdk\Clients\CredentialIssuanceClient\Model\NotFoundError + * @return \AffinidiTdk\Clients\CredentialIssuanceClient\Model\FlowData|\AffinidiTdk\Clients\CredentialIssuanceClient\Model\ChangeCredentialStatus400Response|\AffinidiTdk\Clients\CredentialIssuanceClient\Model\NotFoundError */ - public function changeCredentialStatus($project_id, $configuration_id, string $contentType = self::contentTypes['changeCredentialStatus'][0]) + public function changeCredentialStatus($project_id, $configuration_id, $change_credential_status_input, string $contentType = self::contentTypes['changeCredentialStatus'][0]) { - list($response) = $this->changeCredentialStatusWithHttpInfo($project_id, $configuration_id, $contentType); + list($response) = $this->changeCredentialStatusWithHttpInfo($project_id, $configuration_id, $change_credential_status_input, $contentType); return $response; } @@ -152,21 +156,36 @@ public function changeCredentialStatus($project_id, $configuration_id, string $c * * @param string $project_id project id (required) * @param string $configuration_id configuration id (required) + * @param \AffinidiTdk\Clients\CredentialIssuanceClient\Model\ChangeCredentialStatusInput $change_credential_status_input Request body for changing credential status (required) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['changeCredentialStatus'] to see the possible values for this operation * * @throws \AffinidiTdk\Clients\CredentialIssuanceClient\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException - * @return array of \AffinidiTdk\Clients\CredentialIssuanceClient\Model\FlowData|\AffinidiTdk\Clients\CredentialIssuanceClient\Model\InvalidParameterError|\AffinidiTdk\Clients\CredentialIssuanceClient\Model\NotFoundError, HTTP status code, HTTP response headers (array of strings) + * @return array of \AffinidiTdk\Clients\CredentialIssuanceClient\Model\FlowData|\AffinidiTdk\Clients\CredentialIssuanceClient\Model\ChangeCredentialStatus400Response|\AffinidiTdk\Clients\CredentialIssuanceClient\Model\NotFoundError, HTTP status code, HTTP response headers (array of strings) */ - public function changeCredentialStatusWithHttpInfo($project_id, $configuration_id, string $contentType = self::contentTypes['changeCredentialStatus'][0]) + public function changeCredentialStatusWithHttpInfo($project_id, $configuration_id, $change_credential_status_input, string $contentType = self::contentTypes['changeCredentialStatus'][0]) { - $request = $this->changeCredentialStatusRequest($project_id, $configuration_id, $contentType); + $request = $this->changeCredentialStatusRequest($project_id, $configuration_id, $change_credential_status_input, $contentType); try { $options = $this->createHttpClientOption(); try { $response = $this->client->send($request, $options); } catch (RequestException $e) { + $jsonResponse = json_decode($e->getResponse()->getBody()); + if ($jsonResponse->name === 'InvalidJwtTokenError') { + $issue = $jsonResponse->details[0]->issue; + throw new InvalidJwtTokenError($issue, $jsonResponse->traceId); + } + + if ($jsonResponse->name === 'NotFoundError') { + throw new NotFoundError($jsonResponse->message, $jsonResponse->traceId); + } + + if ($jsonResponse->name === 'InvalidParameterError') { + throw new InvalidParameterError($jsonResponse->message, $jsonResponse->details, $jsonResponse->traceId); + } + throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), @@ -214,11 +233,11 @@ public function changeCredentialStatusWithHttpInfo($project_id, $configuration_i $response->getHeaders() ]; case 400: - if ('\AffinidiTdk\Clients\CredentialIssuanceClient\Model\InvalidParameterError' === '\SplFileObject') { + if ('\AffinidiTdk\Clients\CredentialIssuanceClient\Model\ChangeCredentialStatus400Response' === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer } else { $content = (string) $response->getBody(); - if ('\AffinidiTdk\Clients\CredentialIssuanceClient\Model\InvalidParameterError' !== 'string') { + if ('\AffinidiTdk\Clients\CredentialIssuanceClient\Model\ChangeCredentialStatus400Response' !== 'string') { try { $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); } catch (\JsonException $exception) { @@ -236,7 +255,7 @@ public function changeCredentialStatusWithHttpInfo($project_id, $configuration_i } return [ - ObjectSerializer::deserialize($content, '\AffinidiTdk\Clients\CredentialIssuanceClient\Model\InvalidParameterError', []), + ObjectSerializer::deserialize($content, '\AffinidiTdk\Clients\CredentialIssuanceClient\Model\ChangeCredentialStatus400Response', []), $response->getStatusCode(), $response->getHeaders() ]; @@ -323,7 +342,7 @@ public function changeCredentialStatusWithHttpInfo($project_id, $configuration_i case 400: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\AffinidiTdk\Clients\CredentialIssuanceClient\Model\InvalidParameterError', + '\AffinidiTdk\Clients\CredentialIssuanceClient\Model\ChangeCredentialStatus400Response', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -348,14 +367,15 @@ public function changeCredentialStatusWithHttpInfo($project_id, $configuration_i * * @param string $project_id project id (required) * @param string $configuration_id configuration id (required) + * @param \AffinidiTdk\Clients\CredentialIssuanceClient\Model\ChangeCredentialStatusInput $change_credential_status_input Request body for changing credential status (required) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['changeCredentialStatus'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function changeCredentialStatusAsync($project_id, $configuration_id, string $contentType = self::contentTypes['changeCredentialStatus'][0]) + public function changeCredentialStatusAsync($project_id, $configuration_id, $change_credential_status_input, string $contentType = self::contentTypes['changeCredentialStatus'][0]) { - return $this->changeCredentialStatusAsyncWithHttpInfo($project_id, $configuration_id, $contentType) + return $this->changeCredentialStatusAsyncWithHttpInfo($project_id, $configuration_id, $change_credential_status_input, $contentType) ->then( function ($response) { return $response[0]; @@ -370,15 +390,16 @@ function ($response) { * * @param string $project_id project id (required) * @param string $configuration_id configuration id (required) + * @param \AffinidiTdk\Clients\CredentialIssuanceClient\Model\ChangeCredentialStatusInput $change_credential_status_input Request body for changing credential status (required) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['changeCredentialStatus'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function changeCredentialStatusAsyncWithHttpInfo($project_id, $configuration_id, string $contentType = self::contentTypes['changeCredentialStatus'][0]) + public function changeCredentialStatusAsyncWithHttpInfo($project_id, $configuration_id, $change_credential_status_input, string $contentType = self::contentTypes['changeCredentialStatus'][0]) { $returnType = '\AffinidiTdk\Clients\CredentialIssuanceClient\Model\FlowData'; - $request = $this->changeCredentialStatusRequest($project_id, $configuration_id, $contentType); + $request = $this->changeCredentialStatusRequest($project_id, $configuration_id, $change_credential_status_input, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) @@ -421,12 +442,13 @@ function ($exception) { * * @param string $project_id project id (required) * @param string $configuration_id configuration id (required) + * @param \AffinidiTdk\Clients\CredentialIssuanceClient\Model\ChangeCredentialStatusInput $change_credential_status_input Request body for changing credential status (required) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['changeCredentialStatus'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - public function changeCredentialStatusRequest($project_id, $configuration_id, string $contentType = self::contentTypes['changeCredentialStatus'][0]) + public function changeCredentialStatusRequest($project_id, $configuration_id, $change_credential_status_input, string $contentType = self::contentTypes['changeCredentialStatus'][0]) { // verify the required parameter 'project_id' is set @@ -443,6 +465,13 @@ public function changeCredentialStatusRequest($project_id, $configuration_id, st ); } + // verify the required parameter 'change_credential_status_input' is set + if ($change_credential_status_input === null || (is_array($change_credential_status_input) && count($change_credential_status_input) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $change_credential_status_input when calling changeCredentialStatus' + ); + } + $resourcePath = '/v1/{projectId}/configurations/{configurationId}/issuance/change-status'; $formParams = []; @@ -478,7 +507,14 @@ public function changeCredentialStatusRequest($project_id, $configuration_id, st ); // for model (json/xml) - if (count($formParams) > 0) { + if (isset($change_credential_status_input)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($change_credential_status_input)); + } else { + $httpBody = $change_credential_status_input; + } + } elseif (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { @@ -536,8 +572,8 @@ public function changeCredentialStatusRequest($project_id, $configuration_id, st * * @param string $project_id Affinidi project id (required) * @param string $configuration_id The id of the issuance configuration (required) - * @param int $limit Maximum number of records to fetch in a list (optional, default to 10) - * @param string $exclusive_start_key exclusiveStartKey for retrieving the next batch of data. (optional) + * @param int|null $limit Maximum number of records to fetch in a list (optional, default to 10) + * @param string|null $exclusive_start_key exclusiveStartKey for retrieving the next batch of data. (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['listIssuanceDataRecords'] to see the possible values for this operation * * @throws \AffinidiTdk\Clients\CredentialIssuanceClient\ApiException on non-2xx response or if the response body is not in the expected format @@ -557,8 +593,8 @@ public function listIssuanceDataRecords($project_id, $configuration_id, $limit = * * @param string $project_id Affinidi project id (required) * @param string $configuration_id The id of the issuance configuration (required) - * @param int $limit Maximum number of records to fetch in a list (optional, default to 10) - * @param string $exclusive_start_key exclusiveStartKey for retrieving the next batch of data. (optional) + * @param int|null $limit Maximum number of records to fetch in a list (optional, default to 10) + * @param string|null $exclusive_start_key exclusiveStartKey for retrieving the next batch of data. (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['listIssuanceDataRecords'] to see the possible values for this operation * * @throws \AffinidiTdk\Clients\CredentialIssuanceClient\ApiException on non-2xx response or if the response body is not in the expected format @@ -574,6 +610,20 @@ public function listIssuanceDataRecordsWithHttpInfo($project_id, $configuration_ try { $response = $this->client->send($request, $options); } catch (RequestException $e) { + $jsonResponse = json_decode($e->getResponse()->getBody()); + if ($jsonResponse->name === 'InvalidJwtTokenError') { + $issue = $jsonResponse->details[0]->issue; + throw new InvalidJwtTokenError($issue, $jsonResponse->traceId); + } + + if ($jsonResponse->name === 'NotFoundError') { + throw new NotFoundError($jsonResponse->message, $jsonResponse->traceId); + } + + if ($jsonResponse->name === 'InvalidParameterError') { + throw new InvalidParameterError($jsonResponse->message, $jsonResponse->details, $jsonResponse->traceId); + } + throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), @@ -755,8 +805,8 @@ public function listIssuanceDataRecordsWithHttpInfo($project_id, $configuration_ * * @param string $project_id Affinidi project id (required) * @param string $configuration_id The id of the issuance configuration (required) - * @param int $limit Maximum number of records to fetch in a list (optional, default to 10) - * @param string $exclusive_start_key exclusiveStartKey for retrieving the next batch of data. (optional) + * @param int|null $limit Maximum number of records to fetch in a list (optional, default to 10) + * @param string|null $exclusive_start_key exclusiveStartKey for retrieving the next batch of data. (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['listIssuanceDataRecords'] to see the possible values for this operation * * @throws \InvalidArgumentException @@ -779,8 +829,8 @@ function ($response) { * * @param string $project_id Affinidi project id (required) * @param string $configuration_id The id of the issuance configuration (required) - * @param int $limit Maximum number of records to fetch in a list (optional, default to 10) - * @param string $exclusive_start_key exclusiveStartKey for retrieving the next batch of data. (optional) + * @param int|null $limit Maximum number of records to fetch in a list (optional, default to 10) + * @param string|null $exclusive_start_key exclusiveStartKey for retrieving the next batch of data. (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['listIssuanceDataRecords'] to see the possible values for this operation * * @throws \InvalidArgumentException @@ -832,8 +882,8 @@ function ($exception) { * * @param string $project_id Affinidi project id (required) * @param string $configuration_id The id of the issuance configuration (required) - * @param int $limit Maximum number of records to fetch in a list (optional, default to 10) - * @param string $exclusive_start_key exclusiveStartKey for retrieving the next batch of data. (optional) + * @param int|null $limit Maximum number of records to fetch in a list (optional, default to 10) + * @param string|null $exclusive_start_key exclusiveStartKey for retrieving the next batch of data. (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['listIssuanceDataRecords'] to see the possible values for this operation * * @throws \InvalidArgumentException diff --git a/src/Clients/CredentialIssuanceClient/lib/Api/IssuanceApi.php b/src/Clients/CredentialIssuanceClient/lib/Api/IssuanceApi.php index 679e1e5..6c23f24 100644 --- a/src/Clients/CredentialIssuanceClient/lib/Api/IssuanceApi.php +++ b/src/Clients/CredentialIssuanceClient/lib/Api/IssuanceApi.php @@ -36,6 +36,9 @@ use GuzzleHttp\Psr7\Request; use GuzzleHttp\RequestOptions; use AffinidiTdk\Clients\CredentialIssuanceClient\ApiException; +use AffinidiTdk\Clients\CredentialIssuanceClient\InvalidJwtTokenError; +use AffinidiTdk\Clients\CredentialIssuanceClient\InvalidParameterError; +use AffinidiTdk\Clients\CredentialIssuanceClient\NotFoundError; use AffinidiTdk\Clients\CredentialIssuanceClient\Configuration; use AffinidiTdk\Clients\CredentialIssuanceClient\HeaderSelector; use AffinidiTdk\Clients\CredentialIssuanceClient\ObjectSerializer; @@ -90,10 +93,10 @@ class IssuanceApi * @param int $hostIndex (Optional) host index to select the list of hosts if defined in the OpenAPI spec */ public function __construct( - ClientInterface $client = null, - Configuration $config = null, - HeaderSelector $selector = null, - $hostIndex = 0 + ?ClientInterface $client = null, + ?Configuration $config = null, + ?HeaderSelector $selector = null, + int $hostIndex = 0 ) { $this->client = $client ?: new Client(); $this->config = $config ?: Configuration::getDefaultConfiguration(); @@ -166,6 +169,20 @@ public function issuanceStateWithHttpInfo($issuance_id, $project_id, string $con try { $response = $this->client->send($request, $options); } catch (RequestException $e) { + $jsonResponse = json_decode($e->getResponse()->getBody()); + if ($jsonResponse->name === 'InvalidJwtTokenError') { + $issue = $jsonResponse->details[0]->issue; + throw new InvalidJwtTokenError($issue, $jsonResponse->traceId); + } + + if ($jsonResponse->name === 'NotFoundError') { + throw new NotFoundError($jsonResponse->message, $jsonResponse->traceId); + } + + if ($jsonResponse->name === 'InvalidParameterError') { + throw new InvalidParameterError($jsonResponse->message, $jsonResponse->details, $jsonResponse->traceId); + } + throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), @@ -594,6 +611,20 @@ public function listIssuanceWithHttpInfo($project_id, string $contentType = self try { $response = $this->client->send($request, $options); } catch (RequestException $e) { + $jsonResponse = json_decode($e->getResponse()->getBody()); + if ($jsonResponse->name === 'InvalidJwtTokenError') { + $issue = $jsonResponse->details[0]->issue; + throw new InvalidJwtTokenError($issue, $jsonResponse->traceId); + } + + if ($jsonResponse->name === 'NotFoundError') { + throw new NotFoundError($jsonResponse->message, $jsonResponse->traceId); + } + + if ($jsonResponse->name === 'InvalidParameterError') { + throw new InvalidParameterError($jsonResponse->message, $jsonResponse->details, $jsonResponse->traceId); + } + throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), @@ -936,6 +967,20 @@ public function startIssuanceWithHttpInfo($project_id, $start_issuance_input, st try { $response = $this->client->send($request, $options); } catch (RequestException $e) { + $jsonResponse = json_decode($e->getResponse()->getBody()); + if ($jsonResponse->name === 'InvalidJwtTokenError') { + $issue = $jsonResponse->details[0]->issue; + throw new InvalidJwtTokenError($issue, $jsonResponse->traceId); + } + + if ($jsonResponse->name === 'NotFoundError') { + throw new NotFoundError($jsonResponse->message, $jsonResponse->traceId); + } + + if ($jsonResponse->name === 'InvalidParameterError') { + throw new InvalidParameterError($jsonResponse->message, $jsonResponse->details, $jsonResponse->traceId); + } + throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), diff --git a/src/Clients/CredentialIssuanceClient/lib/Api/OfferApi.php b/src/Clients/CredentialIssuanceClient/lib/Api/OfferApi.php index 80a6a7a..299372a 100644 --- a/src/Clients/CredentialIssuanceClient/lib/Api/OfferApi.php +++ b/src/Clients/CredentialIssuanceClient/lib/Api/OfferApi.php @@ -36,6 +36,9 @@ use GuzzleHttp\Psr7\Request; use GuzzleHttp\RequestOptions; use AffinidiTdk\Clients\CredentialIssuanceClient\ApiException; +use AffinidiTdk\Clients\CredentialIssuanceClient\InvalidJwtTokenError; +use AffinidiTdk\Clients\CredentialIssuanceClient\InvalidParameterError; +use AffinidiTdk\Clients\CredentialIssuanceClient\NotFoundError; use AffinidiTdk\Clients\CredentialIssuanceClient\Configuration; use AffinidiTdk\Clients\CredentialIssuanceClient\HeaderSelector; use AffinidiTdk\Clients\CredentialIssuanceClient\ObjectSerializer; @@ -84,10 +87,10 @@ class OfferApi * @param int $hostIndex (Optional) host index to select the list of hosts if defined in the OpenAPI spec */ public function __construct( - ClientInterface $client = null, - Configuration $config = null, - HeaderSelector $selector = null, - $hostIndex = 0 + ?ClientInterface $client = null, + ?Configuration $config = null, + ?HeaderSelector $selector = null, + int $hostIndex = 0 ) { $this->client = $client ?: new Client(); $this->config = $config ?: Configuration::getDefaultConfiguration(); @@ -160,6 +163,20 @@ public function getCredentialOfferWithHttpInfo($project_id, $issuance_id, string try { $response = $this->client->send($request, $options); } catch (RequestException $e) { + $jsonResponse = json_decode($e->getResponse()->getBody()); + if ($jsonResponse->name === 'InvalidJwtTokenError') { + $issue = $jsonResponse->details[0]->issue; + throw new InvalidJwtTokenError($issue, $jsonResponse->traceId); + } + + if ($jsonResponse->name === 'NotFoundError') { + throw new NotFoundError($jsonResponse->message, $jsonResponse->traceId); + } + + if ($jsonResponse->name === 'InvalidParameterError') { + throw new InvalidParameterError($jsonResponse->message, $jsonResponse->details, $jsonResponse->traceId); + } + throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), diff --git a/src/Clients/CredentialIssuanceClient/lib/Api/WellKnownApi.php b/src/Clients/CredentialIssuanceClient/lib/Api/WellKnownApi.php index 26a026f..a018503 100644 --- a/src/Clients/CredentialIssuanceClient/lib/Api/WellKnownApi.php +++ b/src/Clients/CredentialIssuanceClient/lib/Api/WellKnownApi.php @@ -36,6 +36,9 @@ use GuzzleHttp\Psr7\Request; use GuzzleHttp\RequestOptions; use AffinidiTdk\Clients\CredentialIssuanceClient\ApiException; +use AffinidiTdk\Clients\CredentialIssuanceClient\InvalidJwtTokenError; +use AffinidiTdk\Clients\CredentialIssuanceClient\InvalidParameterError; +use AffinidiTdk\Clients\CredentialIssuanceClient\NotFoundError; use AffinidiTdk\Clients\CredentialIssuanceClient\Configuration; use AffinidiTdk\Clients\CredentialIssuanceClient\HeaderSelector; use AffinidiTdk\Clients\CredentialIssuanceClient\ObjectSerializer; @@ -84,10 +87,10 @@ class WellKnownApi * @param int $hostIndex (Optional) host index to select the list of hosts if defined in the OpenAPI spec */ public function __construct( - ClientInterface $client = null, - Configuration $config = null, - HeaderSelector $selector = null, - $hostIndex = 0 + ?ClientInterface $client = null, + ?Configuration $config = null, + ?HeaderSelector $selector = null, + int $hostIndex = 0 ) { $this->client = $client ?: new Client(); $this->config = $config ?: Configuration::getDefaultConfiguration(); @@ -158,6 +161,20 @@ public function getWellKnownOpenIdCredentialIssuerWithHttpInfo($project_id, stri try { $response = $this->client->send($request, $options); } catch (RequestException $e) { + $jsonResponse = json_decode($e->getResponse()->getBody()); + if ($jsonResponse->name === 'InvalidJwtTokenError') { + $issue = $jsonResponse->details[0]->issue; + throw new InvalidJwtTokenError($issue, $jsonResponse->traceId); + } + + if ($jsonResponse->name === 'NotFoundError') { + throw new NotFoundError($jsonResponse->message, $jsonResponse->traceId); + } + + if ($jsonResponse->name === 'InvalidParameterError') { + throw new InvalidParameterError($jsonResponse->message, $jsonResponse->details, $jsonResponse->traceId); + } + throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), diff --git a/src/Clients/CredentialIssuanceClient/lib/InvalidJwtTokenError.php b/src/Clients/CredentialIssuanceClient/lib/InvalidJwtTokenError.php new file mode 100644 index 0000000..722fb46 --- /dev/null +++ b/src/Clients/CredentialIssuanceClient/lib/InvalidJwtTokenError.php @@ -0,0 +1,80 @@ + $this->name, + 'message' => $this->message, + 'issue' => $issue, + 'traceId' => $traceId + ]; + + parent::__construct(json_encode($message), 403); + $this->issue = $issue; + $this->traceId = $traceId; + } +} diff --git a/src/Clients/CredentialIssuanceClient/lib/InvalidParameterError.php b/src/Clients/CredentialIssuanceClient/lib/InvalidParameterError.php new file mode 100644 index 0000000..ef70a12 --- /dev/null +++ b/src/Clients/CredentialIssuanceClient/lib/InvalidParameterError.php @@ -0,0 +1,75 @@ + $this->name, + 'message' => $message, + 'details' => $details, + 'traceId' => $traceId + ]; + + parent::__construct(json_encode($message), 400); + $this->details = $details; + $this->traceId = $traceId; + } +} diff --git a/src/Clients/CredentialIssuanceClient/lib/Model/ChangeCredentialStatus400Response.php b/src/Clients/CredentialIssuanceClient/lib/Model/ChangeCredentialStatus400Response.php new file mode 100644 index 0000000..90d6fae --- /dev/null +++ b/src/Clients/CredentialIssuanceClient/lib/Model/ChangeCredentialStatus400Response.php @@ -0,0 +1,654 @@ + + */ +class ChangeCredentialStatus400Response implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'changeCredentialStatus_400_response'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'name' => 'string', + 'message' => 'string', + 'http_status_code' => 'float', + 'trace_id' => 'string', + 'details' => '\AffinidiTdk\Clients\CredentialIssuanceClient\Model\ActionForbiddenErrorDetailsInner[]' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'name' => null, + 'message' => null, + 'http_status_code' => null, + 'trace_id' => null, + 'details' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'name' => false, + 'message' => false, + 'http_status_code' => false, + 'trace_id' => false, + 'details' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'name' => 'name', + 'message' => 'message', + 'http_status_code' => 'httpStatusCode', + 'trace_id' => 'traceId', + 'details' => 'details' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'name' => 'setName', + 'message' => 'setMessage', + 'http_status_code' => 'setHttpStatusCode', + 'trace_id' => 'setTraceId', + 'details' => 'setDetails' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'name' => 'getName', + 'message' => 'getMessage', + 'http_status_code' => 'getHttpStatusCode', + 'trace_id' => 'getTraceId', + 'details' => 'getDetails' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + public const NAME_CHANGE_STATUS_FORBIDDEN_ERROR = 'ChangeStatusForbiddenError'; + public const MESSAGE_RELATED_VC_STATUS_CANNOT_BE_CHANGED = 'Related VC status cannot be changed'; + public const HTTP_STATUS_CODE_NUMBER_400 = 400; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getNameAllowableValues() + { + return [ + self::NAME_CHANGE_STATUS_FORBIDDEN_ERROR, + ]; + } + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getMessageAllowableValues() + { + return [ + self::MESSAGE_RELATED_VC_STATUS_CANNOT_BE_CHANGED, + ]; + } + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getHttpStatusCodeAllowableValues() + { + return [ + self::HTTP_STATUS_CODE_NUMBER_400, + ]; + } + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('name', $data ?? [], null); + $this->setIfExists('message', $data ?? [], null); + $this->setIfExists('http_status_code', $data ?? [], null); + $this->setIfExists('trace_id', $data ?? [], null); + $this->setIfExists('details', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['name'] === null) { + $invalidProperties[] = "'name' can't be null"; + } + $allowedValues = $this->getNameAllowableValues(); + if (!is_null($this->container['name']) && !in_array($this->container['name'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'name', must be one of '%s'", + $this->container['name'], + implode("', '", $allowedValues) + ); + } + + if ($this->container['message'] === null) { + $invalidProperties[] = "'message' can't be null"; + } + $allowedValues = $this->getMessageAllowableValues(); + if (!is_null($this->container['message']) && !in_array($this->container['message'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'message', must be one of '%s'", + $this->container['message'], + implode("', '", $allowedValues) + ); + } + + if ($this->container['http_status_code'] === null) { + $invalidProperties[] = "'http_status_code' can't be null"; + } + $allowedValues = $this->getHttpStatusCodeAllowableValues(); + if (!is_null($this->container['http_status_code']) && !in_array($this->container['http_status_code'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'http_status_code', must be one of '%s'", + $this->container['http_status_code'], + implode("', '", $allowedValues) + ); + } + + if ($this->container['trace_id'] === null) { + $invalidProperties[] = "'trace_id' can't be null"; + } + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets name + * + * @return string + */ + public function getName() + { + return $this->container['name']; + } + + /** + * Sets name + * + * @param string $name name + * + * @return self + */ + public function setName($name) + { + if (is_null($name)) { + throw new \InvalidArgumentException('non-nullable name cannot be null'); + } + $allowedValues = $this->getNameAllowableValues(); + if (!in_array($name, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'name', must be one of '%s'", + $name, + implode("', '", $allowedValues) + ) + ); + } + $this->container['name'] = $name; + + return $this; + } + + /** + * Gets message + * + * @return string + */ + public function getMessage() + { + return $this->container['message']; + } + + /** + * Sets message + * + * @param string $message message + * + * @return self + */ + public function setMessage($message) + { + if (is_null($message)) { + throw new \InvalidArgumentException('non-nullable message cannot be null'); + } + $allowedValues = $this->getMessageAllowableValues(); + if (!in_array($message, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'message', must be one of '%s'", + $message, + implode("', '", $allowedValues) + ) + ); + } + $this->container['message'] = $message; + + return $this; + } + + /** + * Gets http_status_code + * + * @return float + */ + public function getHttpStatusCode() + { + return $this->container['http_status_code']; + } + + /** + * Sets http_status_code + * + * @param float $http_status_code http_status_code + * + * @return self + */ + public function setHttpStatusCode($http_status_code) + { + if (is_null($http_status_code)) { + throw new \InvalidArgumentException('non-nullable http_status_code cannot be null'); + } + $allowedValues = $this->getHttpStatusCodeAllowableValues(); + if (!in_array($http_status_code, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'http_status_code', must be one of '%s'", + $http_status_code, + implode("', '", $allowedValues) + ) + ); + } + $this->container['http_status_code'] = $http_status_code; + + return $this; + } + + /** + * Gets trace_id + * + * @return string + */ + public function getTraceId() + { + return $this->container['trace_id']; + } + + /** + * Sets trace_id + * + * @param string $trace_id trace_id + * + * @return self + */ + public function setTraceId($trace_id) + { + if (is_null($trace_id)) { + throw new \InvalidArgumentException('non-nullable trace_id cannot be null'); + } + $this->container['trace_id'] = $trace_id; + + return $this; + } + + /** + * Gets details + * + * @return \AffinidiTdk\Clients\CredentialIssuanceClient\Model\ActionForbiddenErrorDetailsInner[]|null + */ + public function getDetails() + { + return $this->container['details']; + } + + /** + * Sets details + * + * @param \AffinidiTdk\Clients\CredentialIssuanceClient\Model\ActionForbiddenErrorDetailsInner[]|null $details details + * + * @return self + */ + public function setDetails($details) + { + if (is_null($details)) { + throw new \InvalidArgumentException('non-nullable details cannot be null'); + } + $this->container['details'] = $details; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/src/Clients/CredentialIssuanceClient/lib/Model/ChangeCredentialStatusInput.php b/src/Clients/CredentialIssuanceClient/lib/Model/ChangeCredentialStatusInput.php index 5b5ffb6..ac27e9f 100644 --- a/src/Clients/CredentialIssuanceClient/lib/Model/ChangeCredentialStatusInput.php +++ b/src/Clients/CredentialIssuanceClient/lib/Model/ChangeCredentialStatusInput.php @@ -59,7 +59,7 @@ class ChangeCredentialStatusInput implements ModelInterface, ArrayAccess, \JsonS */ protected static $openAPITypes = [ 'change_reason' => 'string', - 'issuance_flow_data_id' => 'string' + 'issuance_record_id' => 'string' ]; /** @@ -71,7 +71,7 @@ class ChangeCredentialStatusInput implements ModelInterface, ArrayAccess, \JsonS */ protected static $openAPIFormats = [ 'change_reason' => null, - 'issuance_flow_data_id' => null + 'issuance_record_id' => null ]; /** @@ -81,7 +81,7 @@ class ChangeCredentialStatusInput implements ModelInterface, ArrayAccess, \JsonS */ protected static array $openAPINullables = [ 'change_reason' => false, - 'issuance_flow_data_id' => false + 'issuance_record_id' => false ]; /** @@ -171,7 +171,7 @@ public function isNullableSetToNull(string $property): bool */ protected static $attributeMap = [ 'change_reason' => 'changeReason', - 'issuance_flow_data_id' => 'issuanceFlowDataId' + 'issuance_record_id' => 'issuanceRecordId' ]; /** @@ -181,7 +181,7 @@ public function isNullableSetToNull(string $property): bool */ protected static $setters = [ 'change_reason' => 'setChangeReason', - 'issuance_flow_data_id' => 'setIssuanceFlowDataId' + 'issuance_record_id' => 'setIssuanceRecordId' ]; /** @@ -191,7 +191,7 @@ public function isNullableSetToNull(string $property): bool */ protected static $getters = [ 'change_reason' => 'getChangeReason', - 'issuance_flow_data_id' => 'getIssuanceFlowDataId' + 'issuance_record_id' => 'getIssuanceRecordId' ]; /** @@ -235,6 +235,21 @@ public function getModelName() return self::$openAPIModelName; } + public const CHANGE_REASON_INVALID_CREDENTIAL = 'INVALID_CREDENTIAL'; + public const CHANGE_REASON_COMPROMISED_ISSUER = 'COMPROMISED_ISSUER'; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getChangeReasonAllowableValues() + { + return [ + self::CHANGE_REASON_INVALID_CREDENTIAL, + self::CHANGE_REASON_COMPROMISED_ISSUER, + ]; + } /** * Associative array for storing property values @@ -252,7 +267,7 @@ public function getModelName() public function __construct(array $data = null) { $this->setIfExists('change_reason', $data ?? [], null); - $this->setIfExists('issuance_flow_data_id', $data ?? [], null); + $this->setIfExists('issuance_record_id', $data ?? [], null); } /** @@ -282,6 +297,15 @@ public function listInvalidProperties() { $invalidProperties = []; + $allowedValues = $this->getChangeReasonAllowableValues(); + if (!is_null($this->container['change_reason']) && !in_array($this->container['change_reason'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'change_reason', must be one of '%s'", + $this->container['change_reason'], + implode("', '", $allowedValues) + ); + } + return $invalidProperties; } @@ -310,7 +334,7 @@ public function getChangeReason() /** * Sets change_reason * - * @param string|null $change_reason change_reason + * @param string|null $change_reason reason for revocation * * @return self */ @@ -319,34 +343,44 @@ public function setChangeReason($change_reason) if (is_null($change_reason)) { throw new \InvalidArgumentException('non-nullable change_reason cannot be null'); } + $allowedValues = $this->getChangeReasonAllowableValues(); + if (!in_array($change_reason, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'change_reason', must be one of '%s'", + $change_reason, + implode("', '", $allowedValues) + ) + ); + } $this->container['change_reason'] = $change_reason; return $this; } /** - * Gets issuance_flow_data_id + * Gets issuance_record_id * * @return string|null */ - public function getIssuanceFlowDataId() + public function getIssuanceRecordId() { - return $this->container['issuance_flow_data_id']; + return $this->container['issuance_record_id']; } /** - * Sets issuance_flow_data_id + * Sets issuance_record_id * - * @param string|null $issuance_flow_data_id issuance_flow_data_id + * @param string|null $issuance_record_id issuance_record_id * * @return self */ - public function setIssuanceFlowDataId($issuance_flow_data_id) + public function setIssuanceRecordId($issuance_record_id) { - if (is_null($issuance_flow_data_id)) { - throw new \InvalidArgumentException('non-nullable issuance_flow_data_id cannot be null'); + if (is_null($issuance_record_id)) { + throw new \InvalidArgumentException('non-nullable issuance_record_id cannot be null'); } - $this->container['issuance_flow_data_id'] = $issuance_flow_data_id; + $this->container['issuance_record_id'] = $issuance_record_id; return $this; } diff --git a/src/Clients/CredentialIssuanceClient/lib/Model/ChangeStatusForbiddenError.php b/src/Clients/CredentialIssuanceClient/lib/Model/ChangeStatusForbiddenError.php new file mode 100644 index 0000000..020c83b --- /dev/null +++ b/src/Clients/CredentialIssuanceClient/lib/Model/ChangeStatusForbiddenError.php @@ -0,0 +1,654 @@ + + */ +class ChangeStatusForbiddenError implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'ChangeStatusForbiddenError'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'name' => 'string', + 'message' => 'string', + 'http_status_code' => 'float', + 'trace_id' => 'string', + 'details' => '\AffinidiTdk\Clients\CredentialIssuanceClient\Model\ActionForbiddenErrorDetailsInner[]' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'name' => null, + 'message' => null, + 'http_status_code' => null, + 'trace_id' => null, + 'details' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'name' => false, + 'message' => false, + 'http_status_code' => false, + 'trace_id' => false, + 'details' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'name' => 'name', + 'message' => 'message', + 'http_status_code' => 'httpStatusCode', + 'trace_id' => 'traceId', + 'details' => 'details' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'name' => 'setName', + 'message' => 'setMessage', + 'http_status_code' => 'setHttpStatusCode', + 'trace_id' => 'setTraceId', + 'details' => 'setDetails' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'name' => 'getName', + 'message' => 'getMessage', + 'http_status_code' => 'getHttpStatusCode', + 'trace_id' => 'getTraceId', + 'details' => 'getDetails' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + public const NAME_CHANGE_STATUS_FORBIDDEN_ERROR = 'ChangeStatusForbiddenError'; + public const MESSAGE_RELATED_VC_STATUS_CANNOT_BE_CHANGED = 'Related VC status cannot be changed'; + public const HTTP_STATUS_CODE_NUMBER_400 = 400; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getNameAllowableValues() + { + return [ + self::NAME_CHANGE_STATUS_FORBIDDEN_ERROR, + ]; + } + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getMessageAllowableValues() + { + return [ + self::MESSAGE_RELATED_VC_STATUS_CANNOT_BE_CHANGED, + ]; + } + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getHttpStatusCodeAllowableValues() + { + return [ + self::HTTP_STATUS_CODE_NUMBER_400, + ]; + } + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('name', $data ?? [], null); + $this->setIfExists('message', $data ?? [], null); + $this->setIfExists('http_status_code', $data ?? [], null); + $this->setIfExists('trace_id', $data ?? [], null); + $this->setIfExists('details', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['name'] === null) { + $invalidProperties[] = "'name' can't be null"; + } + $allowedValues = $this->getNameAllowableValues(); + if (!is_null($this->container['name']) && !in_array($this->container['name'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'name', must be one of '%s'", + $this->container['name'], + implode("', '", $allowedValues) + ); + } + + if ($this->container['message'] === null) { + $invalidProperties[] = "'message' can't be null"; + } + $allowedValues = $this->getMessageAllowableValues(); + if (!is_null($this->container['message']) && !in_array($this->container['message'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'message', must be one of '%s'", + $this->container['message'], + implode("', '", $allowedValues) + ); + } + + if ($this->container['http_status_code'] === null) { + $invalidProperties[] = "'http_status_code' can't be null"; + } + $allowedValues = $this->getHttpStatusCodeAllowableValues(); + if (!is_null($this->container['http_status_code']) && !in_array($this->container['http_status_code'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'http_status_code', must be one of '%s'", + $this->container['http_status_code'], + implode("', '", $allowedValues) + ); + } + + if ($this->container['trace_id'] === null) { + $invalidProperties[] = "'trace_id' can't be null"; + } + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets name + * + * @return string + */ + public function getName() + { + return $this->container['name']; + } + + /** + * Sets name + * + * @param string $name name + * + * @return self + */ + public function setName($name) + { + if (is_null($name)) { + throw new \InvalidArgumentException('non-nullable name cannot be null'); + } + $allowedValues = $this->getNameAllowableValues(); + if (!in_array($name, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'name', must be one of '%s'", + $name, + implode("', '", $allowedValues) + ) + ); + } + $this->container['name'] = $name; + + return $this; + } + + /** + * Gets message + * + * @return string + */ + public function getMessage() + { + return $this->container['message']; + } + + /** + * Sets message + * + * @param string $message message + * + * @return self + */ + public function setMessage($message) + { + if (is_null($message)) { + throw new \InvalidArgumentException('non-nullable message cannot be null'); + } + $allowedValues = $this->getMessageAllowableValues(); + if (!in_array($message, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'message', must be one of '%s'", + $message, + implode("', '", $allowedValues) + ) + ); + } + $this->container['message'] = $message; + + return $this; + } + + /** + * Gets http_status_code + * + * @return float + */ + public function getHttpStatusCode() + { + return $this->container['http_status_code']; + } + + /** + * Sets http_status_code + * + * @param float $http_status_code http_status_code + * + * @return self + */ + public function setHttpStatusCode($http_status_code) + { + if (is_null($http_status_code)) { + throw new \InvalidArgumentException('non-nullable http_status_code cannot be null'); + } + $allowedValues = $this->getHttpStatusCodeAllowableValues(); + if (!in_array($http_status_code, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'http_status_code', must be one of '%s'", + $http_status_code, + implode("', '", $allowedValues) + ) + ); + } + $this->container['http_status_code'] = $http_status_code; + + return $this; + } + + /** + * Gets trace_id + * + * @return string + */ + public function getTraceId() + { + return $this->container['trace_id']; + } + + /** + * Sets trace_id + * + * @param string $trace_id trace_id + * + * @return self + */ + public function setTraceId($trace_id) + { + if (is_null($trace_id)) { + throw new \InvalidArgumentException('non-nullable trace_id cannot be null'); + } + $this->container['trace_id'] = $trace_id; + + return $this; + } + + /** + * Gets details + * + * @return \AffinidiTdk\Clients\CredentialIssuanceClient\Model\ActionForbiddenErrorDetailsInner[]|null + */ + public function getDetails() + { + return $this->container['details']; + } + + /** + * Sets details + * + * @param \AffinidiTdk\Clients\CredentialIssuanceClient\Model\ActionForbiddenErrorDetailsInner[]|null $details details + * + * @return self + */ + public function setDetails($details) + { + if (is_null($details)) { + throw new \InvalidArgumentException('non-nullable details cannot be null'); + } + $this->container['details'] = $details; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/src/Clients/CredentialIssuanceClient/lib/Model/RevocationForbiddenError.php b/src/Clients/CredentialIssuanceClient/lib/Model/RevocationForbiddenError.php new file mode 100644 index 0000000..cc8f949 --- /dev/null +++ b/src/Clients/CredentialIssuanceClient/lib/Model/RevocationForbiddenError.php @@ -0,0 +1,654 @@ + + */ +class RevocationForbiddenError implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'RevocationForbiddenError'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'name' => 'string', + 'message' => 'string', + 'http_status_code' => 'float', + 'trace_id' => 'string', + 'details' => '\AffinidiTdk\Clients\CredentialIssuanceClient\Model\ActionForbiddenErrorDetailsInner[]' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'name' => null, + 'message' => null, + 'http_status_code' => null, + 'trace_id' => null, + 'details' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'name' => false, + 'message' => false, + 'http_status_code' => false, + 'trace_id' => false, + 'details' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'name' => 'name', + 'message' => 'message', + 'http_status_code' => 'httpStatusCode', + 'trace_id' => 'traceId', + 'details' => 'details' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'name' => 'setName', + 'message' => 'setMessage', + 'http_status_code' => 'setHttpStatusCode', + 'trace_id' => 'setTraceId', + 'details' => 'setDetails' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'name' => 'getName', + 'message' => 'getMessage', + 'http_status_code' => 'getHttpStatusCode', + 'trace_id' => 'getTraceId', + 'details' => 'getDetails' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + public const NAME_REVOCATION_FORBIDDEN_ERROR = 'RevocationForbiddenError'; + public const MESSAGE_RELATED_VC_HAS_NOT_BEEN_CLAIMED_YET = 'Related VC has not been claimed yet'; + public const HTTP_STATUS_CODE_NUMBER_400 = 400; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getNameAllowableValues() + { + return [ + self::NAME_REVOCATION_FORBIDDEN_ERROR, + ]; + } + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getMessageAllowableValues() + { + return [ + self::MESSAGE_RELATED_VC_HAS_NOT_BEEN_CLAIMED_YET, + ]; + } + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getHttpStatusCodeAllowableValues() + { + return [ + self::HTTP_STATUS_CODE_NUMBER_400, + ]; + } + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('name', $data ?? [], null); + $this->setIfExists('message', $data ?? [], null); + $this->setIfExists('http_status_code', $data ?? [], null); + $this->setIfExists('trace_id', $data ?? [], null); + $this->setIfExists('details', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['name'] === null) { + $invalidProperties[] = "'name' can't be null"; + } + $allowedValues = $this->getNameAllowableValues(); + if (!is_null($this->container['name']) && !in_array($this->container['name'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'name', must be one of '%s'", + $this->container['name'], + implode("', '", $allowedValues) + ); + } + + if ($this->container['message'] === null) { + $invalidProperties[] = "'message' can't be null"; + } + $allowedValues = $this->getMessageAllowableValues(); + if (!is_null($this->container['message']) && !in_array($this->container['message'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'message', must be one of '%s'", + $this->container['message'], + implode("', '", $allowedValues) + ); + } + + if ($this->container['http_status_code'] === null) { + $invalidProperties[] = "'http_status_code' can't be null"; + } + $allowedValues = $this->getHttpStatusCodeAllowableValues(); + if (!is_null($this->container['http_status_code']) && !in_array($this->container['http_status_code'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'http_status_code', must be one of '%s'", + $this->container['http_status_code'], + implode("', '", $allowedValues) + ); + } + + if ($this->container['trace_id'] === null) { + $invalidProperties[] = "'trace_id' can't be null"; + } + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets name + * + * @return string + */ + public function getName() + { + return $this->container['name']; + } + + /** + * Sets name + * + * @param string $name name + * + * @return self + */ + public function setName($name) + { + if (is_null($name)) { + throw new \InvalidArgumentException('non-nullable name cannot be null'); + } + $allowedValues = $this->getNameAllowableValues(); + if (!in_array($name, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'name', must be one of '%s'", + $name, + implode("', '", $allowedValues) + ) + ); + } + $this->container['name'] = $name; + + return $this; + } + + /** + * Gets message + * + * @return string + */ + public function getMessage() + { + return $this->container['message']; + } + + /** + * Sets message + * + * @param string $message message + * + * @return self + */ + public function setMessage($message) + { + if (is_null($message)) { + throw new \InvalidArgumentException('non-nullable message cannot be null'); + } + $allowedValues = $this->getMessageAllowableValues(); + if (!in_array($message, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'message', must be one of '%s'", + $message, + implode("', '", $allowedValues) + ) + ); + } + $this->container['message'] = $message; + + return $this; + } + + /** + * Gets http_status_code + * + * @return float + */ + public function getHttpStatusCode() + { + return $this->container['http_status_code']; + } + + /** + * Sets http_status_code + * + * @param float $http_status_code http_status_code + * + * @return self + */ + public function setHttpStatusCode($http_status_code) + { + if (is_null($http_status_code)) { + throw new \InvalidArgumentException('non-nullable http_status_code cannot be null'); + } + $allowedValues = $this->getHttpStatusCodeAllowableValues(); + if (!in_array($http_status_code, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'http_status_code', must be one of '%s'", + $http_status_code, + implode("', '", $allowedValues) + ) + ); + } + $this->container['http_status_code'] = $http_status_code; + + return $this; + } + + /** + * Gets trace_id + * + * @return string + */ + public function getTraceId() + { + return $this->container['trace_id']; + } + + /** + * Sets trace_id + * + * @param string $trace_id trace_id + * + * @return self + */ + public function setTraceId($trace_id) + { + if (is_null($trace_id)) { + throw new \InvalidArgumentException('non-nullable trace_id cannot be null'); + } + $this->container['trace_id'] = $trace_id; + + return $this; + } + + /** + * Gets details + * + * @return \AffinidiTdk\Clients\CredentialIssuanceClient\Model\ActionForbiddenErrorDetailsInner[]|null + */ + public function getDetails() + { + return $this->container['details']; + } + + /** + * Sets details + * + * @param \AffinidiTdk\Clients\CredentialIssuanceClient\Model\ActionForbiddenErrorDetailsInner[]|null $details details + * + * @return self + */ + public function setDetails($details) + { + if (is_null($details)) { + throw new \InvalidArgumentException('non-nullable details cannot be null'); + } + $this->container['details'] = $details; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/src/Clients/CredentialIssuanceClient/lib/NotFoundError.php b/src/Clients/CredentialIssuanceClient/lib/NotFoundError.php new file mode 100644 index 0000000..429bbb0 --- /dev/null +++ b/src/Clients/CredentialIssuanceClient/lib/NotFoundError.php @@ -0,0 +1,73 @@ + $this->name, + 'message' => $message, + 'traceId' => $traceId + ]; + + parent::__construct(json_encode($message), 404); + $this->traceId = $traceId; + } +} diff --git a/src/Clients/CredentialIssuanceClient/test/Model/ChangeCredentialStatus400ResponseTest.php b/src/Clients/CredentialIssuanceClient/test/Model/ChangeCredentialStatus400ResponseTest.php new file mode 100644 index 0000000..cb6796c --- /dev/null +++ b/src/Clients/CredentialIssuanceClient/test/Model/ChangeCredentialStatus400ResponseTest.php @@ -0,0 +1,127 @@ +client = $client ?: new Client(); $this->config = $config ?: Configuration::getDefaultConfiguration(); @@ -165,6 +168,20 @@ public function verifyCredentialsWithHttpInfo($verify_credential_input, string $ try { $response = $this->client->send($request, $options); } catch (RequestException $e) { + $jsonResponse = json_decode($e->getResponse()->getBody()); + if ($jsonResponse->name === 'InvalidJwtTokenError') { + $issue = $jsonResponse->details[0]->issue; + throw new InvalidJwtTokenError($issue, $jsonResponse->traceId); + } + + if ($jsonResponse->name === 'NotFoundError') { + throw new NotFoundError($jsonResponse->message, $jsonResponse->traceId); + } + + if ($jsonResponse->name === 'InvalidParameterError') { + throw new InvalidParameterError($jsonResponse->message, $jsonResponse->details, $jsonResponse->traceId); + } + throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), @@ -547,6 +564,20 @@ public function verifyPresentationWithHttpInfo($verify_presentation_input, strin try { $response = $this->client->send($request, $options); } catch (RequestException $e) { + $jsonResponse = json_decode($e->getResponse()->getBody()); + if ($jsonResponse->name === 'InvalidJwtTokenError') { + $issue = $jsonResponse->details[0]->issue; + throw new InvalidJwtTokenError($issue, $jsonResponse->traceId); + } + + if ($jsonResponse->name === 'NotFoundError') { + throw new NotFoundError($jsonResponse->message, $jsonResponse->traceId); + } + + if ($jsonResponse->name === 'InvalidParameterError') { + throw new InvalidParameterError($jsonResponse->message, $jsonResponse->details, $jsonResponse->traceId); + } + throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), diff --git a/src/Clients/CredentialVerificationClient/lib/InvalidJwtTokenError.php b/src/Clients/CredentialVerificationClient/lib/InvalidJwtTokenError.php new file mode 100644 index 0000000..08ce0e1 --- /dev/null +++ b/src/Clients/CredentialVerificationClient/lib/InvalidJwtTokenError.php @@ -0,0 +1,80 @@ + $this->name, + 'message' => $this->message, + 'issue' => $issue, + 'traceId' => $traceId + ]; + + parent::__construct(json_encode($message), 403); + $this->issue = $issue; + $this->traceId = $traceId; + } +} diff --git a/src/Clients/CredentialVerificationClient/lib/InvalidParameterError.php b/src/Clients/CredentialVerificationClient/lib/InvalidParameterError.php new file mode 100644 index 0000000..574943e --- /dev/null +++ b/src/Clients/CredentialVerificationClient/lib/InvalidParameterError.php @@ -0,0 +1,75 @@ + $this->name, + 'message' => $message, + 'details' => $details, + 'traceId' => $traceId + ]; + + parent::__construct(json_encode($message), 400); + $this->details = $details; + $this->traceId = $traceId; + } +} diff --git a/src/Clients/CredentialVerificationClient/lib/NotFoundError.php b/src/Clients/CredentialVerificationClient/lib/NotFoundError.php new file mode 100644 index 0000000..3812a5c --- /dev/null +++ b/src/Clients/CredentialVerificationClient/lib/NotFoundError.php @@ -0,0 +1,73 @@ + $this->name, + 'message' => $message, + 'traceId' => $traceId + ]; + + parent::__construct(json_encode($message), 404); + $this->traceId = $traceId; + } +} diff --git a/src/Clients/IamClient/.openapi-generator/FILES b/src/Clients/IamClient/.openapi-generator/FILES index 87fbecc..5428dc3 100644 --- a/src/Clients/IamClient/.openapi-generator/FILES +++ b/src/Clients/IamClient/.openapi-generator/FILES @@ -42,7 +42,7 @@ docs/Model/TokenPrivateKeyAuthenticationMethodDto.md docs/Model/TokenPrivateKeyAuthenticationMethodDtoPublicKeyInfo.md docs/Model/TokenPrivateKeyAuthenticationMethodDtoPublicKeyInfoOneOf.md docs/Model/TokenPrivateKeyAuthenticationMethodDtoPublicKeyInfoOneOf1.md -docs/Model/TypedPricipalId.md +docs/Model/TypedPrincipalId.md docs/Model/UnauthorizedError.md docs/Model/UnexpectedError.md docs/Model/UpdateProjectInput.md @@ -61,6 +61,8 @@ lib/Api/WellKnownApi.php lib/ApiException.php lib/Configuration.php lib/HeaderSelector.php +lib/InvalidJwtTokenError.php +lib/InvalidParameterError.php lib/Model/ActionForbiddenError.php lib/Model/AddUserToProjectInput.php lib/Model/ConsumerAuthTokenEndpointInput.php @@ -96,7 +98,7 @@ lib/Model/TokenPrivateKeyAuthenticationMethodDto.php lib/Model/TokenPrivateKeyAuthenticationMethodDtoPublicKeyInfo.php lib/Model/TokenPrivateKeyAuthenticationMethodDtoPublicKeyInfoOneOf.php lib/Model/TokenPrivateKeyAuthenticationMethodDtoPublicKeyInfoOneOf1.php -lib/Model/TypedPricipalId.php +lib/Model/TypedPrincipalId.php lib/Model/UnauthorizedError.php lib/Model/UnexpectedError.php lib/Model/UpdateProjectInput.php @@ -105,5 +107,7 @@ lib/Model/UpdateTokenPrivateKeyAuthenticationMethodDto.php lib/Model/UserDto.php lib/Model/UserList.php lib/Model/WhoamiDto.php +lib/NotFoundError.php lib/ObjectSerializer.php phpunit.xml.dist +test/Model/TypedPrincipalIdTest.php diff --git a/src/Clients/IamClient/README.md b/src/Clients/IamClient/README.md index 1902c12..6800fff 100644 --- a/src/Clients/IamClient/README.md +++ b/src/Clients/IamClient/README.md @@ -126,7 +126,7 @@ Class | Method | HTTP request | Description - [TokenPrivateKeyAuthenticationMethodDtoPublicKeyInfo](docs/Model/TokenPrivateKeyAuthenticationMethodDtoPublicKeyInfo.md) - [TokenPrivateKeyAuthenticationMethodDtoPublicKeyInfoOneOf](docs/Model/TokenPrivateKeyAuthenticationMethodDtoPublicKeyInfoOneOf.md) - [TokenPrivateKeyAuthenticationMethodDtoPublicKeyInfoOneOf1](docs/Model/TokenPrivateKeyAuthenticationMethodDtoPublicKeyInfoOneOf1.md) -- [TypedPricipalId](docs/Model/TypedPricipalId.md) +- [TypedPrincipalId](docs/Model/TypedPrincipalId.md) - [UnauthorizedError](docs/Model/UnauthorizedError.md) - [UnexpectedError](docs/Model/UnexpectedError.md) - [UpdateProjectInput](docs/Model/UpdateProjectInput.md) diff --git a/src/Clients/IamClient/docs/Api/ProjectsApi.md b/src/Clients/IamClient/docs/Api/ProjectsApi.md index 53f5a86..d04331f 100644 --- a/src/Clients/IamClient/docs/Api/ProjectsApi.md +++ b/src/Clients/IamClient/docs/Api/ProjectsApi.md @@ -195,7 +195,7 @@ void (empty response body) ## `listPrincipalsOfProject()` ```php -listPrincipalsOfProject(): \AffinidiTdk\Clients\IamClient\Model\UserList +listPrincipalsOfProject($limit, $exclusive_start_key): \AffinidiTdk\Clients\IamClient\Model\UserList ``` @@ -219,9 +219,11 @@ $apiInstance = new AffinidiTdk\Clients\IamClient\Api\ProjectsApi( new GuzzleHttp\Client(), $config ); +$limit = 100; // int | Maximum number of records to fetch in a list +$exclusive_start_key = 'exclusive_start_key_example'; // string | The base64url encoded key of the first item that this operation will evaluate (it is not returned). Use the value that was returned in the previous operation. try { - $result = $apiInstance->listPrincipalsOfProject(); + $result = $apiInstance->listPrincipalsOfProject($limit, $exclusive_start_key); print_r($result); } catch (Exception $e) { echo 'Exception when calling ProjectsApi->listPrincipalsOfProject: ', $e->getMessage(), PHP_EOL; @@ -230,7 +232,10 @@ try { ### Parameters -This endpoint does not need any parameter. +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **limit** | **int**| Maximum number of records to fetch in a list | [optional] [default to 100] | +| **exclusive_start_key** | **string**| The base64url encoded key of the first item that this operation will evaluate (it is not returned). Use the value that was returned in the previous operation. | [optional] | ### Return type @@ -252,7 +257,7 @@ This endpoint does not need any parameter. ## `listProject()` ```php -listProject(): \AffinidiTdk\Clients\IamClient\Model\ProjectList +listProject($limit, $exclusive_start_key): \AffinidiTdk\Clients\IamClient\Model\ProjectList ``` @@ -276,9 +281,11 @@ $apiInstance = new AffinidiTdk\Clients\IamClient\Api\ProjectsApi( new GuzzleHttp\Client(), $config ); +$limit = 100; // int | Maximum number of records to fetch in a list +$exclusive_start_key = 'exclusive_start_key_example'; // string | The base64url encoded key of the first item that this operation will evaluate (it is not returned). Use the value that was returned in the previous operation. try { - $result = $apiInstance->listProject(); + $result = $apiInstance->listProject($limit, $exclusive_start_key); print_r($result); } catch (Exception $e) { echo 'Exception when calling ProjectsApi->listProject: ', $e->getMessage(), PHP_EOL; @@ -287,7 +294,10 @@ try { ### Parameters -This endpoint does not need any parameter. +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **limit** | **int**| Maximum number of records to fetch in a list | [optional] [default to 100] | +| **exclusive_start_key** | **string**| The base64url encoded key of the first item that this operation will evaluate (it is not returned). Use the value that was returned in the previous operation. | [optional] | ### Return type diff --git a/src/Clients/IamClient/docs/Api/TokensApi.md b/src/Clients/IamClient/docs/Api/TokensApi.md index 56ebbab..2b0770f 100644 --- a/src/Clients/IamClient/docs/Api/TokensApi.md +++ b/src/Clients/IamClient/docs/Api/TokensApi.md @@ -219,8 +219,8 @@ $apiInstance = new AffinidiTdk\Clients\IamClient\Api\TokensApi( $config ); $token_id = 'token_id_example'; // string -$limit = 56; // int | Maximum number of records to fetch in a list -$exclusive_start_key = 'exclusive_start_key_example'; // string | exclusiveStartKey for retrieving the next batch of data. +$limit = 100; // int | Maximum number of records to fetch in a list +$exclusive_start_key = 'exclusive_start_key_example'; // string | The base64url encoded key of the first item that this operation will evaluate (it is not returned). Use the value that was returned in the previous operation. try { $result = $apiInstance->listProjectsOfToken($token_id, $limit, $exclusive_start_key); @@ -235,8 +235,8 @@ try { | Name | Type | Description | Notes | | ------------- | ------------- | ------------- | ------------- | | **token_id** | **string**| | | -| **limit** | **int**| Maximum number of records to fetch in a list | [optional] | -| **exclusive_start_key** | **string**| exclusiveStartKey for retrieving the next batch of data. | [optional] | +| **limit** | **int**| Maximum number of records to fetch in a list | [optional] [default to 100] | +| **exclusive_start_key** | **string**| The base64url encoded key of the first item that this operation will evaluate (it is not returned). Use the value that was returned in the previous operation. | [optional] | ### Return type @@ -258,7 +258,7 @@ try { ## `listToken()` ```php -listToken(): \AffinidiTdk\Clients\IamClient\Model\TokenList +listToken($limit, $exclusive_start_key): \AffinidiTdk\Clients\IamClient\Model\TokenList ``` @@ -282,9 +282,11 @@ $apiInstance = new AffinidiTdk\Clients\IamClient\Api\TokensApi( new GuzzleHttp\Client(), $config ); +$limit = 100; // int | Maximum number of records to fetch in a list +$exclusive_start_key = 'exclusive_start_key_example'; // string | The base64url encoded key of the first item that this operation will evaluate (it is not returned). Use the value that was returned in the previous operation. try { - $result = $apiInstance->listToken(); + $result = $apiInstance->listToken($limit, $exclusive_start_key); print_r($result); } catch (Exception $e) { echo 'Exception when calling TokensApi->listToken: ', $e->getMessage(), PHP_EOL; @@ -293,7 +295,10 @@ try { ### Parameters -This endpoint does not need any parameter. +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **limit** | **int**| Maximum number of records to fetch in a list | [optional] [default to 100] | +| **exclusive_start_key** | **string**| The base64url encoded key of the first item that this operation will evaluate (it is not returned). Use the value that was returned in the previous operation. | [optional] | ### Return type diff --git a/src/Clients/IamClient/docs/Model/ProjectList.md b/src/Clients/IamClient/docs/Model/ProjectList.md index 8d24e8b..74fc5be 100644 --- a/src/Clients/IamClient/docs/Model/ProjectList.md +++ b/src/Clients/IamClient/docs/Model/ProjectList.md @@ -5,5 +5,6 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **projects** | [**\AffinidiTdk\Clients\IamClient\Model\ProjectDto[]**](ProjectDto.md) | | +**last_evaluated_key** | **string** | | [optional] [[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/src/Clients/IamClient/docs/Model/TokenList.md b/src/Clients/IamClient/docs/Model/TokenList.md index 4d6e1bd..77b85c2 100644 --- a/src/Clients/IamClient/docs/Model/TokenList.md +++ b/src/Clients/IamClient/docs/Model/TokenList.md @@ -5,5 +5,6 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **tokens** | [**\AffinidiTdk\Clients\IamClient\Model\TokenDto[]**](TokenDto.md) | | +**last_evaluated_key** | **string** | | [optional] [[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/src/Clients/IamClient/docs/Model/TypedPrincipalId.md b/src/Clients/IamClient/docs/Model/TypedPrincipalId.md new file mode 100644 index 0000000..0174103 --- /dev/null +++ b/src/Clients/IamClient/docs/Model/TypedPrincipalId.md @@ -0,0 +1,9 @@ +# # TypedPrincipalId + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**principal_id** | **string** | | + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/src/Clients/IamClient/docs/Model/UserList.md b/src/Clients/IamClient/docs/Model/UserList.md index fc88cd1..9e11db4 100644 --- a/src/Clients/IamClient/docs/Model/UserList.md +++ b/src/Clients/IamClient/docs/Model/UserList.md @@ -5,5 +5,6 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **records** | [**\AffinidiTdk\Clients\IamClient\Model\UserDto[]**](UserDto.md) | | +**last_evaluated_key** | **string** | | [optional] [[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/src/Clients/IamClient/lib/Api/ConsumerAuthApi.php b/src/Clients/IamClient/lib/Api/ConsumerAuthApi.php index ca70a9b..2567427 100644 --- a/src/Clients/IamClient/lib/Api/ConsumerAuthApi.php +++ b/src/Clients/IamClient/lib/Api/ConsumerAuthApi.php @@ -36,6 +36,9 @@ use GuzzleHttp\Psr7\Request; use GuzzleHttp\RequestOptions; use AffinidiTdk\Clients\IamClient\ApiException; +use AffinidiTdk\Clients\IamClient\InvalidJwtTokenError; +use AffinidiTdk\Clients\IamClient\InvalidParameterError; +use AffinidiTdk\Clients\IamClient\NotFoundError; use AffinidiTdk\Clients\IamClient\Configuration; use AffinidiTdk\Clients\IamClient\HeaderSelector; use AffinidiTdk\Clients\IamClient\ObjectSerializer; @@ -84,10 +87,10 @@ class ConsumerAuthApi * @param int $hostIndex (Optional) host index to select the list of hosts if defined in the OpenAPI spec */ public function __construct( - ClientInterface $client = null, - Configuration $config = null, - HeaderSelector $selector = null, - $hostIndex = 0 + ?ClientInterface $client = null, + ?Configuration $config = null, + ?HeaderSelector $selector = null, + int $hostIndex = 0 ) { $this->client = $client ?: new Client(); $this->config = $config ?: Configuration::getDefaultConfiguration(); @@ -162,6 +165,20 @@ public function consumerAuthTokenEndpointWithHttpInfo($consumer_auth_token_endpo try { $response = $this->client->send($request, $options); } catch (RequestException $e) { + $jsonResponse = json_decode($e->getResponse()->getBody()); + if ($jsonResponse->name === 'InvalidJwtTokenError') { + $issue = $jsonResponse->details[0]->issue; + throw new InvalidJwtTokenError($issue, $jsonResponse->traceId); + } + + if ($jsonResponse->name === 'NotFoundError') { + throw new NotFoundError($jsonResponse->message, $jsonResponse->traceId); + } + + if ($jsonResponse->name === 'InvalidParameterError') { + throw new InvalidParameterError($jsonResponse->message, $jsonResponse->details, $jsonResponse->traceId); + } + throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), diff --git a/src/Clients/IamClient/lib/Api/DefaultApi.php b/src/Clients/IamClient/lib/Api/DefaultApi.php index b400ffd..6666e2c 100644 --- a/src/Clients/IamClient/lib/Api/DefaultApi.php +++ b/src/Clients/IamClient/lib/Api/DefaultApi.php @@ -36,6 +36,9 @@ use GuzzleHttp\Psr7\Request; use GuzzleHttp\RequestOptions; use AffinidiTdk\Clients\IamClient\ApiException; +use AffinidiTdk\Clients\IamClient\InvalidJwtTokenError; +use AffinidiTdk\Clients\IamClient\InvalidParameterError; +use AffinidiTdk\Clients\IamClient\NotFoundError; use AffinidiTdk\Clients\IamClient\Configuration; use AffinidiTdk\Clients\IamClient\HeaderSelector; use AffinidiTdk\Clients\IamClient\ObjectSerializer; @@ -111,10 +114,10 @@ class DefaultApi * @param int $hostIndex (Optional) host index to select the list of hosts if defined in the OpenAPI spec */ public function __construct( - ClientInterface $client = null, - Configuration $config = null, - HeaderSelector $selector = null, - $hostIndex = 0 + ?ClientInterface $client = null, + ?Configuration $config = null, + ?HeaderSelector $selector = null, + int $hostIndex = 0 ) { $this->client = $client ?: new Client(); $this->config = $config ?: Configuration::getDefaultConfiguration(); @@ -184,6 +187,20 @@ public function v1AuthProxyDeleteWithHttpInfo($proxy, string $contentType = self try { $response = $this->client->send($request, $options); } catch (RequestException $e) { + $jsonResponse = json_decode($e->getResponse()->getBody()); + if ($jsonResponse->name === 'InvalidJwtTokenError') { + $issue = $jsonResponse->details[0]->issue; + throw new InvalidJwtTokenError($issue, $jsonResponse->traceId); + } + + if ($jsonResponse->name === 'NotFoundError') { + throw new NotFoundError($jsonResponse->message, $jsonResponse->traceId); + } + + if ($jsonResponse->name === 'InvalidParameterError') { + throw new InvalidParameterError($jsonResponse->message, $jsonResponse->details, $jsonResponse->traceId); + } + throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), @@ -393,6 +410,20 @@ public function v1AuthProxyGetWithHttpInfo($proxy, string $contentType = self::c try { $response = $this->client->send($request, $options); } catch (RequestException $e) { + $jsonResponse = json_decode($e->getResponse()->getBody()); + if ($jsonResponse->name === 'InvalidJwtTokenError') { + $issue = $jsonResponse->details[0]->issue; + throw new InvalidJwtTokenError($issue, $jsonResponse->traceId); + } + + if ($jsonResponse->name === 'NotFoundError') { + throw new NotFoundError($jsonResponse->message, $jsonResponse->traceId); + } + + if ($jsonResponse->name === 'InvalidParameterError') { + throw new InvalidParameterError($jsonResponse->message, $jsonResponse->details, $jsonResponse->traceId); + } + throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), @@ -602,6 +633,20 @@ public function v1AuthProxyPatchWithHttpInfo($proxy, string $contentType = self: try { $response = $this->client->send($request, $options); } catch (RequestException $e) { + $jsonResponse = json_decode($e->getResponse()->getBody()); + if ($jsonResponse->name === 'InvalidJwtTokenError') { + $issue = $jsonResponse->details[0]->issue; + throw new InvalidJwtTokenError($issue, $jsonResponse->traceId); + } + + if ($jsonResponse->name === 'NotFoundError') { + throw new NotFoundError($jsonResponse->message, $jsonResponse->traceId); + } + + if ($jsonResponse->name === 'InvalidParameterError') { + throw new InvalidParameterError($jsonResponse->message, $jsonResponse->details, $jsonResponse->traceId); + } + throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), @@ -811,6 +856,20 @@ public function v1AuthProxyPostWithHttpInfo($proxy, string $contentType = self:: try { $response = $this->client->send($request, $options); } catch (RequestException $e) { + $jsonResponse = json_decode($e->getResponse()->getBody()); + if ($jsonResponse->name === 'InvalidJwtTokenError') { + $issue = $jsonResponse->details[0]->issue; + throw new InvalidJwtTokenError($issue, $jsonResponse->traceId); + } + + if ($jsonResponse->name === 'NotFoundError') { + throw new NotFoundError($jsonResponse->message, $jsonResponse->traceId); + } + + if ($jsonResponse->name === 'InvalidParameterError') { + throw new InvalidParameterError($jsonResponse->message, $jsonResponse->details, $jsonResponse->traceId); + } + throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), @@ -1020,6 +1079,20 @@ public function v1AuthProxyPutWithHttpInfo($proxy, string $contentType = self::c try { $response = $this->client->send($request, $options); } catch (RequestException $e) { + $jsonResponse = json_decode($e->getResponse()->getBody()); + if ($jsonResponse->name === 'InvalidJwtTokenError') { + $issue = $jsonResponse->details[0]->issue; + throw new InvalidJwtTokenError($issue, $jsonResponse->traceId); + } + + if ($jsonResponse->name === 'NotFoundError') { + throw new NotFoundError($jsonResponse->message, $jsonResponse->traceId); + } + + if ($jsonResponse->name === 'InvalidParameterError') { + throw new InvalidParameterError($jsonResponse->message, $jsonResponse->details, $jsonResponse->traceId); + } + throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), @@ -1229,6 +1302,20 @@ public function v1IdpProxyDeleteWithHttpInfo($proxy, string $contentType = self: try { $response = $this->client->send($request, $options); } catch (RequestException $e) { + $jsonResponse = json_decode($e->getResponse()->getBody()); + if ($jsonResponse->name === 'InvalidJwtTokenError') { + $issue = $jsonResponse->details[0]->issue; + throw new InvalidJwtTokenError($issue, $jsonResponse->traceId); + } + + if ($jsonResponse->name === 'NotFoundError') { + throw new NotFoundError($jsonResponse->message, $jsonResponse->traceId); + } + + if ($jsonResponse->name === 'InvalidParameterError') { + throw new InvalidParameterError($jsonResponse->message, $jsonResponse->details, $jsonResponse->traceId); + } + throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), @@ -1438,6 +1525,20 @@ public function v1IdpProxyGetWithHttpInfo($proxy, string $contentType = self::co try { $response = $this->client->send($request, $options); } catch (RequestException $e) { + $jsonResponse = json_decode($e->getResponse()->getBody()); + if ($jsonResponse->name === 'InvalidJwtTokenError') { + $issue = $jsonResponse->details[0]->issue; + throw new InvalidJwtTokenError($issue, $jsonResponse->traceId); + } + + if ($jsonResponse->name === 'NotFoundError') { + throw new NotFoundError($jsonResponse->message, $jsonResponse->traceId); + } + + if ($jsonResponse->name === 'InvalidParameterError') { + throw new InvalidParameterError($jsonResponse->message, $jsonResponse->details, $jsonResponse->traceId); + } + throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), @@ -1647,6 +1748,20 @@ public function v1IdpProxyPatchWithHttpInfo($proxy, string $contentType = self:: try { $response = $this->client->send($request, $options); } catch (RequestException $e) { + $jsonResponse = json_decode($e->getResponse()->getBody()); + if ($jsonResponse->name === 'InvalidJwtTokenError') { + $issue = $jsonResponse->details[0]->issue; + throw new InvalidJwtTokenError($issue, $jsonResponse->traceId); + } + + if ($jsonResponse->name === 'NotFoundError') { + throw new NotFoundError($jsonResponse->message, $jsonResponse->traceId); + } + + if ($jsonResponse->name === 'InvalidParameterError') { + throw new InvalidParameterError($jsonResponse->message, $jsonResponse->details, $jsonResponse->traceId); + } + throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), @@ -1856,6 +1971,20 @@ public function v1IdpProxyPostWithHttpInfo($proxy, string $contentType = self::c try { $response = $this->client->send($request, $options); } catch (RequestException $e) { + $jsonResponse = json_decode($e->getResponse()->getBody()); + if ($jsonResponse->name === 'InvalidJwtTokenError') { + $issue = $jsonResponse->details[0]->issue; + throw new InvalidJwtTokenError($issue, $jsonResponse->traceId); + } + + if ($jsonResponse->name === 'NotFoundError') { + throw new NotFoundError($jsonResponse->message, $jsonResponse->traceId); + } + + if ($jsonResponse->name === 'InvalidParameterError') { + throw new InvalidParameterError($jsonResponse->message, $jsonResponse->details, $jsonResponse->traceId); + } + throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), @@ -2065,6 +2194,20 @@ public function v1IdpProxyPutWithHttpInfo($proxy, string $contentType = self::co try { $response = $this->client->send($request, $options); } catch (RequestException $e) { + $jsonResponse = json_decode($e->getResponse()->getBody()); + if ($jsonResponse->name === 'InvalidJwtTokenError') { + $issue = $jsonResponse->details[0]->issue; + throw new InvalidJwtTokenError($issue, $jsonResponse->traceId); + } + + if ($jsonResponse->name === 'NotFoundError') { + throw new NotFoundError($jsonResponse->message, $jsonResponse->traceId); + } + + if ($jsonResponse->name === 'InvalidParameterError') { + throw new InvalidParameterError($jsonResponse->message, $jsonResponse->details, $jsonResponse->traceId); + } + throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), diff --git a/src/Clients/IamClient/lib/Api/PoliciesApi.php b/src/Clients/IamClient/lib/Api/PoliciesApi.php index c961da4..71d0a3d 100644 --- a/src/Clients/IamClient/lib/Api/PoliciesApi.php +++ b/src/Clients/IamClient/lib/Api/PoliciesApi.php @@ -36,6 +36,9 @@ use GuzzleHttp\Psr7\Request; use GuzzleHttp\RequestOptions; use AffinidiTdk\Clients\IamClient\ApiException; +use AffinidiTdk\Clients\IamClient\InvalidJwtTokenError; +use AffinidiTdk\Clients\IamClient\InvalidParameterError; +use AffinidiTdk\Clients\IamClient\NotFoundError; use AffinidiTdk\Clients\IamClient\Configuration; use AffinidiTdk\Clients\IamClient\HeaderSelector; use AffinidiTdk\Clients\IamClient\ObjectSerializer; @@ -87,10 +90,10 @@ class PoliciesApi * @param int $hostIndex (Optional) host index to select the list of hosts if defined in the OpenAPI spec */ public function __construct( - ClientInterface $client = null, - Configuration $config = null, - HeaderSelector $selector = null, - $hostIndex = 0 + ?ClientInterface $client = null, + ?Configuration $config = null, + ?HeaderSelector $selector = null, + int $hostIndex = 0 ) { $this->client = $client ?: new Client(); $this->config = $config ?: Configuration::getDefaultConfiguration(); @@ -163,6 +166,20 @@ public function getPoliciesWithHttpInfo($principal_id, $principal_type, string $ try { $response = $this->client->send($request, $options); } catch (RequestException $e) { + $jsonResponse = json_decode($e->getResponse()->getBody()); + if ($jsonResponse->name === 'InvalidJwtTokenError') { + $issue = $jsonResponse->details[0]->issue; + throw new InvalidJwtTokenError($issue, $jsonResponse->traceId); + } + + if ($jsonResponse->name === 'NotFoundError') { + throw new NotFoundError($jsonResponse->message, $jsonResponse->traceId); + } + + if ($jsonResponse->name === 'InvalidParameterError') { + throw new InvalidParameterError($jsonResponse->message, $jsonResponse->details, $jsonResponse->traceId); + } + throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), @@ -596,6 +613,20 @@ public function updatePoliciesWithHttpInfo($principal_id, $principal_type, $poli try { $response = $this->client->send($request, $options); } catch (RequestException $e) { + $jsonResponse = json_decode($e->getResponse()->getBody()); + if ($jsonResponse->name === 'InvalidJwtTokenError') { + $issue = $jsonResponse->details[0]->issue; + throw new InvalidJwtTokenError($issue, $jsonResponse->traceId); + } + + if ($jsonResponse->name === 'NotFoundError') { + throw new NotFoundError($jsonResponse->message, $jsonResponse->traceId); + } + + if ($jsonResponse->name === 'InvalidParameterError') { + throw new InvalidParameterError($jsonResponse->message, $jsonResponse->details, $jsonResponse->traceId); + } + throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), diff --git a/src/Clients/IamClient/lib/Api/ProjectsApi.php b/src/Clients/IamClient/lib/Api/ProjectsApi.php index 9c1c07d..45be9ba 100644 --- a/src/Clients/IamClient/lib/Api/ProjectsApi.php +++ b/src/Clients/IamClient/lib/Api/ProjectsApi.php @@ -36,6 +36,9 @@ use GuzzleHttp\Psr7\Request; use GuzzleHttp\RequestOptions; use AffinidiTdk\Clients\IamClient\ApiException; +use AffinidiTdk\Clients\IamClient\InvalidJwtTokenError; +use AffinidiTdk\Clients\IamClient\InvalidParameterError; +use AffinidiTdk\Clients\IamClient\NotFoundError; use AffinidiTdk\Clients\IamClient\Configuration; use AffinidiTdk\Clients\IamClient\HeaderSelector; use AffinidiTdk\Clients\IamClient\ObjectSerializer; @@ -99,10 +102,10 @@ class ProjectsApi * @param int $hostIndex (Optional) host index to select the list of hosts if defined in the OpenAPI spec */ public function __construct( - ClientInterface $client = null, - Configuration $config = null, - HeaderSelector $selector = null, - $hostIndex = 0 + ?ClientInterface $client = null, + ?Configuration $config = null, + ?HeaderSelector $selector = null, + int $hostIndex = 0 ) { $this->client = $client ?: new Client(); $this->config = $config ?: Configuration::getDefaultConfiguration(); @@ -172,6 +175,20 @@ public function addPrincipalToProjectWithHttpInfo($add_user_to_project_input, st try { $response = $this->client->send($request, $options); } catch (RequestException $e) { + $jsonResponse = json_decode($e->getResponse()->getBody()); + if ($jsonResponse->name === 'InvalidJwtTokenError') { + $issue = $jsonResponse->details[0]->issue; + throw new InvalidJwtTokenError($issue, $jsonResponse->traceId); + } + + if ($jsonResponse->name === 'NotFoundError') { + throw new NotFoundError($jsonResponse->message, $jsonResponse->traceId); + } + + if ($jsonResponse->name === 'InvalidParameterError') { + throw new InvalidParameterError($jsonResponse->message, $jsonResponse->details, $jsonResponse->traceId); + } + throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), @@ -410,6 +427,20 @@ public function createProjectWithHttpInfo($create_project_input, string $content try { $response = $this->client->send($request, $options); } catch (RequestException $e) { + $jsonResponse = json_decode($e->getResponse()->getBody()); + if ($jsonResponse->name === 'InvalidJwtTokenError') { + $issue = $jsonResponse->details[0]->issue; + throw new InvalidJwtTokenError($issue, $jsonResponse->traceId); + } + + if ($jsonResponse->name === 'NotFoundError') { + throw new NotFoundError($jsonResponse->message, $jsonResponse->traceId); + } + + if ($jsonResponse->name === 'InvalidParameterError') { + throw new InvalidParameterError($jsonResponse->message, $jsonResponse->details, $jsonResponse->traceId); + } + throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), @@ -785,6 +816,20 @@ public function deletePrincipalFromProjectWithHttpInfo($principal_id, $principal try { $response = $this->client->send($request, $options); } catch (RequestException $e) { + $jsonResponse = json_decode($e->getResponse()->getBody()); + if ($jsonResponse->name === 'InvalidJwtTokenError') { + $issue = $jsonResponse->details[0]->issue; + throw new InvalidJwtTokenError($issue, $jsonResponse->traceId); + } + + if ($jsonResponse->name === 'NotFoundError') { + throw new NotFoundError($jsonResponse->message, $jsonResponse->traceId); + } + + if ($jsonResponse->name === 'InvalidParameterError') { + throw new InvalidParameterError($jsonResponse->message, $jsonResponse->details, $jsonResponse->traceId); + } + throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), @@ -1027,36 +1072,54 @@ public function deletePrincipalFromProjectRequest($principal_id, $principal_type /** * Operation listPrincipalsOfProject * + * @param int|null $limit Maximum number of records to fetch in a list (optional, default to 100) + * @param string|null $exclusive_start_key The base64url encoded key of the first item that this operation will evaluate (it is not returned). Use the value that was returned in the previous operation. (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['listPrincipalsOfProject'] to see the possible values for this operation * * @throws \AffinidiTdk\Clients\IamClient\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException * @return \AffinidiTdk\Clients\IamClient\Model\UserList|\AffinidiTdk\Clients\IamClient\Model\InvalidParameterError|\AffinidiTdk\Clients\IamClient\Model\ActionForbiddenError|\AffinidiTdk\Clients\IamClient\Model\UnexpectedError */ - public function listPrincipalsOfProject(string $contentType = self::contentTypes['listPrincipalsOfProject'][0]) + public function listPrincipalsOfProject($limit = 100, $exclusive_start_key = null, string $contentType = self::contentTypes['listPrincipalsOfProject'][0]) { - list($response) = $this->listPrincipalsOfProjectWithHttpInfo($contentType); + list($response) = $this->listPrincipalsOfProjectWithHttpInfo($limit, $exclusive_start_key, $contentType); return $response; } /** * Operation listPrincipalsOfProjectWithHttpInfo * + * @param int|null $limit Maximum number of records to fetch in a list (optional, default to 100) + * @param string|null $exclusive_start_key The base64url encoded key of the first item that this operation will evaluate (it is not returned). Use the value that was returned in the previous operation. (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['listPrincipalsOfProject'] to see the possible values for this operation * * @throws \AffinidiTdk\Clients\IamClient\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException * @return array of \AffinidiTdk\Clients\IamClient\Model\UserList|\AffinidiTdk\Clients\IamClient\Model\InvalidParameterError|\AffinidiTdk\Clients\IamClient\Model\ActionForbiddenError|\AffinidiTdk\Clients\IamClient\Model\UnexpectedError, HTTP status code, HTTP response headers (array of strings) */ - public function listPrincipalsOfProjectWithHttpInfo(string $contentType = self::contentTypes['listPrincipalsOfProject'][0]) + public function listPrincipalsOfProjectWithHttpInfo($limit = 100, $exclusive_start_key = null, string $contentType = self::contentTypes['listPrincipalsOfProject'][0]) { - $request = $this->listPrincipalsOfProjectRequest($contentType); + $request = $this->listPrincipalsOfProjectRequest($limit, $exclusive_start_key, $contentType); try { $options = $this->createHttpClientOption(); try { $response = $this->client->send($request, $options); } catch (RequestException $e) { + $jsonResponse = json_decode($e->getResponse()->getBody()); + if ($jsonResponse->name === 'InvalidJwtTokenError') { + $issue = $jsonResponse->details[0]->issue; + throw new InvalidJwtTokenError($issue, $jsonResponse->traceId); + } + + if ($jsonResponse->name === 'NotFoundError') { + throw new NotFoundError($jsonResponse->message, $jsonResponse->traceId); + } + + if ($jsonResponse->name === 'InvalidParameterError') { + throw new InvalidParameterError($jsonResponse->message, $jsonResponse->details, $jsonResponse->traceId); + } + throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), @@ -1269,14 +1332,16 @@ public function listPrincipalsOfProjectWithHttpInfo(string $contentType = self:: /** * Operation listPrincipalsOfProjectAsync * + * @param int|null $limit Maximum number of records to fetch in a list (optional, default to 100) + * @param string|null $exclusive_start_key The base64url encoded key of the first item that this operation will evaluate (it is not returned). Use the value that was returned in the previous operation. (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['listPrincipalsOfProject'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function listPrincipalsOfProjectAsync(string $contentType = self::contentTypes['listPrincipalsOfProject'][0]) + public function listPrincipalsOfProjectAsync($limit = 100, $exclusive_start_key = null, string $contentType = self::contentTypes['listPrincipalsOfProject'][0]) { - return $this->listPrincipalsOfProjectAsyncWithHttpInfo($contentType) + return $this->listPrincipalsOfProjectAsyncWithHttpInfo($limit, $exclusive_start_key, $contentType) ->then( function ($response) { return $response[0]; @@ -1287,15 +1352,17 @@ function ($response) { /** * Operation listPrincipalsOfProjectAsyncWithHttpInfo * + * @param int|null $limit Maximum number of records to fetch in a list (optional, default to 100) + * @param string|null $exclusive_start_key The base64url encoded key of the first item that this operation will evaluate (it is not returned). Use the value that was returned in the previous operation. (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['listPrincipalsOfProject'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function listPrincipalsOfProjectAsyncWithHttpInfo(string $contentType = self::contentTypes['listPrincipalsOfProject'][0]) + public function listPrincipalsOfProjectAsyncWithHttpInfo($limit = 100, $exclusive_start_key = null, string $contentType = self::contentTypes['listPrincipalsOfProject'][0]) { $returnType = '\AffinidiTdk\Clients\IamClient\Model\UserList'; - $request = $this->listPrincipalsOfProjectRequest($contentType); + $request = $this->listPrincipalsOfProjectRequest($limit, $exclusive_start_key, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) @@ -1336,14 +1403,27 @@ function ($exception) { /** * Create request for operation 'listPrincipalsOfProject' * + * @param int|null $limit Maximum number of records to fetch in a list (optional, default to 100) + * @param string|null $exclusive_start_key The base64url encoded key of the first item that this operation will evaluate (it is not returned). Use the value that was returned in the previous operation. (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['listPrincipalsOfProject'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - public function listPrincipalsOfProjectRequest(string $contentType = self::contentTypes['listPrincipalsOfProject'][0]) + public function listPrincipalsOfProjectRequest($limit = 100, $exclusive_start_key = null, string $contentType = self::contentTypes['listPrincipalsOfProject'][0]) { + if ($limit !== null && $limit > 100) { + throw new \InvalidArgumentException('invalid value for "$limit" when calling ProjectsApi.listPrincipalsOfProject, must be smaller than or equal to 100.'); + } + if ($limit !== null && $limit < 1) { + throw new \InvalidArgumentException('invalid value for "$limit" when calling ProjectsApi.listPrincipalsOfProject, must be bigger than or equal to 1.'); + } + + if ($exclusive_start_key !== null && strlen($exclusive_start_key) > 3000) { + throw new \InvalidArgumentException('invalid length for "$exclusive_start_key" when calling ProjectsApi.listPrincipalsOfProject, must be smaller than or equal to 3000.'); + } + $resourcePath = '/v1/projects/principals'; $formParams = []; @@ -1352,6 +1432,24 @@ public function listPrincipalsOfProjectRequest(string $contentType = self::conte $httpBody = ''; $multipart = false; + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $limit, + 'limit', // param base name + 'integer', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $exclusive_start_key, + 'exclusiveStartKey', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); @@ -1417,36 +1515,54 @@ public function listPrincipalsOfProjectRequest(string $contentType = self::conte /** * Operation listProject * + * @param int|null $limit Maximum number of records to fetch in a list (optional, default to 100) + * @param string|null $exclusive_start_key The base64url encoded key of the first item that this operation will evaluate (it is not returned). Use the value that was returned in the previous operation. (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['listProject'] to see the possible values for this operation * * @throws \AffinidiTdk\Clients\IamClient\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException * @return \AffinidiTdk\Clients\IamClient\Model\ProjectList|\AffinidiTdk\Clients\IamClient\Model\UnexpectedError */ - public function listProject(string $contentType = self::contentTypes['listProject'][0]) + public function listProject($limit = 100, $exclusive_start_key = null, string $contentType = self::contentTypes['listProject'][0]) { - list($response) = $this->listProjectWithHttpInfo($contentType); + list($response) = $this->listProjectWithHttpInfo($limit, $exclusive_start_key, $contentType); return $response; } /** * Operation listProjectWithHttpInfo * + * @param int|null $limit Maximum number of records to fetch in a list (optional, default to 100) + * @param string|null $exclusive_start_key The base64url encoded key of the first item that this operation will evaluate (it is not returned). Use the value that was returned in the previous operation. (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['listProject'] to see the possible values for this operation * * @throws \AffinidiTdk\Clients\IamClient\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException * @return array of \AffinidiTdk\Clients\IamClient\Model\ProjectList|\AffinidiTdk\Clients\IamClient\Model\UnexpectedError, HTTP status code, HTTP response headers (array of strings) */ - public function listProjectWithHttpInfo(string $contentType = self::contentTypes['listProject'][0]) + public function listProjectWithHttpInfo($limit = 100, $exclusive_start_key = null, string $contentType = self::contentTypes['listProject'][0]) { - $request = $this->listProjectRequest($contentType); + $request = $this->listProjectRequest($limit, $exclusive_start_key, $contentType); try { $options = $this->createHttpClientOption(); try { $response = $this->client->send($request, $options); } catch (RequestException $e) { + $jsonResponse = json_decode($e->getResponse()->getBody()); + if ($jsonResponse->name === 'InvalidJwtTokenError') { + $issue = $jsonResponse->details[0]->issue; + throw new InvalidJwtTokenError($issue, $jsonResponse->traceId); + } + + if ($jsonResponse->name === 'NotFoundError') { + throw new NotFoundError($jsonResponse->message, $jsonResponse->traceId); + } + + if ($jsonResponse->name === 'InvalidParameterError') { + throw new InvalidParameterError($jsonResponse->message, $jsonResponse->details, $jsonResponse->traceId); + } + throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), @@ -1589,14 +1705,16 @@ public function listProjectWithHttpInfo(string $contentType = self::contentTypes /** * Operation listProjectAsync * + * @param int|null $limit Maximum number of records to fetch in a list (optional, default to 100) + * @param string|null $exclusive_start_key The base64url encoded key of the first item that this operation will evaluate (it is not returned). Use the value that was returned in the previous operation. (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['listProject'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function listProjectAsync(string $contentType = self::contentTypes['listProject'][0]) + public function listProjectAsync($limit = 100, $exclusive_start_key = null, string $contentType = self::contentTypes['listProject'][0]) { - return $this->listProjectAsyncWithHttpInfo($contentType) + return $this->listProjectAsyncWithHttpInfo($limit, $exclusive_start_key, $contentType) ->then( function ($response) { return $response[0]; @@ -1607,15 +1725,17 @@ function ($response) { /** * Operation listProjectAsyncWithHttpInfo * + * @param int|null $limit Maximum number of records to fetch in a list (optional, default to 100) + * @param string|null $exclusive_start_key The base64url encoded key of the first item that this operation will evaluate (it is not returned). Use the value that was returned in the previous operation. (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['listProject'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function listProjectAsyncWithHttpInfo(string $contentType = self::contentTypes['listProject'][0]) + public function listProjectAsyncWithHttpInfo($limit = 100, $exclusive_start_key = null, string $contentType = self::contentTypes['listProject'][0]) { $returnType = '\AffinidiTdk\Clients\IamClient\Model\ProjectList'; - $request = $this->listProjectRequest($contentType); + $request = $this->listProjectRequest($limit, $exclusive_start_key, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) @@ -1656,14 +1776,27 @@ function ($exception) { /** * Create request for operation 'listProject' * + * @param int|null $limit Maximum number of records to fetch in a list (optional, default to 100) + * @param string|null $exclusive_start_key The base64url encoded key of the first item that this operation will evaluate (it is not returned). Use the value that was returned in the previous operation. (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['listProject'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - public function listProjectRequest(string $contentType = self::contentTypes['listProject'][0]) + public function listProjectRequest($limit = 100, $exclusive_start_key = null, string $contentType = self::contentTypes['listProject'][0]) { + if ($limit !== null && $limit > 100) { + throw new \InvalidArgumentException('invalid value for "$limit" when calling ProjectsApi.listProject, must be smaller than or equal to 100.'); + } + if ($limit !== null && $limit < 1) { + throw new \InvalidArgumentException('invalid value for "$limit" when calling ProjectsApi.listProject, must be bigger than or equal to 1.'); + } + + if ($exclusive_start_key !== null && strlen($exclusive_start_key) > 3000) { + throw new \InvalidArgumentException('invalid length for "$exclusive_start_key" when calling ProjectsApi.listProject, must be smaller than or equal to 3000.'); + } + $resourcePath = '/v1/projects'; $formParams = []; @@ -1672,6 +1805,24 @@ public function listProjectRequest(string $contentType = self::contentTypes['lis $httpBody = ''; $multipart = false; + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $limit, + 'limit', // param base name + 'integer', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $exclusive_start_key, + 'exclusiveStartKey', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); @@ -1771,6 +1922,20 @@ public function updateProjectWithHttpInfo($project_id, $update_project_input, st try { $response = $this->client->send($request, $options); } catch (RequestException $e) { + $jsonResponse = json_decode($e->getResponse()->getBody()); + if ($jsonResponse->name === 'InvalidJwtTokenError') { + $issue = $jsonResponse->details[0]->issue; + throw new InvalidJwtTokenError($issue, $jsonResponse->traceId); + } + + if ($jsonResponse->name === 'NotFoundError') { + throw new NotFoundError($jsonResponse->message, $jsonResponse->traceId); + } + + if ($jsonResponse->name === 'InvalidParameterError') { + throw new InvalidParameterError($jsonResponse->message, $jsonResponse->details, $jsonResponse->traceId); + } + throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), diff --git a/src/Clients/IamClient/lib/Api/StsApi.php b/src/Clients/IamClient/lib/Api/StsApi.php index 3472064..7b86086 100644 --- a/src/Clients/IamClient/lib/Api/StsApi.php +++ b/src/Clients/IamClient/lib/Api/StsApi.php @@ -36,6 +36,9 @@ use GuzzleHttp\Psr7\Request; use GuzzleHttp\RequestOptions; use AffinidiTdk\Clients\IamClient\ApiException; +use AffinidiTdk\Clients\IamClient\InvalidJwtTokenError; +use AffinidiTdk\Clients\IamClient\InvalidParameterError; +use AffinidiTdk\Clients\IamClient\NotFoundError; use AffinidiTdk\Clients\IamClient\Configuration; use AffinidiTdk\Clients\IamClient\HeaderSelector; use AffinidiTdk\Clients\IamClient\ObjectSerializer; @@ -87,10 +90,10 @@ class StsApi * @param int $hostIndex (Optional) host index to select the list of hosts if defined in the OpenAPI spec */ public function __construct( - ClientInterface $client = null, - Configuration $config = null, - HeaderSelector $selector = null, - $hostIndex = 0 + ?ClientInterface $client = null, + ?Configuration $config = null, + ?HeaderSelector $selector = null, + int $hostIndex = 0 ) { $this->client = $client ?: new Client(); $this->config = $config ?: Configuration::getDefaultConfiguration(); @@ -161,6 +164,20 @@ public function createProjectScopedTokenWithHttpInfo($create_project_scoped_toke try { $response = $this->client->send($request, $options); } catch (RequestException $e) { + $jsonResponse = json_decode($e->getResponse()->getBody()); + if ($jsonResponse->name === 'InvalidJwtTokenError') { + $issue = $jsonResponse->details[0]->issue; + throw new InvalidJwtTokenError($issue, $jsonResponse->traceId); + } + + if ($jsonResponse->name === 'NotFoundError') { + throw new NotFoundError($jsonResponse->message, $jsonResponse->traceId); + } + + if ($jsonResponse->name === 'InvalidParameterError') { + throw new InvalidParameterError($jsonResponse->message, $jsonResponse->details, $jsonResponse->traceId); + } + throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), @@ -568,6 +585,20 @@ public function whoamiWithHttpInfo(string $contentType = self::contentTypes['who try { $response = $this->client->send($request, $options); } catch (RequestException $e) { + $jsonResponse = json_decode($e->getResponse()->getBody()); + if ($jsonResponse->name === 'InvalidJwtTokenError') { + $issue = $jsonResponse->details[0]->issue; + throw new InvalidJwtTokenError($issue, $jsonResponse->traceId); + } + + if ($jsonResponse->name === 'NotFoundError') { + throw new NotFoundError($jsonResponse->message, $jsonResponse->traceId); + } + + if ($jsonResponse->name === 'InvalidParameterError') { + throw new InvalidParameterError($jsonResponse->message, $jsonResponse->details, $jsonResponse->traceId); + } + throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), diff --git a/src/Clients/IamClient/lib/Api/TokensApi.php b/src/Clients/IamClient/lib/Api/TokensApi.php index 6b31912..9ac9769 100644 --- a/src/Clients/IamClient/lib/Api/TokensApi.php +++ b/src/Clients/IamClient/lib/Api/TokensApi.php @@ -36,6 +36,9 @@ use GuzzleHttp\Psr7\Request; use GuzzleHttp\RequestOptions; use AffinidiTdk\Clients\IamClient\ApiException; +use AffinidiTdk\Clients\IamClient\InvalidJwtTokenError; +use AffinidiTdk\Clients\IamClient\InvalidParameterError; +use AffinidiTdk\Clients\IamClient\NotFoundError; use AffinidiTdk\Clients\IamClient\Configuration; use AffinidiTdk\Clients\IamClient\HeaderSelector; use AffinidiTdk\Clients\IamClient\ObjectSerializer; @@ -99,10 +102,10 @@ class TokensApi * @param int $hostIndex (Optional) host index to select the list of hosts if defined in the OpenAPI spec */ public function __construct( - ClientInterface $client = null, - Configuration $config = null, - HeaderSelector $selector = null, - $hostIndex = 0 + ?ClientInterface $client = null, + ?Configuration $config = null, + ?HeaderSelector $selector = null, + int $hostIndex = 0 ) { $this->client = $client ?: new Client(); $this->config = $config ?: Configuration::getDefaultConfiguration(); @@ -173,6 +176,20 @@ public function createTokenWithHttpInfo($create_token_input, string $contentType try { $response = $this->client->send($request, $options); } catch (RequestException $e) { + $jsonResponse = json_decode($e->getResponse()->getBody()); + if ($jsonResponse->name === 'InvalidJwtTokenError') { + $issue = $jsonResponse->details[0]->issue; + throw new InvalidJwtTokenError($issue, $jsonResponse->traceId); + } + + if ($jsonResponse->name === 'NotFoundError') { + throw new NotFoundError($jsonResponse->message, $jsonResponse->traceId); + } + + if ($jsonResponse->name === 'InvalidParameterError') { + throw new InvalidParameterError($jsonResponse->message, $jsonResponse->details, $jsonResponse->traceId); + } + throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), @@ -546,6 +563,20 @@ public function deleteTokenWithHttpInfo($token_id, string $contentType = self::c try { $response = $this->client->send($request, $options); } catch (RequestException $e) { + $jsonResponse = json_decode($e->getResponse()->getBody()); + if ($jsonResponse->name === 'InvalidJwtTokenError') { + $issue = $jsonResponse->details[0]->issue; + throw new InvalidJwtTokenError($issue, $jsonResponse->traceId); + } + + if ($jsonResponse->name === 'NotFoundError') { + throw new NotFoundError($jsonResponse->message, $jsonResponse->traceId); + } + + if ($jsonResponse->name === 'InvalidParameterError') { + throw new InvalidParameterError($jsonResponse->message, $jsonResponse->details, $jsonResponse->traceId); + } + throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), @@ -785,6 +816,20 @@ public function getTokenWithHttpInfo($token_id, string $contentType = self::cont try { $response = $this->client->send($request, $options); } catch (RequestException $e) { + $jsonResponse = json_decode($e->getResponse()->getBody()); + if ($jsonResponse->name === 'InvalidJwtTokenError') { + $issue = $jsonResponse->details[0]->issue; + throw new InvalidJwtTokenError($issue, $jsonResponse->traceId); + } + + if ($jsonResponse->name === 'NotFoundError') { + throw new NotFoundError($jsonResponse->message, $jsonResponse->traceId); + } + + if ($jsonResponse->name === 'InvalidParameterError') { + throw new InvalidParameterError($jsonResponse->message, $jsonResponse->details, $jsonResponse->traceId); + } + throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), @@ -1164,15 +1209,15 @@ public function getTokenRequest($token_id, string $contentType = self::contentTy * Operation listProjectsOfToken * * @param string $token_id token_id (required) - * @param int $limit Maximum number of records to fetch in a list (optional) - * @param string $exclusive_start_key exclusiveStartKey for retrieving the next batch of data. (optional) + * @param int|null $limit Maximum number of records to fetch in a list (optional, default to 100) + * @param string|null $exclusive_start_key The base64url encoded key of the first item that this operation will evaluate (it is not returned). Use the value that was returned in the previous operation. (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['listProjectsOfToken'] to see the possible values for this operation * * @throws \AffinidiTdk\Clients\IamClient\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException * @return \AffinidiTdk\Clients\IamClient\Model\ProjectWithPolicyList|\AffinidiTdk\Clients\IamClient\Model\ActionForbiddenError|\AffinidiTdk\Clients\IamClient\Model\NotFoundError|\AffinidiTdk\Clients\IamClient\Model\UnexpectedError */ - public function listProjectsOfToken($token_id, $limit = null, $exclusive_start_key = null, string $contentType = self::contentTypes['listProjectsOfToken'][0]) + public function listProjectsOfToken($token_id, $limit = 100, $exclusive_start_key = null, string $contentType = self::contentTypes['listProjectsOfToken'][0]) { list($response) = $this->listProjectsOfTokenWithHttpInfo($token_id, $limit, $exclusive_start_key, $contentType); return $response; @@ -1182,15 +1227,15 @@ public function listProjectsOfToken($token_id, $limit = null, $exclusive_start_k * Operation listProjectsOfTokenWithHttpInfo * * @param string $token_id (required) - * @param int $limit Maximum number of records to fetch in a list (optional) - * @param string $exclusive_start_key exclusiveStartKey for retrieving the next batch of data. (optional) + * @param int|null $limit Maximum number of records to fetch in a list (optional, default to 100) + * @param string|null $exclusive_start_key The base64url encoded key of the first item that this operation will evaluate (it is not returned). Use the value that was returned in the previous operation. (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['listProjectsOfToken'] to see the possible values for this operation * * @throws \AffinidiTdk\Clients\IamClient\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException * @return array of \AffinidiTdk\Clients\IamClient\Model\ProjectWithPolicyList|\AffinidiTdk\Clients\IamClient\Model\ActionForbiddenError|\AffinidiTdk\Clients\IamClient\Model\NotFoundError|\AffinidiTdk\Clients\IamClient\Model\UnexpectedError, HTTP status code, HTTP response headers (array of strings) */ - public function listProjectsOfTokenWithHttpInfo($token_id, $limit = null, $exclusive_start_key = null, string $contentType = self::contentTypes['listProjectsOfToken'][0]) + public function listProjectsOfTokenWithHttpInfo($token_id, $limit = 100, $exclusive_start_key = null, string $contentType = self::contentTypes['listProjectsOfToken'][0]) { $request = $this->listProjectsOfTokenRequest($token_id, $limit, $exclusive_start_key, $contentType); @@ -1199,6 +1244,20 @@ public function listProjectsOfTokenWithHttpInfo($token_id, $limit = null, $exclu try { $response = $this->client->send($request, $options); } catch (RequestException $e) { + $jsonResponse = json_decode($e->getResponse()->getBody()); + if ($jsonResponse->name === 'InvalidJwtTokenError') { + $issue = $jsonResponse->details[0]->issue; + throw new InvalidJwtTokenError($issue, $jsonResponse->traceId); + } + + if ($jsonResponse->name === 'NotFoundError') { + throw new NotFoundError($jsonResponse->message, $jsonResponse->traceId); + } + + if ($jsonResponse->name === 'InvalidParameterError') { + throw new InvalidParameterError($jsonResponse->message, $jsonResponse->details, $jsonResponse->traceId); + } + throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), @@ -1412,14 +1471,14 @@ public function listProjectsOfTokenWithHttpInfo($token_id, $limit = null, $exclu * Operation listProjectsOfTokenAsync * * @param string $token_id (required) - * @param int $limit Maximum number of records to fetch in a list (optional) - * @param string $exclusive_start_key exclusiveStartKey for retrieving the next batch of data. (optional) + * @param int|null $limit Maximum number of records to fetch in a list (optional, default to 100) + * @param string|null $exclusive_start_key The base64url encoded key of the first item that this operation will evaluate (it is not returned). Use the value that was returned in the previous operation. (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['listProjectsOfToken'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function listProjectsOfTokenAsync($token_id, $limit = null, $exclusive_start_key = null, string $contentType = self::contentTypes['listProjectsOfToken'][0]) + public function listProjectsOfTokenAsync($token_id, $limit = 100, $exclusive_start_key = null, string $contentType = self::contentTypes['listProjectsOfToken'][0]) { return $this->listProjectsOfTokenAsyncWithHttpInfo($token_id, $limit, $exclusive_start_key, $contentType) ->then( @@ -1433,14 +1492,14 @@ function ($response) { * Operation listProjectsOfTokenAsyncWithHttpInfo * * @param string $token_id (required) - * @param int $limit Maximum number of records to fetch in a list (optional) - * @param string $exclusive_start_key exclusiveStartKey for retrieving the next batch of data. (optional) + * @param int|null $limit Maximum number of records to fetch in a list (optional, default to 100) + * @param string|null $exclusive_start_key The base64url encoded key of the first item that this operation will evaluate (it is not returned). Use the value that was returned in the previous operation. (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['listProjectsOfToken'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function listProjectsOfTokenAsyncWithHttpInfo($token_id, $limit = null, $exclusive_start_key = null, string $contentType = self::contentTypes['listProjectsOfToken'][0]) + public function listProjectsOfTokenAsyncWithHttpInfo($token_id, $limit = 100, $exclusive_start_key = null, string $contentType = self::contentTypes['listProjectsOfToken'][0]) { $returnType = '\AffinidiTdk\Clients\IamClient\Model\ProjectWithPolicyList'; $request = $this->listProjectsOfTokenRequest($token_id, $limit, $exclusive_start_key, $contentType); @@ -1485,14 +1544,14 @@ function ($exception) { * Create request for operation 'listProjectsOfToken' * * @param string $token_id (required) - * @param int $limit Maximum number of records to fetch in a list (optional) - * @param string $exclusive_start_key exclusiveStartKey for retrieving the next batch of data. (optional) + * @param int|null $limit Maximum number of records to fetch in a list (optional, default to 100) + * @param string|null $exclusive_start_key The base64url encoded key of the first item that this operation will evaluate (it is not returned). Use the value that was returned in the previous operation. (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['listProjectsOfToken'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - public function listProjectsOfTokenRequest($token_id, $limit = null, $exclusive_start_key = null, string $contentType = self::contentTypes['listProjectsOfToken'][0]) + public function listProjectsOfTokenRequest($token_id, $limit = 100, $exclusive_start_key = null, string $contentType = self::contentTypes['listProjectsOfToken'][0]) { // verify the required parameter 'token_id' is set @@ -1502,8 +1561,17 @@ public function listProjectsOfTokenRequest($token_id, $limit = null, $exclusive_ ); } - - + if ($limit !== null && $limit > 100) { + throw new \InvalidArgumentException('invalid value for "$limit" when calling TokensApi.listProjectsOfToken, must be smaller than or equal to 100.'); + } + if ($limit !== null && $limit < 1) { + throw new \InvalidArgumentException('invalid value for "$limit" when calling TokensApi.listProjectsOfToken, must be bigger than or equal to 1.'); + } + + if ($exclusive_start_key !== null && strlen($exclusive_start_key) > 3000) { + throw new \InvalidArgumentException('invalid length for "$exclusive_start_key" when calling TokensApi.listProjectsOfToken, must be smaller than or equal to 3000.'); + } + $resourcePath = '/v1/tokens/{tokenId}/projects'; $formParams = []; @@ -1603,36 +1671,54 @@ public function listProjectsOfTokenRequest($token_id, $limit = null, $exclusive_ /** * Operation listToken * + * @param int|null $limit Maximum number of records to fetch in a list (optional, default to 100) + * @param string|null $exclusive_start_key The base64url encoded key of the first item that this operation will evaluate (it is not returned). Use the value that was returned in the previous operation. (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['listToken'] to see the possible values for this operation * * @throws \AffinidiTdk\Clients\IamClient\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException * @return \AffinidiTdk\Clients\IamClient\Model\TokenList|\AffinidiTdk\Clients\IamClient\Model\InvalidParameterError|\AffinidiTdk\Clients\IamClient\Model\UnexpectedError */ - public function listToken(string $contentType = self::contentTypes['listToken'][0]) + public function listToken($limit = 100, $exclusive_start_key = null, string $contentType = self::contentTypes['listToken'][0]) { - list($response) = $this->listTokenWithHttpInfo($contentType); + list($response) = $this->listTokenWithHttpInfo($limit, $exclusive_start_key, $contentType); return $response; } /** * Operation listTokenWithHttpInfo * + * @param int|null $limit Maximum number of records to fetch in a list (optional, default to 100) + * @param string|null $exclusive_start_key The base64url encoded key of the first item that this operation will evaluate (it is not returned). Use the value that was returned in the previous operation. (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['listToken'] to see the possible values for this operation * * @throws \AffinidiTdk\Clients\IamClient\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException * @return array of \AffinidiTdk\Clients\IamClient\Model\TokenList|\AffinidiTdk\Clients\IamClient\Model\InvalidParameterError|\AffinidiTdk\Clients\IamClient\Model\UnexpectedError, HTTP status code, HTTP response headers (array of strings) */ - public function listTokenWithHttpInfo(string $contentType = self::contentTypes['listToken'][0]) + public function listTokenWithHttpInfo($limit = 100, $exclusive_start_key = null, string $contentType = self::contentTypes['listToken'][0]) { - $request = $this->listTokenRequest($contentType); + $request = $this->listTokenRequest($limit, $exclusive_start_key, $contentType); try { $options = $this->createHttpClientOption(); try { $response = $this->client->send($request, $options); } catch (RequestException $e) { + $jsonResponse = json_decode($e->getResponse()->getBody()); + if ($jsonResponse->name === 'InvalidJwtTokenError') { + $issue = $jsonResponse->details[0]->issue; + throw new InvalidJwtTokenError($issue, $jsonResponse->traceId); + } + + if ($jsonResponse->name === 'NotFoundError') { + throw new NotFoundError($jsonResponse->message, $jsonResponse->traceId); + } + + if ($jsonResponse->name === 'InvalidParameterError') { + throw new InvalidParameterError($jsonResponse->message, $jsonResponse->details, $jsonResponse->traceId); + } + throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), @@ -1810,14 +1896,16 @@ public function listTokenWithHttpInfo(string $contentType = self::contentTypes[' /** * Operation listTokenAsync * + * @param int|null $limit Maximum number of records to fetch in a list (optional, default to 100) + * @param string|null $exclusive_start_key The base64url encoded key of the first item that this operation will evaluate (it is not returned). Use the value that was returned in the previous operation. (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['listToken'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function listTokenAsync(string $contentType = self::contentTypes['listToken'][0]) + public function listTokenAsync($limit = 100, $exclusive_start_key = null, string $contentType = self::contentTypes['listToken'][0]) { - return $this->listTokenAsyncWithHttpInfo($contentType) + return $this->listTokenAsyncWithHttpInfo($limit, $exclusive_start_key, $contentType) ->then( function ($response) { return $response[0]; @@ -1828,15 +1916,17 @@ function ($response) { /** * Operation listTokenAsyncWithHttpInfo * + * @param int|null $limit Maximum number of records to fetch in a list (optional, default to 100) + * @param string|null $exclusive_start_key The base64url encoded key of the first item that this operation will evaluate (it is not returned). Use the value that was returned in the previous operation. (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['listToken'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function listTokenAsyncWithHttpInfo(string $contentType = self::contentTypes['listToken'][0]) + public function listTokenAsyncWithHttpInfo($limit = 100, $exclusive_start_key = null, string $contentType = self::contentTypes['listToken'][0]) { $returnType = '\AffinidiTdk\Clients\IamClient\Model\TokenList'; - $request = $this->listTokenRequest($contentType); + $request = $this->listTokenRequest($limit, $exclusive_start_key, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) @@ -1877,14 +1967,27 @@ function ($exception) { /** * Create request for operation 'listToken' * + * @param int|null $limit Maximum number of records to fetch in a list (optional, default to 100) + * @param string|null $exclusive_start_key The base64url encoded key of the first item that this operation will evaluate (it is not returned). Use the value that was returned in the previous operation. (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['listToken'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - public function listTokenRequest(string $contentType = self::contentTypes['listToken'][0]) + public function listTokenRequest($limit = 100, $exclusive_start_key = null, string $contentType = self::contentTypes['listToken'][0]) { + if ($limit !== null && $limit > 100) { + throw new \InvalidArgumentException('invalid value for "$limit" when calling TokensApi.listToken, must be smaller than or equal to 100.'); + } + if ($limit !== null && $limit < 1) { + throw new \InvalidArgumentException('invalid value for "$limit" when calling TokensApi.listToken, must be bigger than or equal to 1.'); + } + + if ($exclusive_start_key !== null && strlen($exclusive_start_key) > 3000) { + throw new \InvalidArgumentException('invalid length for "$exclusive_start_key" when calling TokensApi.listToken, must be smaller than or equal to 3000.'); + } + $resourcePath = '/v1/tokens'; $formParams = []; @@ -1893,6 +1996,24 @@ public function listTokenRequest(string $contentType = self::contentTypes['listT $httpBody = ''; $multipart = false; + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $limit, + 'limit', // param base name + 'integer', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $exclusive_start_key, + 'exclusiveStartKey', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); @@ -1992,6 +2113,20 @@ public function updateTokenWithHttpInfo($token_id, $update_token_input, string $ try { $response = $this->client->send($request, $options); } catch (RequestException $e) { + $jsonResponse = json_decode($e->getResponse()->getBody()); + if ($jsonResponse->name === 'InvalidJwtTokenError') { + $issue = $jsonResponse->details[0]->issue; + throw new InvalidJwtTokenError($issue, $jsonResponse->traceId); + } + + if ($jsonResponse->name === 'NotFoundError') { + throw new NotFoundError($jsonResponse->message, $jsonResponse->traceId); + } + + if ($jsonResponse->name === 'InvalidParameterError') { + throw new InvalidParameterError($jsonResponse->message, $jsonResponse->details, $jsonResponse->traceId); + } + throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), diff --git a/src/Clients/IamClient/lib/Api/WellKnownApi.php b/src/Clients/IamClient/lib/Api/WellKnownApi.php index 56d9630..f15751f 100644 --- a/src/Clients/IamClient/lib/Api/WellKnownApi.php +++ b/src/Clients/IamClient/lib/Api/WellKnownApi.php @@ -36,6 +36,9 @@ use GuzzleHttp\Psr7\Request; use GuzzleHttp\RequestOptions; use AffinidiTdk\Clients\IamClient\ApiException; +use AffinidiTdk\Clients\IamClient\InvalidJwtTokenError; +use AffinidiTdk\Clients\IamClient\InvalidParameterError; +use AffinidiTdk\Clients\IamClient\NotFoundError; use AffinidiTdk\Clients\IamClient\Configuration; use AffinidiTdk\Clients\IamClient\HeaderSelector; use AffinidiTdk\Clients\IamClient\ObjectSerializer; @@ -87,10 +90,10 @@ class WellKnownApi * @param int $hostIndex (Optional) host index to select the list of hosts if defined in the OpenAPI spec */ public function __construct( - ClientInterface $client = null, - Configuration $config = null, - HeaderSelector $selector = null, - $hostIndex = 0 + ?ClientInterface $client = null, + ?Configuration $config = null, + ?HeaderSelector $selector = null, + int $hostIndex = 0 ) { $this->client = $client ?: new Client(); $this->config = $config ?: Configuration::getDefaultConfiguration(); @@ -159,6 +162,20 @@ public function getWellKnownDidWithHttpInfo(string $contentType = self::contentT try { $response = $this->client->send($request, $options); } catch (RequestException $e) { + $jsonResponse = json_decode($e->getResponse()->getBody()); + if ($jsonResponse->name === 'InvalidJwtTokenError') { + $issue = $jsonResponse->details[0]->issue; + throw new InvalidJwtTokenError($issue, $jsonResponse->traceId); + } + + if ($jsonResponse->name === 'NotFoundError') { + throw new NotFoundError($jsonResponse->message, $jsonResponse->traceId); + } + + if ($jsonResponse->name === 'InvalidParameterError') { + throw new InvalidParameterError($jsonResponse->message, $jsonResponse->details, $jsonResponse->traceId); + } + throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), @@ -474,6 +491,20 @@ public function getWellKnownJwksWithHttpInfo(string $contentType = self::content try { $response = $this->client->send($request, $options); } catch (RequestException $e) { + $jsonResponse = json_decode($e->getResponse()->getBody()); + if ($jsonResponse->name === 'InvalidJwtTokenError') { + $issue = $jsonResponse->details[0]->issue; + throw new InvalidJwtTokenError($issue, $jsonResponse->traceId); + } + + if ($jsonResponse->name === 'NotFoundError') { + throw new NotFoundError($jsonResponse->message, $jsonResponse->traceId); + } + + if ($jsonResponse->name === 'InvalidParameterError') { + throw new InvalidParameterError($jsonResponse->message, $jsonResponse->details, $jsonResponse->traceId); + } + throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), diff --git a/src/Clients/IamClient/lib/InvalidJwtTokenError.php b/src/Clients/IamClient/lib/InvalidJwtTokenError.php new file mode 100644 index 0000000..c1948ef --- /dev/null +++ b/src/Clients/IamClient/lib/InvalidJwtTokenError.php @@ -0,0 +1,80 @@ + $this->name, + 'message' => $this->message, + 'issue' => $issue, + 'traceId' => $traceId + ]; + + parent::__construct(json_encode($message), 403); + $this->issue = $issue; + $this->traceId = $traceId; + } +} diff --git a/src/Clients/IamClient/lib/InvalidParameterError.php b/src/Clients/IamClient/lib/InvalidParameterError.php new file mode 100644 index 0000000..fc31124 --- /dev/null +++ b/src/Clients/IamClient/lib/InvalidParameterError.php @@ -0,0 +1,75 @@ + $this->name, + 'message' => $message, + 'details' => $details, + 'traceId' => $traceId + ]; + + parent::__construct(json_encode($message), 400); + $this->details = $details; + $this->traceId = $traceId; + } +} diff --git a/src/Clients/IamClient/lib/Model/ProjectList.php b/src/Clients/IamClient/lib/Model/ProjectList.php index 06f1b98..0112954 100644 --- a/src/Clients/IamClient/lib/Model/ProjectList.php +++ b/src/Clients/IamClient/lib/Model/ProjectList.php @@ -58,7 +58,8 @@ class ProjectList implements ModelInterface, ArrayAccess, \JsonSerializable * @var string[] */ protected static $openAPITypes = [ - 'projects' => '\AffinidiTdk\Clients\IamClient\Model\ProjectDto[]' + 'projects' => '\AffinidiTdk\Clients\IamClient\Model\ProjectDto[]', + 'last_evaluated_key' => 'string' ]; /** @@ -69,7 +70,8 @@ class ProjectList implements ModelInterface, ArrayAccess, \JsonSerializable * @psalm-var array */ protected static $openAPIFormats = [ - 'projects' => null + 'projects' => null, + 'last_evaluated_key' => null ]; /** @@ -78,7 +80,8 @@ class ProjectList implements ModelInterface, ArrayAccess, \JsonSerializable * @var boolean[] */ protected static array $openAPINullables = [ - 'projects' => false + 'projects' => false, + 'last_evaluated_key' => false ]; /** @@ -167,7 +170,8 @@ public function isNullableSetToNull(string $property): bool * @var string[] */ protected static $attributeMap = [ - 'projects' => 'projects' + 'projects' => 'projects', + 'last_evaluated_key' => 'lastEvaluatedKey' ]; /** @@ -176,7 +180,8 @@ public function isNullableSetToNull(string $property): bool * @var string[] */ protected static $setters = [ - 'projects' => 'setProjects' + 'projects' => 'setProjects', + 'last_evaluated_key' => 'setLastEvaluatedKey' ]; /** @@ -185,7 +190,8 @@ public function isNullableSetToNull(string $property): bool * @var string[] */ protected static $getters = [ - 'projects' => 'getProjects' + 'projects' => 'getProjects', + 'last_evaluated_key' => 'getLastEvaluatedKey' ]; /** @@ -246,6 +252,7 @@ public function getModelName() public function __construct(array $data = null) { $this->setIfExists('projects', $data ?? [], null); + $this->setIfExists('last_evaluated_key', $data ?? [], null); } /** @@ -319,6 +326,33 @@ public function setProjects($projects) return $this; } + + /** + * Gets last_evaluated_key + * + * @return string|null + */ + public function getLastEvaluatedKey() + { + return $this->container['last_evaluated_key']; + } + + /** + * Sets last_evaluated_key + * + * @param string|null $last_evaluated_key last_evaluated_key + * + * @return self + */ + public function setLastEvaluatedKey($last_evaluated_key) + { + if (is_null($last_evaluated_key)) { + throw new \InvalidArgumentException('non-nullable last_evaluated_key cannot be null'); + } + $this->container['last_evaluated_key'] = $last_evaluated_key; + + return $this; + } /** * Returns true if offset exists. False otherwise. * diff --git a/src/Clients/IamClient/lib/Model/TokenList.php b/src/Clients/IamClient/lib/Model/TokenList.php index d501dfa..7147bdd 100644 --- a/src/Clients/IamClient/lib/Model/TokenList.php +++ b/src/Clients/IamClient/lib/Model/TokenList.php @@ -58,7 +58,8 @@ class TokenList implements ModelInterface, ArrayAccess, \JsonSerializable * @var string[] */ protected static $openAPITypes = [ - 'tokens' => '\AffinidiTdk\Clients\IamClient\Model\TokenDto[]' + 'tokens' => '\AffinidiTdk\Clients\IamClient\Model\TokenDto[]', + 'last_evaluated_key' => 'string' ]; /** @@ -69,7 +70,8 @@ class TokenList implements ModelInterface, ArrayAccess, \JsonSerializable * @psalm-var array */ protected static $openAPIFormats = [ - 'tokens' => null + 'tokens' => null, + 'last_evaluated_key' => null ]; /** @@ -78,7 +80,8 @@ class TokenList implements ModelInterface, ArrayAccess, \JsonSerializable * @var boolean[] */ protected static array $openAPINullables = [ - 'tokens' => false + 'tokens' => false, + 'last_evaluated_key' => false ]; /** @@ -167,7 +170,8 @@ public function isNullableSetToNull(string $property): bool * @var string[] */ protected static $attributeMap = [ - 'tokens' => 'tokens' + 'tokens' => 'tokens', + 'last_evaluated_key' => 'lastEvaluatedKey' ]; /** @@ -176,7 +180,8 @@ public function isNullableSetToNull(string $property): bool * @var string[] */ protected static $setters = [ - 'tokens' => 'setTokens' + 'tokens' => 'setTokens', + 'last_evaluated_key' => 'setLastEvaluatedKey' ]; /** @@ -185,7 +190,8 @@ public function isNullableSetToNull(string $property): bool * @var string[] */ protected static $getters = [ - 'tokens' => 'getTokens' + 'tokens' => 'getTokens', + 'last_evaluated_key' => 'getLastEvaluatedKey' ]; /** @@ -246,6 +252,7 @@ public function getModelName() public function __construct(array $data = null) { $this->setIfExists('tokens', $data ?? [], null); + $this->setIfExists('last_evaluated_key', $data ?? [], null); } /** @@ -319,6 +326,33 @@ public function setTokens($tokens) return $this; } + + /** + * Gets last_evaluated_key + * + * @return string|null + */ + public function getLastEvaluatedKey() + { + return $this->container['last_evaluated_key']; + } + + /** + * Sets last_evaluated_key + * + * @param string|null $last_evaluated_key last_evaluated_key + * + * @return self + */ + public function setLastEvaluatedKey($last_evaluated_key) + { + if (is_null($last_evaluated_key)) { + throw new \InvalidArgumentException('non-nullable last_evaluated_key cannot be null'); + } + $this->container['last_evaluated_key'] = $last_evaluated_key; + + return $this; + } /** * Returns true if offset exists. False otherwise. * diff --git a/src/Clients/IamClient/lib/Model/TypedPrincipalId.php b/src/Clients/IamClient/lib/Model/TypedPrincipalId.php new file mode 100644 index 0000000..d3af2dc --- /dev/null +++ b/src/Clients/IamClient/lib/Model/TypedPrincipalId.php @@ -0,0 +1,413 @@ + + */ +class TypedPrincipalId implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'TypedPrincipalId'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'principal_id' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'principal_id' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'principal_id' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'principal_id' => 'principalId' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'principal_id' => 'setPrincipalId' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'principal_id' => 'getPrincipalId' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('principal_id', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['principal_id'] === null) { + $invalidProperties[] = "'principal_id' can't be null"; + } + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets principal_id + * + * @return string + */ + public function getPrincipalId() + { + return $this->container['principal_id']; + } + + /** + * Sets principal_id + * + * @param string $principal_id principal_id + * + * @return self + */ + public function setPrincipalId($principal_id) + { + if (is_null($principal_id)) { + throw new \InvalidArgumentException('non-nullable principal_id cannot be null'); + } + $this->container['principal_id'] = $principal_id; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/src/Clients/IamClient/lib/Model/UserList.php b/src/Clients/IamClient/lib/Model/UserList.php index e757037..2c178f9 100644 --- a/src/Clients/IamClient/lib/Model/UserList.php +++ b/src/Clients/IamClient/lib/Model/UserList.php @@ -58,7 +58,8 @@ class UserList implements ModelInterface, ArrayAccess, \JsonSerializable * @var string[] */ protected static $openAPITypes = [ - 'records' => '\AffinidiTdk\Clients\IamClient\Model\UserDto[]' + 'records' => '\AffinidiTdk\Clients\IamClient\Model\UserDto[]', + 'last_evaluated_key' => 'string' ]; /** @@ -69,7 +70,8 @@ class UserList implements ModelInterface, ArrayAccess, \JsonSerializable * @psalm-var array */ protected static $openAPIFormats = [ - 'records' => null + 'records' => null, + 'last_evaluated_key' => null ]; /** @@ -78,7 +80,8 @@ class UserList implements ModelInterface, ArrayAccess, \JsonSerializable * @var boolean[] */ protected static array $openAPINullables = [ - 'records' => false + 'records' => false, + 'last_evaluated_key' => false ]; /** @@ -167,7 +170,8 @@ public function isNullableSetToNull(string $property): bool * @var string[] */ protected static $attributeMap = [ - 'records' => 'records' + 'records' => 'records', + 'last_evaluated_key' => 'lastEvaluatedKey' ]; /** @@ -176,7 +180,8 @@ public function isNullableSetToNull(string $property): bool * @var string[] */ protected static $setters = [ - 'records' => 'setRecords' + 'records' => 'setRecords', + 'last_evaluated_key' => 'setLastEvaluatedKey' ]; /** @@ -185,7 +190,8 @@ public function isNullableSetToNull(string $property): bool * @var string[] */ protected static $getters = [ - 'records' => 'getRecords' + 'records' => 'getRecords', + 'last_evaluated_key' => 'getLastEvaluatedKey' ]; /** @@ -246,6 +252,7 @@ public function getModelName() public function __construct(array $data = null) { $this->setIfExists('records', $data ?? [], null); + $this->setIfExists('last_evaluated_key', $data ?? [], null); } /** @@ -319,6 +326,33 @@ public function setRecords($records) return $this; } + + /** + * Gets last_evaluated_key + * + * @return string|null + */ + public function getLastEvaluatedKey() + { + return $this->container['last_evaluated_key']; + } + + /** + * Sets last_evaluated_key + * + * @param string|null $last_evaluated_key last_evaluated_key + * + * @return self + */ + public function setLastEvaluatedKey($last_evaluated_key) + { + if (is_null($last_evaluated_key)) { + throw new \InvalidArgumentException('non-nullable last_evaluated_key cannot be null'); + } + $this->container['last_evaluated_key'] = $last_evaluated_key; + + return $this; + } /** * Returns true if offset exists. False otherwise. * diff --git a/src/Clients/IamClient/lib/NotFoundError.php b/src/Clients/IamClient/lib/NotFoundError.php new file mode 100644 index 0000000..392d4cf --- /dev/null +++ b/src/Clients/IamClient/lib/NotFoundError.php @@ -0,0 +1,73 @@ + $this->name, + 'message' => $message, + 'traceId' => $traceId + ]; + + parent::__construct(json_encode($message), 404); + $this->traceId = $traceId; + } +} diff --git a/src/Clients/IamClient/test/Model/TypedPrincipalIdTest.php b/src/Clients/IamClient/test/Model/TypedPrincipalIdTest.php new file mode 100644 index 0000000..d0b9c83 --- /dev/null +++ b/src/Clients/IamClient/test/Model/TypedPrincipalIdTest.php @@ -0,0 +1,91 @@ +client = $client ?: new Client(); $this->config = $config ?: Configuration::getDefaultConfiguration(); @@ -158,6 +161,20 @@ public function iotOIDC4VPCallbackWithHttpInfo($callback_input, string $contentT try { $response = $this->client->send($request, $options); } catch (RequestException $e) { + $jsonResponse = json_decode($e->getResponse()->getBody()); + if ($jsonResponse->name === 'InvalidJwtTokenError') { + $issue = $jsonResponse->details[0]->issue; + throw new InvalidJwtTokenError($issue, $jsonResponse->traceId); + } + + if ($jsonResponse->name === 'NotFoundError') { + throw new NotFoundError($jsonResponse->message, $jsonResponse->traceId); + } + + if ($jsonResponse->name === 'InvalidParameterError') { + throw new InvalidParameterError($jsonResponse->message, $jsonResponse->details, $jsonResponse->traceId); + } + throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), diff --git a/src/Clients/IotaClient/lib/Api/ConfigurationsApi.php b/src/Clients/IotaClient/lib/Api/ConfigurationsApi.php index 116dd97..cd606e7 100644 --- a/src/Clients/IotaClient/lib/Api/ConfigurationsApi.php +++ b/src/Clients/IotaClient/lib/Api/ConfigurationsApi.php @@ -36,6 +36,9 @@ use GuzzleHttp\Psr7\Request; use GuzzleHttp\RequestOptions; use AffinidiTdk\Clients\IotaClient\ApiException; +use AffinidiTdk\Clients\IotaClient\InvalidJwtTokenError; +use AffinidiTdk\Clients\IotaClient\InvalidParameterError; +use AffinidiTdk\Clients\IotaClient\NotFoundError; use AffinidiTdk\Clients\IotaClient\Configuration; use AffinidiTdk\Clients\IotaClient\HeaderSelector; use AffinidiTdk\Clients\IotaClient\ObjectSerializer; @@ -99,10 +102,10 @@ class ConfigurationsApi * @param int $hostIndex (Optional) host index to select the list of hosts if defined in the OpenAPI spec */ public function __construct( - ClientInterface $client = null, - Configuration $config = null, - HeaderSelector $selector = null, - $hostIndex = 0 + ?ClientInterface $client = null, + ?Configuration $config = null, + ?HeaderSelector $selector = null, + int $hostIndex = 0 ) { $this->client = $client ?: new Client(); $this->config = $config ?: Configuration::getDefaultConfiguration(); @@ -173,6 +176,20 @@ public function createIotaConfigurationWithHttpInfo($create_iota_configuration_i try { $response = $this->client->send($request, $options); } catch (RequestException $e) { + $jsonResponse = json_decode($e->getResponse()->getBody()); + if ($jsonResponse->name === 'InvalidJwtTokenError') { + $issue = $jsonResponse->details[0]->issue; + throw new InvalidJwtTokenError($issue, $jsonResponse->traceId); + } + + if ($jsonResponse->name === 'NotFoundError') { + throw new NotFoundError($jsonResponse->message, $jsonResponse->traceId); + } + + if ($jsonResponse->name === 'InvalidParameterError') { + throw new InvalidParameterError($jsonResponse->message, $jsonResponse->details, $jsonResponse->traceId); + } + throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), @@ -616,6 +633,20 @@ public function deleteIotaConfigurationByIdWithHttpInfo($configuration_id, strin try { $response = $this->client->send($request, $options); } catch (RequestException $e) { + $jsonResponse = json_decode($e->getResponse()->getBody()); + if ($jsonResponse->name === 'InvalidJwtTokenError') { + $issue = $jsonResponse->details[0]->issue; + throw new InvalidJwtTokenError($issue, $jsonResponse->traceId); + } + + if ($jsonResponse->name === 'NotFoundError') { + throw new NotFoundError($jsonResponse->message, $jsonResponse->traceId); + } + + if ($jsonResponse->name === 'InvalidParameterError') { + throw new InvalidParameterError($jsonResponse->message, $jsonResponse->details, $jsonResponse->traceId); + } + throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), @@ -847,6 +878,20 @@ public function getIotaConfigurationByIdWithHttpInfo($configuration_id, string $ try { $response = $this->client->send($request, $options); } catch (RequestException $e) { + $jsonResponse = json_decode($e->getResponse()->getBody()); + if ($jsonResponse->name === 'InvalidJwtTokenError') { + $issue = $jsonResponse->details[0]->issue; + throw new InvalidJwtTokenError($issue, $jsonResponse->traceId); + } + + if ($jsonResponse->name === 'NotFoundError') { + throw new NotFoundError($jsonResponse->message, $jsonResponse->traceId); + } + + if ($jsonResponse->name === 'InvalidParameterError') { + throw new InvalidParameterError($jsonResponse->message, $jsonResponse->details, $jsonResponse->traceId); + } + throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), @@ -1259,6 +1304,20 @@ public function getIotaConfigurationMetaDataWithHttpInfo($project_id, $configura try { $response = $this->client->send($request, $options); } catch (RequestException $e) { + $jsonResponse = json_decode($e->getResponse()->getBody()); + if ($jsonResponse->name === 'InvalidJwtTokenError') { + $issue = $jsonResponse->details[0]->issue; + throw new InvalidJwtTokenError($issue, $jsonResponse->traceId); + } + + if ($jsonResponse->name === 'NotFoundError') { + throw new NotFoundError($jsonResponse->message, $jsonResponse->traceId); + } + + if ($jsonResponse->name === 'InvalidParameterError') { + throw new InvalidParameterError($jsonResponse->message, $jsonResponse->details, $jsonResponse->traceId); + } + throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), @@ -1645,6 +1704,20 @@ public function listIotaConfigurationsWithHttpInfo(string $contentType = self::c try { $response = $this->client->send($request, $options); } catch (RequestException $e) { + $jsonResponse = json_decode($e->getResponse()->getBody()); + if ($jsonResponse->name === 'InvalidJwtTokenError') { + $issue = $jsonResponse->details[0]->issue; + throw new InvalidJwtTokenError($issue, $jsonResponse->traceId); + } + + if ($jsonResponse->name === 'NotFoundError') { + throw new NotFoundError($jsonResponse->message, $jsonResponse->traceId); + } + + if ($jsonResponse->name === 'InvalidParameterError') { + throw new InvalidParameterError($jsonResponse->message, $jsonResponse->details, $jsonResponse->traceId); + } + throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), @@ -2004,6 +2077,20 @@ public function updateIotaConfigurationByIdWithHttpInfo($configuration_id, $upda try { $response = $this->client->send($request, $options); } catch (RequestException $e) { + $jsonResponse = json_decode($e->getResponse()->getBody()); + if ($jsonResponse->name === 'InvalidJwtTokenError') { + $issue = $jsonResponse->details[0]->issue; + throw new InvalidJwtTokenError($issue, $jsonResponse->traceId); + } + + if ($jsonResponse->name === 'NotFoundError') { + throw new NotFoundError($jsonResponse->message, $jsonResponse->traceId); + } + + if ($jsonResponse->name === 'InvalidParameterError') { + throw new InvalidParameterError($jsonResponse->message, $jsonResponse->details, $jsonResponse->traceId); + } + throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), diff --git a/src/Clients/IotaClient/lib/Api/DefaultApi.php b/src/Clients/IotaClient/lib/Api/DefaultApi.php index 4ea71d4..62643bb 100644 --- a/src/Clients/IotaClient/lib/Api/DefaultApi.php +++ b/src/Clients/IotaClient/lib/Api/DefaultApi.php @@ -36,6 +36,9 @@ use GuzzleHttp\Psr7\Request; use GuzzleHttp\RequestOptions; use AffinidiTdk\Clients\IotaClient\ApiException; +use AffinidiTdk\Clients\IotaClient\InvalidJwtTokenError; +use AffinidiTdk\Clients\IotaClient\InvalidParameterError; +use AffinidiTdk\Clients\IotaClient\NotFoundError; use AffinidiTdk\Clients\IotaClient\Configuration; use AffinidiTdk\Clients\IotaClient\HeaderSelector; use AffinidiTdk\Clients\IotaClient\ObjectSerializer; @@ -84,10 +87,10 @@ class DefaultApi * @param int $hostIndex (Optional) host index to select the list of hosts if defined in the OpenAPI spec */ public function __construct( - ClientInterface $client = null, - Configuration $config = null, - HeaderSelector $selector = null, - $hostIndex = 0 + ?ClientInterface $client = null, + ?Configuration $config = null, + ?HeaderSelector $selector = null, + int $hostIndex = 0 ) { $this->client = $client ?: new Client(); $this->config = $config ?: Configuration::getDefaultConfiguration(); @@ -126,10 +129,10 @@ public function getConfig() /** * Operation listLoggedConsents * - * @param string $configuration_id configuration_id (optional) - * @param string $user_id user_id (optional) - * @param int $limit The maximum number of records to fetch from the list of logged consents. (optional) - * @param string $exclusive_start_key The base64url encoded key of the first item that this operation will evaluate (it is not returned). Use the value that was returned in the previous operation. (optional) + * @param string|null $configuration_id configuration_id (optional) + * @param string|null $user_id user_id (optional) + * @param int|null $limit The maximum number of records to fetch from the list of logged consents. (optional) + * @param string|null $exclusive_start_key The base64url encoded key of the first item that this operation will evaluate (it is not returned). Use the value that was returned in the previous operation. (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['listLoggedConsents'] to see the possible values for this operation * * @throws \AffinidiTdk\Clients\IotaClient\ApiException on non-2xx response or if the response body is not in the expected format @@ -145,10 +148,10 @@ public function listLoggedConsents($configuration_id = null, $user_id = null, $l /** * Operation listLoggedConsentsWithHttpInfo * - * @param string $configuration_id (optional) - * @param string $user_id (optional) - * @param int $limit The maximum number of records to fetch from the list of logged consents. (optional) - * @param string $exclusive_start_key The base64url encoded key of the first item that this operation will evaluate (it is not returned). Use the value that was returned in the previous operation. (optional) + * @param string|null $configuration_id (optional) + * @param string|null $user_id (optional) + * @param int|null $limit The maximum number of records to fetch from the list of logged consents. (optional) + * @param string|null $exclusive_start_key The base64url encoded key of the first item that this operation will evaluate (it is not returned). Use the value that was returned in the previous operation. (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['listLoggedConsents'] to see the possible values for this operation * * @throws \AffinidiTdk\Clients\IotaClient\ApiException on non-2xx response or if the response body is not in the expected format @@ -164,6 +167,20 @@ public function listLoggedConsentsWithHttpInfo($configuration_id = null, $user_i try { $response = $this->client->send($request, $options); } catch (RequestException $e) { + $jsonResponse = json_decode($e->getResponse()->getBody()); + if ($jsonResponse->name === 'InvalidJwtTokenError') { + $issue = $jsonResponse->details[0]->issue; + throw new InvalidJwtTokenError($issue, $jsonResponse->traceId); + } + + if ($jsonResponse->name === 'NotFoundError') { + throw new NotFoundError($jsonResponse->message, $jsonResponse->traceId); + } + + if ($jsonResponse->name === 'InvalidParameterError') { + throw new InvalidParameterError($jsonResponse->message, $jsonResponse->details, $jsonResponse->traceId); + } + throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), @@ -341,10 +358,10 @@ public function listLoggedConsentsWithHttpInfo($configuration_id = null, $user_i /** * Operation listLoggedConsentsAsync * - * @param string $configuration_id (optional) - * @param string $user_id (optional) - * @param int $limit The maximum number of records to fetch from the list of logged consents. (optional) - * @param string $exclusive_start_key The base64url encoded key of the first item that this operation will evaluate (it is not returned). Use the value that was returned in the previous operation. (optional) + * @param string|null $configuration_id (optional) + * @param string|null $user_id (optional) + * @param int|null $limit The maximum number of records to fetch from the list of logged consents. (optional) + * @param string|null $exclusive_start_key The base64url encoded key of the first item that this operation will evaluate (it is not returned). Use the value that was returned in the previous operation. (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['listLoggedConsents'] to see the possible values for this operation * * @throws \InvalidArgumentException @@ -363,10 +380,10 @@ function ($response) { /** * Operation listLoggedConsentsAsyncWithHttpInfo * - * @param string $configuration_id (optional) - * @param string $user_id (optional) - * @param int $limit The maximum number of records to fetch from the list of logged consents. (optional) - * @param string $exclusive_start_key The base64url encoded key of the first item that this operation will evaluate (it is not returned). Use the value that was returned in the previous operation. (optional) + * @param string|null $configuration_id (optional) + * @param string|null $user_id (optional) + * @param int|null $limit The maximum number of records to fetch from the list of logged consents. (optional) + * @param string|null $exclusive_start_key The base64url encoded key of the first item that this operation will evaluate (it is not returned). Use the value that was returned in the previous operation. (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['listLoggedConsents'] to see the possible values for this operation * * @throws \InvalidArgumentException @@ -416,10 +433,10 @@ function ($exception) { /** * Create request for operation 'listLoggedConsents' * - * @param string $configuration_id (optional) - * @param string $user_id (optional) - * @param int $limit The maximum number of records to fetch from the list of logged consents. (optional) - * @param string $exclusive_start_key The base64url encoded key of the first item that this operation will evaluate (it is not returned). Use the value that was returned in the previous operation. (optional) + * @param string|null $configuration_id (optional) + * @param string|null $user_id (optional) + * @param int|null $limit The maximum number of records to fetch from the list of logged consents. (optional) + * @param string|null $exclusive_start_key The base64url encoded key of the first item that this operation will evaluate (it is not returned). Use the value that was returned in the previous operation. (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['listLoggedConsents'] to see the possible values for this operation * * @throws \InvalidArgumentException diff --git a/src/Clients/IotaClient/lib/Api/IotaApi.php b/src/Clients/IotaClient/lib/Api/IotaApi.php index 086718b..e4e69f2 100644 --- a/src/Clients/IotaClient/lib/Api/IotaApi.php +++ b/src/Clients/IotaClient/lib/Api/IotaApi.php @@ -36,6 +36,9 @@ use GuzzleHttp\Psr7\Request; use GuzzleHttp\RequestOptions; use AffinidiTdk\Clients\IotaClient\ApiException; +use AffinidiTdk\Clients\IotaClient\InvalidJwtTokenError; +use AffinidiTdk\Clients\IotaClient\InvalidParameterError; +use AffinidiTdk\Clients\IotaClient\NotFoundError; use AffinidiTdk\Clients\IotaClient\Configuration; use AffinidiTdk\Clients\IotaClient\HeaderSelector; use AffinidiTdk\Clients\IotaClient\ObjectSerializer; @@ -96,10 +99,10 @@ class IotaApi * @param int $hostIndex (Optional) host index to select the list of hosts if defined in the OpenAPI spec */ public function __construct( - ClientInterface $client = null, - Configuration $config = null, - HeaderSelector $selector = null, - $hostIndex = 0 + ?ClientInterface $client = null, + ?Configuration $config = null, + ?HeaderSelector $selector = null, + int $hostIndex = 0 ) { $this->client = $client ?: new Client(); $this->config = $config ?: Configuration::getDefaultConfiguration(); @@ -170,6 +173,20 @@ public function awsExchangeCredentialsWithHttpInfo($aws_exchange_credentials, st try { $response = $this->client->send($request, $options); } catch (RequestException $e) { + $jsonResponse = json_decode($e->getResponse()->getBody()); + if ($jsonResponse->name === 'InvalidJwtTokenError') { + $issue = $jsonResponse->details[0]->issue; + throw new InvalidJwtTokenError($issue, $jsonResponse->traceId); + } + + if ($jsonResponse->name === 'NotFoundError') { + throw new NotFoundError($jsonResponse->message, $jsonResponse->traceId); + } + + if ($jsonResponse->name === 'InvalidParameterError') { + throw new InvalidParameterError($jsonResponse->message, $jsonResponse->details, $jsonResponse->traceId); + } + throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), @@ -539,6 +556,20 @@ public function awsExchangeCredentialsProjectTokenWithHttpInfo($aws_exchange_cre try { $response = $this->client->send($request, $options); } catch (RequestException $e) { + $jsonResponse = json_decode($e->getResponse()->getBody()); + if ($jsonResponse->name === 'InvalidJwtTokenError') { + $issue = $jsonResponse->details[0]->issue; + throw new InvalidJwtTokenError($issue, $jsonResponse->traceId); + } + + if ($jsonResponse->name === 'NotFoundError') { + throw new NotFoundError($jsonResponse->message, $jsonResponse->traceId); + } + + if ($jsonResponse->name === 'InvalidParameterError') { + throw new InvalidParameterError($jsonResponse->message, $jsonResponse->details, $jsonResponse->traceId); + } + throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), @@ -913,6 +944,20 @@ public function fetchIotaVpResponseWithHttpInfo($fetch_iotavp_response_input, st try { $response = $this->client->send($request, $options); } catch (RequestException $e) { + $jsonResponse = json_decode($e->getResponse()->getBody()); + if ($jsonResponse->name === 'InvalidJwtTokenError') { + $issue = $jsonResponse->details[0]->issue; + throw new InvalidJwtTokenError($issue, $jsonResponse->traceId); + } + + if ($jsonResponse->name === 'NotFoundError') { + throw new NotFoundError($jsonResponse->message, $jsonResponse->traceId); + } + + if ($jsonResponse->name === 'InvalidParameterError') { + throw new InvalidParameterError($jsonResponse->message, $jsonResponse->details, $jsonResponse->traceId); + } + throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), @@ -1322,6 +1367,20 @@ public function initiateDataSharingRequestWithHttpInfo($initiate_data_sharing_re try { $response = $this->client->send($request, $options); } catch (RequestException $e) { + $jsonResponse = json_decode($e->getResponse()->getBody()); + if ($jsonResponse->name === 'InvalidJwtTokenError') { + $issue = $jsonResponse->details[0]->issue; + throw new InvalidJwtTokenError($issue, $jsonResponse->traceId); + } + + if ($jsonResponse->name === 'NotFoundError') { + throw new NotFoundError($jsonResponse->message, $jsonResponse->traceId); + } + + if ($jsonResponse->name === 'InvalidParameterError') { + throw new InvalidParameterError($jsonResponse->message, $jsonResponse->details, $jsonResponse->traceId); + } + throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), @@ -1696,6 +1755,20 @@ public function iotaExchangeCredentialsWithHttpInfo($iota_exchange_credentials, try { $response = $this->client->send($request, $options); } catch (RequestException $e) { + $jsonResponse = json_decode($e->getResponse()->getBody()); + if ($jsonResponse->name === 'InvalidJwtTokenError') { + $issue = $jsonResponse->details[0]->issue; + throw new InvalidJwtTokenError($issue, $jsonResponse->traceId); + } + + if ($jsonResponse->name === 'NotFoundError') { + throw new NotFoundError($jsonResponse->message, $jsonResponse->traceId); + } + + if ($jsonResponse->name === 'InvalidParameterError') { + throw new InvalidParameterError($jsonResponse->message, $jsonResponse->details, $jsonResponse->traceId); + } + throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), diff --git a/src/Clients/IotaClient/lib/Api/PexQueryApi.php b/src/Clients/IotaClient/lib/Api/PexQueryApi.php index a7f9d71..c95afda 100644 --- a/src/Clients/IotaClient/lib/Api/PexQueryApi.php +++ b/src/Clients/IotaClient/lib/Api/PexQueryApi.php @@ -36,6 +36,9 @@ use GuzzleHttp\Psr7\Request; use GuzzleHttp\RequestOptions; use AffinidiTdk\Clients\IotaClient\ApiException; +use AffinidiTdk\Clients\IotaClient\InvalidJwtTokenError; +use AffinidiTdk\Clients\IotaClient\InvalidParameterError; +use AffinidiTdk\Clients\IotaClient\NotFoundError; use AffinidiTdk\Clients\IotaClient\Configuration; use AffinidiTdk\Clients\IotaClient\HeaderSelector; use AffinidiTdk\Clients\IotaClient\ObjectSerializer; @@ -102,10 +105,10 @@ class PexQueryApi * @param int $hostIndex (Optional) host index to select the list of hosts if defined in the OpenAPI spec */ public function __construct( - ClientInterface $client = null, - Configuration $config = null, - HeaderSelector $selector = null, - $hostIndex = 0 + ?ClientInterface $client = null, + ?Configuration $config = null, + ?HeaderSelector $selector = null, + int $hostIndex = 0 ) { $this->client = $client ?: new Client(); $this->config = $config ?: Configuration::getDefaultConfiguration(); @@ -178,6 +181,20 @@ public function createPexQueryWithHttpInfo($configuration_id, $create_pex_query_ try { $response = $this->client->send($request, $options); } catch (RequestException $e) { + $jsonResponse = json_decode($e->getResponse()->getBody()); + if ($jsonResponse->name === 'InvalidJwtTokenError') { + $issue = $jsonResponse->details[0]->issue; + throw new InvalidJwtTokenError($issue, $jsonResponse->traceId); + } + + if ($jsonResponse->name === 'NotFoundError') { + throw new NotFoundError($jsonResponse->message, $jsonResponse->traceId); + } + + if ($jsonResponse->name === 'InvalidParameterError') { + throw new InvalidParameterError($jsonResponse->message, $jsonResponse->details, $jsonResponse->traceId); + } + throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), @@ -674,6 +691,20 @@ public function deletePexQueriesWithHttpInfo($configuration_id, string $contentT try { $response = $this->client->send($request, $options); } catch (RequestException $e) { + $jsonResponse = json_decode($e->getResponse()->getBody()); + if ($jsonResponse->name === 'InvalidJwtTokenError') { + $issue = $jsonResponse->details[0]->issue; + throw new InvalidJwtTokenError($issue, $jsonResponse->traceId); + } + + if ($jsonResponse->name === 'NotFoundError') { + throw new NotFoundError($jsonResponse->message, $jsonResponse->traceId); + } + + if ($jsonResponse->name === 'InvalidParameterError') { + throw new InvalidParameterError($jsonResponse->message, $jsonResponse->details, $jsonResponse->traceId); + } + throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), @@ -906,6 +937,20 @@ public function deletePexQueryByIdWithHttpInfo($configuration_id, $query_id, str try { $response = $this->client->send($request, $options); } catch (RequestException $e) { + $jsonResponse = json_decode($e->getResponse()->getBody()); + if ($jsonResponse->name === 'InvalidJwtTokenError') { + $issue = $jsonResponse->details[0]->issue; + throw new InvalidJwtTokenError($issue, $jsonResponse->traceId); + } + + if ($jsonResponse->name === 'NotFoundError') { + throw new NotFoundError($jsonResponse->message, $jsonResponse->traceId); + } + + if ($jsonResponse->name === 'InvalidParameterError') { + throw new InvalidParameterError($jsonResponse->message, $jsonResponse->details, $jsonResponse->traceId); + } + throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), @@ -1165,6 +1210,20 @@ public function getPexQueryByIdWithHttpInfo($configuration_id, $query_id, string try { $response = $this->client->send($request, $options); } catch (RequestException $e) { + $jsonResponse = json_decode($e->getResponse()->getBody()); + if ($jsonResponse->name === 'InvalidJwtTokenError') { + $issue = $jsonResponse->details[0]->issue; + throw new InvalidJwtTokenError($issue, $jsonResponse->traceId); + } + + if ($jsonResponse->name === 'NotFoundError') { + throw new NotFoundError($jsonResponse->message, $jsonResponse->traceId); + } + + if ($jsonResponse->name === 'InvalidParameterError') { + throw new InvalidParameterError($jsonResponse->message, $jsonResponse->details, $jsonResponse->traceId); + } + throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), @@ -1562,8 +1621,8 @@ public function getPexQueryByIdRequest($configuration_id, $query_id, string $con * Operation listPexQueries * * @param string $configuration_id ID of the Affinidi Iota Framework configuration. (required) - * @param int $limit Maximum number of records to fetch in a list (optional) - * @param string $exclusive_start_key The base64url encoded key of the first item that this operation will evaluate (it is not returned). Use the value that was returned in the previous operation. (optional) + * @param int|null $limit Maximum number of records to fetch in a list (optional) + * @param string|null $exclusive_start_key The base64url encoded key of the first item that this operation will evaluate (it is not returned). Use the value that was returned in the previous operation. (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['listPexQueries'] to see the possible values for this operation * * @throws \AffinidiTdk\Clients\IotaClient\ApiException on non-2xx response or if the response body is not in the expected format @@ -1580,8 +1639,8 @@ public function listPexQueries($configuration_id, $limit = null, $exclusive_star * Operation listPexQueriesWithHttpInfo * * @param string $configuration_id ID of the Affinidi Iota Framework configuration. (required) - * @param int $limit Maximum number of records to fetch in a list (optional) - * @param string $exclusive_start_key The base64url encoded key of the first item that this operation will evaluate (it is not returned). Use the value that was returned in the previous operation. (optional) + * @param int|null $limit Maximum number of records to fetch in a list (optional) + * @param string|null $exclusive_start_key The base64url encoded key of the first item that this operation will evaluate (it is not returned). Use the value that was returned in the previous operation. (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['listPexQueries'] to see the possible values for this operation * * @throws \AffinidiTdk\Clients\IotaClient\ApiException on non-2xx response or if the response body is not in the expected format @@ -1597,6 +1656,20 @@ public function listPexQueriesWithHttpInfo($configuration_id, $limit = null, $ex try { $response = $this->client->send($request, $options); } catch (RequestException $e) { + $jsonResponse = json_decode($e->getResponse()->getBody()); + if ($jsonResponse->name === 'InvalidJwtTokenError') { + $issue = $jsonResponse->details[0]->issue; + throw new InvalidJwtTokenError($issue, $jsonResponse->traceId); + } + + if ($jsonResponse->name === 'NotFoundError') { + throw new NotFoundError($jsonResponse->message, $jsonResponse->traceId); + } + + if ($jsonResponse->name === 'InvalidParameterError') { + throw new InvalidParameterError($jsonResponse->message, $jsonResponse->details, $jsonResponse->traceId); + } + throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), @@ -1810,8 +1883,8 @@ public function listPexQueriesWithHttpInfo($configuration_id, $limit = null, $ex * Operation listPexQueriesAsync * * @param string $configuration_id ID of the Affinidi Iota Framework configuration. (required) - * @param int $limit Maximum number of records to fetch in a list (optional) - * @param string $exclusive_start_key The base64url encoded key of the first item that this operation will evaluate (it is not returned). Use the value that was returned in the previous operation. (optional) + * @param int|null $limit Maximum number of records to fetch in a list (optional) + * @param string|null $exclusive_start_key The base64url encoded key of the first item that this operation will evaluate (it is not returned). Use the value that was returned in the previous operation. (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['listPexQueries'] to see the possible values for this operation * * @throws \InvalidArgumentException @@ -1831,8 +1904,8 @@ function ($response) { * Operation listPexQueriesAsyncWithHttpInfo * * @param string $configuration_id ID of the Affinidi Iota Framework configuration. (required) - * @param int $limit Maximum number of records to fetch in a list (optional) - * @param string $exclusive_start_key The base64url encoded key of the first item that this operation will evaluate (it is not returned). Use the value that was returned in the previous operation. (optional) + * @param int|null $limit Maximum number of records to fetch in a list (optional) + * @param string|null $exclusive_start_key The base64url encoded key of the first item that this operation will evaluate (it is not returned). Use the value that was returned in the previous operation. (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['listPexQueries'] to see the possible values for this operation * * @throws \InvalidArgumentException @@ -1883,8 +1956,8 @@ function ($exception) { * Create request for operation 'listPexQueries' * * @param string $configuration_id ID of the Affinidi Iota Framework configuration. (required) - * @param int $limit Maximum number of records to fetch in a list (optional) - * @param string $exclusive_start_key The base64url encoded key of the first item that this operation will evaluate (it is not returned). Use the value that was returned in the previous operation. (optional) + * @param int|null $limit Maximum number of records to fetch in a list (optional) + * @param string|null $exclusive_start_key The base64url encoded key of the first item that this operation will evaluate (it is not returned). Use the value that was returned in the previous operation. (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['listPexQueries'] to see the possible values for this operation * * @throws \InvalidArgumentException @@ -2044,6 +2117,20 @@ public function savePexQueriesWithHttpInfo($configuration_id, $save_pex_queries_ try { $response = $this->client->send($request, $options); } catch (RequestException $e) { + $jsonResponse = json_decode($e->getResponse()->getBody()); + if ($jsonResponse->name === 'InvalidJwtTokenError') { + $issue = $jsonResponse->details[0]->issue; + throw new InvalidJwtTokenError($issue, $jsonResponse->traceId); + } + + if ($jsonResponse->name === 'NotFoundError') { + throw new NotFoundError($jsonResponse->message, $jsonResponse->traceId); + } + + if ($jsonResponse->name === 'InvalidParameterError') { + throw new InvalidParameterError($jsonResponse->message, $jsonResponse->details, $jsonResponse->traceId); + } + throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), @@ -2440,6 +2527,20 @@ public function updatePexQueryByIdWithHttpInfo($configuration_id, $query_id, $up try { $response = $this->client->send($request, $options); } catch (RequestException $e) { + $jsonResponse = json_decode($e->getResponse()->getBody()); + if ($jsonResponse->name === 'InvalidJwtTokenError') { + $issue = $jsonResponse->details[0]->issue; + throw new InvalidJwtTokenError($issue, $jsonResponse->traceId); + } + + if ($jsonResponse->name === 'NotFoundError') { + throw new NotFoundError($jsonResponse->message, $jsonResponse->traceId); + } + + if ($jsonResponse->name === 'InvalidParameterError') { + throw new InvalidParameterError($jsonResponse->message, $jsonResponse->details, $jsonResponse->traceId); + } + throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), diff --git a/src/Clients/IotaClient/lib/InvalidJwtTokenError.php b/src/Clients/IotaClient/lib/InvalidJwtTokenError.php new file mode 100644 index 0000000..a6bb35c --- /dev/null +++ b/src/Clients/IotaClient/lib/InvalidJwtTokenError.php @@ -0,0 +1,80 @@ + $this->name, + 'message' => $this->message, + 'issue' => $issue, + 'traceId' => $traceId + ]; + + parent::__construct(json_encode($message), 403); + $this->issue = $issue; + $this->traceId = $traceId; + } +} diff --git a/src/Clients/IotaClient/lib/InvalidParameterError.php b/src/Clients/IotaClient/lib/InvalidParameterError.php new file mode 100644 index 0000000..9504428 --- /dev/null +++ b/src/Clients/IotaClient/lib/InvalidParameterError.php @@ -0,0 +1,75 @@ + $this->name, + 'message' => $message, + 'details' => $details, + 'traceId' => $traceId + ]; + + parent::__construct(json_encode($message), 400); + $this->details = $details; + $this->traceId = $traceId; + } +} diff --git a/src/Clients/IotaClient/lib/Model/FetchIOTAVPResponseOK.php b/src/Clients/IotaClient/lib/Model/FetchIOTAVPResponseOK.php index 6ad111c..c11b67f 100644 --- a/src/Clients/IotaClient/lib/Model/FetchIOTAVPResponseOK.php +++ b/src/Clients/IotaClient/lib/Model/FetchIOTAVPResponseOK.php @@ -174,6 +174,8 @@ public function isNullableSetToNull(string $property): bool */ protected static $attributeMap = [ 'correlation_id' => 'correlationId', + 'presentation_submission' => 'presentation_submission', + 'vp_token' => 'vp_token', 'presentation_submission' => 'presentationSubmission', 'vp_token' => 'vpToken' ]; @@ -260,6 +262,8 @@ public function __construct(array $data = null) $this->setIfExists('correlation_id', $data ?? [], null); $this->setIfExists('presentation_submission', $data ?? [], null); $this->setIfExists('vp_token', $data ?? [], null); + $this->setIfExists('presentation_submission', $data ?? [], null); + $this->setIfExists('vp_token', $data ?? [], null); } /** diff --git a/src/Clients/IotaClient/lib/NotFoundError.php b/src/Clients/IotaClient/lib/NotFoundError.php new file mode 100644 index 0000000..42618b8 --- /dev/null +++ b/src/Clients/IotaClient/lib/NotFoundError.php @@ -0,0 +1,73 @@ + $this->name, + 'message' => $message, + 'traceId' => $traceId + ]; + + parent::__construct(json_encode($message), 404); + $this->traceId = $traceId; + } +} diff --git a/src/Clients/LoginConfigurationClient/.openapi-generator/FILES b/src/Clients/LoginConfigurationClient/.openapi-generator/FILES index 1aaca5d..4873a1a 100644 --- a/src/Clients/LoginConfigurationClient/.openapi-generator/FILES +++ b/src/Clients/LoginConfigurationClient/.openapi-generator/FILES @@ -71,6 +71,8 @@ lib/Api/IdpApi.php lib/ApiException.php lib/Configuration.php lib/HeaderSelector.php +lib/InvalidJwtTokenError.php +lib/InvalidParameterError.php lib/Model/ActionForbiddenError.php lib/Model/AddUserToGroupInput.php lib/Model/BlockedUsers.php @@ -129,5 +131,6 @@ lib/Model/TokenEndpointAuthMethod.php lib/Model/UnauthorizedError.php lib/Model/UpdateLoginConfigurationInput.php lib/Model/VPTokenValidationError.php +lib/NotFoundError.php lib/ObjectSerializer.php phpunit.xml.dist diff --git a/src/Clients/LoginConfigurationClient/lib/Api/AllowListApi.php b/src/Clients/LoginConfigurationClient/lib/Api/AllowListApi.php index 86db8f6..fca30ec 100644 --- a/src/Clients/LoginConfigurationClient/lib/Api/AllowListApi.php +++ b/src/Clients/LoginConfigurationClient/lib/Api/AllowListApi.php @@ -36,6 +36,9 @@ use GuzzleHttp\Psr7\Request; use GuzzleHttp\RequestOptions; use AffinidiTdk\Clients\LoginConfigurationClient\ApiException; +use AffinidiTdk\Clients\LoginConfigurationClient\InvalidJwtTokenError; +use AffinidiTdk\Clients\LoginConfigurationClient\InvalidParameterError; +use AffinidiTdk\Clients\LoginConfigurationClient\NotFoundError; use AffinidiTdk\Clients\LoginConfigurationClient\Configuration; use AffinidiTdk\Clients\LoginConfigurationClient\HeaderSelector; use AffinidiTdk\Clients\LoginConfigurationClient\ObjectSerializer; @@ -90,10 +93,10 @@ class AllowListApi * @param int $hostIndex (Optional) host index to select the list of hosts if defined in the OpenAPI spec */ public function __construct( - ClientInterface $client = null, - Configuration $config = null, - HeaderSelector $selector = null, - $hostIndex = 0 + ?ClientInterface $client = null, + ?Configuration $config = null, + ?HeaderSelector $selector = null, + int $hostIndex = 0 ) { $this->client = $client ?: new Client(); $this->config = $config ?: Configuration::getDefaultConfiguration(); @@ -132,7 +135,7 @@ public function getConfig() /** * Operation allowGroups * - * @param \AffinidiTdk\Clients\LoginConfigurationClient\Model\GroupNamesInput $group_names_input List of group names as input (optional) + * @param \AffinidiTdk\Clients\LoginConfigurationClient\Model\GroupNamesInput|null $group_names_input List of group names as input (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['allowGroups'] to see the possible values for this operation * * @throws \AffinidiTdk\Clients\LoginConfigurationClient\ApiException on non-2xx response or if the response body is not in the expected format @@ -147,7 +150,7 @@ public function allowGroups($group_names_input = null, string $contentType = sel /** * Operation allowGroupsWithHttpInfo * - * @param \AffinidiTdk\Clients\LoginConfigurationClient\Model\GroupNamesInput $group_names_input List of group names as input (optional) + * @param \AffinidiTdk\Clients\LoginConfigurationClient\Model\GroupNamesInput|null $group_names_input List of group names as input (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['allowGroups'] to see the possible values for this operation * * @throws \AffinidiTdk\Clients\LoginConfigurationClient\ApiException on non-2xx response or if the response body is not in the expected format @@ -163,6 +166,20 @@ public function allowGroupsWithHttpInfo($group_names_input = null, string $conte try { $response = $this->client->send($request, $options); } catch (RequestException $e) { + $jsonResponse = json_decode($e->getResponse()->getBody()); + if ($jsonResponse->name === 'InvalidJwtTokenError') { + $issue = $jsonResponse->details[0]->issue; + throw new InvalidJwtTokenError($issue, $jsonResponse->traceId); + } + + if ($jsonResponse->name === 'NotFoundError') { + throw new NotFoundError($jsonResponse->message, $jsonResponse->traceId); + } + + if ($jsonResponse->name === 'InvalidParameterError') { + throw new InvalidParameterError($jsonResponse->message, $jsonResponse->details, $jsonResponse->traceId); + } + throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), @@ -201,7 +218,7 @@ public function allowGroupsWithHttpInfo($group_names_input = null, string $conte /** * Operation allowGroupsAsync * - * @param \AffinidiTdk\Clients\LoginConfigurationClient\Model\GroupNamesInput $group_names_input List of group names as input (optional) + * @param \AffinidiTdk\Clients\LoginConfigurationClient\Model\GroupNamesInput|null $group_names_input List of group names as input (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['allowGroups'] to see the possible values for this operation * * @throws \InvalidArgumentException @@ -220,7 +237,7 @@ function ($response) { /** * Operation allowGroupsAsyncWithHttpInfo * - * @param \AffinidiTdk\Clients\LoginConfigurationClient\Model\GroupNamesInput $group_names_input List of group names as input (optional) + * @param \AffinidiTdk\Clients\LoginConfigurationClient\Model\GroupNamesInput|null $group_names_input List of group names as input (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['allowGroups'] to see the possible values for this operation * * @throws \InvalidArgumentException @@ -257,7 +274,7 @@ function ($exception) { /** * Create request for operation 'allowGroups' * - * @param \AffinidiTdk\Clients\LoginConfigurationClient\Model\GroupNamesInput $group_names_input List of group names as input (optional) + * @param \AffinidiTdk\Clients\LoginConfigurationClient\Model\GroupNamesInput|null $group_names_input List of group names as input (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['allowGroups'] to see the possible values for this operation * * @throws \InvalidArgumentException @@ -347,7 +364,7 @@ public function allowGroupsRequest($group_names_input = null, string $contentTyp /** * Operation disallowGroups * - * @param \AffinidiTdk\Clients\LoginConfigurationClient\Model\GroupNamesInput $group_names_input List of group names as input (optional) + * @param \AffinidiTdk\Clients\LoginConfigurationClient\Model\GroupNamesInput|null $group_names_input List of group names as input (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['disallowGroups'] to see the possible values for this operation * * @throws \AffinidiTdk\Clients\LoginConfigurationClient\ApiException on non-2xx response or if the response body is not in the expected format @@ -362,7 +379,7 @@ public function disallowGroups($group_names_input = null, string $contentType = /** * Operation disallowGroupsWithHttpInfo * - * @param \AffinidiTdk\Clients\LoginConfigurationClient\Model\GroupNamesInput $group_names_input List of group names as input (optional) + * @param \AffinidiTdk\Clients\LoginConfigurationClient\Model\GroupNamesInput|null $group_names_input List of group names as input (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['disallowGroups'] to see the possible values for this operation * * @throws \AffinidiTdk\Clients\LoginConfigurationClient\ApiException on non-2xx response or if the response body is not in the expected format @@ -378,6 +395,20 @@ public function disallowGroupsWithHttpInfo($group_names_input = null, string $co try { $response = $this->client->send($request, $options); } catch (RequestException $e) { + $jsonResponse = json_decode($e->getResponse()->getBody()); + if ($jsonResponse->name === 'InvalidJwtTokenError') { + $issue = $jsonResponse->details[0]->issue; + throw new InvalidJwtTokenError($issue, $jsonResponse->traceId); + } + + if ($jsonResponse->name === 'NotFoundError') { + throw new NotFoundError($jsonResponse->message, $jsonResponse->traceId); + } + + if ($jsonResponse->name === 'InvalidParameterError') { + throw new InvalidParameterError($jsonResponse->message, $jsonResponse->details, $jsonResponse->traceId); + } + throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), @@ -416,7 +447,7 @@ public function disallowGroupsWithHttpInfo($group_names_input = null, string $co /** * Operation disallowGroupsAsync * - * @param \AffinidiTdk\Clients\LoginConfigurationClient\Model\GroupNamesInput $group_names_input List of group names as input (optional) + * @param \AffinidiTdk\Clients\LoginConfigurationClient\Model\GroupNamesInput|null $group_names_input List of group names as input (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['disallowGroups'] to see the possible values for this operation * * @throws \InvalidArgumentException @@ -435,7 +466,7 @@ function ($response) { /** * Operation disallowGroupsAsyncWithHttpInfo * - * @param \AffinidiTdk\Clients\LoginConfigurationClient\Model\GroupNamesInput $group_names_input List of group names as input (optional) + * @param \AffinidiTdk\Clients\LoginConfigurationClient\Model\GroupNamesInput|null $group_names_input List of group names as input (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['disallowGroups'] to see the possible values for this operation * * @throws \InvalidArgumentException @@ -472,7 +503,7 @@ function ($exception) { /** * Create request for operation 'disallowGroups' * - * @param \AffinidiTdk\Clients\LoginConfigurationClient\Model\GroupNamesInput $group_names_input List of group names as input (optional) + * @param \AffinidiTdk\Clients\LoginConfigurationClient\Model\GroupNamesInput|null $group_names_input List of group names as input (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['disallowGroups'] to see the possible values for this operation * * @throws \InvalidArgumentException @@ -562,7 +593,7 @@ public function disallowGroupsRequest($group_names_input = null, string $content /** * Operation listAllowedGroups * - * @param string $page_token page_token (optional) + * @param string|null $page_token page_token (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['listAllowedGroups'] to see the possible values for this operation * * @throws \AffinidiTdk\Clients\LoginConfigurationClient\ApiException on non-2xx response or if the response body is not in the expected format @@ -578,7 +609,7 @@ public function listAllowedGroups($page_token = null, string $contentType = self /** * Operation listAllowedGroupsWithHttpInfo * - * @param string $page_token (optional) + * @param string|null $page_token (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['listAllowedGroups'] to see the possible values for this operation * * @throws \AffinidiTdk\Clients\LoginConfigurationClient\ApiException on non-2xx response or if the response body is not in the expected format @@ -594,6 +625,20 @@ public function listAllowedGroupsWithHttpInfo($page_token = null, string $conten try { $response = $this->client->send($request, $options); } catch (RequestException $e) { + $jsonResponse = json_decode($e->getResponse()->getBody()); + if ($jsonResponse->name === 'InvalidJwtTokenError') { + $issue = $jsonResponse->details[0]->issue; + throw new InvalidJwtTokenError($issue, $jsonResponse->traceId); + } + + if ($jsonResponse->name === 'NotFoundError') { + throw new NotFoundError($jsonResponse->message, $jsonResponse->traceId); + } + + if ($jsonResponse->name === 'InvalidParameterError') { + throw new InvalidParameterError($jsonResponse->message, $jsonResponse->details, $jsonResponse->traceId); + } + throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), @@ -701,7 +746,7 @@ public function listAllowedGroupsWithHttpInfo($page_token = null, string $conten /** * Operation listAllowedGroupsAsync * - * @param string $page_token (optional) + * @param string|null $page_token (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['listAllowedGroups'] to see the possible values for this operation * * @throws \InvalidArgumentException @@ -720,7 +765,7 @@ function ($response) { /** * Operation listAllowedGroupsAsyncWithHttpInfo * - * @param string $page_token (optional) + * @param string|null $page_token (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['listAllowedGroups'] to see the possible values for this operation * * @throws \InvalidArgumentException @@ -770,7 +815,7 @@ function ($exception) { /** * Create request for operation 'listAllowedGroups' * - * @param string $page_token (optional) + * @param string|null $page_token (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['listAllowedGroups'] to see the possible values for this operation * * @throws \InvalidArgumentException diff --git a/src/Clients/LoginConfigurationClient/lib/Api/ConfigurationApi.php b/src/Clients/LoginConfigurationClient/lib/Api/ConfigurationApi.php index 1238cb2..de1adf6 100644 --- a/src/Clients/LoginConfigurationClient/lib/Api/ConfigurationApi.php +++ b/src/Clients/LoginConfigurationClient/lib/Api/ConfigurationApi.php @@ -36,6 +36,9 @@ use GuzzleHttp\Psr7\Request; use GuzzleHttp\RequestOptions; use AffinidiTdk\Clients\LoginConfigurationClient\ApiException; +use AffinidiTdk\Clients\LoginConfigurationClient\InvalidJwtTokenError; +use AffinidiTdk\Clients\LoginConfigurationClient\InvalidParameterError; +use AffinidiTdk\Clients\LoginConfigurationClient\NotFoundError; use AffinidiTdk\Clients\LoginConfigurationClient\Configuration; use AffinidiTdk\Clients\LoginConfigurationClient\HeaderSelector; use AffinidiTdk\Clients\LoginConfigurationClient\ObjectSerializer; @@ -99,10 +102,10 @@ class ConfigurationApi * @param int $hostIndex (Optional) host index to select the list of hosts if defined in the OpenAPI spec */ public function __construct( - ClientInterface $client = null, - Configuration $config = null, - HeaderSelector $selector = null, - $hostIndex = 0 + ?ClientInterface $client = null, + ?Configuration $config = null, + ?HeaderSelector $selector = null, + int $hostIndex = 0 ) { $this->client = $client ?: new Client(); $this->config = $config ?: Configuration::getDefaultConfiguration(); @@ -143,7 +146,7 @@ public function getConfig() * * Create a new login configuration * - * @param \AffinidiTdk\Clients\LoginConfigurationClient\Model\CreateLoginConfigurationInput $create_login_configuration_input CreateLoginConfigurations (optional) + * @param \AffinidiTdk\Clients\LoginConfigurationClient\Model\CreateLoginConfigurationInput|null $create_login_configuration_input CreateLoginConfigurations (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createLoginConfigurations'] to see the possible values for this operation * * @throws \AffinidiTdk\Clients\LoginConfigurationClient\ApiException on non-2xx response or if the response body is not in the expected format @@ -161,7 +164,7 @@ public function createLoginConfigurations($create_login_configuration_input = nu * * Create a new login configuration * - * @param \AffinidiTdk\Clients\LoginConfigurationClient\Model\CreateLoginConfigurationInput $create_login_configuration_input CreateLoginConfigurations (optional) + * @param \AffinidiTdk\Clients\LoginConfigurationClient\Model\CreateLoginConfigurationInput|null $create_login_configuration_input CreateLoginConfigurations (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createLoginConfigurations'] to see the possible values for this operation * * @throws \AffinidiTdk\Clients\LoginConfigurationClient\ApiException on non-2xx response or if the response body is not in the expected format @@ -177,6 +180,20 @@ public function createLoginConfigurationsWithHttpInfo($create_login_configuratio try { $response = $this->client->send($request, $options); } catch (RequestException $e) { + $jsonResponse = json_decode($e->getResponse()->getBody()); + if ($jsonResponse->name === 'InvalidJwtTokenError') { + $issue = $jsonResponse->details[0]->issue; + throw new InvalidJwtTokenError($issue, $jsonResponse->traceId); + } + + if ($jsonResponse->name === 'NotFoundError') { + throw new NotFoundError($jsonResponse->message, $jsonResponse->traceId); + } + + if ($jsonResponse->name === 'InvalidParameterError') { + throw new InvalidParameterError($jsonResponse->message, $jsonResponse->details, $jsonResponse->traceId); + } + throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), @@ -391,7 +408,7 @@ public function createLoginConfigurationsWithHttpInfo($create_login_configuratio * * Create a new login configuration * - * @param \AffinidiTdk\Clients\LoginConfigurationClient\Model\CreateLoginConfigurationInput $create_login_configuration_input CreateLoginConfigurations (optional) + * @param \AffinidiTdk\Clients\LoginConfigurationClient\Model\CreateLoginConfigurationInput|null $create_login_configuration_input CreateLoginConfigurations (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createLoginConfigurations'] to see the possible values for this operation * * @throws \InvalidArgumentException @@ -412,7 +429,7 @@ function ($response) { * * Create a new login configuration * - * @param \AffinidiTdk\Clients\LoginConfigurationClient\Model\CreateLoginConfigurationInput $create_login_configuration_input CreateLoginConfigurations (optional) + * @param \AffinidiTdk\Clients\LoginConfigurationClient\Model\CreateLoginConfigurationInput|null $create_login_configuration_input CreateLoginConfigurations (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createLoginConfigurations'] to see the possible values for this operation * * @throws \InvalidArgumentException @@ -462,7 +479,7 @@ function ($exception) { /** * Create request for operation 'createLoginConfigurations' * - * @param \AffinidiTdk\Clients\LoginConfigurationClient\Model\CreateLoginConfigurationInput $create_login_configuration_input CreateLoginConfigurations (optional) + * @param \AffinidiTdk\Clients\LoginConfigurationClient\Model\CreateLoginConfigurationInput|null $create_login_configuration_input CreateLoginConfigurations (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createLoginConfigurations'] to see the possible values for this operation * * @throws \InvalidArgumentException @@ -587,6 +604,20 @@ public function deleteLoginConfigurationsByIdWithHttpInfo($configuration_id, str try { $response = $this->client->send($request, $options); } catch (RequestException $e) { + $jsonResponse = json_decode($e->getResponse()->getBody()); + if ($jsonResponse->name === 'InvalidJwtTokenError') { + $issue = $jsonResponse->details[0]->issue; + throw new InvalidJwtTokenError($issue, $jsonResponse->traceId); + } + + if ($jsonResponse->name === 'NotFoundError') { + throw new NotFoundError($jsonResponse->message, $jsonResponse->traceId); + } + + if ($jsonResponse->name === 'InvalidParameterError') { + throw new InvalidParameterError($jsonResponse->message, $jsonResponse->details, $jsonResponse->traceId); + } + throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), @@ -826,6 +857,20 @@ public function getClientMetadataByClientIdWithHttpInfo($client_id, string $cont try { $response = $this->client->send($request, $options); } catch (RequestException $e) { + $jsonResponse = json_decode($e->getResponse()->getBody()); + if ($jsonResponse->name === 'InvalidJwtTokenError') { + $issue = $jsonResponse->details[0]->issue; + throw new InvalidJwtTokenError($issue, $jsonResponse->traceId); + } + + if ($jsonResponse->name === 'NotFoundError') { + throw new NotFoundError($jsonResponse->message, $jsonResponse->traceId); + } + + if ($jsonResponse->name === 'InvalidParameterError') { + throw new InvalidParameterError($jsonResponse->message, $jsonResponse->details, $jsonResponse->traceId); + } + throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), @@ -1204,6 +1249,20 @@ public function getLoginConfigurationsByIdWithHttpInfo($configuration_id, string try { $response = $this->client->send($request, $options); } catch (RequestException $e) { + $jsonResponse = json_decode($e->getResponse()->getBody()); + if ($jsonResponse->name === 'InvalidJwtTokenError') { + $issue = $jsonResponse->details[0]->issue; + throw new InvalidJwtTokenError($issue, $jsonResponse->traceId); + } + + if ($jsonResponse->name === 'NotFoundError') { + throw new NotFoundError($jsonResponse->message, $jsonResponse->traceId); + } + + if ($jsonResponse->name === 'InvalidParameterError') { + throw new InvalidParameterError($jsonResponse->message, $jsonResponse->details, $jsonResponse->traceId); + } + throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), @@ -1553,8 +1612,8 @@ public function getLoginConfigurationsByIdRequest($configuration_id, string $con * * List login configurations * - * @param int $limit Maximum number of records to fetch in a list (optional) - * @param string $exclusive_start_key The base64url encoded key of the first item that this operation will evaluate (it is not returned). Use the value that was returned in the previous operation. (optional) + * @param int|null $limit Maximum number of records to fetch in a list (optional) + * @param string|null $exclusive_start_key The base64url encoded key of the first item that this operation will evaluate (it is not returned). Use the value that was returned in the previous operation. (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['listLoginConfigurations'] to see the possible values for this operation * * @throws \AffinidiTdk\Clients\LoginConfigurationClient\ApiException on non-2xx response or if the response body is not in the expected format @@ -1572,8 +1631,8 @@ public function listLoginConfigurations($limit = null, $exclusive_start_key = nu * * List login configurations * - * @param int $limit Maximum number of records to fetch in a list (optional) - * @param string $exclusive_start_key The base64url encoded key of the first item that this operation will evaluate (it is not returned). Use the value that was returned in the previous operation. (optional) + * @param int|null $limit Maximum number of records to fetch in a list (optional) + * @param string|null $exclusive_start_key The base64url encoded key of the first item that this operation will evaluate (it is not returned). Use the value that was returned in the previous operation. (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['listLoginConfigurations'] to see the possible values for this operation * * @throws \AffinidiTdk\Clients\LoginConfigurationClient\ApiException on non-2xx response or if the response body is not in the expected format @@ -1589,6 +1648,20 @@ public function listLoginConfigurationsWithHttpInfo($limit = null, $exclusive_st try { $response = $this->client->send($request, $options); } catch (RequestException $e) { + $jsonResponse = json_decode($e->getResponse()->getBody()); + if ($jsonResponse->name === 'InvalidJwtTokenError') { + $issue = $jsonResponse->details[0]->issue; + throw new InvalidJwtTokenError($issue, $jsonResponse->traceId); + } + + if ($jsonResponse->name === 'NotFoundError') { + throw new NotFoundError($jsonResponse->message, $jsonResponse->traceId); + } + + if ($jsonResponse->name === 'InvalidParameterError') { + throw new InvalidParameterError($jsonResponse->message, $jsonResponse->details, $jsonResponse->traceId); + } + throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), @@ -1768,8 +1841,8 @@ public function listLoginConfigurationsWithHttpInfo($limit = null, $exclusive_st * * List login configurations * - * @param int $limit Maximum number of records to fetch in a list (optional) - * @param string $exclusive_start_key The base64url encoded key of the first item that this operation will evaluate (it is not returned). Use the value that was returned in the previous operation. (optional) + * @param int|null $limit Maximum number of records to fetch in a list (optional) + * @param string|null $exclusive_start_key The base64url encoded key of the first item that this operation will evaluate (it is not returned). Use the value that was returned in the previous operation. (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['listLoginConfigurations'] to see the possible values for this operation * * @throws \InvalidArgumentException @@ -1790,8 +1863,8 @@ function ($response) { * * List login configurations * - * @param int $limit Maximum number of records to fetch in a list (optional) - * @param string $exclusive_start_key The base64url encoded key of the first item that this operation will evaluate (it is not returned). Use the value that was returned in the previous operation. (optional) + * @param int|null $limit Maximum number of records to fetch in a list (optional) + * @param string|null $exclusive_start_key The base64url encoded key of the first item that this operation will evaluate (it is not returned). Use the value that was returned in the previous operation. (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['listLoginConfigurations'] to see the possible values for this operation * * @throws \InvalidArgumentException @@ -1841,8 +1914,8 @@ function ($exception) { /** * Create request for operation 'listLoginConfigurations' * - * @param int $limit Maximum number of records to fetch in a list (optional) - * @param string $exclusive_start_key The base64url encoded key of the first item that this operation will evaluate (it is not returned). Use the value that was returned in the previous operation. (optional) + * @param int|null $limit Maximum number of records to fetch in a list (optional) + * @param string|null $exclusive_start_key The base64url encoded key of the first item that this operation will evaluate (it is not returned). Use the value that was returned in the previous operation. (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['listLoginConfigurations'] to see the possible values for this operation * * @throws \InvalidArgumentException @@ -1956,7 +2029,7 @@ public function listLoginConfigurationsRequest($limit = null, $exclusive_start_k * Update login configurations by ID * * @param string $configuration_id The id of the login configuration (required) - * @param \AffinidiTdk\Clients\LoginConfigurationClient\Model\UpdateLoginConfigurationInput $update_login_configuration_input UpdateLoginConfigurationsById (optional) + * @param \AffinidiTdk\Clients\LoginConfigurationClient\Model\UpdateLoginConfigurationInput|null $update_login_configuration_input UpdateLoginConfigurationsById (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['updateLoginConfigurationsById'] to see the possible values for this operation * * @throws \AffinidiTdk\Clients\LoginConfigurationClient\ApiException on non-2xx response or if the response body is not in the expected format @@ -1975,7 +2048,7 @@ public function updateLoginConfigurationsById($configuration_id, $update_login_c * Update login configurations by ID * * @param string $configuration_id The id of the login configuration (required) - * @param \AffinidiTdk\Clients\LoginConfigurationClient\Model\UpdateLoginConfigurationInput $update_login_configuration_input UpdateLoginConfigurationsById (optional) + * @param \AffinidiTdk\Clients\LoginConfigurationClient\Model\UpdateLoginConfigurationInput|null $update_login_configuration_input UpdateLoginConfigurationsById (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['updateLoginConfigurationsById'] to see the possible values for this operation * * @throws \AffinidiTdk\Clients\LoginConfigurationClient\ApiException on non-2xx response or if the response body is not in the expected format @@ -1991,6 +2064,20 @@ public function updateLoginConfigurationsByIdWithHttpInfo($configuration_id, $up try { $response = $this->client->send($request, $options); } catch (RequestException $e) { + $jsonResponse = json_decode($e->getResponse()->getBody()); + if ($jsonResponse->name === 'InvalidJwtTokenError') { + $issue = $jsonResponse->details[0]->issue; + throw new InvalidJwtTokenError($issue, $jsonResponse->traceId); + } + + if ($jsonResponse->name === 'NotFoundError') { + throw new NotFoundError($jsonResponse->message, $jsonResponse->traceId); + } + + if ($jsonResponse->name === 'InvalidParameterError') { + throw new InvalidParameterError($jsonResponse->message, $jsonResponse->details, $jsonResponse->traceId); + } + throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), @@ -2171,7 +2258,7 @@ public function updateLoginConfigurationsByIdWithHttpInfo($configuration_id, $up * Update login configurations by ID * * @param string $configuration_id The id of the login configuration (required) - * @param \AffinidiTdk\Clients\LoginConfigurationClient\Model\UpdateLoginConfigurationInput $update_login_configuration_input UpdateLoginConfigurationsById (optional) + * @param \AffinidiTdk\Clients\LoginConfigurationClient\Model\UpdateLoginConfigurationInput|null $update_login_configuration_input UpdateLoginConfigurationsById (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['updateLoginConfigurationsById'] to see the possible values for this operation * * @throws \InvalidArgumentException @@ -2193,7 +2280,7 @@ function ($response) { * Update login configurations by ID * * @param string $configuration_id The id of the login configuration (required) - * @param \AffinidiTdk\Clients\LoginConfigurationClient\Model\UpdateLoginConfigurationInput $update_login_configuration_input UpdateLoginConfigurationsById (optional) + * @param \AffinidiTdk\Clients\LoginConfigurationClient\Model\UpdateLoginConfigurationInput|null $update_login_configuration_input UpdateLoginConfigurationsById (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['updateLoginConfigurationsById'] to see the possible values for this operation * * @throws \InvalidArgumentException @@ -2244,7 +2331,7 @@ function ($exception) { * Create request for operation 'updateLoginConfigurationsById' * * @param string $configuration_id The id of the login configuration (required) - * @param \AffinidiTdk\Clients\LoginConfigurationClient\Model\UpdateLoginConfigurationInput $update_login_configuration_input UpdateLoginConfigurationsById (optional) + * @param \AffinidiTdk\Clients\LoginConfigurationClient\Model\UpdateLoginConfigurationInput|null $update_login_configuration_input UpdateLoginConfigurationsById (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['updateLoginConfigurationsById'] to see the possible values for this operation * * @throws \InvalidArgumentException diff --git a/src/Clients/LoginConfigurationClient/lib/Api/DenyListApi.php b/src/Clients/LoginConfigurationClient/lib/Api/DenyListApi.php index 3e4549a..0f6ca27 100644 --- a/src/Clients/LoginConfigurationClient/lib/Api/DenyListApi.php +++ b/src/Clients/LoginConfigurationClient/lib/Api/DenyListApi.php @@ -36,6 +36,9 @@ use GuzzleHttp\Psr7\Request; use GuzzleHttp\RequestOptions; use AffinidiTdk\Clients\LoginConfigurationClient\ApiException; +use AffinidiTdk\Clients\LoginConfigurationClient\InvalidJwtTokenError; +use AffinidiTdk\Clients\LoginConfigurationClient\InvalidParameterError; +use AffinidiTdk\Clients\LoginConfigurationClient\NotFoundError; use AffinidiTdk\Clients\LoginConfigurationClient\Configuration; use AffinidiTdk\Clients\LoginConfigurationClient\HeaderSelector; use AffinidiTdk\Clients\LoginConfigurationClient\ObjectSerializer; @@ -99,10 +102,10 @@ class DenyListApi * @param int $hostIndex (Optional) host index to select the list of hosts if defined in the OpenAPI spec */ public function __construct( - ClientInterface $client = null, - Configuration $config = null, - HeaderSelector $selector = null, - $hostIndex = 0 + ?ClientInterface $client = null, + ?Configuration $config = null, + ?HeaderSelector $selector = null, + int $hostIndex = 0 ) { $this->client = $client ?: new Client(); $this->config = $config ?: Configuration::getDefaultConfiguration(); @@ -141,7 +144,7 @@ public function getConfig() /** * Operation blockGroups * - * @param \AffinidiTdk\Clients\LoginConfigurationClient\Model\GroupNamesInput $group_names_input List of group names as input (optional) + * @param \AffinidiTdk\Clients\LoginConfigurationClient\Model\GroupNamesInput|null $group_names_input List of group names as input (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['blockGroups'] to see the possible values for this operation * * @throws \AffinidiTdk\Clients\LoginConfigurationClient\ApiException on non-2xx response or if the response body is not in the expected format @@ -156,7 +159,7 @@ public function blockGroups($group_names_input = null, string $contentType = sel /** * Operation blockGroupsWithHttpInfo * - * @param \AffinidiTdk\Clients\LoginConfigurationClient\Model\GroupNamesInput $group_names_input List of group names as input (optional) + * @param \AffinidiTdk\Clients\LoginConfigurationClient\Model\GroupNamesInput|null $group_names_input List of group names as input (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['blockGroups'] to see the possible values for this operation * * @throws \AffinidiTdk\Clients\LoginConfigurationClient\ApiException on non-2xx response or if the response body is not in the expected format @@ -172,6 +175,20 @@ public function blockGroupsWithHttpInfo($group_names_input = null, string $conte try { $response = $this->client->send($request, $options); } catch (RequestException $e) { + $jsonResponse = json_decode($e->getResponse()->getBody()); + if ($jsonResponse->name === 'InvalidJwtTokenError') { + $issue = $jsonResponse->details[0]->issue; + throw new InvalidJwtTokenError($issue, $jsonResponse->traceId); + } + + if ($jsonResponse->name === 'NotFoundError') { + throw new NotFoundError($jsonResponse->message, $jsonResponse->traceId); + } + + if ($jsonResponse->name === 'InvalidParameterError') { + throw new InvalidParameterError($jsonResponse->message, $jsonResponse->details, $jsonResponse->traceId); + } + throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), @@ -210,7 +227,7 @@ public function blockGroupsWithHttpInfo($group_names_input = null, string $conte /** * Operation blockGroupsAsync * - * @param \AffinidiTdk\Clients\LoginConfigurationClient\Model\GroupNamesInput $group_names_input List of group names as input (optional) + * @param \AffinidiTdk\Clients\LoginConfigurationClient\Model\GroupNamesInput|null $group_names_input List of group names as input (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['blockGroups'] to see the possible values for this operation * * @throws \InvalidArgumentException @@ -229,7 +246,7 @@ function ($response) { /** * Operation blockGroupsAsyncWithHttpInfo * - * @param \AffinidiTdk\Clients\LoginConfigurationClient\Model\GroupNamesInput $group_names_input List of group names as input (optional) + * @param \AffinidiTdk\Clients\LoginConfigurationClient\Model\GroupNamesInput|null $group_names_input List of group names as input (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['blockGroups'] to see the possible values for this operation * * @throws \InvalidArgumentException @@ -266,7 +283,7 @@ function ($exception) { /** * Create request for operation 'blockGroups' * - * @param \AffinidiTdk\Clients\LoginConfigurationClient\Model\GroupNamesInput $group_names_input List of group names as input (optional) + * @param \AffinidiTdk\Clients\LoginConfigurationClient\Model\GroupNamesInput|null $group_names_input List of group names as input (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['blockGroups'] to see the possible values for this operation * * @throws \InvalidArgumentException @@ -356,7 +373,7 @@ public function blockGroupsRequest($group_names_input = null, string $contentTyp /** * Operation blockUsers * - * @param \AffinidiTdk\Clients\LoginConfigurationClient\Model\BlockedUsersInput $blocked_users_input List of blocked users as input (optional) + * @param \AffinidiTdk\Clients\LoginConfigurationClient\Model\BlockedUsersInput|null $blocked_users_input List of blocked users as input (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['blockUsers'] to see the possible values for this operation * * @throws \AffinidiTdk\Clients\LoginConfigurationClient\ApiException on non-2xx response or if the response body is not in the expected format @@ -371,7 +388,7 @@ public function blockUsers($blocked_users_input = null, string $contentType = se /** * Operation blockUsersWithHttpInfo * - * @param \AffinidiTdk\Clients\LoginConfigurationClient\Model\BlockedUsersInput $blocked_users_input List of blocked users as input (optional) + * @param \AffinidiTdk\Clients\LoginConfigurationClient\Model\BlockedUsersInput|null $blocked_users_input List of blocked users as input (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['blockUsers'] to see the possible values for this operation * * @throws \AffinidiTdk\Clients\LoginConfigurationClient\ApiException on non-2xx response or if the response body is not in the expected format @@ -387,6 +404,20 @@ public function blockUsersWithHttpInfo($blocked_users_input = null, string $cont try { $response = $this->client->send($request, $options); } catch (RequestException $e) { + $jsonResponse = json_decode($e->getResponse()->getBody()); + if ($jsonResponse->name === 'InvalidJwtTokenError') { + $issue = $jsonResponse->details[0]->issue; + throw new InvalidJwtTokenError($issue, $jsonResponse->traceId); + } + + if ($jsonResponse->name === 'NotFoundError') { + throw new NotFoundError($jsonResponse->message, $jsonResponse->traceId); + } + + if ($jsonResponse->name === 'InvalidParameterError') { + throw new InvalidParameterError($jsonResponse->message, $jsonResponse->details, $jsonResponse->traceId); + } + throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), @@ -417,7 +448,7 @@ public function blockUsersWithHttpInfo($blocked_users_input = null, string $cont /** * Operation blockUsersAsync * - * @param \AffinidiTdk\Clients\LoginConfigurationClient\Model\BlockedUsersInput $blocked_users_input List of blocked users as input (optional) + * @param \AffinidiTdk\Clients\LoginConfigurationClient\Model\BlockedUsersInput|null $blocked_users_input List of blocked users as input (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['blockUsers'] to see the possible values for this operation * * @throws \InvalidArgumentException @@ -436,7 +467,7 @@ function ($response) { /** * Operation blockUsersAsyncWithHttpInfo * - * @param \AffinidiTdk\Clients\LoginConfigurationClient\Model\BlockedUsersInput $blocked_users_input List of blocked users as input (optional) + * @param \AffinidiTdk\Clients\LoginConfigurationClient\Model\BlockedUsersInput|null $blocked_users_input List of blocked users as input (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['blockUsers'] to see the possible values for this operation * * @throws \InvalidArgumentException @@ -473,7 +504,7 @@ function ($exception) { /** * Create request for operation 'blockUsers' * - * @param \AffinidiTdk\Clients\LoginConfigurationClient\Model\BlockedUsersInput $blocked_users_input List of blocked users as input (optional) + * @param \AffinidiTdk\Clients\LoginConfigurationClient\Model\BlockedUsersInput|null $blocked_users_input List of blocked users as input (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['blockUsers'] to see the possible values for this operation * * @throws \InvalidArgumentException @@ -563,7 +594,7 @@ public function blockUsersRequest($blocked_users_input = null, string $contentTy /** * Operation listBlockedGroups * - * @param string $page_token page_token (optional) + * @param string|null $page_token page_token (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['listBlockedGroups'] to see the possible values for this operation * * @throws \AffinidiTdk\Clients\LoginConfigurationClient\ApiException on non-2xx response or if the response body is not in the expected format @@ -579,7 +610,7 @@ public function listBlockedGroups($page_token = null, string $contentType = self /** * Operation listBlockedGroupsWithHttpInfo * - * @param string $page_token (optional) + * @param string|null $page_token (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['listBlockedGroups'] to see the possible values for this operation * * @throws \AffinidiTdk\Clients\LoginConfigurationClient\ApiException on non-2xx response or if the response body is not in the expected format @@ -595,6 +626,20 @@ public function listBlockedGroupsWithHttpInfo($page_token = null, string $conten try { $response = $this->client->send($request, $options); } catch (RequestException $e) { + $jsonResponse = json_decode($e->getResponse()->getBody()); + if ($jsonResponse->name === 'InvalidJwtTokenError') { + $issue = $jsonResponse->details[0]->issue; + throw new InvalidJwtTokenError($issue, $jsonResponse->traceId); + } + + if ($jsonResponse->name === 'NotFoundError') { + throw new NotFoundError($jsonResponse->message, $jsonResponse->traceId); + } + + if ($jsonResponse->name === 'InvalidParameterError') { + throw new InvalidParameterError($jsonResponse->message, $jsonResponse->details, $jsonResponse->traceId); + } + throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), @@ -702,7 +747,7 @@ public function listBlockedGroupsWithHttpInfo($page_token = null, string $conten /** * Operation listBlockedGroupsAsync * - * @param string $page_token (optional) + * @param string|null $page_token (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['listBlockedGroups'] to see the possible values for this operation * * @throws \InvalidArgumentException @@ -721,7 +766,7 @@ function ($response) { /** * Operation listBlockedGroupsAsyncWithHttpInfo * - * @param string $page_token (optional) + * @param string|null $page_token (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['listBlockedGroups'] to see the possible values for this operation * * @throws \InvalidArgumentException @@ -771,7 +816,7 @@ function ($exception) { /** * Create request for operation 'listBlockedGroups' * - * @param string $page_token (optional) + * @param string|null $page_token (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['listBlockedGroups'] to see the possible values for this operation * * @throws \InvalidArgumentException @@ -863,7 +908,7 @@ public function listBlockedGroupsRequest($page_token = null, string $contentType /** * Operation listBlockedUsers * - * @param string $page_token page_token (optional) + * @param string|null $page_token page_token (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['listBlockedUsers'] to see the possible values for this operation * * @throws \AffinidiTdk\Clients\LoginConfigurationClient\ApiException on non-2xx response or if the response body is not in the expected format @@ -879,7 +924,7 @@ public function listBlockedUsers($page_token = null, string $contentType = self: /** * Operation listBlockedUsersWithHttpInfo * - * @param string $page_token (optional) + * @param string|null $page_token (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['listBlockedUsers'] to see the possible values for this operation * * @throws \AffinidiTdk\Clients\LoginConfigurationClient\ApiException on non-2xx response or if the response body is not in the expected format @@ -895,6 +940,20 @@ public function listBlockedUsersWithHttpInfo($page_token = null, string $content try { $response = $this->client->send($request, $options); } catch (RequestException $e) { + $jsonResponse = json_decode($e->getResponse()->getBody()); + if ($jsonResponse->name === 'InvalidJwtTokenError') { + $issue = $jsonResponse->details[0]->issue; + throw new InvalidJwtTokenError($issue, $jsonResponse->traceId); + } + + if ($jsonResponse->name === 'NotFoundError') { + throw new NotFoundError($jsonResponse->message, $jsonResponse->traceId); + } + + if ($jsonResponse->name === 'InvalidParameterError') { + throw new InvalidParameterError($jsonResponse->message, $jsonResponse->details, $jsonResponse->traceId); + } + throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), @@ -1002,7 +1061,7 @@ public function listBlockedUsersWithHttpInfo($page_token = null, string $content /** * Operation listBlockedUsersAsync * - * @param string $page_token (optional) + * @param string|null $page_token (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['listBlockedUsers'] to see the possible values for this operation * * @throws \InvalidArgumentException @@ -1021,7 +1080,7 @@ function ($response) { /** * Operation listBlockedUsersAsyncWithHttpInfo * - * @param string $page_token (optional) + * @param string|null $page_token (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['listBlockedUsers'] to see the possible values for this operation * * @throws \InvalidArgumentException @@ -1071,7 +1130,7 @@ function ($exception) { /** * Create request for operation 'listBlockedUsers' * - * @param string $page_token (optional) + * @param string|null $page_token (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['listBlockedUsers'] to see the possible values for this operation * * @throws \InvalidArgumentException @@ -1163,7 +1222,7 @@ public function listBlockedUsersRequest($page_token = null, string $contentType /** * Operation unblockGroups * - * @param \AffinidiTdk\Clients\LoginConfigurationClient\Model\GroupNamesInput $group_names_input List of group names as input (optional) + * @param \AffinidiTdk\Clients\LoginConfigurationClient\Model\GroupNamesInput|null $group_names_input List of group names as input (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['unblockGroups'] to see the possible values for this operation * * @throws \AffinidiTdk\Clients\LoginConfigurationClient\ApiException on non-2xx response or if the response body is not in the expected format @@ -1178,7 +1237,7 @@ public function unblockGroups($group_names_input = null, string $contentType = s /** * Operation unblockGroupsWithHttpInfo * - * @param \AffinidiTdk\Clients\LoginConfigurationClient\Model\GroupNamesInput $group_names_input List of group names as input (optional) + * @param \AffinidiTdk\Clients\LoginConfigurationClient\Model\GroupNamesInput|null $group_names_input List of group names as input (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['unblockGroups'] to see the possible values for this operation * * @throws \AffinidiTdk\Clients\LoginConfigurationClient\ApiException on non-2xx response or if the response body is not in the expected format @@ -1194,6 +1253,20 @@ public function unblockGroupsWithHttpInfo($group_names_input = null, string $con try { $response = $this->client->send($request, $options); } catch (RequestException $e) { + $jsonResponse = json_decode($e->getResponse()->getBody()); + if ($jsonResponse->name === 'InvalidJwtTokenError') { + $issue = $jsonResponse->details[0]->issue; + throw new InvalidJwtTokenError($issue, $jsonResponse->traceId); + } + + if ($jsonResponse->name === 'NotFoundError') { + throw new NotFoundError($jsonResponse->message, $jsonResponse->traceId); + } + + if ($jsonResponse->name === 'InvalidParameterError') { + throw new InvalidParameterError($jsonResponse->message, $jsonResponse->details, $jsonResponse->traceId); + } + throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), @@ -1232,7 +1305,7 @@ public function unblockGroupsWithHttpInfo($group_names_input = null, string $con /** * Operation unblockGroupsAsync * - * @param \AffinidiTdk\Clients\LoginConfigurationClient\Model\GroupNamesInput $group_names_input List of group names as input (optional) + * @param \AffinidiTdk\Clients\LoginConfigurationClient\Model\GroupNamesInput|null $group_names_input List of group names as input (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['unblockGroups'] to see the possible values for this operation * * @throws \InvalidArgumentException @@ -1251,7 +1324,7 @@ function ($response) { /** * Operation unblockGroupsAsyncWithHttpInfo * - * @param \AffinidiTdk\Clients\LoginConfigurationClient\Model\GroupNamesInput $group_names_input List of group names as input (optional) + * @param \AffinidiTdk\Clients\LoginConfigurationClient\Model\GroupNamesInput|null $group_names_input List of group names as input (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['unblockGroups'] to see the possible values for this operation * * @throws \InvalidArgumentException @@ -1288,7 +1361,7 @@ function ($exception) { /** * Create request for operation 'unblockGroups' * - * @param \AffinidiTdk\Clients\LoginConfigurationClient\Model\GroupNamesInput $group_names_input List of group names as input (optional) + * @param \AffinidiTdk\Clients\LoginConfigurationClient\Model\GroupNamesInput|null $group_names_input List of group names as input (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['unblockGroups'] to see the possible values for this operation * * @throws \InvalidArgumentException @@ -1378,7 +1451,7 @@ public function unblockGroupsRequest($group_names_input = null, string $contentT /** * Operation unblockUsers * - * @param \AffinidiTdk\Clients\LoginConfigurationClient\Model\BlockedUsersInput $blocked_users_input List of blocked users as input (optional) + * @param \AffinidiTdk\Clients\LoginConfigurationClient\Model\BlockedUsersInput|null $blocked_users_input List of blocked users as input (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['unblockUsers'] to see the possible values for this operation * * @throws \AffinidiTdk\Clients\LoginConfigurationClient\ApiException on non-2xx response or if the response body is not in the expected format @@ -1393,7 +1466,7 @@ public function unblockUsers($blocked_users_input = null, string $contentType = /** * Operation unblockUsersWithHttpInfo * - * @param \AffinidiTdk\Clients\LoginConfigurationClient\Model\BlockedUsersInput $blocked_users_input List of blocked users as input (optional) + * @param \AffinidiTdk\Clients\LoginConfigurationClient\Model\BlockedUsersInput|null $blocked_users_input List of blocked users as input (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['unblockUsers'] to see the possible values for this operation * * @throws \AffinidiTdk\Clients\LoginConfigurationClient\ApiException on non-2xx response or if the response body is not in the expected format @@ -1409,6 +1482,20 @@ public function unblockUsersWithHttpInfo($blocked_users_input = null, string $co try { $response = $this->client->send($request, $options); } catch (RequestException $e) { + $jsonResponse = json_decode($e->getResponse()->getBody()); + if ($jsonResponse->name === 'InvalidJwtTokenError') { + $issue = $jsonResponse->details[0]->issue; + throw new InvalidJwtTokenError($issue, $jsonResponse->traceId); + } + + if ($jsonResponse->name === 'NotFoundError') { + throw new NotFoundError($jsonResponse->message, $jsonResponse->traceId); + } + + if ($jsonResponse->name === 'InvalidParameterError') { + throw new InvalidParameterError($jsonResponse->message, $jsonResponse->details, $jsonResponse->traceId); + } + throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), @@ -1439,7 +1526,7 @@ public function unblockUsersWithHttpInfo($blocked_users_input = null, string $co /** * Operation unblockUsersAsync * - * @param \AffinidiTdk\Clients\LoginConfigurationClient\Model\BlockedUsersInput $blocked_users_input List of blocked users as input (optional) + * @param \AffinidiTdk\Clients\LoginConfigurationClient\Model\BlockedUsersInput|null $blocked_users_input List of blocked users as input (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['unblockUsers'] to see the possible values for this operation * * @throws \InvalidArgumentException @@ -1458,7 +1545,7 @@ function ($response) { /** * Operation unblockUsersAsyncWithHttpInfo * - * @param \AffinidiTdk\Clients\LoginConfigurationClient\Model\BlockedUsersInput $blocked_users_input List of blocked users as input (optional) + * @param \AffinidiTdk\Clients\LoginConfigurationClient\Model\BlockedUsersInput|null $blocked_users_input List of blocked users as input (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['unblockUsers'] to see the possible values for this operation * * @throws \InvalidArgumentException @@ -1495,7 +1582,7 @@ function ($exception) { /** * Create request for operation 'unblockUsers' * - * @param \AffinidiTdk\Clients\LoginConfigurationClient\Model\BlockedUsersInput $blocked_users_input List of blocked users as input (optional) + * @param \AffinidiTdk\Clients\LoginConfigurationClient\Model\BlockedUsersInput|null $blocked_users_input List of blocked users as input (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['unblockUsers'] to see the possible values for this operation * * @throws \InvalidArgumentException diff --git a/src/Clients/LoginConfigurationClient/lib/Api/GroupApi.php b/src/Clients/LoginConfigurationClient/lib/Api/GroupApi.php index ba68a7e..e284483 100644 --- a/src/Clients/LoginConfigurationClient/lib/Api/GroupApi.php +++ b/src/Clients/LoginConfigurationClient/lib/Api/GroupApi.php @@ -36,6 +36,9 @@ use GuzzleHttp\Psr7\Request; use GuzzleHttp\RequestOptions; use AffinidiTdk\Clients\LoginConfigurationClient\ApiException; +use AffinidiTdk\Clients\LoginConfigurationClient\InvalidJwtTokenError; +use AffinidiTdk\Clients\LoginConfigurationClient\InvalidParameterError; +use AffinidiTdk\Clients\LoginConfigurationClient\NotFoundError; use AffinidiTdk\Clients\LoginConfigurationClient\Configuration; use AffinidiTdk\Clients\LoginConfigurationClient\HeaderSelector; use AffinidiTdk\Clients\LoginConfigurationClient\ObjectSerializer; @@ -102,10 +105,10 @@ class GroupApi * @param int $hostIndex (Optional) host index to select the list of hosts if defined in the OpenAPI spec */ public function __construct( - ClientInterface $client = null, - Configuration $config = null, - HeaderSelector $selector = null, - $hostIndex = 0 + ?ClientInterface $client = null, + ?Configuration $config = null, + ?HeaderSelector $selector = null, + int $hostIndex = 0 ) { $this->client = $client ?: new Client(); $this->config = $config ?: Configuration::getDefaultConfiguration(); @@ -178,6 +181,20 @@ public function addUserToGroupWithHttpInfo($group_name, $add_user_to_group_input try { $response = $this->client->send($request, $options); } catch (RequestException $e) { + $jsonResponse = json_decode($e->getResponse()->getBody()); + if ($jsonResponse->name === 'InvalidJwtTokenError') { + $issue = $jsonResponse->details[0]->issue; + throw new InvalidJwtTokenError($issue, $jsonResponse->traceId); + } + + if ($jsonResponse->name === 'NotFoundError') { + throw new NotFoundError($jsonResponse->message, $jsonResponse->traceId); + } + + if ($jsonResponse->name === 'InvalidParameterError') { + throw new InvalidParameterError($jsonResponse->message, $jsonResponse->details, $jsonResponse->traceId); + } + throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), @@ -605,6 +622,20 @@ public function createGroupWithHttpInfo($create_group_input, string $contentType try { $response = $this->client->send($request, $options); } catch (RequestException $e) { + $jsonResponse = json_decode($e->getResponse()->getBody()); + if ($jsonResponse->name === 'InvalidJwtTokenError') { + $issue = $jsonResponse->details[0]->issue; + throw new InvalidJwtTokenError($issue, $jsonResponse->traceId); + } + + if ($jsonResponse->name === 'NotFoundError') { + throw new NotFoundError($jsonResponse->message, $jsonResponse->traceId); + } + + if ($jsonResponse->name === 'InvalidParameterError') { + throw new InvalidParameterError($jsonResponse->message, $jsonResponse->details, $jsonResponse->traceId); + } + throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), @@ -1013,6 +1044,20 @@ public function deleteGroupWithHttpInfo($group_name, string $contentType = self: try { $response = $this->client->send($request, $options); } catch (RequestException $e) { + $jsonResponse = json_decode($e->getResponse()->getBody()); + if ($jsonResponse->name === 'InvalidJwtTokenError') { + $issue = $jsonResponse->details[0]->issue; + throw new InvalidJwtTokenError($issue, $jsonResponse->traceId); + } + + if ($jsonResponse->name === 'NotFoundError') { + throw new NotFoundError($jsonResponse->message, $jsonResponse->traceId); + } + + if ($jsonResponse->name === 'InvalidParameterError') { + throw new InvalidParameterError($jsonResponse->message, $jsonResponse->details, $jsonResponse->traceId); + } + throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), @@ -1244,6 +1289,20 @@ public function getGroupByIdWithHttpInfo($group_name, string $contentType = self try { $response = $this->client->send($request, $options); } catch (RequestException $e) { + $jsonResponse = json_decode($e->getResponse()->getBody()); + if ($jsonResponse->name === 'InvalidJwtTokenError') { + $issue = $jsonResponse->details[0]->issue; + throw new InvalidJwtTokenError($issue, $jsonResponse->traceId); + } + + if ($jsonResponse->name === 'NotFoundError') { + throw new NotFoundError($jsonResponse->message, $jsonResponse->traceId); + } + + if ($jsonResponse->name === 'InvalidParameterError') { + throw new InvalidParameterError($jsonResponse->message, $jsonResponse->details, $jsonResponse->traceId); + } + throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), @@ -1623,9 +1682,9 @@ public function getGroupByIdRequest($group_name, string $contentType = self::con * Operation listGroupUserMappings * * @param string $group_name group_name (required) - * @param int $limit Maximum number of records to fetch in a list (optional) - * @param string $exclusive_start_key The base64url encoded key of the first item that this operation will evaluate (it is not returned). Use the value that was returned in the previous operation. (optional) - * @param string $sort_order sort response in specific order. By default it is in desc order (optional) + * @param int|null $limit Maximum number of records to fetch in a list (optional) + * @param string|null $exclusive_start_key The base64url encoded key of the first item that this operation will evaluate (it is not returned). Use the value that was returned in the previous operation. (optional) + * @param string|null $sort_order sort response in specific order. By default it is in desc order (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['listGroupUserMappings'] to see the possible values for this operation * * @throws \AffinidiTdk\Clients\LoginConfigurationClient\ApiException on non-2xx response or if the response body is not in the expected format @@ -1642,9 +1701,9 @@ public function listGroupUserMappings($group_name, $limit = null, $exclusive_sta * Operation listGroupUserMappingsWithHttpInfo * * @param string $group_name (required) - * @param int $limit Maximum number of records to fetch in a list (optional) - * @param string $exclusive_start_key The base64url encoded key of the first item that this operation will evaluate (it is not returned). Use the value that was returned in the previous operation. (optional) - * @param string $sort_order sort response in specific order. By default it is in desc order (optional) + * @param int|null $limit Maximum number of records to fetch in a list (optional) + * @param string|null $exclusive_start_key The base64url encoded key of the first item that this operation will evaluate (it is not returned). Use the value that was returned in the previous operation. (optional) + * @param string|null $sort_order sort response in specific order. By default it is in desc order (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['listGroupUserMappings'] to see the possible values for this operation * * @throws \AffinidiTdk\Clients\LoginConfigurationClient\ApiException on non-2xx response or if the response body is not in the expected format @@ -1660,6 +1719,20 @@ public function listGroupUserMappingsWithHttpInfo($group_name, $limit = null, $e try { $response = $this->client->send($request, $options); } catch (RequestException $e) { + $jsonResponse = json_decode($e->getResponse()->getBody()); + if ($jsonResponse->name === 'InvalidJwtTokenError') { + $issue = $jsonResponse->details[0]->issue; + throw new InvalidJwtTokenError($issue, $jsonResponse->traceId); + } + + if ($jsonResponse->name === 'NotFoundError') { + throw new NotFoundError($jsonResponse->message, $jsonResponse->traceId); + } + + if ($jsonResponse->name === 'InvalidParameterError') { + throw new InvalidParameterError($jsonResponse->message, $jsonResponse->details, $jsonResponse->traceId); + } + throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), @@ -1873,9 +1946,9 @@ public function listGroupUserMappingsWithHttpInfo($group_name, $limit = null, $e * Operation listGroupUserMappingsAsync * * @param string $group_name (required) - * @param int $limit Maximum number of records to fetch in a list (optional) - * @param string $exclusive_start_key The base64url encoded key of the first item that this operation will evaluate (it is not returned). Use the value that was returned in the previous operation. (optional) - * @param string $sort_order sort response in specific order. By default it is in desc order (optional) + * @param int|null $limit Maximum number of records to fetch in a list (optional) + * @param string|null $exclusive_start_key The base64url encoded key of the first item that this operation will evaluate (it is not returned). Use the value that was returned in the previous operation. (optional) + * @param string|null $sort_order sort response in specific order. By default it is in desc order (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['listGroupUserMappings'] to see the possible values for this operation * * @throws \InvalidArgumentException @@ -1895,9 +1968,9 @@ function ($response) { * Operation listGroupUserMappingsAsyncWithHttpInfo * * @param string $group_name (required) - * @param int $limit Maximum number of records to fetch in a list (optional) - * @param string $exclusive_start_key The base64url encoded key of the first item that this operation will evaluate (it is not returned). Use the value that was returned in the previous operation. (optional) - * @param string $sort_order sort response in specific order. By default it is in desc order (optional) + * @param int|null $limit Maximum number of records to fetch in a list (optional) + * @param string|null $exclusive_start_key The base64url encoded key of the first item that this operation will evaluate (it is not returned). Use the value that was returned in the previous operation. (optional) + * @param string|null $sort_order sort response in specific order. By default it is in desc order (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['listGroupUserMappings'] to see the possible values for this operation * * @throws \InvalidArgumentException @@ -1948,9 +2021,9 @@ function ($exception) { * Create request for operation 'listGroupUserMappings' * * @param string $group_name (required) - * @param int $limit Maximum number of records to fetch in a list (optional) - * @param string $exclusive_start_key The base64url encoded key of the first item that this operation will evaluate (it is not returned). Use the value that was returned in the previous operation. (optional) - * @param string $sort_order sort response in specific order. By default it is in desc order (optional) + * @param int|null $limit Maximum number of records to fetch in a list (optional) + * @param string|null $exclusive_start_key The base64url encoded key of the first item that this operation will evaluate (it is not returned). Use the value that was returned in the previous operation. (optional) + * @param string|null $sort_order sort response in specific order. By default it is in desc order (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['listGroupUserMappings'] to see the possible values for this operation * * @throws \InvalidArgumentException @@ -2116,6 +2189,20 @@ public function listGroupsWithHttpInfo(string $contentType = self::contentTypes[ try { $response = $this->client->send($request, $options); } catch (RequestException $e) { + $jsonResponse = json_decode($e->getResponse()->getBody()); + if ($jsonResponse->name === 'InvalidJwtTokenError') { + $issue = $jsonResponse->details[0]->issue; + throw new InvalidJwtTokenError($issue, $jsonResponse->traceId); + } + + if ($jsonResponse->name === 'NotFoundError') { + throw new NotFoundError($jsonResponse->message, $jsonResponse->traceId); + } + + if ($jsonResponse->name === 'InvalidParameterError') { + throw new InvalidParameterError($jsonResponse->message, $jsonResponse->details, $jsonResponse->traceId); + } + throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), @@ -2509,6 +2596,20 @@ public function removeUserFromGroupWithHttpInfo($group_name, $remove_user_from_g try { $response = $this->client->send($request, $options); } catch (RequestException $e) { + $jsonResponse = json_decode($e->getResponse()->getBody()); + if ($jsonResponse->name === 'InvalidJwtTokenError') { + $issue = $jsonResponse->details[0]->issue; + throw new InvalidJwtTokenError($issue, $jsonResponse->traceId); + } + + if ($jsonResponse->name === 'NotFoundError') { + throw new NotFoundError($jsonResponse->message, $jsonResponse->traceId); + } + + if ($jsonResponse->name === 'InvalidParameterError') { + throw new InvalidParameterError($jsonResponse->message, $jsonResponse->details, $jsonResponse->traceId); + } + throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), diff --git a/src/Clients/LoginConfigurationClient/lib/Api/IdpApi.php b/src/Clients/LoginConfigurationClient/lib/Api/IdpApi.php index 1305e85..85f2753 100644 --- a/src/Clients/LoginConfigurationClient/lib/Api/IdpApi.php +++ b/src/Clients/LoginConfigurationClient/lib/Api/IdpApi.php @@ -36,6 +36,9 @@ use GuzzleHttp\Psr7\Request; use GuzzleHttp\RequestOptions; use AffinidiTdk\Clients\LoginConfigurationClient\ApiException; +use AffinidiTdk\Clients\LoginConfigurationClient\InvalidJwtTokenError; +use AffinidiTdk\Clients\LoginConfigurationClient\InvalidParameterError; +use AffinidiTdk\Clients\LoginConfigurationClient\NotFoundError; use AffinidiTdk\Clients\LoginConfigurationClient\Configuration; use AffinidiTdk\Clients\LoginConfigurationClient\HeaderSelector; use AffinidiTdk\Clients\LoginConfigurationClient\ObjectSerializer; @@ -102,10 +105,10 @@ class IdpApi * @param int $hostIndex (Optional) host index to select the list of hosts if defined in the OpenAPI spec */ public function __construct( - ClientInterface $client = null, - Configuration $config = null, - HeaderSelector $selector = null, - $hostIndex = 0 + ?ClientInterface $client = null, + ?Configuration $config = null, + ?HeaderSelector $selector = null, + int $hostIndex = 0 ) { $this->client = $client ?: new Client(); $this->config = $config ?: Configuration::getDefaultConfiguration(); @@ -179,6 +182,20 @@ public function v1LoginProjectProjectIdOauth2AuthGetWithHttpInfo($project_id, st try { $response = $this->client->send($request, $options); } catch (RequestException $e) { + $jsonResponse = json_decode($e->getResponse()->getBody()); + if ($jsonResponse->name === 'InvalidJwtTokenError') { + $issue = $jsonResponse->details[0]->issue; + throw new InvalidJwtTokenError($issue, $jsonResponse->traceId); + } + + if ($jsonResponse->name === 'NotFoundError') { + throw new NotFoundError($jsonResponse->message, $jsonResponse->traceId); + } + + if ($jsonResponse->name === 'InvalidParameterError') { + throw new InvalidParameterError($jsonResponse->message, $jsonResponse->details, $jsonResponse->traceId); + } + throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), @@ -396,6 +413,20 @@ public function v1LoginProjectProjectIdOauth2RevokePostWithHttpInfo($project_id, try { $response = $this->client->send($request, $options); } catch (RequestException $e) { + $jsonResponse = json_decode($e->getResponse()->getBody()); + if ($jsonResponse->name === 'InvalidJwtTokenError') { + $issue = $jsonResponse->details[0]->issue; + throw new InvalidJwtTokenError($issue, $jsonResponse->traceId); + } + + if ($jsonResponse->name === 'NotFoundError') { + throw new NotFoundError($jsonResponse->message, $jsonResponse->traceId); + } + + if ($jsonResponse->name === 'InvalidParameterError') { + throw new InvalidParameterError($jsonResponse->message, $jsonResponse->details, $jsonResponse->traceId); + } + throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), @@ -613,6 +644,20 @@ public function v1LoginProjectProjectIdOauth2SessionsLogoutGetWithHttpInfo($proj try { $response = $this->client->send($request, $options); } catch (RequestException $e) { + $jsonResponse = json_decode($e->getResponse()->getBody()); + if ($jsonResponse->name === 'InvalidJwtTokenError') { + $issue = $jsonResponse->details[0]->issue; + throw new InvalidJwtTokenError($issue, $jsonResponse->traceId); + } + + if ($jsonResponse->name === 'NotFoundError') { + throw new NotFoundError($jsonResponse->message, $jsonResponse->traceId); + } + + if ($jsonResponse->name === 'InvalidParameterError') { + throw new InvalidParameterError($jsonResponse->message, $jsonResponse->details, $jsonResponse->traceId); + } + throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), @@ -831,6 +876,20 @@ public function v1LoginProjectProjectIdOauth2TokenPostWithHttpInfo($project_id, try { $response = $this->client->send($request, $options); } catch (RequestException $e) { + $jsonResponse = json_decode($e->getResponse()->getBody()); + if ($jsonResponse->name === 'InvalidJwtTokenError') { + $issue = $jsonResponse->details[0]->issue; + throw new InvalidJwtTokenError($issue, $jsonResponse->traceId); + } + + if ($jsonResponse->name === 'NotFoundError') { + throw new NotFoundError($jsonResponse->message, $jsonResponse->traceId); + } + + if ($jsonResponse->name === 'InvalidParameterError') { + throw new InvalidParameterError($jsonResponse->message, $jsonResponse->details, $jsonResponse->traceId); + } + throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), @@ -1139,6 +1198,20 @@ public function v1LoginProjectProjectIdUserinfoGetWithHttpInfo($project_id, stri try { $response = $this->client->send($request, $options); } catch (RequestException $e) { + $jsonResponse = json_decode($e->getResponse()->getBody()); + if ($jsonResponse->name === 'InvalidJwtTokenError') { + $issue = $jsonResponse->details[0]->issue; + throw new InvalidJwtTokenError($issue, $jsonResponse->traceId); + } + + if ($jsonResponse->name === 'NotFoundError') { + throw new NotFoundError($jsonResponse->message, $jsonResponse->traceId); + } + + if ($jsonResponse->name === 'InvalidParameterError') { + throw new InvalidParameterError($jsonResponse->message, $jsonResponse->details, $jsonResponse->traceId); + } + throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), @@ -1447,6 +1520,20 @@ public function v1LoginProjectProjectIdWellKnownJwksJsonGetWithHttpInfo($project try { $response = $this->client->send($request, $options); } catch (RequestException $e) { + $jsonResponse = json_decode($e->getResponse()->getBody()); + if ($jsonResponse->name === 'InvalidJwtTokenError') { + $issue = $jsonResponse->details[0]->issue; + throw new InvalidJwtTokenError($issue, $jsonResponse->traceId); + } + + if ($jsonResponse->name === 'NotFoundError') { + throw new NotFoundError($jsonResponse->message, $jsonResponse->traceId); + } + + if ($jsonResponse->name === 'InvalidParameterError') { + throw new InvalidParameterError($jsonResponse->message, $jsonResponse->details, $jsonResponse->traceId); + } + throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), @@ -1755,6 +1842,20 @@ public function v1LoginProjectProjectIdWellKnownOpenidConfigurationGetWithHttpIn try { $response = $this->client->send($request, $options); } catch (RequestException $e) { + $jsonResponse = json_decode($e->getResponse()->getBody()); + if ($jsonResponse->name === 'InvalidJwtTokenError') { + $issue = $jsonResponse->details[0]->issue; + throw new InvalidJwtTokenError($issue, $jsonResponse->traceId); + } + + if ($jsonResponse->name === 'NotFoundError') { + throw new NotFoundError($jsonResponse->message, $jsonResponse->traceId); + } + + if ($jsonResponse->name === 'InvalidParameterError') { + throw new InvalidParameterError($jsonResponse->message, $jsonResponse->details, $jsonResponse->traceId); + } + throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), diff --git a/src/Clients/LoginConfigurationClient/lib/InvalidJwtTokenError.php b/src/Clients/LoginConfigurationClient/lib/InvalidJwtTokenError.php new file mode 100644 index 0000000..2ca415e --- /dev/null +++ b/src/Clients/LoginConfigurationClient/lib/InvalidJwtTokenError.php @@ -0,0 +1,80 @@ + $this->name, + 'message' => $this->message, + 'issue' => $issue, + 'traceId' => $traceId + ]; + + parent::__construct(json_encode($message), 403); + $this->issue = $issue; + $this->traceId = $traceId; + } +} diff --git a/src/Clients/LoginConfigurationClient/lib/InvalidParameterError.php b/src/Clients/LoginConfigurationClient/lib/InvalidParameterError.php new file mode 100644 index 0000000..c89f17b --- /dev/null +++ b/src/Clients/LoginConfigurationClient/lib/InvalidParameterError.php @@ -0,0 +1,75 @@ + $this->name, + 'message' => $message, + 'details' => $details, + 'traceId' => $traceId + ]; + + parent::__construct(json_encode($message), 400); + $this->details = $details; + $this->traceId = $traceId; + } +} diff --git a/src/Clients/LoginConfigurationClient/lib/NotFoundError.php b/src/Clients/LoginConfigurationClient/lib/NotFoundError.php new file mode 100644 index 0000000..adeaebe --- /dev/null +++ b/src/Clients/LoginConfigurationClient/lib/NotFoundError.php @@ -0,0 +1,73 @@ + $this->name, + 'message' => $message, + 'traceId' => $traceId + ]; + + parent::__construct(json_encode($message), 404); + $this->traceId = $traceId; + } +} diff --git a/src/Clients/WalletsClient/.openapi-generator/FILES b/src/Clients/WalletsClient/.openapi-generator/FILES index 2c448a6..705dba4 100644 --- a/src/Clients/WalletsClient/.openapi-generator/FILES +++ b/src/Clients/WalletsClient/.openapi-generator/FILES @@ -35,6 +35,8 @@ lib/Api/WalletApi.php lib/ApiException.php lib/Configuration.php lib/HeaderSelector.php +lib/InvalidJwtTokenError.php +lib/InvalidParameterError.php lib/Model/CreateWalletInput.php lib/Model/CreateWalletResponse.php lib/Model/DidKeyInputParams.php @@ -63,5 +65,6 @@ lib/Model/UpdateWalletInput.php lib/Model/WalletDto.php lib/Model/WalletDtoKeysInner.php lib/Model/WalletsListDto.php +lib/NotFoundError.php lib/ObjectSerializer.php phpunit.xml.dist diff --git a/src/Clients/WalletsClient/lib/Api/RevocationApi.php b/src/Clients/WalletsClient/lib/Api/RevocationApi.php index dcecf86..95976a6 100644 --- a/src/Clients/WalletsClient/lib/Api/RevocationApi.php +++ b/src/Clients/WalletsClient/lib/Api/RevocationApi.php @@ -36,6 +36,9 @@ use GuzzleHttp\Psr7\Request; use GuzzleHttp\RequestOptions; use AffinidiTdk\Clients\WalletsClient\ApiException; +use AffinidiTdk\Clients\WalletsClient\InvalidJwtTokenError; +use AffinidiTdk\Clients\WalletsClient\InvalidParameterError; +use AffinidiTdk\Clients\WalletsClient\NotFoundError; use AffinidiTdk\Clients\WalletsClient\Configuration; use AffinidiTdk\Clients\WalletsClient\HeaderSelector; use AffinidiTdk\Clients\WalletsClient\ObjectSerializer; @@ -90,10 +93,10 @@ class RevocationApi * @param int $hostIndex (Optional) host index to select the list of hosts if defined in the OpenAPI spec */ public function __construct( - ClientInterface $client = null, - Configuration $config = null, - HeaderSelector $selector = null, - $hostIndex = 0 + ?ClientInterface $client = null, + ?Configuration $config = null, + ?HeaderSelector $selector = null, + int $hostIndex = 0 ) { $this->client = $client ?: new Client(); $this->config = $config ?: Configuration::getDefaultConfiguration(); @@ -168,6 +171,20 @@ public function getRevocationCredentialStatusWithHttpInfo($project_id, $wallet_i try { $response = $this->client->send($request, $options); } catch (RequestException $e) { + $jsonResponse = json_decode($e->getResponse()->getBody()); + if ($jsonResponse->name === 'InvalidJwtTokenError') { + $issue = $jsonResponse->details[0]->issue; + throw new InvalidJwtTokenError($issue, $jsonResponse->traceId); + } + + if ($jsonResponse->name === 'NotFoundError') { + throw new NotFoundError($jsonResponse->message, $jsonResponse->traceId); + } + + if ($jsonResponse->name === 'InvalidParameterError') { + throw new InvalidParameterError($jsonResponse->message, $jsonResponse->details, $jsonResponse->traceId); + } + throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), @@ -552,6 +569,20 @@ public function getRevocationListCredentialWithHttpInfo($list_id, $wallet_id, st try { $response = $this->client->send($request, $options); } catch (RequestException $e) { + $jsonResponse = json_decode($e->getResponse()->getBody()); + if ($jsonResponse->name === 'InvalidJwtTokenError') { + $issue = $jsonResponse->details[0]->issue; + throw new InvalidJwtTokenError($issue, $jsonResponse->traceId); + } + + if ($jsonResponse->name === 'NotFoundError') { + throw new NotFoundError($jsonResponse->message, $jsonResponse->traceId); + } + + if ($jsonResponse->name === 'InvalidParameterError') { + throw new InvalidParameterError($jsonResponse->message, $jsonResponse->details, $jsonResponse->traceId); + } + throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), @@ -957,6 +988,20 @@ public function revokeCredentialWithHttpInfo($wallet_id, $revoke_credential_inpu try { $response = $this->client->send($request, $options); } catch (RequestException $e) { + $jsonResponse = json_decode($e->getResponse()->getBody()); + if ($jsonResponse->name === 'InvalidJwtTokenError') { + $issue = $jsonResponse->details[0]->issue; + throw new InvalidJwtTokenError($issue, $jsonResponse->traceId); + } + + if ($jsonResponse->name === 'NotFoundError') { + throw new NotFoundError($jsonResponse->message, $jsonResponse->traceId); + } + + if ($jsonResponse->name === 'InvalidParameterError') { + throw new InvalidParameterError($jsonResponse->message, $jsonResponse->details, $jsonResponse->traceId); + } + throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), diff --git a/src/Clients/WalletsClient/lib/Api/WalletApi.php b/src/Clients/WalletsClient/lib/Api/WalletApi.php index e63a76a..519b1c0 100644 --- a/src/Clients/WalletsClient/lib/Api/WalletApi.php +++ b/src/Clients/WalletsClient/lib/Api/WalletApi.php @@ -36,6 +36,9 @@ use GuzzleHttp\Psr7\Request; use GuzzleHttp\RequestOptions; use AffinidiTdk\Clients\WalletsClient\ApiException; +use AffinidiTdk\Clients\WalletsClient\InvalidJwtTokenError; +use AffinidiTdk\Clients\WalletsClient\InvalidParameterError; +use AffinidiTdk\Clients\WalletsClient\NotFoundError; use AffinidiTdk\Clients\WalletsClient\Configuration; use AffinidiTdk\Clients\WalletsClient\HeaderSelector; use AffinidiTdk\Clients\WalletsClient\ObjectSerializer; @@ -102,10 +105,10 @@ class WalletApi * @param int $hostIndex (Optional) host index to select the list of hosts if defined in the OpenAPI spec */ public function __construct( - ClientInterface $client = null, - Configuration $config = null, - HeaderSelector $selector = null, - $hostIndex = 0 + ?ClientInterface $client = null, + ?Configuration $config = null, + ?HeaderSelector $selector = null, + int $hostIndex = 0 ) { $this->client = $client ?: new Client(); $this->config = $config ?: Configuration::getDefaultConfiguration(); @@ -144,7 +147,7 @@ public function getConfig() /** * Operation createWallet * - * @param \AffinidiTdk\Clients\WalletsClient\Model\CreateWalletInput $create_wallet_input CreateWallet (optional) + * @param \AffinidiTdk\Clients\WalletsClient\Model\CreateWalletInput|null $create_wallet_input CreateWallet (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createWallet'] to see the possible values for this operation * * @throws \AffinidiTdk\Clients\WalletsClient\ApiException on non-2xx response or if the response body is not in the expected format @@ -160,7 +163,7 @@ public function createWallet($create_wallet_input = null, string $contentType = /** * Operation createWalletWithHttpInfo * - * @param \AffinidiTdk\Clients\WalletsClient\Model\CreateWalletInput $create_wallet_input CreateWallet (optional) + * @param \AffinidiTdk\Clients\WalletsClient\Model\CreateWalletInput|null $create_wallet_input CreateWallet (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createWallet'] to see the possible values for this operation * * @throws \AffinidiTdk\Clients\WalletsClient\ApiException on non-2xx response or if the response body is not in the expected format @@ -176,6 +179,20 @@ public function createWalletWithHttpInfo($create_wallet_input = null, string $co try { $response = $this->client->send($request, $options); } catch (RequestException $e) { + $jsonResponse = json_decode($e->getResponse()->getBody()); + if ($jsonResponse->name === 'InvalidJwtTokenError') { + $issue = $jsonResponse->details[0]->issue; + throw new InvalidJwtTokenError($issue, $jsonResponse->traceId); + } + + if ($jsonResponse->name === 'NotFoundError') { + throw new NotFoundError($jsonResponse->message, $jsonResponse->traceId); + } + + if ($jsonResponse->name === 'InvalidParameterError') { + throw new InvalidParameterError($jsonResponse->message, $jsonResponse->details, $jsonResponse->traceId); + } + throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), @@ -318,7 +335,7 @@ public function createWalletWithHttpInfo($create_wallet_input = null, string $co /** * Operation createWalletAsync * - * @param \AffinidiTdk\Clients\WalletsClient\Model\CreateWalletInput $create_wallet_input CreateWallet (optional) + * @param \AffinidiTdk\Clients\WalletsClient\Model\CreateWalletInput|null $create_wallet_input CreateWallet (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createWallet'] to see the possible values for this operation * * @throws \InvalidArgumentException @@ -337,7 +354,7 @@ function ($response) { /** * Operation createWalletAsyncWithHttpInfo * - * @param \AffinidiTdk\Clients\WalletsClient\Model\CreateWalletInput $create_wallet_input CreateWallet (optional) + * @param \AffinidiTdk\Clients\WalletsClient\Model\CreateWalletInput|null $create_wallet_input CreateWallet (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createWallet'] to see the possible values for this operation * * @throws \InvalidArgumentException @@ -387,7 +404,7 @@ function ($exception) { /** * Create request for operation 'createWallet' * - * @param \AffinidiTdk\Clients\WalletsClient\Model\CreateWalletInput $create_wallet_input CreateWallet (optional) + * @param \AffinidiTdk\Clients\WalletsClient\Model\CreateWalletInput|null $create_wallet_input CreateWallet (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createWallet'] to see the possible values for this operation * * @throws \InvalidArgumentException @@ -508,6 +525,20 @@ public function deleteWalletWithHttpInfo($wallet_id, string $contentType = self: try { $response = $this->client->send($request, $options); } catch (RequestException $e) { + $jsonResponse = json_decode($e->getResponse()->getBody()); + if ($jsonResponse->name === 'InvalidJwtTokenError') { + $issue = $jsonResponse->details[0]->issue; + throw new InvalidJwtTokenError($issue, $jsonResponse->traceId); + } + + if ($jsonResponse->name === 'NotFoundError') { + throw new NotFoundError($jsonResponse->message, $jsonResponse->traceId); + } + + if ($jsonResponse->name === 'InvalidParameterError') { + throw new InvalidParameterError($jsonResponse->message, $jsonResponse->details, $jsonResponse->traceId); + } + throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), @@ -723,6 +754,20 @@ public function getWalletWithHttpInfo($wallet_id, string $contentType = self::co try { $response = $this->client->send($request, $options); } catch (RequestException $e) { + $jsonResponse = json_decode($e->getResponse()->getBody()); + if ($jsonResponse->name === 'InvalidJwtTokenError') { + $issue = $jsonResponse->details[0]->issue; + throw new InvalidJwtTokenError($issue, $jsonResponse->traceId); + } + + if ($jsonResponse->name === 'NotFoundError') { + throw new NotFoundError($jsonResponse->message, $jsonResponse->traceId); + } + + if ($jsonResponse->name === 'InvalidParameterError') { + throw new InvalidParameterError($jsonResponse->message, $jsonResponse->details, $jsonResponse->traceId); + } + throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), @@ -1101,7 +1146,7 @@ public function getWalletRequest($wallet_id, string $contentType = self::content /** * Operation listWallets * - * @param string $did_type did_type (optional) + * @param string|null $did_type did_type (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['listWallets'] to see the possible values for this operation * * @throws \AffinidiTdk\Clients\WalletsClient\ApiException on non-2xx response or if the response body is not in the expected format @@ -1117,7 +1162,7 @@ public function listWallets($did_type = null, string $contentType = self::conten /** * Operation listWalletsWithHttpInfo * - * @param string $did_type (optional) + * @param string|null $did_type (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['listWallets'] to see the possible values for this operation * * @throws \AffinidiTdk\Clients\WalletsClient\ApiException on non-2xx response or if the response body is not in the expected format @@ -1133,6 +1178,20 @@ public function listWalletsWithHttpInfo($did_type = null, string $contentType = try { $response = $this->client->send($request, $options); } catch (RequestException $e) { + $jsonResponse = json_decode($e->getResponse()->getBody()); + if ($jsonResponse->name === 'InvalidJwtTokenError') { + $issue = $jsonResponse->details[0]->issue; + throw new InvalidJwtTokenError($issue, $jsonResponse->traceId); + } + + if ($jsonResponse->name === 'NotFoundError') { + throw new NotFoundError($jsonResponse->message, $jsonResponse->traceId); + } + + if ($jsonResponse->name === 'InvalidParameterError') { + throw new InvalidParameterError($jsonResponse->message, $jsonResponse->details, $jsonResponse->traceId); + } + throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), @@ -1310,7 +1369,7 @@ public function listWalletsWithHttpInfo($did_type = null, string $contentType = /** * Operation listWalletsAsync * - * @param string $did_type (optional) + * @param string|null $did_type (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['listWallets'] to see the possible values for this operation * * @throws \InvalidArgumentException @@ -1329,7 +1388,7 @@ function ($response) { /** * Operation listWalletsAsyncWithHttpInfo * - * @param string $did_type (optional) + * @param string|null $did_type (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['listWallets'] to see the possible values for this operation * * @throws \InvalidArgumentException @@ -1379,7 +1438,7 @@ function ($exception) { /** * Create request for operation 'listWallets' * - * @param string $did_type (optional) + * @param string|null $did_type (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['listWallets'] to see the possible values for this operation * * @throws \InvalidArgumentException @@ -1505,6 +1564,20 @@ public function signCredentialWithHttpInfo($wallet_id, $sign_credential_input_dt try { $response = $this->client->send($request, $options); } catch (RequestException $e) { + $jsonResponse = json_decode($e->getResponse()->getBody()); + if ($jsonResponse->name === 'InvalidJwtTokenError') { + $issue = $jsonResponse->details[0]->issue; + throw new InvalidJwtTokenError($issue, $jsonResponse->traceId); + } + + if ($jsonResponse->name === 'NotFoundError') { + throw new NotFoundError($jsonResponse->message, $jsonResponse->traceId); + } + + if ($jsonResponse->name === 'InvalidParameterError') { + throw new InvalidParameterError($jsonResponse->message, $jsonResponse->details, $jsonResponse->traceId); + } + throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), @@ -1934,6 +2007,20 @@ public function signJwtTokenWithHttpInfo($wallet_id, $sign_jwt_token, string $co try { $response = $this->client->send($request, $options); } catch (RequestException $e) { + $jsonResponse = json_decode($e->getResponse()->getBody()); + if ($jsonResponse->name === 'InvalidJwtTokenError') { + $issue = $jsonResponse->details[0]->issue; + throw new InvalidJwtTokenError($issue, $jsonResponse->traceId); + } + + if ($jsonResponse->name === 'NotFoundError') { + throw new NotFoundError($jsonResponse->message, $jsonResponse->traceId); + } + + if ($jsonResponse->name === 'InvalidParameterError') { + throw new InvalidParameterError($jsonResponse->message, $jsonResponse->details, $jsonResponse->traceId); + } + throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), @@ -2363,6 +2450,20 @@ public function updateWalletWithHttpInfo($wallet_id, $update_wallet_input, strin try { $response = $this->client->send($request, $options); } catch (RequestException $e) { + $jsonResponse = json_decode($e->getResponse()->getBody()); + if ($jsonResponse->name === 'InvalidJwtTokenError') { + $issue = $jsonResponse->details[0]->issue; + throw new InvalidJwtTokenError($issue, $jsonResponse->traceId); + } + + if ($jsonResponse->name === 'NotFoundError') { + throw new NotFoundError($jsonResponse->message, $jsonResponse->traceId); + } + + if ($jsonResponse->name === 'InvalidParameterError') { + throw new InvalidParameterError($jsonResponse->message, $jsonResponse->details, $jsonResponse->traceId); + } + throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), diff --git a/src/Clients/WalletsClient/lib/InvalidJwtTokenError.php b/src/Clients/WalletsClient/lib/InvalidJwtTokenError.php new file mode 100644 index 0000000..cccf304 --- /dev/null +++ b/src/Clients/WalletsClient/lib/InvalidJwtTokenError.php @@ -0,0 +1,80 @@ + $this->name, + 'message' => $this->message, + 'issue' => $issue, + 'traceId' => $traceId + ]; + + parent::__construct(json_encode($message), 403); + $this->issue = $issue; + $this->traceId = $traceId; + } +} diff --git a/src/Clients/WalletsClient/lib/InvalidParameterError.php b/src/Clients/WalletsClient/lib/InvalidParameterError.php new file mode 100644 index 0000000..4cfaed0 --- /dev/null +++ b/src/Clients/WalletsClient/lib/InvalidParameterError.php @@ -0,0 +1,75 @@ + $this->name, + 'message' => $message, + 'details' => $details, + 'traceId' => $traceId + ]; + + parent::__construct(json_encode($message), 400); + $this->details = $details; + $this->traceId = $traceId; + } +} diff --git a/src/Clients/WalletsClient/lib/NotFoundError.php b/src/Clients/WalletsClient/lib/NotFoundError.php new file mode 100644 index 0000000..2f7137b --- /dev/null +++ b/src/Clients/WalletsClient/lib/NotFoundError.php @@ -0,0 +1,73 @@ + $this->name, + 'message' => $message, + 'traceId' => $traceId + ]; + + parent::__construct(json_encode($message), 404); + $this->traceId = $traceId; + } +}