Skip to content

Commit

Permalink
feat: update client cis
Browse files Browse the repository at this point in the history
  • Loading branch information
Krushikbhai Jayantibhai Savani committed Dec 18, 2024
1 parent f59edf4 commit 3a9373f
Show file tree
Hide file tree
Showing 13 changed files with 552 additions and 66 deletions.
3 changes: 3 additions & 0 deletions src/Clients/CredentialIssuanceClient/.openapi-generator/FILES
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,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/ActionForbiddenErrorDetailsInner.php
lib/Model/ChangeCredentialStatusInput.php
Expand Down Expand Up @@ -135,5 +137,6 @@ 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
8 changes: 5 additions & 3 deletions src/Clients/CredentialIssuanceClient/docs/Api/DefaultApi.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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;
Expand All @@ -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

Expand All @@ -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)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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)
81 changes: 77 additions & 4 deletions src/Clients/CredentialIssuanceClient/lib/Api/ConfigurationApi.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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();
Expand Down Expand Up @@ -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(),
Expand Down Expand Up @@ -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(),
Expand Down Expand Up @@ -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(),
Expand Down Expand Up @@ -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(),
Expand Down Expand Up @@ -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(),
Expand Down
25 changes: 21 additions & 4 deletions src/Clients/CredentialIssuanceClient/lib/Api/CredentialsApi.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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();
Expand Down Expand Up @@ -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(),
Expand Down
Loading

0 comments on commit 3a9373f

Please sign in to comment.