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 @@ +