diff --git a/.gitignore b/.gitignore index 9f1681c..a1bbba9 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ +.DS_Store # ref: https://github.com/github/gitignore/blob/master/Composer.gitignore composer.phar diff --git a/README.md b/README.md index c10772f..087021e 100644 --- a/README.md +++ b/README.md @@ -19,11 +19,11 @@ To install the bindings via [Composer](https://getcomposer.org/), add the follow "repositories": [ { "type": "vcs", - "url": "https://github.com/mondaycom/monday-code-php-sdk.git" + "url": "https://github.com/GIT_USER_ID/GIT_REPO_ID.git" } ], "require": { - "mondaycom/monday-code-php-sdk": "*@dev" + "GIT_USER_ID/GIT_REPO_ID": "*@dev" } } ``` @@ -50,18 +50,18 @@ require_once(__DIR__ . '/vendor/autoload.php'); -$apiInstance = new OpenAPI\Client\Api\QueueApi( +$apiInstance = new OpenAPI\Client\Api\EnvironmentVariablesApi( // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. // This is optional, `GuzzleHttp\Client` will be used as default. new GuzzleHttp\Client() ); -$publish_message_params = new \OpenAPI\Client\Model\PublishMessageParams(); // \OpenAPI\Client\Model\PublishMessageParams +$name = 'name_example'; // string try { - $result = $apiInstance->publishMessage($publish_message_params); + $result = $apiInstance->getEnvironmentVariable($name); print_r($result); } catch (Exception $e) { - echo 'Exception when calling QueueApi->publishMessage: ', $e->getMessage(), PHP_EOL; + echo 'Exception when calling EnvironmentVariablesApi->getEnvironmentVariable: ', $e->getMessage(), PHP_EOL; } ``` @@ -72,27 +72,37 @@ All URIs are relative to *http://localhost:59999* Class | Method | HTTP request | Description ------------ | ------------- | ------------- | ------------- +*EnvironmentVariablesApi* | [**getEnvironmentVariable**](docs/Api/EnvironmentVariablesApi.md#getenvironmentvariable) | **GET** /environment-variables/{name} | +*EnvironmentVariablesApi* | [**getEnvironmentVariableKeys**](docs/Api/EnvironmentVariablesApi.md#getenvironmentvariablekeys) | **GET** /environment-variables | +*LogsApi* | [**writeLog**](docs/Api/LogsApi.md#writelog) | **POST** /logs | *QueueApi* | [**publishMessage**](docs/Api/QueueApi.md#publishmessage) | **POST** /queue | *QueueApi* | [**validateSecret**](docs/Api/QueueApi.md#validatesecret) | **POST** /queue/validate-secret | -*SecretApi* | [**getSecret**](docs/Api/SecretApi.md#getsecret) | **GET** /secrets/{name} | +*SecretsApi* | [**getSecret**](docs/Api/SecretsApi.md#getsecret) | **GET** /secrets/{name} | +*SecretsApi* | [**getSecretKeys**](docs/Api/SecretsApi.md#getsecretkeys) | **GET** /secrets | *SecureStorageApi* | [**deleteSecureStorage**](docs/Api/SecureStorageApi.md#deletesecurestorage) | **DELETE** /secure-storage/{key} | *SecureStorageApi* | [**getSecureStorage**](docs/Api/SecureStorageApi.md#getsecurestorage) | **GET** /secure-storage/{key} | *SecureStorageApi* | [**putSecureStorage**](docs/Api/SecureStorageApi.md#putsecurestorage) | **PUT** /secure-storage/{key} | -*StorageApi* | [**deleteStorage**](docs/Api/StorageApi.md#deletestorage) | **DELETE** /storage/{key} | -*StorageApi* | [**getStorage**](docs/Api/StorageApi.md#getstorage) | **GET** /storage/{key} | -*StorageApi* | [**putStorage**](docs/Api/StorageApi.md#putstorage) | **PUT** /storage/{key} | -*StorageApi* | [**storageIncrementCounter**](docs/Api/StorageApi.md#storageincrementcounter) | **PUT** /storage/{key}/counter/increment | +*StorageApi* | [**deleteByKeyFromStorage**](docs/Api/StorageApi.md#deletebykeyfromstorage) | **DELETE** /storage/{key} | +*StorageApi* | [**getByKeyFromStorage**](docs/Api/StorageApi.md#getbykeyfromstorage) | **GET** /storage/{key} | +*StorageApi* | [**incrementCounter**](docs/Api/StorageApi.md#incrementcounter) | **PUT** /storage/counter/increment | +*StorageApi* | [**upsertByKeyFromStorage**](docs/Api/StorageApi.md#upsertbykeyfromstorage) | **PUT** /storage/{key} | ## Models -- [GetStorage404Response](docs/Model/GetStorage404Response.md) +- [GetByKeyFromStorage404Response](docs/Model/GetByKeyFromStorage404Response.md) +- [GetByKeyFromStorage500Response](docs/Model/GetByKeyFromStorage500Response.md) - [IncrementCounterParams](docs/Model/IncrementCounterParams.md) +- [JsonValue](docs/Model/JsonValue.md) +- [LogMethods](docs/Model/LogMethods.md) - [Period](docs/Model/Period.md) - [PublishMessageParams](docs/Model/PublishMessageParams.md) - [PublishMessageResponse](docs/Model/PublishMessageResponse.md) +- [SecureStorageDataContract](docs/Model/SecureStorageDataContract.md) - [StorageDataContract](docs/Model/StorageDataContract.md) - [ValidateSecretParams](docs/Model/ValidateSecretParams.md) - [ValidateSecretResponse](docs/Model/ValidateSecretResponse.md) +- [WriteLogRequestBody](docs/Model/WriteLogRequestBody.md) +- [WriteLogRequestBodyError](docs/Model/WriteLogRequestBodyError.md) ## Authorization Endpoints do not require authorization. @@ -115,4 +125,5 @@ vendor/bin/phpunit This PHP package is automatically generated by the [OpenAPI Generator](https://openapi-generator.tech) project: - API version: `0.0.1` + - Generator version: `7.7.0-SNAPSHOT` - Build package: `org.openapitools.codegen.languages.PhpClientCodegen` diff --git a/composer.json b/composer.json index d6b9242..8e70a88 100644 --- a/composer.json +++ b/composer.json @@ -1,5 +1,4 @@ { - "name": "mondaycom/monday-code", "description": "No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)", "keywords": [ "openapitools", diff --git a/docs/Api/EnvironmentVariablesApi.md b/docs/Api/EnvironmentVariablesApi.md new file mode 100644 index 0000000..d17e850 --- /dev/null +++ b/docs/Api/EnvironmentVariablesApi.md @@ -0,0 +1,114 @@ +# OpenAPI\Client\EnvironmentVariablesApi + +All URIs are relative to http://localhost:59999, except if the operation defines another base path. + +| Method | HTTP request | Description | +| ------------- | ------------- | ------------- | +| [**getEnvironmentVariable()**](EnvironmentVariablesApi.md#getEnvironmentVariable) | **GET** /environment-variables/{name} | | +| [**getEnvironmentVariableKeys()**](EnvironmentVariablesApi.md#getEnvironmentVariableKeys) | **GET** /environment-variables | | + + +## `getEnvironmentVariable()` + +```php +getEnvironmentVariable($name): \OpenAPI\Client\Model\JsonValue +``` + + + +### Example + +```php +getEnvironmentVariable($name); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling EnvironmentVariablesApi->getEnvironmentVariable: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **name** | **string**| | | + +### Return type + +[**\OpenAPI\Client\Model\JsonValue**](../Model/JsonValue.md) + +### Authorization + +No authorization required + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: `application/json` + +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) + +## `getEnvironmentVariableKeys()` + +```php +getEnvironmentVariableKeys(): string[] +``` + + + +### Example + +```php +getEnvironmentVariableKeys(); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling EnvironmentVariablesApi->getEnvironmentVariableKeys: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +This endpoint does not need any parameter. + +### Return type + +**string[]** + +### Authorization + +No authorization required + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: `application/json` + +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) diff --git a/docs/Api/SecretApi.md b/docs/Api/LogsApi.md similarity index 57% rename from docs/Api/SecretApi.md rename to docs/Api/LogsApi.md index f8919bc..59e23ba 100644 --- a/docs/Api/SecretApi.md +++ b/docs/Api/LogsApi.md @@ -1,16 +1,16 @@ -# OpenAPI\Client\SecretApi +# OpenAPI\Client\LogsApi All URIs are relative to http://localhost:59999, except if the operation defines another base path. | Method | HTTP request | Description | | ------------- | ------------- | ------------- | -| [**getSecret()**](SecretApi.md#getSecret) | **GET** /secrets/{name} | | +| [**writeLog()**](LogsApi.md#writeLog) | **POST** /logs | | -## `getSecret()` +## `writeLog()` ```php -getSecret($name): string +writeLog($write_log_request_body) ``` @@ -23,18 +23,17 @@ require_once(__DIR__ . '/vendor/autoload.php'); -$apiInstance = new OpenAPI\Client\Api\SecretApi( +$apiInstance = new OpenAPI\Client\Api\LogsApi( // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. // This is optional, `GuzzleHttp\Client` will be used as default. new GuzzleHttp\Client() ); -$name = 'name_example'; // string +$write_log_request_body = new \OpenAPI\Client\Model\WriteLogRequestBody(); // \OpenAPI\Client\Model\WriteLogRequestBody try { - $result = $apiInstance->getSecret($name); - print_r($result); + $apiInstance->writeLog($write_log_request_body); } catch (Exception $e) { - echo 'Exception when calling SecretApi->getSecret: ', $e->getMessage(), PHP_EOL; + echo 'Exception when calling LogsApi->writeLog: ', $e->getMessage(), PHP_EOL; } ``` @@ -42,11 +41,11 @@ try { | Name | Type | Description | Notes | | ------------- | ------------- | ------------- | ------------- | -| **name** | **string**| | | +| **write_log_request_body** | [**\OpenAPI\Client\Model\WriteLogRequestBody**](../Model/WriteLogRequestBody.md)| | | ### Return type -**string** +void (empty response body) ### Authorization @@ -54,8 +53,8 @@ No authorization required ### HTTP request headers -- **Content-Type**: Not defined -- **Accept**: `application/json` +- **Content-Type**: `application/json` +- **Accept**: Not defined [[Back to top]](#) [[Back to API list]](../../README.md#endpoints) [[Back to Model list]](../../README.md#models) diff --git a/docs/Api/SecretsApi.md b/docs/Api/SecretsApi.md new file mode 100644 index 0000000..364350b --- /dev/null +++ b/docs/Api/SecretsApi.md @@ -0,0 +1,114 @@ +# OpenAPI\Client\SecretsApi + +All URIs are relative to http://localhost:59999, except if the operation defines another base path. + +| Method | HTTP request | Description | +| ------------- | ------------- | ------------- | +| [**getSecret()**](SecretsApi.md#getSecret) | **GET** /secrets/{name} | | +| [**getSecretKeys()**](SecretsApi.md#getSecretKeys) | **GET** /secrets | | + + +## `getSecret()` + +```php +getSecret($name): string +``` + + + +### Example + +```php +getSecret($name); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling SecretsApi->getSecret: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **name** | **string**| | | + +### Return type + +**string** + +### Authorization + +No authorization required + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: `application/json` + +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) + +## `getSecretKeys()` + +```php +getSecretKeys(): string[] +``` + + + +### Example + +```php +getSecretKeys(); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling SecretsApi->getSecretKeys: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +This endpoint does not need any parameter. + +### Return type + +**string[]** + +### Authorization + +No authorization required + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: `application/json` + +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) diff --git a/docs/Api/SecureStorageApi.md b/docs/Api/SecureStorageApi.md index 11ab140..57db044 100644 --- a/docs/Api/SecureStorageApi.md +++ b/docs/Api/SecureStorageApi.md @@ -65,7 +65,7 @@ No authorization required ## `getSecureStorage()` ```php -getSecureStorage($key): \OpenAPI\Client\Model\StorageDataContract +getSecureStorage($key): \OpenAPI\Client\Model\SecureStorageDataContract ``` @@ -101,7 +101,7 @@ try { ### Return type -[**\OpenAPI\Client\Model\StorageDataContract**](../Model/StorageDataContract.md) +[**\OpenAPI\Client\Model\SecureStorageDataContract**](../Model/SecureStorageDataContract.md) ### Authorization @@ -119,7 +119,7 @@ No authorization required ## `putSecureStorage()` ```php -putSecureStorage($key, $storage_data_contract) +putSecureStorage($key, $secure_storage_data_contract): mixed ``` @@ -138,10 +138,11 @@ $apiInstance = new OpenAPI\Client\Api\SecureStorageApi( new GuzzleHttp\Client() ); $key = 'key_example'; // string -$storage_data_contract = new \OpenAPI\Client\Model\StorageDataContract(); // \OpenAPI\Client\Model\StorageDataContract +$secure_storage_data_contract = new \OpenAPI\Client\Model\SecureStorageDataContract(); // \OpenAPI\Client\Model\SecureStorageDataContract try { - $apiInstance->putSecureStorage($key, $storage_data_contract); + $result = $apiInstance->putSecureStorage($key, $secure_storage_data_contract); + print_r($result); } catch (Exception $e) { echo 'Exception when calling SecureStorageApi->putSecureStorage: ', $e->getMessage(), PHP_EOL; } @@ -152,11 +153,11 @@ try { | Name | Type | Description | Notes | | ------------- | ------------- | ------------- | ------------- | | **key** | **string**| | | -| **storage_data_contract** | [**\OpenAPI\Client\Model\StorageDataContract**](../Model/StorageDataContract.md)| | | +| **secure_storage_data_contract** | [**\OpenAPI\Client\Model\SecureStorageDataContract**](../Model/SecureStorageDataContract.md)| | | ### Return type -void (empty response body) +**mixed** ### Authorization @@ -165,7 +166,7 @@ No authorization required ### HTTP request headers - **Content-Type**: `application/json` -- **Accept**: Not defined +- **Accept**: `application/json` [[Back to top]](#) [[Back to API list]](../../README.md#endpoints) [[Back to Model list]](../../README.md#models) diff --git a/docs/Api/StorageApi.md b/docs/Api/StorageApi.md index 60a5c3a..ca2a73d 100644 --- a/docs/Api/StorageApi.md +++ b/docs/Api/StorageApi.md @@ -4,16 +4,16 @@ All URIs are relative to http://localhost:59999, except if the operation defines | Method | HTTP request | Description | | ------------- | ------------- | ------------- | -| [**deleteStorage()**](StorageApi.md#deleteStorage) | **DELETE** /storage/{key} | | -| [**getStorage()**](StorageApi.md#getStorage) | **GET** /storage/{key} | | -| [**putStorage()**](StorageApi.md#putStorage) | **PUT** /storage/{key} | | -| [**storageIncrementCounter()**](StorageApi.md#storageIncrementCounter) | **PUT** /storage/{key}/counter/increment | | +| [**deleteByKeyFromStorage()**](StorageApi.md#deleteByKeyFromStorage) | **DELETE** /storage/{key} | | +| [**getByKeyFromStorage()**](StorageApi.md#getByKeyFromStorage) | **GET** /storage/{key} | | +| [**incrementCounter()**](StorageApi.md#incrementCounter) | **PUT** /storage/counter/increment | | +| [**upsertByKeyFromStorage()**](StorageApi.md#upsertByKeyFromStorage) | **PUT** /storage/{key} | | -## `deleteStorage()` +## `deleteByKeyFromStorage()` ```php -deleteStorage($key, $x_monday_access_token) +deleteByKeyFromStorage($key, $x_monday_access_token) ``` @@ -35,9 +35,9 @@ $key = 'key_example'; // string $x_monday_access_token = 'x_monday_access_token_example'; // string try { - $apiInstance->deleteStorage($key, $x_monday_access_token); + $apiInstance->deleteByKeyFromStorage($key, $x_monday_access_token); } catch (Exception $e) { - echo 'Exception when calling StorageApi->deleteStorage: ', $e->getMessage(), PHP_EOL; + echo 'Exception when calling StorageApi->deleteByKeyFromStorage: ', $e->getMessage(), PHP_EOL; } ``` @@ -65,10 +65,10 @@ No authorization required [[Back to Model list]](../../README.md#models) [[Back to README]](../../README.md) -## `getStorage()` +## `getByKeyFromStorage()` ```php -getStorage($key, $shared, $x_monday_access_token): \OpenAPI\Client\Model\StorageDataContract +getByKeyFromStorage($key, $shared, $x_monday_access_token): \OpenAPI\Client\Model\StorageDataContract ``` @@ -91,10 +91,10 @@ $shared = True; // bool $x_monday_access_token = 'x_monday_access_token_example'; // string try { - $result = $apiInstance->getStorage($key, $shared, $x_monday_access_token); + $result = $apiInstance->getByKeyFromStorage($key, $shared, $x_monday_access_token); print_r($result); } catch (Exception $e) { - echo 'Exception when calling StorageApi->getStorage: ', $e->getMessage(), PHP_EOL; + echo 'Exception when calling StorageApi->getByKeyFromStorage: ', $e->getMessage(), PHP_EOL; } ``` @@ -123,10 +123,10 @@ No authorization required [[Back to Model list]](../../README.md#models) [[Back to README]](../../README.md) -## `putStorage()` +## `incrementCounter()` ```php -putStorage($key, $x_monday_access_token, $shared, $previous_version, $storage_data_contract) +incrementCounter($x_monday_access_token, $increment_counter_params): mixed ``` @@ -144,16 +144,14 @@ $apiInstance = new OpenAPI\Client\Api\StorageApi( // This is optional, `GuzzleHttp\Client` will be used as default. new GuzzleHttp\Client() ); -$key = 'key_example'; // string $x_monday_access_token = 'x_monday_access_token_example'; // string -$shared = True; // bool -$previous_version = 'previous_version_example'; // string -$storage_data_contract = new \OpenAPI\Client\Model\StorageDataContract(); // \OpenAPI\Client\Model\StorageDataContract +$increment_counter_params = new \OpenAPI\Client\Model\IncrementCounterParams(); // \OpenAPI\Client\Model\IncrementCounterParams try { - $apiInstance->putStorage($key, $x_monday_access_token, $shared, $previous_version, $storage_data_contract); + $result = $apiInstance->incrementCounter($x_monday_access_token, $increment_counter_params); + print_r($result); } catch (Exception $e) { - echo 'Exception when calling StorageApi->putStorage: ', $e->getMessage(), PHP_EOL; + echo 'Exception when calling StorageApi->incrementCounter: ', $e->getMessage(), PHP_EOL; } ``` @@ -161,15 +159,12 @@ try { | Name | Type | Description | Notes | | ------------- | ------------- | ------------- | ------------- | -| **key** | **string**| | | | **x_monday_access_token** | **string**| | | -| **shared** | **bool**| | | -| **previous_version** | **string**| | | -| **storage_data_contract** | [**\OpenAPI\Client\Model\StorageDataContract**](../Model/StorageDataContract.md)| | | +| **increment_counter_params** | [**\OpenAPI\Client\Model\IncrementCounterParams**](../Model/IncrementCounterParams.md)| | | ### Return type -void (empty response body) +**mixed** ### Authorization @@ -178,16 +173,16 @@ No authorization required ### HTTP request headers - **Content-Type**: `application/json` -- **Accept**: Not defined +- **Accept**: `application/json` [[Back to top]](#) [[Back to API list]](../../README.md#endpoints) [[Back to Model list]](../../README.md#models) [[Back to README]](../../README.md) -## `storageIncrementCounter()` +## `upsertByKeyFromStorage()` ```php -storageIncrementCounter($x_monday_access_token, $key, $increment_counter_params) +upsertByKeyFromStorage($key, $x_monday_access_token, $storage_data_contract, $shared, $previous_version): mixed ``` @@ -205,14 +200,17 @@ $apiInstance = new OpenAPI\Client\Api\StorageApi( // This is optional, `GuzzleHttp\Client` will be used as default. new GuzzleHttp\Client() ); -$x_monday_access_token = 'x_monday_access_token_example'; // string $key = 'key_example'; // string -$increment_counter_params = new \OpenAPI\Client\Model\IncrementCounterParams(); // \OpenAPI\Client\Model\IncrementCounterParams +$x_monday_access_token = 'x_monday_access_token_example'; // string +$storage_data_contract = new \OpenAPI\Client\Model\StorageDataContract(); // \OpenAPI\Client\Model\StorageDataContract +$shared = True; // bool +$previous_version = 'previous_version_example'; // string try { - $apiInstance->storageIncrementCounter($x_monday_access_token, $key, $increment_counter_params); + $result = $apiInstance->upsertByKeyFromStorage($key, $x_monday_access_token, $storage_data_contract, $shared, $previous_version); + print_r($result); } catch (Exception $e) { - echo 'Exception when calling StorageApi->storageIncrementCounter: ', $e->getMessage(), PHP_EOL; + echo 'Exception when calling StorageApi->upsertByKeyFromStorage: ', $e->getMessage(), PHP_EOL; } ``` @@ -220,13 +218,15 @@ try { | Name | Type | Description | Notes | | ------------- | ------------- | ------------- | ------------- | -| **x_monday_access_token** | **string**| | | | **key** | **string**| | | -| **increment_counter_params** | [**\OpenAPI\Client\Model\IncrementCounterParams**](../Model/IncrementCounterParams.md)| | | +| **x_monday_access_token** | **string**| | | +| **storage_data_contract** | [**\OpenAPI\Client\Model\StorageDataContract**](../Model/StorageDataContract.md)| | | +| **shared** | **bool**| | [optional] | +| **previous_version** | **string**| | [optional] | ### Return type -void (empty response body) +**mixed** ### Authorization @@ -235,7 +235,7 @@ No authorization required ### HTTP request headers - **Content-Type**: `application/json` -- **Accept**: Not defined +- **Accept**: `application/json` [[Back to top]](#) [[Back to API list]](../../README.md#endpoints) [[Back to Model list]](../../README.md#models) diff --git a/docs/Model/GetStorage404Response.md b/docs/Model/GetByKeyFromStorage404Response.md similarity index 88% rename from docs/Model/GetStorage404Response.md rename to docs/Model/GetByKeyFromStorage404Response.md index cf8488c..fe856e9 100644 --- a/docs/Model/GetStorage404Response.md +++ b/docs/Model/GetByKeyFromStorage404Response.md @@ -1,4 +1,4 @@ -# # GetStorage404Response +# # GetByKeyFromStorage404Response ## Properties diff --git a/docs/Model/GetByKeyFromStorage500Response.md b/docs/Model/GetByKeyFromStorage500Response.md new file mode 100644 index 0000000..53a2bd2 --- /dev/null +++ b/docs/Model/GetByKeyFromStorage500Response.md @@ -0,0 +1,9 @@ +# # GetByKeyFromStorage500Response + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**reason** | **string** | | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/LogMethods.md b/docs/Model/LogMethods.md new file mode 100644 index 0000000..62f8307 --- /dev/null +++ b/docs/Model/LogMethods.md @@ -0,0 +1,8 @@ +# # LogMethods + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/SecureStorageDataContract.md b/docs/Model/SecureStorageDataContract.md new file mode 100644 index 0000000..e924cc3 --- /dev/null +++ b/docs/Model/SecureStorageDataContract.md @@ -0,0 +1,9 @@ +# # SecureStorageDataContract + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**value** | **mixed** | | + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/StorageDataContract.md b/docs/Model/StorageDataContract.md index 22b29f8..d6ff573 100644 --- a/docs/Model/StorageDataContract.md +++ b/docs/Model/StorageDataContract.md @@ -4,6 +4,7 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**value** | **mixed** | | +**version** | **string** | | +**value** | [**\OpenAPI\Client\Model\JsonValue**](JsonValue.md) | | [[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/WriteLogRequestBody.md b/docs/Model/WriteLogRequestBody.md new file mode 100644 index 0000000..bcf8a38 --- /dev/null +++ b/docs/Model/WriteLogRequestBody.md @@ -0,0 +1,11 @@ +# # WriteLogRequestBody + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**error** | [**\OpenAPI\Client\Model\WriteLogRequestBodyError**](WriteLogRequestBodyError.md) | | [optional] +**message** | **string** | | +**method** | [**\OpenAPI\Client\Model\LogMethods**](LogMethods.md) | | + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/WriteLogRequestBodyError.md b/docs/Model/WriteLogRequestBodyError.md new file mode 100644 index 0000000..0c2b3bc --- /dev/null +++ b/docs/Model/WriteLogRequestBodyError.md @@ -0,0 +1,8 @@ +# # WriteLogRequestBodyError + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/lib/Api/EnvironmentVariablesApi.php b/lib/Api/EnvironmentVariablesApi.php new file mode 100644 index 0000000..e6241c7 --- /dev/null +++ b/lib/Api/EnvironmentVariablesApi.php @@ -0,0 +1,759 @@ + [ + 'application/json', + ], + 'getEnvironmentVariableKeys' => [ + 'application/json', + ], + ]; + + /** + * @param ClientInterface $client + * @param Configuration $config + * @param HeaderSelector $selector + * @param int $hostIndex (Optional) host index to select the list of hosts if defined in the OpenAPI spec + */ + public function __construct( + ClientInterface $client = null, + Configuration $config = null, + HeaderSelector $selector = null, + $hostIndex = 0 + ) { + $this->client = $client ?: new Client(); + $this->config = $config ?: new Configuration(); + $this->headerSelector = $selector ?: new HeaderSelector(); + $this->hostIndex = $hostIndex; + } + + /** + * Set the host index + * + * @param int $hostIndex Host index (required) + */ + public function setHostIndex($hostIndex): void + { + $this->hostIndex = $hostIndex; + } + + /** + * Get the host index + * + * @return int Host index + */ + public function getHostIndex() + { + return $this->hostIndex; + } + + /** + * @return Configuration + */ + public function getConfig() + { + return $this->config; + } + + /** + * Operation getEnvironmentVariable + * + * @param string $name name (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getEnvironmentVariable'] to see the possible values for this operation + * + * @throws \OpenAPI\Client\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \InvalidArgumentException + * @return \OpenAPI\Client\Model\JsonValue|\OpenAPI\Client\Model\GetByKeyFromStorage404Response + */ + public function getEnvironmentVariable($name, string $contentType = self::contentTypes['getEnvironmentVariable'][0]) + { + list($response) = $this->getEnvironmentVariableWithHttpInfo($name, $contentType); + return $response; + } + + /** + * Operation getEnvironmentVariableWithHttpInfo + * + * @param string $name (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getEnvironmentVariable'] to see the possible values for this operation + * + * @throws \OpenAPI\Client\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \InvalidArgumentException + * @return array of \OpenAPI\Client\Model\JsonValue|\OpenAPI\Client\Model\GetByKeyFromStorage404Response, HTTP status code, HTTP response headers (array of strings) + */ + public function getEnvironmentVariableWithHttpInfo($name, string $contentType = self::contentTypes['getEnvironmentVariable'][0]) + { + $request = $this->getEnvironmentVariableRequest($name, $contentType); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); + } + + $statusCode = $response->getStatusCode(); + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + + switch($statusCode) { + case 200: + if ('\OpenAPI\Client\Model\JsonValue' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\JsonValue' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\JsonValue', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 404: + if ('\OpenAPI\Client\Model\GetByKeyFromStorage404Response' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\GetByKeyFromStorage404Response' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\GetByKeyFromStorage404Response', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\OpenAPI\Client\Model\JsonValue'; + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\OpenAPI\Client\Model\JsonValue', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 404: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\OpenAPI\Client\Model\GetByKeyFromStorage404Response', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation getEnvironmentVariableAsync + * + * @param string $name (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getEnvironmentVariable'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function getEnvironmentVariableAsync($name, string $contentType = self::contentTypes['getEnvironmentVariable'][0]) + { + return $this->getEnvironmentVariableAsyncWithHttpInfo($name, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation getEnvironmentVariableAsyncWithHttpInfo + * + * @param string $name (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getEnvironmentVariable'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function getEnvironmentVariableAsyncWithHttpInfo($name, string $contentType = self::contentTypes['getEnvironmentVariable'][0]) + { + $returnType = '\OpenAPI\Client\Model\JsonValue'; + $request = $this->getEnvironmentVariableRequest($name, $contentType); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'getEnvironmentVariable' + * + * @param string $name (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getEnvironmentVariable'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function getEnvironmentVariableRequest($name, string $contentType = self::contentTypes['getEnvironmentVariable'][0]) + { + + // verify the required parameter 'name' is set + if ($name === null || (is_array($name) && count($name) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $name when calling getEnvironmentVariable' + ); + } + + + $resourcePath = '/environment-variables/{name}'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + // path params + if ($name !== null) { + $resourcePath = str_replace( + '{' . 'name' . '}', + ObjectSerializer::toPathValue($name), + $resourcePath + ); + } + + + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } + } + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); + + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + } else { + // for HTTP post (form) + $httpBody = ObjectSerializer::buildQuery($formParams); + } + } + + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( + 'GET', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation getEnvironmentVariableKeys + * + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getEnvironmentVariableKeys'] to see the possible values for this operation + * + * @throws \OpenAPI\Client\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \InvalidArgumentException + * @return string[] + */ + public function getEnvironmentVariableKeys(string $contentType = self::contentTypes['getEnvironmentVariableKeys'][0]) + { + list($response) = $this->getEnvironmentVariableKeysWithHttpInfo($contentType); + return $response; + } + + /** + * Operation getEnvironmentVariableKeysWithHttpInfo + * + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getEnvironmentVariableKeys'] to see the possible values for this operation + * + * @throws \OpenAPI\Client\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \InvalidArgumentException + * @return array of string[], HTTP status code, HTTP response headers (array of strings) + */ + public function getEnvironmentVariableKeysWithHttpInfo(string $contentType = self::contentTypes['getEnvironmentVariableKeys'][0]) + { + $request = $this->getEnvironmentVariableKeysRequest($contentType); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); + } + + $statusCode = $response->getStatusCode(); + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + + switch($statusCode) { + case 200: + if ('string[]' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('string[]' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, 'string[]', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = 'string[]'; + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + 'string[]', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation getEnvironmentVariableKeysAsync + * + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getEnvironmentVariableKeys'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function getEnvironmentVariableKeysAsync(string $contentType = self::contentTypes['getEnvironmentVariableKeys'][0]) + { + return $this->getEnvironmentVariableKeysAsyncWithHttpInfo($contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation getEnvironmentVariableKeysAsyncWithHttpInfo + * + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getEnvironmentVariableKeys'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function getEnvironmentVariableKeysAsyncWithHttpInfo(string $contentType = self::contentTypes['getEnvironmentVariableKeys'][0]) + { + $returnType = 'string[]'; + $request = $this->getEnvironmentVariableKeysRequest($contentType); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'getEnvironmentVariableKeys' + * + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getEnvironmentVariableKeys'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function getEnvironmentVariableKeysRequest(string $contentType = self::contentTypes['getEnvironmentVariableKeys'][0]) + { + + + $resourcePath = '/environment-variables'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + + + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } + } + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); + + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + } else { + // for HTTP post (form) + $httpBody = ObjectSerializer::buildQuery($formParams); + } + } + + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( + 'GET', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Create http client option + * + * @throws \RuntimeException on file opening failure + * @return array of http client options + */ + protected function createHttpClientOption() + { + $options = []; + if ($this->config->getDebug()) { + $options[RequestOptions::DEBUG] = fopen($this->config->getDebugFile(), 'a'); + if (!$options[RequestOptions::DEBUG]) { + throw new \RuntimeException('Failed to open the debug file: ' . $this->config->getDebugFile()); + } + } + + return $options; + } +} diff --git a/lib/Api/LogsApi.php b/lib/Api/LogsApi.php new file mode 100644 index 0000000..181665a --- /dev/null +++ b/lib/Api/LogsApi.php @@ -0,0 +1,363 @@ + [ + 'application/json', + ], + ]; + + /** + * @param ClientInterface $client + * @param Configuration $config + * @param HeaderSelector $selector + * @param int $hostIndex (Optional) host index to select the list of hosts if defined in the OpenAPI spec + */ + public function __construct( + ClientInterface $client = null, + Configuration $config = null, + HeaderSelector $selector = null, + $hostIndex = 0 + ) { + $this->client = $client ?: new Client(); + $this->config = $config ?: new Configuration(); + $this->headerSelector = $selector ?: new HeaderSelector(); + $this->hostIndex = $hostIndex; + } + + /** + * Set the host index + * + * @param int $hostIndex Host index (required) + */ + public function setHostIndex($hostIndex): void + { + $this->hostIndex = $hostIndex; + } + + /** + * Get the host index + * + * @return int Host index + */ + public function getHostIndex() + { + return $this->hostIndex; + } + + /** + * @return Configuration + */ + public function getConfig() + { + return $this->config; + } + + /** + * Operation writeLog + * + * @param \OpenAPI\Client\Model\WriteLogRequestBody $write_log_request_body write_log_request_body (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['writeLog'] to see the possible values for this operation + * + * @throws \OpenAPI\Client\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \InvalidArgumentException + * @return void + */ + public function writeLog($write_log_request_body, string $contentType = self::contentTypes['writeLog'][0]) + { + $this->writeLogWithHttpInfo($write_log_request_body, $contentType); + } + + /** + * Operation writeLogWithHttpInfo + * + * @param \OpenAPI\Client\Model\WriteLogRequestBody $write_log_request_body (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['writeLog'] to see the possible values for this operation + * + * @throws \OpenAPI\Client\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \InvalidArgumentException + * @return array of null, HTTP status code, HTTP response headers (array of strings) + */ + public function writeLogWithHttpInfo($write_log_request_body, string $contentType = self::contentTypes['writeLog'][0]) + { + $request = $this->writeLogRequest($write_log_request_body, $contentType); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); + } + + $statusCode = $response->getStatusCode(); + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + + return [null, $statusCode, $response->getHeaders()]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + } + throw $e; + } + } + + /** + * Operation writeLogAsync + * + * @param \OpenAPI\Client\Model\WriteLogRequestBody $write_log_request_body (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['writeLog'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function writeLogAsync($write_log_request_body, string $contentType = self::contentTypes['writeLog'][0]) + { + return $this->writeLogAsyncWithHttpInfo($write_log_request_body, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation writeLogAsyncWithHttpInfo + * + * @param \OpenAPI\Client\Model\WriteLogRequestBody $write_log_request_body (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['writeLog'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function writeLogAsyncWithHttpInfo($write_log_request_body, string $contentType = self::contentTypes['writeLog'][0]) + { + $returnType = ''; + $request = $this->writeLogRequest($write_log_request_body, $contentType); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + return [null, $response->getStatusCode(), $response->getHeaders()]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'writeLog' + * + * @param \OpenAPI\Client\Model\WriteLogRequestBody $write_log_request_body (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['writeLog'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function writeLogRequest($write_log_request_body, string $contentType = self::contentTypes['writeLog'][0]) + { + + // verify the required parameter 'write_log_request_body' is set + if ($write_log_request_body === null || (is_array($write_log_request_body) && count($write_log_request_body) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $write_log_request_body when calling writeLog' + ); + } + + + $resourcePath = '/logs'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + + + $headers = $this->headerSelector->selectHeaders( + [], + $contentType, + $multipart + ); + + // for model (json/xml) + if (isset($write_log_request_body)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($write_log_request_body)); + } else { + $httpBody = $write_log_request_body; + } + } elseif (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } + } + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); + + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + } else { + // for HTTP post (form) + $httpBody = ObjectSerializer::buildQuery($formParams); + } + } + + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( + 'POST', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Create http client option + * + * @throws \RuntimeException on file opening failure + * @return array of http client options + */ + protected function createHttpClientOption() + { + $options = []; + if ($this->config->getDebug()) { + $options[RequestOptions::DEBUG] = fopen($this->config->getDebugFile(), 'a'); + if (!$options[RequestOptions::DEBUG]) { + throw new \RuntimeException('Failed to open the debug file: ' . $this->config->getDebugFile()); + } + } + + return $options; + } +} diff --git a/lib/Api/QueueApi.php b/lib/Api/QueueApi.php index 0352fe6..e71afe0 100644 --- a/lib/Api/QueueApi.php +++ b/lib/Api/QueueApi.php @@ -16,7 +16,7 @@ * * The version of the OpenAPI document: 0.0.1 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.4.0-SNAPSHOT + * Generator version: 7.7.0-SNAPSHOT */ /** diff --git a/lib/Api/SecretApi.php b/lib/Api/SecretsApi.php similarity index 58% rename from lib/Api/SecretApi.php rename to lib/Api/SecretsApi.php index 5243f19..d4aa819 100644 --- a/lib/Api/SecretApi.php +++ b/lib/Api/SecretsApi.php @@ -1,6 +1,6 @@ [ 'application/json', ], + 'getSecretKeys' => [ + 'application/json', + ], ]; /** @@ -130,7 +133,7 @@ public function getConfig() * * @throws \OpenAPI\Client\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException - * @return string|\OpenAPI\Client\Model\GetStorage404Response + * @return string|\OpenAPI\Client\Model\GetByKeyFromStorage404Response */ public function getSecret($name, string $contentType = self::contentTypes['getSecret'][0]) { @@ -146,7 +149,7 @@ public function getSecret($name, string $contentType = self::contentTypes['getSe * * @throws \OpenAPI\Client\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException - * @return array of string|\OpenAPI\Client\Model\GetStorage404Response, HTTP status code, HTTP response headers (array of strings) + * @return array of string|\OpenAPI\Client\Model\GetByKeyFromStorage404Response, HTTP status code, HTTP response headers (array of strings) */ public function getSecretWithHttpInfo($name, string $contentType = self::contentTypes['getSecret'][0]) { @@ -216,11 +219,11 @@ public function getSecretWithHttpInfo($name, string $contentType = self::content $response->getHeaders() ]; case 404: - if ('\OpenAPI\Client\Model\GetStorage404Response' === '\SplFileObject') { + if ('\OpenAPI\Client\Model\GetByKeyFromStorage404Response' === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer } else { $content = (string) $response->getBody(); - if ('\OpenAPI\Client\Model\GetStorage404Response' !== 'string') { + if ('\OpenAPI\Client\Model\GetByKeyFromStorage404Response' !== 'string') { try { $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); } catch (\JsonException $exception) { @@ -238,7 +241,7 @@ public function getSecretWithHttpInfo($name, string $contentType = self::content } return [ - ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\GetStorage404Response', []), + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\GetByKeyFromStorage404Response', []), $response->getStatusCode(), $response->getHeaders() ]; @@ -285,7 +288,7 @@ public function getSecretWithHttpInfo($name, string $contentType = self::content case 404: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\OpenAPI\Client\Model\GetStorage404Response', + '\OpenAPI\Client\Model\GetByKeyFromStorage404Response', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -403,6 +406,285 @@ public function getSecretRequest($name, string $contentType = self::contentTypes } + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } + } + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); + + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + } else { + // for HTTP post (form) + $httpBody = ObjectSerializer::buildQuery($formParams); + } + } + + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( + 'GET', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation getSecretKeys + * + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getSecretKeys'] to see the possible values for this operation + * + * @throws \OpenAPI\Client\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \InvalidArgumentException + * @return string[] + */ + public function getSecretKeys(string $contentType = self::contentTypes['getSecretKeys'][0]) + { + list($response) = $this->getSecretKeysWithHttpInfo($contentType); + return $response; + } + + /** + * Operation getSecretKeysWithHttpInfo + * + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getSecretKeys'] to see the possible values for this operation + * + * @throws \OpenAPI\Client\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \InvalidArgumentException + * @return array of string[], HTTP status code, HTTP response headers (array of strings) + */ + public function getSecretKeysWithHttpInfo(string $contentType = self::contentTypes['getSecretKeys'][0]) + { + $request = $this->getSecretKeysRequest($contentType); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); + } + + $statusCode = $response->getStatusCode(); + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + + switch($statusCode) { + case 200: + if ('string[]' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('string[]' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, 'string[]', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = 'string[]'; + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + 'string[]', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation getSecretKeysAsync + * + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getSecretKeys'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function getSecretKeysAsync(string $contentType = self::contentTypes['getSecretKeys'][0]) + { + return $this->getSecretKeysAsyncWithHttpInfo($contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation getSecretKeysAsyncWithHttpInfo + * + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getSecretKeys'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function getSecretKeysAsyncWithHttpInfo(string $contentType = self::contentTypes['getSecretKeys'][0]) + { + $returnType = 'string[]'; + $request = $this->getSecretKeysRequest($contentType); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'getSecretKeys' + * + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getSecretKeys'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function getSecretKeysRequest(string $contentType = self::contentTypes['getSecretKeys'][0]) + { + + + $resourcePath = '/secrets'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + + $headers = $this->headerSelector->selectHeaders( ['application/json', ], $contentType, diff --git a/lib/Api/SecureStorageApi.php b/lib/Api/SecureStorageApi.php index ad3c021..36fc992 100644 --- a/lib/Api/SecureStorageApi.php +++ b/lib/Api/SecureStorageApi.php @@ -16,7 +16,7 @@ * * The version of the OpenAPI document: 0.0.1 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.4.0-SNAPSHOT + * Generator version: 7.7.0-SNAPSHOT */ /** @@ -357,7 +357,7 @@ public function deleteSecureStorageRequest($key, string $contentType = self::con * * @throws \OpenAPI\Client\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException - * @return \OpenAPI\Client\Model\StorageDataContract|\OpenAPI\Client\Model\GetStorage404Response + * @return \OpenAPI\Client\Model\SecureStorageDataContract|\OpenAPI\Client\Model\GetByKeyFromStorage404Response */ public function getSecureStorage($key, string $contentType = self::contentTypes['getSecureStorage'][0]) { @@ -373,7 +373,7 @@ public function getSecureStorage($key, string $contentType = self::contentTypes[ * * @throws \OpenAPI\Client\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException - * @return array of \OpenAPI\Client\Model\StorageDataContract|\OpenAPI\Client\Model\GetStorage404Response, HTTP status code, HTTP response headers (array of strings) + * @return array of \OpenAPI\Client\Model\SecureStorageDataContract|\OpenAPI\Client\Model\GetByKeyFromStorage404Response, HTTP status code, HTTP response headers (array of strings) */ public function getSecureStorageWithHttpInfo($key, string $contentType = self::contentTypes['getSecureStorage'][0]) { @@ -416,11 +416,11 @@ public function getSecureStorageWithHttpInfo($key, string $contentType = self::c switch($statusCode) { case 200: - if ('\OpenAPI\Client\Model\StorageDataContract' === '\SplFileObject') { + if ('\OpenAPI\Client\Model\SecureStorageDataContract' === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer } else { $content = (string) $response->getBody(); - if ('\OpenAPI\Client\Model\StorageDataContract' !== 'string') { + if ('\OpenAPI\Client\Model\SecureStorageDataContract' !== 'string') { try { $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); } catch (\JsonException $exception) { @@ -438,16 +438,16 @@ public function getSecureStorageWithHttpInfo($key, string $contentType = self::c } return [ - ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\StorageDataContract', []), + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\SecureStorageDataContract', []), $response->getStatusCode(), $response->getHeaders() ]; case 404: - if ('\OpenAPI\Client\Model\GetStorage404Response' === '\SplFileObject') { + if ('\OpenAPI\Client\Model\GetByKeyFromStorage404Response' === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer } else { $content = (string) $response->getBody(); - if ('\OpenAPI\Client\Model\GetStorage404Response' !== 'string') { + if ('\OpenAPI\Client\Model\GetByKeyFromStorage404Response' !== 'string') { try { $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); } catch (\JsonException $exception) { @@ -465,13 +465,13 @@ public function getSecureStorageWithHttpInfo($key, string $contentType = self::c } return [ - ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\GetStorage404Response', []), + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\GetByKeyFromStorage404Response', []), $response->getStatusCode(), $response->getHeaders() ]; } - $returnType = '\OpenAPI\Client\Model\StorageDataContract'; + $returnType = '\OpenAPI\Client\Model\SecureStorageDataContract'; if ($returnType === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer } else { @@ -504,7 +504,7 @@ public function getSecureStorageWithHttpInfo($key, string $contentType = self::c case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\OpenAPI\Client\Model\StorageDataContract', + '\OpenAPI\Client\Model\SecureStorageDataContract', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -512,7 +512,7 @@ public function getSecureStorageWithHttpInfo($key, string $contentType = self::c case 404: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\OpenAPI\Client\Model\GetStorage404Response', + '\OpenAPI\Client\Model\GetByKeyFromStorage404Response', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -552,7 +552,7 @@ function ($response) { */ public function getSecureStorageAsyncWithHttpInfo($key, string $contentType = self::contentTypes['getSecureStorage'][0]) { - $returnType = '\OpenAPI\Client\Model\StorageDataContract'; + $returnType = '\OpenAPI\Client\Model\SecureStorageDataContract'; $request = $this->getSecureStorageRequest($key, $contentType); return $this->client @@ -687,32 +687,33 @@ public function getSecureStorageRequest($key, string $contentType = self::conten * Operation putSecureStorage * * @param string $key key (required) - * @param \OpenAPI\Client\Model\StorageDataContract $storage_data_contract storage_data_contract (required) + * @param \OpenAPI\Client\Model\SecureStorageDataContract $secure_storage_data_contract secure_storage_data_contract (required) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['putSecureStorage'] to see the possible values for this operation * * @throws \OpenAPI\Client\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException - * @return void + * @return mixed */ - public function putSecureStorage($key, $storage_data_contract, string $contentType = self::contentTypes['putSecureStorage'][0]) + public function putSecureStorage($key, $secure_storage_data_contract, string $contentType = self::contentTypes['putSecureStorage'][0]) { - $this->putSecureStorageWithHttpInfo($key, $storage_data_contract, $contentType); + list($response) = $this->putSecureStorageWithHttpInfo($key, $secure_storage_data_contract, $contentType); + return $response; } /** * Operation putSecureStorageWithHttpInfo * * @param string $key (required) - * @param \OpenAPI\Client\Model\StorageDataContract $storage_data_contract (required) + * @param \OpenAPI\Client\Model\SecureStorageDataContract $secure_storage_data_contract (required) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['putSecureStorage'] to see the possible values for this operation * * @throws \OpenAPI\Client\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException - * @return array of null, HTTP status code, HTTP response headers (array of strings) + * @return array of mixed, HTTP status code, HTTP response headers (array of strings) */ - public function putSecureStorageWithHttpInfo($key, $storage_data_contract, string $contentType = self::contentTypes['putSecureStorage'][0]) + public function putSecureStorageWithHttpInfo($key, $secure_storage_data_contract, string $contentType = self::contentTypes['putSecureStorage'][0]) { - $request = $this->putSecureStorageRequest($key, $storage_data_contract, $contentType); + $request = $this->putSecureStorageRequest($key, $secure_storage_data_contract, $contentType); try { $options = $this->createHttpClientOption(); @@ -749,10 +750,74 @@ public function putSecureStorageWithHttpInfo($key, $storage_data_contract, strin ); } - return [null, $statusCode, $response->getHeaders()]; + switch($statusCode) { + case 200: + if ('mixed' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('mixed' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, 'mixed', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = 'mixed'; + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; } catch (ApiException $e) { switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + 'mixed', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; } throw $e; } @@ -762,15 +827,15 @@ public function putSecureStorageWithHttpInfo($key, $storage_data_contract, strin * Operation putSecureStorageAsync * * @param string $key (required) - * @param \OpenAPI\Client\Model\StorageDataContract $storage_data_contract (required) + * @param \OpenAPI\Client\Model\SecureStorageDataContract $secure_storage_data_contract (required) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['putSecureStorage'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function putSecureStorageAsync($key, $storage_data_contract, string $contentType = self::contentTypes['putSecureStorage'][0]) + public function putSecureStorageAsync($key, $secure_storage_data_contract, string $contentType = self::contentTypes['putSecureStorage'][0]) { - return $this->putSecureStorageAsyncWithHttpInfo($key, $storage_data_contract, $contentType) + return $this->putSecureStorageAsyncWithHttpInfo($key, $secure_storage_data_contract, $contentType) ->then( function ($response) { return $response[0]; @@ -782,22 +847,35 @@ function ($response) { * Operation putSecureStorageAsyncWithHttpInfo * * @param string $key (required) - * @param \OpenAPI\Client\Model\StorageDataContract $storage_data_contract (required) + * @param \OpenAPI\Client\Model\SecureStorageDataContract $secure_storage_data_contract (required) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['putSecureStorage'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function putSecureStorageAsyncWithHttpInfo($key, $storage_data_contract, string $contentType = self::contentTypes['putSecureStorage'][0]) + public function putSecureStorageAsyncWithHttpInfo($key, $secure_storage_data_contract, string $contentType = self::contentTypes['putSecureStorage'][0]) { - $returnType = ''; - $request = $this->putSecureStorageRequest($key, $storage_data_contract, $contentType); + $returnType = 'mixed'; + $request = $this->putSecureStorageRequest($key, $secure_storage_data_contract, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { - return [null, $response->getStatusCode(), $response->getHeaders()]; + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; }, function ($exception) { $response = $exception->getResponse(); @@ -820,13 +898,13 @@ function ($exception) { * Create request for operation 'putSecureStorage' * * @param string $key (required) - * @param \OpenAPI\Client\Model\StorageDataContract $storage_data_contract (required) + * @param \OpenAPI\Client\Model\SecureStorageDataContract $secure_storage_data_contract (required) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['putSecureStorage'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - public function putSecureStorageRequest($key, $storage_data_contract, string $contentType = self::contentTypes['putSecureStorage'][0]) + public function putSecureStorageRequest($key, $secure_storage_data_contract, string $contentType = self::contentTypes['putSecureStorage'][0]) { // verify the required parameter 'key' is set @@ -836,10 +914,10 @@ public function putSecureStorageRequest($key, $storage_data_contract, string $co ); } - // verify the required parameter 'storage_data_contract' is set - if ($storage_data_contract === null || (is_array($storage_data_contract) && count($storage_data_contract) === 0)) { + // verify the required parameter 'secure_storage_data_contract' is set + if ($secure_storage_data_contract === null || (is_array($secure_storage_data_contract) && count($secure_storage_data_contract) === 0)) { throw new \InvalidArgumentException( - 'Missing the required parameter $storage_data_contract when calling putSecureStorage' + 'Missing the required parameter $secure_storage_data_contract when calling putSecureStorage' ); } @@ -864,18 +942,18 @@ public function putSecureStorageRequest($key, $storage_data_contract, string $co $headers = $this->headerSelector->selectHeaders( - [], + ['application/json', ], $contentType, $multipart ); // for model (json/xml) - if (isset($storage_data_contract)) { + if (isset($secure_storage_data_contract)) { if (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the body - $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($storage_data_contract)); + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($secure_storage_data_contract)); } else { - $httpBody = $storage_data_contract; + $httpBody = $secure_storage_data_contract; } } elseif (count($formParams) > 0) { if ($multipart) { diff --git a/lib/Api/StorageApi.php b/lib/Api/StorageApi.php index 2e5a4ac..b020efc 100644 --- a/lib/Api/StorageApi.php +++ b/lib/Api/StorageApi.php @@ -16,7 +16,7 @@ * * The version of the OpenAPI document: 0.0.1 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.4.0-SNAPSHOT + * Generator version: 7.7.0-SNAPSHOT */ /** @@ -71,16 +71,16 @@ class StorageApi /** @var string[] $contentTypes **/ public const contentTypes = [ - 'deleteStorage' => [ + 'deleteByKeyFromStorage' => [ 'application/json', ], - 'getStorage' => [ + 'getByKeyFromStorage' => [ 'application/json', ], - 'putStorage' => [ + 'incrementCounter' => [ 'application/json', ], - 'storageIncrementCounter' => [ + 'upsertByKeyFromStorage' => [ 'application/json', ], ]; @@ -132,35 +132,35 @@ public function getConfig() } /** - * Operation deleteStorage + * Operation deleteByKeyFromStorage * * @param string $key key (required) * @param string $x_monday_access_token x_monday_access_token (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteStorage'] to see the possible values for this operation + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteByKeyFromStorage'] to see the possible values for this operation * * @throws \OpenAPI\Client\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException * @return void */ - public function deleteStorage($key, $x_monday_access_token, string $contentType = self::contentTypes['deleteStorage'][0]) + public function deleteByKeyFromStorage($key, $x_monday_access_token, string $contentType = self::contentTypes['deleteByKeyFromStorage'][0]) { - $this->deleteStorageWithHttpInfo($key, $x_monday_access_token, $contentType); + $this->deleteByKeyFromStorageWithHttpInfo($key, $x_monday_access_token, $contentType); } /** - * Operation deleteStorageWithHttpInfo + * Operation deleteByKeyFromStorageWithHttpInfo * * @param string $key (required) * @param string $x_monday_access_token (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteStorage'] to see the possible values for this operation + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteByKeyFromStorage'] to see the possible values for this operation * * @throws \OpenAPI\Client\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException * @return array of null, HTTP status code, HTTP response headers (array of strings) */ - public function deleteStorageWithHttpInfo($key, $x_monday_access_token, string $contentType = self::contentTypes['deleteStorage'][0]) + public function deleteByKeyFromStorageWithHttpInfo($key, $x_monday_access_token, string $contentType = self::contentTypes['deleteByKeyFromStorage'][0]) { - $request = $this->deleteStorageRequest($key, $x_monday_access_token, $contentType); + $request = $this->deleteByKeyFromStorageRequest($key, $x_monday_access_token, $contentType); try { $options = $this->createHttpClientOption(); @@ -207,18 +207,18 @@ public function deleteStorageWithHttpInfo($key, $x_monday_access_token, string $ } /** - * Operation deleteStorageAsync + * Operation deleteByKeyFromStorageAsync * * @param string $key (required) * @param string $x_monday_access_token (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteStorage'] to see the possible values for this operation + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteByKeyFromStorage'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function deleteStorageAsync($key, $x_monday_access_token, string $contentType = self::contentTypes['deleteStorage'][0]) + public function deleteByKeyFromStorageAsync($key, $x_monday_access_token, string $contentType = self::contentTypes['deleteByKeyFromStorage'][0]) { - return $this->deleteStorageAsyncWithHttpInfo($key, $x_monday_access_token, $contentType) + return $this->deleteByKeyFromStorageAsyncWithHttpInfo($key, $x_monday_access_token, $contentType) ->then( function ($response) { return $response[0]; @@ -227,19 +227,19 @@ function ($response) { } /** - * Operation deleteStorageAsyncWithHttpInfo + * Operation deleteByKeyFromStorageAsyncWithHttpInfo * * @param string $key (required) * @param string $x_monday_access_token (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteStorage'] to see the possible values for this operation + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteByKeyFromStorage'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function deleteStorageAsyncWithHttpInfo($key, $x_monday_access_token, string $contentType = self::contentTypes['deleteStorage'][0]) + public function deleteByKeyFromStorageAsyncWithHttpInfo($key, $x_monday_access_token, string $contentType = self::contentTypes['deleteByKeyFromStorage'][0]) { $returnType = ''; - $request = $this->deleteStorageRequest($key, $x_monday_access_token, $contentType); + $request = $this->deleteByKeyFromStorageRequest($key, $x_monday_access_token, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) @@ -265,29 +265,29 @@ function ($exception) { } /** - * Create request for operation 'deleteStorage' + * Create request for operation 'deleteByKeyFromStorage' * * @param string $key (required) * @param string $x_monday_access_token (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteStorage'] to see the possible values for this operation + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteByKeyFromStorage'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - public function deleteStorageRequest($key, $x_monday_access_token, string $contentType = self::contentTypes['deleteStorage'][0]) + public function deleteByKeyFromStorageRequest($key, $x_monday_access_token, string $contentType = self::contentTypes['deleteByKeyFromStorage'][0]) { // verify the required parameter 'key' is set if ($key === null || (is_array($key) && count($key) === 0)) { throw new \InvalidArgumentException( - 'Missing the required parameter $key when calling deleteStorage' + 'Missing the required parameter $key when calling deleteByKeyFromStorage' ); } // verify the required parameter 'x_monday_access_token' is set if ($x_monday_access_token === null || (is_array($x_monday_access_token) && count($x_monday_access_token) === 0)) { throw new \InvalidArgumentException( - 'Missing the required parameter $x_monday_access_token when calling deleteStorage' + 'Missing the required parameter $x_monday_access_token when calling deleteByKeyFromStorage' ); } @@ -369,38 +369,38 @@ public function deleteStorageRequest($key, $x_monday_access_token, string $conte } /** - * Operation getStorage + * Operation getByKeyFromStorage * * @param string $key key (required) * @param bool $shared shared (required) * @param string $x_monday_access_token x_monday_access_token (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getStorage'] to see the possible values for this operation + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getByKeyFromStorage'] to see the possible values for this operation * * @throws \OpenAPI\Client\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException - * @return \OpenAPI\Client\Model\StorageDataContract|\OpenAPI\Client\Model\GetStorage404Response + * @return \OpenAPI\Client\Model\StorageDataContract|\OpenAPI\Client\Model\GetByKeyFromStorage404Response|\OpenAPI\Client\Model\GetByKeyFromStorage500Response */ - public function getStorage($key, $shared, $x_monday_access_token, string $contentType = self::contentTypes['getStorage'][0]) + public function getByKeyFromStorage($key, $shared, $x_monday_access_token, string $contentType = self::contentTypes['getByKeyFromStorage'][0]) { - list($response) = $this->getStorageWithHttpInfo($key, $shared, $x_monday_access_token, $contentType); + list($response) = $this->getByKeyFromStorageWithHttpInfo($key, $shared, $x_monday_access_token, $contentType); return $response; } /** - * Operation getStorageWithHttpInfo + * Operation getByKeyFromStorageWithHttpInfo * * @param string $key (required) * @param bool $shared (required) * @param string $x_monday_access_token (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getStorage'] to see the possible values for this operation + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getByKeyFromStorage'] to see the possible values for this operation * * @throws \OpenAPI\Client\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException - * @return array of \OpenAPI\Client\Model\StorageDataContract|\OpenAPI\Client\Model\GetStorage404Response, HTTP status code, HTTP response headers (array of strings) + * @return array of \OpenAPI\Client\Model\StorageDataContract|\OpenAPI\Client\Model\GetByKeyFromStorage404Response|\OpenAPI\Client\Model\GetByKeyFromStorage500Response, HTTP status code, HTTP response headers (array of strings) */ - public function getStorageWithHttpInfo($key, $shared, $x_monday_access_token, string $contentType = self::contentTypes['getStorage'][0]) + public function getByKeyFromStorageWithHttpInfo($key, $shared, $x_monday_access_token, string $contentType = self::contentTypes['getByKeyFromStorage'][0]) { - $request = $this->getStorageRequest($key, $shared, $x_monday_access_token, $contentType); + $request = $this->getByKeyFromStorageRequest($key, $shared, $x_monday_access_token, $contentType); try { $options = $this->createHttpClientOption(); @@ -466,11 +466,11 @@ public function getStorageWithHttpInfo($key, $shared, $x_monday_access_token, st $response->getHeaders() ]; case 404: - if ('\OpenAPI\Client\Model\GetStorage404Response' === '\SplFileObject') { + if ('\OpenAPI\Client\Model\GetByKeyFromStorage404Response' === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer } else { $content = (string) $response->getBody(); - if ('\OpenAPI\Client\Model\GetStorage404Response' !== 'string') { + if ('\OpenAPI\Client\Model\GetByKeyFromStorage404Response' !== 'string') { try { $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); } catch (\JsonException $exception) { @@ -488,7 +488,34 @@ public function getStorageWithHttpInfo($key, $shared, $x_monday_access_token, st } return [ - ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\GetStorage404Response', []), + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\GetByKeyFromStorage404Response', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 500: + if ('\OpenAPI\Client\Model\GetByKeyFromStorage500Response' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\GetByKeyFromStorage500Response' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\GetByKeyFromStorage500Response', []), $response->getStatusCode(), $response->getHeaders() ]; @@ -535,7 +562,15 @@ public function getStorageWithHttpInfo($key, $shared, $x_monday_access_token, st case 404: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\OpenAPI\Client\Model\GetStorage404Response', + '\OpenAPI\Client\Model\GetByKeyFromStorage404Response', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 500: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\OpenAPI\Client\Model\GetByKeyFromStorage500Response', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -546,19 +581,19 @@ public function getStorageWithHttpInfo($key, $shared, $x_monday_access_token, st } /** - * Operation getStorageAsync + * Operation getByKeyFromStorageAsync * * @param string $key (required) * @param bool $shared (required) * @param string $x_monday_access_token (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getStorage'] to see the possible values for this operation + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getByKeyFromStorage'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function getStorageAsync($key, $shared, $x_monday_access_token, string $contentType = self::contentTypes['getStorage'][0]) + public function getByKeyFromStorageAsync($key, $shared, $x_monday_access_token, string $contentType = self::contentTypes['getByKeyFromStorage'][0]) { - return $this->getStorageAsyncWithHttpInfo($key, $shared, $x_monday_access_token, $contentType) + return $this->getByKeyFromStorageAsyncWithHttpInfo($key, $shared, $x_monday_access_token, $contentType) ->then( function ($response) { return $response[0]; @@ -567,20 +602,20 @@ function ($response) { } /** - * Operation getStorageAsyncWithHttpInfo + * Operation getByKeyFromStorageAsyncWithHttpInfo * * @param string $key (required) * @param bool $shared (required) * @param string $x_monday_access_token (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getStorage'] to see the possible values for this operation + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getByKeyFromStorage'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function getStorageAsyncWithHttpInfo($key, $shared, $x_monday_access_token, string $contentType = self::contentTypes['getStorage'][0]) + public function getByKeyFromStorageAsyncWithHttpInfo($key, $shared, $x_monday_access_token, string $contentType = self::contentTypes['getByKeyFromStorage'][0]) { $returnType = '\OpenAPI\Client\Model\StorageDataContract'; - $request = $this->getStorageRequest($key, $shared, $x_monday_access_token, $contentType); + $request = $this->getByKeyFromStorageRequest($key, $shared, $x_monday_access_token, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) @@ -619,37 +654,37 @@ function ($exception) { } /** - * Create request for operation 'getStorage' + * Create request for operation 'getByKeyFromStorage' * * @param string $key (required) * @param bool $shared (required) * @param string $x_monday_access_token (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getStorage'] to see the possible values for this operation + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getByKeyFromStorage'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - public function getStorageRequest($key, $shared, $x_monday_access_token, string $contentType = self::contentTypes['getStorage'][0]) + public function getByKeyFromStorageRequest($key, $shared, $x_monday_access_token, string $contentType = self::contentTypes['getByKeyFromStorage'][0]) { // verify the required parameter 'key' is set if ($key === null || (is_array($key) && count($key) === 0)) { throw new \InvalidArgumentException( - 'Missing the required parameter $key when calling getStorage' + 'Missing the required parameter $key when calling getByKeyFromStorage' ); } // verify the required parameter 'shared' is set if ($shared === null || (is_array($shared) && count($shared) === 0)) { throw new \InvalidArgumentException( - 'Missing the required parameter $shared when calling getStorage' + 'Missing the required parameter $shared when calling getByKeyFromStorage' ); } // verify the required parameter 'x_monday_access_token' is set if ($x_monday_access_token === null || (is_array($x_monday_access_token) && count($x_monday_access_token) === 0)) { throw new \InvalidArgumentException( - 'Missing the required parameter $x_monday_access_token when calling getStorage' + 'Missing the required parameter $x_monday_access_token when calling getByKeyFromStorage' ); } @@ -740,41 +775,36 @@ public function getStorageRequest($key, $shared, $x_monday_access_token, string } /** - * Operation putStorage + * Operation incrementCounter * - * @param string $key key (required) * @param string $x_monday_access_token x_monday_access_token (required) - * @param bool $shared shared (required) - * @param string $previous_version previous_version (required) - * @param \OpenAPI\Client\Model\StorageDataContract $storage_data_contract storage_data_contract (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['putStorage'] to see the possible values for this operation + * @param \OpenAPI\Client\Model\IncrementCounterParams $increment_counter_params increment_counter_params (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['incrementCounter'] to see the possible values for this operation * * @throws \OpenAPI\Client\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException - * @return void + * @return mixed */ - public function putStorage($key, $x_monday_access_token, $shared, $previous_version, $storage_data_contract, string $contentType = self::contentTypes['putStorage'][0]) + public function incrementCounter($x_monday_access_token, $increment_counter_params, string $contentType = self::contentTypes['incrementCounter'][0]) { - $this->putStorageWithHttpInfo($key, $x_monday_access_token, $shared, $previous_version, $storage_data_contract, $contentType); + list($response) = $this->incrementCounterWithHttpInfo($x_monday_access_token, $increment_counter_params, $contentType); + return $response; } /** - * Operation putStorageWithHttpInfo + * Operation incrementCounterWithHttpInfo * - * @param string $key (required) * @param string $x_monday_access_token (required) - * @param bool $shared (required) - * @param string $previous_version (required) - * @param \OpenAPI\Client\Model\StorageDataContract $storage_data_contract (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['putStorage'] to see the possible values for this operation + * @param \OpenAPI\Client\Model\IncrementCounterParams $increment_counter_params (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['incrementCounter'] to see the possible values for this operation * * @throws \OpenAPI\Client\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException - * @return array of null, HTTP status code, HTTP response headers (array of strings) + * @return array of mixed, HTTP status code, HTTP response headers (array of strings) */ - public function putStorageWithHttpInfo($key, $x_monday_access_token, $shared, $previous_version, $storage_data_contract, string $contentType = self::contentTypes['putStorage'][0]) + public function incrementCounterWithHttpInfo($x_monday_access_token, $increment_counter_params, string $contentType = self::contentTypes['incrementCounter'][0]) { - $request = $this->putStorageRequest($key, $x_monday_access_token, $shared, $previous_version, $storage_data_contract, $contentType); + $request = $this->incrementCounterRequest($x_monday_access_token, $increment_counter_params, $contentType); try { $options = $this->createHttpClientOption(); @@ -811,31 +841,92 @@ public function putStorageWithHttpInfo($key, $x_monday_access_token, $shared, $p ); } - return [null, $statusCode, $response->getHeaders()]; + switch($statusCode) { + case 200: + if ('mixed' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('mixed' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, 'mixed', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = 'mixed'; + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; } catch (ApiException $e) { switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + 'mixed', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; } throw $e; } } /** - * Operation putStorageAsync + * Operation incrementCounterAsync * - * @param string $key (required) * @param string $x_monday_access_token (required) - * @param bool $shared (required) - * @param string $previous_version (required) - * @param \OpenAPI\Client\Model\StorageDataContract $storage_data_contract (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['putStorage'] to see the possible values for this operation + * @param \OpenAPI\Client\Model\IncrementCounterParams $increment_counter_params (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['incrementCounter'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function putStorageAsync($key, $x_monday_access_token, $shared, $previous_version, $storage_data_contract, string $contentType = self::contentTypes['putStorage'][0]) + public function incrementCounterAsync($x_monday_access_token, $increment_counter_params, string $contentType = self::contentTypes['incrementCounter'][0]) { - return $this->putStorageAsyncWithHttpInfo($key, $x_monday_access_token, $shared, $previous_version, $storage_data_contract, $contentType) + return $this->incrementCounterAsyncWithHttpInfo($x_monday_access_token, $increment_counter_params, $contentType) ->then( function ($response) { return $response[0]; @@ -844,28 +935,38 @@ function ($response) { } /** - * Operation putStorageAsyncWithHttpInfo + * Operation incrementCounterAsyncWithHttpInfo * - * @param string $key (required) * @param string $x_monday_access_token (required) - * @param bool $shared (required) - * @param string $previous_version (required) - * @param \OpenAPI\Client\Model\StorageDataContract $storage_data_contract (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['putStorage'] to see the possible values for this operation + * @param \OpenAPI\Client\Model\IncrementCounterParams $increment_counter_params (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['incrementCounter'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function putStorageAsyncWithHttpInfo($key, $x_monday_access_token, $shared, $previous_version, $storage_data_contract, string $contentType = self::contentTypes['putStorage'][0]) + public function incrementCounterAsyncWithHttpInfo($x_monday_access_token, $increment_counter_params, string $contentType = self::contentTypes['incrementCounter'][0]) { - $returnType = ''; - $request = $this->putStorageRequest($key, $x_monday_access_token, $shared, $previous_version, $storage_data_contract, $contentType); + $returnType = 'mixed'; + $request = $this->incrementCounterRequest($x_monday_access_token, $increment_counter_params, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { - return [null, $response->getStatusCode(), $response->getHeaders()]; + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; }, function ($exception) { $response = $exception->getResponse(); @@ -885,111 +986,61 @@ function ($exception) { } /** - * Create request for operation 'putStorage' + * Create request for operation 'incrementCounter' * - * @param string $key (required) * @param string $x_monday_access_token (required) - * @param bool $shared (required) - * @param string $previous_version (required) - * @param \OpenAPI\Client\Model\StorageDataContract $storage_data_contract (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['putStorage'] to see the possible values for this operation + * @param \OpenAPI\Client\Model\IncrementCounterParams $increment_counter_params (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['incrementCounter'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - public function putStorageRequest($key, $x_monday_access_token, $shared, $previous_version, $storage_data_contract, string $contentType = self::contentTypes['putStorage'][0]) + public function incrementCounterRequest($x_monday_access_token, $increment_counter_params, string $contentType = self::contentTypes['incrementCounter'][0]) { - // verify the required parameter 'key' is set - if ($key === null || (is_array($key) && count($key) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $key when calling putStorage' - ); - } - // verify the required parameter 'x_monday_access_token' is set if ($x_monday_access_token === null || (is_array($x_monday_access_token) && count($x_monday_access_token) === 0)) { throw new \InvalidArgumentException( - 'Missing the required parameter $x_monday_access_token when calling putStorage' - ); - } - - // verify the required parameter 'shared' is set - if ($shared === null || (is_array($shared) && count($shared) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $shared when calling putStorage' - ); - } - - // verify the required parameter 'previous_version' is set - if ($previous_version === null || (is_array($previous_version) && count($previous_version) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $previous_version when calling putStorage' + 'Missing the required parameter $x_monday_access_token when calling incrementCounter' ); } - // verify the required parameter 'storage_data_contract' is set - if ($storage_data_contract === null || (is_array($storage_data_contract) && count($storage_data_contract) === 0)) { + // verify the required parameter 'increment_counter_params' is set + if ($increment_counter_params === null || (is_array($increment_counter_params) && count($increment_counter_params) === 0)) { throw new \InvalidArgumentException( - 'Missing the required parameter $storage_data_contract when calling putStorage' + 'Missing the required parameter $increment_counter_params when calling incrementCounter' ); } - $resourcePath = '/storage/{key}'; + $resourcePath = '/storage/counter/increment'; $formParams = []; $queryParams = []; $headerParams = []; $httpBody = ''; $multipart = false; - // query params - $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( - $shared, - 'shared', // param base name - 'boolean', // openApiType - 'form', // style - true, // explode - true // required - ) ?? []); - // query params - $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( - $previous_version, - 'previousVersion', // param base name - 'string', // openApiType - 'form', // style - true, // explode - true // required - ) ?? []); // header params if ($x_monday_access_token !== null) { $headerParams['x-monday-access-token'] = ObjectSerializer::toHeaderValue($x_monday_access_token); } - // path params - if ($key !== null) { - $resourcePath = str_replace( - '{' . 'key' . '}', - ObjectSerializer::toPathValue($key), - $resourcePath - ); - } $headers = $this->headerSelector->selectHeaders( - [], + ['application/json', ], $contentType, $multipart ); // for model (json/xml) - if (isset($storage_data_contract)) { + if (isset($increment_counter_params)) { if (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the body - $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($storage_data_contract)); + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($increment_counter_params)); } else { - $httpBody = $storage_data_contract; + $httpBody = $increment_counter_params; } } elseif (count($formParams) > 0) { if ($multipart) { @@ -1038,37 +1089,42 @@ public function putStorageRequest($key, $x_monday_access_token, $shared, $previo } /** - * Operation storageIncrementCounter + * Operation upsertByKeyFromStorage * - * @param string $x_monday_access_token x_monday_access_token (required) * @param string $key key (required) - * @param \OpenAPI\Client\Model\IncrementCounterParams $increment_counter_params increment_counter_params (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['storageIncrementCounter'] to see the possible values for this operation + * @param string $x_monday_access_token x_monday_access_token (required) + * @param \OpenAPI\Client\Model\StorageDataContract $storage_data_contract storage_data_contract (required) + * @param bool $shared shared (optional) + * @param string $previous_version previous_version (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['upsertByKeyFromStorage'] to see the possible values for this operation * * @throws \OpenAPI\Client\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException - * @return void + * @return mixed */ - public function storageIncrementCounter($x_monday_access_token, $key, $increment_counter_params, string $contentType = self::contentTypes['storageIncrementCounter'][0]) + public function upsertByKeyFromStorage($key, $x_monday_access_token, $storage_data_contract, $shared = null, $previous_version = null, string $contentType = self::contentTypes['upsertByKeyFromStorage'][0]) { - $this->storageIncrementCounterWithHttpInfo($x_monday_access_token, $key, $increment_counter_params, $contentType); + list($response) = $this->upsertByKeyFromStorageWithHttpInfo($key, $x_monday_access_token, $storage_data_contract, $shared, $previous_version, $contentType); + return $response; } /** - * Operation storageIncrementCounterWithHttpInfo + * Operation upsertByKeyFromStorageWithHttpInfo * - * @param string $x_monday_access_token (required) * @param string $key (required) - * @param \OpenAPI\Client\Model\IncrementCounterParams $increment_counter_params (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['storageIncrementCounter'] to see the possible values for this operation + * @param string $x_monday_access_token (required) + * @param \OpenAPI\Client\Model\StorageDataContract $storage_data_contract (required) + * @param bool $shared (optional) + * @param string $previous_version (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['upsertByKeyFromStorage'] to see the possible values for this operation * * @throws \OpenAPI\Client\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException - * @return array of null, HTTP status code, HTTP response headers (array of strings) + * @return array of mixed, HTTP status code, HTTP response headers (array of strings) */ - public function storageIncrementCounterWithHttpInfo($x_monday_access_token, $key, $increment_counter_params, string $contentType = self::contentTypes['storageIncrementCounter'][0]) + public function upsertByKeyFromStorageWithHttpInfo($key, $x_monday_access_token, $storage_data_contract, $shared = null, $previous_version = null, string $contentType = self::contentTypes['upsertByKeyFromStorage'][0]) { - $request = $this->storageIncrementCounterRequest($x_monday_access_token, $key, $increment_counter_params, $contentType); + $request = $this->upsertByKeyFromStorageRequest($key, $x_monday_access_token, $storage_data_contract, $shared, $previous_version, $contentType); try { $options = $this->createHttpClientOption(); @@ -1105,29 +1161,95 @@ public function storageIncrementCounterWithHttpInfo($x_monday_access_token, $key ); } - return [null, $statusCode, $response->getHeaders()]; + switch($statusCode) { + case 200: + if ('mixed' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('mixed' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, 'mixed', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = 'mixed'; + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; } catch (ApiException $e) { switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + 'mixed', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; } throw $e; } } /** - * Operation storageIncrementCounterAsync + * Operation upsertByKeyFromStorageAsync * - * @param string $x_monday_access_token (required) * @param string $key (required) - * @param \OpenAPI\Client\Model\IncrementCounterParams $increment_counter_params (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['storageIncrementCounter'] to see the possible values for this operation + * @param string $x_monday_access_token (required) + * @param \OpenAPI\Client\Model\StorageDataContract $storage_data_contract (required) + * @param bool $shared (optional) + * @param string $previous_version (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['upsertByKeyFromStorage'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function storageIncrementCounterAsync($x_monday_access_token, $key, $increment_counter_params, string $contentType = self::contentTypes['storageIncrementCounter'][0]) + public function upsertByKeyFromStorageAsync($key, $x_monday_access_token, $storage_data_contract, $shared = null, $previous_version = null, string $contentType = self::contentTypes['upsertByKeyFromStorage'][0]) { - return $this->storageIncrementCounterAsyncWithHttpInfo($x_monday_access_token, $key, $increment_counter_params, $contentType) + return $this->upsertByKeyFromStorageAsyncWithHttpInfo($key, $x_monday_access_token, $storage_data_contract, $shared, $previous_version, $contentType) ->then( function ($response) { return $response[0]; @@ -1136,26 +1258,41 @@ function ($response) { } /** - * Operation storageIncrementCounterAsyncWithHttpInfo + * Operation upsertByKeyFromStorageAsyncWithHttpInfo * - * @param string $x_monday_access_token (required) * @param string $key (required) - * @param \OpenAPI\Client\Model\IncrementCounterParams $increment_counter_params (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['storageIncrementCounter'] to see the possible values for this operation + * @param string $x_monday_access_token (required) + * @param \OpenAPI\Client\Model\StorageDataContract $storage_data_contract (required) + * @param bool $shared (optional) + * @param string $previous_version (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['upsertByKeyFromStorage'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function storageIncrementCounterAsyncWithHttpInfo($x_monday_access_token, $key, $increment_counter_params, string $contentType = self::contentTypes['storageIncrementCounter'][0]) + public function upsertByKeyFromStorageAsyncWithHttpInfo($key, $x_monday_access_token, $storage_data_contract, $shared = null, $previous_version = null, string $contentType = self::contentTypes['upsertByKeyFromStorage'][0]) { - $returnType = ''; - $request = $this->storageIncrementCounterRequest($x_monday_access_token, $key, $increment_counter_params, $contentType); + $returnType = 'mixed'; + $request = $this->upsertByKeyFromStorageRequest($key, $x_monday_access_token, $storage_data_contract, $shared, $previous_version, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { - return [null, $response->getStatusCode(), $response->getHeaders()]; + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; }, function ($exception) { $response = $exception->getResponse(); @@ -1175,48 +1312,70 @@ function ($exception) { } /** - * Create request for operation 'storageIncrementCounter' + * Create request for operation 'upsertByKeyFromStorage' * - * @param string $x_monday_access_token (required) * @param string $key (required) - * @param \OpenAPI\Client\Model\IncrementCounterParams $increment_counter_params (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['storageIncrementCounter'] to see the possible values for this operation + * @param string $x_monday_access_token (required) + * @param \OpenAPI\Client\Model\StorageDataContract $storage_data_contract (required) + * @param bool $shared (optional) + * @param string $previous_version (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['upsertByKeyFromStorage'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - public function storageIncrementCounterRequest($x_monday_access_token, $key, $increment_counter_params, string $contentType = self::contentTypes['storageIncrementCounter'][0]) + public function upsertByKeyFromStorageRequest($key, $x_monday_access_token, $storage_data_contract, $shared = null, $previous_version = null, string $contentType = self::contentTypes['upsertByKeyFromStorage'][0]) { - // verify the required parameter 'x_monday_access_token' is set - if ($x_monday_access_token === null || (is_array($x_monday_access_token) && count($x_monday_access_token) === 0)) { + // verify the required parameter 'key' is set + if ($key === null || (is_array($key) && count($key) === 0)) { throw new \InvalidArgumentException( - 'Missing the required parameter $x_monday_access_token when calling storageIncrementCounter' + 'Missing the required parameter $key when calling upsertByKeyFromStorage' ); } - // verify the required parameter 'key' is set - if ($key === null || (is_array($key) && count($key) === 0)) { + // verify the required parameter 'x_monday_access_token' is set + if ($x_monday_access_token === null || (is_array($x_monday_access_token) && count($x_monday_access_token) === 0)) { throw new \InvalidArgumentException( - 'Missing the required parameter $key when calling storageIncrementCounter' + 'Missing the required parameter $x_monday_access_token when calling upsertByKeyFromStorage' ); } - // verify the required parameter 'increment_counter_params' is set - if ($increment_counter_params === null || (is_array($increment_counter_params) && count($increment_counter_params) === 0)) { + // verify the required parameter 'storage_data_contract' is set + if ($storage_data_contract === null || (is_array($storage_data_contract) && count($storage_data_contract) === 0)) { throw new \InvalidArgumentException( - 'Missing the required parameter $increment_counter_params when calling storageIncrementCounter' + 'Missing the required parameter $storage_data_contract when calling upsertByKeyFromStorage' ); } - $resourcePath = '/storage/{key}/counter/increment'; + + + $resourcePath = '/storage/{key}'; $formParams = []; $queryParams = []; $headerParams = []; $httpBody = ''; $multipart = false; + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $shared, + 'shared', // param base name + 'boolean', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $previous_version, + 'previousVersion', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); // header params if ($x_monday_access_token !== null) { @@ -1234,18 +1393,18 @@ public function storageIncrementCounterRequest($x_monday_access_token, $key, $in $headers = $this->headerSelector->selectHeaders( - [], + ['application/json', ], $contentType, $multipart ); // for model (json/xml) - if (isset($increment_counter_params)) { + if (isset($storage_data_contract)) { if (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the body - $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($increment_counter_params)); + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($storage_data_contract)); } else { - $httpBody = $increment_counter_params; + $httpBody = $storage_data_contract; } } elseif (count($formParams) > 0) { if ($multipart) { diff --git a/lib/ApiException.php b/lib/ApiException.php index 5755519..e356390 100644 --- a/lib/ApiException.php +++ b/lib/ApiException.php @@ -16,7 +16,7 @@ * * The version of the OpenAPI document: 0.0.1 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.4.0-SNAPSHOT + * Generator version: 7.7.0-SNAPSHOT */ /** diff --git a/lib/Configuration.php b/lib/Configuration.php index fdb2d27..e73deaa 100644 --- a/lib/Configuration.php +++ b/lib/Configuration.php @@ -16,7 +16,7 @@ * * The version of the OpenAPI document: 0.0.1 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.4.0-SNAPSHOT + * Generator version: 7.7.0-SNAPSHOT */ /** diff --git a/lib/HeaderSelector.php b/lib/HeaderSelector.php index 8e82c1d..8beeb6b 100644 --- a/lib/HeaderSelector.php +++ b/lib/HeaderSelector.php @@ -16,7 +16,7 @@ * * The version of the OpenAPI document: 0.0.1 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.4.0-SNAPSHOT + * Generator version: 7.7.0-SNAPSHOT */ /** diff --git a/lib/Model/GetStorage404Response.php b/lib/Model/GetByKeyFromStorage404Response.php similarity index 96% rename from lib/Model/GetStorage404Response.php rename to lib/Model/GetByKeyFromStorage404Response.php index ec149e5..80742db 100644 --- a/lib/Model/GetStorage404Response.php +++ b/lib/Model/GetByKeyFromStorage404Response.php @@ -1,6 +1,6 @@ */ -class GetStorage404Response implements ModelInterface, ArrayAccess, \JsonSerializable +class GetByKeyFromStorage404Response implements ModelInterface, ArrayAccess, \JsonSerializable { public const DISCRIMINATOR = null; @@ -49,7 +49,7 @@ class GetStorage404Response implements ModelInterface, ArrayAccess, \JsonSeriali * * @var string */ - protected static $openAPIModelName = 'getStorage_404_response'; + protected static $openAPIModelName = 'getByKeyFromStorage_404_response'; /** * Array of property to type mappings. Used for (de)serialization diff --git a/lib/Model/GetByKeyFromStorage500Response.php b/lib/Model/GetByKeyFromStorage500Response.php new file mode 100644 index 0000000..d1cb6e8 --- /dev/null +++ b/lib/Model/GetByKeyFromStorage500Response.php @@ -0,0 +1,409 @@ + + */ +class GetByKeyFromStorage500Response implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'getByKeyFromStorage_500_response'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'reason' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'reason' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'reason' => 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 = [ + 'reason' => 'reason' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'reason' => 'setReason' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'reason' => 'getReason' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('reason', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param 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 = []; + + 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 reason + * + * @return string|null + */ + public function getReason() + { + return $this->container['reason']; + } + + /** + * Sets reason + * + * @param string|null $reason reason + * + * @return self + */ + public function setReason($reason) + { + if (is_null($reason)) { + throw new \InvalidArgumentException('non-nullable reason cannot be null'); + } + $this->container['reason'] = $reason; + + 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/lib/Model/IncrementCounterParams.php b/lib/Model/IncrementCounterParams.php index 1296e42..abf3fdd 100644 --- a/lib/Model/IncrementCounterParams.php +++ b/lib/Model/IncrementCounterParams.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: 0.0.1 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.4.0-SNAPSHOT + * Generator version: 7.7.0-SNAPSHOT */ /** diff --git a/lib/Model/JsonValue.php b/lib/Model/JsonValue.php index 03c747b..dfcae83 100644 --- a/lib/Model/JsonValue.php +++ b/lib/Model/JsonValue.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: 0.0.1 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.4.0-SNAPSHOT + * Generator version: 7.7.0-SNAPSHOT */ /** diff --git a/lib/Model/LogMethods.php b/lib/Model/LogMethods.php new file mode 100644 index 0000000..968ea26 --- /dev/null +++ b/lib/Model/LogMethods.php @@ -0,0 +1,68 @@ + + */ +class SecureStorageDataContract implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'SecureStorageDataContract'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'value' => 'mixed' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'value' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'value' => true + ]; + + /** + * 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 = [ + 'value' => 'value' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'value' => 'setValue' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'value' => 'getValue' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('value', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param 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['value'] === null) { + $invalidProperties[] = "'value' 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 value + * + * @return mixed + */ + public function getValue() + { + return $this->container['value']; + } + + /** + * Sets value + * + * @param mixed $value value + * + * @return self + */ + public function setValue($value) + { + if (is_null($value)) { + array_push($this->openAPINullablesSetToNull, 'value'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('value', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['value'] = $value; + + 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/lib/Model/StorageDataContract.php b/lib/Model/StorageDataContract.php index 808fc1b..cd0d3c0 100644 --- a/lib/Model/StorageDataContract.php +++ b/lib/Model/StorageDataContract.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: 0.0.1 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.4.0-SNAPSHOT + * Generator version: 7.7.0-SNAPSHOT */ /** @@ -57,7 +57,8 @@ class StorageDataContract implements ModelInterface, ArrayAccess, \JsonSerializa * @var string[] */ protected static $openAPITypes = [ - 'value' => 'mixed' + 'version' => 'string', + 'value' => '\OpenAPI\Client\Model\JsonValue' ]; /** @@ -68,6 +69,7 @@ class StorageDataContract implements ModelInterface, ArrayAccess, \JsonSerializa * @psalm-var array */ protected static $openAPIFormats = [ + 'version' => null, 'value' => null ]; @@ -77,6 +79,7 @@ class StorageDataContract implements ModelInterface, ArrayAccess, \JsonSerializa * @var boolean[] */ protected static array $openAPINullables = [ + 'version' => false, 'value' => true ]; @@ -166,6 +169,7 @@ public function isNullableSetToNull(string $property): bool * @var string[] */ protected static $attributeMap = [ + 'version' => 'version', 'value' => 'value' ]; @@ -175,6 +179,7 @@ public function isNullableSetToNull(string $property): bool * @var string[] */ protected static $setters = [ + 'version' => 'setVersion', 'value' => 'setValue' ]; @@ -184,6 +189,7 @@ public function isNullableSetToNull(string $property): bool * @var string[] */ protected static $getters = [ + 'version' => 'getVersion', 'value' => 'getValue' ]; @@ -244,6 +250,7 @@ public function getModelName() */ public function __construct(array $data = null) { + $this->setIfExists('version', $data ?? [], null); $this->setIfExists('value', $data ?? [], null); } @@ -274,6 +281,9 @@ public function listInvalidProperties() { $invalidProperties = []; + if ($this->container['version'] === null) { + $invalidProperties[] = "'version' can't be null"; + } if ($this->container['value'] === null) { $invalidProperties[] = "'value' can't be null"; } @@ -292,10 +302,37 @@ public function valid() } + /** + * Gets version + * + * @return string + */ + public function getVersion() + { + return $this->container['version']; + } + + /** + * Sets version + * + * @param string $version version + * + * @return self + */ + public function setVersion($version) + { + if (is_null($version)) { + throw new \InvalidArgumentException('non-nullable version cannot be null'); + } + $this->container['version'] = $version; + + return $this; + } + /** * Gets value * - * @return mixed + * @return \OpenAPI\Client\Model\JsonValue */ public function getValue() { @@ -305,7 +342,7 @@ public function getValue() /** * Sets value * - * @param mixed $value value + * @param \OpenAPI\Client\Model\JsonValue $value value * * @return self */ diff --git a/lib/Model/ValidateSecretParams.php b/lib/Model/ValidateSecretParams.php index 07c3a61..5354964 100644 --- a/lib/Model/ValidateSecretParams.php +++ b/lib/Model/ValidateSecretParams.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: 0.0.1 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.4.0-SNAPSHOT + * Generator version: 7.7.0-SNAPSHOT */ /** diff --git a/lib/Model/ValidateSecretResponse.php b/lib/Model/ValidateSecretResponse.php index 341c66a..06a1b97 100644 --- a/lib/Model/ValidateSecretResponse.php +++ b/lib/Model/ValidateSecretResponse.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: 0.0.1 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.4.0-SNAPSHOT + * Generator version: 7.7.0-SNAPSHOT */ /** diff --git a/lib/Model/WriteLogRequestBody.php b/lib/Model/WriteLogRequestBody.php new file mode 100644 index 0000000..8134e84 --- /dev/null +++ b/lib/Model/WriteLogRequestBody.php @@ -0,0 +1,483 @@ + + */ +class WriteLogRequestBody implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'WriteLogRequestBody'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'error' => '\OpenAPI\Client\Model\WriteLogRequestBodyError', + 'message' => 'string', + 'method' => '\OpenAPI\Client\Model\LogMethods' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'error' => null, + 'message' => null, + 'method' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'error' => false, + 'message' => false, + 'method' => 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 = [ + 'error' => 'error', + 'message' => 'message', + 'method' => 'method' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'error' => 'setError', + 'message' => 'setMessage', + 'method' => 'setMethod' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'error' => 'getError', + 'message' => 'getMessage', + 'method' => 'getMethod' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('error', $data ?? [], null); + $this->setIfExists('message', $data ?? [], null); + $this->setIfExists('method', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param 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['message'] === null) { + $invalidProperties[] = "'message' can't be null"; + } + if ($this->container['method'] === null) { + $invalidProperties[] = "'method' 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 error + * + * @return \OpenAPI\Client\Model\WriteLogRequestBodyError|null + */ + public function getError() + { + return $this->container['error']; + } + + /** + * Sets error + * + * @param \OpenAPI\Client\Model\WriteLogRequestBodyError|null $error error + * + * @return self + */ + public function setError($error) + { + if (is_null($error)) { + throw new \InvalidArgumentException('non-nullable error cannot be null'); + } + $this->container['error'] = $error; + + 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'); + } + $this->container['message'] = $message; + + return $this; + } + + /** + * Gets method + * + * @return \OpenAPI\Client\Model\LogMethods + */ + public function getMethod() + { + return $this->container['method']; + } + + /** + * Sets method + * + * @param \OpenAPI\Client\Model\LogMethods $method method + * + * @return self + */ + public function setMethod($method) + { + if (is_null($method)) { + throw new \InvalidArgumentException('non-nullable method cannot be null'); + } + $this->container['method'] = $method; + + 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/lib/Model/WriteLogRequestBodyError.php b/lib/Model/WriteLogRequestBodyError.php new file mode 100644 index 0000000..fc2b88f --- /dev/null +++ b/lib/Model/WriteLogRequestBodyError.php @@ -0,0 +1,381 @@ + + */ +class WriteLogRequestBodyError implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'WriteLogRequestBody_error'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + 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 = [ + + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param 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 = []; + + 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; + } + + /** + * 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/lib/ObjectSerializer.php b/lib/ObjectSerializer.php index c9b3ec0..a1d8f0c 100644 --- a/lib/ObjectSerializer.php +++ b/lib/ObjectSerializer.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: 0.0.1 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.4.0-SNAPSHOT + * Generator version: 7.7.0-SNAPSHOT */ /** @@ -396,7 +396,6 @@ public static function serializeCollection(array $collection, $style, $allowColl * @param mixed $data object or primitive to be deserialized * @param string $class class name is passed as a string * @param string[] $httpHeaders HTTP headers - * @param string $discriminator discriminator if polymorphism is used * * @return object|array|null a single or an array of $class instances */ @@ -546,22 +545,64 @@ public static function deserialize($data, $class, $httpHeaders = null) } /** - * Native `http_build_query` wrapper. - * @see https://www.php.net/manual/en/function.http-build-query - * - * @param array|object $data May be an array or object containing properties. - * @param string $numeric_prefix If numeric indices are used in the base array and this parameter is provided, it will be prepended to the numeric index for elements in the base array only. - * @param string|null $arg_separator arg_separator.output is used to separate arguments but may be overridden by specifying this parameter. - * @param int $encoding_type Encoding type. By default, PHP_QUERY_RFC1738. - * - * @return string - */ - public static function buildQuery( - $data, - string $numeric_prefix = '', - ?string $arg_separator = null, - int $encoding_type = \PHP_QUERY_RFC3986 - ): string { - return \GuzzleHttp\Psr7\Query::build($data, $encoding_type); + * Build a query string from an array of key value pairs. + * + * This function can use the return value of `parse()` to build a query + * string. This function does not modify the provided keys when an array is + * encountered (like `http_build_query()` would). + * + * The function is copied from https://github.com/guzzle/psr7/blob/a243f80a1ca7fe8ceed4deee17f12c1930efe662/src/Query.php#L59-L112 + * with a modification which is described in https://github.com/guzzle/psr7/pull/603 + * + * @param array $params Query string parameters. + * @param int|false $encoding Set to false to not encode, PHP_QUERY_RFC3986 + * to encode using RFC3986, or PHP_QUERY_RFC1738 + * to encode using RFC1738. + */ + public static function buildQuery(array $params, $encoding = PHP_QUERY_RFC3986): string + { + if (!$params) { + return ''; + } + + if ($encoding === false) { + $encoder = function (string $str): string { + return $str; + }; + } elseif ($encoding === PHP_QUERY_RFC3986) { + $encoder = 'rawurlencode'; + } elseif ($encoding === PHP_QUERY_RFC1738) { + $encoder = 'urlencode'; + } else { + throw new \InvalidArgumentException('Invalid type'); + } + + $castBool = Configuration::BOOLEAN_FORMAT_INT == Configuration::getDefaultConfiguration()->getBooleanFormatForQueryString() + ? function ($v) { return (int) $v; } + : function ($v) { return $v ? 'true' : 'false'; }; + + $qs = ''; + foreach ($params as $k => $v) { + $k = $encoder((string) $k); + if (!is_array($v)) { + $qs .= $k; + $v = is_bool($v) ? $castBool($v) : $v; + if ($v !== null) { + $qs .= '='.$encoder((string) $v); + } + $qs .= '&'; + } else { + foreach ($v as $vv) { + $qs .= $k; + $vv = is_bool($vv) ? $castBool($vv) : $vv; + if ($vv !== null) { + $qs .= '='.$encoder((string) $vv); + } + $qs .= '&'; + } + } + } + + return $qs ? (string) substr($qs, 0, -1) : ''; } } diff --git a/test/Api/EnvironmentVariablesApiTest.php b/test/Api/EnvironmentVariablesApiTest.php new file mode 100644 index 0000000..ef88aba --- /dev/null +++ b/test/Api/EnvironmentVariablesApiTest.php @@ -0,0 +1,97 @@ +