diff --git a/utils/sdk/Makefile b/utils/sdk/Makefile index a2bbc27d..93fc8dd6 100644 --- a/utils/sdk/Makefile +++ b/utils/sdk/Makefile @@ -21,7 +21,7 @@ go: POST_BUILD_HOOK = (cd $(BUILD_DIR)/go && go mod edit -module github.com/leth # For the 'go' target, set the generator name correctly. go: GENERATOR_NAME = go - +php: GENERATOR_NAME = php-nextgen # --- Main Targets --- all: build @@ -34,6 +34,8 @@ build: $(SDK_TARGETS) $(SDK_TARGETS): %: packages/%.json # Default generator name is the target name itself. $(eval GENERATOR_NAME = $@) + # Ensure the output directory exists, cross-platform. + @cmake -E make_directory "$(BUILD_DIR)/$@" @echo "--> Creating .openapi-generator-ignore file" @echo "git_push.sh" > "$(BUILD_DIR)/$@/.openapi-generator-ignore" @echo ".travis.yml" >> "$(BUILD_DIR)/$@/.openapi-generator-ignore" @@ -45,7 +47,7 @@ $(SDK_TARGETS): %: packages/%.json rm -rf "$(BUILD_DIR)/$@/*" export TS_POST_PROCESS_FILE="/usr/local/bin/prettier --write" && \ openapi-generator generate --minimal-update --git-host "github.com" --git-repo-id "blockchain" --git-user-id "letheanVPN" \ - -i "$(BASE_DIR)/spec/oas-3.0.0.json" \ + -i "$(BASE_DIR)/spec/oas-3.0.0.json" --group-id "lthn" \ -g "$(GENERATOR_NAME)" \ -o "$(BUILD_DIR)/$@" \ -c "$<" \ diff --git a/utils/sdk/client/php/.gitignore b/utils/sdk/client/php/.gitignore new file mode 100644 index 00000000..cc2a4bdc --- /dev/null +++ b/utils/sdk/client/php/.gitignore @@ -0,0 +1,19 @@ +# ref: https://github.com/github/gitignore/blob/master/Composer.gitignore + +composer.phar +/vendor/ + +# Commit your application's lock file https://getcomposer.org/doc/01-basic-usage.md#commit-your-composer-lock-file-to-version-control +# You may choose to ignore a library lock file http://getcomposer.org/doc/02-libraries.md#lock-file +# makes sense since it's a library(client SDK) and not a project +composer.lock + +# php-cs-fixer cache +.php_cs.cache +.php-cs-fixer.cache + +# PHPUnit cache +.phpunit.result.cache + +# PHPLint cache +build/phplint.cache diff --git a/utils/sdk/client/php/.openapi-generator-ignore b/utils/sdk/client/php/.openapi-generator-ignore new file mode 100644 index 00000000..def5120f --- /dev/null +++ b/utils/sdk/client/php/.openapi-generator-ignore @@ -0,0 +1,3 @@ +git_push.sh +.travis.yml +README.md diff --git a/utils/sdk/client/php/.openapi-generator/FILES b/utils/sdk/client/php/.openapi-generator/FILES new file mode 100644 index 00000000..36966ecc --- /dev/null +++ b/utils/sdk/client/php/.openapi-generator/FILES @@ -0,0 +1,57 @@ +.gitignore +.php-cs-fixer.dist.php +.phplint.yml +composer.json +docs/Api/BlockApi.md +docs/Api/InfoApi.md +docs/Model/BlockDetailsModel.md +docs/Model/BlockProcessingPerformanceModel.md +docs/Model/BlockTemplateModel.md +docs/Model/BlockTemplateRequestModel.md +docs/Model/DbStatInfoModel.md +docs/Model/HeightModel.md +docs/Model/InfoModel.md +docs/Model/MaintainersInfoModel.md +docs/Model/PerformanceModel.md +docs/Model/PosEntryModel.md +docs/Model/SubmitBlockRequestModel.md +docs/Model/SubmitBlockResponseModel.md +docs/Model/TransactionAttachmentModel.md +docs/Model/TransactionDetailsModel.md +docs/Model/TransactionExtraModel.md +docs/Model/TransactionInputModel.md +docs/Model/TransactionOutputModel.md +docs/Model/TxGenerationContextModel.md +docs/Model/TxPoolPerformanceModel.md +docs/Model/TxProcessingPerformanceModel.md +docs/Model/VersionModel.md +phpunit.xml.dist +src/ApiException.php +src/BlockApi.php +src/BlockDetailsModel.php +src/BlockProcessingPerformanceModel.php +src/BlockTemplateModel.php +src/BlockTemplateRequestModel.php +src/Configuration.php +src/DbStatInfoModel.php +src/FormDataProcessor.php +src/HeaderSelector.php +src/HeightModel.php +src/InfoApi.php +src/InfoModel.php +src/MaintainersInfoModel.php +src/ModelInterface.php +src/ObjectSerializer.php +src/PerformanceModel.php +src/PosEntryModel.php +src/SubmitBlockRequestModel.php +src/SubmitBlockResponseModel.php +src/TransactionAttachmentModel.php +src/TransactionDetailsModel.php +src/TransactionExtraModel.php +src/TransactionInputModel.php +src/TransactionOutputModel.php +src/TxGenerationContextModel.php +src/TxPoolPerformanceModel.php +src/TxProcessingPerformanceModel.php +src/VersionModel.php diff --git a/utils/sdk/client/php/.openapi-generator/VERSION b/utils/sdk/client/php/.openapi-generator/VERSION new file mode 100644 index 00000000..971ecb25 --- /dev/null +++ b/utils/sdk/client/php/.openapi-generator/VERSION @@ -0,0 +1 @@ +7.16.0 diff --git a/utils/sdk/client/php/.php-cs-fixer.dist.php b/utils/sdk/client/php/.php-cs-fixer.dist.php new file mode 100644 index 00000000..af9cf39f --- /dev/null +++ b/utils/sdk/client/php/.php-cs-fixer.dist.php @@ -0,0 +1,29 @@ +in(__DIR__) + ->exclude('vendor') + ->exclude('test') + ->exclude('tests') +; + +$config = new PhpCsFixer\Config(); +return $config->setRules([ + '@PSR12' => true, + 'phpdoc_order' => true, + 'array_syntax' => [ 'syntax' => 'short' ], + 'strict_comparison' => true, + 'strict_param' => true, + 'no_trailing_whitespace' => false, + 'no_trailing_whitespace_in_comment' => false, + 'braces' => false, + 'single_blank_line_at_eof' => false, + 'blank_line_after_namespace' => false, + 'no_leading_import_slash' => false, + ]) + ->setFinder($finder) +; diff --git a/utils/sdk/client/php/.phplint.yml b/utils/sdk/client/php/.phplint.yml new file mode 100644 index 00000000..ef4be48f --- /dev/null +++ b/utils/sdk/client/php/.phplint.yml @@ -0,0 +1,11 @@ +path: + - ./src + - ./tests +jobs: 10 +extensions: + - php +exclude: + - vendor +warning: true +memory-limit: -1 +no-cache: true diff --git a/utils/sdk/client/php/composer.json b/utils/sdk/client/php/composer.json new file mode 100644 index 00000000..ecd3f5f2 --- /dev/null +++ b/utils/sdk/client/php/composer.json @@ -0,0 +1,47 @@ +{ + "name": "letheanvpn/blockchain", + "version": "6.0.1", + "description": "OpenAPI for Lethean Blockchain", + "keywords": [ + "openapitools", + "openapi-generator", + "openapi", + "php", + "sdk", + "rest", + "api" + ], + "homepage": "https://openapi-generator.tech", + "license": "unlicense", + "authors": [ + { + "name": "OpenAPI-Generator contributors", + "homepage": "https://openapi-generator.tech" + } + ], + "require": { + "php": "^8.1", + "ext-curl": "*", + "ext-json": "*", + "ext-mbstring": "*", + "guzzlehttp/guzzle": "^7.4.5", + "guzzlehttp/psr7": "^2.0" + }, + "require-dev": { + "friendsofphp/php-cs-fixer": "^3.5", + "overtrue/phplint": "^9.0", + "phpunit/phpunit": "^9.0" + }, + "autoload": { + "psr-4": { "lthn\\" : "src/" } + }, + "autoload-dev": { + "psr-4": { "lthn\\Test\\" : "tests/" } + }, + "scripts": { + "test": [ + "@phplint" + ], + "phplint": "phplint" + } +} diff --git a/utils/sdk/client/php/docs/Api/BlockApi.md b/utils/sdk/client/php/docs/Api/BlockApi.md new file mode 100644 index 00000000..2d630bdb --- /dev/null +++ b/utils/sdk/client/php/docs/Api/BlockApi.md @@ -0,0 +1,276 @@ +# lthn\BlockApi + +All URIs are relative to http://127.0.0.1:36943, except if the operation defines another base path. + +| Method | HTTP request | Description | +| ------------- | ------------- | ------------- | +| [**createBlockTemplate()**](BlockApi.md#createBlockTemplate) | **POST** /block/template | Create a block template for mining | +| [**getBlock()**](BlockApi.md#getBlock) | **GET** /block/{identifier} | Get a block by its hash or height (ID) | +| [**getBlocks()**](BlockApi.md#getBlocks) | **GET** /block | Get one or more blocks, with optional pagination. | +| [**getHeight()**](BlockApi.md#getHeight) | **GET** /block/height | Get the current blockchain height | +| [**submitBlock()**](BlockApi.md#submitBlock) | **POST** /block/submit | Submit a new block to the network | + + +## `createBlockTemplate()` + +```php +createBlockTemplate($block_template_request_model): \lthn\lthn\BlockTemplateModel +``` + +Create a block template for mining + +### Example + +```php +createBlockTemplate($block_template_request_model); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling BlockApi->createBlockTemplate: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **block_template_request_model** | [**\lthn\lthn\BlockTemplateRequestModel**](../Model/BlockTemplateRequestModel.md)| | | + +### Return type + +[**\lthn\lthn\BlockTemplateModel**](../Model/BlockTemplateModel.md) + +### Authorization + +No authorization required + +### HTTP request headers + +- **Content-Type**: `application/json` +- **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) + +## `getBlock()` + +```php +getBlock($identifier): \lthn\lthn\BlockDetailsModel +``` + +Get a block by its hash or height (ID) + +### Example + +```php +getBlock($identifier); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling BlockApi->getBlock: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **identifier** | **string**| The hash (hex string) or height (integer) of the block to retrieve. | | + +### Return type + +[**\lthn\lthn\BlockDetailsModel**](../Model/BlockDetailsModel.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) + +## `getBlocks()` + +```php +getBlocks(): \lthn\lthn\BlockDetailsModel[] +``` + +Get one or more blocks, with optional pagination. + +### Example + +```php +getBlocks(); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling BlockApi->getBlocks: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +This endpoint does not need any parameter. + +### Return type + +[**\lthn\lthn\BlockDetailsModel[]**](../Model/BlockDetailsModel.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) + +## `getHeight()` + +```php +getHeight(): \lthn\lthn\HeightModel +``` + +Get the current blockchain height + +### Example + +```php +getHeight(); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling BlockApi->getHeight: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +This endpoint does not need any parameter. + +### Return type + +[**\lthn\lthn\HeightModel**](../Model/HeightModel.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) + +## `submitBlock()` + +```php +submitBlock($submit_block_request_model): \lthn\lthn\SubmitBlockResponseModel +``` + +Submit a new block to the network + +### Example + +```php +submitBlock($submit_block_request_model); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling BlockApi->submitBlock: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **submit_block_request_model** | [**\lthn\lthn\SubmitBlockRequestModel**](../Model/SubmitBlockRequestModel.md)| | | + +### Return type + +[**\lthn\lthn\SubmitBlockResponseModel**](../Model/SubmitBlockResponseModel.md) + +### Authorization + +No authorization required + +### HTTP request headers + +- **Content-Type**: `application/json` +- **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/utils/sdk/client/php/docs/Api/InfoApi.md b/utils/sdk/client/php/docs/Api/InfoApi.md new file mode 100644 index 00000000..5223ac2e --- /dev/null +++ b/utils/sdk/client/php/docs/Api/InfoApi.md @@ -0,0 +1,116 @@ +# lthn\InfoApi + +All URIs are relative to http://127.0.0.1:36943, except if the operation defines another base path. + +| Method | HTTP request | Description | +| ------------- | ------------- | ------------- | +| [**getInfo()**](InfoApi.md#getInfo) | **GET** /info | Get detailed information about the blockchain and daemon state | +| [**version()**](InfoApi.md#version) | **GET** /info/version | Get API version | + + +## `getInfo()` + +```php +getInfo($flags): \lthn\lthn\InfoModel +``` + +Get detailed information about the blockchain and daemon state + +### Example + +```php +getInfo($flags); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling InfoApi->getInfo: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **flags** | **string**| Possible values: net_time_delta_median, current_network_hashrate_50, current_network_hashrate_350, seconds_for_10_blocks, seconds_for_30_blocks, transactions_daily_stat, last_pos_timestamp, last_pow_timestamp, total_coins, last_block_size, tx_count_in_last_block, pos_sequence_factor, pow_sequence_factor, pos_difficulty, performance, outs_stat, expirations_median. | [optional] | + +### Return type + +[**\lthn\lthn\InfoModel**](../Model/InfoModel.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) + +## `version()` + +```php +version(): \lthn\lthn\VersionModel +``` + +Get API version + +Returns the current version of the API. + +### Example + +```php +version(); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling InfoApi->version: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +This endpoint does not need any parameter. + +### Return type + +[**\lthn\lthn\VersionModel**](../Model/VersionModel.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) diff --git a/utils/sdk/client/php/docs/Model/BlockDetailsModel.md b/utils/sdk/client/php/docs/Model/BlockDetailsModel.md new file mode 100644 index 00000000..8e356610 --- /dev/null +++ b/utils/sdk/client/php/docs/Model/BlockDetailsModel.md @@ -0,0 +1,33 @@ +# # BlockDetailsModel + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**actual_timestamp** | **int** | | [optional] +**already_generated_coins** | **string** | | [optional] +**base_reward** | **int** | | [optional] +**blob** | **string** | | [optional] +**block_cumulative_size** | **int** | | [optional] +**block_tself_size** | **int** | | [optional] +**cumulative_diff_adjusted** | **string** | | [optional] +**cumulative_diff_precise** | **string** | | [optional] +**difficulty** | **string** | | [optional] +**effective_fee_median** | **int** | | [optional] +**height** | **int** | | [optional] +**id** | **string** | | [optional] +**is_orphan** | **bool** | | [optional] +**miner_text_info** | **string** | | [optional] +**object_in_json** | **string** | | [optional] +**penalty** | **int** | | [optional] +**pow_seed** | **string** | | [optional] +**prev_id** | **string** | | [optional] +**summary_reward** | **int** | | [optional] +**this_block_fee_median** | **int** | | [optional] +**timestamp** | **int** | | [optional] +**total_fee** | **int** | | [optional] +**total_txs_size** | **int** | | [optional] +**transactions_details** | [**\lthn\lthn\TransactionDetailsModel[]**](TransactionDetailsModel.md) | | [optional] +**type** | **int** | | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/utils/sdk/client/php/docs/Model/BlockProcessingPerformanceModel.md b/utils/sdk/client/php/docs/Model/BlockProcessingPerformanceModel.md new file mode 100644 index 00000000..b9198579 --- /dev/null +++ b/utils/sdk/client/php/docs/Model/BlockProcessingPerformanceModel.md @@ -0,0 +1,24 @@ +# # BlockProcessingPerformanceModel + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**block_processing_time_0** | **int** | | [optional] +**block_processing_time_1** | **int** | | [optional] +**target_calculating_time_2** | **int** | | [optional] +**longhash_calculating_time_3** | **int** | | [optional] +**all_txs_insert_time_5** | **int** | | [optional] +**etc_stuff_6** | **int** | | [optional] +**insert_time_4** | **int** | | [optional] +**raise_block_core_event** | **int** | | [optional] +**validate_miner_transaction_time** | **int** | | [optional] +**collect_rangeproofs_data_from_tx_time** | **int** | | [optional] +**verify_multiple_zc_outs_range_proofs_time** | **int** | | [optional] +**target_calculating_enum_blocks** | **int** | | [optional] +**target_calculating_calc** | **int** | | [optional] +**pos_validate_ki_search** | **int** | | [optional] +**pos_validate_get_out_keys_for_inputs** | **int** | | [optional] +**pos_validate_zvp** | **int** | | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/utils/sdk/client/php/docs/Model/BlockTemplateModel.md b/utils/sdk/client/php/docs/Model/BlockTemplateModel.md new file mode 100644 index 00000000..8bb79f69 --- /dev/null +++ b/utils/sdk/client/php/docs/Model/BlockTemplateModel.md @@ -0,0 +1,17 @@ +# # BlockTemplateModel + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**blocktemplate_blob** | **string** | | [optional] +**difficulty** | **string** | | [optional] +**height** | **int** | | [optional] +**miner_tx_tgc** | [**\lthn\lthn\TxGenerationContextModel**](TxGenerationContextModel.md) | | [optional] +**block_reward_without_fee** | **int** | | [optional] +**block_reward** | **int** | | [optional] +**txs_fee** | **int** | | [optional] +**prev_hash** | **string** | | [optional] +**seed** | **string** | | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/utils/sdk/client/php/docs/Model/BlockTemplateRequestModel.md b/utils/sdk/client/php/docs/Model/BlockTemplateRequestModel.md new file mode 100644 index 00000000..214e7853 --- /dev/null +++ b/utils/sdk/client/php/docs/Model/BlockTemplateRequestModel.md @@ -0,0 +1,15 @@ +# # BlockTemplateRequestModel + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**miner_address** | **string** | | [optional] +**stakeholder_address** | **string** | | [optional] +**ex_nonce** | **string** | | [optional] +**pos_block** | **bool** | | [optional] +**ignore_pow_ts_check** | **bool** | | [optional] +**pe** | [**\lthn\lthn\PosEntryModel**](PosEntryModel.md) | | [optional] +**explicit_txs** | **string[]** | | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/utils/sdk/client/php/docs/Model/DbStatInfoModel.md b/utils/sdk/client/php/docs/Model/DbStatInfoModel.md new file mode 100644 index 00000000..dfa5cc35 --- /dev/null +++ b/utils/sdk/client/php/docs/Model/DbStatInfoModel.md @@ -0,0 +1,11 @@ +# # DbStatInfoModel + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**tx_count** | **int** | | [optional] +**write_tx_count** | **int** | | [optional] +**map_size** | **int** | | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/utils/sdk/client/php/docs/Model/HeightModel.md b/utils/sdk/client/php/docs/Model/HeightModel.md new file mode 100644 index 00000000..2e9ad248 --- /dev/null +++ b/utils/sdk/client/php/docs/Model/HeightModel.md @@ -0,0 +1,9 @@ +# # HeightModel + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**height** | **int** | | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/utils/sdk/client/php/docs/Model/InfoModel.md b/utils/sdk/client/php/docs/Model/InfoModel.md new file mode 100644 index 00000000..eb07800b --- /dev/null +++ b/utils/sdk/client/php/docs/Model/InfoModel.md @@ -0,0 +1,54 @@ +# # InfoModel + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**height** | **int** | | [optional] +**tx_count** | **int** | | [optional] +**tx_pool_size** | **int** | | [optional] +**alt_blocks_count** | **int** | | [optional] +**outgoing_connections_count** | **int** | | [optional] +**incoming_connections_count** | **int** | | [optional] +**synchronized_connections_count** | **int** | | [optional] +**white_peerlist_size** | **int** | | [optional] +**grey_peerlist_size** | **int** | | [optional] +**current_blocks_median** | **int** | | [optional] +**alias_count** | **int** | | [optional] +**current_max_allowed_block_size** | **int** | | [optional] +**daemon_network_state** | **string** | | [optional] +**synchronization_start_height** | **int** | | [optional] +**max_net_seen_height** | **int** | | [optional] +**mi** | [**\lthn\lthn\MaintainersInfoModel**](MaintainersInfoModel.md) | | [optional] +**pos_allowed** | **bool** | | [optional] +**pos_difficulty** | **string** | | [optional] +**pow_difficulty** | **int** | | [optional] +**default_fee** | **int** | | [optional] +**minimum_fee** | **int** | | [optional] +**is_hardfork_active** | **bool[]** | | [optional] +**net_time_delta_median** | **int** | | [optional] +**current_network_hashrate_50** | **int** | | [optional] +**current_network_hashrate_350** | **int** | | [optional] +**seconds_for_10_blocks** | **int** | | [optional] +**seconds_for_30_blocks** | **int** | | [optional] +**transactions_cnt_per_day** | **int[]** | | [optional] +**transactions_volume_per_day** | **int[]** | | [optional] +**last_pos_timestamp** | **int** | | [optional] +**last_pow_timestamp** | **int** | | [optional] +**total_coins** | **string** | | [optional] +**last_block_size** | **int** | | [optional] +**tx_count_in_last_block** | **int** | | [optional] +**pos_sequence_factor** | **float** | | [optional] +**pow_sequence_factor** | **float** | | [optional] +**block_reward** | **int** | | [optional] +**last_block_total_reward** | **int** | | [optional] +**pos_diff_total_coins_rate** | **int** | | [optional] +**last_block_timestamp** | **int** | | [optional] +**last_block_hash** | **string** | | [optional] +**pos_block_ts_shift_vs_actual** | **int** | | [optional] +**outs_stat** | **array** | | [optional] +**performance_data** | [**\lthn\lthn\PerformanceModel**](PerformanceModel.md) | | [optional] +**offers_count** | **int** | | [optional] +**expiration_median_timestamp** | **int** | | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/utils/sdk/client/php/docs/Model/MaintainersInfoModel.md b/utils/sdk/client/php/docs/Model/MaintainersInfoModel.md new file mode 100644 index 00000000..6f3d298a --- /dev/null +++ b/utils/sdk/client/php/docs/Model/MaintainersInfoModel.md @@ -0,0 +1,13 @@ +# # MaintainersInfoModel + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**ver_major** | **int** | | [optional] +**ver_minor** | **int** | | [optional] +**ver_revision** | **int** | | [optional] +**build_no** | **int** | | [optional] +**mode** | **int** | | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/utils/sdk/client/php/docs/Model/PerformanceModel.md b/utils/sdk/client/php/docs/Model/PerformanceModel.md new file mode 100644 index 00000000..5c947dfd --- /dev/null +++ b/utils/sdk/client/php/docs/Model/PerformanceModel.md @@ -0,0 +1,12 @@ +# # PerformanceModel + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**block_processing** | [**\lthn\lthn\BlockProcessingPerformanceModel**](BlockProcessingPerformanceModel.md) | | [optional] +**tx_processing** | [**\lthn\lthn\TxProcessingPerformanceModel**](TxProcessingPerformanceModel.md) | | [optional] +**tx_pool** | [**\lthn\lthn\TxPoolPerformanceModel**](TxPoolPerformanceModel.md) | | [optional] +**db_stat_info** | [**\lthn\lthn\DbStatInfoModel**](DbStatInfoModel.md) | | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/utils/sdk/client/php/docs/Model/PosEntryModel.md b/utils/sdk/client/php/docs/Model/PosEntryModel.md new file mode 100644 index 00000000..4104be3d --- /dev/null +++ b/utils/sdk/client/php/docs/Model/PosEntryModel.md @@ -0,0 +1,16 @@ +# # PosEntryModel + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**amount** | **int** | | [optional] +**g_index** | **int** | | [optional] +**keyimage** | **string** | | [optional] +**block_timestamp** | **int** | | [optional] +**stake_unlock_time** | **int** | | [optional] +**tx_id** | **string** | | [optional] +**tx_out_index** | **int** | | [optional] +**wallet_index** | **int** | | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/utils/sdk/client/php/docs/Model/SubmitBlockRequestModel.md b/utils/sdk/client/php/docs/Model/SubmitBlockRequestModel.md new file mode 100644 index 00000000..4757d442 --- /dev/null +++ b/utils/sdk/client/php/docs/Model/SubmitBlockRequestModel.md @@ -0,0 +1,9 @@ +# # SubmitBlockRequestModel + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**block_blob** | **string** | | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/utils/sdk/client/php/docs/Model/SubmitBlockResponseModel.md b/utils/sdk/client/php/docs/Model/SubmitBlockResponseModel.md new file mode 100644 index 00000000..18b82340 --- /dev/null +++ b/utils/sdk/client/php/docs/Model/SubmitBlockResponseModel.md @@ -0,0 +1,9 @@ +# # SubmitBlockResponseModel + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**status** | **string** | | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/utils/sdk/client/php/docs/Model/TransactionAttachmentModel.md b/utils/sdk/client/php/docs/Model/TransactionAttachmentModel.md new file mode 100644 index 00000000..55438099 --- /dev/null +++ b/utils/sdk/client/php/docs/Model/TransactionAttachmentModel.md @@ -0,0 +1,11 @@ +# # TransactionAttachmentModel + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**type** | **string** | | [optional] +**short_view** | **string** | | [optional] +**details_view** | **string** | | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/utils/sdk/client/php/docs/Model/TransactionDetailsModel.md b/utils/sdk/client/php/docs/Model/TransactionDetailsModel.md new file mode 100644 index 00000000..9f3641f3 --- /dev/null +++ b/utils/sdk/client/php/docs/Model/TransactionDetailsModel.md @@ -0,0 +1,21 @@ +# # TransactionDetailsModel + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**amount** | **int** | | [optional] +**attachments** | [**\lthn\lthn\TransactionAttachmentModel[]**](TransactionAttachmentModel.md) | | [optional] +**blob** | **string** | | [optional] +**blob_size** | **int** | | [optional] +**extra** | [**\lthn\lthn\TransactionExtraModel[]**](TransactionExtraModel.md) | | [optional] +**fee** | **int** | | [optional] +**id** | **string** | | [optional] +**ins** | [**\lthn\lthn\TransactionInputModel[]**](TransactionInputModel.md) | | [optional] +**keeper_block** | **int** | | [optional] +**object_in_json** | **string** | | [optional] +**outs** | [**\lthn\lthn\TransactionOutputModel[]**](TransactionOutputModel.md) | | [optional] +**pub_key** | **string** | | [optional] +**timestamp** | **int** | | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/utils/sdk/client/php/docs/Model/TransactionExtraModel.md b/utils/sdk/client/php/docs/Model/TransactionExtraModel.md new file mode 100644 index 00000000..497fbfa1 --- /dev/null +++ b/utils/sdk/client/php/docs/Model/TransactionExtraModel.md @@ -0,0 +1,11 @@ +# # TransactionExtraModel + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**type** | **string** | | [optional] +**short_view** | **string** | | [optional] +**details_view** | **string** | | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/utils/sdk/client/php/docs/Model/TransactionInputModel.md b/utils/sdk/client/php/docs/Model/TransactionInputModel.md new file mode 100644 index 00000000..017356d1 --- /dev/null +++ b/utils/sdk/client/php/docs/Model/TransactionInputModel.md @@ -0,0 +1,13 @@ +# # TransactionInputModel + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**amount** | **int** | | [optional] +**global_indexes** | **int[]** | | [optional] +**htlc_origin** | **string** | | [optional] +**kimage_or_ms_id** | **string** | | [optional] +**multisig_count** | **int** | | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/utils/sdk/client/php/docs/Model/TransactionOutputModel.md b/utils/sdk/client/php/docs/Model/TransactionOutputModel.md new file mode 100644 index 00000000..d0ff17ae --- /dev/null +++ b/utils/sdk/client/php/docs/Model/TransactionOutputModel.md @@ -0,0 +1,13 @@ +# # TransactionOutputModel + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**amount** | **int** | | [optional] +**global_index** | **int** | | [optional] +**is_spent** | **bool** | | [optional] +**minimum_sigs** | **int** | | [optional] +**pub_keys** | **string[]** | | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/utils/sdk/client/php/docs/Model/TxGenerationContextModel.md b/utils/sdk/client/php/docs/Model/TxGenerationContextModel.md new file mode 100644 index 00000000..bb1ec794 --- /dev/null +++ b/utils/sdk/client/php/docs/Model/TxGenerationContextModel.md @@ -0,0 +1,32 @@ +# # TxGenerationContextModel + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**asset_ids** | **string[]** | | [optional] +**blinded_asset_ids** | **string[]** | | [optional] +**amount_commitments** | **string[]** | | [optional] +**asset_id_blinding_masks** | **string[]** | | [optional] +**amounts** | **string[]** | | [optional] +**amount_blinding_masks** | **string[]** | | [optional] +**pseudo_outs_blinded_asset_ids** | **string[]** | | [optional] +**pseudo_outs_plus_real_out_blinding_masks** | **string[]** | | [optional] +**real_zc_ins_asset_ids** | **string[]** | | [optional] +**zc_input_amounts** | **int[]** | | [optional] +**pseudo_out_amount_commitments_sum** | **string** | | [optional] +**pseudo_out_amount_blinding_masks_sum** | **string** | | [optional] +**real_in_asset_id_blinding_mask_x_amount_sum** | **string** | | [optional] +**amount_commitments_sum** | **string** | | [optional] +**amount_blinding_masks_sum** | **string** | | [optional] +**asset_id_blinding_mask_x_amount_sum** | **string** | | [optional] +**ao_asset_id** | **string** | | [optional] +**ao_asset_id_pt** | **string** | | [optional] +**ao_amount_commitment** | **string** | | [optional] +**ao_amount_blinding_mask** | **string** | | [optional] +**ao_commitment_in_outputs** | **bool** | | [optional] +**tx_key_pub** | **string** | | [optional] +**tx_key_sec** | **string** | | [optional] +**tx_pub_key_p** | **string** | | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/utils/sdk/client/php/docs/Model/TxPoolPerformanceModel.md b/utils/sdk/client/php/docs/Model/TxPoolPerformanceModel.md new file mode 100644 index 00000000..2729f995 --- /dev/null +++ b/utils/sdk/client/php/docs/Model/TxPoolPerformanceModel.md @@ -0,0 +1,19 @@ +# # TxPoolPerformanceModel + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**tx_processing_time** | **int** | | [optional] +**check_inputs_types_supported_time** | **int** | | [optional] +**expiration_validate_time** | **int** | | [optional] +**validate_amount_time** | **int** | | [optional] +**validate_alias_time** | **int** | | [optional] +**check_keyimages_ws_ms_time** | **int** | | [optional] +**check_inputs_time** | **int** | | [optional] +**begin_tx_time** | **int** | | [optional] +**update_db_time** | **int** | | [optional] +**db_commit_time** | **int** | | [optional] +**check_post_hf4_balance** | **int** | | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/utils/sdk/client/php/docs/Model/TxProcessingPerformanceModel.md b/utils/sdk/client/php/docs/Model/TxProcessingPerformanceModel.md new file mode 100644 index 00000000..e1982ae8 --- /dev/null +++ b/utils/sdk/client/php/docs/Model/TxProcessingPerformanceModel.md @@ -0,0 +1,33 @@ +# # TxProcessingPerformanceModel + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**tx_check_inputs** | **int** | | [optional] +**tx_add_one_tx** | **int** | | [optional] +**tx_process_extra** | **int** | | [optional] +**tx_process_attachment** | **int** | | [optional] +**tx_process_inputs** | **int** | | [optional] +**tx_push_global_index** | **int** | | [optional] +**tx_check_exist** | **int** | | [optional] +**tx_print_log** | **int** | | [optional] +**tx_prapare_append** | **int** | | [optional] +**tx_append** | **int** | | [optional] +**tx_append_rl_wait** | **int** | | [optional] +**tx_append_is_expired** | **int** | | [optional] +**tx_store_db** | **int** | | [optional] +**tx_check_inputs_prefix_hash** | **int** | | [optional] +**tx_check_inputs_attachment_check** | **int** | | [optional] +**tx_check_inputs_loop** | **int** | | [optional] +**tx_check_inputs_loop_kimage_check** | **int** | | [optional] +**tx_check_inputs_loop_ch_in_val_sig** | **int** | | [optional] +**tx_check_inputs_loop_scan_outputkeys_get_item_size** | **int** | | [optional] +**tx_check_inputs_loop_scan_outputkeys_relative_to_absolute** | **int** | | [optional] +**tx_check_inputs_loop_scan_outputkeys_loop** | **int** | | [optional] +**tx_check_inputs_loop_scan_outputkeys_loop_get_subitem** | **int** | | [optional] +**tx_check_inputs_loop_scan_outputkeys_loop_find_tx** | **int** | | [optional] +**tx_check_inputs_loop_scan_outputkeys_loop_handle_output** | **int** | | [optional] +**tx_mixin_count** | **int** | | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/utils/sdk/client/php/docs/Model/VersionModel.md b/utils/sdk/client/php/docs/Model/VersionModel.md new file mode 100644 index 00000000..a55f7b31 --- /dev/null +++ b/utils/sdk/client/php/docs/Model/VersionModel.md @@ -0,0 +1,13 @@ +# # VersionModel + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**version** | **string** | | [optional] +**version_long** | **string** | | [optional] +**major** | **string** | | [optional] +**minor** | **string** | | [optional] +**revision** | **string** | | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/utils/sdk/client/php/phpunit.xml.dist b/utils/sdk/client/php/phpunit.xml.dist new file mode 100644 index 00000000..cc192566 --- /dev/null +++ b/utils/sdk/client/php/phpunit.xml.dist @@ -0,0 +1,18 @@ + + + + + ./src + ./src + + + + + ./tests/Api + ./tests/Model + + + + + + diff --git a/utils/sdk/client/php/src/ApiException.php b/utils/sdk/client/php/src/ApiException.php new file mode 100644 index 00000000..9c3d63db --- /dev/null +++ b/utils/sdk/client/php/src/ApiException.php @@ -0,0 +1,118 @@ +responseHeaders = $responseHeaders; + $this->responseBody = $responseBody; + } + + /** + * Gets the HTTP response header + * + * @return string[][]|null HTTP response header + */ + public function getResponseHeaders(): ?array + { + return $this->responseHeaders; + } + + /** + * Gets the HTTP body of the server response either as Json or string + * + * @return stdClass|string|null HTTP body of the server response either as \stdClass or string + */ + public function getResponseBody(): stdClass|string|null + { + return $this->responseBody; + } + + /** + * Sets the deserialized response object (during deserialization) + * + * @param mixed $obj Deserialized response object + * + * @return void + */ + public function setResponseObject(mixed $obj): void + { + $this->responseObject = $obj; + } + + /** + * Gets the deserialized response object (during deserialization) + * + * @return mixed the deserialized response object + */ + public function getResponseObject(): mixed + { + return $this->responseObject; + } +} diff --git a/utils/sdk/client/php/src/BlockApi.php b/utils/sdk/client/php/src/BlockApi.php new file mode 100644 index 00000000..b8afe006 --- /dev/null +++ b/utils/sdk/client/php/src/BlockApi.php @@ -0,0 +1,1549 @@ + [ + 'application/json', + ], + 'getBlock' => [ + 'application/json', + ], + 'getBlocks' => [ + 'application/json', + ], + 'getHeight' => [ + 'application/json', + ], + 'submitBlock' => [ + 'application/json', + ], + ]; + + /** + * @param ClientInterface|null $client + * @param Configuration|null $config + * @param HeaderSelector|null $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, + int $hostIndex = 0 + ) { + $this->client = $client ?: new Client(); + $this->config = $config ?: Configuration::getDefaultConfiguration(); + $this->headerSelector = $selector ?: new HeaderSelector(); + $this->hostIndex = $hostIndex; + } + + /** + * Set the host index + * + * @param int $hostIndex Host index (required) + */ + public function setHostIndex(int $hostIndex): void + { + $this->hostIndex = $hostIndex; + } + + /** + * Get the host index + * + * @return int Host index + */ + public function getHostIndex(): int + { + return $this->hostIndex; + } + + /** + * @return Configuration + */ + public function getConfig(): Configuration + { + return $this->config; + } + + /** + * Operation createBlockTemplate + * + * Create a block template for mining + * + * @param \lthn\lthn\BlockTemplateRequestModel $block_template_request_model block_template_request_model (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createBlockTemplate'] to see the possible values for this operation + * + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return \lthn\lthn\BlockTemplateModel + */ + public function createBlockTemplate( + \lthn\lthn\BlockTemplateRequestModel $block_template_request_model, + string $contentType = self::contentTypes['createBlockTemplate'][0] + ): \lthn\lthn\BlockTemplateModel + { + list($response) = $this->createBlockTemplateWithHttpInfo($block_template_request_model, $contentType); + return $response; + } + + /** + * Operation createBlockTemplateWithHttpInfo + * + * Create a block template for mining + * + * @param \lthn\lthn\BlockTemplateRequestModel $block_template_request_model (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createBlockTemplate'] to see the possible values for this operation + * + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return array of |\lthn\lthn\BlockTemplateModel, HTTP status code, HTTP response headers (array of strings) + */ + public function createBlockTemplateWithHttpInfo( + \lthn\lthn\BlockTemplateRequestModel $block_template_request_model, + string $contentType = self::contentTypes['createBlockTemplate'][0] + ): array + { + $request = $this->createBlockTemplateRequest($block_template_request_model, $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(); + + switch($statusCode) { + case 200: + return $this->handleResponseWithDataType( + '\lthn\lthn\BlockTemplateModel', + $request, + $response, + ); + } + + + 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 $this->handleResponseWithDataType( + '\lthn\lthn\BlockTemplateModel', + $request, + $response, + ); + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\lthn\lthn\BlockTemplateModel', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + } + + throw $e; + } + } + + /** + * Operation createBlockTemplateAsync + * + * Create a block template for mining + * + * @param \lthn\lthn\BlockTemplateRequestModel $block_template_request_model (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createBlockTemplate'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return PromiseInterface + */ + public function createBlockTemplateAsync( + \lthn\lthn\BlockTemplateRequestModel $block_template_request_model, + string $contentType = self::contentTypes['createBlockTemplate'][0] + ): PromiseInterface + { + return $this->createBlockTemplateAsyncWithHttpInfo($block_template_request_model, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation createBlockTemplateAsyncWithHttpInfo + * + * Create a block template for mining + * + * @param \lthn\lthn\BlockTemplateRequestModel $block_template_request_model (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createBlockTemplate'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return PromiseInterface + */ + public function createBlockTemplateAsyncWithHttpInfo( + \lthn\lthn\BlockTemplateRequestModel $block_template_request_model, + string $contentType = self::contentTypes['createBlockTemplate'][0] + ): PromiseInterface + { + $returnType = '\lthn\lthn\BlockTemplateModel'; + $request = $this->createBlockTemplateRequest($block_template_request_model, $contentType); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $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 'createBlockTemplate' + * + * @param \lthn\lthn\BlockTemplateRequestModel $block_template_request_model (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createBlockTemplate'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function createBlockTemplateRequest( + \lthn\lthn\BlockTemplateRequestModel $block_template_request_model, + string $contentType = self::contentTypes['createBlockTemplate'][0] + ): Request + { + + // verify the required parameter 'block_template_request_model' is set + if ($block_template_request_model === null || (is_array($block_template_request_model) && count($block_template_request_model) === 0)) { + throw new InvalidArgumentException( + 'Missing the required parameter $block_template_request_model when calling createBlockTemplate' + ); + } + + + $resourcePath = '/block/template'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + + + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (isset($block_template_request_model)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($block_template_request_model)); + } else { + $httpBody = $block_template_request_model; + } + } 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 + ); + } + + /** + * Operation getBlock + * + * Get a block by its hash or height (ID) + * + * @param string $identifier The hash (hex string) or height (integer) of the block to retrieve. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getBlock'] to see the possible values for this operation + * + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return \lthn\lthn\BlockDetailsModel + */ + public function getBlock( + string $identifier, + string $contentType = self::contentTypes['getBlock'][0] + ): \lthn\lthn\BlockDetailsModel + { + list($response) = $this->getBlockWithHttpInfo($identifier, $contentType); + return $response; + } + + /** + * Operation getBlockWithHttpInfo + * + * Get a block by its hash or height (ID) + * + * @param string $identifier The hash (hex string) or height (integer) of the block to retrieve. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getBlock'] to see the possible values for this operation + * + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return array of |\lthn\lthn\BlockDetailsModel, HTTP status code, HTTP response headers (array of strings) + */ + public function getBlockWithHttpInfo( + string $identifier, + string $contentType = self::contentTypes['getBlock'][0] + ): array + { + $request = $this->getBlockRequest($identifier, $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(); + + switch($statusCode) { + case 200: + return $this->handleResponseWithDataType( + '\lthn\lthn\BlockDetailsModel', + $request, + $response, + ); + } + + + 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 $this->handleResponseWithDataType( + '\lthn\lthn\BlockDetailsModel', + $request, + $response, + ); + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\lthn\lthn\BlockDetailsModel', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + } + + throw $e; + } + } + + /** + * Operation getBlockAsync + * + * Get a block by its hash or height (ID) + * + * @param string $identifier The hash (hex string) or height (integer) of the block to retrieve. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getBlock'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return PromiseInterface + */ + public function getBlockAsync( + string $identifier, + string $contentType = self::contentTypes['getBlock'][0] + ): PromiseInterface + { + return $this->getBlockAsyncWithHttpInfo($identifier, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation getBlockAsyncWithHttpInfo + * + * Get a block by its hash or height (ID) + * + * @param string $identifier The hash (hex string) or height (integer) of the block to retrieve. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getBlock'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return PromiseInterface + */ + public function getBlockAsyncWithHttpInfo( + string $identifier, + string $contentType = self::contentTypes['getBlock'][0] + ): PromiseInterface + { + $returnType = '\lthn\lthn\BlockDetailsModel'; + $request = $this->getBlockRequest($identifier, $contentType); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $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 'getBlock' + * + * @param string $identifier The hash (hex string) or height (integer) of the block to retrieve. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getBlock'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function getBlockRequest( + string $identifier, + string $contentType = self::contentTypes['getBlock'][0] + ): Request + { + + // verify the required parameter 'identifier' is set + if ($identifier === null || (is_array($identifier) && count($identifier) === 0)) { + throw new InvalidArgumentException( + 'Missing the required parameter $identifier when calling getBlock' + ); + } + + + $resourcePath = '/block/{identifier}'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + // path params + if ($identifier !== null) { + $resourcePath = str_replace( + '{' . 'identifier' . '}', + ObjectSerializer::toPathValue($identifier), + $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 getBlocks + * + * Get one or more blocks, with optional pagination. + * + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getBlocks'] to see the possible values for this operation + * + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return \lthn\lthn\BlockDetailsModel[] + */ + public function getBlocks( + string $contentType = self::contentTypes['getBlocks'][0] + ): array + { + list($response) = $this->getBlocksWithHttpInfo($contentType); + return $response; + } + + /** + * Operation getBlocksWithHttpInfo + * + * Get one or more blocks, with optional pagination. + * + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getBlocks'] to see the possible values for this operation + * + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return array of |\lthn\lthn\BlockDetailsModel[], HTTP status code, HTTP response headers (array of strings) + */ + public function getBlocksWithHttpInfo( + string $contentType = self::contentTypes['getBlocks'][0] + ): array + { + $request = $this->getBlocksRequest($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(); + + switch($statusCode) { + case 200: + return $this->handleResponseWithDataType( + '\lthn\lthn\BlockDetailsModel[]', + $request, + $response, + ); + } + + + 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 $this->handleResponseWithDataType( + '\lthn\lthn\BlockDetailsModel[]', + $request, + $response, + ); + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\lthn\lthn\BlockDetailsModel[]', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + } + + throw $e; + } + } + + /** + * Operation getBlocksAsync + * + * Get one or more blocks, with optional pagination. + * + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getBlocks'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return PromiseInterface + */ + public function getBlocksAsync( + string $contentType = self::contentTypes['getBlocks'][0] + ): PromiseInterface + { + return $this->getBlocksAsyncWithHttpInfo($contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation getBlocksAsyncWithHttpInfo + * + * Get one or more blocks, with optional pagination. + * + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getBlocks'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return PromiseInterface + */ + public function getBlocksAsyncWithHttpInfo( + string $contentType = self::contentTypes['getBlocks'][0] + ): PromiseInterface + { + $returnType = '\lthn\lthn\BlockDetailsModel[]'; + $request = $this->getBlocksRequest($contentType); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $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 'getBlocks' + * + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getBlocks'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function getBlocksRequest( + string $contentType = self::contentTypes['getBlocks'][0] + ): Request + { + + + $resourcePath = '/block'; + $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 + ); + } + + /** + * Operation getHeight + * + * Get the current blockchain height + * + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getHeight'] to see the possible values for this operation + * + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return \lthn\lthn\HeightModel + */ + public function getHeight( + string $contentType = self::contentTypes['getHeight'][0] + ): \lthn\lthn\HeightModel + { + list($response) = $this->getHeightWithHttpInfo($contentType); + return $response; + } + + /** + * Operation getHeightWithHttpInfo + * + * Get the current blockchain height + * + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getHeight'] to see the possible values for this operation + * + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return array of \lthn\lthn\HeightModel, HTTP status code, HTTP response headers (array of strings) + */ + public function getHeightWithHttpInfo( + string $contentType = self::contentTypes['getHeight'][0] + ): array + { + $request = $this->getHeightRequest($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(); + + switch($statusCode) { + case 200: + return $this->handleResponseWithDataType( + '\lthn\lthn\HeightModel', + $request, + $response, + ); + } + + + 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 $this->handleResponseWithDataType( + '\lthn\lthn\HeightModel', + $request, + $response, + ); + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\lthn\lthn\HeightModel', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + } + + throw $e; + } + } + + /** + * Operation getHeightAsync + * + * Get the current blockchain height + * + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getHeight'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return PromiseInterface + */ + public function getHeightAsync( + string $contentType = self::contentTypes['getHeight'][0] + ): PromiseInterface + { + return $this->getHeightAsyncWithHttpInfo($contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation getHeightAsyncWithHttpInfo + * + * Get the current blockchain height + * + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getHeight'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return PromiseInterface + */ + public function getHeightAsyncWithHttpInfo( + string $contentType = self::contentTypes['getHeight'][0] + ): PromiseInterface + { + $returnType = '\lthn\lthn\HeightModel'; + $request = $this->getHeightRequest($contentType); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $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 'getHeight' + * + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getHeight'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function getHeightRequest( + string $contentType = self::contentTypes['getHeight'][0] + ): Request + { + + + $resourcePath = '/block/height'; + $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 + ); + } + + /** + * Operation submitBlock + * + * Submit a new block to the network + * + * @param \lthn\lthn\SubmitBlockRequestModel $submit_block_request_model submit_block_request_model (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['submitBlock'] to see the possible values for this operation + * + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return \lthn\lthn\SubmitBlockResponseModel + */ + public function submitBlock( + \lthn\lthn\SubmitBlockRequestModel $submit_block_request_model, + string $contentType = self::contentTypes['submitBlock'][0] + ): \lthn\lthn\SubmitBlockResponseModel + { + list($response) = $this->submitBlockWithHttpInfo($submit_block_request_model, $contentType); + return $response; + } + + /** + * Operation submitBlockWithHttpInfo + * + * Submit a new block to the network + * + * @param \lthn\lthn\SubmitBlockRequestModel $submit_block_request_model (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['submitBlock'] to see the possible values for this operation + * + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return array of |\lthn\lthn\SubmitBlockResponseModel, HTTP status code, HTTP response headers (array of strings) + */ + public function submitBlockWithHttpInfo( + \lthn\lthn\SubmitBlockRequestModel $submit_block_request_model, + string $contentType = self::contentTypes['submitBlock'][0] + ): array + { + $request = $this->submitBlockRequest($submit_block_request_model, $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(); + + switch($statusCode) { + case 200: + return $this->handleResponseWithDataType( + '\lthn\lthn\SubmitBlockResponseModel', + $request, + $response, + ); + } + + + 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 $this->handleResponseWithDataType( + '\lthn\lthn\SubmitBlockResponseModel', + $request, + $response, + ); + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\lthn\lthn\SubmitBlockResponseModel', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + } + + throw $e; + } + } + + /** + * Operation submitBlockAsync + * + * Submit a new block to the network + * + * @param \lthn\lthn\SubmitBlockRequestModel $submit_block_request_model (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['submitBlock'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return PromiseInterface + */ + public function submitBlockAsync( + \lthn\lthn\SubmitBlockRequestModel $submit_block_request_model, + string $contentType = self::contentTypes['submitBlock'][0] + ): PromiseInterface + { + return $this->submitBlockAsyncWithHttpInfo($submit_block_request_model, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation submitBlockAsyncWithHttpInfo + * + * Submit a new block to the network + * + * @param \lthn\lthn\SubmitBlockRequestModel $submit_block_request_model (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['submitBlock'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return PromiseInterface + */ + public function submitBlockAsyncWithHttpInfo( + \lthn\lthn\SubmitBlockRequestModel $submit_block_request_model, + string $contentType = self::contentTypes['submitBlock'][0] + ): PromiseInterface + { + $returnType = '\lthn\lthn\SubmitBlockResponseModel'; + $request = $this->submitBlockRequest($submit_block_request_model, $contentType); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $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 'submitBlock' + * + * @param \lthn\lthn\SubmitBlockRequestModel $submit_block_request_model (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['submitBlock'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function submitBlockRequest( + \lthn\lthn\SubmitBlockRequestModel $submit_block_request_model, + string $contentType = self::contentTypes['submitBlock'][0] + ): Request + { + + // verify the required parameter 'submit_block_request_model' is set + if ($submit_block_request_model === null || (is_array($submit_block_request_model) && count($submit_block_request_model) === 0)) { + throw new InvalidArgumentException( + 'Missing the required parameter $submit_block_request_model when calling submitBlock' + ); + } + + + $resourcePath = '/block/submit'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + + + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (isset($submit_block_request_model)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($submit_block_request_model)); + } else { + $httpBody = $submit_block_request_model; + } + } 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(): array + { + $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; + } + + private function handleResponseWithDataType( + string $dataType, + RequestInterface $request, + ResponseInterface $response, + ): array { + if (in_array($dataType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($dataType !== '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() + ), + $response->getStatusCode(), + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, $dataType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + private function responseWithinRangeCode( + string $rangeCode, + int $statusCode, + ): bool { + $left = (int) ($rangeCode[0].'00'); + $right = (int) ($rangeCode[0].'99'); + + return $statusCode >= $left && $statusCode <= $right; + } +} diff --git a/utils/sdk/client/php/src/BlockDetailsModel.php b/utils/sdk/client/php/src/BlockDetailsModel.php new file mode 100644 index 00000000..b536decf --- /dev/null +++ b/utils/sdk/client/php/src/BlockDetailsModel.php @@ -0,0 +1,1239 @@ + + */ +class BlockDetailsModel implements ModelInterface, ArrayAccess, JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = 'BlockDetailsModel'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPITypes = [ + 'actual_timestamp' => 'int', + 'already_generated_coins' => 'string', + 'base_reward' => 'int', + 'blob' => 'string', + 'block_cumulative_size' => 'int', + 'block_tself_size' => 'int', + 'cumulative_diff_adjusted' => 'string', + 'cumulative_diff_precise' => 'string', + 'difficulty' => 'string', + 'effective_fee_median' => 'int', + 'height' => 'int', + 'id' => 'string', + 'is_orphan' => 'bool', + 'miner_text_info' => 'string', + 'object_in_json' => 'string', + 'penalty' => 'int', + 'pow_seed' => 'string', + 'prev_id' => 'string', + 'summary_reward' => 'int', + 'this_block_fee_median' => 'int', + 'timestamp' => 'int', + 'total_fee' => 'int', + 'total_txs_size' => 'int', + 'transactions_details' => '\lthn\lthn\TransactionDetailsModel[]', + 'type' => 'int' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPIFormats = [ + 'actual_timestamp' => null, + 'already_generated_coins' => null, + 'base_reward' => null, + 'blob' => null, + 'block_cumulative_size' => null, + 'block_tself_size' => null, + 'cumulative_diff_adjusted' => null, + 'cumulative_diff_precise' => null, + 'difficulty' => null, + 'effective_fee_median' => null, + 'height' => null, + 'id' => null, + 'is_orphan' => null, + 'miner_text_info' => null, + 'object_in_json' => null, + 'penalty' => null, + 'pow_seed' => null, + 'prev_id' => null, + 'summary_reward' => null, + 'this_block_fee_median' => null, + 'timestamp' => null, + 'total_fee' => null, + 'total_txs_size' => null, + 'transactions_details' => null, + 'type' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'actual_timestamp' => false, + 'already_generated_coins' => false, + 'base_reward' => false, + 'blob' => false, + 'block_cumulative_size' => false, + 'block_tself_size' => false, + 'cumulative_diff_adjusted' => false, + 'cumulative_diff_precise' => false, + 'difficulty' => false, + 'effective_fee_median' => false, + 'height' => false, + 'id' => false, + 'is_orphan' => false, + 'miner_text_info' => false, + 'object_in_json' => false, + 'penalty' => false, + 'pow_seed' => false, + 'prev_id' => false, + 'summary_reward' => false, + 'this_block_fee_median' => false, + 'timestamp' => false, + 'total_fee' => false, + 'total_txs_size' => false, + 'transactions_details' => false, + 'type' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes(): array + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats(): array + { + 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 array + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param array $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 array + */ + protected static array $attributeMap = [ + 'actual_timestamp' => 'actual_timestamp', + 'already_generated_coins' => 'already_generated_coins', + 'base_reward' => 'base_reward', + 'blob' => 'blob', + 'block_cumulative_size' => 'block_cumulative_size', + 'block_tself_size' => 'block_tself_size', + 'cumulative_diff_adjusted' => 'cumulative_diff_adjusted', + 'cumulative_diff_precise' => 'cumulative_diff_precise', + 'difficulty' => 'difficulty', + 'effective_fee_median' => 'effective_fee_median', + 'height' => 'height', + 'id' => 'id', + 'is_orphan' => 'is_orphan', + 'miner_text_info' => 'miner_text_info', + 'object_in_json' => 'object_in_json', + 'penalty' => 'penalty', + 'pow_seed' => 'pow_seed', + 'prev_id' => 'prev_id', + 'summary_reward' => 'summary_reward', + 'this_block_fee_median' => 'this_block_fee_median', + 'timestamp' => 'timestamp', + 'total_fee' => 'total_fee', + 'total_txs_size' => 'total_txs_size', + 'transactions_details' => 'transactions_details', + 'type' => 'type' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var array + */ + protected static array $setters = [ + 'actual_timestamp' => 'setActualTimestamp', + 'already_generated_coins' => 'setAlreadyGeneratedCoins', + 'base_reward' => 'setBaseReward', + 'blob' => 'setBlob', + 'block_cumulative_size' => 'setBlockCumulativeSize', + 'block_tself_size' => 'setBlockTselfSize', + 'cumulative_diff_adjusted' => 'setCumulativeDiffAdjusted', + 'cumulative_diff_precise' => 'setCumulativeDiffPrecise', + 'difficulty' => 'setDifficulty', + 'effective_fee_median' => 'setEffectiveFeeMedian', + 'height' => 'setHeight', + 'id' => 'setId', + 'is_orphan' => 'setIsOrphan', + 'miner_text_info' => 'setMinerTextInfo', + 'object_in_json' => 'setObjectInJson', + 'penalty' => 'setPenalty', + 'pow_seed' => 'setPowSeed', + 'prev_id' => 'setPrevId', + 'summary_reward' => 'setSummaryReward', + 'this_block_fee_median' => 'setThisBlockFeeMedian', + 'timestamp' => 'setTimestamp', + 'total_fee' => 'setTotalFee', + 'total_txs_size' => 'setTotalTxsSize', + 'transactions_details' => 'setTransactionsDetails', + 'type' => 'setType' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var array + */ + protected static array $getters = [ + 'actual_timestamp' => 'getActualTimestamp', + 'already_generated_coins' => 'getAlreadyGeneratedCoins', + 'base_reward' => 'getBaseReward', + 'blob' => 'getBlob', + 'block_cumulative_size' => 'getBlockCumulativeSize', + 'block_tself_size' => 'getBlockTselfSize', + 'cumulative_diff_adjusted' => 'getCumulativeDiffAdjusted', + 'cumulative_diff_precise' => 'getCumulativeDiffPrecise', + 'difficulty' => 'getDifficulty', + 'effective_fee_median' => 'getEffectiveFeeMedian', + 'height' => 'getHeight', + 'id' => 'getId', + 'is_orphan' => 'getIsOrphan', + 'miner_text_info' => 'getMinerTextInfo', + 'object_in_json' => 'getObjectInJson', + 'penalty' => 'getPenalty', + 'pow_seed' => 'getPowSeed', + 'prev_id' => 'getPrevId', + 'summary_reward' => 'getSummaryReward', + 'this_block_fee_median' => 'getThisBlockFeeMedian', + 'timestamp' => 'getTimestamp', + 'total_fee' => 'getTotalFee', + 'total_txs_size' => 'getTotalTxsSize', + 'transactions_details' => 'getTransactionsDetails', + 'type' => 'getType' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap(): array + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters(): array + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters(): array + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName(): string + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var array + */ + protected array $container = []; + + /** + * Constructor + * + * @param array $data Associated array of property values initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('actual_timestamp', $data ?? [], null); + $this->setIfExists('already_generated_coins', $data ?? [], null); + $this->setIfExists('base_reward', $data ?? [], null); + $this->setIfExists('blob', $data ?? [], null); + $this->setIfExists('block_cumulative_size', $data ?? [], null); + $this->setIfExists('block_tself_size', $data ?? [], null); + $this->setIfExists('cumulative_diff_adjusted', $data ?? [], null); + $this->setIfExists('cumulative_diff_precise', $data ?? [], null); + $this->setIfExists('difficulty', $data ?? [], null); + $this->setIfExists('effective_fee_median', $data ?? [], null); + $this->setIfExists('height', $data ?? [], null); + $this->setIfExists('id', $data ?? [], null); + $this->setIfExists('is_orphan', $data ?? [], null); + $this->setIfExists('miner_text_info', $data ?? [], null); + $this->setIfExists('object_in_json', $data ?? [], null); + $this->setIfExists('penalty', $data ?? [], null); + $this->setIfExists('pow_seed', $data ?? [], null); + $this->setIfExists('prev_id', $data ?? [], null); + $this->setIfExists('summary_reward', $data ?? [], null); + $this->setIfExists('this_block_fee_median', $data ?? [], null); + $this->setIfExists('timestamp', $data ?? [], null); + $this->setIfExists('total_fee', $data ?? [], null); + $this->setIfExists('total_txs_size', $data ?? [], null); + $this->setIfExists('transactions_details', $data ?? [], null); + $this->setIfExists('type', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, mixed $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 string[] invalid properties with reasons + */ + public function listInvalidProperties(): array + { + $invalidProperties = []; + + if (!is_null($this->container['type']) && ($this->container['type'] > 4294967295)) { + $invalidProperties[] = "invalid value for 'type', must be smaller than or equal to 4294967295."; + } + + if (!is_null($this->container['type']) && ($this->container['type'] < 0)) { + $invalidProperties[] = "invalid value for 'type', must be bigger than or equal to 0."; + } + + 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(): bool + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets actual_timestamp + * + * @return int|null + */ + public function getActualTimestamp(): ?int + { + return $this->container['actual_timestamp']; + } + + /** + * Sets actual_timestamp + * + * @param int|null $actual_timestamp actual_timestamp + * + * @return $this + */ + public function setActualTimestamp(?int $actual_timestamp): static + { + if (is_null($actual_timestamp)) { + throw new InvalidArgumentException('non-nullable actual_timestamp cannot be null'); + } + $this->container['actual_timestamp'] = $actual_timestamp; + + return $this; + } + + /** + * Gets already_generated_coins + * + * @return string|null + */ + public function getAlreadyGeneratedCoins(): ?string + { + return $this->container['already_generated_coins']; + } + + /** + * Sets already_generated_coins + * + * @param string|null $already_generated_coins already_generated_coins + * + * @return $this + */ + public function setAlreadyGeneratedCoins(?string $already_generated_coins): static + { + if (is_null($already_generated_coins)) { + throw new InvalidArgumentException('non-nullable already_generated_coins cannot be null'); + } + $this->container['already_generated_coins'] = $already_generated_coins; + + return $this; + } + + /** + * Gets base_reward + * + * @return int|null + */ + public function getBaseReward(): ?int + { + return $this->container['base_reward']; + } + + /** + * Sets base_reward + * + * @param int|null $base_reward base_reward + * + * @return $this + */ + public function setBaseReward(?int $base_reward): static + { + if (is_null($base_reward)) { + throw new InvalidArgumentException('non-nullable base_reward cannot be null'); + } + $this->container['base_reward'] = $base_reward; + + return $this; + } + + /** + * Gets blob + * + * @return string|null + */ + public function getBlob(): ?string + { + return $this->container['blob']; + } + + /** + * Sets blob + * + * @param string|null $blob blob + * + * @return $this + */ + public function setBlob(?string $blob): static + { + if (is_null($blob)) { + throw new InvalidArgumentException('non-nullable blob cannot be null'); + } + $this->container['blob'] = $blob; + + return $this; + } + + /** + * Gets block_cumulative_size + * + * @return int|null + */ + public function getBlockCumulativeSize(): ?int + { + return $this->container['block_cumulative_size']; + } + + /** + * Sets block_cumulative_size + * + * @param int|null $block_cumulative_size block_cumulative_size + * + * @return $this + */ + public function setBlockCumulativeSize(?int $block_cumulative_size): static + { + if (is_null($block_cumulative_size)) { + throw new InvalidArgumentException('non-nullable block_cumulative_size cannot be null'); + } + $this->container['block_cumulative_size'] = $block_cumulative_size; + + return $this; + } + + /** + * Gets block_tself_size + * + * @return int|null + */ + public function getBlockTselfSize(): ?int + { + return $this->container['block_tself_size']; + } + + /** + * Sets block_tself_size + * + * @param int|null $block_tself_size block_tself_size + * + * @return $this + */ + public function setBlockTselfSize(?int $block_tself_size): static + { + if (is_null($block_tself_size)) { + throw new InvalidArgumentException('non-nullable block_tself_size cannot be null'); + } + $this->container['block_tself_size'] = $block_tself_size; + + return $this; + } + + /** + * Gets cumulative_diff_adjusted + * + * @return string|null + */ + public function getCumulativeDiffAdjusted(): ?string + { + return $this->container['cumulative_diff_adjusted']; + } + + /** + * Sets cumulative_diff_adjusted + * + * @param string|null $cumulative_diff_adjusted cumulative_diff_adjusted + * + * @return $this + */ + public function setCumulativeDiffAdjusted(?string $cumulative_diff_adjusted): static + { + if (is_null($cumulative_diff_adjusted)) { + throw new InvalidArgumentException('non-nullable cumulative_diff_adjusted cannot be null'); + } + $this->container['cumulative_diff_adjusted'] = $cumulative_diff_adjusted; + + return $this; + } + + /** + * Gets cumulative_diff_precise + * + * @return string|null + */ + public function getCumulativeDiffPrecise(): ?string + { + return $this->container['cumulative_diff_precise']; + } + + /** + * Sets cumulative_diff_precise + * + * @param string|null $cumulative_diff_precise cumulative_diff_precise + * + * @return $this + */ + public function setCumulativeDiffPrecise(?string $cumulative_diff_precise): static + { + if (is_null($cumulative_diff_precise)) { + throw new InvalidArgumentException('non-nullable cumulative_diff_precise cannot be null'); + } + $this->container['cumulative_diff_precise'] = $cumulative_diff_precise; + + return $this; + } + + /** + * Gets difficulty + * + * @return string|null + */ + public function getDifficulty(): ?string + { + return $this->container['difficulty']; + } + + /** + * Sets difficulty + * + * @param string|null $difficulty difficulty + * + * @return $this + */ + public function setDifficulty(?string $difficulty): static + { + if (is_null($difficulty)) { + throw new InvalidArgumentException('non-nullable difficulty cannot be null'); + } + $this->container['difficulty'] = $difficulty; + + return $this; + } + + /** + * Gets effective_fee_median + * + * @return int|null + */ + public function getEffectiveFeeMedian(): ?int + { + return $this->container['effective_fee_median']; + } + + /** + * Sets effective_fee_median + * + * @param int|null $effective_fee_median effective_fee_median + * + * @return $this + */ + public function setEffectiveFeeMedian(?int $effective_fee_median): static + { + if (is_null($effective_fee_median)) { + throw new InvalidArgumentException('non-nullable effective_fee_median cannot be null'); + } + $this->container['effective_fee_median'] = $effective_fee_median; + + return $this; + } + + /** + * Gets height + * + * @return int|null + */ + public function getHeight(): ?int + { + return $this->container['height']; + } + + /** + * Sets height + * + * @param int|null $height height + * + * @return $this + */ + public function setHeight(?int $height): static + { + if (is_null($height)) { + throw new InvalidArgumentException('non-nullable height cannot be null'); + } + $this->container['height'] = $height; + + return $this; + } + + /** + * Gets id + * + * @return string|null + */ + public function getId(): ?string + { + return $this->container['id']; + } + + /** + * Sets id + * + * @param string|null $id id + * + * @return $this + */ + public function setId(?string $id): static + { + if (is_null($id)) { + throw new InvalidArgumentException('non-nullable id cannot be null'); + } + $this->container['id'] = $id; + + return $this; + } + + /** + * Gets is_orphan + * + * @return bool|null + */ + public function getIsOrphan(): ?bool + { + return $this->container['is_orphan']; + } + + /** + * Sets is_orphan + * + * @param bool|null $is_orphan is_orphan + * + * @return $this + */ + public function setIsOrphan(?bool $is_orphan): static + { + if (is_null($is_orphan)) { + throw new InvalidArgumentException('non-nullable is_orphan cannot be null'); + } + $this->container['is_orphan'] = $is_orphan; + + return $this; + } + + /** + * Gets miner_text_info + * + * @return string|null + */ + public function getMinerTextInfo(): ?string + { + return $this->container['miner_text_info']; + } + + /** + * Sets miner_text_info + * + * @param string|null $miner_text_info miner_text_info + * + * @return $this + */ + public function setMinerTextInfo(?string $miner_text_info): static + { + if (is_null($miner_text_info)) { + throw new InvalidArgumentException('non-nullable miner_text_info cannot be null'); + } + $this->container['miner_text_info'] = $miner_text_info; + + return $this; + } + + /** + * Gets object_in_json + * + * @return string|null + */ + public function getObjectInJson(): ?string + { + return $this->container['object_in_json']; + } + + /** + * Sets object_in_json + * + * @param string|null $object_in_json object_in_json + * + * @return $this + */ + public function setObjectInJson(?string $object_in_json): static + { + if (is_null($object_in_json)) { + throw new InvalidArgumentException('non-nullable object_in_json cannot be null'); + } + $this->container['object_in_json'] = $object_in_json; + + return $this; + } + + /** + * Gets penalty + * + * @return int|null + */ + public function getPenalty(): ?int + { + return $this->container['penalty']; + } + + /** + * Sets penalty + * + * @param int|null $penalty penalty + * + * @return $this + */ + public function setPenalty(?int $penalty): static + { + if (is_null($penalty)) { + throw new InvalidArgumentException('non-nullable penalty cannot be null'); + } + $this->container['penalty'] = $penalty; + + return $this; + } + + /** + * Gets pow_seed + * + * @return string|null + */ + public function getPowSeed(): ?string + { + return $this->container['pow_seed']; + } + + /** + * Sets pow_seed + * + * @param string|null $pow_seed pow_seed + * + * @return $this + */ + public function setPowSeed(?string $pow_seed): static + { + if (is_null($pow_seed)) { + throw new InvalidArgumentException('non-nullable pow_seed cannot be null'); + } + $this->container['pow_seed'] = $pow_seed; + + return $this; + } + + /** + * Gets prev_id + * + * @return string|null + */ + public function getPrevId(): ?string + { + return $this->container['prev_id']; + } + + /** + * Sets prev_id + * + * @param string|null $prev_id prev_id + * + * @return $this + */ + public function setPrevId(?string $prev_id): static + { + if (is_null($prev_id)) { + throw new InvalidArgumentException('non-nullable prev_id cannot be null'); + } + $this->container['prev_id'] = $prev_id; + + return $this; + } + + /** + * Gets summary_reward + * + * @return int|null + */ + public function getSummaryReward(): ?int + { + return $this->container['summary_reward']; + } + + /** + * Sets summary_reward + * + * @param int|null $summary_reward summary_reward + * + * @return $this + */ + public function setSummaryReward(?int $summary_reward): static + { + if (is_null($summary_reward)) { + throw new InvalidArgumentException('non-nullable summary_reward cannot be null'); + } + $this->container['summary_reward'] = $summary_reward; + + return $this; + } + + /** + * Gets this_block_fee_median + * + * @return int|null + */ + public function getThisBlockFeeMedian(): ?int + { + return $this->container['this_block_fee_median']; + } + + /** + * Sets this_block_fee_median + * + * @param int|null $this_block_fee_median this_block_fee_median + * + * @return $this + */ + public function setThisBlockFeeMedian(?int $this_block_fee_median): static + { + if (is_null($this_block_fee_median)) { + throw new InvalidArgumentException('non-nullable this_block_fee_median cannot be null'); + } + $this->container['this_block_fee_median'] = $this_block_fee_median; + + return $this; + } + + /** + * Gets timestamp + * + * @return int|null + */ + public function getTimestamp(): ?int + { + return $this->container['timestamp']; + } + + /** + * Sets timestamp + * + * @param int|null $timestamp timestamp + * + * @return $this + */ + public function setTimestamp(?int $timestamp): static + { + if (is_null($timestamp)) { + throw new InvalidArgumentException('non-nullable timestamp cannot be null'); + } + $this->container['timestamp'] = $timestamp; + + return $this; + } + + /** + * Gets total_fee + * + * @return int|null + */ + public function getTotalFee(): ?int + { + return $this->container['total_fee']; + } + + /** + * Sets total_fee + * + * @param int|null $total_fee total_fee + * + * @return $this + */ + public function setTotalFee(?int $total_fee): static + { + if (is_null($total_fee)) { + throw new InvalidArgumentException('non-nullable total_fee cannot be null'); + } + $this->container['total_fee'] = $total_fee; + + return $this; + } + + /** + * Gets total_txs_size + * + * @return int|null + */ + public function getTotalTxsSize(): ?int + { + return $this->container['total_txs_size']; + } + + /** + * Sets total_txs_size + * + * @param int|null $total_txs_size total_txs_size + * + * @return $this + */ + public function setTotalTxsSize(?int $total_txs_size): static + { + if (is_null($total_txs_size)) { + throw new InvalidArgumentException('non-nullable total_txs_size cannot be null'); + } + $this->container['total_txs_size'] = $total_txs_size; + + return $this; + } + + /** + * Gets transactions_details + * + * @return \lthn\lthn\TransactionDetailsModel[]|null + */ + public function getTransactionsDetails(): ?array + { + return $this->container['transactions_details']; + } + + /** + * Sets transactions_details + * + * @param \lthn\lthn\TransactionDetailsModel[]|null $transactions_details transactions_details + * + * @return $this + */ + public function setTransactionsDetails(?array $transactions_details): static + { + if (is_null($transactions_details)) { + throw new InvalidArgumentException('non-nullable transactions_details cannot be null'); + } + $this->container['transactions_details'] = $transactions_details; + + return $this; + } + + /** + * Gets type + * + * @return int|null + */ + public function getType(): ?int + { + return $this->container['type']; + } + + /** + * Sets type + * + * @param int|null $type type + * + * @return $this + */ + public function setType(?int $type): static + { + if (is_null($type)) { + throw new InvalidArgumentException('non-nullable type cannot be null'); + } + + if (($type > 4294967295)) { + throw new InvalidArgumentException('invalid value for $type when calling BlockDetailsModel., must be smaller than or equal to 4294967295.'); + } + if (($type < 0)) { + throw new InvalidArgumentException('invalid value for $type when calling BlockDetailsModel., must be bigger than or equal to 0.'); + } + + $this->container['type'] = $type; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists(mixed $offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[ReturnTypeWillChange] + public function offsetGet(mixed $offset): mixed + { + 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(mixed $offset, mixed $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(mixed $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(): mixed + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString(): string + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue(): string + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/utils/sdk/client/php/src/BlockProcessingPerformanceModel.php b/utils/sdk/client/php/src/BlockProcessingPerformanceModel.php new file mode 100644 index 00000000..17e2e695 --- /dev/null +++ b/utils/sdk/client/php/src/BlockProcessingPerformanceModel.php @@ -0,0 +1,917 @@ + + */ +class BlockProcessingPerformanceModel implements ModelInterface, ArrayAccess, JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = 'BlockProcessingPerformanceModel'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPITypes = [ + 'block_processing_time_0' => 'int', + 'block_processing_time_1' => 'int', + 'target_calculating_time_2' => 'int', + 'longhash_calculating_time_3' => 'int', + 'all_txs_insert_time_5' => 'int', + 'etc_stuff_6' => 'int', + 'insert_time_4' => 'int', + 'raise_block_core_event' => 'int', + 'validate_miner_transaction_time' => 'int', + 'collect_rangeproofs_data_from_tx_time' => 'int', + 'verify_multiple_zc_outs_range_proofs_time' => 'int', + 'target_calculating_enum_blocks' => 'int', + 'target_calculating_calc' => 'int', + 'pos_validate_ki_search' => 'int', + 'pos_validate_get_out_keys_for_inputs' => 'int', + 'pos_validate_zvp' => 'int' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPIFormats = [ + 'block_processing_time_0' => null, + 'block_processing_time_1' => null, + 'target_calculating_time_2' => null, + 'longhash_calculating_time_3' => null, + 'all_txs_insert_time_5' => null, + 'etc_stuff_6' => null, + 'insert_time_4' => null, + 'raise_block_core_event' => null, + 'validate_miner_transaction_time' => null, + 'collect_rangeproofs_data_from_tx_time' => null, + 'verify_multiple_zc_outs_range_proofs_time' => null, + 'target_calculating_enum_blocks' => null, + 'target_calculating_calc' => null, + 'pos_validate_ki_search' => null, + 'pos_validate_get_out_keys_for_inputs' => null, + 'pos_validate_zvp' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'block_processing_time_0' => false, + 'block_processing_time_1' => false, + 'target_calculating_time_2' => false, + 'longhash_calculating_time_3' => false, + 'all_txs_insert_time_5' => false, + 'etc_stuff_6' => false, + 'insert_time_4' => false, + 'raise_block_core_event' => false, + 'validate_miner_transaction_time' => false, + 'collect_rangeproofs_data_from_tx_time' => false, + 'verify_multiple_zc_outs_range_proofs_time' => false, + 'target_calculating_enum_blocks' => false, + 'target_calculating_calc' => false, + 'pos_validate_ki_search' => false, + 'pos_validate_get_out_keys_for_inputs' => false, + 'pos_validate_zvp' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes(): array + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats(): array + { + 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 array + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param array $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 array + */ + protected static array $attributeMap = [ + 'block_processing_time_0' => 'block_processing_time_0', + 'block_processing_time_1' => 'block_processing_time_1', + 'target_calculating_time_2' => 'target_calculating_time_2', + 'longhash_calculating_time_3' => 'longhash_calculating_time_3', + 'all_txs_insert_time_5' => 'all_txs_insert_time_5', + 'etc_stuff_6' => 'etc_stuff_6', + 'insert_time_4' => 'insert_time_4', + 'raise_block_core_event' => 'raise_block_core_event', + 'validate_miner_transaction_time' => 'validate_miner_transaction_time', + 'collect_rangeproofs_data_from_tx_time' => 'collect_rangeproofs_data_from_tx_time', + 'verify_multiple_zc_outs_range_proofs_time' => 'verify_multiple_zc_outs_range_proofs_time', + 'target_calculating_enum_blocks' => 'target_calculating_enum_blocks', + 'target_calculating_calc' => 'target_calculating_calc', + 'pos_validate_ki_search' => 'pos_validate_ki_search', + 'pos_validate_get_out_keys_for_inputs' => 'pos_validate_get_out_keys_for_inputs', + 'pos_validate_zvp' => 'pos_validate_zvp' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var array + */ + protected static array $setters = [ + 'block_processing_time_0' => 'setBlockProcessingTime0', + 'block_processing_time_1' => 'setBlockProcessingTime1', + 'target_calculating_time_2' => 'setTargetCalculatingTime2', + 'longhash_calculating_time_3' => 'setLonghashCalculatingTime3', + 'all_txs_insert_time_5' => 'setAllTxsInsertTime5', + 'etc_stuff_6' => 'setEtcStuff6', + 'insert_time_4' => 'setInsertTime4', + 'raise_block_core_event' => 'setRaiseBlockCoreEvent', + 'validate_miner_transaction_time' => 'setValidateMinerTransactionTime', + 'collect_rangeproofs_data_from_tx_time' => 'setCollectRangeproofsDataFromTxTime', + 'verify_multiple_zc_outs_range_proofs_time' => 'setVerifyMultipleZcOutsRangeProofsTime', + 'target_calculating_enum_blocks' => 'setTargetCalculatingEnumBlocks', + 'target_calculating_calc' => 'setTargetCalculatingCalc', + 'pos_validate_ki_search' => 'setPosValidateKiSearch', + 'pos_validate_get_out_keys_for_inputs' => 'setPosValidateGetOutKeysForInputs', + 'pos_validate_zvp' => 'setPosValidateZvp' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var array + */ + protected static array $getters = [ + 'block_processing_time_0' => 'getBlockProcessingTime0', + 'block_processing_time_1' => 'getBlockProcessingTime1', + 'target_calculating_time_2' => 'getTargetCalculatingTime2', + 'longhash_calculating_time_3' => 'getLonghashCalculatingTime3', + 'all_txs_insert_time_5' => 'getAllTxsInsertTime5', + 'etc_stuff_6' => 'getEtcStuff6', + 'insert_time_4' => 'getInsertTime4', + 'raise_block_core_event' => 'getRaiseBlockCoreEvent', + 'validate_miner_transaction_time' => 'getValidateMinerTransactionTime', + 'collect_rangeproofs_data_from_tx_time' => 'getCollectRangeproofsDataFromTxTime', + 'verify_multiple_zc_outs_range_proofs_time' => 'getVerifyMultipleZcOutsRangeProofsTime', + 'target_calculating_enum_blocks' => 'getTargetCalculatingEnumBlocks', + 'target_calculating_calc' => 'getTargetCalculatingCalc', + 'pos_validate_ki_search' => 'getPosValidateKiSearch', + 'pos_validate_get_out_keys_for_inputs' => 'getPosValidateGetOutKeysForInputs', + 'pos_validate_zvp' => 'getPosValidateZvp' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap(): array + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters(): array + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters(): array + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName(): string + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var array + */ + protected array $container = []; + + /** + * Constructor + * + * @param array $data Associated array of property values initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('block_processing_time_0', $data ?? [], null); + $this->setIfExists('block_processing_time_1', $data ?? [], null); + $this->setIfExists('target_calculating_time_2', $data ?? [], null); + $this->setIfExists('longhash_calculating_time_3', $data ?? [], null); + $this->setIfExists('all_txs_insert_time_5', $data ?? [], null); + $this->setIfExists('etc_stuff_6', $data ?? [], null); + $this->setIfExists('insert_time_4', $data ?? [], null); + $this->setIfExists('raise_block_core_event', $data ?? [], null); + $this->setIfExists('validate_miner_transaction_time', $data ?? [], null); + $this->setIfExists('collect_rangeproofs_data_from_tx_time', $data ?? [], null); + $this->setIfExists('verify_multiple_zc_outs_range_proofs_time', $data ?? [], null); + $this->setIfExists('target_calculating_enum_blocks', $data ?? [], null); + $this->setIfExists('target_calculating_calc', $data ?? [], null); + $this->setIfExists('pos_validate_ki_search', $data ?? [], null); + $this->setIfExists('pos_validate_get_out_keys_for_inputs', $data ?? [], null); + $this->setIfExists('pos_validate_zvp', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, mixed $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 string[] invalid properties with reasons + */ + public function listInvalidProperties(): array + { + $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(): bool + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets block_processing_time_0 + * + * @return int|null + */ + public function getBlockProcessingTime0(): ?int + { + return $this->container['block_processing_time_0']; + } + + /** + * Sets block_processing_time_0 + * + * @param int|null $block_processing_time_0 block_processing_time_0 + * + * @return $this + */ + public function setBlockProcessingTime0(?int $block_processing_time_0): static + { + if (is_null($block_processing_time_0)) { + throw new InvalidArgumentException('non-nullable block_processing_time_0 cannot be null'); + } + $this->container['block_processing_time_0'] = $block_processing_time_0; + + return $this; + } + + /** + * Gets block_processing_time_1 + * + * @return int|null + */ + public function getBlockProcessingTime1(): ?int + { + return $this->container['block_processing_time_1']; + } + + /** + * Sets block_processing_time_1 + * + * @param int|null $block_processing_time_1 block_processing_time_1 + * + * @return $this + */ + public function setBlockProcessingTime1(?int $block_processing_time_1): static + { + if (is_null($block_processing_time_1)) { + throw new InvalidArgumentException('non-nullable block_processing_time_1 cannot be null'); + } + $this->container['block_processing_time_1'] = $block_processing_time_1; + + return $this; + } + + /** + * Gets target_calculating_time_2 + * + * @return int|null + */ + public function getTargetCalculatingTime2(): ?int + { + return $this->container['target_calculating_time_2']; + } + + /** + * Sets target_calculating_time_2 + * + * @param int|null $target_calculating_time_2 target_calculating_time_2 + * + * @return $this + */ + public function setTargetCalculatingTime2(?int $target_calculating_time_2): static + { + if (is_null($target_calculating_time_2)) { + throw new InvalidArgumentException('non-nullable target_calculating_time_2 cannot be null'); + } + $this->container['target_calculating_time_2'] = $target_calculating_time_2; + + return $this; + } + + /** + * Gets longhash_calculating_time_3 + * + * @return int|null + */ + public function getLonghashCalculatingTime3(): ?int + { + return $this->container['longhash_calculating_time_3']; + } + + /** + * Sets longhash_calculating_time_3 + * + * @param int|null $longhash_calculating_time_3 longhash_calculating_time_3 + * + * @return $this + */ + public function setLonghashCalculatingTime3(?int $longhash_calculating_time_3): static + { + if (is_null($longhash_calculating_time_3)) { + throw new InvalidArgumentException('non-nullable longhash_calculating_time_3 cannot be null'); + } + $this->container['longhash_calculating_time_3'] = $longhash_calculating_time_3; + + return $this; + } + + /** + * Gets all_txs_insert_time_5 + * + * @return int|null + */ + public function getAllTxsInsertTime5(): ?int + { + return $this->container['all_txs_insert_time_5']; + } + + /** + * Sets all_txs_insert_time_5 + * + * @param int|null $all_txs_insert_time_5 all_txs_insert_time_5 + * + * @return $this + */ + public function setAllTxsInsertTime5(?int $all_txs_insert_time_5): static + { + if (is_null($all_txs_insert_time_5)) { + throw new InvalidArgumentException('non-nullable all_txs_insert_time_5 cannot be null'); + } + $this->container['all_txs_insert_time_5'] = $all_txs_insert_time_5; + + return $this; + } + + /** + * Gets etc_stuff_6 + * + * @return int|null + */ + public function getEtcStuff6(): ?int + { + return $this->container['etc_stuff_6']; + } + + /** + * Sets etc_stuff_6 + * + * @param int|null $etc_stuff_6 etc_stuff_6 + * + * @return $this + */ + public function setEtcStuff6(?int $etc_stuff_6): static + { + if (is_null($etc_stuff_6)) { + throw new InvalidArgumentException('non-nullable etc_stuff_6 cannot be null'); + } + $this->container['etc_stuff_6'] = $etc_stuff_6; + + return $this; + } + + /** + * Gets insert_time_4 + * + * @return int|null + */ + public function getInsertTime4(): ?int + { + return $this->container['insert_time_4']; + } + + /** + * Sets insert_time_4 + * + * @param int|null $insert_time_4 insert_time_4 + * + * @return $this + */ + public function setInsertTime4(?int $insert_time_4): static + { + if (is_null($insert_time_4)) { + throw new InvalidArgumentException('non-nullable insert_time_4 cannot be null'); + } + $this->container['insert_time_4'] = $insert_time_4; + + return $this; + } + + /** + * Gets raise_block_core_event + * + * @return int|null + */ + public function getRaiseBlockCoreEvent(): ?int + { + return $this->container['raise_block_core_event']; + } + + /** + * Sets raise_block_core_event + * + * @param int|null $raise_block_core_event raise_block_core_event + * + * @return $this + */ + public function setRaiseBlockCoreEvent(?int $raise_block_core_event): static + { + if (is_null($raise_block_core_event)) { + throw new InvalidArgumentException('non-nullable raise_block_core_event cannot be null'); + } + $this->container['raise_block_core_event'] = $raise_block_core_event; + + return $this; + } + + /** + * Gets validate_miner_transaction_time + * + * @return int|null + */ + public function getValidateMinerTransactionTime(): ?int + { + return $this->container['validate_miner_transaction_time']; + } + + /** + * Sets validate_miner_transaction_time + * + * @param int|null $validate_miner_transaction_time validate_miner_transaction_time + * + * @return $this + */ + public function setValidateMinerTransactionTime(?int $validate_miner_transaction_time): static + { + if (is_null($validate_miner_transaction_time)) { + throw new InvalidArgumentException('non-nullable validate_miner_transaction_time cannot be null'); + } + $this->container['validate_miner_transaction_time'] = $validate_miner_transaction_time; + + return $this; + } + + /** + * Gets collect_rangeproofs_data_from_tx_time + * + * @return int|null + */ + public function getCollectRangeproofsDataFromTxTime(): ?int + { + return $this->container['collect_rangeproofs_data_from_tx_time']; + } + + /** + * Sets collect_rangeproofs_data_from_tx_time + * + * @param int|null $collect_rangeproofs_data_from_tx_time collect_rangeproofs_data_from_tx_time + * + * @return $this + */ + public function setCollectRangeproofsDataFromTxTime(?int $collect_rangeproofs_data_from_tx_time): static + { + if (is_null($collect_rangeproofs_data_from_tx_time)) { + throw new InvalidArgumentException('non-nullable collect_rangeproofs_data_from_tx_time cannot be null'); + } + $this->container['collect_rangeproofs_data_from_tx_time'] = $collect_rangeproofs_data_from_tx_time; + + return $this; + } + + /** + * Gets verify_multiple_zc_outs_range_proofs_time + * + * @return int|null + */ + public function getVerifyMultipleZcOutsRangeProofsTime(): ?int + { + return $this->container['verify_multiple_zc_outs_range_proofs_time']; + } + + /** + * Sets verify_multiple_zc_outs_range_proofs_time + * + * @param int|null $verify_multiple_zc_outs_range_proofs_time verify_multiple_zc_outs_range_proofs_time + * + * @return $this + */ + public function setVerifyMultipleZcOutsRangeProofsTime(?int $verify_multiple_zc_outs_range_proofs_time): static + { + if (is_null($verify_multiple_zc_outs_range_proofs_time)) { + throw new InvalidArgumentException('non-nullable verify_multiple_zc_outs_range_proofs_time cannot be null'); + } + $this->container['verify_multiple_zc_outs_range_proofs_time'] = $verify_multiple_zc_outs_range_proofs_time; + + return $this; + } + + /** + * Gets target_calculating_enum_blocks + * + * @return int|null + */ + public function getTargetCalculatingEnumBlocks(): ?int + { + return $this->container['target_calculating_enum_blocks']; + } + + /** + * Sets target_calculating_enum_blocks + * + * @param int|null $target_calculating_enum_blocks target_calculating_enum_blocks + * + * @return $this + */ + public function setTargetCalculatingEnumBlocks(?int $target_calculating_enum_blocks): static + { + if (is_null($target_calculating_enum_blocks)) { + throw new InvalidArgumentException('non-nullable target_calculating_enum_blocks cannot be null'); + } + $this->container['target_calculating_enum_blocks'] = $target_calculating_enum_blocks; + + return $this; + } + + /** + * Gets target_calculating_calc + * + * @return int|null + */ + public function getTargetCalculatingCalc(): ?int + { + return $this->container['target_calculating_calc']; + } + + /** + * Sets target_calculating_calc + * + * @param int|null $target_calculating_calc target_calculating_calc + * + * @return $this + */ + public function setTargetCalculatingCalc(?int $target_calculating_calc): static + { + if (is_null($target_calculating_calc)) { + throw new InvalidArgumentException('non-nullable target_calculating_calc cannot be null'); + } + $this->container['target_calculating_calc'] = $target_calculating_calc; + + return $this; + } + + /** + * Gets pos_validate_ki_search + * + * @return int|null + */ + public function getPosValidateKiSearch(): ?int + { + return $this->container['pos_validate_ki_search']; + } + + /** + * Sets pos_validate_ki_search + * + * @param int|null $pos_validate_ki_search pos_validate_ki_search + * + * @return $this + */ + public function setPosValidateKiSearch(?int $pos_validate_ki_search): static + { + if (is_null($pos_validate_ki_search)) { + throw new InvalidArgumentException('non-nullable pos_validate_ki_search cannot be null'); + } + $this->container['pos_validate_ki_search'] = $pos_validate_ki_search; + + return $this; + } + + /** + * Gets pos_validate_get_out_keys_for_inputs + * + * @return int|null + */ + public function getPosValidateGetOutKeysForInputs(): ?int + { + return $this->container['pos_validate_get_out_keys_for_inputs']; + } + + /** + * Sets pos_validate_get_out_keys_for_inputs + * + * @param int|null $pos_validate_get_out_keys_for_inputs pos_validate_get_out_keys_for_inputs + * + * @return $this + */ + public function setPosValidateGetOutKeysForInputs(?int $pos_validate_get_out_keys_for_inputs): static + { + if (is_null($pos_validate_get_out_keys_for_inputs)) { + throw new InvalidArgumentException('non-nullable pos_validate_get_out_keys_for_inputs cannot be null'); + } + $this->container['pos_validate_get_out_keys_for_inputs'] = $pos_validate_get_out_keys_for_inputs; + + return $this; + } + + /** + * Gets pos_validate_zvp + * + * @return int|null + */ + public function getPosValidateZvp(): ?int + { + return $this->container['pos_validate_zvp']; + } + + /** + * Sets pos_validate_zvp + * + * @param int|null $pos_validate_zvp pos_validate_zvp + * + * @return $this + */ + public function setPosValidateZvp(?int $pos_validate_zvp): static + { + if (is_null($pos_validate_zvp)) { + throw new InvalidArgumentException('non-nullable pos_validate_zvp cannot be null'); + } + $this->container['pos_validate_zvp'] = $pos_validate_zvp; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists(mixed $offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[ReturnTypeWillChange] + public function offsetGet(mixed $offset): mixed + { + 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(mixed $offset, mixed $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(mixed $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(): mixed + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString(): string + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue(): string + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/utils/sdk/client/php/src/BlockTemplateModel.php b/utils/sdk/client/php/src/BlockTemplateModel.php new file mode 100644 index 00000000..7087d40f --- /dev/null +++ b/utils/sdk/client/php/src/BlockTemplateModel.php @@ -0,0 +1,679 @@ + + */ +class BlockTemplateModel implements ModelInterface, ArrayAccess, JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = 'BlockTemplateModel'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPITypes = [ + 'blocktemplate_blob' => 'string', + 'difficulty' => 'string', + 'height' => 'int', + 'miner_tx_tgc' => '\lthn\lthn\TxGenerationContextModel', + 'block_reward_without_fee' => 'int', + 'block_reward' => 'int', + 'txs_fee' => 'int', + 'prev_hash' => 'string', + 'seed' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPIFormats = [ + 'blocktemplate_blob' => null, + 'difficulty' => null, + 'height' => null, + 'miner_tx_tgc' => null, + 'block_reward_without_fee' => null, + 'block_reward' => null, + 'txs_fee' => null, + 'prev_hash' => null, + 'seed' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'blocktemplate_blob' => false, + 'difficulty' => false, + 'height' => false, + 'miner_tx_tgc' => false, + 'block_reward_without_fee' => false, + 'block_reward' => false, + 'txs_fee' => false, + 'prev_hash' => false, + 'seed' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes(): array + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats(): array + { + 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 array + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param array $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 array + */ + protected static array $attributeMap = [ + 'blocktemplate_blob' => 'blocktemplate_blob', + 'difficulty' => 'difficulty', + 'height' => 'height', + 'miner_tx_tgc' => 'miner_tx_tgc', + 'block_reward_without_fee' => 'block_reward_without_fee', + 'block_reward' => 'block_reward', + 'txs_fee' => 'txs_fee', + 'prev_hash' => 'prev_hash', + 'seed' => 'seed' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var array + */ + protected static array $setters = [ + 'blocktemplate_blob' => 'setBlocktemplateBlob', + 'difficulty' => 'setDifficulty', + 'height' => 'setHeight', + 'miner_tx_tgc' => 'setMinerTxTgc', + 'block_reward_without_fee' => 'setBlockRewardWithoutFee', + 'block_reward' => 'setBlockReward', + 'txs_fee' => 'setTxsFee', + 'prev_hash' => 'setPrevHash', + 'seed' => 'setSeed' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var array + */ + protected static array $getters = [ + 'blocktemplate_blob' => 'getBlocktemplateBlob', + 'difficulty' => 'getDifficulty', + 'height' => 'getHeight', + 'miner_tx_tgc' => 'getMinerTxTgc', + 'block_reward_without_fee' => 'getBlockRewardWithoutFee', + 'block_reward' => 'getBlockReward', + 'txs_fee' => 'getTxsFee', + 'prev_hash' => 'getPrevHash', + 'seed' => 'getSeed' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap(): array + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters(): array + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters(): array + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName(): string + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var array + */ + protected array $container = []; + + /** + * Constructor + * + * @param array $data Associated array of property values initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('blocktemplate_blob', $data ?? [], null); + $this->setIfExists('difficulty', $data ?? [], null); + $this->setIfExists('height', $data ?? [], null); + $this->setIfExists('miner_tx_tgc', $data ?? [], null); + $this->setIfExists('block_reward_without_fee', $data ?? [], null); + $this->setIfExists('block_reward', $data ?? [], null); + $this->setIfExists('txs_fee', $data ?? [], null); + $this->setIfExists('prev_hash', $data ?? [], null); + $this->setIfExists('seed', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, mixed $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 string[] invalid properties with reasons + */ + public function listInvalidProperties(): array + { + $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(): bool + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets blocktemplate_blob + * + * @return string|null + */ + public function getBlocktemplateBlob(): ?string + { + return $this->container['blocktemplate_blob']; + } + + /** + * Sets blocktemplate_blob + * + * @param string|null $blocktemplate_blob blocktemplate_blob + * + * @return $this + */ + public function setBlocktemplateBlob(?string $blocktemplate_blob): static + { + if (is_null($blocktemplate_blob)) { + throw new InvalidArgumentException('non-nullable blocktemplate_blob cannot be null'); + } + $this->container['blocktemplate_blob'] = $blocktemplate_blob; + + return $this; + } + + /** + * Gets difficulty + * + * @return string|null + */ + public function getDifficulty(): ?string + { + return $this->container['difficulty']; + } + + /** + * Sets difficulty + * + * @param string|null $difficulty difficulty + * + * @return $this + */ + public function setDifficulty(?string $difficulty): static + { + if (is_null($difficulty)) { + throw new InvalidArgumentException('non-nullable difficulty cannot be null'); + } + $this->container['difficulty'] = $difficulty; + + return $this; + } + + /** + * Gets height + * + * @return int|null + */ + public function getHeight(): ?int + { + return $this->container['height']; + } + + /** + * Sets height + * + * @param int|null $height height + * + * @return $this + */ + public function setHeight(?int $height): static + { + if (is_null($height)) { + throw new InvalidArgumentException('non-nullable height cannot be null'); + } + $this->container['height'] = $height; + + return $this; + } + + /** + * Gets miner_tx_tgc + * + * @return \lthn\lthn\TxGenerationContextModel|null + */ + public function getMinerTxTgc(): ?\lthn\lthn\TxGenerationContextModel + { + return $this->container['miner_tx_tgc']; + } + + /** + * Sets miner_tx_tgc + * + * @param \lthn\lthn\TxGenerationContextModel|null $miner_tx_tgc miner_tx_tgc + * + * @return $this + */ + public function setMinerTxTgc(?\lthn\lthn\TxGenerationContextModel $miner_tx_tgc): static + { + if (is_null($miner_tx_tgc)) { + throw new InvalidArgumentException('non-nullable miner_tx_tgc cannot be null'); + } + $this->container['miner_tx_tgc'] = $miner_tx_tgc; + + return $this; + } + + /** + * Gets block_reward_without_fee + * + * @return int|null + */ + public function getBlockRewardWithoutFee(): ?int + { + return $this->container['block_reward_without_fee']; + } + + /** + * Sets block_reward_without_fee + * + * @param int|null $block_reward_without_fee block_reward_without_fee + * + * @return $this + */ + public function setBlockRewardWithoutFee(?int $block_reward_without_fee): static + { + if (is_null($block_reward_without_fee)) { + throw new InvalidArgumentException('non-nullable block_reward_without_fee cannot be null'); + } + $this->container['block_reward_without_fee'] = $block_reward_without_fee; + + return $this; + } + + /** + * Gets block_reward + * + * @return int|null + */ + public function getBlockReward(): ?int + { + return $this->container['block_reward']; + } + + /** + * Sets block_reward + * + * @param int|null $block_reward block_reward + * + * @return $this + */ + public function setBlockReward(?int $block_reward): static + { + if (is_null($block_reward)) { + throw new InvalidArgumentException('non-nullable block_reward cannot be null'); + } + $this->container['block_reward'] = $block_reward; + + return $this; + } + + /** + * Gets txs_fee + * + * @return int|null + */ + public function getTxsFee(): ?int + { + return $this->container['txs_fee']; + } + + /** + * Sets txs_fee + * + * @param int|null $txs_fee txs_fee + * + * @return $this + */ + public function setTxsFee(?int $txs_fee): static + { + if (is_null($txs_fee)) { + throw new InvalidArgumentException('non-nullable txs_fee cannot be null'); + } + $this->container['txs_fee'] = $txs_fee; + + return $this; + } + + /** + * Gets prev_hash + * + * @return string|null + */ + public function getPrevHash(): ?string + { + return $this->container['prev_hash']; + } + + /** + * Sets prev_hash + * + * @param string|null $prev_hash prev_hash + * + * @return $this + */ + public function setPrevHash(?string $prev_hash): static + { + if (is_null($prev_hash)) { + throw new InvalidArgumentException('non-nullable prev_hash cannot be null'); + } + $this->container['prev_hash'] = $prev_hash; + + return $this; + } + + /** + * Gets seed + * + * @return string|null + */ + public function getSeed(): ?string + { + return $this->container['seed']; + } + + /** + * Sets seed + * + * @param string|null $seed seed + * + * @return $this + */ + public function setSeed(?string $seed): static + { + if (is_null($seed)) { + throw new InvalidArgumentException('non-nullable seed cannot be null'); + } + $this->container['seed'] = $seed; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists(mixed $offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[ReturnTypeWillChange] + public function offsetGet(mixed $offset): mixed + { + 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(mixed $offset, mixed $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(mixed $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(): mixed + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString(): string + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue(): string + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/utils/sdk/client/php/src/BlockTemplateRequestModel.php b/utils/sdk/client/php/src/BlockTemplateRequestModel.php new file mode 100644 index 00000000..f33ad845 --- /dev/null +++ b/utils/sdk/client/php/src/BlockTemplateRequestModel.php @@ -0,0 +1,611 @@ + + */ +class BlockTemplateRequestModel implements ModelInterface, ArrayAccess, JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = 'BlockTemplateRequestModel'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPITypes = [ + 'miner_address' => 'string', + 'stakeholder_address' => 'string', + 'ex_nonce' => 'string', + 'pos_block' => 'bool', + 'ignore_pow_ts_check' => 'bool', + 'pe' => '\lthn\lthn\PosEntryModel', + 'explicit_txs' => 'string[]' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPIFormats = [ + 'miner_address' => null, + 'stakeholder_address' => null, + 'ex_nonce' => null, + 'pos_block' => null, + 'ignore_pow_ts_check' => null, + 'pe' => null, + 'explicit_txs' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'miner_address' => false, + 'stakeholder_address' => false, + 'ex_nonce' => false, + 'pos_block' => false, + 'ignore_pow_ts_check' => false, + 'pe' => false, + 'explicit_txs' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes(): array + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats(): array + { + 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 array + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param array $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 array + */ + protected static array $attributeMap = [ + 'miner_address' => 'miner_address', + 'stakeholder_address' => 'stakeholder_address', + 'ex_nonce' => 'ex_nonce', + 'pos_block' => 'pos_block', + 'ignore_pow_ts_check' => 'ignore_pow_ts_check', + 'pe' => 'pe', + 'explicit_txs' => 'explicit_txs' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var array + */ + protected static array $setters = [ + 'miner_address' => 'setMinerAddress', + 'stakeholder_address' => 'setStakeholderAddress', + 'ex_nonce' => 'setExNonce', + 'pos_block' => 'setPosBlock', + 'ignore_pow_ts_check' => 'setIgnorePowTsCheck', + 'pe' => 'setPe', + 'explicit_txs' => 'setExplicitTxs' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var array + */ + protected static array $getters = [ + 'miner_address' => 'getMinerAddress', + 'stakeholder_address' => 'getStakeholderAddress', + 'ex_nonce' => 'getExNonce', + 'pos_block' => 'getPosBlock', + 'ignore_pow_ts_check' => 'getIgnorePowTsCheck', + 'pe' => 'getPe', + 'explicit_txs' => 'getExplicitTxs' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap(): array + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters(): array + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters(): array + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName(): string + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var array + */ + protected array $container = []; + + /** + * Constructor + * + * @param array $data Associated array of property values initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('miner_address', $data ?? [], null); + $this->setIfExists('stakeholder_address', $data ?? [], null); + $this->setIfExists('ex_nonce', $data ?? [], null); + $this->setIfExists('pos_block', $data ?? [], null); + $this->setIfExists('ignore_pow_ts_check', $data ?? [], null); + $this->setIfExists('pe', $data ?? [], null); + $this->setIfExists('explicit_txs', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, mixed $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 string[] invalid properties with reasons + */ + public function listInvalidProperties(): array + { + $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(): bool + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets miner_address + * + * @return string|null + */ + public function getMinerAddress(): ?string + { + return $this->container['miner_address']; + } + + /** + * Sets miner_address + * + * @param string|null $miner_address miner_address + * + * @return $this + */ + public function setMinerAddress(?string $miner_address): static + { + if (is_null($miner_address)) { + throw new InvalidArgumentException('non-nullable miner_address cannot be null'); + } + $this->container['miner_address'] = $miner_address; + + return $this; + } + + /** + * Gets stakeholder_address + * + * @return string|null + */ + public function getStakeholderAddress(): ?string + { + return $this->container['stakeholder_address']; + } + + /** + * Sets stakeholder_address + * + * @param string|null $stakeholder_address stakeholder_address + * + * @return $this + */ + public function setStakeholderAddress(?string $stakeholder_address): static + { + if (is_null($stakeholder_address)) { + throw new InvalidArgumentException('non-nullable stakeholder_address cannot be null'); + } + $this->container['stakeholder_address'] = $stakeholder_address; + + return $this; + } + + /** + * Gets ex_nonce + * + * @return string|null + */ + public function getExNonce(): ?string + { + return $this->container['ex_nonce']; + } + + /** + * Sets ex_nonce + * + * @param string|null $ex_nonce ex_nonce + * + * @return $this + */ + public function setExNonce(?string $ex_nonce): static + { + if (is_null($ex_nonce)) { + throw new InvalidArgumentException('non-nullable ex_nonce cannot be null'); + } + $this->container['ex_nonce'] = $ex_nonce; + + return $this; + } + + /** + * Gets pos_block + * + * @return bool|null + */ + public function getPosBlock(): ?bool + { + return $this->container['pos_block']; + } + + /** + * Sets pos_block + * + * @param bool|null $pos_block pos_block + * + * @return $this + */ + public function setPosBlock(?bool $pos_block): static + { + if (is_null($pos_block)) { + throw new InvalidArgumentException('non-nullable pos_block cannot be null'); + } + $this->container['pos_block'] = $pos_block; + + return $this; + } + + /** + * Gets ignore_pow_ts_check + * + * @return bool|null + */ + public function getIgnorePowTsCheck(): ?bool + { + return $this->container['ignore_pow_ts_check']; + } + + /** + * Sets ignore_pow_ts_check + * + * @param bool|null $ignore_pow_ts_check ignore_pow_ts_check + * + * @return $this + */ + public function setIgnorePowTsCheck(?bool $ignore_pow_ts_check): static + { + if (is_null($ignore_pow_ts_check)) { + throw new InvalidArgumentException('non-nullable ignore_pow_ts_check cannot be null'); + } + $this->container['ignore_pow_ts_check'] = $ignore_pow_ts_check; + + return $this; + } + + /** + * Gets pe + * + * @return \lthn\lthn\PosEntryModel|null + */ + public function getPe(): ?\lthn\lthn\PosEntryModel + { + return $this->container['pe']; + } + + /** + * Sets pe + * + * @param \lthn\lthn\PosEntryModel|null $pe pe + * + * @return $this + */ + public function setPe(?\lthn\lthn\PosEntryModel $pe): static + { + if (is_null($pe)) { + throw new InvalidArgumentException('non-nullable pe cannot be null'); + } + $this->container['pe'] = $pe; + + return $this; + } + + /** + * Gets explicit_txs + * + * @return string[]|null + */ + public function getExplicitTxs(): ?array + { + return $this->container['explicit_txs']; + } + + /** + * Sets explicit_txs + * + * @param string[]|null $explicit_txs explicit_txs + * + * @return $this + */ + public function setExplicitTxs(?array $explicit_txs): static + { + if (is_null($explicit_txs)) { + throw new InvalidArgumentException('non-nullable explicit_txs cannot be null'); + } + $this->container['explicit_txs'] = $explicit_txs; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists(mixed $offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[ReturnTypeWillChange] + public function offsetGet(mixed $offset): mixed + { + 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(mixed $offset, mixed $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(mixed $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(): mixed + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString(): string + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue(): string + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/utils/sdk/client/php/src/Configuration.php b/utils/sdk/client/php/src/Configuration.php new file mode 100644 index 00000000..ec78a471 --- /dev/null +++ b/utils/sdk/client/php/src/Configuration.php @@ -0,0 +1,531 @@ +tempFolderPath = sys_get_temp_dir(); + } + + /** + * Sets API key + * + * @param string $apiKeyIdentifier API key identifier (authentication scheme) + * @param string $key API key or token + * + * @return $this + */ + public function setApiKey(string $apiKeyIdentifier, string $key): static + { + $this->apiKeys[$apiKeyIdentifier] = $key; + return $this; + } + + /** + * Gets API key + * + * @param string $apiKeyIdentifier API key identifier (authentication scheme) + * + * @return null|string API key or token + */ + public function getApiKey(string $apiKeyIdentifier): ?string + { + return $this->apiKeys[$apiKeyIdentifier] ?? null; + } + + /** + * Sets the prefix for API key (e.g. Bearer) + * + * @param string $apiKeyIdentifier API key identifier (authentication scheme) + * @param string $prefix API key prefix, e.g. Bearer + * + * @return $this + */ + public function setApiKeyPrefix(string $apiKeyIdentifier, string $prefix): static + { + $this->apiKeyPrefixes[$apiKeyIdentifier] = $prefix; + return $this; + } + + /** + * Gets API key prefix + * + * @param string $apiKeyIdentifier API key identifier (authentication scheme) + * + * @return null|string + */ + public function getApiKeyPrefix(string $apiKeyIdentifier): ?string + { + return $this->apiKeyPrefixes[$apiKeyIdentifier] ?? null; + } + + /** + * Sets the access token for OAuth + * + * @param string $accessToken Token for OAuth + * + * @return $this + */ + public function setAccessToken(string $accessToken): static + { + $this->accessToken = $accessToken; + return $this; + } + + /** + * Gets the access token for OAuth + * + * @return string Access token for OAuth + */ + public function getAccessToken(): string + { + return $this->accessToken; + } + + /** + * Sets boolean format for query string. + * + * @param string $booleanFormat Boolean format for query string + * + * @return $this + */ + public function setBooleanFormatForQueryString(string $booleanFormat): static + { + $this->booleanFormatForQueryString = $booleanFormat; + + return $this; + } + + /** + * Gets boolean format for query string. + * + * @return string Boolean format for query string + */ + public function getBooleanFormatForQueryString(): string + { + return $this->booleanFormatForQueryString; + } + + /** + * Sets the username for HTTP basic authentication + * + * @param string $username Username for HTTP basic authentication + * + * @return $this + */ + public function setUsername(string $username): static + { + $this->username = $username; + return $this; + } + + /** + * Gets the username for HTTP basic authentication + * + * @return string Username for HTTP basic authentication + */ + public function getUsername(): string + { + return $this->username; + } + + /** + * Sets the password for HTTP basic authentication + * + * @param string $password Password for HTTP basic authentication + * + * @return $this + */ + public function setPassword(string $password): static + { + $this->password = $password; + return $this; + } + + /** + * Gets the password for HTTP basic authentication + * + * @return string Password for HTTP basic authentication + */ + public function getPassword(): string + { + return $this->password; + } + + /** + * Sets the host + * + * @param string $host Host + * + * @return $this + */ + public function setHost(string $host): static + { + $this->host = $host; + return $this; + } + + /** + * Gets the host + * + * @return string Host + */ + public function getHost(): string + { + return $this->host; + } + + /** + * Sets the user agent of the api client + * + * @param string $userAgent the user agent of the api client + * + * @throws InvalidArgumentException + * @return $this + */ + public function setUserAgent(string $userAgent): static + { + $this->userAgent = $userAgent; + return $this; + } + + /** + * Gets the user agent of the api client + * + * @return string user agent + */ + public function getUserAgent(): string + { + return $this->userAgent; + } + + /** + * Sets debug flag + * + * @param bool $debug Debug flag + * + * @return $this + */ + public function setDebug(bool $debug): static + { + $this->debug = $debug; + return $this; + } + + /** + * Gets the debug flag + * + * @return bool + */ + public function getDebug(): bool + { + return $this->debug; + } + + /** + * Sets the debug file + * + * @param string $debugFile Debug file + * + * @return $this + */ + public function setDebugFile(string $debugFile): static + { + $this->debugFile = $debugFile; + return $this; + } + + /** + * Gets the debug file + * + * @return string + */ + public function getDebugFile(): string + { + return $this->debugFile; + } + + /** + * Sets the temp folder path + * + * @param string $tempFolderPath Temp folder path + * + * @return $this + */ + public function setTempFolderPath(string $tempFolderPath): static + { + $this->tempFolderPath = $tempFolderPath; + return $this; + } + + /** + * Gets the temp folder path + * + * @return string Temp folder path + */ + public function getTempFolderPath(): string + { + return $this->tempFolderPath; + } + + /** + * Gets the default configuration instance + * + * @return Configuration + */ + public static function getDefaultConfiguration(): Configuration + { + if (self::$defaultConfiguration === null) { + self::$defaultConfiguration = new Configuration(); + } + + return self::$defaultConfiguration; + } + + /** + * Sets the default configuration instance + * + * @param Configuration $config An instance of the Configuration Object + * + * @return void + */ + public static function setDefaultConfiguration(Configuration $config): void + { + self::$defaultConfiguration = $config; + } + + /** + * Gets the essential information for debugging + * + * @return string The report for debugging + */ + public static function toDebugReport(): string + { + $report = 'PHP SDK (lthn) Debug Report:' . PHP_EOL; + $report .= ' OS: ' . php_uname() . PHP_EOL; + $report .= ' PHP Version: ' . PHP_VERSION . PHP_EOL; + $report .= ' The version of the OpenAPI document: 6.0.1' . PHP_EOL; + $report .= ' SDK Package Version: 6.0.1' . PHP_EOL; + $report .= ' Temp Folder Path: ' . self::getDefaultConfiguration()->getTempFolderPath() . PHP_EOL; + + return $report; + } + + /** + * Get API key (with prefix if set) + * + * @param string $apiKeyIdentifier name of apikey + * + * @return null|string API key with the prefix + */ + public function getApiKeyWithPrefix(string $apiKeyIdentifier): ?string + { + $prefix = $this->getApiKeyPrefix($apiKeyIdentifier); + $apiKey = $this->getApiKey($apiKeyIdentifier); + + if ($apiKey === null) { + return null; + } + + if ($prefix === null) { + $keyWithPrefix = $apiKey; + } else { + $keyWithPrefix = $prefix . ' ' . $apiKey; + } + + return $keyWithPrefix; + } + + /** + * Returns an array of host settings + * + * @return array an array of host settings + */ + public function getHostSettings(): array + { + return [ + [ + "url" => "http://127.0.0.1:36943", + "description" => "Local Daemon", + ], + [ + "url" => "http://seed.lethean.io:36943", + "description" => "Seed Server", + ] + ]; + } + + /** + * Returns URL based on host settings, index and variables + * + * @param array $hostSettings array of host settings, generated from getHostSettings() or equivalent from the API clients + * @param int $hostIndex index of the host settings + * @param array|null $variables hash of variable and the corresponding value (optional) + * @return string URL based on host settings + */ + public static function getHostString(array $hostSettings, int $hostIndex, ?array $variables = null): string + { + if (null === $variables) { + $variables = []; + } + + // check array index out of bound + if ($hostIndex < 0 || $hostIndex >= count($hostSettings)) { + throw new InvalidArgumentException("Invalid index $hostIndex when selecting the host. Must be less than ".count($hostSettings)); + } + + $host = $hostSettings[$hostIndex]; + $url = $host["url"]; + + // go through variable and assign a value + foreach ($host["variables"] ?? [] as $name => $variable) { + if (array_key_exists($name, $variables)) { // check to see if it's in the variables provided by the user + if (!isset($variable['enum_values']) || in_array($variables[$name], $variable["enum_values"], true)) { // check to see if the value is in the enum + $url = str_replace("{".$name."}", $variables[$name], $url); + } else { + throw new InvalidArgumentException("The variable `$name` in the host URL has invalid value ".$variables[$name].". Must be ".join(',', $variable["enum_values"])."."); + } + } else { + // use default value + $url = str_replace("{".$name."}", $variable["default_value"], $url); + } + } + + return $url; + } + + /** + * Returns URL based on the index and variables + * + * @param int $index index of the host settings + * @param array|null $variables hash of variable and the corresponding value (optional) + * @return string URL based on host settings + */ + public function getHostFromSettings(int $index, ?array $variables = null): string + { + return self::getHostString($this->getHostSettings(), $index, $variables); + } +} diff --git a/utils/sdk/client/php/src/DbStatInfoModel.php b/utils/sdk/client/php/src/DbStatInfoModel.php new file mode 100644 index 00000000..345029f7 --- /dev/null +++ b/utils/sdk/client/php/src/DbStatInfoModel.php @@ -0,0 +1,475 @@ + + */ +class DbStatInfoModel implements ModelInterface, ArrayAccess, JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = 'DbStatInfoModel'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPITypes = [ + 'tx_count' => 'int', + 'write_tx_count' => 'int', + 'map_size' => 'int' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPIFormats = [ + 'tx_count' => null, + 'write_tx_count' => null, + 'map_size' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'tx_count' => false, + 'write_tx_count' => false, + 'map_size' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes(): array + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats(): array + { + 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 array + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param array $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 array + */ + protected static array $attributeMap = [ + 'tx_count' => 'tx_count', + 'write_tx_count' => 'write_tx_count', + 'map_size' => 'map_size' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var array + */ + protected static array $setters = [ + 'tx_count' => 'setTxCount', + 'write_tx_count' => 'setWriteTxCount', + 'map_size' => 'setMapSize' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var array + */ + protected static array $getters = [ + 'tx_count' => 'getTxCount', + 'write_tx_count' => 'getWriteTxCount', + 'map_size' => 'getMapSize' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap(): array + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters(): array + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters(): array + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName(): string + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var array + */ + protected array $container = []; + + /** + * Constructor + * + * @param array $data Associated array of property values initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('tx_count', $data ?? [], null); + $this->setIfExists('write_tx_count', $data ?? [], null); + $this->setIfExists('map_size', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, mixed $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 string[] invalid properties with reasons + */ + public function listInvalidProperties(): array + { + $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(): bool + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets tx_count + * + * @return int|null + */ + public function getTxCount(): ?int + { + return $this->container['tx_count']; + } + + /** + * Sets tx_count + * + * @param int|null $tx_count tx_count + * + * @return $this + */ + public function setTxCount(?int $tx_count): static + { + if (is_null($tx_count)) { + throw new InvalidArgumentException('non-nullable tx_count cannot be null'); + } + $this->container['tx_count'] = $tx_count; + + return $this; + } + + /** + * Gets write_tx_count + * + * @return int|null + */ + public function getWriteTxCount(): ?int + { + return $this->container['write_tx_count']; + } + + /** + * Sets write_tx_count + * + * @param int|null $write_tx_count write_tx_count + * + * @return $this + */ + public function setWriteTxCount(?int $write_tx_count): static + { + if (is_null($write_tx_count)) { + throw new InvalidArgumentException('non-nullable write_tx_count cannot be null'); + } + $this->container['write_tx_count'] = $write_tx_count; + + return $this; + } + + /** + * Gets map_size + * + * @return int|null + */ + public function getMapSize(): ?int + { + return $this->container['map_size']; + } + + /** + * Sets map_size + * + * @param int|null $map_size map_size + * + * @return $this + */ + public function setMapSize(?int $map_size): static + { + if (is_null($map_size)) { + throw new InvalidArgumentException('non-nullable map_size cannot be null'); + } + $this->container['map_size'] = $map_size; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists(mixed $offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[ReturnTypeWillChange] + public function offsetGet(mixed $offset): mixed + { + 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(mixed $offset, mixed $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(mixed $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(): mixed + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString(): string + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue(): string + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/utils/sdk/client/php/src/FormDataProcessor.php b/utils/sdk/client/php/src/FormDataProcessor.php new file mode 100644 index 00000000..28bea3b1 --- /dev/null +++ b/utils/sdk/client/php/src/FormDataProcessor.php @@ -0,0 +1,240 @@ + $values the value of the form parameter + * + * @return array [key => value] of formdata + */ + public function prepare(array $values): array + { + $this->has_file = false; + $result = []; + + foreach ($values as $k => $v) { + if ($v === null) { + continue; + } + + $result[$k] = $this->makeFormSafe($v); + } + + return $result; + } + + /** + * Flattens a multi-level array of data and generates a single-level array + * compatible with formdata - a single-level array where the keys use bracket + * notation to signify nested data. + * + * credit: https://github.com/FranBar1966/FlatPHP + */ + public static function flatten(array $source, string $start = ''): array + { + $opt = [ + 'prefix' => '[', + 'suffix' => ']', + 'suffix-end' => true, + 'prefix-list' => '[', + 'suffix-list' => ']', + 'suffix-list-end' => true, + ]; + + if ($start === '') { + $currentPrefix = ''; + $currentSuffix = ''; + $currentSuffixEnd = false; + } elseif (array_is_list($source)) { + $currentPrefix = $opt['prefix-list']; + $currentSuffix = $opt['suffix-list']; + $currentSuffixEnd = $opt['suffix-list-end']; + } else { + $currentPrefix = $opt['prefix']; + $currentSuffix = $opt['suffix']; + $currentSuffixEnd = $opt['suffix-end']; + } + + $currentName = $start; + $result = []; + + foreach ($source as $key => $val) { + $currentName .= $currentPrefix . $key; + + if (is_array($val) && !empty($val)) { + $currentName .= $currentSuffix; + $result += self::flatten($val, $currentName); + } else { + if ($currentSuffixEnd) { + $currentName .= $currentSuffix; + } + + if (is_resource($val)) { + $result[$currentName] = $val; + } else { + $result[$currentName] = ObjectSerializer::toString($val); + } + } + + $currentName = $start; + } + + return $result; + } + + /** + * formdata must be limited to scalars or arrays of scalar values, + * or a resource for a file upload. Here we iterate through all available + * data and identify how to handle each scenario + * + * @param string|bool|array|DateTime|ArrayAccess|SplFileObject $value + */ + protected function makeFormSafe(mixed $value) + { + if ($value instanceof SplFileObject) { + return $this->processFiles([$value])[0]; + } + + if (is_resource($value)) { + $this->has_file = true; + + return $value; + } + + if ($value instanceof ModelInterface) { + return $this->processModel($value); + } + + if (is_array($value) || is_object($value)) { + $data = []; + + foreach ($value as $k => $v) { + $data[$k] = $this->makeFormSafe($v); + } + + return $data; + } + + return ObjectSerializer::toString($value); + } + + /** + * We are able to handle nested ModelInterface. We do not simply call + * json_decode(json_encode()) because any given model may have binary data + * or other data that cannot be serialized to a JSON string + */ + protected function processModel(ModelInterface $model): array + { + $result = []; + + foreach ($model::openAPITypes() as $name => $type) { + $value = $model->offsetGet($name); + + if ($value === null) { + continue; + } + + if (str_contains($type, '\SplFileObject')) { + $file = is_array($value) ? $value : [$value]; + $result[$name] = $this->processFiles($file); + + continue; + } + + if ($value instanceof ModelInterface) { + $result[$name] = $this->processModel($value); + + continue; + } + + if (is_array($value) || is_object($value)) { + $result[$name] = $this->makeFormSafe($value); + + continue; + } + + $result[$name] = ObjectSerializer::toString($value); + } + + return $result; + } + + /** + * Handle file data + */ + protected function processFiles(array $files): array + { + $this->has_file = true; + + $result = []; + + foreach ($files as $i => $file) { + if (is_array($file)) { + $result[$i] = $this->processFiles($file); + + continue; + } + + if ($file instanceof StreamInterface) { + $result[$i] = $file; + + continue; + } + + if ($file instanceof SplFileObject) { + $result[$i] = $this->tryFopen($file); + } + } + + return $result; + } + + private function tryFopen(SplFileObject $file) + { + return Utils::tryFopen($file->getRealPath(), 'rb'); + } +} diff --git a/utils/sdk/client/php/src/HeaderSelector.php b/utils/sdk/client/php/src/HeaderSelector.php new file mode 100644 index 00000000..b040159b --- /dev/null +++ b/utils/sdk/client/php/src/HeaderSelector.php @@ -0,0 +1,243 @@ +selectAcceptHeader($accept); + if ($accept !== null) { + $headers['Accept'] = $accept; + } + + if (!$isMultipart) { + if($contentType === '') { + $contentType = 'application/json'; + } + + $headers['Content-Type'] = $contentType; + } + + return $headers; + } + + /** + * Return the header 'Accept' based on an array of Accept provided. + * + * @param string[] $accept Array of header + * + * @return null|string Accept (e.g. application/json) + */ + private function selectAcceptHeader(array $accept): ?string + { + # filter out empty entries + $accept = array_filter($accept); + + if (count($accept) === 0) { + return null; + } + + # If there's only one Accept header, just use it + if (count($accept) === 1) { + return reset($accept); + } + + # If none of the available Accept headers is of type "json", then just use all them + $headersWithJson = preg_grep('~(?i)^(application/json|[^;/ \t]+/[^;/ \t]+[+]json)[ \t]*(;.*)?$~', $accept); + if (count($headersWithJson) === 0) { + return implode(',', $accept); + } + + # If we got here, then we need add quality values (weight), as described in IETF RFC 9110, Items 12.4.2/12.5.1, + # to give the highest priority to json-like headers - recalculating the existing ones, if needed + return $this->getAcceptHeaderWithAdjustedWeight($accept, $headersWithJson); + } + + /** + * Create an Accept header string from the given "Accept" headers array, recalculating all weights + * + * @param string[] $accept Array of Accept Headers + * @param string[] $headersWithJson Array of Accept Headers of type "json" + * + * @return string "Accept" Header (e.g. "application/json, text/html; q=0.9") + */ + private function getAcceptHeaderWithAdjustedWeight(array $accept, array $headersWithJson): string + { + $processedHeaders = [ + 'withApplicationJson' => [], + 'withJson' => [], + 'withoutJson' => [], + ]; + + foreach ($accept as $header) { + + $headerData = $this->getHeaderAndWeight($header); + + if (stripos($headerData['header'], 'application/json') === 0) { + $processedHeaders['withApplicationJson'][] = $headerData; + } elseif (in_array($header, $headersWithJson, true)) { + $processedHeaders['withJson'][] = $headerData; + } else { + $processedHeaders['withoutJson'][] = $headerData; + } + } + + $acceptHeaders = []; + $currentWeight = 1000; + + $hasMoreThan28Headers = count($accept) > 28; + + foreach($processedHeaders as $headers) { + if (count($headers) > 0) { + $acceptHeaders[] = $this->adjustWeight($headers, $currentWeight, $hasMoreThan28Headers); + } + } + + $acceptHeaders = array_merge(...$acceptHeaders); + + return implode(',', $acceptHeaders); + } + + /** + * Given an Accept header, returns an associative array splitting the header and its weight + * + * @param string $header "Accept" Header + * + * @return array with the header and its weight + */ + private function getHeaderAndWeight(string $header): array + { + # matches headers with weight, splitting the header and the weight in $outputArray + if (preg_match('/(.*);\s*q=(1(?:\.0+)?|0\.\d+)$/', $header, $outputArray) === 1) { + $headerData = [ + 'header' => $outputArray[1], + 'weight' => (int)($outputArray[2] * 1000), + ]; + } else { + $headerData = [ + 'header' => trim($header), + 'weight' => 1000, + ]; + } + + return $headerData; + } + + /** + * @param array[] $headers + * @param float $currentWeight + * @param bool $hasMoreThan28Headers + * @return string[] array of adjusted "Accept" headers + */ + private function adjustWeight(array $headers, float &$currentWeight, bool $hasMoreThan28Headers): array + { + usort($headers, function (array $a, array $b) { + return $b['weight'] - $a['weight']; + }); + + $acceptHeaders = []; + foreach ($headers as $index => $header) { + if($index > 0 && $headers[$index - 1]['weight'] > $header['weight']) + { + $currentWeight = $this->getNextWeight($currentWeight, $hasMoreThan28Headers); + } + + $weight = $currentWeight; + + $acceptHeaders[] = $this->buildAcceptHeader($header['header'], $weight); + } + + $currentWeight = $this->getNextWeight($currentWeight, $hasMoreThan28Headers); + + return $acceptHeaders; + } + + /** + * @param string $header + * @param int $weight + * @return string + */ + private function buildAcceptHeader(string $header, int $weight): string + { + if($weight === 1000) { + return $header; + } + + return trim($header, '; ') . ';q=' . rtrim(sprintf('%0.3f', $weight / 1000), '0'); + } + + /** + * Calculate the next weight, based on the current one. + * + * If there are less than 28 "Accept" headers, the weights will be decreased by 1 on its highest significant digit, using the + * following formula: + * + * next weight = current weight - 10 ^ (floor(log(current weight - 1))) + * + * ( current weight minus ( 10 raised to the power of ( floor of (log to the base 10 of ( current weight minus 1 ) ) ) ) ) + * + * Starting from 1000, this generates the following series: + * + * 1000, 900, 800, 700, 600, 500, 400, 300, 200, 100, 90, 80, 70, 60, 50, 40, 30, 20, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1 + * + * The resulting quality codes are closer to the average "normal" usage of them (like "q=0.9", "q=0.8" and so on), but it only works + * if there is a maximum of 28 "Accept" headers. If we have more than that (which is extremely unlikely), then we fall back to a 1-by-1 + * decrement rule, which will result in quality codes like "q=0.999", "q=0.998" etc. + * + * @param int $currentWeight varying from 1 to 1000 (will be divided by 1000 to build the quality value) + * @param bool $hasMoreThan28Headers + * @return int + */ + public function getNextWeight(int $currentWeight, bool $hasMoreThan28Headers): int + { + if ($currentWeight <= 1) { + return 1; + } + + if ($hasMoreThan28Headers) { + return $currentWeight - 1; + } + + return $currentWeight - 10 ** floor( log10($currentWeight - 1) ); + } +} diff --git a/utils/sdk/client/php/src/HeightModel.php b/utils/sdk/client/php/src/HeightModel.php new file mode 100644 index 00000000..5d29e39c --- /dev/null +++ b/utils/sdk/client/php/src/HeightModel.php @@ -0,0 +1,407 @@ + + */ +class HeightModel implements ModelInterface, ArrayAccess, JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = 'HeightModel'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPITypes = [ + 'height' => 'int' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPIFormats = [ + 'height' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'height' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes(): array + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats(): array + { + 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 array + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param array $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 array + */ + protected static array $attributeMap = [ + 'height' => 'height' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var array + */ + protected static array $setters = [ + 'height' => 'setHeight' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var array + */ + protected static array $getters = [ + 'height' => 'getHeight' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap(): array + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters(): array + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters(): array + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName(): string + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var array + */ + protected array $container = []; + + /** + * Constructor + * + * @param array $data Associated array of property values initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('height', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, mixed $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 string[] invalid properties with reasons + */ + public function listInvalidProperties(): array + { + $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(): bool + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets height + * + * @return int|null + */ + public function getHeight(): ?int + { + return $this->container['height']; + } + + /** + * Sets height + * + * @param int|null $height height + * + * @return $this + */ + public function setHeight(?int $height): static + { + if (is_null($height)) { + throw new InvalidArgumentException('non-nullable height cannot be null'); + } + $this->container['height'] = $height; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists(mixed $offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[ReturnTypeWillChange] + public function offsetGet(mixed $offset): mixed + { + 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(mixed $offset, mixed $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(mixed $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(): mixed + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString(): string + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue(): string + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/utils/sdk/client/php/src/InfoApi.php b/utils/sdk/client/php/src/InfoApi.php new file mode 100644 index 00000000..e61eae8d --- /dev/null +++ b/utils/sdk/client/php/src/InfoApi.php @@ -0,0 +1,722 @@ + [ + 'application/json', + ], + 'version' => [ + 'application/json', + ], + ]; + + /** + * @param ClientInterface|null $client + * @param Configuration|null $config + * @param HeaderSelector|null $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, + int $hostIndex = 0 + ) { + $this->client = $client ?: new Client(); + $this->config = $config ?: Configuration::getDefaultConfiguration(); + $this->headerSelector = $selector ?: new HeaderSelector(); + $this->hostIndex = $hostIndex; + } + + /** + * Set the host index + * + * @param int $hostIndex Host index (required) + */ + public function setHostIndex(int $hostIndex): void + { + $this->hostIndex = $hostIndex; + } + + /** + * Get the host index + * + * @return int Host index + */ + public function getHostIndex(): int + { + return $this->hostIndex; + } + + /** + * @return Configuration + */ + public function getConfig(): Configuration + { + return $this->config; + } + + /** + * Operation getInfo + * + * Get detailed information about the blockchain and daemon state + * + * @param string|null $flags Possible values: net_time_delta_median, current_network_hashrate_50, current_network_hashrate_350, seconds_for_10_blocks, seconds_for_30_blocks, transactions_daily_stat, last_pos_timestamp, last_pow_timestamp, total_coins, last_block_size, tx_count_in_last_block, pos_sequence_factor, pow_sequence_factor, pos_difficulty, performance, outs_stat, expirations_median. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getInfo'] to see the possible values for this operation + * + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return \lthn\lthn\InfoModel + */ + public function getInfo( + ?string $flags = null, + string $contentType = self::contentTypes['getInfo'][0] + ): \lthn\lthn\InfoModel + { + list($response) = $this->getInfoWithHttpInfo($flags, $contentType); + return $response; + } + + /** + * Operation getInfoWithHttpInfo + * + * Get detailed information about the blockchain and daemon state + * + * @param string|null $flags Possible values: net_time_delta_median, current_network_hashrate_50, current_network_hashrate_350, seconds_for_10_blocks, seconds_for_30_blocks, transactions_daily_stat, last_pos_timestamp, last_pow_timestamp, total_coins, last_block_size, tx_count_in_last_block, pos_sequence_factor, pow_sequence_factor, pos_difficulty, performance, outs_stat, expirations_median. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getInfo'] to see the possible values for this operation + * + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return array of \lthn\lthn\InfoModel, HTTP status code, HTTP response headers (array of strings) + */ + public function getInfoWithHttpInfo( + ?string $flags = null, + string $contentType = self::contentTypes['getInfo'][0] + ): array + { + $request = $this->getInfoRequest($flags, $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(); + + switch($statusCode) { + case 200: + return $this->handleResponseWithDataType( + '\lthn\lthn\InfoModel', + $request, + $response, + ); + } + + + 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 $this->handleResponseWithDataType( + '\lthn\lthn\InfoModel', + $request, + $response, + ); + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\lthn\lthn\InfoModel', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + } + + throw $e; + } + } + + /** + * Operation getInfoAsync + * + * Get detailed information about the blockchain and daemon state + * + * @param string|null $flags Possible values: net_time_delta_median, current_network_hashrate_50, current_network_hashrate_350, seconds_for_10_blocks, seconds_for_30_blocks, transactions_daily_stat, last_pos_timestamp, last_pow_timestamp, total_coins, last_block_size, tx_count_in_last_block, pos_sequence_factor, pow_sequence_factor, pos_difficulty, performance, outs_stat, expirations_median. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getInfo'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return PromiseInterface + */ + public function getInfoAsync( + ?string $flags = null, + string $contentType = self::contentTypes['getInfo'][0] + ): PromiseInterface + { + return $this->getInfoAsyncWithHttpInfo($flags, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation getInfoAsyncWithHttpInfo + * + * Get detailed information about the blockchain and daemon state + * + * @param string|null $flags Possible values: net_time_delta_median, current_network_hashrate_50, current_network_hashrate_350, seconds_for_10_blocks, seconds_for_30_blocks, transactions_daily_stat, last_pos_timestamp, last_pow_timestamp, total_coins, last_block_size, tx_count_in_last_block, pos_sequence_factor, pow_sequence_factor, pos_difficulty, performance, outs_stat, expirations_median. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getInfo'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return PromiseInterface + */ + public function getInfoAsyncWithHttpInfo( + ?string $flags = null, + string $contentType = self::contentTypes['getInfo'][0] + ): PromiseInterface + { + $returnType = '\lthn\lthn\InfoModel'; + $request = $this->getInfoRequest($flags, $contentType); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $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 'getInfo' + * + * @param string|null $flags Possible values: net_time_delta_median, current_network_hashrate_50, current_network_hashrate_350, seconds_for_10_blocks, seconds_for_30_blocks, transactions_daily_stat, last_pos_timestamp, last_pow_timestamp, total_coins, last_block_size, tx_count_in_last_block, pos_sequence_factor, pow_sequence_factor, pos_difficulty, performance, outs_stat, expirations_median. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getInfo'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function getInfoRequest( + ?string $flags = null, + string $contentType = self::contentTypes['getInfo'][0] + ): Request + { + + + + $resourcePath = '/info'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $flags, + 'flags', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + + + + + $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 version + * + * Get API version + * + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['version'] to see the possible values for this operation + * + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return \lthn\lthn\VersionModel + */ + public function version( + string $contentType = self::contentTypes['version'][0] + ): \lthn\lthn\VersionModel + { + list($response) = $this->versionWithHttpInfo($contentType); + return $response; + } + + /** + * Operation versionWithHttpInfo + * + * Get API version + * + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['version'] to see the possible values for this operation + * + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return array of \lthn\lthn\VersionModel, HTTP status code, HTTP response headers (array of strings) + */ + public function versionWithHttpInfo( + string $contentType = self::contentTypes['version'][0] + ): array + { + $request = $this->versionRequest($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(); + + switch($statusCode) { + case 200: + return $this->handleResponseWithDataType( + '\lthn\lthn\VersionModel', + $request, + $response, + ); + } + + + 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 $this->handleResponseWithDataType( + '\lthn\lthn\VersionModel', + $request, + $response, + ); + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\lthn\lthn\VersionModel', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + } + + throw $e; + } + } + + /** + * Operation versionAsync + * + * Get API version + * + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['version'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return PromiseInterface + */ + public function versionAsync( + string $contentType = self::contentTypes['version'][0] + ): PromiseInterface + { + return $this->versionAsyncWithHttpInfo($contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation versionAsyncWithHttpInfo + * + * Get API version + * + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['version'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return PromiseInterface + */ + public function versionAsyncWithHttpInfo( + string $contentType = self::contentTypes['version'][0] + ): PromiseInterface + { + $returnType = '\lthn\lthn\VersionModel'; + $request = $this->versionRequest($contentType); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $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 'version' + * + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['version'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function versionRequest( + string $contentType = self::contentTypes['version'][0] + ): Request + { + + + $resourcePath = '/info/version'; + $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(): array + { + $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; + } + + private function handleResponseWithDataType( + string $dataType, + RequestInterface $request, + ResponseInterface $response, + ): array { + if (in_array($dataType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($dataType !== '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() + ), + $response->getStatusCode(), + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, $dataType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + private function responseWithinRangeCode( + string $rangeCode, + int $statusCode, + ): bool { + $left = (int) ($rangeCode[0].'00'); + $right = (int) ($rangeCode[0].'99'); + + return $statusCode >= $left && $statusCode <= $right; + } +} diff --git a/utils/sdk/client/php/src/InfoModel.php b/utils/sdk/client/php/src/InfoModel.php new file mode 100644 index 00000000..2f5c4984 --- /dev/null +++ b/utils/sdk/client/php/src/InfoModel.php @@ -0,0 +1,1937 @@ + + */ +class InfoModel implements ModelInterface, ArrayAccess, JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = 'InfoModel'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPITypes = [ + 'height' => 'int', + 'tx_count' => 'int', + 'tx_pool_size' => 'int', + 'alt_blocks_count' => 'int', + 'outgoing_connections_count' => 'int', + 'incoming_connections_count' => 'int', + 'synchronized_connections_count' => 'int', + 'white_peerlist_size' => 'int', + 'grey_peerlist_size' => 'int', + 'current_blocks_median' => 'int', + 'alias_count' => 'int', + 'current_max_allowed_block_size' => 'int', + 'daemon_network_state' => 'string', + 'synchronization_start_height' => 'int', + 'max_net_seen_height' => 'int', + 'mi' => '\lthn\lthn\MaintainersInfoModel', + 'pos_allowed' => 'bool', + 'pos_difficulty' => 'string', + 'pow_difficulty' => 'int', + 'default_fee' => 'int', + 'minimum_fee' => 'int', + 'is_hardfork_active' => 'bool[]', + 'net_time_delta_median' => 'int', + 'current_network_hashrate_50' => 'int', + 'current_network_hashrate_350' => 'int', + 'seconds_for_10_blocks' => 'int', + 'seconds_for_30_blocks' => 'int', + 'transactions_cnt_per_day' => 'int[]', + 'transactions_volume_per_day' => 'int[]', + 'last_pos_timestamp' => 'int', + 'last_pow_timestamp' => 'int', + 'total_coins' => 'string', + 'last_block_size' => 'int', + 'tx_count_in_last_block' => 'int', + 'pos_sequence_factor' => 'float', + 'pow_sequence_factor' => 'float', + 'block_reward' => 'int', + 'last_block_total_reward' => 'int', + 'pos_diff_total_coins_rate' => 'int', + 'last_block_timestamp' => 'int', + 'last_block_hash' => 'string', + 'pos_block_ts_shift_vs_actual' => 'int', + 'outs_stat' => 'array', + 'performance_data' => '\lthn\lthn\PerformanceModel', + 'offers_count' => 'int', + 'expiration_median_timestamp' => 'int' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPIFormats = [ + 'height' => null, + 'tx_count' => null, + 'tx_pool_size' => null, + 'alt_blocks_count' => null, + 'outgoing_connections_count' => null, + 'incoming_connections_count' => null, + 'synchronized_connections_count' => null, + 'white_peerlist_size' => null, + 'grey_peerlist_size' => null, + 'current_blocks_median' => null, + 'alias_count' => null, + 'current_max_allowed_block_size' => null, + 'daemon_network_state' => null, + 'synchronization_start_height' => null, + 'max_net_seen_height' => null, + 'mi' => null, + 'pos_allowed' => null, + 'pos_difficulty' => null, + 'pow_difficulty' => null, + 'default_fee' => null, + 'minimum_fee' => null, + 'is_hardfork_active' => null, + 'net_time_delta_median' => 'int64', + 'current_network_hashrate_50' => null, + 'current_network_hashrate_350' => null, + 'seconds_for_10_blocks' => null, + 'seconds_for_30_blocks' => null, + 'transactions_cnt_per_day' => null, + 'transactions_volume_per_day' => null, + 'last_pos_timestamp' => null, + 'last_pow_timestamp' => null, + 'total_coins' => null, + 'last_block_size' => null, + 'tx_count_in_last_block' => null, + 'pos_sequence_factor' => 'double', + 'pow_sequence_factor' => 'double', + 'block_reward' => null, + 'last_block_total_reward' => null, + 'pos_diff_total_coins_rate' => null, + 'last_block_timestamp' => null, + 'last_block_hash' => null, + 'pos_block_ts_shift_vs_actual' => 'int64', + 'outs_stat' => null, + 'performance_data' => null, + 'offers_count' => null, + 'expiration_median_timestamp' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'height' => false, + 'tx_count' => false, + 'tx_pool_size' => false, + 'alt_blocks_count' => false, + 'outgoing_connections_count' => false, + 'incoming_connections_count' => false, + 'synchronized_connections_count' => false, + 'white_peerlist_size' => false, + 'grey_peerlist_size' => false, + 'current_blocks_median' => false, + 'alias_count' => false, + 'current_max_allowed_block_size' => false, + 'daemon_network_state' => false, + 'synchronization_start_height' => false, + 'max_net_seen_height' => false, + 'mi' => false, + 'pos_allowed' => false, + 'pos_difficulty' => false, + 'pow_difficulty' => false, + 'default_fee' => false, + 'minimum_fee' => false, + 'is_hardfork_active' => false, + 'net_time_delta_median' => false, + 'current_network_hashrate_50' => false, + 'current_network_hashrate_350' => false, + 'seconds_for_10_blocks' => false, + 'seconds_for_30_blocks' => false, + 'transactions_cnt_per_day' => false, + 'transactions_volume_per_day' => false, + 'last_pos_timestamp' => false, + 'last_pow_timestamp' => false, + 'total_coins' => false, + 'last_block_size' => false, + 'tx_count_in_last_block' => false, + 'pos_sequence_factor' => false, + 'pow_sequence_factor' => false, + 'block_reward' => false, + 'last_block_total_reward' => false, + 'pos_diff_total_coins_rate' => false, + 'last_block_timestamp' => false, + 'last_block_hash' => false, + 'pos_block_ts_shift_vs_actual' => false, + 'outs_stat' => false, + 'performance_data' => false, + 'offers_count' => false, + 'expiration_median_timestamp' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes(): array + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats(): array + { + 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 array + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param array $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 array + */ + protected static array $attributeMap = [ + 'height' => 'height', + 'tx_count' => 'tx_count', + 'tx_pool_size' => 'tx_pool_size', + 'alt_blocks_count' => 'alt_blocks_count', + 'outgoing_connections_count' => 'outgoing_connections_count', + 'incoming_connections_count' => 'incoming_connections_count', + 'synchronized_connections_count' => 'synchronized_connections_count', + 'white_peerlist_size' => 'white_peerlist_size', + 'grey_peerlist_size' => 'grey_peerlist_size', + 'current_blocks_median' => 'current_blocks_median', + 'alias_count' => 'alias_count', + 'current_max_allowed_block_size' => 'current_max_allowed_block_size', + 'daemon_network_state' => 'daemon_network_state', + 'synchronization_start_height' => 'synchronization_start_height', + 'max_net_seen_height' => 'max_net_seen_height', + 'mi' => 'mi', + 'pos_allowed' => 'pos_allowed', + 'pos_difficulty' => 'pos_difficulty', + 'pow_difficulty' => 'pow_difficulty', + 'default_fee' => 'default_fee', + 'minimum_fee' => 'minimum_fee', + 'is_hardfork_active' => 'is_hardfork_active', + 'net_time_delta_median' => 'net_time_delta_median', + 'current_network_hashrate_50' => 'current_network_hashrate_50', + 'current_network_hashrate_350' => 'current_network_hashrate_350', + 'seconds_for_10_blocks' => 'seconds_for_10_blocks', + 'seconds_for_30_blocks' => 'seconds_for_30_blocks', + 'transactions_cnt_per_day' => 'transactions_cnt_per_day', + 'transactions_volume_per_day' => 'transactions_volume_per_day', + 'last_pos_timestamp' => 'last_pos_timestamp', + 'last_pow_timestamp' => 'last_pow_timestamp', + 'total_coins' => 'total_coins', + 'last_block_size' => 'last_block_size', + 'tx_count_in_last_block' => 'tx_count_in_last_block', + 'pos_sequence_factor' => 'pos_sequence_factor', + 'pow_sequence_factor' => 'pow_sequence_factor', + 'block_reward' => 'block_reward', + 'last_block_total_reward' => 'last_block_total_reward', + 'pos_diff_total_coins_rate' => 'pos_diff_total_coins_rate', + 'last_block_timestamp' => 'last_block_timestamp', + 'last_block_hash' => 'last_block_hash', + 'pos_block_ts_shift_vs_actual' => 'pos_block_ts_shift_vs_actual', + 'outs_stat' => 'outs_stat', + 'performance_data' => 'performance_data', + 'offers_count' => 'offers_count', + 'expiration_median_timestamp' => 'expiration_median_timestamp' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var array + */ + protected static array $setters = [ + 'height' => 'setHeight', + 'tx_count' => 'setTxCount', + 'tx_pool_size' => 'setTxPoolSize', + 'alt_blocks_count' => 'setAltBlocksCount', + 'outgoing_connections_count' => 'setOutgoingConnectionsCount', + 'incoming_connections_count' => 'setIncomingConnectionsCount', + 'synchronized_connections_count' => 'setSynchronizedConnectionsCount', + 'white_peerlist_size' => 'setWhitePeerlistSize', + 'grey_peerlist_size' => 'setGreyPeerlistSize', + 'current_blocks_median' => 'setCurrentBlocksMedian', + 'alias_count' => 'setAliasCount', + 'current_max_allowed_block_size' => 'setCurrentMaxAllowedBlockSize', + 'daemon_network_state' => 'setDaemonNetworkState', + 'synchronization_start_height' => 'setSynchronizationStartHeight', + 'max_net_seen_height' => 'setMaxNetSeenHeight', + 'mi' => 'setMi', + 'pos_allowed' => 'setPosAllowed', + 'pos_difficulty' => 'setPosDifficulty', + 'pow_difficulty' => 'setPowDifficulty', + 'default_fee' => 'setDefaultFee', + 'minimum_fee' => 'setMinimumFee', + 'is_hardfork_active' => 'setIsHardforkActive', + 'net_time_delta_median' => 'setNetTimeDeltaMedian', + 'current_network_hashrate_50' => 'setCurrentNetworkHashrate50', + 'current_network_hashrate_350' => 'setCurrentNetworkHashrate350', + 'seconds_for_10_blocks' => 'setSecondsFor10Blocks', + 'seconds_for_30_blocks' => 'setSecondsFor30Blocks', + 'transactions_cnt_per_day' => 'setTransactionsCntPerDay', + 'transactions_volume_per_day' => 'setTransactionsVolumePerDay', + 'last_pos_timestamp' => 'setLastPosTimestamp', + 'last_pow_timestamp' => 'setLastPowTimestamp', + 'total_coins' => 'setTotalCoins', + 'last_block_size' => 'setLastBlockSize', + 'tx_count_in_last_block' => 'setTxCountInLastBlock', + 'pos_sequence_factor' => 'setPosSequenceFactor', + 'pow_sequence_factor' => 'setPowSequenceFactor', + 'block_reward' => 'setBlockReward', + 'last_block_total_reward' => 'setLastBlockTotalReward', + 'pos_diff_total_coins_rate' => 'setPosDiffTotalCoinsRate', + 'last_block_timestamp' => 'setLastBlockTimestamp', + 'last_block_hash' => 'setLastBlockHash', + 'pos_block_ts_shift_vs_actual' => 'setPosBlockTsShiftVsActual', + 'outs_stat' => 'setOutsStat', + 'performance_data' => 'setPerformanceData', + 'offers_count' => 'setOffersCount', + 'expiration_median_timestamp' => 'setExpirationMedianTimestamp' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var array + */ + protected static array $getters = [ + 'height' => 'getHeight', + 'tx_count' => 'getTxCount', + 'tx_pool_size' => 'getTxPoolSize', + 'alt_blocks_count' => 'getAltBlocksCount', + 'outgoing_connections_count' => 'getOutgoingConnectionsCount', + 'incoming_connections_count' => 'getIncomingConnectionsCount', + 'synchronized_connections_count' => 'getSynchronizedConnectionsCount', + 'white_peerlist_size' => 'getWhitePeerlistSize', + 'grey_peerlist_size' => 'getGreyPeerlistSize', + 'current_blocks_median' => 'getCurrentBlocksMedian', + 'alias_count' => 'getAliasCount', + 'current_max_allowed_block_size' => 'getCurrentMaxAllowedBlockSize', + 'daemon_network_state' => 'getDaemonNetworkState', + 'synchronization_start_height' => 'getSynchronizationStartHeight', + 'max_net_seen_height' => 'getMaxNetSeenHeight', + 'mi' => 'getMi', + 'pos_allowed' => 'getPosAllowed', + 'pos_difficulty' => 'getPosDifficulty', + 'pow_difficulty' => 'getPowDifficulty', + 'default_fee' => 'getDefaultFee', + 'minimum_fee' => 'getMinimumFee', + 'is_hardfork_active' => 'getIsHardforkActive', + 'net_time_delta_median' => 'getNetTimeDeltaMedian', + 'current_network_hashrate_50' => 'getCurrentNetworkHashrate50', + 'current_network_hashrate_350' => 'getCurrentNetworkHashrate350', + 'seconds_for_10_blocks' => 'getSecondsFor10Blocks', + 'seconds_for_30_blocks' => 'getSecondsFor30Blocks', + 'transactions_cnt_per_day' => 'getTransactionsCntPerDay', + 'transactions_volume_per_day' => 'getTransactionsVolumePerDay', + 'last_pos_timestamp' => 'getLastPosTimestamp', + 'last_pow_timestamp' => 'getLastPowTimestamp', + 'total_coins' => 'getTotalCoins', + 'last_block_size' => 'getLastBlockSize', + 'tx_count_in_last_block' => 'getTxCountInLastBlock', + 'pos_sequence_factor' => 'getPosSequenceFactor', + 'pow_sequence_factor' => 'getPowSequenceFactor', + 'block_reward' => 'getBlockReward', + 'last_block_total_reward' => 'getLastBlockTotalReward', + 'pos_diff_total_coins_rate' => 'getPosDiffTotalCoinsRate', + 'last_block_timestamp' => 'getLastBlockTimestamp', + 'last_block_hash' => 'getLastBlockHash', + 'pos_block_ts_shift_vs_actual' => 'getPosBlockTsShiftVsActual', + 'outs_stat' => 'getOutsStat', + 'performance_data' => 'getPerformanceData', + 'offers_count' => 'getOffersCount', + 'expiration_median_timestamp' => 'getExpirationMedianTimestamp' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap(): array + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters(): array + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters(): array + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName(): string + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var array + */ + protected array $container = []; + + /** + * Constructor + * + * @param array $data Associated array of property values initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('height', $data ?? [], null); + $this->setIfExists('tx_count', $data ?? [], null); + $this->setIfExists('tx_pool_size', $data ?? [], null); + $this->setIfExists('alt_blocks_count', $data ?? [], null); + $this->setIfExists('outgoing_connections_count', $data ?? [], null); + $this->setIfExists('incoming_connections_count', $data ?? [], null); + $this->setIfExists('synchronized_connections_count', $data ?? [], null); + $this->setIfExists('white_peerlist_size', $data ?? [], null); + $this->setIfExists('grey_peerlist_size', $data ?? [], null); + $this->setIfExists('current_blocks_median', $data ?? [], null); + $this->setIfExists('alias_count', $data ?? [], null); + $this->setIfExists('current_max_allowed_block_size', $data ?? [], null); + $this->setIfExists('daemon_network_state', $data ?? [], null); + $this->setIfExists('synchronization_start_height', $data ?? [], null); + $this->setIfExists('max_net_seen_height', $data ?? [], null); + $this->setIfExists('mi', $data ?? [], null); + $this->setIfExists('pos_allowed', $data ?? [], null); + $this->setIfExists('pos_difficulty', $data ?? [], null); + $this->setIfExists('pow_difficulty', $data ?? [], null); + $this->setIfExists('default_fee', $data ?? [], null); + $this->setIfExists('minimum_fee', $data ?? [], null); + $this->setIfExists('is_hardfork_active', $data ?? [], null); + $this->setIfExists('net_time_delta_median', $data ?? [], null); + $this->setIfExists('current_network_hashrate_50', $data ?? [], null); + $this->setIfExists('current_network_hashrate_350', $data ?? [], null); + $this->setIfExists('seconds_for_10_blocks', $data ?? [], null); + $this->setIfExists('seconds_for_30_blocks', $data ?? [], null); + $this->setIfExists('transactions_cnt_per_day', $data ?? [], null); + $this->setIfExists('transactions_volume_per_day', $data ?? [], null); + $this->setIfExists('last_pos_timestamp', $data ?? [], null); + $this->setIfExists('last_pow_timestamp', $data ?? [], null); + $this->setIfExists('total_coins', $data ?? [], null); + $this->setIfExists('last_block_size', $data ?? [], null); + $this->setIfExists('tx_count_in_last_block', $data ?? [], null); + $this->setIfExists('pos_sequence_factor', $data ?? [], null); + $this->setIfExists('pow_sequence_factor', $data ?? [], null); + $this->setIfExists('block_reward', $data ?? [], null); + $this->setIfExists('last_block_total_reward', $data ?? [], null); + $this->setIfExists('pos_diff_total_coins_rate', $data ?? [], null); + $this->setIfExists('last_block_timestamp', $data ?? [], null); + $this->setIfExists('last_block_hash', $data ?? [], null); + $this->setIfExists('pos_block_ts_shift_vs_actual', $data ?? [], null); + $this->setIfExists('outs_stat', $data ?? [], null); + $this->setIfExists('performance_data', $data ?? [], null); + $this->setIfExists('offers_count', $data ?? [], null); + $this->setIfExists('expiration_median_timestamp', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, mixed $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 string[] invalid properties with reasons + */ + public function listInvalidProperties(): array + { + $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(): bool + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets height + * + * @return int|null + */ + public function getHeight(): ?int + { + return $this->container['height']; + } + + /** + * Sets height + * + * @param int|null $height height + * + * @return $this + */ + public function setHeight(?int $height): static + { + if (is_null($height)) { + throw new InvalidArgumentException('non-nullable height cannot be null'); + } + $this->container['height'] = $height; + + return $this; + } + + /** + * Gets tx_count + * + * @return int|null + */ + public function getTxCount(): ?int + { + return $this->container['tx_count']; + } + + /** + * Sets tx_count + * + * @param int|null $tx_count tx_count + * + * @return $this + */ + public function setTxCount(?int $tx_count): static + { + if (is_null($tx_count)) { + throw new InvalidArgumentException('non-nullable tx_count cannot be null'); + } + $this->container['tx_count'] = $tx_count; + + return $this; + } + + /** + * Gets tx_pool_size + * + * @return int|null + */ + public function getTxPoolSize(): ?int + { + return $this->container['tx_pool_size']; + } + + /** + * Sets tx_pool_size + * + * @param int|null $tx_pool_size tx_pool_size + * + * @return $this + */ + public function setTxPoolSize(?int $tx_pool_size): static + { + if (is_null($tx_pool_size)) { + throw new InvalidArgumentException('non-nullable tx_pool_size cannot be null'); + } + $this->container['tx_pool_size'] = $tx_pool_size; + + return $this; + } + + /** + * Gets alt_blocks_count + * + * @return int|null + */ + public function getAltBlocksCount(): ?int + { + return $this->container['alt_blocks_count']; + } + + /** + * Sets alt_blocks_count + * + * @param int|null $alt_blocks_count alt_blocks_count + * + * @return $this + */ + public function setAltBlocksCount(?int $alt_blocks_count): static + { + if (is_null($alt_blocks_count)) { + throw new InvalidArgumentException('non-nullable alt_blocks_count cannot be null'); + } + $this->container['alt_blocks_count'] = $alt_blocks_count; + + return $this; + } + + /** + * Gets outgoing_connections_count + * + * @return int|null + */ + public function getOutgoingConnectionsCount(): ?int + { + return $this->container['outgoing_connections_count']; + } + + /** + * Sets outgoing_connections_count + * + * @param int|null $outgoing_connections_count outgoing_connections_count + * + * @return $this + */ + public function setOutgoingConnectionsCount(?int $outgoing_connections_count): static + { + if (is_null($outgoing_connections_count)) { + throw new InvalidArgumentException('non-nullable outgoing_connections_count cannot be null'); + } + $this->container['outgoing_connections_count'] = $outgoing_connections_count; + + return $this; + } + + /** + * Gets incoming_connections_count + * + * @return int|null + */ + public function getIncomingConnectionsCount(): ?int + { + return $this->container['incoming_connections_count']; + } + + /** + * Sets incoming_connections_count + * + * @param int|null $incoming_connections_count incoming_connections_count + * + * @return $this + */ + public function setIncomingConnectionsCount(?int $incoming_connections_count): static + { + if (is_null($incoming_connections_count)) { + throw new InvalidArgumentException('non-nullable incoming_connections_count cannot be null'); + } + $this->container['incoming_connections_count'] = $incoming_connections_count; + + return $this; + } + + /** + * Gets synchronized_connections_count + * + * @return int|null + */ + public function getSynchronizedConnectionsCount(): ?int + { + return $this->container['synchronized_connections_count']; + } + + /** + * Sets synchronized_connections_count + * + * @param int|null $synchronized_connections_count synchronized_connections_count + * + * @return $this + */ + public function setSynchronizedConnectionsCount(?int $synchronized_connections_count): static + { + if (is_null($synchronized_connections_count)) { + throw new InvalidArgumentException('non-nullable synchronized_connections_count cannot be null'); + } + $this->container['synchronized_connections_count'] = $synchronized_connections_count; + + return $this; + } + + /** + * Gets white_peerlist_size + * + * @return int|null + */ + public function getWhitePeerlistSize(): ?int + { + return $this->container['white_peerlist_size']; + } + + /** + * Sets white_peerlist_size + * + * @param int|null $white_peerlist_size white_peerlist_size + * + * @return $this + */ + public function setWhitePeerlistSize(?int $white_peerlist_size): static + { + if (is_null($white_peerlist_size)) { + throw new InvalidArgumentException('non-nullable white_peerlist_size cannot be null'); + } + $this->container['white_peerlist_size'] = $white_peerlist_size; + + return $this; + } + + /** + * Gets grey_peerlist_size + * + * @return int|null + */ + public function getGreyPeerlistSize(): ?int + { + return $this->container['grey_peerlist_size']; + } + + /** + * Sets grey_peerlist_size + * + * @param int|null $grey_peerlist_size grey_peerlist_size + * + * @return $this + */ + public function setGreyPeerlistSize(?int $grey_peerlist_size): static + { + if (is_null($grey_peerlist_size)) { + throw new InvalidArgumentException('non-nullable grey_peerlist_size cannot be null'); + } + $this->container['grey_peerlist_size'] = $grey_peerlist_size; + + return $this; + } + + /** + * Gets current_blocks_median + * + * @return int|null + */ + public function getCurrentBlocksMedian(): ?int + { + return $this->container['current_blocks_median']; + } + + /** + * Sets current_blocks_median + * + * @param int|null $current_blocks_median current_blocks_median + * + * @return $this + */ + public function setCurrentBlocksMedian(?int $current_blocks_median): static + { + if (is_null($current_blocks_median)) { + throw new InvalidArgumentException('non-nullable current_blocks_median cannot be null'); + } + $this->container['current_blocks_median'] = $current_blocks_median; + + return $this; + } + + /** + * Gets alias_count + * + * @return int|null + */ + public function getAliasCount(): ?int + { + return $this->container['alias_count']; + } + + /** + * Sets alias_count + * + * @param int|null $alias_count alias_count + * + * @return $this + */ + public function setAliasCount(?int $alias_count): static + { + if (is_null($alias_count)) { + throw new InvalidArgumentException('non-nullable alias_count cannot be null'); + } + $this->container['alias_count'] = $alias_count; + + return $this; + } + + /** + * Gets current_max_allowed_block_size + * + * @return int|null + */ + public function getCurrentMaxAllowedBlockSize(): ?int + { + return $this->container['current_max_allowed_block_size']; + } + + /** + * Sets current_max_allowed_block_size + * + * @param int|null $current_max_allowed_block_size current_max_allowed_block_size + * + * @return $this + */ + public function setCurrentMaxAllowedBlockSize(?int $current_max_allowed_block_size): static + { + if (is_null($current_max_allowed_block_size)) { + throw new InvalidArgumentException('non-nullable current_max_allowed_block_size cannot be null'); + } + $this->container['current_max_allowed_block_size'] = $current_max_allowed_block_size; + + return $this; + } + + /** + * Gets daemon_network_state + * + * @return string|null + */ + public function getDaemonNetworkState(): ?string + { + return $this->container['daemon_network_state']; + } + + /** + * Sets daemon_network_state + * + * @param string|null $daemon_network_state daemon_network_state + * + * @return $this + */ + public function setDaemonNetworkState(?string $daemon_network_state): static + { + if (is_null($daemon_network_state)) { + throw new InvalidArgumentException('non-nullable daemon_network_state cannot be null'); + } + $this->container['daemon_network_state'] = $daemon_network_state; + + return $this; + } + + /** + * Gets synchronization_start_height + * + * @return int|null + */ + public function getSynchronizationStartHeight(): ?int + { + return $this->container['synchronization_start_height']; + } + + /** + * Sets synchronization_start_height + * + * @param int|null $synchronization_start_height synchronization_start_height + * + * @return $this + */ + public function setSynchronizationStartHeight(?int $synchronization_start_height): static + { + if (is_null($synchronization_start_height)) { + throw new InvalidArgumentException('non-nullable synchronization_start_height cannot be null'); + } + $this->container['synchronization_start_height'] = $synchronization_start_height; + + return $this; + } + + /** + * Gets max_net_seen_height + * + * @return int|null + */ + public function getMaxNetSeenHeight(): ?int + { + return $this->container['max_net_seen_height']; + } + + /** + * Sets max_net_seen_height + * + * @param int|null $max_net_seen_height max_net_seen_height + * + * @return $this + */ + public function setMaxNetSeenHeight(?int $max_net_seen_height): static + { + if (is_null($max_net_seen_height)) { + throw new InvalidArgumentException('non-nullable max_net_seen_height cannot be null'); + } + $this->container['max_net_seen_height'] = $max_net_seen_height; + + return $this; + } + + /** + * Gets mi + * + * @return \lthn\lthn\MaintainersInfoModel|null + */ + public function getMi(): ?\lthn\lthn\MaintainersInfoModel + { + return $this->container['mi']; + } + + /** + * Sets mi + * + * @param \lthn\lthn\MaintainersInfoModel|null $mi mi + * + * @return $this + */ + public function setMi(?\lthn\lthn\MaintainersInfoModel $mi): static + { + if (is_null($mi)) { + throw new InvalidArgumentException('non-nullable mi cannot be null'); + } + $this->container['mi'] = $mi; + + return $this; + } + + /** + * Gets pos_allowed + * + * @return bool|null + */ + public function getPosAllowed(): ?bool + { + return $this->container['pos_allowed']; + } + + /** + * Sets pos_allowed + * + * @param bool|null $pos_allowed pos_allowed + * + * @return $this + */ + public function setPosAllowed(?bool $pos_allowed): static + { + if (is_null($pos_allowed)) { + throw new InvalidArgumentException('non-nullable pos_allowed cannot be null'); + } + $this->container['pos_allowed'] = $pos_allowed; + + return $this; + } + + /** + * Gets pos_difficulty + * + * @return string|null + */ + public function getPosDifficulty(): ?string + { + return $this->container['pos_difficulty']; + } + + /** + * Sets pos_difficulty + * + * @param string|null $pos_difficulty pos_difficulty + * + * @return $this + */ + public function setPosDifficulty(?string $pos_difficulty): static + { + if (is_null($pos_difficulty)) { + throw new InvalidArgumentException('non-nullable pos_difficulty cannot be null'); + } + $this->container['pos_difficulty'] = $pos_difficulty; + + return $this; + } + + /** + * Gets pow_difficulty + * + * @return int|null + */ + public function getPowDifficulty(): ?int + { + return $this->container['pow_difficulty']; + } + + /** + * Sets pow_difficulty + * + * @param int|null $pow_difficulty pow_difficulty + * + * @return $this + */ + public function setPowDifficulty(?int $pow_difficulty): static + { + if (is_null($pow_difficulty)) { + throw new InvalidArgumentException('non-nullable pow_difficulty cannot be null'); + } + $this->container['pow_difficulty'] = $pow_difficulty; + + return $this; + } + + /** + * Gets default_fee + * + * @return int|null + */ + public function getDefaultFee(): ?int + { + return $this->container['default_fee']; + } + + /** + * Sets default_fee + * + * @param int|null $default_fee default_fee + * + * @return $this + */ + public function setDefaultFee(?int $default_fee): static + { + if (is_null($default_fee)) { + throw new InvalidArgumentException('non-nullable default_fee cannot be null'); + } + $this->container['default_fee'] = $default_fee; + + return $this; + } + + /** + * Gets minimum_fee + * + * @return int|null + */ + public function getMinimumFee(): ?int + { + return $this->container['minimum_fee']; + } + + /** + * Sets minimum_fee + * + * @param int|null $minimum_fee minimum_fee + * + * @return $this + */ + public function setMinimumFee(?int $minimum_fee): static + { + if (is_null($minimum_fee)) { + throw new InvalidArgumentException('non-nullable minimum_fee cannot be null'); + } + $this->container['minimum_fee'] = $minimum_fee; + + return $this; + } + + /** + * Gets is_hardfork_active + * + * @return bool[]|null + */ + public function getIsHardforkActive(): ?array + { + return $this->container['is_hardfork_active']; + } + + /** + * Sets is_hardfork_active + * + * @param bool[]|null $is_hardfork_active is_hardfork_active + * + * @return $this + */ + public function setIsHardforkActive(?array $is_hardfork_active): static + { + if (is_null($is_hardfork_active)) { + throw new InvalidArgumentException('non-nullable is_hardfork_active cannot be null'); + } + $this->container['is_hardfork_active'] = $is_hardfork_active; + + return $this; + } + + /** + * Gets net_time_delta_median + * + * @return int|null + */ + public function getNetTimeDeltaMedian(): ?int + { + return $this->container['net_time_delta_median']; + } + + /** + * Sets net_time_delta_median + * + * @param int|null $net_time_delta_median net_time_delta_median + * + * @return $this + */ + public function setNetTimeDeltaMedian(?int $net_time_delta_median): static + { + if (is_null($net_time_delta_median)) { + throw new InvalidArgumentException('non-nullable net_time_delta_median cannot be null'); + } + $this->container['net_time_delta_median'] = $net_time_delta_median; + + return $this; + } + + /** + * Gets current_network_hashrate_50 + * + * @return int|null + */ + public function getCurrentNetworkHashrate50(): ?int + { + return $this->container['current_network_hashrate_50']; + } + + /** + * Sets current_network_hashrate_50 + * + * @param int|null $current_network_hashrate_50 current_network_hashrate_50 + * + * @return $this + */ + public function setCurrentNetworkHashrate50(?int $current_network_hashrate_50): static + { + if (is_null($current_network_hashrate_50)) { + throw new InvalidArgumentException('non-nullable current_network_hashrate_50 cannot be null'); + } + $this->container['current_network_hashrate_50'] = $current_network_hashrate_50; + + return $this; + } + + /** + * Gets current_network_hashrate_350 + * + * @return int|null + */ + public function getCurrentNetworkHashrate350(): ?int + { + return $this->container['current_network_hashrate_350']; + } + + /** + * Sets current_network_hashrate_350 + * + * @param int|null $current_network_hashrate_350 current_network_hashrate_350 + * + * @return $this + */ + public function setCurrentNetworkHashrate350(?int $current_network_hashrate_350): static + { + if (is_null($current_network_hashrate_350)) { + throw new InvalidArgumentException('non-nullable current_network_hashrate_350 cannot be null'); + } + $this->container['current_network_hashrate_350'] = $current_network_hashrate_350; + + return $this; + } + + /** + * Gets seconds_for_10_blocks + * + * @return int|null + */ + public function getSecondsFor10Blocks(): ?int + { + return $this->container['seconds_for_10_blocks']; + } + + /** + * Sets seconds_for_10_blocks + * + * @param int|null $seconds_for_10_blocks seconds_for_10_blocks + * + * @return $this + */ + public function setSecondsFor10Blocks(?int $seconds_for_10_blocks): static + { + if (is_null($seconds_for_10_blocks)) { + throw new InvalidArgumentException('non-nullable seconds_for_10_blocks cannot be null'); + } + $this->container['seconds_for_10_blocks'] = $seconds_for_10_blocks; + + return $this; + } + + /** + * Gets seconds_for_30_blocks + * + * @return int|null + */ + public function getSecondsFor30Blocks(): ?int + { + return $this->container['seconds_for_30_blocks']; + } + + /** + * Sets seconds_for_30_blocks + * + * @param int|null $seconds_for_30_blocks seconds_for_30_blocks + * + * @return $this + */ + public function setSecondsFor30Blocks(?int $seconds_for_30_blocks): static + { + if (is_null($seconds_for_30_blocks)) { + throw new InvalidArgumentException('non-nullable seconds_for_30_blocks cannot be null'); + } + $this->container['seconds_for_30_blocks'] = $seconds_for_30_blocks; + + return $this; + } + + /** + * Gets transactions_cnt_per_day + * + * @return int[]|null + */ + public function getTransactionsCntPerDay(): ?array + { + return $this->container['transactions_cnt_per_day']; + } + + /** + * Sets transactions_cnt_per_day + * + * @param int[]|null $transactions_cnt_per_day transactions_cnt_per_day + * + * @return $this + */ + public function setTransactionsCntPerDay(?array $transactions_cnt_per_day): static + { + if (is_null($transactions_cnt_per_day)) { + throw new InvalidArgumentException('non-nullable transactions_cnt_per_day cannot be null'); + } + $this->container['transactions_cnt_per_day'] = $transactions_cnt_per_day; + + return $this; + } + + /** + * Gets transactions_volume_per_day + * + * @return int[]|null + */ + public function getTransactionsVolumePerDay(): ?array + { + return $this->container['transactions_volume_per_day']; + } + + /** + * Sets transactions_volume_per_day + * + * @param int[]|null $transactions_volume_per_day transactions_volume_per_day + * + * @return $this + */ + public function setTransactionsVolumePerDay(?array $transactions_volume_per_day): static + { + if (is_null($transactions_volume_per_day)) { + throw new InvalidArgumentException('non-nullable transactions_volume_per_day cannot be null'); + } + $this->container['transactions_volume_per_day'] = $transactions_volume_per_day; + + return $this; + } + + /** + * Gets last_pos_timestamp + * + * @return int|null + */ + public function getLastPosTimestamp(): ?int + { + return $this->container['last_pos_timestamp']; + } + + /** + * Sets last_pos_timestamp + * + * @param int|null $last_pos_timestamp last_pos_timestamp + * + * @return $this + */ + public function setLastPosTimestamp(?int $last_pos_timestamp): static + { + if (is_null($last_pos_timestamp)) { + throw new InvalidArgumentException('non-nullable last_pos_timestamp cannot be null'); + } + $this->container['last_pos_timestamp'] = $last_pos_timestamp; + + return $this; + } + + /** + * Gets last_pow_timestamp + * + * @return int|null + */ + public function getLastPowTimestamp(): ?int + { + return $this->container['last_pow_timestamp']; + } + + /** + * Sets last_pow_timestamp + * + * @param int|null $last_pow_timestamp last_pow_timestamp + * + * @return $this + */ + public function setLastPowTimestamp(?int $last_pow_timestamp): static + { + if (is_null($last_pow_timestamp)) { + throw new InvalidArgumentException('non-nullable last_pow_timestamp cannot be null'); + } + $this->container['last_pow_timestamp'] = $last_pow_timestamp; + + return $this; + } + + /** + * Gets total_coins + * + * @return string|null + */ + public function getTotalCoins(): ?string + { + return $this->container['total_coins']; + } + + /** + * Sets total_coins + * + * @param string|null $total_coins total_coins + * + * @return $this + */ + public function setTotalCoins(?string $total_coins): static + { + if (is_null($total_coins)) { + throw new InvalidArgumentException('non-nullable total_coins cannot be null'); + } + $this->container['total_coins'] = $total_coins; + + return $this; + } + + /** + * Gets last_block_size + * + * @return int|null + */ + public function getLastBlockSize(): ?int + { + return $this->container['last_block_size']; + } + + /** + * Sets last_block_size + * + * @param int|null $last_block_size last_block_size + * + * @return $this + */ + public function setLastBlockSize(?int $last_block_size): static + { + if (is_null($last_block_size)) { + throw new InvalidArgumentException('non-nullable last_block_size cannot be null'); + } + $this->container['last_block_size'] = $last_block_size; + + return $this; + } + + /** + * Gets tx_count_in_last_block + * + * @return int|null + */ + public function getTxCountInLastBlock(): ?int + { + return $this->container['tx_count_in_last_block']; + } + + /** + * Sets tx_count_in_last_block + * + * @param int|null $tx_count_in_last_block tx_count_in_last_block + * + * @return $this + */ + public function setTxCountInLastBlock(?int $tx_count_in_last_block): static + { + if (is_null($tx_count_in_last_block)) { + throw new InvalidArgumentException('non-nullable tx_count_in_last_block cannot be null'); + } + $this->container['tx_count_in_last_block'] = $tx_count_in_last_block; + + return $this; + } + + /** + * Gets pos_sequence_factor + * + * @return float|null + */ + public function getPosSequenceFactor(): ?float + { + return $this->container['pos_sequence_factor']; + } + + /** + * Sets pos_sequence_factor + * + * @param float|null $pos_sequence_factor pos_sequence_factor + * + * @return $this + */ + public function setPosSequenceFactor(?float $pos_sequence_factor): static + { + if (is_null($pos_sequence_factor)) { + throw new InvalidArgumentException('non-nullable pos_sequence_factor cannot be null'); + } + $this->container['pos_sequence_factor'] = $pos_sequence_factor; + + return $this; + } + + /** + * Gets pow_sequence_factor + * + * @return float|null + */ + public function getPowSequenceFactor(): ?float + { + return $this->container['pow_sequence_factor']; + } + + /** + * Sets pow_sequence_factor + * + * @param float|null $pow_sequence_factor pow_sequence_factor + * + * @return $this + */ + public function setPowSequenceFactor(?float $pow_sequence_factor): static + { + if (is_null($pow_sequence_factor)) { + throw new InvalidArgumentException('non-nullable pow_sequence_factor cannot be null'); + } + $this->container['pow_sequence_factor'] = $pow_sequence_factor; + + return $this; + } + + /** + * Gets block_reward + * + * @return int|null + */ + public function getBlockReward(): ?int + { + return $this->container['block_reward']; + } + + /** + * Sets block_reward + * + * @param int|null $block_reward block_reward + * + * @return $this + */ + public function setBlockReward(?int $block_reward): static + { + if (is_null($block_reward)) { + throw new InvalidArgumentException('non-nullable block_reward cannot be null'); + } + $this->container['block_reward'] = $block_reward; + + return $this; + } + + /** + * Gets last_block_total_reward + * + * @return int|null + */ + public function getLastBlockTotalReward(): ?int + { + return $this->container['last_block_total_reward']; + } + + /** + * Sets last_block_total_reward + * + * @param int|null $last_block_total_reward last_block_total_reward + * + * @return $this + */ + public function setLastBlockTotalReward(?int $last_block_total_reward): static + { + if (is_null($last_block_total_reward)) { + throw new InvalidArgumentException('non-nullable last_block_total_reward cannot be null'); + } + $this->container['last_block_total_reward'] = $last_block_total_reward; + + return $this; + } + + /** + * Gets pos_diff_total_coins_rate + * + * @return int|null + */ + public function getPosDiffTotalCoinsRate(): ?int + { + return $this->container['pos_diff_total_coins_rate']; + } + + /** + * Sets pos_diff_total_coins_rate + * + * @param int|null $pos_diff_total_coins_rate pos_diff_total_coins_rate + * + * @return $this + */ + public function setPosDiffTotalCoinsRate(?int $pos_diff_total_coins_rate): static + { + if (is_null($pos_diff_total_coins_rate)) { + throw new InvalidArgumentException('non-nullable pos_diff_total_coins_rate cannot be null'); + } + $this->container['pos_diff_total_coins_rate'] = $pos_diff_total_coins_rate; + + return $this; + } + + /** + * Gets last_block_timestamp + * + * @return int|null + */ + public function getLastBlockTimestamp(): ?int + { + return $this->container['last_block_timestamp']; + } + + /** + * Sets last_block_timestamp + * + * @param int|null $last_block_timestamp last_block_timestamp + * + * @return $this + */ + public function setLastBlockTimestamp(?int $last_block_timestamp): static + { + if (is_null($last_block_timestamp)) { + throw new InvalidArgumentException('non-nullable last_block_timestamp cannot be null'); + } + $this->container['last_block_timestamp'] = $last_block_timestamp; + + return $this; + } + + /** + * Gets last_block_hash + * + * @return string|null + */ + public function getLastBlockHash(): ?string + { + return $this->container['last_block_hash']; + } + + /** + * Sets last_block_hash + * + * @param string|null $last_block_hash last_block_hash + * + * @return $this + */ + public function setLastBlockHash(?string $last_block_hash): static + { + if (is_null($last_block_hash)) { + throw new InvalidArgumentException('non-nullable last_block_hash cannot be null'); + } + $this->container['last_block_hash'] = $last_block_hash; + + return $this; + } + + /** + * Gets pos_block_ts_shift_vs_actual + * + * @return int|null + */ + public function getPosBlockTsShiftVsActual(): ?int + { + return $this->container['pos_block_ts_shift_vs_actual']; + } + + /** + * Sets pos_block_ts_shift_vs_actual + * + * @param int|null $pos_block_ts_shift_vs_actual pos_block_ts_shift_vs_actual + * + * @return $this + */ + public function setPosBlockTsShiftVsActual(?int $pos_block_ts_shift_vs_actual): static + { + if (is_null($pos_block_ts_shift_vs_actual)) { + throw new InvalidArgumentException('non-nullable pos_block_ts_shift_vs_actual cannot be null'); + } + $this->container['pos_block_ts_shift_vs_actual'] = $pos_block_ts_shift_vs_actual; + + return $this; + } + + /** + * Gets outs_stat + * + * @return array|null + */ + public function getOutsStat(): ?array + { + return $this->container['outs_stat']; + } + + /** + * Sets outs_stat + * + * @param array|null $outs_stat outs_stat + * + * @return $this + */ + public function setOutsStat(?array $outs_stat): static + { + if (is_null($outs_stat)) { + throw new InvalidArgumentException('non-nullable outs_stat cannot be null'); + } + $this->container['outs_stat'] = $outs_stat; + + return $this; + } + + /** + * Gets performance_data + * + * @return \lthn\lthn\PerformanceModel|null + */ + public function getPerformanceData(): ?\lthn\lthn\PerformanceModel + { + return $this->container['performance_data']; + } + + /** + * Sets performance_data + * + * @param \lthn\lthn\PerformanceModel|null $performance_data performance_data + * + * @return $this + */ + public function setPerformanceData(?\lthn\lthn\PerformanceModel $performance_data): static + { + if (is_null($performance_data)) { + throw new InvalidArgumentException('non-nullable performance_data cannot be null'); + } + $this->container['performance_data'] = $performance_data; + + return $this; + } + + /** + * Gets offers_count + * + * @return int|null + */ + public function getOffersCount(): ?int + { + return $this->container['offers_count']; + } + + /** + * Sets offers_count + * + * @param int|null $offers_count offers_count + * + * @return $this + */ + public function setOffersCount(?int $offers_count): static + { + if (is_null($offers_count)) { + throw new InvalidArgumentException('non-nullable offers_count cannot be null'); + } + $this->container['offers_count'] = $offers_count; + + return $this; + } + + /** + * Gets expiration_median_timestamp + * + * @return int|null + */ + public function getExpirationMedianTimestamp(): ?int + { + return $this->container['expiration_median_timestamp']; + } + + /** + * Sets expiration_median_timestamp + * + * @param int|null $expiration_median_timestamp expiration_median_timestamp + * + * @return $this + */ + public function setExpirationMedianTimestamp(?int $expiration_median_timestamp): static + { + if (is_null($expiration_median_timestamp)) { + throw new InvalidArgumentException('non-nullable expiration_median_timestamp cannot be null'); + } + $this->container['expiration_median_timestamp'] = $expiration_median_timestamp; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists(mixed $offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[ReturnTypeWillChange] + public function offsetGet(mixed $offset): mixed + { + 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(mixed $offset, mixed $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(mixed $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(): mixed + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString(): string + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue(): string + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/utils/sdk/client/php/src/MaintainersInfoModel.php b/utils/sdk/client/php/src/MaintainersInfoModel.php new file mode 100644 index 00000000..c330a1da --- /dev/null +++ b/utils/sdk/client/php/src/MaintainersInfoModel.php @@ -0,0 +1,623 @@ + + */ +class MaintainersInfoModel implements ModelInterface, ArrayAccess, JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = 'MaintainersInfoModel'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPITypes = [ + 'ver_major' => 'int', + 'ver_minor' => 'int', + 'ver_revision' => 'int', + 'build_no' => 'int', + 'mode' => 'int' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPIFormats = [ + 'ver_major' => null, + 'ver_minor' => null, + 'ver_revision' => null, + 'build_no' => null, + 'mode' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'ver_major' => false, + 'ver_minor' => false, + 'ver_revision' => false, + 'build_no' => false, + 'mode' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes(): array + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats(): array + { + 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 array + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param array $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 array + */ + protected static array $attributeMap = [ + 'ver_major' => 'ver_major', + 'ver_minor' => 'ver_minor', + 'ver_revision' => 'ver_revision', + 'build_no' => 'build_no', + 'mode' => 'mode' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var array + */ + protected static array $setters = [ + 'ver_major' => 'setVerMajor', + 'ver_minor' => 'setVerMinor', + 'ver_revision' => 'setVerRevision', + 'build_no' => 'setBuildNo', + 'mode' => 'setMode' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var array + */ + protected static array $getters = [ + 'ver_major' => 'getVerMajor', + 'ver_minor' => 'getVerMinor', + 'ver_revision' => 'getVerRevision', + 'build_no' => 'getBuildNo', + 'mode' => 'getMode' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap(): array + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters(): array + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters(): array + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName(): string + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var array + */ + protected array $container = []; + + /** + * Constructor + * + * @param array $data Associated array of property values initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('ver_major', $data ?? [], null); + $this->setIfExists('ver_minor', $data ?? [], null); + $this->setIfExists('ver_revision', $data ?? [], null); + $this->setIfExists('build_no', $data ?? [], null); + $this->setIfExists('mode', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, mixed $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 string[] invalid properties with reasons + */ + public function listInvalidProperties(): array + { + $invalidProperties = []; + + if (!is_null($this->container['ver_major']) && ($this->container['ver_major'] > 255)) { + $invalidProperties[] = "invalid value for 'ver_major', must be smaller than or equal to 255."; + } + + if (!is_null($this->container['ver_major']) && ($this->container['ver_major'] < 0)) { + $invalidProperties[] = "invalid value for 'ver_major', must be bigger than or equal to 0."; + } + + if (!is_null($this->container['ver_minor']) && ($this->container['ver_minor'] > 255)) { + $invalidProperties[] = "invalid value for 'ver_minor', must be smaller than or equal to 255."; + } + + if (!is_null($this->container['ver_minor']) && ($this->container['ver_minor'] < 0)) { + $invalidProperties[] = "invalid value for 'ver_minor', must be bigger than or equal to 0."; + } + + if (!is_null($this->container['ver_revision']) && ($this->container['ver_revision'] > 255)) { + $invalidProperties[] = "invalid value for 'ver_revision', must be smaller than or equal to 255."; + } + + if (!is_null($this->container['ver_revision']) && ($this->container['ver_revision'] < 0)) { + $invalidProperties[] = "invalid value for 'ver_revision', must be bigger than or equal to 0."; + } + + if (!is_null($this->container['build_no']) && ($this->container['build_no'] > 4294967295)) { + $invalidProperties[] = "invalid value for 'build_no', must be smaller than or equal to 4294967295."; + } + + if (!is_null($this->container['build_no']) && ($this->container['build_no'] < 0)) { + $invalidProperties[] = "invalid value for 'build_no', must be bigger than or equal to 0."; + } + + if (!is_null($this->container['mode']) && ($this->container['mode'] > 255)) { + $invalidProperties[] = "invalid value for 'mode', must be smaller than or equal to 255."; + } + + if (!is_null($this->container['mode']) && ($this->container['mode'] < 0)) { + $invalidProperties[] = "invalid value for 'mode', must be bigger than or equal to 0."; + } + + 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(): bool + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets ver_major + * + * @return int|null + */ + public function getVerMajor(): ?int + { + return $this->container['ver_major']; + } + + /** + * Sets ver_major + * + * @param int|null $ver_major ver_major + * + * @return $this + */ + public function setVerMajor(?int $ver_major): static + { + if (is_null($ver_major)) { + throw new InvalidArgumentException('non-nullable ver_major cannot be null'); + } + + if (($ver_major > 255)) { + throw new InvalidArgumentException('invalid value for $ver_major when calling MaintainersInfoModel., must be smaller than or equal to 255.'); + } + if (($ver_major < 0)) { + throw new InvalidArgumentException('invalid value for $ver_major when calling MaintainersInfoModel., must be bigger than or equal to 0.'); + } + + $this->container['ver_major'] = $ver_major; + + return $this; + } + + /** + * Gets ver_minor + * + * @return int|null + */ + public function getVerMinor(): ?int + { + return $this->container['ver_minor']; + } + + /** + * Sets ver_minor + * + * @param int|null $ver_minor ver_minor + * + * @return $this + */ + public function setVerMinor(?int $ver_minor): static + { + if (is_null($ver_minor)) { + throw new InvalidArgumentException('non-nullable ver_minor cannot be null'); + } + + if (($ver_minor > 255)) { + throw new InvalidArgumentException('invalid value for $ver_minor when calling MaintainersInfoModel., must be smaller than or equal to 255.'); + } + if (($ver_minor < 0)) { + throw new InvalidArgumentException('invalid value for $ver_minor when calling MaintainersInfoModel., must be bigger than or equal to 0.'); + } + + $this->container['ver_minor'] = $ver_minor; + + return $this; + } + + /** + * Gets ver_revision + * + * @return int|null + */ + public function getVerRevision(): ?int + { + return $this->container['ver_revision']; + } + + /** + * Sets ver_revision + * + * @param int|null $ver_revision ver_revision + * + * @return $this + */ + public function setVerRevision(?int $ver_revision): static + { + if (is_null($ver_revision)) { + throw new InvalidArgumentException('non-nullable ver_revision cannot be null'); + } + + if (($ver_revision > 255)) { + throw new InvalidArgumentException('invalid value for $ver_revision when calling MaintainersInfoModel., must be smaller than or equal to 255.'); + } + if (($ver_revision < 0)) { + throw new InvalidArgumentException('invalid value for $ver_revision when calling MaintainersInfoModel., must be bigger than or equal to 0.'); + } + + $this->container['ver_revision'] = $ver_revision; + + return $this; + } + + /** + * Gets build_no + * + * @return int|null + */ + public function getBuildNo(): ?int + { + return $this->container['build_no']; + } + + /** + * Sets build_no + * + * @param int|null $build_no build_no + * + * @return $this + */ + public function setBuildNo(?int $build_no): static + { + if (is_null($build_no)) { + throw new InvalidArgumentException('non-nullable build_no cannot be null'); + } + + if (($build_no > 4294967295)) { + throw new InvalidArgumentException('invalid value for $build_no when calling MaintainersInfoModel., must be smaller than or equal to 4294967295.'); + } + if (($build_no < 0)) { + throw new InvalidArgumentException('invalid value for $build_no when calling MaintainersInfoModel., must be bigger than or equal to 0.'); + } + + $this->container['build_no'] = $build_no; + + return $this; + } + + /** + * Gets mode + * + * @return int|null + */ + public function getMode(): ?int + { + return $this->container['mode']; + } + + /** + * Sets mode + * + * @param int|null $mode mode + * + * @return $this + */ + public function setMode(?int $mode): static + { + if (is_null($mode)) { + throw new InvalidArgumentException('non-nullable mode cannot be null'); + } + + if (($mode > 255)) { + throw new InvalidArgumentException('invalid value for $mode when calling MaintainersInfoModel., must be smaller than or equal to 255.'); + } + if (($mode < 0)) { + throw new InvalidArgumentException('invalid value for $mode when calling MaintainersInfoModel., must be bigger than or equal to 0.'); + } + + $this->container['mode'] = $mode; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists(mixed $offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[ReturnTypeWillChange] + public function offsetGet(mixed $offset): mixed + { + 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(mixed $offset, mixed $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(mixed $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(): mixed + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString(): string + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue(): string + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/utils/sdk/client/php/src/Model/BlockDetailsModel.php b/utils/sdk/client/php/src/Model/BlockDetailsModel.php new file mode 100644 index 00000000..ec1e8e59 --- /dev/null +++ b/utils/sdk/client/php/src/Model/BlockDetailsModel.php @@ -0,0 +1,1239 @@ + + */ +class BlockDetailsModel implements ModelInterface, ArrayAccess, JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = 'BlockDetailsModel'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPITypes = [ + 'actual_timestamp' => 'int', + 'already_generated_coins' => 'string', + 'base_reward' => 'int', + 'blob' => 'string', + 'block_cumulative_size' => 'int', + 'block_tself_size' => 'int', + 'cumulative_diff_adjusted' => 'string', + 'cumulative_diff_precise' => 'string', + 'difficulty' => 'string', + 'effective_fee_median' => 'int', + 'height' => 'int', + 'id' => 'string', + 'is_orphan' => 'bool', + 'miner_text_info' => 'string', + 'object_in_json' => 'string', + 'penalty' => 'int', + 'pow_seed' => 'string', + 'prev_id' => 'string', + 'summary_reward' => 'int', + 'this_block_fee_median' => 'int', + 'timestamp' => 'int', + 'total_fee' => 'int', + 'total_txs_size' => 'int', + 'transactions_details' => '\OpenAPI\Client\Model\TransactionDetailsModel[]', + 'type' => 'int' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPIFormats = [ + 'actual_timestamp' => null, + 'already_generated_coins' => null, + 'base_reward' => null, + 'blob' => null, + 'block_cumulative_size' => null, + 'block_tself_size' => null, + 'cumulative_diff_adjusted' => null, + 'cumulative_diff_precise' => null, + 'difficulty' => null, + 'effective_fee_median' => null, + 'height' => null, + 'id' => null, + 'is_orphan' => null, + 'miner_text_info' => null, + 'object_in_json' => null, + 'penalty' => null, + 'pow_seed' => null, + 'prev_id' => null, + 'summary_reward' => null, + 'this_block_fee_median' => null, + 'timestamp' => null, + 'total_fee' => null, + 'total_txs_size' => null, + 'transactions_details' => null, + 'type' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'actual_timestamp' => false, + 'already_generated_coins' => false, + 'base_reward' => false, + 'blob' => false, + 'block_cumulative_size' => false, + 'block_tself_size' => false, + 'cumulative_diff_adjusted' => false, + 'cumulative_diff_precise' => false, + 'difficulty' => false, + 'effective_fee_median' => false, + 'height' => false, + 'id' => false, + 'is_orphan' => false, + 'miner_text_info' => false, + 'object_in_json' => false, + 'penalty' => false, + 'pow_seed' => false, + 'prev_id' => false, + 'summary_reward' => false, + 'this_block_fee_median' => false, + 'timestamp' => false, + 'total_fee' => false, + 'total_txs_size' => false, + 'transactions_details' => false, + 'type' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes(): array + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats(): array + { + 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 array + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param array $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 array + */ + protected static array $attributeMap = [ + 'actual_timestamp' => 'actual_timestamp', + 'already_generated_coins' => 'already_generated_coins', + 'base_reward' => 'base_reward', + 'blob' => 'blob', + 'block_cumulative_size' => 'block_cumulative_size', + 'block_tself_size' => 'block_tself_size', + 'cumulative_diff_adjusted' => 'cumulative_diff_adjusted', + 'cumulative_diff_precise' => 'cumulative_diff_precise', + 'difficulty' => 'difficulty', + 'effective_fee_median' => 'effective_fee_median', + 'height' => 'height', + 'id' => 'id', + 'is_orphan' => 'is_orphan', + 'miner_text_info' => 'miner_text_info', + 'object_in_json' => 'object_in_json', + 'penalty' => 'penalty', + 'pow_seed' => 'pow_seed', + 'prev_id' => 'prev_id', + 'summary_reward' => 'summary_reward', + 'this_block_fee_median' => 'this_block_fee_median', + 'timestamp' => 'timestamp', + 'total_fee' => 'total_fee', + 'total_txs_size' => 'total_txs_size', + 'transactions_details' => 'transactions_details', + 'type' => 'type' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var array + */ + protected static array $setters = [ + 'actual_timestamp' => 'setActualTimestamp', + 'already_generated_coins' => 'setAlreadyGeneratedCoins', + 'base_reward' => 'setBaseReward', + 'blob' => 'setBlob', + 'block_cumulative_size' => 'setBlockCumulativeSize', + 'block_tself_size' => 'setBlockTselfSize', + 'cumulative_diff_adjusted' => 'setCumulativeDiffAdjusted', + 'cumulative_diff_precise' => 'setCumulativeDiffPrecise', + 'difficulty' => 'setDifficulty', + 'effective_fee_median' => 'setEffectiveFeeMedian', + 'height' => 'setHeight', + 'id' => 'setId', + 'is_orphan' => 'setIsOrphan', + 'miner_text_info' => 'setMinerTextInfo', + 'object_in_json' => 'setObjectInJson', + 'penalty' => 'setPenalty', + 'pow_seed' => 'setPowSeed', + 'prev_id' => 'setPrevId', + 'summary_reward' => 'setSummaryReward', + 'this_block_fee_median' => 'setThisBlockFeeMedian', + 'timestamp' => 'setTimestamp', + 'total_fee' => 'setTotalFee', + 'total_txs_size' => 'setTotalTxsSize', + 'transactions_details' => 'setTransactionsDetails', + 'type' => 'setType' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var array + */ + protected static array $getters = [ + 'actual_timestamp' => 'getActualTimestamp', + 'already_generated_coins' => 'getAlreadyGeneratedCoins', + 'base_reward' => 'getBaseReward', + 'blob' => 'getBlob', + 'block_cumulative_size' => 'getBlockCumulativeSize', + 'block_tself_size' => 'getBlockTselfSize', + 'cumulative_diff_adjusted' => 'getCumulativeDiffAdjusted', + 'cumulative_diff_precise' => 'getCumulativeDiffPrecise', + 'difficulty' => 'getDifficulty', + 'effective_fee_median' => 'getEffectiveFeeMedian', + 'height' => 'getHeight', + 'id' => 'getId', + 'is_orphan' => 'getIsOrphan', + 'miner_text_info' => 'getMinerTextInfo', + 'object_in_json' => 'getObjectInJson', + 'penalty' => 'getPenalty', + 'pow_seed' => 'getPowSeed', + 'prev_id' => 'getPrevId', + 'summary_reward' => 'getSummaryReward', + 'this_block_fee_median' => 'getThisBlockFeeMedian', + 'timestamp' => 'getTimestamp', + 'total_fee' => 'getTotalFee', + 'total_txs_size' => 'getTotalTxsSize', + 'transactions_details' => 'getTransactionsDetails', + 'type' => 'getType' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap(): array + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters(): array + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters(): array + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName(): string + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var array + */ + protected array $container = []; + + /** + * Constructor + * + * @param array $data Associated array of property values initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('actual_timestamp', $data ?? [], null); + $this->setIfExists('already_generated_coins', $data ?? [], null); + $this->setIfExists('base_reward', $data ?? [], null); + $this->setIfExists('blob', $data ?? [], null); + $this->setIfExists('block_cumulative_size', $data ?? [], null); + $this->setIfExists('block_tself_size', $data ?? [], null); + $this->setIfExists('cumulative_diff_adjusted', $data ?? [], null); + $this->setIfExists('cumulative_diff_precise', $data ?? [], null); + $this->setIfExists('difficulty', $data ?? [], null); + $this->setIfExists('effective_fee_median', $data ?? [], null); + $this->setIfExists('height', $data ?? [], null); + $this->setIfExists('id', $data ?? [], null); + $this->setIfExists('is_orphan', $data ?? [], null); + $this->setIfExists('miner_text_info', $data ?? [], null); + $this->setIfExists('object_in_json', $data ?? [], null); + $this->setIfExists('penalty', $data ?? [], null); + $this->setIfExists('pow_seed', $data ?? [], null); + $this->setIfExists('prev_id', $data ?? [], null); + $this->setIfExists('summary_reward', $data ?? [], null); + $this->setIfExists('this_block_fee_median', $data ?? [], null); + $this->setIfExists('timestamp', $data ?? [], null); + $this->setIfExists('total_fee', $data ?? [], null); + $this->setIfExists('total_txs_size', $data ?? [], null); + $this->setIfExists('transactions_details', $data ?? [], null); + $this->setIfExists('type', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, mixed $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 string[] invalid properties with reasons + */ + public function listInvalidProperties(): array + { + $invalidProperties = []; + + if (!is_null($this->container['type']) && ($this->container['type'] > 4294967295)) { + $invalidProperties[] = "invalid value for 'type', must be smaller than or equal to 4294967295."; + } + + if (!is_null($this->container['type']) && ($this->container['type'] < 0)) { + $invalidProperties[] = "invalid value for 'type', must be bigger than or equal to 0."; + } + + 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(): bool + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets actual_timestamp + * + * @return int|null + */ + public function getActualTimestamp(): ?int + { + return $this->container['actual_timestamp']; + } + + /** + * Sets actual_timestamp + * + * @param int|null $actual_timestamp actual_timestamp + * + * @return $this + */ + public function setActualTimestamp(?int $actual_timestamp): static + { + if (is_null($actual_timestamp)) { + throw new InvalidArgumentException('non-nullable actual_timestamp cannot be null'); + } + $this->container['actual_timestamp'] = $actual_timestamp; + + return $this; + } + + /** + * Gets already_generated_coins + * + * @return string|null + */ + public function getAlreadyGeneratedCoins(): ?string + { + return $this->container['already_generated_coins']; + } + + /** + * Sets already_generated_coins + * + * @param string|null $already_generated_coins already_generated_coins + * + * @return $this + */ + public function setAlreadyGeneratedCoins(?string $already_generated_coins): static + { + if (is_null($already_generated_coins)) { + throw new InvalidArgumentException('non-nullable already_generated_coins cannot be null'); + } + $this->container['already_generated_coins'] = $already_generated_coins; + + return $this; + } + + /** + * Gets base_reward + * + * @return int|null + */ + public function getBaseReward(): ?int + { + return $this->container['base_reward']; + } + + /** + * Sets base_reward + * + * @param int|null $base_reward base_reward + * + * @return $this + */ + public function setBaseReward(?int $base_reward): static + { + if (is_null($base_reward)) { + throw new InvalidArgumentException('non-nullable base_reward cannot be null'); + } + $this->container['base_reward'] = $base_reward; + + return $this; + } + + /** + * Gets blob + * + * @return string|null + */ + public function getBlob(): ?string + { + return $this->container['blob']; + } + + /** + * Sets blob + * + * @param string|null $blob blob + * + * @return $this + */ + public function setBlob(?string $blob): static + { + if (is_null($blob)) { + throw new InvalidArgumentException('non-nullable blob cannot be null'); + } + $this->container['blob'] = $blob; + + return $this; + } + + /** + * Gets block_cumulative_size + * + * @return int|null + */ + public function getBlockCumulativeSize(): ?int + { + return $this->container['block_cumulative_size']; + } + + /** + * Sets block_cumulative_size + * + * @param int|null $block_cumulative_size block_cumulative_size + * + * @return $this + */ + public function setBlockCumulativeSize(?int $block_cumulative_size): static + { + if (is_null($block_cumulative_size)) { + throw new InvalidArgumentException('non-nullable block_cumulative_size cannot be null'); + } + $this->container['block_cumulative_size'] = $block_cumulative_size; + + return $this; + } + + /** + * Gets block_tself_size + * + * @return int|null + */ + public function getBlockTselfSize(): ?int + { + return $this->container['block_tself_size']; + } + + /** + * Sets block_tself_size + * + * @param int|null $block_tself_size block_tself_size + * + * @return $this + */ + public function setBlockTselfSize(?int $block_tself_size): static + { + if (is_null($block_tself_size)) { + throw new InvalidArgumentException('non-nullable block_tself_size cannot be null'); + } + $this->container['block_tself_size'] = $block_tself_size; + + return $this; + } + + /** + * Gets cumulative_diff_adjusted + * + * @return string|null + */ + public function getCumulativeDiffAdjusted(): ?string + { + return $this->container['cumulative_diff_adjusted']; + } + + /** + * Sets cumulative_diff_adjusted + * + * @param string|null $cumulative_diff_adjusted cumulative_diff_adjusted + * + * @return $this + */ + public function setCumulativeDiffAdjusted(?string $cumulative_diff_adjusted): static + { + if (is_null($cumulative_diff_adjusted)) { + throw new InvalidArgumentException('non-nullable cumulative_diff_adjusted cannot be null'); + } + $this->container['cumulative_diff_adjusted'] = $cumulative_diff_adjusted; + + return $this; + } + + /** + * Gets cumulative_diff_precise + * + * @return string|null + */ + public function getCumulativeDiffPrecise(): ?string + { + return $this->container['cumulative_diff_precise']; + } + + /** + * Sets cumulative_diff_precise + * + * @param string|null $cumulative_diff_precise cumulative_diff_precise + * + * @return $this + */ + public function setCumulativeDiffPrecise(?string $cumulative_diff_precise): static + { + if (is_null($cumulative_diff_precise)) { + throw new InvalidArgumentException('non-nullable cumulative_diff_precise cannot be null'); + } + $this->container['cumulative_diff_precise'] = $cumulative_diff_precise; + + return $this; + } + + /** + * Gets difficulty + * + * @return string|null + */ + public function getDifficulty(): ?string + { + return $this->container['difficulty']; + } + + /** + * Sets difficulty + * + * @param string|null $difficulty difficulty + * + * @return $this + */ + public function setDifficulty(?string $difficulty): static + { + if (is_null($difficulty)) { + throw new InvalidArgumentException('non-nullable difficulty cannot be null'); + } + $this->container['difficulty'] = $difficulty; + + return $this; + } + + /** + * Gets effective_fee_median + * + * @return int|null + */ + public function getEffectiveFeeMedian(): ?int + { + return $this->container['effective_fee_median']; + } + + /** + * Sets effective_fee_median + * + * @param int|null $effective_fee_median effective_fee_median + * + * @return $this + */ + public function setEffectiveFeeMedian(?int $effective_fee_median): static + { + if (is_null($effective_fee_median)) { + throw new InvalidArgumentException('non-nullable effective_fee_median cannot be null'); + } + $this->container['effective_fee_median'] = $effective_fee_median; + + return $this; + } + + /** + * Gets height + * + * @return int|null + */ + public function getHeight(): ?int + { + return $this->container['height']; + } + + /** + * Sets height + * + * @param int|null $height height + * + * @return $this + */ + public function setHeight(?int $height): static + { + if (is_null($height)) { + throw new InvalidArgumentException('non-nullable height cannot be null'); + } + $this->container['height'] = $height; + + return $this; + } + + /** + * Gets id + * + * @return string|null + */ + public function getId(): ?string + { + return $this->container['id']; + } + + /** + * Sets id + * + * @param string|null $id id + * + * @return $this + */ + public function setId(?string $id): static + { + if (is_null($id)) { + throw new InvalidArgumentException('non-nullable id cannot be null'); + } + $this->container['id'] = $id; + + return $this; + } + + /** + * Gets is_orphan + * + * @return bool|null + */ + public function getIsOrphan(): ?bool + { + return $this->container['is_orphan']; + } + + /** + * Sets is_orphan + * + * @param bool|null $is_orphan is_orphan + * + * @return $this + */ + public function setIsOrphan(?bool $is_orphan): static + { + if (is_null($is_orphan)) { + throw new InvalidArgumentException('non-nullable is_orphan cannot be null'); + } + $this->container['is_orphan'] = $is_orphan; + + return $this; + } + + /** + * Gets miner_text_info + * + * @return string|null + */ + public function getMinerTextInfo(): ?string + { + return $this->container['miner_text_info']; + } + + /** + * Sets miner_text_info + * + * @param string|null $miner_text_info miner_text_info + * + * @return $this + */ + public function setMinerTextInfo(?string $miner_text_info): static + { + if (is_null($miner_text_info)) { + throw new InvalidArgumentException('non-nullable miner_text_info cannot be null'); + } + $this->container['miner_text_info'] = $miner_text_info; + + return $this; + } + + /** + * Gets object_in_json + * + * @return string|null + */ + public function getObjectInJson(): ?string + { + return $this->container['object_in_json']; + } + + /** + * Sets object_in_json + * + * @param string|null $object_in_json object_in_json + * + * @return $this + */ + public function setObjectInJson(?string $object_in_json): static + { + if (is_null($object_in_json)) { + throw new InvalidArgumentException('non-nullable object_in_json cannot be null'); + } + $this->container['object_in_json'] = $object_in_json; + + return $this; + } + + /** + * Gets penalty + * + * @return int|null + */ + public function getPenalty(): ?int + { + return $this->container['penalty']; + } + + /** + * Sets penalty + * + * @param int|null $penalty penalty + * + * @return $this + */ + public function setPenalty(?int $penalty): static + { + if (is_null($penalty)) { + throw new InvalidArgumentException('non-nullable penalty cannot be null'); + } + $this->container['penalty'] = $penalty; + + return $this; + } + + /** + * Gets pow_seed + * + * @return string|null + */ + public function getPowSeed(): ?string + { + return $this->container['pow_seed']; + } + + /** + * Sets pow_seed + * + * @param string|null $pow_seed pow_seed + * + * @return $this + */ + public function setPowSeed(?string $pow_seed): static + { + if (is_null($pow_seed)) { + throw new InvalidArgumentException('non-nullable pow_seed cannot be null'); + } + $this->container['pow_seed'] = $pow_seed; + + return $this; + } + + /** + * Gets prev_id + * + * @return string|null + */ + public function getPrevId(): ?string + { + return $this->container['prev_id']; + } + + /** + * Sets prev_id + * + * @param string|null $prev_id prev_id + * + * @return $this + */ + public function setPrevId(?string $prev_id): static + { + if (is_null($prev_id)) { + throw new InvalidArgumentException('non-nullable prev_id cannot be null'); + } + $this->container['prev_id'] = $prev_id; + + return $this; + } + + /** + * Gets summary_reward + * + * @return int|null + */ + public function getSummaryReward(): ?int + { + return $this->container['summary_reward']; + } + + /** + * Sets summary_reward + * + * @param int|null $summary_reward summary_reward + * + * @return $this + */ + public function setSummaryReward(?int $summary_reward): static + { + if (is_null($summary_reward)) { + throw new InvalidArgumentException('non-nullable summary_reward cannot be null'); + } + $this->container['summary_reward'] = $summary_reward; + + return $this; + } + + /** + * Gets this_block_fee_median + * + * @return int|null + */ + public function getThisBlockFeeMedian(): ?int + { + return $this->container['this_block_fee_median']; + } + + /** + * Sets this_block_fee_median + * + * @param int|null $this_block_fee_median this_block_fee_median + * + * @return $this + */ + public function setThisBlockFeeMedian(?int $this_block_fee_median): static + { + if (is_null($this_block_fee_median)) { + throw new InvalidArgumentException('non-nullable this_block_fee_median cannot be null'); + } + $this->container['this_block_fee_median'] = $this_block_fee_median; + + return $this; + } + + /** + * Gets timestamp + * + * @return int|null + */ + public function getTimestamp(): ?int + { + return $this->container['timestamp']; + } + + /** + * Sets timestamp + * + * @param int|null $timestamp timestamp + * + * @return $this + */ + public function setTimestamp(?int $timestamp): static + { + if (is_null($timestamp)) { + throw new InvalidArgumentException('non-nullable timestamp cannot be null'); + } + $this->container['timestamp'] = $timestamp; + + return $this; + } + + /** + * Gets total_fee + * + * @return int|null + */ + public function getTotalFee(): ?int + { + return $this->container['total_fee']; + } + + /** + * Sets total_fee + * + * @param int|null $total_fee total_fee + * + * @return $this + */ + public function setTotalFee(?int $total_fee): static + { + if (is_null($total_fee)) { + throw new InvalidArgumentException('non-nullable total_fee cannot be null'); + } + $this->container['total_fee'] = $total_fee; + + return $this; + } + + /** + * Gets total_txs_size + * + * @return int|null + */ + public function getTotalTxsSize(): ?int + { + return $this->container['total_txs_size']; + } + + /** + * Sets total_txs_size + * + * @param int|null $total_txs_size total_txs_size + * + * @return $this + */ + public function setTotalTxsSize(?int $total_txs_size): static + { + if (is_null($total_txs_size)) { + throw new InvalidArgumentException('non-nullable total_txs_size cannot be null'); + } + $this->container['total_txs_size'] = $total_txs_size; + + return $this; + } + + /** + * Gets transactions_details + * + * @return \OpenAPI\Client\Model\TransactionDetailsModel[]|null + */ + public function getTransactionsDetails(): ?array + { + return $this->container['transactions_details']; + } + + /** + * Sets transactions_details + * + * @param \OpenAPI\Client\Model\TransactionDetailsModel[]|null $transactions_details transactions_details + * + * @return $this + */ + public function setTransactionsDetails(?array $transactions_details): static + { + if (is_null($transactions_details)) { + throw new InvalidArgumentException('non-nullable transactions_details cannot be null'); + } + $this->container['transactions_details'] = $transactions_details; + + return $this; + } + + /** + * Gets type + * + * @return int|null + */ + public function getType(): ?int + { + return $this->container['type']; + } + + /** + * Sets type + * + * @param int|null $type type + * + * @return $this + */ + public function setType(?int $type): static + { + if (is_null($type)) { + throw new InvalidArgumentException('non-nullable type cannot be null'); + } + + if (($type > 4294967295)) { + throw new InvalidArgumentException('invalid value for $type when calling BlockDetailsModel., must be smaller than or equal to 4294967295.'); + } + if (($type < 0)) { + throw new InvalidArgumentException('invalid value for $type when calling BlockDetailsModel., must be bigger than or equal to 0.'); + } + + $this->container['type'] = $type; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists(mixed $offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[ReturnTypeWillChange] + public function offsetGet(mixed $offset): mixed + { + 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(mixed $offset, mixed $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(mixed $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(): mixed + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString(): string + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue(): string + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/utils/sdk/client/php/src/Model/BlockProcessingPerformanceModel.php b/utils/sdk/client/php/src/Model/BlockProcessingPerformanceModel.php new file mode 100644 index 00000000..1a51e2bb --- /dev/null +++ b/utils/sdk/client/php/src/Model/BlockProcessingPerformanceModel.php @@ -0,0 +1,917 @@ + + */ +class BlockProcessingPerformanceModel implements ModelInterface, ArrayAccess, JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = 'BlockProcessingPerformanceModel'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPITypes = [ + 'block_processing_time_0' => 'int', + 'block_processing_time_1' => 'int', + 'target_calculating_time_2' => 'int', + 'longhash_calculating_time_3' => 'int', + 'all_txs_insert_time_5' => 'int', + 'etc_stuff_6' => 'int', + 'insert_time_4' => 'int', + 'raise_block_core_event' => 'int', + 'validate_miner_transaction_time' => 'int', + 'collect_rangeproofs_data_from_tx_time' => 'int', + 'verify_multiple_zc_outs_range_proofs_time' => 'int', + 'target_calculating_enum_blocks' => 'int', + 'target_calculating_calc' => 'int', + 'pos_validate_ki_search' => 'int', + 'pos_validate_get_out_keys_for_inputs' => 'int', + 'pos_validate_zvp' => 'int' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPIFormats = [ + 'block_processing_time_0' => null, + 'block_processing_time_1' => null, + 'target_calculating_time_2' => null, + 'longhash_calculating_time_3' => null, + 'all_txs_insert_time_5' => null, + 'etc_stuff_6' => null, + 'insert_time_4' => null, + 'raise_block_core_event' => null, + 'validate_miner_transaction_time' => null, + 'collect_rangeproofs_data_from_tx_time' => null, + 'verify_multiple_zc_outs_range_proofs_time' => null, + 'target_calculating_enum_blocks' => null, + 'target_calculating_calc' => null, + 'pos_validate_ki_search' => null, + 'pos_validate_get_out_keys_for_inputs' => null, + 'pos_validate_zvp' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'block_processing_time_0' => false, + 'block_processing_time_1' => false, + 'target_calculating_time_2' => false, + 'longhash_calculating_time_3' => false, + 'all_txs_insert_time_5' => false, + 'etc_stuff_6' => false, + 'insert_time_4' => false, + 'raise_block_core_event' => false, + 'validate_miner_transaction_time' => false, + 'collect_rangeproofs_data_from_tx_time' => false, + 'verify_multiple_zc_outs_range_proofs_time' => false, + 'target_calculating_enum_blocks' => false, + 'target_calculating_calc' => false, + 'pos_validate_ki_search' => false, + 'pos_validate_get_out_keys_for_inputs' => false, + 'pos_validate_zvp' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes(): array + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats(): array + { + 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 array + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param array $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 array + */ + protected static array $attributeMap = [ + 'block_processing_time_0' => 'block_processing_time_0', + 'block_processing_time_1' => 'block_processing_time_1', + 'target_calculating_time_2' => 'target_calculating_time_2', + 'longhash_calculating_time_3' => 'longhash_calculating_time_3', + 'all_txs_insert_time_5' => 'all_txs_insert_time_5', + 'etc_stuff_6' => 'etc_stuff_6', + 'insert_time_4' => 'insert_time_4', + 'raise_block_core_event' => 'raise_block_core_event', + 'validate_miner_transaction_time' => 'validate_miner_transaction_time', + 'collect_rangeproofs_data_from_tx_time' => 'collect_rangeproofs_data_from_tx_time', + 'verify_multiple_zc_outs_range_proofs_time' => 'verify_multiple_zc_outs_range_proofs_time', + 'target_calculating_enum_blocks' => 'target_calculating_enum_blocks', + 'target_calculating_calc' => 'target_calculating_calc', + 'pos_validate_ki_search' => 'pos_validate_ki_search', + 'pos_validate_get_out_keys_for_inputs' => 'pos_validate_get_out_keys_for_inputs', + 'pos_validate_zvp' => 'pos_validate_zvp' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var array + */ + protected static array $setters = [ + 'block_processing_time_0' => 'setBlockProcessingTime0', + 'block_processing_time_1' => 'setBlockProcessingTime1', + 'target_calculating_time_2' => 'setTargetCalculatingTime2', + 'longhash_calculating_time_3' => 'setLonghashCalculatingTime3', + 'all_txs_insert_time_5' => 'setAllTxsInsertTime5', + 'etc_stuff_6' => 'setEtcStuff6', + 'insert_time_4' => 'setInsertTime4', + 'raise_block_core_event' => 'setRaiseBlockCoreEvent', + 'validate_miner_transaction_time' => 'setValidateMinerTransactionTime', + 'collect_rangeproofs_data_from_tx_time' => 'setCollectRangeproofsDataFromTxTime', + 'verify_multiple_zc_outs_range_proofs_time' => 'setVerifyMultipleZcOutsRangeProofsTime', + 'target_calculating_enum_blocks' => 'setTargetCalculatingEnumBlocks', + 'target_calculating_calc' => 'setTargetCalculatingCalc', + 'pos_validate_ki_search' => 'setPosValidateKiSearch', + 'pos_validate_get_out_keys_for_inputs' => 'setPosValidateGetOutKeysForInputs', + 'pos_validate_zvp' => 'setPosValidateZvp' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var array + */ + protected static array $getters = [ + 'block_processing_time_0' => 'getBlockProcessingTime0', + 'block_processing_time_1' => 'getBlockProcessingTime1', + 'target_calculating_time_2' => 'getTargetCalculatingTime2', + 'longhash_calculating_time_3' => 'getLonghashCalculatingTime3', + 'all_txs_insert_time_5' => 'getAllTxsInsertTime5', + 'etc_stuff_6' => 'getEtcStuff6', + 'insert_time_4' => 'getInsertTime4', + 'raise_block_core_event' => 'getRaiseBlockCoreEvent', + 'validate_miner_transaction_time' => 'getValidateMinerTransactionTime', + 'collect_rangeproofs_data_from_tx_time' => 'getCollectRangeproofsDataFromTxTime', + 'verify_multiple_zc_outs_range_proofs_time' => 'getVerifyMultipleZcOutsRangeProofsTime', + 'target_calculating_enum_blocks' => 'getTargetCalculatingEnumBlocks', + 'target_calculating_calc' => 'getTargetCalculatingCalc', + 'pos_validate_ki_search' => 'getPosValidateKiSearch', + 'pos_validate_get_out_keys_for_inputs' => 'getPosValidateGetOutKeysForInputs', + 'pos_validate_zvp' => 'getPosValidateZvp' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap(): array + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters(): array + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters(): array + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName(): string + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var array + */ + protected array $container = []; + + /** + * Constructor + * + * @param array $data Associated array of property values initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('block_processing_time_0', $data ?? [], null); + $this->setIfExists('block_processing_time_1', $data ?? [], null); + $this->setIfExists('target_calculating_time_2', $data ?? [], null); + $this->setIfExists('longhash_calculating_time_3', $data ?? [], null); + $this->setIfExists('all_txs_insert_time_5', $data ?? [], null); + $this->setIfExists('etc_stuff_6', $data ?? [], null); + $this->setIfExists('insert_time_4', $data ?? [], null); + $this->setIfExists('raise_block_core_event', $data ?? [], null); + $this->setIfExists('validate_miner_transaction_time', $data ?? [], null); + $this->setIfExists('collect_rangeproofs_data_from_tx_time', $data ?? [], null); + $this->setIfExists('verify_multiple_zc_outs_range_proofs_time', $data ?? [], null); + $this->setIfExists('target_calculating_enum_blocks', $data ?? [], null); + $this->setIfExists('target_calculating_calc', $data ?? [], null); + $this->setIfExists('pos_validate_ki_search', $data ?? [], null); + $this->setIfExists('pos_validate_get_out_keys_for_inputs', $data ?? [], null); + $this->setIfExists('pos_validate_zvp', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, mixed $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 string[] invalid properties with reasons + */ + public function listInvalidProperties(): array + { + $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(): bool + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets block_processing_time_0 + * + * @return int|null + */ + public function getBlockProcessingTime0(): ?int + { + return $this->container['block_processing_time_0']; + } + + /** + * Sets block_processing_time_0 + * + * @param int|null $block_processing_time_0 block_processing_time_0 + * + * @return $this + */ + public function setBlockProcessingTime0(?int $block_processing_time_0): static + { + if (is_null($block_processing_time_0)) { + throw new InvalidArgumentException('non-nullable block_processing_time_0 cannot be null'); + } + $this->container['block_processing_time_0'] = $block_processing_time_0; + + return $this; + } + + /** + * Gets block_processing_time_1 + * + * @return int|null + */ + public function getBlockProcessingTime1(): ?int + { + return $this->container['block_processing_time_1']; + } + + /** + * Sets block_processing_time_1 + * + * @param int|null $block_processing_time_1 block_processing_time_1 + * + * @return $this + */ + public function setBlockProcessingTime1(?int $block_processing_time_1): static + { + if (is_null($block_processing_time_1)) { + throw new InvalidArgumentException('non-nullable block_processing_time_1 cannot be null'); + } + $this->container['block_processing_time_1'] = $block_processing_time_1; + + return $this; + } + + /** + * Gets target_calculating_time_2 + * + * @return int|null + */ + public function getTargetCalculatingTime2(): ?int + { + return $this->container['target_calculating_time_2']; + } + + /** + * Sets target_calculating_time_2 + * + * @param int|null $target_calculating_time_2 target_calculating_time_2 + * + * @return $this + */ + public function setTargetCalculatingTime2(?int $target_calculating_time_2): static + { + if (is_null($target_calculating_time_2)) { + throw new InvalidArgumentException('non-nullable target_calculating_time_2 cannot be null'); + } + $this->container['target_calculating_time_2'] = $target_calculating_time_2; + + return $this; + } + + /** + * Gets longhash_calculating_time_3 + * + * @return int|null + */ + public function getLonghashCalculatingTime3(): ?int + { + return $this->container['longhash_calculating_time_3']; + } + + /** + * Sets longhash_calculating_time_3 + * + * @param int|null $longhash_calculating_time_3 longhash_calculating_time_3 + * + * @return $this + */ + public function setLonghashCalculatingTime3(?int $longhash_calculating_time_3): static + { + if (is_null($longhash_calculating_time_3)) { + throw new InvalidArgumentException('non-nullable longhash_calculating_time_3 cannot be null'); + } + $this->container['longhash_calculating_time_3'] = $longhash_calculating_time_3; + + return $this; + } + + /** + * Gets all_txs_insert_time_5 + * + * @return int|null + */ + public function getAllTxsInsertTime5(): ?int + { + return $this->container['all_txs_insert_time_5']; + } + + /** + * Sets all_txs_insert_time_5 + * + * @param int|null $all_txs_insert_time_5 all_txs_insert_time_5 + * + * @return $this + */ + public function setAllTxsInsertTime5(?int $all_txs_insert_time_5): static + { + if (is_null($all_txs_insert_time_5)) { + throw new InvalidArgumentException('non-nullable all_txs_insert_time_5 cannot be null'); + } + $this->container['all_txs_insert_time_5'] = $all_txs_insert_time_5; + + return $this; + } + + /** + * Gets etc_stuff_6 + * + * @return int|null + */ + public function getEtcStuff6(): ?int + { + return $this->container['etc_stuff_6']; + } + + /** + * Sets etc_stuff_6 + * + * @param int|null $etc_stuff_6 etc_stuff_6 + * + * @return $this + */ + public function setEtcStuff6(?int $etc_stuff_6): static + { + if (is_null($etc_stuff_6)) { + throw new InvalidArgumentException('non-nullable etc_stuff_6 cannot be null'); + } + $this->container['etc_stuff_6'] = $etc_stuff_6; + + return $this; + } + + /** + * Gets insert_time_4 + * + * @return int|null + */ + public function getInsertTime4(): ?int + { + return $this->container['insert_time_4']; + } + + /** + * Sets insert_time_4 + * + * @param int|null $insert_time_4 insert_time_4 + * + * @return $this + */ + public function setInsertTime4(?int $insert_time_4): static + { + if (is_null($insert_time_4)) { + throw new InvalidArgumentException('non-nullable insert_time_4 cannot be null'); + } + $this->container['insert_time_4'] = $insert_time_4; + + return $this; + } + + /** + * Gets raise_block_core_event + * + * @return int|null + */ + public function getRaiseBlockCoreEvent(): ?int + { + return $this->container['raise_block_core_event']; + } + + /** + * Sets raise_block_core_event + * + * @param int|null $raise_block_core_event raise_block_core_event + * + * @return $this + */ + public function setRaiseBlockCoreEvent(?int $raise_block_core_event): static + { + if (is_null($raise_block_core_event)) { + throw new InvalidArgumentException('non-nullable raise_block_core_event cannot be null'); + } + $this->container['raise_block_core_event'] = $raise_block_core_event; + + return $this; + } + + /** + * Gets validate_miner_transaction_time + * + * @return int|null + */ + public function getValidateMinerTransactionTime(): ?int + { + return $this->container['validate_miner_transaction_time']; + } + + /** + * Sets validate_miner_transaction_time + * + * @param int|null $validate_miner_transaction_time validate_miner_transaction_time + * + * @return $this + */ + public function setValidateMinerTransactionTime(?int $validate_miner_transaction_time): static + { + if (is_null($validate_miner_transaction_time)) { + throw new InvalidArgumentException('non-nullable validate_miner_transaction_time cannot be null'); + } + $this->container['validate_miner_transaction_time'] = $validate_miner_transaction_time; + + return $this; + } + + /** + * Gets collect_rangeproofs_data_from_tx_time + * + * @return int|null + */ + public function getCollectRangeproofsDataFromTxTime(): ?int + { + return $this->container['collect_rangeproofs_data_from_tx_time']; + } + + /** + * Sets collect_rangeproofs_data_from_tx_time + * + * @param int|null $collect_rangeproofs_data_from_tx_time collect_rangeproofs_data_from_tx_time + * + * @return $this + */ + public function setCollectRangeproofsDataFromTxTime(?int $collect_rangeproofs_data_from_tx_time): static + { + if (is_null($collect_rangeproofs_data_from_tx_time)) { + throw new InvalidArgumentException('non-nullable collect_rangeproofs_data_from_tx_time cannot be null'); + } + $this->container['collect_rangeproofs_data_from_tx_time'] = $collect_rangeproofs_data_from_tx_time; + + return $this; + } + + /** + * Gets verify_multiple_zc_outs_range_proofs_time + * + * @return int|null + */ + public function getVerifyMultipleZcOutsRangeProofsTime(): ?int + { + return $this->container['verify_multiple_zc_outs_range_proofs_time']; + } + + /** + * Sets verify_multiple_zc_outs_range_proofs_time + * + * @param int|null $verify_multiple_zc_outs_range_proofs_time verify_multiple_zc_outs_range_proofs_time + * + * @return $this + */ + public function setVerifyMultipleZcOutsRangeProofsTime(?int $verify_multiple_zc_outs_range_proofs_time): static + { + if (is_null($verify_multiple_zc_outs_range_proofs_time)) { + throw new InvalidArgumentException('non-nullable verify_multiple_zc_outs_range_proofs_time cannot be null'); + } + $this->container['verify_multiple_zc_outs_range_proofs_time'] = $verify_multiple_zc_outs_range_proofs_time; + + return $this; + } + + /** + * Gets target_calculating_enum_blocks + * + * @return int|null + */ + public function getTargetCalculatingEnumBlocks(): ?int + { + return $this->container['target_calculating_enum_blocks']; + } + + /** + * Sets target_calculating_enum_blocks + * + * @param int|null $target_calculating_enum_blocks target_calculating_enum_blocks + * + * @return $this + */ + public function setTargetCalculatingEnumBlocks(?int $target_calculating_enum_blocks): static + { + if (is_null($target_calculating_enum_blocks)) { + throw new InvalidArgumentException('non-nullable target_calculating_enum_blocks cannot be null'); + } + $this->container['target_calculating_enum_blocks'] = $target_calculating_enum_blocks; + + return $this; + } + + /** + * Gets target_calculating_calc + * + * @return int|null + */ + public function getTargetCalculatingCalc(): ?int + { + return $this->container['target_calculating_calc']; + } + + /** + * Sets target_calculating_calc + * + * @param int|null $target_calculating_calc target_calculating_calc + * + * @return $this + */ + public function setTargetCalculatingCalc(?int $target_calculating_calc): static + { + if (is_null($target_calculating_calc)) { + throw new InvalidArgumentException('non-nullable target_calculating_calc cannot be null'); + } + $this->container['target_calculating_calc'] = $target_calculating_calc; + + return $this; + } + + /** + * Gets pos_validate_ki_search + * + * @return int|null + */ + public function getPosValidateKiSearch(): ?int + { + return $this->container['pos_validate_ki_search']; + } + + /** + * Sets pos_validate_ki_search + * + * @param int|null $pos_validate_ki_search pos_validate_ki_search + * + * @return $this + */ + public function setPosValidateKiSearch(?int $pos_validate_ki_search): static + { + if (is_null($pos_validate_ki_search)) { + throw new InvalidArgumentException('non-nullable pos_validate_ki_search cannot be null'); + } + $this->container['pos_validate_ki_search'] = $pos_validate_ki_search; + + return $this; + } + + /** + * Gets pos_validate_get_out_keys_for_inputs + * + * @return int|null + */ + public function getPosValidateGetOutKeysForInputs(): ?int + { + return $this->container['pos_validate_get_out_keys_for_inputs']; + } + + /** + * Sets pos_validate_get_out_keys_for_inputs + * + * @param int|null $pos_validate_get_out_keys_for_inputs pos_validate_get_out_keys_for_inputs + * + * @return $this + */ + public function setPosValidateGetOutKeysForInputs(?int $pos_validate_get_out_keys_for_inputs): static + { + if (is_null($pos_validate_get_out_keys_for_inputs)) { + throw new InvalidArgumentException('non-nullable pos_validate_get_out_keys_for_inputs cannot be null'); + } + $this->container['pos_validate_get_out_keys_for_inputs'] = $pos_validate_get_out_keys_for_inputs; + + return $this; + } + + /** + * Gets pos_validate_zvp + * + * @return int|null + */ + public function getPosValidateZvp(): ?int + { + return $this->container['pos_validate_zvp']; + } + + /** + * Sets pos_validate_zvp + * + * @param int|null $pos_validate_zvp pos_validate_zvp + * + * @return $this + */ + public function setPosValidateZvp(?int $pos_validate_zvp): static + { + if (is_null($pos_validate_zvp)) { + throw new InvalidArgumentException('non-nullable pos_validate_zvp cannot be null'); + } + $this->container['pos_validate_zvp'] = $pos_validate_zvp; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists(mixed $offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[ReturnTypeWillChange] + public function offsetGet(mixed $offset): mixed + { + 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(mixed $offset, mixed $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(mixed $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(): mixed + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString(): string + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue(): string + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/utils/sdk/client/php/src/Model/BlockTemplateModel.php b/utils/sdk/client/php/src/Model/BlockTemplateModel.php new file mode 100644 index 00000000..d19f5ba3 --- /dev/null +++ b/utils/sdk/client/php/src/Model/BlockTemplateModel.php @@ -0,0 +1,679 @@ + + */ +class BlockTemplateModel implements ModelInterface, ArrayAccess, JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = 'BlockTemplateModel'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPITypes = [ + 'blocktemplate_blob' => 'string', + 'difficulty' => 'string', + 'height' => 'int', + 'miner_tx_tgc' => '\OpenAPI\Client\Model\TxGenerationContextModel', + 'block_reward_without_fee' => 'int', + 'block_reward' => 'int', + 'txs_fee' => 'int', + 'prev_hash' => 'string', + 'seed' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPIFormats = [ + 'blocktemplate_blob' => null, + 'difficulty' => null, + 'height' => null, + 'miner_tx_tgc' => null, + 'block_reward_without_fee' => null, + 'block_reward' => null, + 'txs_fee' => null, + 'prev_hash' => null, + 'seed' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'blocktemplate_blob' => false, + 'difficulty' => false, + 'height' => false, + 'miner_tx_tgc' => false, + 'block_reward_without_fee' => false, + 'block_reward' => false, + 'txs_fee' => false, + 'prev_hash' => false, + 'seed' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes(): array + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats(): array + { + 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 array + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param array $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 array + */ + protected static array $attributeMap = [ + 'blocktemplate_blob' => 'blocktemplate_blob', + 'difficulty' => 'difficulty', + 'height' => 'height', + 'miner_tx_tgc' => 'miner_tx_tgc', + 'block_reward_without_fee' => 'block_reward_without_fee', + 'block_reward' => 'block_reward', + 'txs_fee' => 'txs_fee', + 'prev_hash' => 'prev_hash', + 'seed' => 'seed' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var array + */ + protected static array $setters = [ + 'blocktemplate_blob' => 'setBlocktemplateBlob', + 'difficulty' => 'setDifficulty', + 'height' => 'setHeight', + 'miner_tx_tgc' => 'setMinerTxTgc', + 'block_reward_without_fee' => 'setBlockRewardWithoutFee', + 'block_reward' => 'setBlockReward', + 'txs_fee' => 'setTxsFee', + 'prev_hash' => 'setPrevHash', + 'seed' => 'setSeed' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var array + */ + protected static array $getters = [ + 'blocktemplate_blob' => 'getBlocktemplateBlob', + 'difficulty' => 'getDifficulty', + 'height' => 'getHeight', + 'miner_tx_tgc' => 'getMinerTxTgc', + 'block_reward_without_fee' => 'getBlockRewardWithoutFee', + 'block_reward' => 'getBlockReward', + 'txs_fee' => 'getTxsFee', + 'prev_hash' => 'getPrevHash', + 'seed' => 'getSeed' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap(): array + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters(): array + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters(): array + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName(): string + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var array + */ + protected array $container = []; + + /** + * Constructor + * + * @param array $data Associated array of property values initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('blocktemplate_blob', $data ?? [], null); + $this->setIfExists('difficulty', $data ?? [], null); + $this->setIfExists('height', $data ?? [], null); + $this->setIfExists('miner_tx_tgc', $data ?? [], null); + $this->setIfExists('block_reward_without_fee', $data ?? [], null); + $this->setIfExists('block_reward', $data ?? [], null); + $this->setIfExists('txs_fee', $data ?? [], null); + $this->setIfExists('prev_hash', $data ?? [], null); + $this->setIfExists('seed', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, mixed $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 string[] invalid properties with reasons + */ + public function listInvalidProperties(): array + { + $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(): bool + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets blocktemplate_blob + * + * @return string|null + */ + public function getBlocktemplateBlob(): ?string + { + return $this->container['blocktemplate_blob']; + } + + /** + * Sets blocktemplate_blob + * + * @param string|null $blocktemplate_blob blocktemplate_blob + * + * @return $this + */ + public function setBlocktemplateBlob(?string $blocktemplate_blob): static + { + if (is_null($blocktemplate_blob)) { + throw new InvalidArgumentException('non-nullable blocktemplate_blob cannot be null'); + } + $this->container['blocktemplate_blob'] = $blocktemplate_blob; + + return $this; + } + + /** + * Gets difficulty + * + * @return string|null + */ + public function getDifficulty(): ?string + { + return $this->container['difficulty']; + } + + /** + * Sets difficulty + * + * @param string|null $difficulty difficulty + * + * @return $this + */ + public function setDifficulty(?string $difficulty): static + { + if (is_null($difficulty)) { + throw new InvalidArgumentException('non-nullable difficulty cannot be null'); + } + $this->container['difficulty'] = $difficulty; + + return $this; + } + + /** + * Gets height + * + * @return int|null + */ + public function getHeight(): ?int + { + return $this->container['height']; + } + + /** + * Sets height + * + * @param int|null $height height + * + * @return $this + */ + public function setHeight(?int $height): static + { + if (is_null($height)) { + throw new InvalidArgumentException('non-nullable height cannot be null'); + } + $this->container['height'] = $height; + + return $this; + } + + /** + * Gets miner_tx_tgc + * + * @return \OpenAPI\Client\Model\TxGenerationContextModel|null + */ + public function getMinerTxTgc(): ?\OpenAPI\Client\Model\TxGenerationContextModel + { + return $this->container['miner_tx_tgc']; + } + + /** + * Sets miner_tx_tgc + * + * @param \OpenAPI\Client\Model\TxGenerationContextModel|null $miner_tx_tgc miner_tx_tgc + * + * @return $this + */ + public function setMinerTxTgc(?\OpenAPI\Client\Model\TxGenerationContextModel $miner_tx_tgc): static + { + if (is_null($miner_tx_tgc)) { + throw new InvalidArgumentException('non-nullable miner_tx_tgc cannot be null'); + } + $this->container['miner_tx_tgc'] = $miner_tx_tgc; + + return $this; + } + + /** + * Gets block_reward_without_fee + * + * @return int|null + */ + public function getBlockRewardWithoutFee(): ?int + { + return $this->container['block_reward_without_fee']; + } + + /** + * Sets block_reward_without_fee + * + * @param int|null $block_reward_without_fee block_reward_without_fee + * + * @return $this + */ + public function setBlockRewardWithoutFee(?int $block_reward_without_fee): static + { + if (is_null($block_reward_without_fee)) { + throw new InvalidArgumentException('non-nullable block_reward_without_fee cannot be null'); + } + $this->container['block_reward_without_fee'] = $block_reward_without_fee; + + return $this; + } + + /** + * Gets block_reward + * + * @return int|null + */ + public function getBlockReward(): ?int + { + return $this->container['block_reward']; + } + + /** + * Sets block_reward + * + * @param int|null $block_reward block_reward + * + * @return $this + */ + public function setBlockReward(?int $block_reward): static + { + if (is_null($block_reward)) { + throw new InvalidArgumentException('non-nullable block_reward cannot be null'); + } + $this->container['block_reward'] = $block_reward; + + return $this; + } + + /** + * Gets txs_fee + * + * @return int|null + */ + public function getTxsFee(): ?int + { + return $this->container['txs_fee']; + } + + /** + * Sets txs_fee + * + * @param int|null $txs_fee txs_fee + * + * @return $this + */ + public function setTxsFee(?int $txs_fee): static + { + if (is_null($txs_fee)) { + throw new InvalidArgumentException('non-nullable txs_fee cannot be null'); + } + $this->container['txs_fee'] = $txs_fee; + + return $this; + } + + /** + * Gets prev_hash + * + * @return string|null + */ + public function getPrevHash(): ?string + { + return $this->container['prev_hash']; + } + + /** + * Sets prev_hash + * + * @param string|null $prev_hash prev_hash + * + * @return $this + */ + public function setPrevHash(?string $prev_hash): static + { + if (is_null($prev_hash)) { + throw new InvalidArgumentException('non-nullable prev_hash cannot be null'); + } + $this->container['prev_hash'] = $prev_hash; + + return $this; + } + + /** + * Gets seed + * + * @return string|null + */ + public function getSeed(): ?string + { + return $this->container['seed']; + } + + /** + * Sets seed + * + * @param string|null $seed seed + * + * @return $this + */ + public function setSeed(?string $seed): static + { + if (is_null($seed)) { + throw new InvalidArgumentException('non-nullable seed cannot be null'); + } + $this->container['seed'] = $seed; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists(mixed $offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[ReturnTypeWillChange] + public function offsetGet(mixed $offset): mixed + { + 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(mixed $offset, mixed $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(mixed $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(): mixed + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString(): string + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue(): string + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/utils/sdk/client/php/src/Model/BlockTemplateRequestModel.php b/utils/sdk/client/php/src/Model/BlockTemplateRequestModel.php new file mode 100644 index 00000000..52633bee --- /dev/null +++ b/utils/sdk/client/php/src/Model/BlockTemplateRequestModel.php @@ -0,0 +1,611 @@ + + */ +class BlockTemplateRequestModel implements ModelInterface, ArrayAccess, JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = 'BlockTemplateRequestModel'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPITypes = [ + 'miner_address' => 'string', + 'stakeholder_address' => 'string', + 'ex_nonce' => 'string', + 'pos_block' => 'bool', + 'ignore_pow_ts_check' => 'bool', + 'pe' => '\OpenAPI\Client\Model\PosEntryModel', + 'explicit_txs' => 'string[]' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPIFormats = [ + 'miner_address' => null, + 'stakeholder_address' => null, + 'ex_nonce' => null, + 'pos_block' => null, + 'ignore_pow_ts_check' => null, + 'pe' => null, + 'explicit_txs' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'miner_address' => false, + 'stakeholder_address' => false, + 'ex_nonce' => false, + 'pos_block' => false, + 'ignore_pow_ts_check' => false, + 'pe' => false, + 'explicit_txs' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes(): array + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats(): array + { + 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 array + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param array $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 array + */ + protected static array $attributeMap = [ + 'miner_address' => 'miner_address', + 'stakeholder_address' => 'stakeholder_address', + 'ex_nonce' => 'ex_nonce', + 'pos_block' => 'pos_block', + 'ignore_pow_ts_check' => 'ignore_pow_ts_check', + 'pe' => 'pe', + 'explicit_txs' => 'explicit_txs' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var array + */ + protected static array $setters = [ + 'miner_address' => 'setMinerAddress', + 'stakeholder_address' => 'setStakeholderAddress', + 'ex_nonce' => 'setExNonce', + 'pos_block' => 'setPosBlock', + 'ignore_pow_ts_check' => 'setIgnorePowTsCheck', + 'pe' => 'setPe', + 'explicit_txs' => 'setExplicitTxs' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var array + */ + protected static array $getters = [ + 'miner_address' => 'getMinerAddress', + 'stakeholder_address' => 'getStakeholderAddress', + 'ex_nonce' => 'getExNonce', + 'pos_block' => 'getPosBlock', + 'ignore_pow_ts_check' => 'getIgnorePowTsCheck', + 'pe' => 'getPe', + 'explicit_txs' => 'getExplicitTxs' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap(): array + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters(): array + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters(): array + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName(): string + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var array + */ + protected array $container = []; + + /** + * Constructor + * + * @param array $data Associated array of property values initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('miner_address', $data ?? [], null); + $this->setIfExists('stakeholder_address', $data ?? [], null); + $this->setIfExists('ex_nonce', $data ?? [], null); + $this->setIfExists('pos_block', $data ?? [], null); + $this->setIfExists('ignore_pow_ts_check', $data ?? [], null); + $this->setIfExists('pe', $data ?? [], null); + $this->setIfExists('explicit_txs', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, mixed $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 string[] invalid properties with reasons + */ + public function listInvalidProperties(): array + { + $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(): bool + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets miner_address + * + * @return string|null + */ + public function getMinerAddress(): ?string + { + return $this->container['miner_address']; + } + + /** + * Sets miner_address + * + * @param string|null $miner_address miner_address + * + * @return $this + */ + public function setMinerAddress(?string $miner_address): static + { + if (is_null($miner_address)) { + throw new InvalidArgumentException('non-nullable miner_address cannot be null'); + } + $this->container['miner_address'] = $miner_address; + + return $this; + } + + /** + * Gets stakeholder_address + * + * @return string|null + */ + public function getStakeholderAddress(): ?string + { + return $this->container['stakeholder_address']; + } + + /** + * Sets stakeholder_address + * + * @param string|null $stakeholder_address stakeholder_address + * + * @return $this + */ + public function setStakeholderAddress(?string $stakeholder_address): static + { + if (is_null($stakeholder_address)) { + throw new InvalidArgumentException('non-nullable stakeholder_address cannot be null'); + } + $this->container['stakeholder_address'] = $stakeholder_address; + + return $this; + } + + /** + * Gets ex_nonce + * + * @return string|null + */ + public function getExNonce(): ?string + { + return $this->container['ex_nonce']; + } + + /** + * Sets ex_nonce + * + * @param string|null $ex_nonce ex_nonce + * + * @return $this + */ + public function setExNonce(?string $ex_nonce): static + { + if (is_null($ex_nonce)) { + throw new InvalidArgumentException('non-nullable ex_nonce cannot be null'); + } + $this->container['ex_nonce'] = $ex_nonce; + + return $this; + } + + /** + * Gets pos_block + * + * @return bool|null + */ + public function getPosBlock(): ?bool + { + return $this->container['pos_block']; + } + + /** + * Sets pos_block + * + * @param bool|null $pos_block pos_block + * + * @return $this + */ + public function setPosBlock(?bool $pos_block): static + { + if (is_null($pos_block)) { + throw new InvalidArgumentException('non-nullable pos_block cannot be null'); + } + $this->container['pos_block'] = $pos_block; + + return $this; + } + + /** + * Gets ignore_pow_ts_check + * + * @return bool|null + */ + public function getIgnorePowTsCheck(): ?bool + { + return $this->container['ignore_pow_ts_check']; + } + + /** + * Sets ignore_pow_ts_check + * + * @param bool|null $ignore_pow_ts_check ignore_pow_ts_check + * + * @return $this + */ + public function setIgnorePowTsCheck(?bool $ignore_pow_ts_check): static + { + if (is_null($ignore_pow_ts_check)) { + throw new InvalidArgumentException('non-nullable ignore_pow_ts_check cannot be null'); + } + $this->container['ignore_pow_ts_check'] = $ignore_pow_ts_check; + + return $this; + } + + /** + * Gets pe + * + * @return \OpenAPI\Client\Model\PosEntryModel|null + */ + public function getPe(): ?\OpenAPI\Client\Model\PosEntryModel + { + return $this->container['pe']; + } + + /** + * Sets pe + * + * @param \OpenAPI\Client\Model\PosEntryModel|null $pe pe + * + * @return $this + */ + public function setPe(?\OpenAPI\Client\Model\PosEntryModel $pe): static + { + if (is_null($pe)) { + throw new InvalidArgumentException('non-nullable pe cannot be null'); + } + $this->container['pe'] = $pe; + + return $this; + } + + /** + * Gets explicit_txs + * + * @return string[]|null + */ + public function getExplicitTxs(): ?array + { + return $this->container['explicit_txs']; + } + + /** + * Sets explicit_txs + * + * @param string[]|null $explicit_txs explicit_txs + * + * @return $this + */ + public function setExplicitTxs(?array $explicit_txs): static + { + if (is_null($explicit_txs)) { + throw new InvalidArgumentException('non-nullable explicit_txs cannot be null'); + } + $this->container['explicit_txs'] = $explicit_txs; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists(mixed $offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[ReturnTypeWillChange] + public function offsetGet(mixed $offset): mixed + { + 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(mixed $offset, mixed $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(mixed $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(): mixed + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString(): string + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue(): string + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/utils/sdk/client/php/src/Model/DbStatInfoModel.php b/utils/sdk/client/php/src/Model/DbStatInfoModel.php new file mode 100644 index 00000000..95470888 --- /dev/null +++ b/utils/sdk/client/php/src/Model/DbStatInfoModel.php @@ -0,0 +1,475 @@ + + */ +class DbStatInfoModel implements ModelInterface, ArrayAccess, JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = 'DbStatInfoModel'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPITypes = [ + 'tx_count' => 'int', + 'write_tx_count' => 'int', + 'map_size' => 'int' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPIFormats = [ + 'tx_count' => null, + 'write_tx_count' => null, + 'map_size' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'tx_count' => false, + 'write_tx_count' => false, + 'map_size' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes(): array + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats(): array + { + 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 array + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param array $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 array + */ + protected static array $attributeMap = [ + 'tx_count' => 'tx_count', + 'write_tx_count' => 'write_tx_count', + 'map_size' => 'map_size' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var array + */ + protected static array $setters = [ + 'tx_count' => 'setTxCount', + 'write_tx_count' => 'setWriteTxCount', + 'map_size' => 'setMapSize' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var array + */ + protected static array $getters = [ + 'tx_count' => 'getTxCount', + 'write_tx_count' => 'getWriteTxCount', + 'map_size' => 'getMapSize' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap(): array + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters(): array + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters(): array + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName(): string + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var array + */ + protected array $container = []; + + /** + * Constructor + * + * @param array $data Associated array of property values initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('tx_count', $data ?? [], null); + $this->setIfExists('write_tx_count', $data ?? [], null); + $this->setIfExists('map_size', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, mixed $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 string[] invalid properties with reasons + */ + public function listInvalidProperties(): array + { + $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(): bool + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets tx_count + * + * @return int|null + */ + public function getTxCount(): ?int + { + return $this->container['tx_count']; + } + + /** + * Sets tx_count + * + * @param int|null $tx_count tx_count + * + * @return $this + */ + public function setTxCount(?int $tx_count): static + { + if (is_null($tx_count)) { + throw new InvalidArgumentException('non-nullable tx_count cannot be null'); + } + $this->container['tx_count'] = $tx_count; + + return $this; + } + + /** + * Gets write_tx_count + * + * @return int|null + */ + public function getWriteTxCount(): ?int + { + return $this->container['write_tx_count']; + } + + /** + * Sets write_tx_count + * + * @param int|null $write_tx_count write_tx_count + * + * @return $this + */ + public function setWriteTxCount(?int $write_tx_count): static + { + if (is_null($write_tx_count)) { + throw new InvalidArgumentException('non-nullable write_tx_count cannot be null'); + } + $this->container['write_tx_count'] = $write_tx_count; + + return $this; + } + + /** + * Gets map_size + * + * @return int|null + */ + public function getMapSize(): ?int + { + return $this->container['map_size']; + } + + /** + * Sets map_size + * + * @param int|null $map_size map_size + * + * @return $this + */ + public function setMapSize(?int $map_size): static + { + if (is_null($map_size)) { + throw new InvalidArgumentException('non-nullable map_size cannot be null'); + } + $this->container['map_size'] = $map_size; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists(mixed $offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[ReturnTypeWillChange] + public function offsetGet(mixed $offset): mixed + { + 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(mixed $offset, mixed $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(mixed $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(): mixed + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString(): string + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue(): string + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/utils/sdk/client/php/src/Model/HeightModel.php b/utils/sdk/client/php/src/Model/HeightModel.php new file mode 100644 index 00000000..f781a448 --- /dev/null +++ b/utils/sdk/client/php/src/Model/HeightModel.php @@ -0,0 +1,407 @@ + + */ +class HeightModel implements ModelInterface, ArrayAccess, JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = 'HeightModel'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPITypes = [ + 'height' => 'int' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPIFormats = [ + 'height' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'height' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes(): array + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats(): array + { + 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 array + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param array $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 array + */ + protected static array $attributeMap = [ + 'height' => 'height' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var array + */ + protected static array $setters = [ + 'height' => 'setHeight' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var array + */ + protected static array $getters = [ + 'height' => 'getHeight' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap(): array + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters(): array + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters(): array + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName(): string + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var array + */ + protected array $container = []; + + /** + * Constructor + * + * @param array $data Associated array of property values initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('height', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, mixed $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 string[] invalid properties with reasons + */ + public function listInvalidProperties(): array + { + $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(): bool + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets height + * + * @return int|null + */ + public function getHeight(): ?int + { + return $this->container['height']; + } + + /** + * Sets height + * + * @param int|null $height height + * + * @return $this + */ + public function setHeight(?int $height): static + { + if (is_null($height)) { + throw new InvalidArgumentException('non-nullable height cannot be null'); + } + $this->container['height'] = $height; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists(mixed $offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[ReturnTypeWillChange] + public function offsetGet(mixed $offset): mixed + { + 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(mixed $offset, mixed $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(mixed $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(): mixed + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString(): string + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue(): string + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/utils/sdk/client/php/src/Model/InfoModel.php b/utils/sdk/client/php/src/Model/InfoModel.php new file mode 100644 index 00000000..8d0ca76b --- /dev/null +++ b/utils/sdk/client/php/src/Model/InfoModel.php @@ -0,0 +1,1937 @@ + + */ +class InfoModel implements ModelInterface, ArrayAccess, JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = 'InfoModel'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPITypes = [ + 'height' => 'int', + 'tx_count' => 'int', + 'tx_pool_size' => 'int', + 'alt_blocks_count' => 'int', + 'outgoing_connections_count' => 'int', + 'incoming_connections_count' => 'int', + 'synchronized_connections_count' => 'int', + 'white_peerlist_size' => 'int', + 'grey_peerlist_size' => 'int', + 'current_blocks_median' => 'int', + 'alias_count' => 'int', + 'current_max_allowed_block_size' => 'int', + 'daemon_network_state' => 'string', + 'synchronization_start_height' => 'int', + 'max_net_seen_height' => 'int', + 'mi' => '\OpenAPI\Client\Model\MaintainersInfoModel', + 'pos_allowed' => 'bool', + 'pos_difficulty' => 'string', + 'pow_difficulty' => 'int', + 'default_fee' => 'int', + 'minimum_fee' => 'int', + 'is_hardfork_active' => 'bool[]', + 'net_time_delta_median' => 'int', + 'current_network_hashrate_50' => 'int', + 'current_network_hashrate_350' => 'int', + 'seconds_for_10_blocks' => 'int', + 'seconds_for_30_blocks' => 'int', + 'transactions_cnt_per_day' => 'int[]', + 'transactions_volume_per_day' => 'int[]', + 'last_pos_timestamp' => 'int', + 'last_pow_timestamp' => 'int', + 'total_coins' => 'string', + 'last_block_size' => 'int', + 'tx_count_in_last_block' => 'int', + 'pos_sequence_factor' => 'float', + 'pow_sequence_factor' => 'float', + 'block_reward' => 'int', + 'last_block_total_reward' => 'int', + 'pos_diff_total_coins_rate' => 'int', + 'last_block_timestamp' => 'int', + 'last_block_hash' => 'string', + 'pos_block_ts_shift_vs_actual' => 'int', + 'outs_stat' => 'array', + 'performance_data' => '\OpenAPI\Client\Model\PerformanceModel', + 'offers_count' => 'int', + 'expiration_median_timestamp' => 'int' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPIFormats = [ + 'height' => null, + 'tx_count' => null, + 'tx_pool_size' => null, + 'alt_blocks_count' => null, + 'outgoing_connections_count' => null, + 'incoming_connections_count' => null, + 'synchronized_connections_count' => null, + 'white_peerlist_size' => null, + 'grey_peerlist_size' => null, + 'current_blocks_median' => null, + 'alias_count' => null, + 'current_max_allowed_block_size' => null, + 'daemon_network_state' => null, + 'synchronization_start_height' => null, + 'max_net_seen_height' => null, + 'mi' => null, + 'pos_allowed' => null, + 'pos_difficulty' => null, + 'pow_difficulty' => null, + 'default_fee' => null, + 'minimum_fee' => null, + 'is_hardfork_active' => null, + 'net_time_delta_median' => 'int64', + 'current_network_hashrate_50' => null, + 'current_network_hashrate_350' => null, + 'seconds_for_10_blocks' => null, + 'seconds_for_30_blocks' => null, + 'transactions_cnt_per_day' => null, + 'transactions_volume_per_day' => null, + 'last_pos_timestamp' => null, + 'last_pow_timestamp' => null, + 'total_coins' => null, + 'last_block_size' => null, + 'tx_count_in_last_block' => null, + 'pos_sequence_factor' => 'double', + 'pow_sequence_factor' => 'double', + 'block_reward' => null, + 'last_block_total_reward' => null, + 'pos_diff_total_coins_rate' => null, + 'last_block_timestamp' => null, + 'last_block_hash' => null, + 'pos_block_ts_shift_vs_actual' => 'int64', + 'outs_stat' => null, + 'performance_data' => null, + 'offers_count' => null, + 'expiration_median_timestamp' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'height' => false, + 'tx_count' => false, + 'tx_pool_size' => false, + 'alt_blocks_count' => false, + 'outgoing_connections_count' => false, + 'incoming_connections_count' => false, + 'synchronized_connections_count' => false, + 'white_peerlist_size' => false, + 'grey_peerlist_size' => false, + 'current_blocks_median' => false, + 'alias_count' => false, + 'current_max_allowed_block_size' => false, + 'daemon_network_state' => false, + 'synchronization_start_height' => false, + 'max_net_seen_height' => false, + 'mi' => false, + 'pos_allowed' => false, + 'pos_difficulty' => false, + 'pow_difficulty' => false, + 'default_fee' => false, + 'minimum_fee' => false, + 'is_hardfork_active' => false, + 'net_time_delta_median' => false, + 'current_network_hashrate_50' => false, + 'current_network_hashrate_350' => false, + 'seconds_for_10_blocks' => false, + 'seconds_for_30_blocks' => false, + 'transactions_cnt_per_day' => false, + 'transactions_volume_per_day' => false, + 'last_pos_timestamp' => false, + 'last_pow_timestamp' => false, + 'total_coins' => false, + 'last_block_size' => false, + 'tx_count_in_last_block' => false, + 'pos_sequence_factor' => false, + 'pow_sequence_factor' => false, + 'block_reward' => false, + 'last_block_total_reward' => false, + 'pos_diff_total_coins_rate' => false, + 'last_block_timestamp' => false, + 'last_block_hash' => false, + 'pos_block_ts_shift_vs_actual' => false, + 'outs_stat' => false, + 'performance_data' => false, + 'offers_count' => false, + 'expiration_median_timestamp' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes(): array + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats(): array + { + 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 array + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param array $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 array + */ + protected static array $attributeMap = [ + 'height' => 'height', + 'tx_count' => 'tx_count', + 'tx_pool_size' => 'tx_pool_size', + 'alt_blocks_count' => 'alt_blocks_count', + 'outgoing_connections_count' => 'outgoing_connections_count', + 'incoming_connections_count' => 'incoming_connections_count', + 'synchronized_connections_count' => 'synchronized_connections_count', + 'white_peerlist_size' => 'white_peerlist_size', + 'grey_peerlist_size' => 'grey_peerlist_size', + 'current_blocks_median' => 'current_blocks_median', + 'alias_count' => 'alias_count', + 'current_max_allowed_block_size' => 'current_max_allowed_block_size', + 'daemon_network_state' => 'daemon_network_state', + 'synchronization_start_height' => 'synchronization_start_height', + 'max_net_seen_height' => 'max_net_seen_height', + 'mi' => 'mi', + 'pos_allowed' => 'pos_allowed', + 'pos_difficulty' => 'pos_difficulty', + 'pow_difficulty' => 'pow_difficulty', + 'default_fee' => 'default_fee', + 'minimum_fee' => 'minimum_fee', + 'is_hardfork_active' => 'is_hardfork_active', + 'net_time_delta_median' => 'net_time_delta_median', + 'current_network_hashrate_50' => 'current_network_hashrate_50', + 'current_network_hashrate_350' => 'current_network_hashrate_350', + 'seconds_for_10_blocks' => 'seconds_for_10_blocks', + 'seconds_for_30_blocks' => 'seconds_for_30_blocks', + 'transactions_cnt_per_day' => 'transactions_cnt_per_day', + 'transactions_volume_per_day' => 'transactions_volume_per_day', + 'last_pos_timestamp' => 'last_pos_timestamp', + 'last_pow_timestamp' => 'last_pow_timestamp', + 'total_coins' => 'total_coins', + 'last_block_size' => 'last_block_size', + 'tx_count_in_last_block' => 'tx_count_in_last_block', + 'pos_sequence_factor' => 'pos_sequence_factor', + 'pow_sequence_factor' => 'pow_sequence_factor', + 'block_reward' => 'block_reward', + 'last_block_total_reward' => 'last_block_total_reward', + 'pos_diff_total_coins_rate' => 'pos_diff_total_coins_rate', + 'last_block_timestamp' => 'last_block_timestamp', + 'last_block_hash' => 'last_block_hash', + 'pos_block_ts_shift_vs_actual' => 'pos_block_ts_shift_vs_actual', + 'outs_stat' => 'outs_stat', + 'performance_data' => 'performance_data', + 'offers_count' => 'offers_count', + 'expiration_median_timestamp' => 'expiration_median_timestamp' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var array + */ + protected static array $setters = [ + 'height' => 'setHeight', + 'tx_count' => 'setTxCount', + 'tx_pool_size' => 'setTxPoolSize', + 'alt_blocks_count' => 'setAltBlocksCount', + 'outgoing_connections_count' => 'setOutgoingConnectionsCount', + 'incoming_connections_count' => 'setIncomingConnectionsCount', + 'synchronized_connections_count' => 'setSynchronizedConnectionsCount', + 'white_peerlist_size' => 'setWhitePeerlistSize', + 'grey_peerlist_size' => 'setGreyPeerlistSize', + 'current_blocks_median' => 'setCurrentBlocksMedian', + 'alias_count' => 'setAliasCount', + 'current_max_allowed_block_size' => 'setCurrentMaxAllowedBlockSize', + 'daemon_network_state' => 'setDaemonNetworkState', + 'synchronization_start_height' => 'setSynchronizationStartHeight', + 'max_net_seen_height' => 'setMaxNetSeenHeight', + 'mi' => 'setMi', + 'pos_allowed' => 'setPosAllowed', + 'pos_difficulty' => 'setPosDifficulty', + 'pow_difficulty' => 'setPowDifficulty', + 'default_fee' => 'setDefaultFee', + 'minimum_fee' => 'setMinimumFee', + 'is_hardfork_active' => 'setIsHardforkActive', + 'net_time_delta_median' => 'setNetTimeDeltaMedian', + 'current_network_hashrate_50' => 'setCurrentNetworkHashrate50', + 'current_network_hashrate_350' => 'setCurrentNetworkHashrate350', + 'seconds_for_10_blocks' => 'setSecondsFor10Blocks', + 'seconds_for_30_blocks' => 'setSecondsFor30Blocks', + 'transactions_cnt_per_day' => 'setTransactionsCntPerDay', + 'transactions_volume_per_day' => 'setTransactionsVolumePerDay', + 'last_pos_timestamp' => 'setLastPosTimestamp', + 'last_pow_timestamp' => 'setLastPowTimestamp', + 'total_coins' => 'setTotalCoins', + 'last_block_size' => 'setLastBlockSize', + 'tx_count_in_last_block' => 'setTxCountInLastBlock', + 'pos_sequence_factor' => 'setPosSequenceFactor', + 'pow_sequence_factor' => 'setPowSequenceFactor', + 'block_reward' => 'setBlockReward', + 'last_block_total_reward' => 'setLastBlockTotalReward', + 'pos_diff_total_coins_rate' => 'setPosDiffTotalCoinsRate', + 'last_block_timestamp' => 'setLastBlockTimestamp', + 'last_block_hash' => 'setLastBlockHash', + 'pos_block_ts_shift_vs_actual' => 'setPosBlockTsShiftVsActual', + 'outs_stat' => 'setOutsStat', + 'performance_data' => 'setPerformanceData', + 'offers_count' => 'setOffersCount', + 'expiration_median_timestamp' => 'setExpirationMedianTimestamp' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var array + */ + protected static array $getters = [ + 'height' => 'getHeight', + 'tx_count' => 'getTxCount', + 'tx_pool_size' => 'getTxPoolSize', + 'alt_blocks_count' => 'getAltBlocksCount', + 'outgoing_connections_count' => 'getOutgoingConnectionsCount', + 'incoming_connections_count' => 'getIncomingConnectionsCount', + 'synchronized_connections_count' => 'getSynchronizedConnectionsCount', + 'white_peerlist_size' => 'getWhitePeerlistSize', + 'grey_peerlist_size' => 'getGreyPeerlistSize', + 'current_blocks_median' => 'getCurrentBlocksMedian', + 'alias_count' => 'getAliasCount', + 'current_max_allowed_block_size' => 'getCurrentMaxAllowedBlockSize', + 'daemon_network_state' => 'getDaemonNetworkState', + 'synchronization_start_height' => 'getSynchronizationStartHeight', + 'max_net_seen_height' => 'getMaxNetSeenHeight', + 'mi' => 'getMi', + 'pos_allowed' => 'getPosAllowed', + 'pos_difficulty' => 'getPosDifficulty', + 'pow_difficulty' => 'getPowDifficulty', + 'default_fee' => 'getDefaultFee', + 'minimum_fee' => 'getMinimumFee', + 'is_hardfork_active' => 'getIsHardforkActive', + 'net_time_delta_median' => 'getNetTimeDeltaMedian', + 'current_network_hashrate_50' => 'getCurrentNetworkHashrate50', + 'current_network_hashrate_350' => 'getCurrentNetworkHashrate350', + 'seconds_for_10_blocks' => 'getSecondsFor10Blocks', + 'seconds_for_30_blocks' => 'getSecondsFor30Blocks', + 'transactions_cnt_per_day' => 'getTransactionsCntPerDay', + 'transactions_volume_per_day' => 'getTransactionsVolumePerDay', + 'last_pos_timestamp' => 'getLastPosTimestamp', + 'last_pow_timestamp' => 'getLastPowTimestamp', + 'total_coins' => 'getTotalCoins', + 'last_block_size' => 'getLastBlockSize', + 'tx_count_in_last_block' => 'getTxCountInLastBlock', + 'pos_sequence_factor' => 'getPosSequenceFactor', + 'pow_sequence_factor' => 'getPowSequenceFactor', + 'block_reward' => 'getBlockReward', + 'last_block_total_reward' => 'getLastBlockTotalReward', + 'pos_diff_total_coins_rate' => 'getPosDiffTotalCoinsRate', + 'last_block_timestamp' => 'getLastBlockTimestamp', + 'last_block_hash' => 'getLastBlockHash', + 'pos_block_ts_shift_vs_actual' => 'getPosBlockTsShiftVsActual', + 'outs_stat' => 'getOutsStat', + 'performance_data' => 'getPerformanceData', + 'offers_count' => 'getOffersCount', + 'expiration_median_timestamp' => 'getExpirationMedianTimestamp' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap(): array + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters(): array + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters(): array + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName(): string + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var array + */ + protected array $container = []; + + /** + * Constructor + * + * @param array $data Associated array of property values initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('height', $data ?? [], null); + $this->setIfExists('tx_count', $data ?? [], null); + $this->setIfExists('tx_pool_size', $data ?? [], null); + $this->setIfExists('alt_blocks_count', $data ?? [], null); + $this->setIfExists('outgoing_connections_count', $data ?? [], null); + $this->setIfExists('incoming_connections_count', $data ?? [], null); + $this->setIfExists('synchronized_connections_count', $data ?? [], null); + $this->setIfExists('white_peerlist_size', $data ?? [], null); + $this->setIfExists('grey_peerlist_size', $data ?? [], null); + $this->setIfExists('current_blocks_median', $data ?? [], null); + $this->setIfExists('alias_count', $data ?? [], null); + $this->setIfExists('current_max_allowed_block_size', $data ?? [], null); + $this->setIfExists('daemon_network_state', $data ?? [], null); + $this->setIfExists('synchronization_start_height', $data ?? [], null); + $this->setIfExists('max_net_seen_height', $data ?? [], null); + $this->setIfExists('mi', $data ?? [], null); + $this->setIfExists('pos_allowed', $data ?? [], null); + $this->setIfExists('pos_difficulty', $data ?? [], null); + $this->setIfExists('pow_difficulty', $data ?? [], null); + $this->setIfExists('default_fee', $data ?? [], null); + $this->setIfExists('minimum_fee', $data ?? [], null); + $this->setIfExists('is_hardfork_active', $data ?? [], null); + $this->setIfExists('net_time_delta_median', $data ?? [], null); + $this->setIfExists('current_network_hashrate_50', $data ?? [], null); + $this->setIfExists('current_network_hashrate_350', $data ?? [], null); + $this->setIfExists('seconds_for_10_blocks', $data ?? [], null); + $this->setIfExists('seconds_for_30_blocks', $data ?? [], null); + $this->setIfExists('transactions_cnt_per_day', $data ?? [], null); + $this->setIfExists('transactions_volume_per_day', $data ?? [], null); + $this->setIfExists('last_pos_timestamp', $data ?? [], null); + $this->setIfExists('last_pow_timestamp', $data ?? [], null); + $this->setIfExists('total_coins', $data ?? [], null); + $this->setIfExists('last_block_size', $data ?? [], null); + $this->setIfExists('tx_count_in_last_block', $data ?? [], null); + $this->setIfExists('pos_sequence_factor', $data ?? [], null); + $this->setIfExists('pow_sequence_factor', $data ?? [], null); + $this->setIfExists('block_reward', $data ?? [], null); + $this->setIfExists('last_block_total_reward', $data ?? [], null); + $this->setIfExists('pos_diff_total_coins_rate', $data ?? [], null); + $this->setIfExists('last_block_timestamp', $data ?? [], null); + $this->setIfExists('last_block_hash', $data ?? [], null); + $this->setIfExists('pos_block_ts_shift_vs_actual', $data ?? [], null); + $this->setIfExists('outs_stat', $data ?? [], null); + $this->setIfExists('performance_data', $data ?? [], null); + $this->setIfExists('offers_count', $data ?? [], null); + $this->setIfExists('expiration_median_timestamp', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, mixed $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 string[] invalid properties with reasons + */ + public function listInvalidProperties(): array + { + $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(): bool + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets height + * + * @return int|null + */ + public function getHeight(): ?int + { + return $this->container['height']; + } + + /** + * Sets height + * + * @param int|null $height height + * + * @return $this + */ + public function setHeight(?int $height): static + { + if (is_null($height)) { + throw new InvalidArgumentException('non-nullable height cannot be null'); + } + $this->container['height'] = $height; + + return $this; + } + + /** + * Gets tx_count + * + * @return int|null + */ + public function getTxCount(): ?int + { + return $this->container['tx_count']; + } + + /** + * Sets tx_count + * + * @param int|null $tx_count tx_count + * + * @return $this + */ + public function setTxCount(?int $tx_count): static + { + if (is_null($tx_count)) { + throw new InvalidArgumentException('non-nullable tx_count cannot be null'); + } + $this->container['tx_count'] = $tx_count; + + return $this; + } + + /** + * Gets tx_pool_size + * + * @return int|null + */ + public function getTxPoolSize(): ?int + { + return $this->container['tx_pool_size']; + } + + /** + * Sets tx_pool_size + * + * @param int|null $tx_pool_size tx_pool_size + * + * @return $this + */ + public function setTxPoolSize(?int $tx_pool_size): static + { + if (is_null($tx_pool_size)) { + throw new InvalidArgumentException('non-nullable tx_pool_size cannot be null'); + } + $this->container['tx_pool_size'] = $tx_pool_size; + + return $this; + } + + /** + * Gets alt_blocks_count + * + * @return int|null + */ + public function getAltBlocksCount(): ?int + { + return $this->container['alt_blocks_count']; + } + + /** + * Sets alt_blocks_count + * + * @param int|null $alt_blocks_count alt_blocks_count + * + * @return $this + */ + public function setAltBlocksCount(?int $alt_blocks_count): static + { + if (is_null($alt_blocks_count)) { + throw new InvalidArgumentException('non-nullable alt_blocks_count cannot be null'); + } + $this->container['alt_blocks_count'] = $alt_blocks_count; + + return $this; + } + + /** + * Gets outgoing_connections_count + * + * @return int|null + */ + public function getOutgoingConnectionsCount(): ?int + { + return $this->container['outgoing_connections_count']; + } + + /** + * Sets outgoing_connections_count + * + * @param int|null $outgoing_connections_count outgoing_connections_count + * + * @return $this + */ + public function setOutgoingConnectionsCount(?int $outgoing_connections_count): static + { + if (is_null($outgoing_connections_count)) { + throw new InvalidArgumentException('non-nullable outgoing_connections_count cannot be null'); + } + $this->container['outgoing_connections_count'] = $outgoing_connections_count; + + return $this; + } + + /** + * Gets incoming_connections_count + * + * @return int|null + */ + public function getIncomingConnectionsCount(): ?int + { + return $this->container['incoming_connections_count']; + } + + /** + * Sets incoming_connections_count + * + * @param int|null $incoming_connections_count incoming_connections_count + * + * @return $this + */ + public function setIncomingConnectionsCount(?int $incoming_connections_count): static + { + if (is_null($incoming_connections_count)) { + throw new InvalidArgumentException('non-nullable incoming_connections_count cannot be null'); + } + $this->container['incoming_connections_count'] = $incoming_connections_count; + + return $this; + } + + /** + * Gets synchronized_connections_count + * + * @return int|null + */ + public function getSynchronizedConnectionsCount(): ?int + { + return $this->container['synchronized_connections_count']; + } + + /** + * Sets synchronized_connections_count + * + * @param int|null $synchronized_connections_count synchronized_connections_count + * + * @return $this + */ + public function setSynchronizedConnectionsCount(?int $synchronized_connections_count): static + { + if (is_null($synchronized_connections_count)) { + throw new InvalidArgumentException('non-nullable synchronized_connections_count cannot be null'); + } + $this->container['synchronized_connections_count'] = $synchronized_connections_count; + + return $this; + } + + /** + * Gets white_peerlist_size + * + * @return int|null + */ + public function getWhitePeerlistSize(): ?int + { + return $this->container['white_peerlist_size']; + } + + /** + * Sets white_peerlist_size + * + * @param int|null $white_peerlist_size white_peerlist_size + * + * @return $this + */ + public function setWhitePeerlistSize(?int $white_peerlist_size): static + { + if (is_null($white_peerlist_size)) { + throw new InvalidArgumentException('non-nullable white_peerlist_size cannot be null'); + } + $this->container['white_peerlist_size'] = $white_peerlist_size; + + return $this; + } + + /** + * Gets grey_peerlist_size + * + * @return int|null + */ + public function getGreyPeerlistSize(): ?int + { + return $this->container['grey_peerlist_size']; + } + + /** + * Sets grey_peerlist_size + * + * @param int|null $grey_peerlist_size grey_peerlist_size + * + * @return $this + */ + public function setGreyPeerlistSize(?int $grey_peerlist_size): static + { + if (is_null($grey_peerlist_size)) { + throw new InvalidArgumentException('non-nullable grey_peerlist_size cannot be null'); + } + $this->container['grey_peerlist_size'] = $grey_peerlist_size; + + return $this; + } + + /** + * Gets current_blocks_median + * + * @return int|null + */ + public function getCurrentBlocksMedian(): ?int + { + return $this->container['current_blocks_median']; + } + + /** + * Sets current_blocks_median + * + * @param int|null $current_blocks_median current_blocks_median + * + * @return $this + */ + public function setCurrentBlocksMedian(?int $current_blocks_median): static + { + if (is_null($current_blocks_median)) { + throw new InvalidArgumentException('non-nullable current_blocks_median cannot be null'); + } + $this->container['current_blocks_median'] = $current_blocks_median; + + return $this; + } + + /** + * Gets alias_count + * + * @return int|null + */ + public function getAliasCount(): ?int + { + return $this->container['alias_count']; + } + + /** + * Sets alias_count + * + * @param int|null $alias_count alias_count + * + * @return $this + */ + public function setAliasCount(?int $alias_count): static + { + if (is_null($alias_count)) { + throw new InvalidArgumentException('non-nullable alias_count cannot be null'); + } + $this->container['alias_count'] = $alias_count; + + return $this; + } + + /** + * Gets current_max_allowed_block_size + * + * @return int|null + */ + public function getCurrentMaxAllowedBlockSize(): ?int + { + return $this->container['current_max_allowed_block_size']; + } + + /** + * Sets current_max_allowed_block_size + * + * @param int|null $current_max_allowed_block_size current_max_allowed_block_size + * + * @return $this + */ + public function setCurrentMaxAllowedBlockSize(?int $current_max_allowed_block_size): static + { + if (is_null($current_max_allowed_block_size)) { + throw new InvalidArgumentException('non-nullable current_max_allowed_block_size cannot be null'); + } + $this->container['current_max_allowed_block_size'] = $current_max_allowed_block_size; + + return $this; + } + + /** + * Gets daemon_network_state + * + * @return string|null + */ + public function getDaemonNetworkState(): ?string + { + return $this->container['daemon_network_state']; + } + + /** + * Sets daemon_network_state + * + * @param string|null $daemon_network_state daemon_network_state + * + * @return $this + */ + public function setDaemonNetworkState(?string $daemon_network_state): static + { + if (is_null($daemon_network_state)) { + throw new InvalidArgumentException('non-nullable daemon_network_state cannot be null'); + } + $this->container['daemon_network_state'] = $daemon_network_state; + + return $this; + } + + /** + * Gets synchronization_start_height + * + * @return int|null + */ + public function getSynchronizationStartHeight(): ?int + { + return $this->container['synchronization_start_height']; + } + + /** + * Sets synchronization_start_height + * + * @param int|null $synchronization_start_height synchronization_start_height + * + * @return $this + */ + public function setSynchronizationStartHeight(?int $synchronization_start_height): static + { + if (is_null($synchronization_start_height)) { + throw new InvalidArgumentException('non-nullable synchronization_start_height cannot be null'); + } + $this->container['synchronization_start_height'] = $synchronization_start_height; + + return $this; + } + + /** + * Gets max_net_seen_height + * + * @return int|null + */ + public function getMaxNetSeenHeight(): ?int + { + return $this->container['max_net_seen_height']; + } + + /** + * Sets max_net_seen_height + * + * @param int|null $max_net_seen_height max_net_seen_height + * + * @return $this + */ + public function setMaxNetSeenHeight(?int $max_net_seen_height): static + { + if (is_null($max_net_seen_height)) { + throw new InvalidArgumentException('non-nullable max_net_seen_height cannot be null'); + } + $this->container['max_net_seen_height'] = $max_net_seen_height; + + return $this; + } + + /** + * Gets mi + * + * @return \OpenAPI\Client\Model\MaintainersInfoModel|null + */ + public function getMi(): ?\OpenAPI\Client\Model\MaintainersInfoModel + { + return $this->container['mi']; + } + + /** + * Sets mi + * + * @param \OpenAPI\Client\Model\MaintainersInfoModel|null $mi mi + * + * @return $this + */ + public function setMi(?\OpenAPI\Client\Model\MaintainersInfoModel $mi): static + { + if (is_null($mi)) { + throw new InvalidArgumentException('non-nullable mi cannot be null'); + } + $this->container['mi'] = $mi; + + return $this; + } + + /** + * Gets pos_allowed + * + * @return bool|null + */ + public function getPosAllowed(): ?bool + { + return $this->container['pos_allowed']; + } + + /** + * Sets pos_allowed + * + * @param bool|null $pos_allowed pos_allowed + * + * @return $this + */ + public function setPosAllowed(?bool $pos_allowed): static + { + if (is_null($pos_allowed)) { + throw new InvalidArgumentException('non-nullable pos_allowed cannot be null'); + } + $this->container['pos_allowed'] = $pos_allowed; + + return $this; + } + + /** + * Gets pos_difficulty + * + * @return string|null + */ + public function getPosDifficulty(): ?string + { + return $this->container['pos_difficulty']; + } + + /** + * Sets pos_difficulty + * + * @param string|null $pos_difficulty pos_difficulty + * + * @return $this + */ + public function setPosDifficulty(?string $pos_difficulty): static + { + if (is_null($pos_difficulty)) { + throw new InvalidArgumentException('non-nullable pos_difficulty cannot be null'); + } + $this->container['pos_difficulty'] = $pos_difficulty; + + return $this; + } + + /** + * Gets pow_difficulty + * + * @return int|null + */ + public function getPowDifficulty(): ?int + { + return $this->container['pow_difficulty']; + } + + /** + * Sets pow_difficulty + * + * @param int|null $pow_difficulty pow_difficulty + * + * @return $this + */ + public function setPowDifficulty(?int $pow_difficulty): static + { + if (is_null($pow_difficulty)) { + throw new InvalidArgumentException('non-nullable pow_difficulty cannot be null'); + } + $this->container['pow_difficulty'] = $pow_difficulty; + + return $this; + } + + /** + * Gets default_fee + * + * @return int|null + */ + public function getDefaultFee(): ?int + { + return $this->container['default_fee']; + } + + /** + * Sets default_fee + * + * @param int|null $default_fee default_fee + * + * @return $this + */ + public function setDefaultFee(?int $default_fee): static + { + if (is_null($default_fee)) { + throw new InvalidArgumentException('non-nullable default_fee cannot be null'); + } + $this->container['default_fee'] = $default_fee; + + return $this; + } + + /** + * Gets minimum_fee + * + * @return int|null + */ + public function getMinimumFee(): ?int + { + return $this->container['minimum_fee']; + } + + /** + * Sets minimum_fee + * + * @param int|null $minimum_fee minimum_fee + * + * @return $this + */ + public function setMinimumFee(?int $minimum_fee): static + { + if (is_null($minimum_fee)) { + throw new InvalidArgumentException('non-nullable minimum_fee cannot be null'); + } + $this->container['minimum_fee'] = $minimum_fee; + + return $this; + } + + /** + * Gets is_hardfork_active + * + * @return bool[]|null + */ + public function getIsHardforkActive(): ?array + { + return $this->container['is_hardfork_active']; + } + + /** + * Sets is_hardfork_active + * + * @param bool[]|null $is_hardfork_active is_hardfork_active + * + * @return $this + */ + public function setIsHardforkActive(?array $is_hardfork_active): static + { + if (is_null($is_hardfork_active)) { + throw new InvalidArgumentException('non-nullable is_hardfork_active cannot be null'); + } + $this->container['is_hardfork_active'] = $is_hardfork_active; + + return $this; + } + + /** + * Gets net_time_delta_median + * + * @return int|null + */ + public function getNetTimeDeltaMedian(): ?int + { + return $this->container['net_time_delta_median']; + } + + /** + * Sets net_time_delta_median + * + * @param int|null $net_time_delta_median net_time_delta_median + * + * @return $this + */ + public function setNetTimeDeltaMedian(?int $net_time_delta_median): static + { + if (is_null($net_time_delta_median)) { + throw new InvalidArgumentException('non-nullable net_time_delta_median cannot be null'); + } + $this->container['net_time_delta_median'] = $net_time_delta_median; + + return $this; + } + + /** + * Gets current_network_hashrate_50 + * + * @return int|null + */ + public function getCurrentNetworkHashrate50(): ?int + { + return $this->container['current_network_hashrate_50']; + } + + /** + * Sets current_network_hashrate_50 + * + * @param int|null $current_network_hashrate_50 current_network_hashrate_50 + * + * @return $this + */ + public function setCurrentNetworkHashrate50(?int $current_network_hashrate_50): static + { + if (is_null($current_network_hashrate_50)) { + throw new InvalidArgumentException('non-nullable current_network_hashrate_50 cannot be null'); + } + $this->container['current_network_hashrate_50'] = $current_network_hashrate_50; + + return $this; + } + + /** + * Gets current_network_hashrate_350 + * + * @return int|null + */ + public function getCurrentNetworkHashrate350(): ?int + { + return $this->container['current_network_hashrate_350']; + } + + /** + * Sets current_network_hashrate_350 + * + * @param int|null $current_network_hashrate_350 current_network_hashrate_350 + * + * @return $this + */ + public function setCurrentNetworkHashrate350(?int $current_network_hashrate_350): static + { + if (is_null($current_network_hashrate_350)) { + throw new InvalidArgumentException('non-nullable current_network_hashrate_350 cannot be null'); + } + $this->container['current_network_hashrate_350'] = $current_network_hashrate_350; + + return $this; + } + + /** + * Gets seconds_for_10_blocks + * + * @return int|null + */ + public function getSecondsFor10Blocks(): ?int + { + return $this->container['seconds_for_10_blocks']; + } + + /** + * Sets seconds_for_10_blocks + * + * @param int|null $seconds_for_10_blocks seconds_for_10_blocks + * + * @return $this + */ + public function setSecondsFor10Blocks(?int $seconds_for_10_blocks): static + { + if (is_null($seconds_for_10_blocks)) { + throw new InvalidArgumentException('non-nullable seconds_for_10_blocks cannot be null'); + } + $this->container['seconds_for_10_blocks'] = $seconds_for_10_blocks; + + return $this; + } + + /** + * Gets seconds_for_30_blocks + * + * @return int|null + */ + public function getSecondsFor30Blocks(): ?int + { + return $this->container['seconds_for_30_blocks']; + } + + /** + * Sets seconds_for_30_blocks + * + * @param int|null $seconds_for_30_blocks seconds_for_30_blocks + * + * @return $this + */ + public function setSecondsFor30Blocks(?int $seconds_for_30_blocks): static + { + if (is_null($seconds_for_30_blocks)) { + throw new InvalidArgumentException('non-nullable seconds_for_30_blocks cannot be null'); + } + $this->container['seconds_for_30_blocks'] = $seconds_for_30_blocks; + + return $this; + } + + /** + * Gets transactions_cnt_per_day + * + * @return int[]|null + */ + public function getTransactionsCntPerDay(): ?array + { + return $this->container['transactions_cnt_per_day']; + } + + /** + * Sets transactions_cnt_per_day + * + * @param int[]|null $transactions_cnt_per_day transactions_cnt_per_day + * + * @return $this + */ + public function setTransactionsCntPerDay(?array $transactions_cnt_per_day): static + { + if (is_null($transactions_cnt_per_day)) { + throw new InvalidArgumentException('non-nullable transactions_cnt_per_day cannot be null'); + } + $this->container['transactions_cnt_per_day'] = $transactions_cnt_per_day; + + return $this; + } + + /** + * Gets transactions_volume_per_day + * + * @return int[]|null + */ + public function getTransactionsVolumePerDay(): ?array + { + return $this->container['transactions_volume_per_day']; + } + + /** + * Sets transactions_volume_per_day + * + * @param int[]|null $transactions_volume_per_day transactions_volume_per_day + * + * @return $this + */ + public function setTransactionsVolumePerDay(?array $transactions_volume_per_day): static + { + if (is_null($transactions_volume_per_day)) { + throw new InvalidArgumentException('non-nullable transactions_volume_per_day cannot be null'); + } + $this->container['transactions_volume_per_day'] = $transactions_volume_per_day; + + return $this; + } + + /** + * Gets last_pos_timestamp + * + * @return int|null + */ + public function getLastPosTimestamp(): ?int + { + return $this->container['last_pos_timestamp']; + } + + /** + * Sets last_pos_timestamp + * + * @param int|null $last_pos_timestamp last_pos_timestamp + * + * @return $this + */ + public function setLastPosTimestamp(?int $last_pos_timestamp): static + { + if (is_null($last_pos_timestamp)) { + throw new InvalidArgumentException('non-nullable last_pos_timestamp cannot be null'); + } + $this->container['last_pos_timestamp'] = $last_pos_timestamp; + + return $this; + } + + /** + * Gets last_pow_timestamp + * + * @return int|null + */ + public function getLastPowTimestamp(): ?int + { + return $this->container['last_pow_timestamp']; + } + + /** + * Sets last_pow_timestamp + * + * @param int|null $last_pow_timestamp last_pow_timestamp + * + * @return $this + */ + public function setLastPowTimestamp(?int $last_pow_timestamp): static + { + if (is_null($last_pow_timestamp)) { + throw new InvalidArgumentException('non-nullable last_pow_timestamp cannot be null'); + } + $this->container['last_pow_timestamp'] = $last_pow_timestamp; + + return $this; + } + + /** + * Gets total_coins + * + * @return string|null + */ + public function getTotalCoins(): ?string + { + return $this->container['total_coins']; + } + + /** + * Sets total_coins + * + * @param string|null $total_coins total_coins + * + * @return $this + */ + public function setTotalCoins(?string $total_coins): static + { + if (is_null($total_coins)) { + throw new InvalidArgumentException('non-nullable total_coins cannot be null'); + } + $this->container['total_coins'] = $total_coins; + + return $this; + } + + /** + * Gets last_block_size + * + * @return int|null + */ + public function getLastBlockSize(): ?int + { + return $this->container['last_block_size']; + } + + /** + * Sets last_block_size + * + * @param int|null $last_block_size last_block_size + * + * @return $this + */ + public function setLastBlockSize(?int $last_block_size): static + { + if (is_null($last_block_size)) { + throw new InvalidArgumentException('non-nullable last_block_size cannot be null'); + } + $this->container['last_block_size'] = $last_block_size; + + return $this; + } + + /** + * Gets tx_count_in_last_block + * + * @return int|null + */ + public function getTxCountInLastBlock(): ?int + { + return $this->container['tx_count_in_last_block']; + } + + /** + * Sets tx_count_in_last_block + * + * @param int|null $tx_count_in_last_block tx_count_in_last_block + * + * @return $this + */ + public function setTxCountInLastBlock(?int $tx_count_in_last_block): static + { + if (is_null($tx_count_in_last_block)) { + throw new InvalidArgumentException('non-nullable tx_count_in_last_block cannot be null'); + } + $this->container['tx_count_in_last_block'] = $tx_count_in_last_block; + + return $this; + } + + /** + * Gets pos_sequence_factor + * + * @return float|null + */ + public function getPosSequenceFactor(): ?float + { + return $this->container['pos_sequence_factor']; + } + + /** + * Sets pos_sequence_factor + * + * @param float|null $pos_sequence_factor pos_sequence_factor + * + * @return $this + */ + public function setPosSequenceFactor(?float $pos_sequence_factor): static + { + if (is_null($pos_sequence_factor)) { + throw new InvalidArgumentException('non-nullable pos_sequence_factor cannot be null'); + } + $this->container['pos_sequence_factor'] = $pos_sequence_factor; + + return $this; + } + + /** + * Gets pow_sequence_factor + * + * @return float|null + */ + public function getPowSequenceFactor(): ?float + { + return $this->container['pow_sequence_factor']; + } + + /** + * Sets pow_sequence_factor + * + * @param float|null $pow_sequence_factor pow_sequence_factor + * + * @return $this + */ + public function setPowSequenceFactor(?float $pow_sequence_factor): static + { + if (is_null($pow_sequence_factor)) { + throw new InvalidArgumentException('non-nullable pow_sequence_factor cannot be null'); + } + $this->container['pow_sequence_factor'] = $pow_sequence_factor; + + return $this; + } + + /** + * Gets block_reward + * + * @return int|null + */ + public function getBlockReward(): ?int + { + return $this->container['block_reward']; + } + + /** + * Sets block_reward + * + * @param int|null $block_reward block_reward + * + * @return $this + */ + public function setBlockReward(?int $block_reward): static + { + if (is_null($block_reward)) { + throw new InvalidArgumentException('non-nullable block_reward cannot be null'); + } + $this->container['block_reward'] = $block_reward; + + return $this; + } + + /** + * Gets last_block_total_reward + * + * @return int|null + */ + public function getLastBlockTotalReward(): ?int + { + return $this->container['last_block_total_reward']; + } + + /** + * Sets last_block_total_reward + * + * @param int|null $last_block_total_reward last_block_total_reward + * + * @return $this + */ + public function setLastBlockTotalReward(?int $last_block_total_reward): static + { + if (is_null($last_block_total_reward)) { + throw new InvalidArgumentException('non-nullable last_block_total_reward cannot be null'); + } + $this->container['last_block_total_reward'] = $last_block_total_reward; + + return $this; + } + + /** + * Gets pos_diff_total_coins_rate + * + * @return int|null + */ + public function getPosDiffTotalCoinsRate(): ?int + { + return $this->container['pos_diff_total_coins_rate']; + } + + /** + * Sets pos_diff_total_coins_rate + * + * @param int|null $pos_diff_total_coins_rate pos_diff_total_coins_rate + * + * @return $this + */ + public function setPosDiffTotalCoinsRate(?int $pos_diff_total_coins_rate): static + { + if (is_null($pos_diff_total_coins_rate)) { + throw new InvalidArgumentException('non-nullable pos_diff_total_coins_rate cannot be null'); + } + $this->container['pos_diff_total_coins_rate'] = $pos_diff_total_coins_rate; + + return $this; + } + + /** + * Gets last_block_timestamp + * + * @return int|null + */ + public function getLastBlockTimestamp(): ?int + { + return $this->container['last_block_timestamp']; + } + + /** + * Sets last_block_timestamp + * + * @param int|null $last_block_timestamp last_block_timestamp + * + * @return $this + */ + public function setLastBlockTimestamp(?int $last_block_timestamp): static + { + if (is_null($last_block_timestamp)) { + throw new InvalidArgumentException('non-nullable last_block_timestamp cannot be null'); + } + $this->container['last_block_timestamp'] = $last_block_timestamp; + + return $this; + } + + /** + * Gets last_block_hash + * + * @return string|null + */ + public function getLastBlockHash(): ?string + { + return $this->container['last_block_hash']; + } + + /** + * Sets last_block_hash + * + * @param string|null $last_block_hash last_block_hash + * + * @return $this + */ + public function setLastBlockHash(?string $last_block_hash): static + { + if (is_null($last_block_hash)) { + throw new InvalidArgumentException('non-nullable last_block_hash cannot be null'); + } + $this->container['last_block_hash'] = $last_block_hash; + + return $this; + } + + /** + * Gets pos_block_ts_shift_vs_actual + * + * @return int|null + */ + public function getPosBlockTsShiftVsActual(): ?int + { + return $this->container['pos_block_ts_shift_vs_actual']; + } + + /** + * Sets pos_block_ts_shift_vs_actual + * + * @param int|null $pos_block_ts_shift_vs_actual pos_block_ts_shift_vs_actual + * + * @return $this + */ + public function setPosBlockTsShiftVsActual(?int $pos_block_ts_shift_vs_actual): static + { + if (is_null($pos_block_ts_shift_vs_actual)) { + throw new InvalidArgumentException('non-nullable pos_block_ts_shift_vs_actual cannot be null'); + } + $this->container['pos_block_ts_shift_vs_actual'] = $pos_block_ts_shift_vs_actual; + + return $this; + } + + /** + * Gets outs_stat + * + * @return array|null + */ + public function getOutsStat(): ?array + { + return $this->container['outs_stat']; + } + + /** + * Sets outs_stat + * + * @param array|null $outs_stat outs_stat + * + * @return $this + */ + public function setOutsStat(?array $outs_stat): static + { + if (is_null($outs_stat)) { + throw new InvalidArgumentException('non-nullable outs_stat cannot be null'); + } + $this->container['outs_stat'] = $outs_stat; + + return $this; + } + + /** + * Gets performance_data + * + * @return \OpenAPI\Client\Model\PerformanceModel|null + */ + public function getPerformanceData(): ?\OpenAPI\Client\Model\PerformanceModel + { + return $this->container['performance_data']; + } + + /** + * Sets performance_data + * + * @param \OpenAPI\Client\Model\PerformanceModel|null $performance_data performance_data + * + * @return $this + */ + public function setPerformanceData(?\OpenAPI\Client\Model\PerformanceModel $performance_data): static + { + if (is_null($performance_data)) { + throw new InvalidArgumentException('non-nullable performance_data cannot be null'); + } + $this->container['performance_data'] = $performance_data; + + return $this; + } + + /** + * Gets offers_count + * + * @return int|null + */ + public function getOffersCount(): ?int + { + return $this->container['offers_count']; + } + + /** + * Sets offers_count + * + * @param int|null $offers_count offers_count + * + * @return $this + */ + public function setOffersCount(?int $offers_count): static + { + if (is_null($offers_count)) { + throw new InvalidArgumentException('non-nullable offers_count cannot be null'); + } + $this->container['offers_count'] = $offers_count; + + return $this; + } + + /** + * Gets expiration_median_timestamp + * + * @return int|null + */ + public function getExpirationMedianTimestamp(): ?int + { + return $this->container['expiration_median_timestamp']; + } + + /** + * Sets expiration_median_timestamp + * + * @param int|null $expiration_median_timestamp expiration_median_timestamp + * + * @return $this + */ + public function setExpirationMedianTimestamp(?int $expiration_median_timestamp): static + { + if (is_null($expiration_median_timestamp)) { + throw new InvalidArgumentException('non-nullable expiration_median_timestamp cannot be null'); + } + $this->container['expiration_median_timestamp'] = $expiration_median_timestamp; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists(mixed $offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[ReturnTypeWillChange] + public function offsetGet(mixed $offset): mixed + { + 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(mixed $offset, mixed $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(mixed $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(): mixed + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString(): string + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue(): string + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/utils/sdk/client/php/src/Model/MaintainersInfoModel.php b/utils/sdk/client/php/src/Model/MaintainersInfoModel.php new file mode 100644 index 00000000..58b33355 --- /dev/null +++ b/utils/sdk/client/php/src/Model/MaintainersInfoModel.php @@ -0,0 +1,623 @@ + + */ +class MaintainersInfoModel implements ModelInterface, ArrayAccess, JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = 'MaintainersInfoModel'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPITypes = [ + 'ver_major' => 'int', + 'ver_minor' => 'int', + 'ver_revision' => 'int', + 'build_no' => 'int', + 'mode' => 'int' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPIFormats = [ + 'ver_major' => null, + 'ver_minor' => null, + 'ver_revision' => null, + 'build_no' => null, + 'mode' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'ver_major' => false, + 'ver_minor' => false, + 'ver_revision' => false, + 'build_no' => false, + 'mode' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes(): array + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats(): array + { + 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 array + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param array $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 array + */ + protected static array $attributeMap = [ + 'ver_major' => 'ver_major', + 'ver_minor' => 'ver_minor', + 'ver_revision' => 'ver_revision', + 'build_no' => 'build_no', + 'mode' => 'mode' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var array + */ + protected static array $setters = [ + 'ver_major' => 'setVerMajor', + 'ver_minor' => 'setVerMinor', + 'ver_revision' => 'setVerRevision', + 'build_no' => 'setBuildNo', + 'mode' => 'setMode' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var array + */ + protected static array $getters = [ + 'ver_major' => 'getVerMajor', + 'ver_minor' => 'getVerMinor', + 'ver_revision' => 'getVerRevision', + 'build_no' => 'getBuildNo', + 'mode' => 'getMode' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap(): array + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters(): array + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters(): array + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName(): string + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var array + */ + protected array $container = []; + + /** + * Constructor + * + * @param array $data Associated array of property values initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('ver_major', $data ?? [], null); + $this->setIfExists('ver_minor', $data ?? [], null); + $this->setIfExists('ver_revision', $data ?? [], null); + $this->setIfExists('build_no', $data ?? [], null); + $this->setIfExists('mode', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, mixed $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 string[] invalid properties with reasons + */ + public function listInvalidProperties(): array + { + $invalidProperties = []; + + if (!is_null($this->container['ver_major']) && ($this->container['ver_major'] > 255)) { + $invalidProperties[] = "invalid value for 'ver_major', must be smaller than or equal to 255."; + } + + if (!is_null($this->container['ver_major']) && ($this->container['ver_major'] < 0)) { + $invalidProperties[] = "invalid value for 'ver_major', must be bigger than or equal to 0."; + } + + if (!is_null($this->container['ver_minor']) && ($this->container['ver_minor'] > 255)) { + $invalidProperties[] = "invalid value for 'ver_minor', must be smaller than or equal to 255."; + } + + if (!is_null($this->container['ver_minor']) && ($this->container['ver_minor'] < 0)) { + $invalidProperties[] = "invalid value for 'ver_minor', must be bigger than or equal to 0."; + } + + if (!is_null($this->container['ver_revision']) && ($this->container['ver_revision'] > 255)) { + $invalidProperties[] = "invalid value for 'ver_revision', must be smaller than or equal to 255."; + } + + if (!is_null($this->container['ver_revision']) && ($this->container['ver_revision'] < 0)) { + $invalidProperties[] = "invalid value for 'ver_revision', must be bigger than or equal to 0."; + } + + if (!is_null($this->container['build_no']) && ($this->container['build_no'] > 4294967295)) { + $invalidProperties[] = "invalid value for 'build_no', must be smaller than or equal to 4294967295."; + } + + if (!is_null($this->container['build_no']) && ($this->container['build_no'] < 0)) { + $invalidProperties[] = "invalid value for 'build_no', must be bigger than or equal to 0."; + } + + if (!is_null($this->container['mode']) && ($this->container['mode'] > 255)) { + $invalidProperties[] = "invalid value for 'mode', must be smaller than or equal to 255."; + } + + if (!is_null($this->container['mode']) && ($this->container['mode'] < 0)) { + $invalidProperties[] = "invalid value for 'mode', must be bigger than or equal to 0."; + } + + 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(): bool + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets ver_major + * + * @return int|null + */ + public function getVerMajor(): ?int + { + return $this->container['ver_major']; + } + + /** + * Sets ver_major + * + * @param int|null $ver_major ver_major + * + * @return $this + */ + public function setVerMajor(?int $ver_major): static + { + if (is_null($ver_major)) { + throw new InvalidArgumentException('non-nullable ver_major cannot be null'); + } + + if (($ver_major > 255)) { + throw new InvalidArgumentException('invalid value for $ver_major when calling MaintainersInfoModel., must be smaller than or equal to 255.'); + } + if (($ver_major < 0)) { + throw new InvalidArgumentException('invalid value for $ver_major when calling MaintainersInfoModel., must be bigger than or equal to 0.'); + } + + $this->container['ver_major'] = $ver_major; + + return $this; + } + + /** + * Gets ver_minor + * + * @return int|null + */ + public function getVerMinor(): ?int + { + return $this->container['ver_minor']; + } + + /** + * Sets ver_minor + * + * @param int|null $ver_minor ver_minor + * + * @return $this + */ + public function setVerMinor(?int $ver_minor): static + { + if (is_null($ver_minor)) { + throw new InvalidArgumentException('non-nullable ver_minor cannot be null'); + } + + if (($ver_minor > 255)) { + throw new InvalidArgumentException('invalid value for $ver_minor when calling MaintainersInfoModel., must be smaller than or equal to 255.'); + } + if (($ver_minor < 0)) { + throw new InvalidArgumentException('invalid value for $ver_minor when calling MaintainersInfoModel., must be bigger than or equal to 0.'); + } + + $this->container['ver_minor'] = $ver_minor; + + return $this; + } + + /** + * Gets ver_revision + * + * @return int|null + */ + public function getVerRevision(): ?int + { + return $this->container['ver_revision']; + } + + /** + * Sets ver_revision + * + * @param int|null $ver_revision ver_revision + * + * @return $this + */ + public function setVerRevision(?int $ver_revision): static + { + if (is_null($ver_revision)) { + throw new InvalidArgumentException('non-nullable ver_revision cannot be null'); + } + + if (($ver_revision > 255)) { + throw new InvalidArgumentException('invalid value for $ver_revision when calling MaintainersInfoModel., must be smaller than or equal to 255.'); + } + if (($ver_revision < 0)) { + throw new InvalidArgumentException('invalid value for $ver_revision when calling MaintainersInfoModel., must be bigger than or equal to 0.'); + } + + $this->container['ver_revision'] = $ver_revision; + + return $this; + } + + /** + * Gets build_no + * + * @return int|null + */ + public function getBuildNo(): ?int + { + return $this->container['build_no']; + } + + /** + * Sets build_no + * + * @param int|null $build_no build_no + * + * @return $this + */ + public function setBuildNo(?int $build_no): static + { + if (is_null($build_no)) { + throw new InvalidArgumentException('non-nullable build_no cannot be null'); + } + + if (($build_no > 4294967295)) { + throw new InvalidArgumentException('invalid value for $build_no when calling MaintainersInfoModel., must be smaller than or equal to 4294967295.'); + } + if (($build_no < 0)) { + throw new InvalidArgumentException('invalid value for $build_no when calling MaintainersInfoModel., must be bigger than or equal to 0.'); + } + + $this->container['build_no'] = $build_no; + + return $this; + } + + /** + * Gets mode + * + * @return int|null + */ + public function getMode(): ?int + { + return $this->container['mode']; + } + + /** + * Sets mode + * + * @param int|null $mode mode + * + * @return $this + */ + public function setMode(?int $mode): static + { + if (is_null($mode)) { + throw new InvalidArgumentException('non-nullable mode cannot be null'); + } + + if (($mode > 255)) { + throw new InvalidArgumentException('invalid value for $mode when calling MaintainersInfoModel., must be smaller than or equal to 255.'); + } + if (($mode < 0)) { + throw new InvalidArgumentException('invalid value for $mode when calling MaintainersInfoModel., must be bigger than or equal to 0.'); + } + + $this->container['mode'] = $mode; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists(mixed $offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[ReturnTypeWillChange] + public function offsetGet(mixed $offset): mixed + { + 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(mixed $offset, mixed $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(mixed $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(): mixed + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString(): string + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue(): string + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/utils/sdk/client/php/src/Model/ModelInterface.php b/utils/sdk/client/php/src/Model/ModelInterface.php new file mode 100644 index 00000000..98fbff21 --- /dev/null +++ b/utils/sdk/client/php/src/Model/ModelInterface.php @@ -0,0 +1,110 @@ + + */ +class PerformanceModel implements ModelInterface, ArrayAccess, JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = 'PerformanceModel'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPITypes = [ + 'block_processing' => '\OpenAPI\Client\Model\BlockProcessingPerformanceModel', + 'tx_processing' => '\OpenAPI\Client\Model\TxProcessingPerformanceModel', + 'tx_pool' => '\OpenAPI\Client\Model\TxPoolPerformanceModel', + 'db_stat_info' => '\OpenAPI\Client\Model\DbStatInfoModel' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPIFormats = [ + 'block_processing' => null, + 'tx_processing' => null, + 'tx_pool' => null, + 'db_stat_info' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'block_processing' => false, + 'tx_processing' => false, + 'tx_pool' => false, + 'db_stat_info' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes(): array + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats(): array + { + 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 array + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param array $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 array + */ + protected static array $attributeMap = [ + 'block_processing' => 'block_processing', + 'tx_processing' => 'tx_processing', + 'tx_pool' => 'tx_pool', + 'db_stat_info' => 'db_stat_info' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var array + */ + protected static array $setters = [ + 'block_processing' => 'setBlockProcessing', + 'tx_processing' => 'setTxProcessing', + 'tx_pool' => 'setTxPool', + 'db_stat_info' => 'setDbStatInfo' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var array + */ + protected static array $getters = [ + 'block_processing' => 'getBlockProcessing', + 'tx_processing' => 'getTxProcessing', + 'tx_pool' => 'getTxPool', + 'db_stat_info' => 'getDbStatInfo' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap(): array + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters(): array + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters(): array + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName(): string + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var array + */ + protected array $container = []; + + /** + * Constructor + * + * @param array $data Associated array of property values initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('block_processing', $data ?? [], null); + $this->setIfExists('tx_processing', $data ?? [], null); + $this->setIfExists('tx_pool', $data ?? [], null); + $this->setIfExists('db_stat_info', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, mixed $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 string[] invalid properties with reasons + */ + public function listInvalidProperties(): array + { + $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(): bool + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets block_processing + * + * @return \OpenAPI\Client\Model\BlockProcessingPerformanceModel|null + */ + public function getBlockProcessing(): ?\OpenAPI\Client\Model\BlockProcessingPerformanceModel + { + return $this->container['block_processing']; + } + + /** + * Sets block_processing + * + * @param \OpenAPI\Client\Model\BlockProcessingPerformanceModel|null $block_processing block_processing + * + * @return $this + */ + public function setBlockProcessing(?\OpenAPI\Client\Model\BlockProcessingPerformanceModel $block_processing): static + { + if (is_null($block_processing)) { + throw new InvalidArgumentException('non-nullable block_processing cannot be null'); + } + $this->container['block_processing'] = $block_processing; + + return $this; + } + + /** + * Gets tx_processing + * + * @return \OpenAPI\Client\Model\TxProcessingPerformanceModel|null + */ + public function getTxProcessing(): ?\OpenAPI\Client\Model\TxProcessingPerformanceModel + { + return $this->container['tx_processing']; + } + + /** + * Sets tx_processing + * + * @param \OpenAPI\Client\Model\TxProcessingPerformanceModel|null $tx_processing tx_processing + * + * @return $this + */ + public function setTxProcessing(?\OpenAPI\Client\Model\TxProcessingPerformanceModel $tx_processing): static + { + if (is_null($tx_processing)) { + throw new InvalidArgumentException('non-nullable tx_processing cannot be null'); + } + $this->container['tx_processing'] = $tx_processing; + + return $this; + } + + /** + * Gets tx_pool + * + * @return \OpenAPI\Client\Model\TxPoolPerformanceModel|null + */ + public function getTxPool(): ?\OpenAPI\Client\Model\TxPoolPerformanceModel + { + return $this->container['tx_pool']; + } + + /** + * Sets tx_pool + * + * @param \OpenAPI\Client\Model\TxPoolPerformanceModel|null $tx_pool tx_pool + * + * @return $this + */ + public function setTxPool(?\OpenAPI\Client\Model\TxPoolPerformanceModel $tx_pool): static + { + if (is_null($tx_pool)) { + throw new InvalidArgumentException('non-nullable tx_pool cannot be null'); + } + $this->container['tx_pool'] = $tx_pool; + + return $this; + } + + /** + * Gets db_stat_info + * + * @return \OpenAPI\Client\Model\DbStatInfoModel|null + */ + public function getDbStatInfo(): ?\OpenAPI\Client\Model\DbStatInfoModel + { + return $this->container['db_stat_info']; + } + + /** + * Sets db_stat_info + * + * @param \OpenAPI\Client\Model\DbStatInfoModel|null $db_stat_info db_stat_info + * + * @return $this + */ + public function setDbStatInfo(?\OpenAPI\Client\Model\DbStatInfoModel $db_stat_info): static + { + if (is_null($db_stat_info)) { + throw new InvalidArgumentException('non-nullable db_stat_info cannot be null'); + } + $this->container['db_stat_info'] = $db_stat_info; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists(mixed $offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[ReturnTypeWillChange] + public function offsetGet(mixed $offset): mixed + { + 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(mixed $offset, mixed $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(mixed $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(): mixed + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString(): string + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue(): string + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/utils/sdk/client/php/src/Model/PosEntryModel.php b/utils/sdk/client/php/src/Model/PosEntryModel.php new file mode 100644 index 00000000..f57c0901 --- /dev/null +++ b/utils/sdk/client/php/src/Model/PosEntryModel.php @@ -0,0 +1,645 @@ + + */ +class PosEntryModel implements ModelInterface, ArrayAccess, JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = 'PosEntryModel'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPITypes = [ + 'amount' => 'int', + 'g_index' => 'int', + 'keyimage' => 'string', + 'block_timestamp' => 'int', + 'stake_unlock_time' => 'int', + 'tx_id' => 'string', + 'tx_out_index' => 'int', + 'wallet_index' => 'int' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPIFormats = [ + 'amount' => null, + 'g_index' => null, + 'keyimage' => null, + 'block_timestamp' => null, + 'stake_unlock_time' => null, + 'tx_id' => null, + 'tx_out_index' => null, + 'wallet_index' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'amount' => false, + 'g_index' => false, + 'keyimage' => false, + 'block_timestamp' => false, + 'stake_unlock_time' => false, + 'tx_id' => false, + 'tx_out_index' => false, + 'wallet_index' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes(): array + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats(): array + { + 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 array + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param array $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 array + */ + protected static array $attributeMap = [ + 'amount' => 'amount', + 'g_index' => 'g_index', + 'keyimage' => 'keyimage', + 'block_timestamp' => 'block_timestamp', + 'stake_unlock_time' => 'stake_unlock_time', + 'tx_id' => 'tx_id', + 'tx_out_index' => 'tx_out_index', + 'wallet_index' => 'wallet_index' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var array + */ + protected static array $setters = [ + 'amount' => 'setAmount', + 'g_index' => 'setGIndex', + 'keyimage' => 'setKeyimage', + 'block_timestamp' => 'setBlockTimestamp', + 'stake_unlock_time' => 'setStakeUnlockTime', + 'tx_id' => 'setTxId', + 'tx_out_index' => 'setTxOutIndex', + 'wallet_index' => 'setWalletIndex' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var array + */ + protected static array $getters = [ + 'amount' => 'getAmount', + 'g_index' => 'getGIndex', + 'keyimage' => 'getKeyimage', + 'block_timestamp' => 'getBlockTimestamp', + 'stake_unlock_time' => 'getStakeUnlockTime', + 'tx_id' => 'getTxId', + 'tx_out_index' => 'getTxOutIndex', + 'wallet_index' => 'getWalletIndex' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap(): array + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters(): array + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters(): array + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName(): string + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var array + */ + protected array $container = []; + + /** + * Constructor + * + * @param array $data Associated array of property values initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('amount', $data ?? [], null); + $this->setIfExists('g_index', $data ?? [], null); + $this->setIfExists('keyimage', $data ?? [], null); + $this->setIfExists('block_timestamp', $data ?? [], null); + $this->setIfExists('stake_unlock_time', $data ?? [], null); + $this->setIfExists('tx_id', $data ?? [], null); + $this->setIfExists('tx_out_index', $data ?? [], null); + $this->setIfExists('wallet_index', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, mixed $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 string[] invalid properties with reasons + */ + public function listInvalidProperties(): array + { + $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(): bool + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets amount + * + * @return int|null + */ + public function getAmount(): ?int + { + return $this->container['amount']; + } + + /** + * Sets amount + * + * @param int|null $amount amount + * + * @return $this + */ + public function setAmount(?int $amount): static + { + if (is_null($amount)) { + throw new InvalidArgumentException('non-nullable amount cannot be null'); + } + $this->container['amount'] = $amount; + + return $this; + } + + /** + * Gets g_index + * + * @return int|null + */ + public function getGIndex(): ?int + { + return $this->container['g_index']; + } + + /** + * Sets g_index + * + * @param int|null $g_index g_index + * + * @return $this + */ + public function setGIndex(?int $g_index): static + { + if (is_null($g_index)) { + throw new InvalidArgumentException('non-nullable g_index cannot be null'); + } + $this->container['g_index'] = $g_index; + + return $this; + } + + /** + * Gets keyimage + * + * @return string|null + */ + public function getKeyimage(): ?string + { + return $this->container['keyimage']; + } + + /** + * Sets keyimage + * + * @param string|null $keyimage keyimage + * + * @return $this + */ + public function setKeyimage(?string $keyimage): static + { + if (is_null($keyimage)) { + throw new InvalidArgumentException('non-nullable keyimage cannot be null'); + } + $this->container['keyimage'] = $keyimage; + + return $this; + } + + /** + * Gets block_timestamp + * + * @return int|null + */ + public function getBlockTimestamp(): ?int + { + return $this->container['block_timestamp']; + } + + /** + * Sets block_timestamp + * + * @param int|null $block_timestamp block_timestamp + * + * @return $this + */ + public function setBlockTimestamp(?int $block_timestamp): static + { + if (is_null($block_timestamp)) { + throw new InvalidArgumentException('non-nullable block_timestamp cannot be null'); + } + $this->container['block_timestamp'] = $block_timestamp; + + return $this; + } + + /** + * Gets stake_unlock_time + * + * @return int|null + */ + public function getStakeUnlockTime(): ?int + { + return $this->container['stake_unlock_time']; + } + + /** + * Sets stake_unlock_time + * + * @param int|null $stake_unlock_time stake_unlock_time + * + * @return $this + */ + public function setStakeUnlockTime(?int $stake_unlock_time): static + { + if (is_null($stake_unlock_time)) { + throw new InvalidArgumentException('non-nullable stake_unlock_time cannot be null'); + } + $this->container['stake_unlock_time'] = $stake_unlock_time; + + return $this; + } + + /** + * Gets tx_id + * + * @return string|null + */ + public function getTxId(): ?string + { + return $this->container['tx_id']; + } + + /** + * Sets tx_id + * + * @param string|null $tx_id tx_id + * + * @return $this + */ + public function setTxId(?string $tx_id): static + { + if (is_null($tx_id)) { + throw new InvalidArgumentException('non-nullable tx_id cannot be null'); + } + $this->container['tx_id'] = $tx_id; + + return $this; + } + + /** + * Gets tx_out_index + * + * @return int|null + */ + public function getTxOutIndex(): ?int + { + return $this->container['tx_out_index']; + } + + /** + * Sets tx_out_index + * + * @param int|null $tx_out_index tx_out_index + * + * @return $this + */ + public function setTxOutIndex(?int $tx_out_index): static + { + if (is_null($tx_out_index)) { + throw new InvalidArgumentException('non-nullable tx_out_index cannot be null'); + } + $this->container['tx_out_index'] = $tx_out_index; + + return $this; + } + + /** + * Gets wallet_index + * + * @return int|null + */ + public function getWalletIndex(): ?int + { + return $this->container['wallet_index']; + } + + /** + * Sets wallet_index + * + * @param int|null $wallet_index wallet_index + * + * @return $this + */ + public function setWalletIndex(?int $wallet_index): static + { + if (is_null($wallet_index)) { + throw new InvalidArgumentException('non-nullable wallet_index cannot be null'); + } + $this->container['wallet_index'] = $wallet_index; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists(mixed $offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[ReturnTypeWillChange] + public function offsetGet(mixed $offset): mixed + { + 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(mixed $offset, mixed $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(mixed $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(): mixed + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString(): string + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue(): string + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/utils/sdk/client/php/src/Model/SubmitBlockRequestModel.php b/utils/sdk/client/php/src/Model/SubmitBlockRequestModel.php new file mode 100644 index 00000000..3668b799 --- /dev/null +++ b/utils/sdk/client/php/src/Model/SubmitBlockRequestModel.php @@ -0,0 +1,407 @@ + + */ +class SubmitBlockRequestModel implements ModelInterface, ArrayAccess, JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = 'SubmitBlockRequestModel'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPITypes = [ + 'block_blob' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPIFormats = [ + 'block_blob' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'block_blob' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes(): array + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats(): array + { + 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 array + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param array $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 array + */ + protected static array $attributeMap = [ + 'block_blob' => 'block_blob' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var array + */ + protected static array $setters = [ + 'block_blob' => 'setBlockBlob' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var array + */ + protected static array $getters = [ + 'block_blob' => 'getBlockBlob' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap(): array + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters(): array + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters(): array + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName(): string + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var array + */ + protected array $container = []; + + /** + * Constructor + * + * @param array $data Associated array of property values initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('block_blob', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, mixed $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 string[] invalid properties with reasons + */ + public function listInvalidProperties(): array + { + $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(): bool + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets block_blob + * + * @return string|null + */ + public function getBlockBlob(): ?string + { + return $this->container['block_blob']; + } + + /** + * Sets block_blob + * + * @param string|null $block_blob block_blob + * + * @return $this + */ + public function setBlockBlob(?string $block_blob): static + { + if (is_null($block_blob)) { + throw new InvalidArgumentException('non-nullable block_blob cannot be null'); + } + $this->container['block_blob'] = $block_blob; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists(mixed $offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[ReturnTypeWillChange] + public function offsetGet(mixed $offset): mixed + { + 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(mixed $offset, mixed $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(mixed $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(): mixed + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString(): string + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue(): string + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/utils/sdk/client/php/src/Model/SubmitBlockResponseModel.php b/utils/sdk/client/php/src/Model/SubmitBlockResponseModel.php new file mode 100644 index 00000000..924f47dd --- /dev/null +++ b/utils/sdk/client/php/src/Model/SubmitBlockResponseModel.php @@ -0,0 +1,407 @@ + + */ +class SubmitBlockResponseModel implements ModelInterface, ArrayAccess, JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = 'SubmitBlockResponseModel'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPITypes = [ + 'status' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPIFormats = [ + 'status' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'status' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes(): array + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats(): array + { + 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 array + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param array $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 array + */ + protected static array $attributeMap = [ + 'status' => 'status' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var array + */ + protected static array $setters = [ + 'status' => 'setStatus' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var array + */ + protected static array $getters = [ + 'status' => 'getStatus' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap(): array + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters(): array + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters(): array + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName(): string + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var array + */ + protected array $container = []; + + /** + * Constructor + * + * @param array $data Associated array of property values initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('status', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, mixed $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 string[] invalid properties with reasons + */ + public function listInvalidProperties(): array + { + $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(): bool + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets status + * + * @return string|null + */ + public function getStatus(): ?string + { + return $this->container['status']; + } + + /** + * Sets status + * + * @param string|null $status status + * + * @return $this + */ + public function setStatus(?string $status): static + { + if (is_null($status)) { + throw new InvalidArgumentException('non-nullable status cannot be null'); + } + $this->container['status'] = $status; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists(mixed $offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[ReturnTypeWillChange] + public function offsetGet(mixed $offset): mixed + { + 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(mixed $offset, mixed $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(mixed $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(): mixed + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString(): string + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue(): string + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/utils/sdk/client/php/src/Model/TransactionAttachmentModel.php b/utils/sdk/client/php/src/Model/TransactionAttachmentModel.php new file mode 100644 index 00000000..fddc59f3 --- /dev/null +++ b/utils/sdk/client/php/src/Model/TransactionAttachmentModel.php @@ -0,0 +1,475 @@ + + */ +class TransactionAttachmentModel implements ModelInterface, ArrayAccess, JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = 'TransactionAttachmentModel'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPITypes = [ + 'type' => 'string', + 'short_view' => 'string', + 'details_view' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPIFormats = [ + 'type' => null, + 'short_view' => null, + 'details_view' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'type' => false, + 'short_view' => false, + 'details_view' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes(): array + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats(): array + { + 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 array + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param array $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 array + */ + protected static array $attributeMap = [ + 'type' => 'type', + 'short_view' => 'short_view', + 'details_view' => 'details_view' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var array + */ + protected static array $setters = [ + 'type' => 'setType', + 'short_view' => 'setShortView', + 'details_view' => 'setDetailsView' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var array + */ + protected static array $getters = [ + 'type' => 'getType', + 'short_view' => 'getShortView', + 'details_view' => 'getDetailsView' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap(): array + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters(): array + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters(): array + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName(): string + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var array + */ + protected array $container = []; + + /** + * Constructor + * + * @param array $data Associated array of property values initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('type', $data ?? [], null); + $this->setIfExists('short_view', $data ?? [], null); + $this->setIfExists('details_view', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, mixed $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 string[] invalid properties with reasons + */ + public function listInvalidProperties(): array + { + $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(): bool + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets type + * + * @return string|null + */ + public function getType(): ?string + { + return $this->container['type']; + } + + /** + * Sets type + * + * @param string|null $type type + * + * @return $this + */ + public function setType(?string $type): static + { + if (is_null($type)) { + throw new InvalidArgumentException('non-nullable type cannot be null'); + } + $this->container['type'] = $type; + + return $this; + } + + /** + * Gets short_view + * + * @return string|null + */ + public function getShortView(): ?string + { + return $this->container['short_view']; + } + + /** + * Sets short_view + * + * @param string|null $short_view short_view + * + * @return $this + */ + public function setShortView(?string $short_view): static + { + if (is_null($short_view)) { + throw new InvalidArgumentException('non-nullable short_view cannot be null'); + } + $this->container['short_view'] = $short_view; + + return $this; + } + + /** + * Gets details_view + * + * @return string|null + */ + public function getDetailsView(): ?string + { + return $this->container['details_view']; + } + + /** + * Sets details_view + * + * @param string|null $details_view details_view + * + * @return $this + */ + public function setDetailsView(?string $details_view): static + { + if (is_null($details_view)) { + throw new InvalidArgumentException('non-nullable details_view cannot be null'); + } + $this->container['details_view'] = $details_view; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists(mixed $offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[ReturnTypeWillChange] + public function offsetGet(mixed $offset): mixed + { + 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(mixed $offset, mixed $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(mixed $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(): mixed + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString(): string + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue(): string + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/utils/sdk/client/php/src/Model/TransactionDetailsModel.php b/utils/sdk/client/php/src/Model/TransactionDetailsModel.php new file mode 100644 index 00000000..287fd1b8 --- /dev/null +++ b/utils/sdk/client/php/src/Model/TransactionDetailsModel.php @@ -0,0 +1,815 @@ + + */ +class TransactionDetailsModel implements ModelInterface, ArrayAccess, JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = 'TransactionDetailsModel'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPITypes = [ + 'amount' => 'int', + 'attachments' => '\OpenAPI\Client\Model\TransactionAttachmentModel[]', + 'blob' => 'string', + 'blob_size' => 'int', + 'extra' => '\OpenAPI\Client\Model\TransactionExtraModel[]', + 'fee' => 'int', + 'id' => 'string', + 'ins' => '\OpenAPI\Client\Model\TransactionInputModel[]', + 'keeper_block' => 'int', + 'object_in_json' => 'string', + 'outs' => '\OpenAPI\Client\Model\TransactionOutputModel[]', + 'pub_key' => 'string', + 'timestamp' => 'int' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPIFormats = [ + 'amount' => null, + 'attachments' => null, + 'blob' => null, + 'blob_size' => null, + 'extra' => null, + 'fee' => null, + 'id' => null, + 'ins' => null, + 'keeper_block' => 'int64', + 'object_in_json' => null, + 'outs' => null, + 'pub_key' => null, + 'timestamp' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'amount' => false, + 'attachments' => false, + 'blob' => false, + 'blob_size' => false, + 'extra' => false, + 'fee' => false, + 'id' => false, + 'ins' => false, + 'keeper_block' => false, + 'object_in_json' => false, + 'outs' => false, + 'pub_key' => false, + 'timestamp' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes(): array + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats(): array + { + 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 array + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param array $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 array + */ + protected static array $attributeMap = [ + 'amount' => 'amount', + 'attachments' => 'attachments', + 'blob' => 'blob', + 'blob_size' => 'blob_size', + 'extra' => 'extra', + 'fee' => 'fee', + 'id' => 'id', + 'ins' => 'ins', + 'keeper_block' => 'keeper_block', + 'object_in_json' => 'object_in_json', + 'outs' => 'outs', + 'pub_key' => 'pub_key', + 'timestamp' => 'timestamp' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var array + */ + protected static array $setters = [ + 'amount' => 'setAmount', + 'attachments' => 'setAttachments', + 'blob' => 'setBlob', + 'blob_size' => 'setBlobSize', + 'extra' => 'setExtra', + 'fee' => 'setFee', + 'id' => 'setId', + 'ins' => 'setIns', + 'keeper_block' => 'setKeeperBlock', + 'object_in_json' => 'setObjectInJson', + 'outs' => 'setOuts', + 'pub_key' => 'setPubKey', + 'timestamp' => 'setTimestamp' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var array + */ + protected static array $getters = [ + 'amount' => 'getAmount', + 'attachments' => 'getAttachments', + 'blob' => 'getBlob', + 'blob_size' => 'getBlobSize', + 'extra' => 'getExtra', + 'fee' => 'getFee', + 'id' => 'getId', + 'ins' => 'getIns', + 'keeper_block' => 'getKeeperBlock', + 'object_in_json' => 'getObjectInJson', + 'outs' => 'getOuts', + 'pub_key' => 'getPubKey', + 'timestamp' => 'getTimestamp' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap(): array + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters(): array + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters(): array + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName(): string + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var array + */ + protected array $container = []; + + /** + * Constructor + * + * @param array $data Associated array of property values initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('amount', $data ?? [], null); + $this->setIfExists('attachments', $data ?? [], null); + $this->setIfExists('blob', $data ?? [], null); + $this->setIfExists('blob_size', $data ?? [], null); + $this->setIfExists('extra', $data ?? [], null); + $this->setIfExists('fee', $data ?? [], null); + $this->setIfExists('id', $data ?? [], null); + $this->setIfExists('ins', $data ?? [], null); + $this->setIfExists('keeper_block', $data ?? [], null); + $this->setIfExists('object_in_json', $data ?? [], null); + $this->setIfExists('outs', $data ?? [], null); + $this->setIfExists('pub_key', $data ?? [], null); + $this->setIfExists('timestamp', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, mixed $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 string[] invalid properties with reasons + */ + public function listInvalidProperties(): array + { + $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(): bool + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets amount + * + * @return int|null + */ + public function getAmount(): ?int + { + return $this->container['amount']; + } + + /** + * Sets amount + * + * @param int|null $amount amount + * + * @return $this + */ + public function setAmount(?int $amount): static + { + if (is_null($amount)) { + throw new InvalidArgumentException('non-nullable amount cannot be null'); + } + $this->container['amount'] = $amount; + + return $this; + } + + /** + * Gets attachments + * + * @return \OpenAPI\Client\Model\TransactionAttachmentModel[]|null + */ + public function getAttachments(): ?array + { + return $this->container['attachments']; + } + + /** + * Sets attachments + * + * @param \OpenAPI\Client\Model\TransactionAttachmentModel[]|null $attachments attachments + * + * @return $this + */ + public function setAttachments(?array $attachments): static + { + if (is_null($attachments)) { + throw new InvalidArgumentException('non-nullable attachments cannot be null'); + } + $this->container['attachments'] = $attachments; + + return $this; + } + + /** + * Gets blob + * + * @return string|null + */ + public function getBlob(): ?string + { + return $this->container['blob']; + } + + /** + * Sets blob + * + * @param string|null $blob blob + * + * @return $this + */ + public function setBlob(?string $blob): static + { + if (is_null($blob)) { + throw new InvalidArgumentException('non-nullable blob cannot be null'); + } + $this->container['blob'] = $blob; + + return $this; + } + + /** + * Gets blob_size + * + * @return int|null + */ + public function getBlobSize(): ?int + { + return $this->container['blob_size']; + } + + /** + * Sets blob_size + * + * @param int|null $blob_size blob_size + * + * @return $this + */ + public function setBlobSize(?int $blob_size): static + { + if (is_null($blob_size)) { + throw new InvalidArgumentException('non-nullable blob_size cannot be null'); + } + $this->container['blob_size'] = $blob_size; + + return $this; + } + + /** + * Gets extra + * + * @return \OpenAPI\Client\Model\TransactionExtraModel[]|null + */ + public function getExtra(): ?array + { + return $this->container['extra']; + } + + /** + * Sets extra + * + * @param \OpenAPI\Client\Model\TransactionExtraModel[]|null $extra extra + * + * @return $this + */ + public function setExtra(?array $extra): static + { + if (is_null($extra)) { + throw new InvalidArgumentException('non-nullable extra cannot be null'); + } + $this->container['extra'] = $extra; + + return $this; + } + + /** + * Gets fee + * + * @return int|null + */ + public function getFee(): ?int + { + return $this->container['fee']; + } + + /** + * Sets fee + * + * @param int|null $fee fee + * + * @return $this + */ + public function setFee(?int $fee): static + { + if (is_null($fee)) { + throw new InvalidArgumentException('non-nullable fee cannot be null'); + } + $this->container['fee'] = $fee; + + return $this; + } + + /** + * Gets id + * + * @return string|null + */ + public function getId(): ?string + { + return $this->container['id']; + } + + /** + * Sets id + * + * @param string|null $id id + * + * @return $this + */ + public function setId(?string $id): static + { + if (is_null($id)) { + throw new InvalidArgumentException('non-nullable id cannot be null'); + } + $this->container['id'] = $id; + + return $this; + } + + /** + * Gets ins + * + * @return \OpenAPI\Client\Model\TransactionInputModel[]|null + */ + public function getIns(): ?array + { + return $this->container['ins']; + } + + /** + * Sets ins + * + * @param \OpenAPI\Client\Model\TransactionInputModel[]|null $ins ins + * + * @return $this + */ + public function setIns(?array $ins): static + { + if (is_null($ins)) { + throw new InvalidArgumentException('non-nullable ins cannot be null'); + } + $this->container['ins'] = $ins; + + return $this; + } + + /** + * Gets keeper_block + * + * @return int|null + */ + public function getKeeperBlock(): ?int + { + return $this->container['keeper_block']; + } + + /** + * Sets keeper_block + * + * @param int|null $keeper_block keeper_block + * + * @return $this + */ + public function setKeeperBlock(?int $keeper_block): static + { + if (is_null($keeper_block)) { + throw new InvalidArgumentException('non-nullable keeper_block cannot be null'); + } + $this->container['keeper_block'] = $keeper_block; + + return $this; + } + + /** + * Gets object_in_json + * + * @return string|null + */ + public function getObjectInJson(): ?string + { + return $this->container['object_in_json']; + } + + /** + * Sets object_in_json + * + * @param string|null $object_in_json object_in_json + * + * @return $this + */ + public function setObjectInJson(?string $object_in_json): static + { + if (is_null($object_in_json)) { + throw new InvalidArgumentException('non-nullable object_in_json cannot be null'); + } + $this->container['object_in_json'] = $object_in_json; + + return $this; + } + + /** + * Gets outs + * + * @return \OpenAPI\Client\Model\TransactionOutputModel[]|null + */ + public function getOuts(): ?array + { + return $this->container['outs']; + } + + /** + * Sets outs + * + * @param \OpenAPI\Client\Model\TransactionOutputModel[]|null $outs outs + * + * @return $this + */ + public function setOuts(?array $outs): static + { + if (is_null($outs)) { + throw new InvalidArgumentException('non-nullable outs cannot be null'); + } + $this->container['outs'] = $outs; + + return $this; + } + + /** + * Gets pub_key + * + * @return string|null + */ + public function getPubKey(): ?string + { + return $this->container['pub_key']; + } + + /** + * Sets pub_key + * + * @param string|null $pub_key pub_key + * + * @return $this + */ + public function setPubKey(?string $pub_key): static + { + if (is_null($pub_key)) { + throw new InvalidArgumentException('non-nullable pub_key cannot be null'); + } + $this->container['pub_key'] = $pub_key; + + return $this; + } + + /** + * Gets timestamp + * + * @return int|null + */ + public function getTimestamp(): ?int + { + return $this->container['timestamp']; + } + + /** + * Sets timestamp + * + * @param int|null $timestamp timestamp + * + * @return $this + */ + public function setTimestamp(?int $timestamp): static + { + if (is_null($timestamp)) { + throw new InvalidArgumentException('non-nullable timestamp cannot be null'); + } + $this->container['timestamp'] = $timestamp; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists(mixed $offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[ReturnTypeWillChange] + public function offsetGet(mixed $offset): mixed + { + 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(mixed $offset, mixed $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(mixed $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(): mixed + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString(): string + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue(): string + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/utils/sdk/client/php/src/Model/TransactionExtraModel.php b/utils/sdk/client/php/src/Model/TransactionExtraModel.php new file mode 100644 index 00000000..f2bee516 --- /dev/null +++ b/utils/sdk/client/php/src/Model/TransactionExtraModel.php @@ -0,0 +1,475 @@ + + */ +class TransactionExtraModel implements ModelInterface, ArrayAccess, JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = 'TransactionExtraModel'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPITypes = [ + 'type' => 'string', + 'short_view' => 'string', + 'details_view' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPIFormats = [ + 'type' => null, + 'short_view' => null, + 'details_view' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'type' => false, + 'short_view' => false, + 'details_view' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes(): array + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats(): array + { + 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 array + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param array $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 array + */ + protected static array $attributeMap = [ + 'type' => 'type', + 'short_view' => 'short_view', + 'details_view' => 'details_view' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var array + */ + protected static array $setters = [ + 'type' => 'setType', + 'short_view' => 'setShortView', + 'details_view' => 'setDetailsView' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var array + */ + protected static array $getters = [ + 'type' => 'getType', + 'short_view' => 'getShortView', + 'details_view' => 'getDetailsView' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap(): array + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters(): array + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters(): array + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName(): string + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var array + */ + protected array $container = []; + + /** + * Constructor + * + * @param array $data Associated array of property values initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('type', $data ?? [], null); + $this->setIfExists('short_view', $data ?? [], null); + $this->setIfExists('details_view', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, mixed $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 string[] invalid properties with reasons + */ + public function listInvalidProperties(): array + { + $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(): bool + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets type + * + * @return string|null + */ + public function getType(): ?string + { + return $this->container['type']; + } + + /** + * Sets type + * + * @param string|null $type type + * + * @return $this + */ + public function setType(?string $type): static + { + if (is_null($type)) { + throw new InvalidArgumentException('non-nullable type cannot be null'); + } + $this->container['type'] = $type; + + return $this; + } + + /** + * Gets short_view + * + * @return string|null + */ + public function getShortView(): ?string + { + return $this->container['short_view']; + } + + /** + * Sets short_view + * + * @param string|null $short_view short_view + * + * @return $this + */ + public function setShortView(?string $short_view): static + { + if (is_null($short_view)) { + throw new InvalidArgumentException('non-nullable short_view cannot be null'); + } + $this->container['short_view'] = $short_view; + + return $this; + } + + /** + * Gets details_view + * + * @return string|null + */ + public function getDetailsView(): ?string + { + return $this->container['details_view']; + } + + /** + * Sets details_view + * + * @param string|null $details_view details_view + * + * @return $this + */ + public function setDetailsView(?string $details_view): static + { + if (is_null($details_view)) { + throw new InvalidArgumentException('non-nullable details_view cannot be null'); + } + $this->container['details_view'] = $details_view; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists(mixed $offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[ReturnTypeWillChange] + public function offsetGet(mixed $offset): mixed + { + 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(mixed $offset, mixed $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(mixed $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(): mixed + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString(): string + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue(): string + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/utils/sdk/client/php/src/Model/TransactionInputModel.php b/utils/sdk/client/php/src/Model/TransactionInputModel.php new file mode 100644 index 00000000..ed15dcd6 --- /dev/null +++ b/utils/sdk/client/php/src/Model/TransactionInputModel.php @@ -0,0 +1,559 @@ + + */ +class TransactionInputModel implements ModelInterface, ArrayAccess, JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = 'TransactionInputModel'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPITypes = [ + 'amount' => 'int', + 'global_indexes' => 'int[]', + 'htlc_origin' => 'string', + 'kimage_or_ms_id' => 'string', + 'multisig_count' => 'int' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPIFormats = [ + 'amount' => null, + 'global_indexes' => null, + 'htlc_origin' => null, + 'kimage_or_ms_id' => null, + 'multisig_count' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'amount' => false, + 'global_indexes' => false, + 'htlc_origin' => false, + 'kimage_or_ms_id' => false, + 'multisig_count' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes(): array + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats(): array + { + 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 array + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param array $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 array + */ + protected static array $attributeMap = [ + 'amount' => 'amount', + 'global_indexes' => 'global_indexes', + 'htlc_origin' => 'htlc_origin', + 'kimage_or_ms_id' => 'kimage_or_ms_id', + 'multisig_count' => 'multisig_count' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var array + */ + protected static array $setters = [ + 'amount' => 'setAmount', + 'global_indexes' => 'setGlobalIndexes', + 'htlc_origin' => 'setHtlcOrigin', + 'kimage_or_ms_id' => 'setKimageOrMsId', + 'multisig_count' => 'setMultisigCount' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var array + */ + protected static array $getters = [ + 'amount' => 'getAmount', + 'global_indexes' => 'getGlobalIndexes', + 'htlc_origin' => 'getHtlcOrigin', + 'kimage_or_ms_id' => 'getKimageOrMsId', + 'multisig_count' => 'getMultisigCount' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap(): array + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters(): array + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters(): array + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName(): string + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var array + */ + protected array $container = []; + + /** + * Constructor + * + * @param array $data Associated array of property values initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('amount', $data ?? [], null); + $this->setIfExists('global_indexes', $data ?? [], null); + $this->setIfExists('htlc_origin', $data ?? [], null); + $this->setIfExists('kimage_or_ms_id', $data ?? [], null); + $this->setIfExists('multisig_count', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, mixed $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 string[] invalid properties with reasons + */ + public function listInvalidProperties(): array + { + $invalidProperties = []; + + if (!is_null($this->container['multisig_count']) && ($this->container['multisig_count'] > 4294967295)) { + $invalidProperties[] = "invalid value for 'multisig_count', must be smaller than or equal to 4294967295."; + } + + if (!is_null($this->container['multisig_count']) && ($this->container['multisig_count'] < 0)) { + $invalidProperties[] = "invalid value for 'multisig_count', must be bigger than or equal to 0."; + } + + 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(): bool + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets amount + * + * @return int|null + */ + public function getAmount(): ?int + { + return $this->container['amount']; + } + + /** + * Sets amount + * + * @param int|null $amount amount + * + * @return $this + */ + public function setAmount(?int $amount): static + { + if (is_null($amount)) { + throw new InvalidArgumentException('non-nullable amount cannot be null'); + } + $this->container['amount'] = $amount; + + return $this; + } + + /** + * Gets global_indexes + * + * @return int[]|null + */ + public function getGlobalIndexes(): ?array + { + return $this->container['global_indexes']; + } + + /** + * Sets global_indexes + * + * @param int[]|null $global_indexes global_indexes + * + * @return $this + */ + public function setGlobalIndexes(?array $global_indexes): static + { + if (is_null($global_indexes)) { + throw new InvalidArgumentException('non-nullable global_indexes cannot be null'); + } + $this->container['global_indexes'] = $global_indexes; + + return $this; + } + + /** + * Gets htlc_origin + * + * @return string|null + */ + public function getHtlcOrigin(): ?string + { + return $this->container['htlc_origin']; + } + + /** + * Sets htlc_origin + * + * @param string|null $htlc_origin htlc_origin + * + * @return $this + */ + public function setHtlcOrigin(?string $htlc_origin): static + { + if (is_null($htlc_origin)) { + throw new InvalidArgumentException('non-nullable htlc_origin cannot be null'); + } + $this->container['htlc_origin'] = $htlc_origin; + + return $this; + } + + /** + * Gets kimage_or_ms_id + * + * @return string|null + */ + public function getKimageOrMsId(): ?string + { + return $this->container['kimage_or_ms_id']; + } + + /** + * Sets kimage_or_ms_id + * + * @param string|null $kimage_or_ms_id kimage_or_ms_id + * + * @return $this + */ + public function setKimageOrMsId(?string $kimage_or_ms_id): static + { + if (is_null($kimage_or_ms_id)) { + throw new InvalidArgumentException('non-nullable kimage_or_ms_id cannot be null'); + } + $this->container['kimage_or_ms_id'] = $kimage_or_ms_id; + + return $this; + } + + /** + * Gets multisig_count + * + * @return int|null + */ + public function getMultisigCount(): ?int + { + return $this->container['multisig_count']; + } + + /** + * Sets multisig_count + * + * @param int|null $multisig_count multisig_count + * + * @return $this + */ + public function setMultisigCount(?int $multisig_count): static + { + if (is_null($multisig_count)) { + throw new InvalidArgumentException('non-nullable multisig_count cannot be null'); + } + + if (($multisig_count > 4294967295)) { + throw new InvalidArgumentException('invalid value for $multisig_count when calling TransactionInputModel., must be smaller than or equal to 4294967295.'); + } + if (($multisig_count < 0)) { + throw new InvalidArgumentException('invalid value for $multisig_count when calling TransactionInputModel., must be bigger than or equal to 0.'); + } + + $this->container['multisig_count'] = $multisig_count; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists(mixed $offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[ReturnTypeWillChange] + public function offsetGet(mixed $offset): mixed + { + 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(mixed $offset, mixed $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(mixed $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(): mixed + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString(): string + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue(): string + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/utils/sdk/client/php/src/Model/TransactionOutputModel.php b/utils/sdk/client/php/src/Model/TransactionOutputModel.php new file mode 100644 index 00000000..792a9ccb --- /dev/null +++ b/utils/sdk/client/php/src/Model/TransactionOutputModel.php @@ -0,0 +1,559 @@ + + */ +class TransactionOutputModel implements ModelInterface, ArrayAccess, JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = 'TransactionOutputModel'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPITypes = [ + 'amount' => 'int', + 'global_index' => 'int', + 'is_spent' => 'bool', + 'minimum_sigs' => 'int', + 'pub_keys' => 'string[]' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPIFormats = [ + 'amount' => null, + 'global_index' => null, + 'is_spent' => null, + 'minimum_sigs' => null, + 'pub_keys' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'amount' => false, + 'global_index' => false, + 'is_spent' => false, + 'minimum_sigs' => false, + 'pub_keys' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes(): array + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats(): array + { + 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 array + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param array $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 array + */ + protected static array $attributeMap = [ + 'amount' => 'amount', + 'global_index' => 'global_index', + 'is_spent' => 'is_spent', + 'minimum_sigs' => 'minimum_sigs', + 'pub_keys' => 'pub_keys' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var array + */ + protected static array $setters = [ + 'amount' => 'setAmount', + 'global_index' => 'setGlobalIndex', + 'is_spent' => 'setIsSpent', + 'minimum_sigs' => 'setMinimumSigs', + 'pub_keys' => 'setPubKeys' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var array + */ + protected static array $getters = [ + 'amount' => 'getAmount', + 'global_index' => 'getGlobalIndex', + 'is_spent' => 'getIsSpent', + 'minimum_sigs' => 'getMinimumSigs', + 'pub_keys' => 'getPubKeys' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap(): array + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters(): array + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters(): array + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName(): string + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var array + */ + protected array $container = []; + + /** + * Constructor + * + * @param array $data Associated array of property values initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('amount', $data ?? [], null); + $this->setIfExists('global_index', $data ?? [], null); + $this->setIfExists('is_spent', $data ?? [], null); + $this->setIfExists('minimum_sigs', $data ?? [], null); + $this->setIfExists('pub_keys', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, mixed $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 string[] invalid properties with reasons + */ + public function listInvalidProperties(): array + { + $invalidProperties = []; + + if (!is_null($this->container['minimum_sigs']) && ($this->container['minimum_sigs'] > 4294967295)) { + $invalidProperties[] = "invalid value for 'minimum_sigs', must be smaller than or equal to 4294967295."; + } + + if (!is_null($this->container['minimum_sigs']) && ($this->container['minimum_sigs'] < 0)) { + $invalidProperties[] = "invalid value for 'minimum_sigs', must be bigger than or equal to 0."; + } + + 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(): bool + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets amount + * + * @return int|null + */ + public function getAmount(): ?int + { + return $this->container['amount']; + } + + /** + * Sets amount + * + * @param int|null $amount amount + * + * @return $this + */ + public function setAmount(?int $amount): static + { + if (is_null($amount)) { + throw new InvalidArgumentException('non-nullable amount cannot be null'); + } + $this->container['amount'] = $amount; + + return $this; + } + + /** + * Gets global_index + * + * @return int|null + */ + public function getGlobalIndex(): ?int + { + return $this->container['global_index']; + } + + /** + * Sets global_index + * + * @param int|null $global_index global_index + * + * @return $this + */ + public function setGlobalIndex(?int $global_index): static + { + if (is_null($global_index)) { + throw new InvalidArgumentException('non-nullable global_index cannot be null'); + } + $this->container['global_index'] = $global_index; + + return $this; + } + + /** + * Gets is_spent + * + * @return bool|null + */ + public function getIsSpent(): ?bool + { + return $this->container['is_spent']; + } + + /** + * Sets is_spent + * + * @param bool|null $is_spent is_spent + * + * @return $this + */ + public function setIsSpent(?bool $is_spent): static + { + if (is_null($is_spent)) { + throw new InvalidArgumentException('non-nullable is_spent cannot be null'); + } + $this->container['is_spent'] = $is_spent; + + return $this; + } + + /** + * Gets minimum_sigs + * + * @return int|null + */ + public function getMinimumSigs(): ?int + { + return $this->container['minimum_sigs']; + } + + /** + * Sets minimum_sigs + * + * @param int|null $minimum_sigs minimum_sigs + * + * @return $this + */ + public function setMinimumSigs(?int $minimum_sigs): static + { + if (is_null($minimum_sigs)) { + throw new InvalidArgumentException('non-nullable minimum_sigs cannot be null'); + } + + if (($minimum_sigs > 4294967295)) { + throw new InvalidArgumentException('invalid value for $minimum_sigs when calling TransactionOutputModel., must be smaller than or equal to 4294967295.'); + } + if (($minimum_sigs < 0)) { + throw new InvalidArgumentException('invalid value for $minimum_sigs when calling TransactionOutputModel., must be bigger than or equal to 0.'); + } + + $this->container['minimum_sigs'] = $minimum_sigs; + + return $this; + } + + /** + * Gets pub_keys + * + * @return string[]|null + */ + public function getPubKeys(): ?array + { + return $this->container['pub_keys']; + } + + /** + * Sets pub_keys + * + * @param string[]|null $pub_keys pub_keys + * + * @return $this + */ + public function setPubKeys(?array $pub_keys): static + { + if (is_null($pub_keys)) { + throw new InvalidArgumentException('non-nullable pub_keys cannot be null'); + } + $this->container['pub_keys'] = $pub_keys; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists(mixed $offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[ReturnTypeWillChange] + public function offsetGet(mixed $offset): mixed + { + 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(mixed $offset, mixed $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(mixed $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(): mixed + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString(): string + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue(): string + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/utils/sdk/client/php/src/Model/TxGenerationContextModel.php b/utils/sdk/client/php/src/Model/TxGenerationContextModel.php new file mode 100644 index 00000000..18bee7f5 --- /dev/null +++ b/utils/sdk/client/php/src/Model/TxGenerationContextModel.php @@ -0,0 +1,1189 @@ + + */ +class TxGenerationContextModel implements ModelInterface, ArrayAccess, JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = 'TxGenerationContextModel'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPITypes = [ + 'asset_ids' => 'string[]', + 'blinded_asset_ids' => 'string[]', + 'amount_commitments' => 'string[]', + 'asset_id_blinding_masks' => 'string[]', + 'amounts' => 'string[]', + 'amount_blinding_masks' => 'string[]', + 'pseudo_outs_blinded_asset_ids' => 'string[]', + 'pseudo_outs_plus_real_out_blinding_masks' => 'string[]', + 'real_zc_ins_asset_ids' => 'string[]', + 'zc_input_amounts' => 'int[]', + 'pseudo_out_amount_commitments_sum' => 'string', + 'pseudo_out_amount_blinding_masks_sum' => 'string', + 'real_in_asset_id_blinding_mask_x_amount_sum' => 'string', + 'amount_commitments_sum' => 'string', + 'amount_blinding_masks_sum' => 'string', + 'asset_id_blinding_mask_x_amount_sum' => 'string', + 'ao_asset_id' => 'string', + 'ao_asset_id_pt' => 'string', + 'ao_amount_commitment' => 'string', + 'ao_amount_blinding_mask' => 'string', + 'ao_commitment_in_outputs' => 'bool', + 'tx_key_pub' => 'string', + 'tx_key_sec' => 'string', + 'tx_pub_key_p' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPIFormats = [ + 'asset_ids' => null, + 'blinded_asset_ids' => null, + 'amount_commitments' => null, + 'asset_id_blinding_masks' => null, + 'amounts' => null, + 'amount_blinding_masks' => null, + 'pseudo_outs_blinded_asset_ids' => null, + 'pseudo_outs_plus_real_out_blinding_masks' => null, + 'real_zc_ins_asset_ids' => null, + 'zc_input_amounts' => null, + 'pseudo_out_amount_commitments_sum' => null, + 'pseudo_out_amount_blinding_masks_sum' => null, + 'real_in_asset_id_blinding_mask_x_amount_sum' => null, + 'amount_commitments_sum' => null, + 'amount_blinding_masks_sum' => null, + 'asset_id_blinding_mask_x_amount_sum' => null, + 'ao_asset_id' => null, + 'ao_asset_id_pt' => null, + 'ao_amount_commitment' => null, + 'ao_amount_blinding_mask' => null, + 'ao_commitment_in_outputs' => null, + 'tx_key_pub' => null, + 'tx_key_sec' => null, + 'tx_pub_key_p' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'asset_ids' => false, + 'blinded_asset_ids' => false, + 'amount_commitments' => false, + 'asset_id_blinding_masks' => false, + 'amounts' => false, + 'amount_blinding_masks' => false, + 'pseudo_outs_blinded_asset_ids' => false, + 'pseudo_outs_plus_real_out_blinding_masks' => false, + 'real_zc_ins_asset_ids' => false, + 'zc_input_amounts' => false, + 'pseudo_out_amount_commitments_sum' => false, + 'pseudo_out_amount_blinding_masks_sum' => false, + 'real_in_asset_id_blinding_mask_x_amount_sum' => false, + 'amount_commitments_sum' => false, + 'amount_blinding_masks_sum' => false, + 'asset_id_blinding_mask_x_amount_sum' => false, + 'ao_asset_id' => false, + 'ao_asset_id_pt' => false, + 'ao_amount_commitment' => false, + 'ao_amount_blinding_mask' => false, + 'ao_commitment_in_outputs' => false, + 'tx_key_pub' => false, + 'tx_key_sec' => false, + 'tx_pub_key_p' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes(): array + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats(): array + { + 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 array + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param array $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 array + */ + protected static array $attributeMap = [ + 'asset_ids' => 'asset_ids', + 'blinded_asset_ids' => 'blinded_asset_ids', + 'amount_commitments' => 'amount_commitments', + 'asset_id_blinding_masks' => 'asset_id_blinding_masks', + 'amounts' => 'amounts', + 'amount_blinding_masks' => 'amount_blinding_masks', + 'pseudo_outs_blinded_asset_ids' => 'pseudo_outs_blinded_asset_ids', + 'pseudo_outs_plus_real_out_blinding_masks' => 'pseudo_outs_plus_real_out_blinding_masks', + 'real_zc_ins_asset_ids' => 'real_zc_ins_asset_ids', + 'zc_input_amounts' => 'zc_input_amounts', + 'pseudo_out_amount_commitments_sum' => 'pseudo_out_amount_commitments_sum', + 'pseudo_out_amount_blinding_masks_sum' => 'pseudo_out_amount_blinding_masks_sum', + 'real_in_asset_id_blinding_mask_x_amount_sum' => 'real_in_asset_id_blinding_mask_x_amount_sum', + 'amount_commitments_sum' => 'amount_commitments_sum', + 'amount_blinding_masks_sum' => 'amount_blinding_masks_sum', + 'asset_id_blinding_mask_x_amount_sum' => 'asset_id_blinding_mask_x_amount_sum', + 'ao_asset_id' => 'ao_asset_id', + 'ao_asset_id_pt' => 'ao_asset_id_pt', + 'ao_amount_commitment' => 'ao_amount_commitment', + 'ao_amount_blinding_mask' => 'ao_amount_blinding_mask', + 'ao_commitment_in_outputs' => 'ao_commitment_in_outputs', + 'tx_key_pub' => 'tx_key_pub', + 'tx_key_sec' => 'tx_key_sec', + 'tx_pub_key_p' => 'tx_pub_key_p' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var array + */ + protected static array $setters = [ + 'asset_ids' => 'setAssetIds', + 'blinded_asset_ids' => 'setBlindedAssetIds', + 'amount_commitments' => 'setAmountCommitments', + 'asset_id_blinding_masks' => 'setAssetIdBlindingMasks', + 'amounts' => 'setAmounts', + 'amount_blinding_masks' => 'setAmountBlindingMasks', + 'pseudo_outs_blinded_asset_ids' => 'setPseudoOutsBlindedAssetIds', + 'pseudo_outs_plus_real_out_blinding_masks' => 'setPseudoOutsPlusRealOutBlindingMasks', + 'real_zc_ins_asset_ids' => 'setRealZcInsAssetIds', + 'zc_input_amounts' => 'setZcInputAmounts', + 'pseudo_out_amount_commitments_sum' => 'setPseudoOutAmountCommitmentsSum', + 'pseudo_out_amount_blinding_masks_sum' => 'setPseudoOutAmountBlindingMasksSum', + 'real_in_asset_id_blinding_mask_x_amount_sum' => 'setRealInAssetIdBlindingMaskXAmountSum', + 'amount_commitments_sum' => 'setAmountCommitmentsSum', + 'amount_blinding_masks_sum' => 'setAmountBlindingMasksSum', + 'asset_id_blinding_mask_x_amount_sum' => 'setAssetIdBlindingMaskXAmountSum', + 'ao_asset_id' => 'setAoAssetId', + 'ao_asset_id_pt' => 'setAoAssetIdPt', + 'ao_amount_commitment' => 'setAoAmountCommitment', + 'ao_amount_blinding_mask' => 'setAoAmountBlindingMask', + 'ao_commitment_in_outputs' => 'setAoCommitmentInOutputs', + 'tx_key_pub' => 'setTxKeyPub', + 'tx_key_sec' => 'setTxKeySec', + 'tx_pub_key_p' => 'setTxPubKeyP' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var array + */ + protected static array $getters = [ + 'asset_ids' => 'getAssetIds', + 'blinded_asset_ids' => 'getBlindedAssetIds', + 'amount_commitments' => 'getAmountCommitments', + 'asset_id_blinding_masks' => 'getAssetIdBlindingMasks', + 'amounts' => 'getAmounts', + 'amount_blinding_masks' => 'getAmountBlindingMasks', + 'pseudo_outs_blinded_asset_ids' => 'getPseudoOutsBlindedAssetIds', + 'pseudo_outs_plus_real_out_blinding_masks' => 'getPseudoOutsPlusRealOutBlindingMasks', + 'real_zc_ins_asset_ids' => 'getRealZcInsAssetIds', + 'zc_input_amounts' => 'getZcInputAmounts', + 'pseudo_out_amount_commitments_sum' => 'getPseudoOutAmountCommitmentsSum', + 'pseudo_out_amount_blinding_masks_sum' => 'getPseudoOutAmountBlindingMasksSum', + 'real_in_asset_id_blinding_mask_x_amount_sum' => 'getRealInAssetIdBlindingMaskXAmountSum', + 'amount_commitments_sum' => 'getAmountCommitmentsSum', + 'amount_blinding_masks_sum' => 'getAmountBlindingMasksSum', + 'asset_id_blinding_mask_x_amount_sum' => 'getAssetIdBlindingMaskXAmountSum', + 'ao_asset_id' => 'getAoAssetId', + 'ao_asset_id_pt' => 'getAoAssetIdPt', + 'ao_amount_commitment' => 'getAoAmountCommitment', + 'ao_amount_blinding_mask' => 'getAoAmountBlindingMask', + 'ao_commitment_in_outputs' => 'getAoCommitmentInOutputs', + 'tx_key_pub' => 'getTxKeyPub', + 'tx_key_sec' => 'getTxKeySec', + 'tx_pub_key_p' => 'getTxPubKeyP' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap(): array + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters(): array + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters(): array + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName(): string + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var array + */ + protected array $container = []; + + /** + * Constructor + * + * @param array $data Associated array of property values initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('asset_ids', $data ?? [], null); + $this->setIfExists('blinded_asset_ids', $data ?? [], null); + $this->setIfExists('amount_commitments', $data ?? [], null); + $this->setIfExists('asset_id_blinding_masks', $data ?? [], null); + $this->setIfExists('amounts', $data ?? [], null); + $this->setIfExists('amount_blinding_masks', $data ?? [], null); + $this->setIfExists('pseudo_outs_blinded_asset_ids', $data ?? [], null); + $this->setIfExists('pseudo_outs_plus_real_out_blinding_masks', $data ?? [], null); + $this->setIfExists('real_zc_ins_asset_ids', $data ?? [], null); + $this->setIfExists('zc_input_amounts', $data ?? [], null); + $this->setIfExists('pseudo_out_amount_commitments_sum', $data ?? [], null); + $this->setIfExists('pseudo_out_amount_blinding_masks_sum', $data ?? [], null); + $this->setIfExists('real_in_asset_id_blinding_mask_x_amount_sum', $data ?? [], null); + $this->setIfExists('amount_commitments_sum', $data ?? [], null); + $this->setIfExists('amount_blinding_masks_sum', $data ?? [], null); + $this->setIfExists('asset_id_blinding_mask_x_amount_sum', $data ?? [], null); + $this->setIfExists('ao_asset_id', $data ?? [], null); + $this->setIfExists('ao_asset_id_pt', $data ?? [], null); + $this->setIfExists('ao_amount_commitment', $data ?? [], null); + $this->setIfExists('ao_amount_blinding_mask', $data ?? [], null); + $this->setIfExists('ao_commitment_in_outputs', $data ?? [], null); + $this->setIfExists('tx_key_pub', $data ?? [], null); + $this->setIfExists('tx_key_sec', $data ?? [], null); + $this->setIfExists('tx_pub_key_p', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, mixed $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 string[] invalid properties with reasons + */ + public function listInvalidProperties(): array + { + $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(): bool + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets asset_ids + * + * @return string[]|null + */ + public function getAssetIds(): ?array + { + return $this->container['asset_ids']; + } + + /** + * Sets asset_ids + * + * @param string[]|null $asset_ids asset_ids + * + * @return $this + */ + public function setAssetIds(?array $asset_ids): static + { + if (is_null($asset_ids)) { + throw new InvalidArgumentException('non-nullable asset_ids cannot be null'); + } + $this->container['asset_ids'] = $asset_ids; + + return $this; + } + + /** + * Gets blinded_asset_ids + * + * @return string[]|null + */ + public function getBlindedAssetIds(): ?array + { + return $this->container['blinded_asset_ids']; + } + + /** + * Sets blinded_asset_ids + * + * @param string[]|null $blinded_asset_ids blinded_asset_ids + * + * @return $this + */ + public function setBlindedAssetIds(?array $blinded_asset_ids): static + { + if (is_null($blinded_asset_ids)) { + throw new InvalidArgumentException('non-nullable blinded_asset_ids cannot be null'); + } + $this->container['blinded_asset_ids'] = $blinded_asset_ids; + + return $this; + } + + /** + * Gets amount_commitments + * + * @return string[]|null + */ + public function getAmountCommitments(): ?array + { + return $this->container['amount_commitments']; + } + + /** + * Sets amount_commitments + * + * @param string[]|null $amount_commitments amount_commitments + * + * @return $this + */ + public function setAmountCommitments(?array $amount_commitments): static + { + if (is_null($amount_commitments)) { + throw new InvalidArgumentException('non-nullable amount_commitments cannot be null'); + } + $this->container['amount_commitments'] = $amount_commitments; + + return $this; + } + + /** + * Gets asset_id_blinding_masks + * + * @return string[]|null + */ + public function getAssetIdBlindingMasks(): ?array + { + return $this->container['asset_id_blinding_masks']; + } + + /** + * Sets asset_id_blinding_masks + * + * @param string[]|null $asset_id_blinding_masks asset_id_blinding_masks + * + * @return $this + */ + public function setAssetIdBlindingMasks(?array $asset_id_blinding_masks): static + { + if (is_null($asset_id_blinding_masks)) { + throw new InvalidArgumentException('non-nullable asset_id_blinding_masks cannot be null'); + } + $this->container['asset_id_blinding_masks'] = $asset_id_blinding_masks; + + return $this; + } + + /** + * Gets amounts + * + * @return string[]|null + */ + public function getAmounts(): ?array + { + return $this->container['amounts']; + } + + /** + * Sets amounts + * + * @param string[]|null $amounts amounts + * + * @return $this + */ + public function setAmounts(?array $amounts): static + { + if (is_null($amounts)) { + throw new InvalidArgumentException('non-nullable amounts cannot be null'); + } + $this->container['amounts'] = $amounts; + + return $this; + } + + /** + * Gets amount_blinding_masks + * + * @return string[]|null + */ + public function getAmountBlindingMasks(): ?array + { + return $this->container['amount_blinding_masks']; + } + + /** + * Sets amount_blinding_masks + * + * @param string[]|null $amount_blinding_masks amount_blinding_masks + * + * @return $this + */ + public function setAmountBlindingMasks(?array $amount_blinding_masks): static + { + if (is_null($amount_blinding_masks)) { + throw new InvalidArgumentException('non-nullable amount_blinding_masks cannot be null'); + } + $this->container['amount_blinding_masks'] = $amount_blinding_masks; + + return $this; + } + + /** + * Gets pseudo_outs_blinded_asset_ids + * + * @return string[]|null + */ + public function getPseudoOutsBlindedAssetIds(): ?array + { + return $this->container['pseudo_outs_blinded_asset_ids']; + } + + /** + * Sets pseudo_outs_blinded_asset_ids + * + * @param string[]|null $pseudo_outs_blinded_asset_ids pseudo_outs_blinded_asset_ids + * + * @return $this + */ + public function setPseudoOutsBlindedAssetIds(?array $pseudo_outs_blinded_asset_ids): static + { + if (is_null($pseudo_outs_blinded_asset_ids)) { + throw new InvalidArgumentException('non-nullable pseudo_outs_blinded_asset_ids cannot be null'); + } + $this->container['pseudo_outs_blinded_asset_ids'] = $pseudo_outs_blinded_asset_ids; + + return $this; + } + + /** + * Gets pseudo_outs_plus_real_out_blinding_masks + * + * @return string[]|null + */ + public function getPseudoOutsPlusRealOutBlindingMasks(): ?array + { + return $this->container['pseudo_outs_plus_real_out_blinding_masks']; + } + + /** + * Sets pseudo_outs_plus_real_out_blinding_masks + * + * @param string[]|null $pseudo_outs_plus_real_out_blinding_masks pseudo_outs_plus_real_out_blinding_masks + * + * @return $this + */ + public function setPseudoOutsPlusRealOutBlindingMasks(?array $pseudo_outs_plus_real_out_blinding_masks): static + { + if (is_null($pseudo_outs_plus_real_out_blinding_masks)) { + throw new InvalidArgumentException('non-nullable pseudo_outs_plus_real_out_blinding_masks cannot be null'); + } + $this->container['pseudo_outs_plus_real_out_blinding_masks'] = $pseudo_outs_plus_real_out_blinding_masks; + + return $this; + } + + /** + * Gets real_zc_ins_asset_ids + * + * @return string[]|null + */ + public function getRealZcInsAssetIds(): ?array + { + return $this->container['real_zc_ins_asset_ids']; + } + + /** + * Sets real_zc_ins_asset_ids + * + * @param string[]|null $real_zc_ins_asset_ids real_zc_ins_asset_ids + * + * @return $this + */ + public function setRealZcInsAssetIds(?array $real_zc_ins_asset_ids): static + { + if (is_null($real_zc_ins_asset_ids)) { + throw new InvalidArgumentException('non-nullable real_zc_ins_asset_ids cannot be null'); + } + $this->container['real_zc_ins_asset_ids'] = $real_zc_ins_asset_ids; + + return $this; + } + + /** + * Gets zc_input_amounts + * + * @return int[]|null + */ + public function getZcInputAmounts(): ?array + { + return $this->container['zc_input_amounts']; + } + + /** + * Sets zc_input_amounts + * + * @param int[]|null $zc_input_amounts zc_input_amounts + * + * @return $this + */ + public function setZcInputAmounts(?array $zc_input_amounts): static + { + if (is_null($zc_input_amounts)) { + throw new InvalidArgumentException('non-nullable zc_input_amounts cannot be null'); + } + $this->container['zc_input_amounts'] = $zc_input_amounts; + + return $this; + } + + /** + * Gets pseudo_out_amount_commitments_sum + * + * @return string|null + */ + public function getPseudoOutAmountCommitmentsSum(): ?string + { + return $this->container['pseudo_out_amount_commitments_sum']; + } + + /** + * Sets pseudo_out_amount_commitments_sum + * + * @param string|null $pseudo_out_amount_commitments_sum pseudo_out_amount_commitments_sum + * + * @return $this + */ + public function setPseudoOutAmountCommitmentsSum(?string $pseudo_out_amount_commitments_sum): static + { + if (is_null($pseudo_out_amount_commitments_sum)) { + throw new InvalidArgumentException('non-nullable pseudo_out_amount_commitments_sum cannot be null'); + } + $this->container['pseudo_out_amount_commitments_sum'] = $pseudo_out_amount_commitments_sum; + + return $this; + } + + /** + * Gets pseudo_out_amount_blinding_masks_sum + * + * @return string|null + */ + public function getPseudoOutAmountBlindingMasksSum(): ?string + { + return $this->container['pseudo_out_amount_blinding_masks_sum']; + } + + /** + * Sets pseudo_out_amount_blinding_masks_sum + * + * @param string|null $pseudo_out_amount_blinding_masks_sum pseudo_out_amount_blinding_masks_sum + * + * @return $this + */ + public function setPseudoOutAmountBlindingMasksSum(?string $pseudo_out_amount_blinding_masks_sum): static + { + if (is_null($pseudo_out_amount_blinding_masks_sum)) { + throw new InvalidArgumentException('non-nullable pseudo_out_amount_blinding_masks_sum cannot be null'); + } + $this->container['pseudo_out_amount_blinding_masks_sum'] = $pseudo_out_amount_blinding_masks_sum; + + return $this; + } + + /** + * Gets real_in_asset_id_blinding_mask_x_amount_sum + * + * @return string|null + */ + public function getRealInAssetIdBlindingMaskXAmountSum(): ?string + { + return $this->container['real_in_asset_id_blinding_mask_x_amount_sum']; + } + + /** + * Sets real_in_asset_id_blinding_mask_x_amount_sum + * + * @param string|null $real_in_asset_id_blinding_mask_x_amount_sum real_in_asset_id_blinding_mask_x_amount_sum + * + * @return $this + */ + public function setRealInAssetIdBlindingMaskXAmountSum(?string $real_in_asset_id_blinding_mask_x_amount_sum): static + { + if (is_null($real_in_asset_id_blinding_mask_x_amount_sum)) { + throw new InvalidArgumentException('non-nullable real_in_asset_id_blinding_mask_x_amount_sum cannot be null'); + } + $this->container['real_in_asset_id_blinding_mask_x_amount_sum'] = $real_in_asset_id_blinding_mask_x_amount_sum; + + return $this; + } + + /** + * Gets amount_commitments_sum + * + * @return string|null + */ + public function getAmountCommitmentsSum(): ?string + { + return $this->container['amount_commitments_sum']; + } + + /** + * Sets amount_commitments_sum + * + * @param string|null $amount_commitments_sum amount_commitments_sum + * + * @return $this + */ + public function setAmountCommitmentsSum(?string $amount_commitments_sum): static + { + if (is_null($amount_commitments_sum)) { + throw new InvalidArgumentException('non-nullable amount_commitments_sum cannot be null'); + } + $this->container['amount_commitments_sum'] = $amount_commitments_sum; + + return $this; + } + + /** + * Gets amount_blinding_masks_sum + * + * @return string|null + */ + public function getAmountBlindingMasksSum(): ?string + { + return $this->container['amount_blinding_masks_sum']; + } + + /** + * Sets amount_blinding_masks_sum + * + * @param string|null $amount_blinding_masks_sum amount_blinding_masks_sum + * + * @return $this + */ + public function setAmountBlindingMasksSum(?string $amount_blinding_masks_sum): static + { + if (is_null($amount_blinding_masks_sum)) { + throw new InvalidArgumentException('non-nullable amount_blinding_masks_sum cannot be null'); + } + $this->container['amount_blinding_masks_sum'] = $amount_blinding_masks_sum; + + return $this; + } + + /** + * Gets asset_id_blinding_mask_x_amount_sum + * + * @return string|null + */ + public function getAssetIdBlindingMaskXAmountSum(): ?string + { + return $this->container['asset_id_blinding_mask_x_amount_sum']; + } + + /** + * Sets asset_id_blinding_mask_x_amount_sum + * + * @param string|null $asset_id_blinding_mask_x_amount_sum asset_id_blinding_mask_x_amount_sum + * + * @return $this + */ + public function setAssetIdBlindingMaskXAmountSum(?string $asset_id_blinding_mask_x_amount_sum): static + { + if (is_null($asset_id_blinding_mask_x_amount_sum)) { + throw new InvalidArgumentException('non-nullable asset_id_blinding_mask_x_amount_sum cannot be null'); + } + $this->container['asset_id_blinding_mask_x_amount_sum'] = $asset_id_blinding_mask_x_amount_sum; + + return $this; + } + + /** + * Gets ao_asset_id + * + * @return string|null + */ + public function getAoAssetId(): ?string + { + return $this->container['ao_asset_id']; + } + + /** + * Sets ao_asset_id + * + * @param string|null $ao_asset_id ao_asset_id + * + * @return $this + */ + public function setAoAssetId(?string $ao_asset_id): static + { + if (is_null($ao_asset_id)) { + throw new InvalidArgumentException('non-nullable ao_asset_id cannot be null'); + } + $this->container['ao_asset_id'] = $ao_asset_id; + + return $this; + } + + /** + * Gets ao_asset_id_pt + * + * @return string|null + */ + public function getAoAssetIdPt(): ?string + { + return $this->container['ao_asset_id_pt']; + } + + /** + * Sets ao_asset_id_pt + * + * @param string|null $ao_asset_id_pt ao_asset_id_pt + * + * @return $this + */ + public function setAoAssetIdPt(?string $ao_asset_id_pt): static + { + if (is_null($ao_asset_id_pt)) { + throw new InvalidArgumentException('non-nullable ao_asset_id_pt cannot be null'); + } + $this->container['ao_asset_id_pt'] = $ao_asset_id_pt; + + return $this; + } + + /** + * Gets ao_amount_commitment + * + * @return string|null + */ + public function getAoAmountCommitment(): ?string + { + return $this->container['ao_amount_commitment']; + } + + /** + * Sets ao_amount_commitment + * + * @param string|null $ao_amount_commitment ao_amount_commitment + * + * @return $this + */ + public function setAoAmountCommitment(?string $ao_amount_commitment): static + { + if (is_null($ao_amount_commitment)) { + throw new InvalidArgumentException('non-nullable ao_amount_commitment cannot be null'); + } + $this->container['ao_amount_commitment'] = $ao_amount_commitment; + + return $this; + } + + /** + * Gets ao_amount_blinding_mask + * + * @return string|null + */ + public function getAoAmountBlindingMask(): ?string + { + return $this->container['ao_amount_blinding_mask']; + } + + /** + * Sets ao_amount_blinding_mask + * + * @param string|null $ao_amount_blinding_mask ao_amount_blinding_mask + * + * @return $this + */ + public function setAoAmountBlindingMask(?string $ao_amount_blinding_mask): static + { + if (is_null($ao_amount_blinding_mask)) { + throw new InvalidArgumentException('non-nullable ao_amount_blinding_mask cannot be null'); + } + $this->container['ao_amount_blinding_mask'] = $ao_amount_blinding_mask; + + return $this; + } + + /** + * Gets ao_commitment_in_outputs + * + * @return bool|null + */ + public function getAoCommitmentInOutputs(): ?bool + { + return $this->container['ao_commitment_in_outputs']; + } + + /** + * Sets ao_commitment_in_outputs + * + * @param bool|null $ao_commitment_in_outputs ao_commitment_in_outputs + * + * @return $this + */ + public function setAoCommitmentInOutputs(?bool $ao_commitment_in_outputs): static + { + if (is_null($ao_commitment_in_outputs)) { + throw new InvalidArgumentException('non-nullable ao_commitment_in_outputs cannot be null'); + } + $this->container['ao_commitment_in_outputs'] = $ao_commitment_in_outputs; + + return $this; + } + + /** + * Gets tx_key_pub + * + * @return string|null + */ + public function getTxKeyPub(): ?string + { + return $this->container['tx_key_pub']; + } + + /** + * Sets tx_key_pub + * + * @param string|null $tx_key_pub tx_key_pub + * + * @return $this + */ + public function setTxKeyPub(?string $tx_key_pub): static + { + if (is_null($tx_key_pub)) { + throw new InvalidArgumentException('non-nullable tx_key_pub cannot be null'); + } + $this->container['tx_key_pub'] = $tx_key_pub; + + return $this; + } + + /** + * Gets tx_key_sec + * + * @return string|null + */ + public function getTxKeySec(): ?string + { + return $this->container['tx_key_sec']; + } + + /** + * Sets tx_key_sec + * + * @param string|null $tx_key_sec tx_key_sec + * + * @return $this + */ + public function setTxKeySec(?string $tx_key_sec): static + { + if (is_null($tx_key_sec)) { + throw new InvalidArgumentException('non-nullable tx_key_sec cannot be null'); + } + $this->container['tx_key_sec'] = $tx_key_sec; + + return $this; + } + + /** + * Gets tx_pub_key_p + * + * @return string|null + */ + public function getTxPubKeyP(): ?string + { + return $this->container['tx_pub_key_p']; + } + + /** + * Sets tx_pub_key_p + * + * @param string|null $tx_pub_key_p tx_pub_key_p + * + * @return $this + */ + public function setTxPubKeyP(?string $tx_pub_key_p): static + { + if (is_null($tx_pub_key_p)) { + throw new InvalidArgumentException('non-nullable tx_pub_key_p cannot be null'); + } + $this->container['tx_pub_key_p'] = $tx_pub_key_p; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists(mixed $offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[ReturnTypeWillChange] + public function offsetGet(mixed $offset): mixed + { + 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(mixed $offset, mixed $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(mixed $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(): mixed + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString(): string + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue(): string + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/utils/sdk/client/php/src/Model/TxPoolPerformanceModel.php b/utils/sdk/client/php/src/Model/TxPoolPerformanceModel.php new file mode 100644 index 00000000..f54359bc --- /dev/null +++ b/utils/sdk/client/php/src/Model/TxPoolPerformanceModel.php @@ -0,0 +1,747 @@ + + */ +class TxPoolPerformanceModel implements ModelInterface, ArrayAccess, JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = 'TxPoolPerformanceModel'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPITypes = [ + 'tx_processing_time' => 'int', + 'check_inputs_types_supported_time' => 'int', + 'expiration_validate_time' => 'int', + 'validate_amount_time' => 'int', + 'validate_alias_time' => 'int', + 'check_keyimages_ws_ms_time' => 'int', + 'check_inputs_time' => 'int', + 'begin_tx_time' => 'int', + 'update_db_time' => 'int', + 'db_commit_time' => 'int', + 'check_post_hf4_balance' => 'int' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPIFormats = [ + 'tx_processing_time' => null, + 'check_inputs_types_supported_time' => null, + 'expiration_validate_time' => null, + 'validate_amount_time' => null, + 'validate_alias_time' => null, + 'check_keyimages_ws_ms_time' => null, + 'check_inputs_time' => null, + 'begin_tx_time' => null, + 'update_db_time' => null, + 'db_commit_time' => null, + 'check_post_hf4_balance' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'tx_processing_time' => false, + 'check_inputs_types_supported_time' => false, + 'expiration_validate_time' => false, + 'validate_amount_time' => false, + 'validate_alias_time' => false, + 'check_keyimages_ws_ms_time' => false, + 'check_inputs_time' => false, + 'begin_tx_time' => false, + 'update_db_time' => false, + 'db_commit_time' => false, + 'check_post_hf4_balance' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes(): array + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats(): array + { + 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 array + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param array $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 array + */ + protected static array $attributeMap = [ + 'tx_processing_time' => 'tx_processing_time', + 'check_inputs_types_supported_time' => 'check_inputs_types_supported_time', + 'expiration_validate_time' => 'expiration_validate_time', + 'validate_amount_time' => 'validate_amount_time', + 'validate_alias_time' => 'validate_alias_time', + 'check_keyimages_ws_ms_time' => 'check_keyimages_ws_ms_time', + 'check_inputs_time' => 'check_inputs_time', + 'begin_tx_time' => 'begin_tx_time', + 'update_db_time' => 'update_db_time', + 'db_commit_time' => 'db_commit_time', + 'check_post_hf4_balance' => 'check_post_hf4_balance' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var array + */ + protected static array $setters = [ + 'tx_processing_time' => 'setTxProcessingTime', + 'check_inputs_types_supported_time' => 'setCheckInputsTypesSupportedTime', + 'expiration_validate_time' => 'setExpirationValidateTime', + 'validate_amount_time' => 'setValidateAmountTime', + 'validate_alias_time' => 'setValidateAliasTime', + 'check_keyimages_ws_ms_time' => 'setCheckKeyimagesWsMsTime', + 'check_inputs_time' => 'setCheckInputsTime', + 'begin_tx_time' => 'setBeginTxTime', + 'update_db_time' => 'setUpdateDbTime', + 'db_commit_time' => 'setDbCommitTime', + 'check_post_hf4_balance' => 'setCheckPostHf4Balance' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var array + */ + protected static array $getters = [ + 'tx_processing_time' => 'getTxProcessingTime', + 'check_inputs_types_supported_time' => 'getCheckInputsTypesSupportedTime', + 'expiration_validate_time' => 'getExpirationValidateTime', + 'validate_amount_time' => 'getValidateAmountTime', + 'validate_alias_time' => 'getValidateAliasTime', + 'check_keyimages_ws_ms_time' => 'getCheckKeyimagesWsMsTime', + 'check_inputs_time' => 'getCheckInputsTime', + 'begin_tx_time' => 'getBeginTxTime', + 'update_db_time' => 'getUpdateDbTime', + 'db_commit_time' => 'getDbCommitTime', + 'check_post_hf4_balance' => 'getCheckPostHf4Balance' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap(): array + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters(): array + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters(): array + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName(): string + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var array + */ + protected array $container = []; + + /** + * Constructor + * + * @param array $data Associated array of property values initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('tx_processing_time', $data ?? [], null); + $this->setIfExists('check_inputs_types_supported_time', $data ?? [], null); + $this->setIfExists('expiration_validate_time', $data ?? [], null); + $this->setIfExists('validate_amount_time', $data ?? [], null); + $this->setIfExists('validate_alias_time', $data ?? [], null); + $this->setIfExists('check_keyimages_ws_ms_time', $data ?? [], null); + $this->setIfExists('check_inputs_time', $data ?? [], null); + $this->setIfExists('begin_tx_time', $data ?? [], null); + $this->setIfExists('update_db_time', $data ?? [], null); + $this->setIfExists('db_commit_time', $data ?? [], null); + $this->setIfExists('check_post_hf4_balance', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, mixed $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 string[] invalid properties with reasons + */ + public function listInvalidProperties(): array + { + $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(): bool + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets tx_processing_time + * + * @return int|null + */ + public function getTxProcessingTime(): ?int + { + return $this->container['tx_processing_time']; + } + + /** + * Sets tx_processing_time + * + * @param int|null $tx_processing_time tx_processing_time + * + * @return $this + */ + public function setTxProcessingTime(?int $tx_processing_time): static + { + if (is_null($tx_processing_time)) { + throw new InvalidArgumentException('non-nullable tx_processing_time cannot be null'); + } + $this->container['tx_processing_time'] = $tx_processing_time; + + return $this; + } + + /** + * Gets check_inputs_types_supported_time + * + * @return int|null + */ + public function getCheckInputsTypesSupportedTime(): ?int + { + return $this->container['check_inputs_types_supported_time']; + } + + /** + * Sets check_inputs_types_supported_time + * + * @param int|null $check_inputs_types_supported_time check_inputs_types_supported_time + * + * @return $this + */ + public function setCheckInputsTypesSupportedTime(?int $check_inputs_types_supported_time): static + { + if (is_null($check_inputs_types_supported_time)) { + throw new InvalidArgumentException('non-nullable check_inputs_types_supported_time cannot be null'); + } + $this->container['check_inputs_types_supported_time'] = $check_inputs_types_supported_time; + + return $this; + } + + /** + * Gets expiration_validate_time + * + * @return int|null + */ + public function getExpirationValidateTime(): ?int + { + return $this->container['expiration_validate_time']; + } + + /** + * Sets expiration_validate_time + * + * @param int|null $expiration_validate_time expiration_validate_time + * + * @return $this + */ + public function setExpirationValidateTime(?int $expiration_validate_time): static + { + if (is_null($expiration_validate_time)) { + throw new InvalidArgumentException('non-nullable expiration_validate_time cannot be null'); + } + $this->container['expiration_validate_time'] = $expiration_validate_time; + + return $this; + } + + /** + * Gets validate_amount_time + * + * @return int|null + */ + public function getValidateAmountTime(): ?int + { + return $this->container['validate_amount_time']; + } + + /** + * Sets validate_amount_time + * + * @param int|null $validate_amount_time validate_amount_time + * + * @return $this + */ + public function setValidateAmountTime(?int $validate_amount_time): static + { + if (is_null($validate_amount_time)) { + throw new InvalidArgumentException('non-nullable validate_amount_time cannot be null'); + } + $this->container['validate_amount_time'] = $validate_amount_time; + + return $this; + } + + /** + * Gets validate_alias_time + * + * @return int|null + */ + public function getValidateAliasTime(): ?int + { + return $this->container['validate_alias_time']; + } + + /** + * Sets validate_alias_time + * + * @param int|null $validate_alias_time validate_alias_time + * + * @return $this + */ + public function setValidateAliasTime(?int $validate_alias_time): static + { + if (is_null($validate_alias_time)) { + throw new InvalidArgumentException('non-nullable validate_alias_time cannot be null'); + } + $this->container['validate_alias_time'] = $validate_alias_time; + + return $this; + } + + /** + * Gets check_keyimages_ws_ms_time + * + * @return int|null + */ + public function getCheckKeyimagesWsMsTime(): ?int + { + return $this->container['check_keyimages_ws_ms_time']; + } + + /** + * Sets check_keyimages_ws_ms_time + * + * @param int|null $check_keyimages_ws_ms_time check_keyimages_ws_ms_time + * + * @return $this + */ + public function setCheckKeyimagesWsMsTime(?int $check_keyimages_ws_ms_time): static + { + if (is_null($check_keyimages_ws_ms_time)) { + throw new InvalidArgumentException('non-nullable check_keyimages_ws_ms_time cannot be null'); + } + $this->container['check_keyimages_ws_ms_time'] = $check_keyimages_ws_ms_time; + + return $this; + } + + /** + * Gets check_inputs_time + * + * @return int|null + */ + public function getCheckInputsTime(): ?int + { + return $this->container['check_inputs_time']; + } + + /** + * Sets check_inputs_time + * + * @param int|null $check_inputs_time check_inputs_time + * + * @return $this + */ + public function setCheckInputsTime(?int $check_inputs_time): static + { + if (is_null($check_inputs_time)) { + throw new InvalidArgumentException('non-nullable check_inputs_time cannot be null'); + } + $this->container['check_inputs_time'] = $check_inputs_time; + + return $this; + } + + /** + * Gets begin_tx_time + * + * @return int|null + */ + public function getBeginTxTime(): ?int + { + return $this->container['begin_tx_time']; + } + + /** + * Sets begin_tx_time + * + * @param int|null $begin_tx_time begin_tx_time + * + * @return $this + */ + public function setBeginTxTime(?int $begin_tx_time): static + { + if (is_null($begin_tx_time)) { + throw new InvalidArgumentException('non-nullable begin_tx_time cannot be null'); + } + $this->container['begin_tx_time'] = $begin_tx_time; + + return $this; + } + + /** + * Gets update_db_time + * + * @return int|null + */ + public function getUpdateDbTime(): ?int + { + return $this->container['update_db_time']; + } + + /** + * Sets update_db_time + * + * @param int|null $update_db_time update_db_time + * + * @return $this + */ + public function setUpdateDbTime(?int $update_db_time): static + { + if (is_null($update_db_time)) { + throw new InvalidArgumentException('non-nullable update_db_time cannot be null'); + } + $this->container['update_db_time'] = $update_db_time; + + return $this; + } + + /** + * Gets db_commit_time + * + * @return int|null + */ + public function getDbCommitTime(): ?int + { + return $this->container['db_commit_time']; + } + + /** + * Sets db_commit_time + * + * @param int|null $db_commit_time db_commit_time + * + * @return $this + */ + public function setDbCommitTime(?int $db_commit_time): static + { + if (is_null($db_commit_time)) { + throw new InvalidArgumentException('non-nullable db_commit_time cannot be null'); + } + $this->container['db_commit_time'] = $db_commit_time; + + return $this; + } + + /** + * Gets check_post_hf4_balance + * + * @return int|null + */ + public function getCheckPostHf4Balance(): ?int + { + return $this->container['check_post_hf4_balance']; + } + + /** + * Sets check_post_hf4_balance + * + * @param int|null $check_post_hf4_balance check_post_hf4_balance + * + * @return $this + */ + public function setCheckPostHf4Balance(?int $check_post_hf4_balance): static + { + if (is_null($check_post_hf4_balance)) { + throw new InvalidArgumentException('non-nullable check_post_hf4_balance cannot be null'); + } + $this->container['check_post_hf4_balance'] = $check_post_hf4_balance; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists(mixed $offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[ReturnTypeWillChange] + public function offsetGet(mixed $offset): mixed + { + 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(mixed $offset, mixed $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(mixed $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(): mixed + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString(): string + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue(): string + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/utils/sdk/client/php/src/Model/TxProcessingPerformanceModel.php b/utils/sdk/client/php/src/Model/TxProcessingPerformanceModel.php new file mode 100644 index 00000000..fab20696 --- /dev/null +++ b/utils/sdk/client/php/src/Model/TxProcessingPerformanceModel.php @@ -0,0 +1,1223 @@ + + */ +class TxProcessingPerformanceModel implements ModelInterface, ArrayAccess, JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = 'TxProcessingPerformanceModel'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPITypes = [ + 'tx_check_inputs' => 'int', + 'tx_add_one_tx' => 'int', + 'tx_process_extra' => 'int', + 'tx_process_attachment' => 'int', + 'tx_process_inputs' => 'int', + 'tx_push_global_index' => 'int', + 'tx_check_exist' => 'int', + 'tx_print_log' => 'int', + 'tx_prapare_append' => 'int', + 'tx_append' => 'int', + 'tx_append_rl_wait' => 'int', + 'tx_append_is_expired' => 'int', + 'tx_store_db' => 'int', + 'tx_check_inputs_prefix_hash' => 'int', + 'tx_check_inputs_attachment_check' => 'int', + 'tx_check_inputs_loop' => 'int', + 'tx_check_inputs_loop_kimage_check' => 'int', + 'tx_check_inputs_loop_ch_in_val_sig' => 'int', + 'tx_check_inputs_loop_scan_outputkeys_get_item_size' => 'int', + 'tx_check_inputs_loop_scan_outputkeys_relative_to_absolute' => 'int', + 'tx_check_inputs_loop_scan_outputkeys_loop' => 'int', + 'tx_check_inputs_loop_scan_outputkeys_loop_get_subitem' => 'int', + 'tx_check_inputs_loop_scan_outputkeys_loop_find_tx' => 'int', + 'tx_check_inputs_loop_scan_outputkeys_loop_handle_output' => 'int', + 'tx_mixin_count' => 'int' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPIFormats = [ + 'tx_check_inputs' => null, + 'tx_add_one_tx' => null, + 'tx_process_extra' => null, + 'tx_process_attachment' => null, + 'tx_process_inputs' => null, + 'tx_push_global_index' => null, + 'tx_check_exist' => null, + 'tx_print_log' => null, + 'tx_prapare_append' => null, + 'tx_append' => null, + 'tx_append_rl_wait' => null, + 'tx_append_is_expired' => null, + 'tx_store_db' => null, + 'tx_check_inputs_prefix_hash' => null, + 'tx_check_inputs_attachment_check' => null, + 'tx_check_inputs_loop' => null, + 'tx_check_inputs_loop_kimage_check' => null, + 'tx_check_inputs_loop_ch_in_val_sig' => null, + 'tx_check_inputs_loop_scan_outputkeys_get_item_size' => null, + 'tx_check_inputs_loop_scan_outputkeys_relative_to_absolute' => null, + 'tx_check_inputs_loop_scan_outputkeys_loop' => null, + 'tx_check_inputs_loop_scan_outputkeys_loop_get_subitem' => null, + 'tx_check_inputs_loop_scan_outputkeys_loop_find_tx' => null, + 'tx_check_inputs_loop_scan_outputkeys_loop_handle_output' => null, + 'tx_mixin_count' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'tx_check_inputs' => false, + 'tx_add_one_tx' => false, + 'tx_process_extra' => false, + 'tx_process_attachment' => false, + 'tx_process_inputs' => false, + 'tx_push_global_index' => false, + 'tx_check_exist' => false, + 'tx_print_log' => false, + 'tx_prapare_append' => false, + 'tx_append' => false, + 'tx_append_rl_wait' => false, + 'tx_append_is_expired' => false, + 'tx_store_db' => false, + 'tx_check_inputs_prefix_hash' => false, + 'tx_check_inputs_attachment_check' => false, + 'tx_check_inputs_loop' => false, + 'tx_check_inputs_loop_kimage_check' => false, + 'tx_check_inputs_loop_ch_in_val_sig' => false, + 'tx_check_inputs_loop_scan_outputkeys_get_item_size' => false, + 'tx_check_inputs_loop_scan_outputkeys_relative_to_absolute' => false, + 'tx_check_inputs_loop_scan_outputkeys_loop' => false, + 'tx_check_inputs_loop_scan_outputkeys_loop_get_subitem' => false, + 'tx_check_inputs_loop_scan_outputkeys_loop_find_tx' => false, + 'tx_check_inputs_loop_scan_outputkeys_loop_handle_output' => false, + 'tx_mixin_count' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes(): array + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats(): array + { + 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 array + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param array $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 array + */ + protected static array $attributeMap = [ + 'tx_check_inputs' => 'tx_check_inputs', + 'tx_add_one_tx' => 'tx_add_one_tx', + 'tx_process_extra' => 'tx_process_extra', + 'tx_process_attachment' => 'tx_process_attachment', + 'tx_process_inputs' => 'tx_process_inputs', + 'tx_push_global_index' => 'tx_push_global_index', + 'tx_check_exist' => 'tx_check_exist', + 'tx_print_log' => 'tx_print_log', + 'tx_prapare_append' => 'tx_prapare_append', + 'tx_append' => 'tx_append', + 'tx_append_rl_wait' => 'tx_append_rl_wait', + 'tx_append_is_expired' => 'tx_append_is_expired', + 'tx_store_db' => 'tx_store_db', + 'tx_check_inputs_prefix_hash' => 'tx_check_inputs_prefix_hash', + 'tx_check_inputs_attachment_check' => 'tx_check_inputs_attachment_check', + 'tx_check_inputs_loop' => 'tx_check_inputs_loop', + 'tx_check_inputs_loop_kimage_check' => 'tx_check_inputs_loop_kimage_check', + 'tx_check_inputs_loop_ch_in_val_sig' => 'tx_check_inputs_loop_ch_in_val_sig', + 'tx_check_inputs_loop_scan_outputkeys_get_item_size' => 'tx_check_inputs_loop_scan_outputkeys_get_item_size', + 'tx_check_inputs_loop_scan_outputkeys_relative_to_absolute' => 'tx_check_inputs_loop_scan_outputkeys_relative_to_absolute', + 'tx_check_inputs_loop_scan_outputkeys_loop' => 'tx_check_inputs_loop_scan_outputkeys_loop', + 'tx_check_inputs_loop_scan_outputkeys_loop_get_subitem' => 'tx_check_inputs_loop_scan_outputkeys_loop_get_subitem', + 'tx_check_inputs_loop_scan_outputkeys_loop_find_tx' => 'tx_check_inputs_loop_scan_outputkeys_loop_find_tx', + 'tx_check_inputs_loop_scan_outputkeys_loop_handle_output' => 'tx_check_inputs_loop_scan_outputkeys_loop_handle_output', + 'tx_mixin_count' => 'tx_mixin_count' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var array + */ + protected static array $setters = [ + 'tx_check_inputs' => 'setTxCheckInputs', + 'tx_add_one_tx' => 'setTxAddOneTx', + 'tx_process_extra' => 'setTxProcessExtra', + 'tx_process_attachment' => 'setTxProcessAttachment', + 'tx_process_inputs' => 'setTxProcessInputs', + 'tx_push_global_index' => 'setTxPushGlobalIndex', + 'tx_check_exist' => 'setTxCheckExist', + 'tx_print_log' => 'setTxPrintLog', + 'tx_prapare_append' => 'setTxPrapareAppend', + 'tx_append' => 'setTxAppend', + 'tx_append_rl_wait' => 'setTxAppendRlWait', + 'tx_append_is_expired' => 'setTxAppendIsExpired', + 'tx_store_db' => 'setTxStoreDb', + 'tx_check_inputs_prefix_hash' => 'setTxCheckInputsPrefixHash', + 'tx_check_inputs_attachment_check' => 'setTxCheckInputsAttachmentCheck', + 'tx_check_inputs_loop' => 'setTxCheckInputsLoop', + 'tx_check_inputs_loop_kimage_check' => 'setTxCheckInputsLoopKimageCheck', + 'tx_check_inputs_loop_ch_in_val_sig' => 'setTxCheckInputsLoopChInValSig', + 'tx_check_inputs_loop_scan_outputkeys_get_item_size' => 'setTxCheckInputsLoopScanOutputkeysGetItemSize', + 'tx_check_inputs_loop_scan_outputkeys_relative_to_absolute' => 'setTxCheckInputsLoopScanOutputkeysRelativeToAbsolute', + 'tx_check_inputs_loop_scan_outputkeys_loop' => 'setTxCheckInputsLoopScanOutputkeysLoop', + 'tx_check_inputs_loop_scan_outputkeys_loop_get_subitem' => 'setTxCheckInputsLoopScanOutputkeysLoopGetSubitem', + 'tx_check_inputs_loop_scan_outputkeys_loop_find_tx' => 'setTxCheckInputsLoopScanOutputkeysLoopFindTx', + 'tx_check_inputs_loop_scan_outputkeys_loop_handle_output' => 'setTxCheckInputsLoopScanOutputkeysLoopHandleOutput', + 'tx_mixin_count' => 'setTxMixinCount' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var array + */ + protected static array $getters = [ + 'tx_check_inputs' => 'getTxCheckInputs', + 'tx_add_one_tx' => 'getTxAddOneTx', + 'tx_process_extra' => 'getTxProcessExtra', + 'tx_process_attachment' => 'getTxProcessAttachment', + 'tx_process_inputs' => 'getTxProcessInputs', + 'tx_push_global_index' => 'getTxPushGlobalIndex', + 'tx_check_exist' => 'getTxCheckExist', + 'tx_print_log' => 'getTxPrintLog', + 'tx_prapare_append' => 'getTxPrapareAppend', + 'tx_append' => 'getTxAppend', + 'tx_append_rl_wait' => 'getTxAppendRlWait', + 'tx_append_is_expired' => 'getTxAppendIsExpired', + 'tx_store_db' => 'getTxStoreDb', + 'tx_check_inputs_prefix_hash' => 'getTxCheckInputsPrefixHash', + 'tx_check_inputs_attachment_check' => 'getTxCheckInputsAttachmentCheck', + 'tx_check_inputs_loop' => 'getTxCheckInputsLoop', + 'tx_check_inputs_loop_kimage_check' => 'getTxCheckInputsLoopKimageCheck', + 'tx_check_inputs_loop_ch_in_val_sig' => 'getTxCheckInputsLoopChInValSig', + 'tx_check_inputs_loop_scan_outputkeys_get_item_size' => 'getTxCheckInputsLoopScanOutputkeysGetItemSize', + 'tx_check_inputs_loop_scan_outputkeys_relative_to_absolute' => 'getTxCheckInputsLoopScanOutputkeysRelativeToAbsolute', + 'tx_check_inputs_loop_scan_outputkeys_loop' => 'getTxCheckInputsLoopScanOutputkeysLoop', + 'tx_check_inputs_loop_scan_outputkeys_loop_get_subitem' => 'getTxCheckInputsLoopScanOutputkeysLoopGetSubitem', + 'tx_check_inputs_loop_scan_outputkeys_loop_find_tx' => 'getTxCheckInputsLoopScanOutputkeysLoopFindTx', + 'tx_check_inputs_loop_scan_outputkeys_loop_handle_output' => 'getTxCheckInputsLoopScanOutputkeysLoopHandleOutput', + 'tx_mixin_count' => 'getTxMixinCount' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap(): array + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters(): array + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters(): array + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName(): string + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var array + */ + protected array $container = []; + + /** + * Constructor + * + * @param array $data Associated array of property values initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('tx_check_inputs', $data ?? [], null); + $this->setIfExists('tx_add_one_tx', $data ?? [], null); + $this->setIfExists('tx_process_extra', $data ?? [], null); + $this->setIfExists('tx_process_attachment', $data ?? [], null); + $this->setIfExists('tx_process_inputs', $data ?? [], null); + $this->setIfExists('tx_push_global_index', $data ?? [], null); + $this->setIfExists('tx_check_exist', $data ?? [], null); + $this->setIfExists('tx_print_log', $data ?? [], null); + $this->setIfExists('tx_prapare_append', $data ?? [], null); + $this->setIfExists('tx_append', $data ?? [], null); + $this->setIfExists('tx_append_rl_wait', $data ?? [], null); + $this->setIfExists('tx_append_is_expired', $data ?? [], null); + $this->setIfExists('tx_store_db', $data ?? [], null); + $this->setIfExists('tx_check_inputs_prefix_hash', $data ?? [], null); + $this->setIfExists('tx_check_inputs_attachment_check', $data ?? [], null); + $this->setIfExists('tx_check_inputs_loop', $data ?? [], null); + $this->setIfExists('tx_check_inputs_loop_kimage_check', $data ?? [], null); + $this->setIfExists('tx_check_inputs_loop_ch_in_val_sig', $data ?? [], null); + $this->setIfExists('tx_check_inputs_loop_scan_outputkeys_get_item_size', $data ?? [], null); + $this->setIfExists('tx_check_inputs_loop_scan_outputkeys_relative_to_absolute', $data ?? [], null); + $this->setIfExists('tx_check_inputs_loop_scan_outputkeys_loop', $data ?? [], null); + $this->setIfExists('tx_check_inputs_loop_scan_outputkeys_loop_get_subitem', $data ?? [], null); + $this->setIfExists('tx_check_inputs_loop_scan_outputkeys_loop_find_tx', $data ?? [], null); + $this->setIfExists('tx_check_inputs_loop_scan_outputkeys_loop_handle_output', $data ?? [], null); + $this->setIfExists('tx_mixin_count', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, mixed $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 string[] invalid properties with reasons + */ + public function listInvalidProperties(): array + { + $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(): bool + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets tx_check_inputs + * + * @return int|null + */ + public function getTxCheckInputs(): ?int + { + return $this->container['tx_check_inputs']; + } + + /** + * Sets tx_check_inputs + * + * @param int|null $tx_check_inputs tx_check_inputs + * + * @return $this + */ + public function setTxCheckInputs(?int $tx_check_inputs): static + { + if (is_null($tx_check_inputs)) { + throw new InvalidArgumentException('non-nullable tx_check_inputs cannot be null'); + } + $this->container['tx_check_inputs'] = $tx_check_inputs; + + return $this; + } + + /** + * Gets tx_add_one_tx + * + * @return int|null + */ + public function getTxAddOneTx(): ?int + { + return $this->container['tx_add_one_tx']; + } + + /** + * Sets tx_add_one_tx + * + * @param int|null $tx_add_one_tx tx_add_one_tx + * + * @return $this + */ + public function setTxAddOneTx(?int $tx_add_one_tx): static + { + if (is_null($tx_add_one_tx)) { + throw new InvalidArgumentException('non-nullable tx_add_one_tx cannot be null'); + } + $this->container['tx_add_one_tx'] = $tx_add_one_tx; + + return $this; + } + + /** + * Gets tx_process_extra + * + * @return int|null + */ + public function getTxProcessExtra(): ?int + { + return $this->container['tx_process_extra']; + } + + /** + * Sets tx_process_extra + * + * @param int|null $tx_process_extra tx_process_extra + * + * @return $this + */ + public function setTxProcessExtra(?int $tx_process_extra): static + { + if (is_null($tx_process_extra)) { + throw new InvalidArgumentException('non-nullable tx_process_extra cannot be null'); + } + $this->container['tx_process_extra'] = $tx_process_extra; + + return $this; + } + + /** + * Gets tx_process_attachment + * + * @return int|null + */ + public function getTxProcessAttachment(): ?int + { + return $this->container['tx_process_attachment']; + } + + /** + * Sets tx_process_attachment + * + * @param int|null $tx_process_attachment tx_process_attachment + * + * @return $this + */ + public function setTxProcessAttachment(?int $tx_process_attachment): static + { + if (is_null($tx_process_attachment)) { + throw new InvalidArgumentException('non-nullable tx_process_attachment cannot be null'); + } + $this->container['tx_process_attachment'] = $tx_process_attachment; + + return $this; + } + + /** + * Gets tx_process_inputs + * + * @return int|null + */ + public function getTxProcessInputs(): ?int + { + return $this->container['tx_process_inputs']; + } + + /** + * Sets tx_process_inputs + * + * @param int|null $tx_process_inputs tx_process_inputs + * + * @return $this + */ + public function setTxProcessInputs(?int $tx_process_inputs): static + { + if (is_null($tx_process_inputs)) { + throw new InvalidArgumentException('non-nullable tx_process_inputs cannot be null'); + } + $this->container['tx_process_inputs'] = $tx_process_inputs; + + return $this; + } + + /** + * Gets tx_push_global_index + * + * @return int|null + */ + public function getTxPushGlobalIndex(): ?int + { + return $this->container['tx_push_global_index']; + } + + /** + * Sets tx_push_global_index + * + * @param int|null $tx_push_global_index tx_push_global_index + * + * @return $this + */ + public function setTxPushGlobalIndex(?int $tx_push_global_index): static + { + if (is_null($tx_push_global_index)) { + throw new InvalidArgumentException('non-nullable tx_push_global_index cannot be null'); + } + $this->container['tx_push_global_index'] = $tx_push_global_index; + + return $this; + } + + /** + * Gets tx_check_exist + * + * @return int|null + */ + public function getTxCheckExist(): ?int + { + return $this->container['tx_check_exist']; + } + + /** + * Sets tx_check_exist + * + * @param int|null $tx_check_exist tx_check_exist + * + * @return $this + */ + public function setTxCheckExist(?int $tx_check_exist): static + { + if (is_null($tx_check_exist)) { + throw new InvalidArgumentException('non-nullable tx_check_exist cannot be null'); + } + $this->container['tx_check_exist'] = $tx_check_exist; + + return $this; + } + + /** + * Gets tx_print_log + * + * @return int|null + */ + public function getTxPrintLog(): ?int + { + return $this->container['tx_print_log']; + } + + /** + * Sets tx_print_log + * + * @param int|null $tx_print_log tx_print_log + * + * @return $this + */ + public function setTxPrintLog(?int $tx_print_log): static + { + if (is_null($tx_print_log)) { + throw new InvalidArgumentException('non-nullable tx_print_log cannot be null'); + } + $this->container['tx_print_log'] = $tx_print_log; + + return $this; + } + + /** + * Gets tx_prapare_append + * + * @return int|null + */ + public function getTxPrapareAppend(): ?int + { + return $this->container['tx_prapare_append']; + } + + /** + * Sets tx_prapare_append + * + * @param int|null $tx_prapare_append tx_prapare_append + * + * @return $this + */ + public function setTxPrapareAppend(?int $tx_prapare_append): static + { + if (is_null($tx_prapare_append)) { + throw new InvalidArgumentException('non-nullable tx_prapare_append cannot be null'); + } + $this->container['tx_prapare_append'] = $tx_prapare_append; + + return $this; + } + + /** + * Gets tx_append + * + * @return int|null + */ + public function getTxAppend(): ?int + { + return $this->container['tx_append']; + } + + /** + * Sets tx_append + * + * @param int|null $tx_append tx_append + * + * @return $this + */ + public function setTxAppend(?int $tx_append): static + { + if (is_null($tx_append)) { + throw new InvalidArgumentException('non-nullable tx_append cannot be null'); + } + $this->container['tx_append'] = $tx_append; + + return $this; + } + + /** + * Gets tx_append_rl_wait + * + * @return int|null + */ + public function getTxAppendRlWait(): ?int + { + return $this->container['tx_append_rl_wait']; + } + + /** + * Sets tx_append_rl_wait + * + * @param int|null $tx_append_rl_wait tx_append_rl_wait + * + * @return $this + */ + public function setTxAppendRlWait(?int $tx_append_rl_wait): static + { + if (is_null($tx_append_rl_wait)) { + throw new InvalidArgumentException('non-nullable tx_append_rl_wait cannot be null'); + } + $this->container['tx_append_rl_wait'] = $tx_append_rl_wait; + + return $this; + } + + /** + * Gets tx_append_is_expired + * + * @return int|null + */ + public function getTxAppendIsExpired(): ?int + { + return $this->container['tx_append_is_expired']; + } + + /** + * Sets tx_append_is_expired + * + * @param int|null $tx_append_is_expired tx_append_is_expired + * + * @return $this + */ + public function setTxAppendIsExpired(?int $tx_append_is_expired): static + { + if (is_null($tx_append_is_expired)) { + throw new InvalidArgumentException('non-nullable tx_append_is_expired cannot be null'); + } + $this->container['tx_append_is_expired'] = $tx_append_is_expired; + + return $this; + } + + /** + * Gets tx_store_db + * + * @return int|null + */ + public function getTxStoreDb(): ?int + { + return $this->container['tx_store_db']; + } + + /** + * Sets tx_store_db + * + * @param int|null $tx_store_db tx_store_db + * + * @return $this + */ + public function setTxStoreDb(?int $tx_store_db): static + { + if (is_null($tx_store_db)) { + throw new InvalidArgumentException('non-nullable tx_store_db cannot be null'); + } + $this->container['tx_store_db'] = $tx_store_db; + + return $this; + } + + /** + * Gets tx_check_inputs_prefix_hash + * + * @return int|null + */ + public function getTxCheckInputsPrefixHash(): ?int + { + return $this->container['tx_check_inputs_prefix_hash']; + } + + /** + * Sets tx_check_inputs_prefix_hash + * + * @param int|null $tx_check_inputs_prefix_hash tx_check_inputs_prefix_hash + * + * @return $this + */ + public function setTxCheckInputsPrefixHash(?int $tx_check_inputs_prefix_hash): static + { + if (is_null($tx_check_inputs_prefix_hash)) { + throw new InvalidArgumentException('non-nullable tx_check_inputs_prefix_hash cannot be null'); + } + $this->container['tx_check_inputs_prefix_hash'] = $tx_check_inputs_prefix_hash; + + return $this; + } + + /** + * Gets tx_check_inputs_attachment_check + * + * @return int|null + */ + public function getTxCheckInputsAttachmentCheck(): ?int + { + return $this->container['tx_check_inputs_attachment_check']; + } + + /** + * Sets tx_check_inputs_attachment_check + * + * @param int|null $tx_check_inputs_attachment_check tx_check_inputs_attachment_check + * + * @return $this + */ + public function setTxCheckInputsAttachmentCheck(?int $tx_check_inputs_attachment_check): static + { + if (is_null($tx_check_inputs_attachment_check)) { + throw new InvalidArgumentException('non-nullable tx_check_inputs_attachment_check cannot be null'); + } + $this->container['tx_check_inputs_attachment_check'] = $tx_check_inputs_attachment_check; + + return $this; + } + + /** + * Gets tx_check_inputs_loop + * + * @return int|null + */ + public function getTxCheckInputsLoop(): ?int + { + return $this->container['tx_check_inputs_loop']; + } + + /** + * Sets tx_check_inputs_loop + * + * @param int|null $tx_check_inputs_loop tx_check_inputs_loop + * + * @return $this + */ + public function setTxCheckInputsLoop(?int $tx_check_inputs_loop): static + { + if (is_null($tx_check_inputs_loop)) { + throw new InvalidArgumentException('non-nullable tx_check_inputs_loop cannot be null'); + } + $this->container['tx_check_inputs_loop'] = $tx_check_inputs_loop; + + return $this; + } + + /** + * Gets tx_check_inputs_loop_kimage_check + * + * @return int|null + */ + public function getTxCheckInputsLoopKimageCheck(): ?int + { + return $this->container['tx_check_inputs_loop_kimage_check']; + } + + /** + * Sets tx_check_inputs_loop_kimage_check + * + * @param int|null $tx_check_inputs_loop_kimage_check tx_check_inputs_loop_kimage_check + * + * @return $this + */ + public function setTxCheckInputsLoopKimageCheck(?int $tx_check_inputs_loop_kimage_check): static + { + if (is_null($tx_check_inputs_loop_kimage_check)) { + throw new InvalidArgumentException('non-nullable tx_check_inputs_loop_kimage_check cannot be null'); + } + $this->container['tx_check_inputs_loop_kimage_check'] = $tx_check_inputs_loop_kimage_check; + + return $this; + } + + /** + * Gets tx_check_inputs_loop_ch_in_val_sig + * + * @return int|null + */ + public function getTxCheckInputsLoopChInValSig(): ?int + { + return $this->container['tx_check_inputs_loop_ch_in_val_sig']; + } + + /** + * Sets tx_check_inputs_loop_ch_in_val_sig + * + * @param int|null $tx_check_inputs_loop_ch_in_val_sig tx_check_inputs_loop_ch_in_val_sig + * + * @return $this + */ + public function setTxCheckInputsLoopChInValSig(?int $tx_check_inputs_loop_ch_in_val_sig): static + { + if (is_null($tx_check_inputs_loop_ch_in_val_sig)) { + throw new InvalidArgumentException('non-nullable tx_check_inputs_loop_ch_in_val_sig cannot be null'); + } + $this->container['tx_check_inputs_loop_ch_in_val_sig'] = $tx_check_inputs_loop_ch_in_val_sig; + + return $this; + } + + /** + * Gets tx_check_inputs_loop_scan_outputkeys_get_item_size + * + * @return int|null + */ + public function getTxCheckInputsLoopScanOutputkeysGetItemSize(): ?int + { + return $this->container['tx_check_inputs_loop_scan_outputkeys_get_item_size']; + } + + /** + * Sets tx_check_inputs_loop_scan_outputkeys_get_item_size + * + * @param int|null $tx_check_inputs_loop_scan_outputkeys_get_item_size tx_check_inputs_loop_scan_outputkeys_get_item_size + * + * @return $this + */ + public function setTxCheckInputsLoopScanOutputkeysGetItemSize(?int $tx_check_inputs_loop_scan_outputkeys_get_item_size): static + { + if (is_null($tx_check_inputs_loop_scan_outputkeys_get_item_size)) { + throw new InvalidArgumentException('non-nullable tx_check_inputs_loop_scan_outputkeys_get_item_size cannot be null'); + } + $this->container['tx_check_inputs_loop_scan_outputkeys_get_item_size'] = $tx_check_inputs_loop_scan_outputkeys_get_item_size; + + return $this; + } + + /** + * Gets tx_check_inputs_loop_scan_outputkeys_relative_to_absolute + * + * @return int|null + */ + public function getTxCheckInputsLoopScanOutputkeysRelativeToAbsolute(): ?int + { + return $this->container['tx_check_inputs_loop_scan_outputkeys_relative_to_absolute']; + } + + /** + * Sets tx_check_inputs_loop_scan_outputkeys_relative_to_absolute + * + * @param int|null $tx_check_inputs_loop_scan_outputkeys_relative_to_absolute tx_check_inputs_loop_scan_outputkeys_relative_to_absolute + * + * @return $this + */ + public function setTxCheckInputsLoopScanOutputkeysRelativeToAbsolute(?int $tx_check_inputs_loop_scan_outputkeys_relative_to_absolute): static + { + if (is_null($tx_check_inputs_loop_scan_outputkeys_relative_to_absolute)) { + throw new InvalidArgumentException('non-nullable tx_check_inputs_loop_scan_outputkeys_relative_to_absolute cannot be null'); + } + $this->container['tx_check_inputs_loop_scan_outputkeys_relative_to_absolute'] = $tx_check_inputs_loop_scan_outputkeys_relative_to_absolute; + + return $this; + } + + /** + * Gets tx_check_inputs_loop_scan_outputkeys_loop + * + * @return int|null + */ + public function getTxCheckInputsLoopScanOutputkeysLoop(): ?int + { + return $this->container['tx_check_inputs_loop_scan_outputkeys_loop']; + } + + /** + * Sets tx_check_inputs_loop_scan_outputkeys_loop + * + * @param int|null $tx_check_inputs_loop_scan_outputkeys_loop tx_check_inputs_loop_scan_outputkeys_loop + * + * @return $this + */ + public function setTxCheckInputsLoopScanOutputkeysLoop(?int $tx_check_inputs_loop_scan_outputkeys_loop): static + { + if (is_null($tx_check_inputs_loop_scan_outputkeys_loop)) { + throw new InvalidArgumentException('non-nullable tx_check_inputs_loop_scan_outputkeys_loop cannot be null'); + } + $this->container['tx_check_inputs_loop_scan_outputkeys_loop'] = $tx_check_inputs_loop_scan_outputkeys_loop; + + return $this; + } + + /** + * Gets tx_check_inputs_loop_scan_outputkeys_loop_get_subitem + * + * @return int|null + */ + public function getTxCheckInputsLoopScanOutputkeysLoopGetSubitem(): ?int + { + return $this->container['tx_check_inputs_loop_scan_outputkeys_loop_get_subitem']; + } + + /** + * Sets tx_check_inputs_loop_scan_outputkeys_loop_get_subitem + * + * @param int|null $tx_check_inputs_loop_scan_outputkeys_loop_get_subitem tx_check_inputs_loop_scan_outputkeys_loop_get_subitem + * + * @return $this + */ + public function setTxCheckInputsLoopScanOutputkeysLoopGetSubitem(?int $tx_check_inputs_loop_scan_outputkeys_loop_get_subitem): static + { + if (is_null($tx_check_inputs_loop_scan_outputkeys_loop_get_subitem)) { + throw new InvalidArgumentException('non-nullable tx_check_inputs_loop_scan_outputkeys_loop_get_subitem cannot be null'); + } + $this->container['tx_check_inputs_loop_scan_outputkeys_loop_get_subitem'] = $tx_check_inputs_loop_scan_outputkeys_loop_get_subitem; + + return $this; + } + + /** + * Gets tx_check_inputs_loop_scan_outputkeys_loop_find_tx + * + * @return int|null + */ + public function getTxCheckInputsLoopScanOutputkeysLoopFindTx(): ?int + { + return $this->container['tx_check_inputs_loop_scan_outputkeys_loop_find_tx']; + } + + /** + * Sets tx_check_inputs_loop_scan_outputkeys_loop_find_tx + * + * @param int|null $tx_check_inputs_loop_scan_outputkeys_loop_find_tx tx_check_inputs_loop_scan_outputkeys_loop_find_tx + * + * @return $this + */ + public function setTxCheckInputsLoopScanOutputkeysLoopFindTx(?int $tx_check_inputs_loop_scan_outputkeys_loop_find_tx): static + { + if (is_null($tx_check_inputs_loop_scan_outputkeys_loop_find_tx)) { + throw new InvalidArgumentException('non-nullable tx_check_inputs_loop_scan_outputkeys_loop_find_tx cannot be null'); + } + $this->container['tx_check_inputs_loop_scan_outputkeys_loop_find_tx'] = $tx_check_inputs_loop_scan_outputkeys_loop_find_tx; + + return $this; + } + + /** + * Gets tx_check_inputs_loop_scan_outputkeys_loop_handle_output + * + * @return int|null + */ + public function getTxCheckInputsLoopScanOutputkeysLoopHandleOutput(): ?int + { + return $this->container['tx_check_inputs_loop_scan_outputkeys_loop_handle_output']; + } + + /** + * Sets tx_check_inputs_loop_scan_outputkeys_loop_handle_output + * + * @param int|null $tx_check_inputs_loop_scan_outputkeys_loop_handle_output tx_check_inputs_loop_scan_outputkeys_loop_handle_output + * + * @return $this + */ + public function setTxCheckInputsLoopScanOutputkeysLoopHandleOutput(?int $tx_check_inputs_loop_scan_outputkeys_loop_handle_output): static + { + if (is_null($tx_check_inputs_loop_scan_outputkeys_loop_handle_output)) { + throw new InvalidArgumentException('non-nullable tx_check_inputs_loop_scan_outputkeys_loop_handle_output cannot be null'); + } + $this->container['tx_check_inputs_loop_scan_outputkeys_loop_handle_output'] = $tx_check_inputs_loop_scan_outputkeys_loop_handle_output; + + return $this; + } + + /** + * Gets tx_mixin_count + * + * @return int|null + */ + public function getTxMixinCount(): ?int + { + return $this->container['tx_mixin_count']; + } + + /** + * Sets tx_mixin_count + * + * @param int|null $tx_mixin_count tx_mixin_count + * + * @return $this + */ + public function setTxMixinCount(?int $tx_mixin_count): static + { + if (is_null($tx_mixin_count)) { + throw new InvalidArgumentException('non-nullable tx_mixin_count cannot be null'); + } + $this->container['tx_mixin_count'] = $tx_mixin_count; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists(mixed $offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[ReturnTypeWillChange] + public function offsetGet(mixed $offset): mixed + { + 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(mixed $offset, mixed $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(mixed $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(): mixed + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString(): string + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue(): string + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/utils/sdk/client/php/src/Model/VersionModel.php b/utils/sdk/client/php/src/Model/VersionModel.php new file mode 100644 index 00000000..e057ff72 --- /dev/null +++ b/utils/sdk/client/php/src/Model/VersionModel.php @@ -0,0 +1,543 @@ + + */ +class VersionModel implements ModelInterface, ArrayAccess, JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = 'VersionModel'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPITypes = [ + 'version' => 'string', + 'version_long' => 'string', + 'major' => 'string', + 'minor' => 'string', + 'revision' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPIFormats = [ + 'version' => null, + 'version_long' => null, + 'major' => null, + 'minor' => null, + 'revision' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'version' => false, + 'version_long' => false, + 'major' => false, + 'minor' => false, + 'revision' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes(): array + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats(): array + { + 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 array + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param array $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 array + */ + protected static array $attributeMap = [ + 'version' => 'version', + 'version_long' => 'version_long', + 'major' => 'major', + 'minor' => 'minor', + 'revision' => 'revision' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var array + */ + protected static array $setters = [ + 'version' => 'setVersion', + 'version_long' => 'setVersionLong', + 'major' => 'setMajor', + 'minor' => 'setMinor', + 'revision' => 'setRevision' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var array + */ + protected static array $getters = [ + 'version' => 'getVersion', + 'version_long' => 'getVersionLong', + 'major' => 'getMajor', + 'minor' => 'getMinor', + 'revision' => 'getRevision' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap(): array + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters(): array + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters(): array + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName(): string + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var array + */ + protected array $container = []; + + /** + * Constructor + * + * @param array $data Associated array of property values initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('version', $data ?? [], null); + $this->setIfExists('version_long', $data ?? [], null); + $this->setIfExists('major', $data ?? [], null); + $this->setIfExists('minor', $data ?? [], null); + $this->setIfExists('revision', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, mixed $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 string[] invalid properties with reasons + */ + public function listInvalidProperties(): array + { + $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(): bool + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets version + * + * @return string|null + */ + public function getVersion(): ?string + { + return $this->container['version']; + } + + /** + * Sets version + * + * @param string|null $version version + * + * @return $this + */ + public function setVersion(?string $version): static + { + if (is_null($version)) { + throw new InvalidArgumentException('non-nullable version cannot be null'); + } + $this->container['version'] = $version; + + return $this; + } + + /** + * Gets version_long + * + * @return string|null + */ + public function getVersionLong(): ?string + { + return $this->container['version_long']; + } + + /** + * Sets version_long + * + * @param string|null $version_long version_long + * + * @return $this + */ + public function setVersionLong(?string $version_long): static + { + if (is_null($version_long)) { + throw new InvalidArgumentException('non-nullable version_long cannot be null'); + } + $this->container['version_long'] = $version_long; + + return $this; + } + + /** + * Gets major + * + * @return string|null + */ + public function getMajor(): ?string + { + return $this->container['major']; + } + + /** + * Sets major + * + * @param string|null $major major + * + * @return $this + */ + public function setMajor(?string $major): static + { + if (is_null($major)) { + throw new InvalidArgumentException('non-nullable major cannot be null'); + } + $this->container['major'] = $major; + + return $this; + } + + /** + * Gets minor + * + * @return string|null + */ + public function getMinor(): ?string + { + return $this->container['minor']; + } + + /** + * Sets minor + * + * @param string|null $minor minor + * + * @return $this + */ + public function setMinor(?string $minor): static + { + if (is_null($minor)) { + throw new InvalidArgumentException('non-nullable minor cannot be null'); + } + $this->container['minor'] = $minor; + + return $this; + } + + /** + * Gets revision + * + * @return string|null + */ + public function getRevision(): ?string + { + return $this->container['revision']; + } + + /** + * Sets revision + * + * @param string|null $revision revision + * + * @return $this + */ + public function setRevision(?string $revision): static + { + if (is_null($revision)) { + throw new InvalidArgumentException('non-nullable revision cannot be null'); + } + $this->container['revision'] = $revision; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists(mixed $offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[ReturnTypeWillChange] + public function offsetGet(mixed $offset): mixed + { + 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(mixed $offset, mixed $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(mixed $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(): mixed + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString(): string + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue(): string + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/utils/sdk/client/php/src/ModelInterface.php b/utils/sdk/client/php/src/ModelInterface.php new file mode 100644 index 00000000..bc4ef4fe --- /dev/null +++ b/utils/sdk/client/php/src/ModelInterface.php @@ -0,0 +1,110 @@ +format('Y-m-d') : $data->format(self::$dateTimeFormat); + } + + if ($data instanceof \BackedEnum) { + return $data->value; + } + + if (is_array($data)) { + foreach ($data as $property => $value) { + $data[$property] = self::sanitizeForSerialization($value); + } + return $data; + } + + if (is_object($data)) { + $values = []; + if ($data instanceof ModelInterface) { + $formats = $data::openAPIFormats(); + foreach ($data::openAPITypes() as $property => $openAPIType) { + $getter = $data::getters()[$property]; + $value = $data->$getter(); + if ($value !== null && !in_array($openAPIType, ['\DateTime', '\SplFileObject', 'array', 'bool', 'boolean', 'byte', 'float', 'int', 'integer', 'mixed', 'number', 'object', 'string', 'void'], true)) { + if (is_subclass_of($openAPIType, '\BackedEnum')) { + if (is_scalar($value)) { + $value = $openAPIType::tryFrom($value); + if ($value === null) { + $imploded = implode("', '", array_map(fn($case) => $case->value, $openAPIType::cases())); + throw new \InvalidArgumentException( + sprintf( + "Invalid value for enum '%s', must be one of: '%s'", + $openAPIType::class, + $imploded + ) + ); + } + } + } + } + if (($data::isNullable($property) && $data->isNullableSetToNull($property)) || $value !== null) { + $values[$data::attributeMap()[$property]] = self::sanitizeForSerialization($value, $openAPIType, $formats[$property]); + } + } + } else { + foreach($data as $property => $value) { + $values[$property] = self::sanitizeForSerialization($value); + } + } + return (object)$values; + } else { + return (string)$data; + } + } + + /** + * Sanitize filename by removing path. + * e.g. ../../sun.gif becomes sun.gif + * + * @param string $filename filename to be sanitized + * + * @return string the sanitized filename + */ + public static function sanitizeFilename(string $filename): string + { + if (preg_match("/.*[\/\\\\](.*)$/", $filename, $match)) { + return $match[1]; + } else { + return $filename; + } + } + + /** + * Shorter timestamp microseconds to 6 digits length. + * + * @param string $timestamp Original timestamp + * + * @return string the shorten timestamp + */ + public static function sanitizeTimestamp(string $timestamp): string + { + return preg_replace('/(:\d{2}.\d{6})\d*/', '$1', $timestamp); + } + + /** + * Take value and turn it into a string suitable for inclusion in + * the path, by url-encoding. + * + * @param string $value a string which will be part of the path + * + * @return string the serialized object + */ + public static function toPathValue(string $value): string + { + return rawurlencode(self::toString($value)); + } + + /** + * Checks if a value is empty, based on its OpenAPI type. + * + * @param mixed $value + * @param string $openApiType + * + * @return bool true if $value is empty + */ + private static function isEmptyValue(mixed $value, string $openApiType): bool + { + # If empty() returns false, it is not empty regardless of its type. + if (!empty($value)) { + return false; + } + + # Null is always empty, as we cannot send a real "null" value in a query parameter. + if ($value === null) { + return true; + } + + return match ($openApiType) { + # For numeric values, false and '' are considered empty. + # This comparison is safe for floating point values, since the previous call to empty() will + # filter out values that don't match 0. + 'int','integer' => $value !== 0, + 'number'|'float' => $value !== 0 && $value !== 0.0, + + # For boolean values, '' is considered empty + 'bool','boolean' => !in_array($value, [false, 0], true), + + # For string values, '' is considered empty. + 'string' => $value === '', + + # For all the other types, any value at this point can be considered empty. + default => true + }; + } + + /** + * Take query parameter properties and turn it into an array suitable for + * native http_build_query or GuzzleHttp\Psr7\Query::build. + * + * @param mixed $value Parameter value + * @param string $paramName Parameter name + * @param string $openApiType OpenAPIType e.g. array or object + * @param string $style Parameter serialization style + * @param bool $explode Parameter explode option + * @param bool $required Whether query param is required or not + * + * @return array + */ + public static function toQueryValue( + mixed $value, + string $paramName, + string $openApiType = 'string', + string $style = 'form', + bool $explode = true, + bool $required = true + ): array { + + # Check if we should omit this parameter from the query. This should only happen when: + # - Parameter is NOT required; AND + # - its value is set to a value that is equivalent to "empty", depending on its OpenAPI type. For + # example, 0 as "int" or "boolean" is NOT an empty value. + if (self::isEmptyValue($value, $openApiType)) { + if ($required) { + return ["{$paramName}" => '']; + } else { + return []; + } + } + + # Handle DateTime objects in query + if($openApiType === "\DateTime" && $value instanceof DateTime) { + return ["{$paramName}" => $value->format(self::$dateTimeFormat)]; + } + + $query = []; + $value = (in_array($openApiType, ['object', 'array'], true)) ? (array)$value : $value; + + // since \GuzzleHttp\Psr7\Query::build fails with nested arrays + // need to flatten array first + $flattenArray = function ($arr, $name, &$result = []) use (&$flattenArray, $style, $explode) { + if (!is_array($arr)) return $arr; + + foreach ($arr as $k => $v) { + $prop = ($style === 'deepObject') ? "{$name}[{$k}]" : $k; + + if (is_array($v)) { + $flattenArray($v, $prop, $result); + } else { + if ($style !== 'deepObject' && !$explode) { + // push key itself + $result[] = $prop; + } + $result[$prop] = $v; + } + } + return $result; + }; + + $value = $flattenArray($value, $paramName); + + // https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#style-values + if ($openApiType === 'array' && $style === 'deepObject' && $explode) { + return $value; + } + + if ($openApiType === 'object' && ($style === 'deepObject' || $explode)) { + return $value; + } + + if ('boolean' === $openApiType && is_bool($value)) { + $value = self::convertBoolToQueryStringFormat($value); + } + + // handle style in serializeCollection + $query[$paramName] = ($explode) ? $value : self::serializeCollection((array)$value, $style); + + return $query; + } + + /** + * Convert boolean value to format for query string. + * + * @param bool $value Boolean value + * + * @return int|string Boolean value in format + */ + public static function convertBoolToQueryStringFormat(bool $value): int|string + { + if (Configuration::BOOLEAN_FORMAT_STRING == Configuration::getDefaultConfiguration()->getBooleanFormatForQueryString()) { + return $value ? 'true' : 'false'; + } + + return (int) $value; + } + + /** + * Take value and turn it into a string suitable for inclusion in + * the header. If it's a string, pass through unchanged + * If it's a datetime object, format it in ISO8601 + * + * @param string $value a string which will be part of the header + * + * @return string the header string + */ + public static function toHeaderValue(string $value): string + { + $callable = [$value, 'toHeaderValue']; + if (is_callable($callable)) { + return $callable(); + } + + return self::toString($value); + } + + /** + * Take value and turn it into a string suitable for inclusion in + * the parameter. If it's a string, pass through unchanged + * If it's a datetime object, format it in ISO8601 + * If it's a boolean, convert it to "true" or "false". + * + * @param string|bool|DateTime $value the value of the parameter + * + * @return string the header string + */ + public static function toString(string|bool|DateTime $value): string + { + if ($value instanceof DateTime) { // datetime in ISO8601 format + return $value->format(self::$dateTimeFormat); + } elseif (is_bool($value)) { + return $value ? 'true' : 'false'; + } else { + return (string) $value; + } + } + + /** + * Serialize an array to a string. + * + * @param array $collection collection to serialize to a string + * @param string $style the format use for serialization (csv, + * ssv, tsv, pipes, multi) + * @param bool $allowCollectionFormatMulti allow collection format to be a multidimensional array + * + * @return string + */ + public static function serializeCollection(array $collection, string $style, bool $allowCollectionFormatMulti = false): string + { + if ($allowCollectionFormatMulti && ('multi' === $style)) { + // http_build_query() almost does the job for us. We just + // need to fix the result of multidimensional arrays. + return preg_replace('/%5B[0-9]+%5D=/', '=', http_build_query($collection, '', '&')); + } + return match ($style) { + 'pipeDelimited', 'pipes' => implode('|', $collection), + 'tsv' => implode("\t", $collection), + 'spaceDelimited', 'ssv' => implode(' ', $collection), + default => implode(',', $collection), + }; + } + + /** + * Deserialize a JSON string into an object + * + * @param mixed $data object or primitive to be deserialized + * @param string $class class name is passed as a string + * @param string[]|null $httpHeaders HTTP headers + * + * @return mixed a single or an array of $class instances + */ + public static function deserialize(mixed $data, string $class, ?array $httpHeaders = null): mixed + { + if (null === $data) { + return null; + } + + if (strcasecmp(substr($class, -2), '[]') === 0) { + $data = is_string($data) ? json_decode($data) : $data; + + if (!is_array($data)) { + throw new \InvalidArgumentException("Invalid array '$class'"); + } + + $subClass = substr($class, 0, -2); + $values = []; + foreach ($data as $key => $value) { + $values[] = self::deserialize($value, $subClass, null); + } + return $values; + } + + if (preg_match('/^(array<|map\[)/', $class)) { // for associative array e.g. array + $data = is_string($data) ? json_decode($data) : $data; + settype($data, 'array'); + $inner = substr($class, 4, -1); + $deserialized = []; + if (strrpos($inner, ",") !== false) { + $subClass_array = explode(',', $inner, 2); + $subClass = $subClass_array[1]; + foreach ($data as $key => $value) { + $deserialized[$key] = self::deserialize($value, $subClass, null); + } + } + return $deserialized; + } + + if ($class === 'mixed') { + settype($data, gettype($data)); + return $data; + } + + if ($class === '\DateTime') { + // Some APIs return an invalid, empty string as a + // date-time property. DateTime::__construct() will return + // the current time for empty input which is probably not + // what is meant. The invalid empty string is probably to + // be interpreted as a missing field/value. Let's handle + // this graceful. + if (!empty($data)) { + try { + return new DateTime($data); + } catch (\Exception $exception) { + // Some APIs return a date-time with too high nanosecond + // precision for php's DateTime to handle. + // With provided regexp 6 digits of microseconds saved + return new DateTime(self::sanitizeTimestamp($data)); + } + } else { + return null; + } + } + + if ($class === '\Psr\Http\Message\StreamInterface') { + return Utils::streamFor($data); + } + + if ($class === '\SplFileObject') { + $data = Utils::streamFor($data); + + /** @var \Psr\Http\Message\StreamInterface $data */ + + // determine file name + if ( + is_array($httpHeaders) + && array_key_exists('Content-Disposition', $httpHeaders) + && preg_match('/inline; filename=[\'"]?([^\'"\s]+)[\'"]?$/i', $httpHeaders['Content-Disposition'], $match) + ) { + $filename = Configuration::getDefaultConfiguration()->getTempFolderPath() . DIRECTORY_SEPARATOR . self::sanitizeFilename($match[1]); + } else { + $filename = tempnam(Configuration::getDefaultConfiguration()->getTempFolderPath(), ''); + } + + $file = fopen($filename, 'w'); + while ($chunk = $data->read(200)) { + fwrite($file, $chunk); + } + fclose($file); + + return new \SplFileObject($filename, 'r'); + } + + /** @psalm-suppress ParadoxicalCondition */ + // handle primitive types + if (in_array($class, ['\DateTime', '\SplFileObject'], true)) { + return $data; + } elseif (in_array($class, ['array', 'bool', 'boolean', 'float', 'double', 'int', 'integer', 'object', 'string', 'null'], true)) { + // type ref: https://www.php.net/manual/en/function.settype.php + // byte, mixed, void in the old php client were removed + settype($data, $class); + return $data; + } + + + if (is_subclass_of($class, '\BackedEnum')) { + $data = $class::tryFrom($data); + if ($data === null) { + $imploded = implode("', '", array_map(fn($case) => $case->value, $class::cases())); + throw new \InvalidArgumentException("Invalid value for enum '$class', must be one of: '$imploded'"); + } + return $data; + } else { + $data = is_string($data) ? json_decode($data) : $data; + + if (is_array($data)) { + $data = (object)$data; + } + + // If a discriminator is defined and points to a valid subclass, use it. + $discriminator = $class::DISCRIMINATOR; + if (!empty($discriminator) && isset($data->{$discriminator}) && is_string($data->{$discriminator})) { + $subclass = '\lthn\Model\\' . $data->{$discriminator}; + if (is_subclass_of($subclass, $class)) { + $class = $subclass; + } + } + + /** @var ModelInterface $instance */ + $instance = new $class(); + foreach ($instance::openAPITypes() as $property => $type) { + $propertySetter = $instance::setters()[$property]; + + if (!isset($propertySetter)) { + continue; + } + + if (!isset($data->{$instance::attributeMap()[$property]})) { + if ($instance::isNullable($property)) { + $instance->$propertySetter(null); + } + + continue; + } + + if (isset($data->{$instance::attributeMap()[$property]})) { + $propertyValue = $data->{$instance::attributeMap()[$property]}; + $instance->$propertySetter(self::deserialize($propertyValue, $type, null)); + } + } + return $instance; + } + } + + /** + * 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). + * + * @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/utils/sdk/client/php/src/PerformanceModel.php b/utils/sdk/client/php/src/PerformanceModel.php new file mode 100644 index 00000000..9793bad5 --- /dev/null +++ b/utils/sdk/client/php/src/PerformanceModel.php @@ -0,0 +1,509 @@ + + */ +class PerformanceModel implements ModelInterface, ArrayAccess, JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = 'PerformanceModel'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPITypes = [ + 'block_processing' => '\lthn\lthn\BlockProcessingPerformanceModel', + 'tx_processing' => '\lthn\lthn\TxProcessingPerformanceModel', + 'tx_pool' => '\lthn\lthn\TxPoolPerformanceModel', + 'db_stat_info' => '\lthn\lthn\DbStatInfoModel' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPIFormats = [ + 'block_processing' => null, + 'tx_processing' => null, + 'tx_pool' => null, + 'db_stat_info' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'block_processing' => false, + 'tx_processing' => false, + 'tx_pool' => false, + 'db_stat_info' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes(): array + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats(): array + { + 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 array + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param array $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 array + */ + protected static array $attributeMap = [ + 'block_processing' => 'block_processing', + 'tx_processing' => 'tx_processing', + 'tx_pool' => 'tx_pool', + 'db_stat_info' => 'db_stat_info' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var array + */ + protected static array $setters = [ + 'block_processing' => 'setBlockProcessing', + 'tx_processing' => 'setTxProcessing', + 'tx_pool' => 'setTxPool', + 'db_stat_info' => 'setDbStatInfo' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var array + */ + protected static array $getters = [ + 'block_processing' => 'getBlockProcessing', + 'tx_processing' => 'getTxProcessing', + 'tx_pool' => 'getTxPool', + 'db_stat_info' => 'getDbStatInfo' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap(): array + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters(): array + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters(): array + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName(): string + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var array + */ + protected array $container = []; + + /** + * Constructor + * + * @param array $data Associated array of property values initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('block_processing', $data ?? [], null); + $this->setIfExists('tx_processing', $data ?? [], null); + $this->setIfExists('tx_pool', $data ?? [], null); + $this->setIfExists('db_stat_info', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, mixed $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 string[] invalid properties with reasons + */ + public function listInvalidProperties(): array + { + $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(): bool + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets block_processing + * + * @return \lthn\lthn\BlockProcessingPerformanceModel|null + */ + public function getBlockProcessing(): ?\lthn\lthn\BlockProcessingPerformanceModel + { + return $this->container['block_processing']; + } + + /** + * Sets block_processing + * + * @param \lthn\lthn\BlockProcessingPerformanceModel|null $block_processing block_processing + * + * @return $this + */ + public function setBlockProcessing(?\lthn\lthn\BlockProcessingPerformanceModel $block_processing): static + { + if (is_null($block_processing)) { + throw new InvalidArgumentException('non-nullable block_processing cannot be null'); + } + $this->container['block_processing'] = $block_processing; + + return $this; + } + + /** + * Gets tx_processing + * + * @return \lthn\lthn\TxProcessingPerformanceModel|null + */ + public function getTxProcessing(): ?\lthn\lthn\TxProcessingPerformanceModel + { + return $this->container['tx_processing']; + } + + /** + * Sets tx_processing + * + * @param \lthn\lthn\TxProcessingPerformanceModel|null $tx_processing tx_processing + * + * @return $this + */ + public function setTxProcessing(?\lthn\lthn\TxProcessingPerformanceModel $tx_processing): static + { + if (is_null($tx_processing)) { + throw new InvalidArgumentException('non-nullable tx_processing cannot be null'); + } + $this->container['tx_processing'] = $tx_processing; + + return $this; + } + + /** + * Gets tx_pool + * + * @return \lthn\lthn\TxPoolPerformanceModel|null + */ + public function getTxPool(): ?\lthn\lthn\TxPoolPerformanceModel + { + return $this->container['tx_pool']; + } + + /** + * Sets tx_pool + * + * @param \lthn\lthn\TxPoolPerformanceModel|null $tx_pool tx_pool + * + * @return $this + */ + public function setTxPool(?\lthn\lthn\TxPoolPerformanceModel $tx_pool): static + { + if (is_null($tx_pool)) { + throw new InvalidArgumentException('non-nullable tx_pool cannot be null'); + } + $this->container['tx_pool'] = $tx_pool; + + return $this; + } + + /** + * Gets db_stat_info + * + * @return \lthn\lthn\DbStatInfoModel|null + */ + public function getDbStatInfo(): ?\lthn\lthn\DbStatInfoModel + { + return $this->container['db_stat_info']; + } + + /** + * Sets db_stat_info + * + * @param \lthn\lthn\DbStatInfoModel|null $db_stat_info db_stat_info + * + * @return $this + */ + public function setDbStatInfo(?\lthn\lthn\DbStatInfoModel $db_stat_info): static + { + if (is_null($db_stat_info)) { + throw new InvalidArgumentException('non-nullable db_stat_info cannot be null'); + } + $this->container['db_stat_info'] = $db_stat_info; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists(mixed $offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[ReturnTypeWillChange] + public function offsetGet(mixed $offset): mixed + { + 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(mixed $offset, mixed $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(mixed $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(): mixed + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString(): string + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue(): string + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/utils/sdk/client/php/src/PosEntryModel.php b/utils/sdk/client/php/src/PosEntryModel.php new file mode 100644 index 00000000..62fe53d9 --- /dev/null +++ b/utils/sdk/client/php/src/PosEntryModel.php @@ -0,0 +1,645 @@ + + */ +class PosEntryModel implements ModelInterface, ArrayAccess, JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = 'PosEntryModel'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPITypes = [ + 'amount' => 'int', + 'g_index' => 'int', + 'keyimage' => 'string', + 'block_timestamp' => 'int', + 'stake_unlock_time' => 'int', + 'tx_id' => 'string', + 'tx_out_index' => 'int', + 'wallet_index' => 'int' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPIFormats = [ + 'amount' => null, + 'g_index' => null, + 'keyimage' => null, + 'block_timestamp' => null, + 'stake_unlock_time' => null, + 'tx_id' => null, + 'tx_out_index' => null, + 'wallet_index' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'amount' => false, + 'g_index' => false, + 'keyimage' => false, + 'block_timestamp' => false, + 'stake_unlock_time' => false, + 'tx_id' => false, + 'tx_out_index' => false, + 'wallet_index' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes(): array + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats(): array + { + 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 array + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param array $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 array + */ + protected static array $attributeMap = [ + 'amount' => 'amount', + 'g_index' => 'g_index', + 'keyimage' => 'keyimage', + 'block_timestamp' => 'block_timestamp', + 'stake_unlock_time' => 'stake_unlock_time', + 'tx_id' => 'tx_id', + 'tx_out_index' => 'tx_out_index', + 'wallet_index' => 'wallet_index' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var array + */ + protected static array $setters = [ + 'amount' => 'setAmount', + 'g_index' => 'setGIndex', + 'keyimage' => 'setKeyimage', + 'block_timestamp' => 'setBlockTimestamp', + 'stake_unlock_time' => 'setStakeUnlockTime', + 'tx_id' => 'setTxId', + 'tx_out_index' => 'setTxOutIndex', + 'wallet_index' => 'setWalletIndex' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var array + */ + protected static array $getters = [ + 'amount' => 'getAmount', + 'g_index' => 'getGIndex', + 'keyimage' => 'getKeyimage', + 'block_timestamp' => 'getBlockTimestamp', + 'stake_unlock_time' => 'getStakeUnlockTime', + 'tx_id' => 'getTxId', + 'tx_out_index' => 'getTxOutIndex', + 'wallet_index' => 'getWalletIndex' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap(): array + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters(): array + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters(): array + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName(): string + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var array + */ + protected array $container = []; + + /** + * Constructor + * + * @param array $data Associated array of property values initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('amount', $data ?? [], null); + $this->setIfExists('g_index', $data ?? [], null); + $this->setIfExists('keyimage', $data ?? [], null); + $this->setIfExists('block_timestamp', $data ?? [], null); + $this->setIfExists('stake_unlock_time', $data ?? [], null); + $this->setIfExists('tx_id', $data ?? [], null); + $this->setIfExists('tx_out_index', $data ?? [], null); + $this->setIfExists('wallet_index', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, mixed $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 string[] invalid properties with reasons + */ + public function listInvalidProperties(): array + { + $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(): bool + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets amount + * + * @return int|null + */ + public function getAmount(): ?int + { + return $this->container['amount']; + } + + /** + * Sets amount + * + * @param int|null $amount amount + * + * @return $this + */ + public function setAmount(?int $amount): static + { + if (is_null($amount)) { + throw new InvalidArgumentException('non-nullable amount cannot be null'); + } + $this->container['amount'] = $amount; + + return $this; + } + + /** + * Gets g_index + * + * @return int|null + */ + public function getGIndex(): ?int + { + return $this->container['g_index']; + } + + /** + * Sets g_index + * + * @param int|null $g_index g_index + * + * @return $this + */ + public function setGIndex(?int $g_index): static + { + if (is_null($g_index)) { + throw new InvalidArgumentException('non-nullable g_index cannot be null'); + } + $this->container['g_index'] = $g_index; + + return $this; + } + + /** + * Gets keyimage + * + * @return string|null + */ + public function getKeyimage(): ?string + { + return $this->container['keyimage']; + } + + /** + * Sets keyimage + * + * @param string|null $keyimage keyimage + * + * @return $this + */ + public function setKeyimage(?string $keyimage): static + { + if (is_null($keyimage)) { + throw new InvalidArgumentException('non-nullable keyimage cannot be null'); + } + $this->container['keyimage'] = $keyimage; + + return $this; + } + + /** + * Gets block_timestamp + * + * @return int|null + */ + public function getBlockTimestamp(): ?int + { + return $this->container['block_timestamp']; + } + + /** + * Sets block_timestamp + * + * @param int|null $block_timestamp block_timestamp + * + * @return $this + */ + public function setBlockTimestamp(?int $block_timestamp): static + { + if (is_null($block_timestamp)) { + throw new InvalidArgumentException('non-nullable block_timestamp cannot be null'); + } + $this->container['block_timestamp'] = $block_timestamp; + + return $this; + } + + /** + * Gets stake_unlock_time + * + * @return int|null + */ + public function getStakeUnlockTime(): ?int + { + return $this->container['stake_unlock_time']; + } + + /** + * Sets stake_unlock_time + * + * @param int|null $stake_unlock_time stake_unlock_time + * + * @return $this + */ + public function setStakeUnlockTime(?int $stake_unlock_time): static + { + if (is_null($stake_unlock_time)) { + throw new InvalidArgumentException('non-nullable stake_unlock_time cannot be null'); + } + $this->container['stake_unlock_time'] = $stake_unlock_time; + + return $this; + } + + /** + * Gets tx_id + * + * @return string|null + */ + public function getTxId(): ?string + { + return $this->container['tx_id']; + } + + /** + * Sets tx_id + * + * @param string|null $tx_id tx_id + * + * @return $this + */ + public function setTxId(?string $tx_id): static + { + if (is_null($tx_id)) { + throw new InvalidArgumentException('non-nullable tx_id cannot be null'); + } + $this->container['tx_id'] = $tx_id; + + return $this; + } + + /** + * Gets tx_out_index + * + * @return int|null + */ + public function getTxOutIndex(): ?int + { + return $this->container['tx_out_index']; + } + + /** + * Sets tx_out_index + * + * @param int|null $tx_out_index tx_out_index + * + * @return $this + */ + public function setTxOutIndex(?int $tx_out_index): static + { + if (is_null($tx_out_index)) { + throw new InvalidArgumentException('non-nullable tx_out_index cannot be null'); + } + $this->container['tx_out_index'] = $tx_out_index; + + return $this; + } + + /** + * Gets wallet_index + * + * @return int|null + */ + public function getWalletIndex(): ?int + { + return $this->container['wallet_index']; + } + + /** + * Sets wallet_index + * + * @param int|null $wallet_index wallet_index + * + * @return $this + */ + public function setWalletIndex(?int $wallet_index): static + { + if (is_null($wallet_index)) { + throw new InvalidArgumentException('non-nullable wallet_index cannot be null'); + } + $this->container['wallet_index'] = $wallet_index; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists(mixed $offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[ReturnTypeWillChange] + public function offsetGet(mixed $offset): mixed + { + 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(mixed $offset, mixed $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(mixed $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(): mixed + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString(): string + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue(): string + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/utils/sdk/client/php/src/SubmitBlockRequestModel.php b/utils/sdk/client/php/src/SubmitBlockRequestModel.php new file mode 100644 index 00000000..1e3c3c33 --- /dev/null +++ b/utils/sdk/client/php/src/SubmitBlockRequestModel.php @@ -0,0 +1,407 @@ + + */ +class SubmitBlockRequestModel implements ModelInterface, ArrayAccess, JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = 'SubmitBlockRequestModel'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPITypes = [ + 'block_blob' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPIFormats = [ + 'block_blob' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'block_blob' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes(): array + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats(): array + { + 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 array + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param array $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 array + */ + protected static array $attributeMap = [ + 'block_blob' => 'block_blob' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var array + */ + protected static array $setters = [ + 'block_blob' => 'setBlockBlob' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var array + */ + protected static array $getters = [ + 'block_blob' => 'getBlockBlob' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap(): array + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters(): array + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters(): array + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName(): string + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var array + */ + protected array $container = []; + + /** + * Constructor + * + * @param array $data Associated array of property values initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('block_blob', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, mixed $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 string[] invalid properties with reasons + */ + public function listInvalidProperties(): array + { + $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(): bool + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets block_blob + * + * @return string|null + */ + public function getBlockBlob(): ?string + { + return $this->container['block_blob']; + } + + /** + * Sets block_blob + * + * @param string|null $block_blob block_blob + * + * @return $this + */ + public function setBlockBlob(?string $block_blob): static + { + if (is_null($block_blob)) { + throw new InvalidArgumentException('non-nullable block_blob cannot be null'); + } + $this->container['block_blob'] = $block_blob; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists(mixed $offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[ReturnTypeWillChange] + public function offsetGet(mixed $offset): mixed + { + 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(mixed $offset, mixed $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(mixed $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(): mixed + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString(): string + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue(): string + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/utils/sdk/client/php/src/SubmitBlockResponseModel.php b/utils/sdk/client/php/src/SubmitBlockResponseModel.php new file mode 100644 index 00000000..5c68cdfb --- /dev/null +++ b/utils/sdk/client/php/src/SubmitBlockResponseModel.php @@ -0,0 +1,407 @@ + + */ +class SubmitBlockResponseModel implements ModelInterface, ArrayAccess, JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = 'SubmitBlockResponseModel'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPITypes = [ + 'status' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPIFormats = [ + 'status' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'status' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes(): array + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats(): array + { + 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 array + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param array $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 array + */ + protected static array $attributeMap = [ + 'status' => 'status' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var array + */ + protected static array $setters = [ + 'status' => 'setStatus' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var array + */ + protected static array $getters = [ + 'status' => 'getStatus' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap(): array + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters(): array + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters(): array + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName(): string + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var array + */ + protected array $container = []; + + /** + * Constructor + * + * @param array $data Associated array of property values initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('status', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, mixed $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 string[] invalid properties with reasons + */ + public function listInvalidProperties(): array + { + $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(): bool + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets status + * + * @return string|null + */ + public function getStatus(): ?string + { + return $this->container['status']; + } + + /** + * Sets status + * + * @param string|null $status status + * + * @return $this + */ + public function setStatus(?string $status): static + { + if (is_null($status)) { + throw new InvalidArgumentException('non-nullable status cannot be null'); + } + $this->container['status'] = $status; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists(mixed $offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[ReturnTypeWillChange] + public function offsetGet(mixed $offset): mixed + { + 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(mixed $offset, mixed $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(mixed $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(): mixed + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString(): string + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue(): string + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/utils/sdk/client/php/src/TransactionAttachmentModel.php b/utils/sdk/client/php/src/TransactionAttachmentModel.php new file mode 100644 index 00000000..8341b0b3 --- /dev/null +++ b/utils/sdk/client/php/src/TransactionAttachmentModel.php @@ -0,0 +1,475 @@ + + */ +class TransactionAttachmentModel implements ModelInterface, ArrayAccess, JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = 'TransactionAttachmentModel'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPITypes = [ + 'type' => 'string', + 'short_view' => 'string', + 'details_view' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPIFormats = [ + 'type' => null, + 'short_view' => null, + 'details_view' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'type' => false, + 'short_view' => false, + 'details_view' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes(): array + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats(): array + { + 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 array + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param array $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 array + */ + protected static array $attributeMap = [ + 'type' => 'type', + 'short_view' => 'short_view', + 'details_view' => 'details_view' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var array + */ + protected static array $setters = [ + 'type' => 'setType', + 'short_view' => 'setShortView', + 'details_view' => 'setDetailsView' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var array + */ + protected static array $getters = [ + 'type' => 'getType', + 'short_view' => 'getShortView', + 'details_view' => 'getDetailsView' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap(): array + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters(): array + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters(): array + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName(): string + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var array + */ + protected array $container = []; + + /** + * Constructor + * + * @param array $data Associated array of property values initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('type', $data ?? [], null); + $this->setIfExists('short_view', $data ?? [], null); + $this->setIfExists('details_view', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, mixed $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 string[] invalid properties with reasons + */ + public function listInvalidProperties(): array + { + $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(): bool + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets type + * + * @return string|null + */ + public function getType(): ?string + { + return $this->container['type']; + } + + /** + * Sets type + * + * @param string|null $type type + * + * @return $this + */ + public function setType(?string $type): static + { + if (is_null($type)) { + throw new InvalidArgumentException('non-nullable type cannot be null'); + } + $this->container['type'] = $type; + + return $this; + } + + /** + * Gets short_view + * + * @return string|null + */ + public function getShortView(): ?string + { + return $this->container['short_view']; + } + + /** + * Sets short_view + * + * @param string|null $short_view short_view + * + * @return $this + */ + public function setShortView(?string $short_view): static + { + if (is_null($short_view)) { + throw new InvalidArgumentException('non-nullable short_view cannot be null'); + } + $this->container['short_view'] = $short_view; + + return $this; + } + + /** + * Gets details_view + * + * @return string|null + */ + public function getDetailsView(): ?string + { + return $this->container['details_view']; + } + + /** + * Sets details_view + * + * @param string|null $details_view details_view + * + * @return $this + */ + public function setDetailsView(?string $details_view): static + { + if (is_null($details_view)) { + throw new InvalidArgumentException('non-nullable details_view cannot be null'); + } + $this->container['details_view'] = $details_view; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists(mixed $offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[ReturnTypeWillChange] + public function offsetGet(mixed $offset): mixed + { + 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(mixed $offset, mixed $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(mixed $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(): mixed + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString(): string + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue(): string + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/utils/sdk/client/php/src/TransactionDetailsModel.php b/utils/sdk/client/php/src/TransactionDetailsModel.php new file mode 100644 index 00000000..eabe8510 --- /dev/null +++ b/utils/sdk/client/php/src/TransactionDetailsModel.php @@ -0,0 +1,815 @@ + + */ +class TransactionDetailsModel implements ModelInterface, ArrayAccess, JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = 'TransactionDetailsModel'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPITypes = [ + 'amount' => 'int', + 'attachments' => '\lthn\lthn\TransactionAttachmentModel[]', + 'blob' => 'string', + 'blob_size' => 'int', + 'extra' => '\lthn\lthn\TransactionExtraModel[]', + 'fee' => 'int', + 'id' => 'string', + 'ins' => '\lthn\lthn\TransactionInputModel[]', + 'keeper_block' => 'int', + 'object_in_json' => 'string', + 'outs' => '\lthn\lthn\TransactionOutputModel[]', + 'pub_key' => 'string', + 'timestamp' => 'int' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPIFormats = [ + 'amount' => null, + 'attachments' => null, + 'blob' => null, + 'blob_size' => null, + 'extra' => null, + 'fee' => null, + 'id' => null, + 'ins' => null, + 'keeper_block' => 'int64', + 'object_in_json' => null, + 'outs' => null, + 'pub_key' => null, + 'timestamp' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'amount' => false, + 'attachments' => false, + 'blob' => false, + 'blob_size' => false, + 'extra' => false, + 'fee' => false, + 'id' => false, + 'ins' => false, + 'keeper_block' => false, + 'object_in_json' => false, + 'outs' => false, + 'pub_key' => false, + 'timestamp' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes(): array + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats(): array + { + 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 array + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param array $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 array + */ + protected static array $attributeMap = [ + 'amount' => 'amount', + 'attachments' => 'attachments', + 'blob' => 'blob', + 'blob_size' => 'blob_size', + 'extra' => 'extra', + 'fee' => 'fee', + 'id' => 'id', + 'ins' => 'ins', + 'keeper_block' => 'keeper_block', + 'object_in_json' => 'object_in_json', + 'outs' => 'outs', + 'pub_key' => 'pub_key', + 'timestamp' => 'timestamp' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var array + */ + protected static array $setters = [ + 'amount' => 'setAmount', + 'attachments' => 'setAttachments', + 'blob' => 'setBlob', + 'blob_size' => 'setBlobSize', + 'extra' => 'setExtra', + 'fee' => 'setFee', + 'id' => 'setId', + 'ins' => 'setIns', + 'keeper_block' => 'setKeeperBlock', + 'object_in_json' => 'setObjectInJson', + 'outs' => 'setOuts', + 'pub_key' => 'setPubKey', + 'timestamp' => 'setTimestamp' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var array + */ + protected static array $getters = [ + 'amount' => 'getAmount', + 'attachments' => 'getAttachments', + 'blob' => 'getBlob', + 'blob_size' => 'getBlobSize', + 'extra' => 'getExtra', + 'fee' => 'getFee', + 'id' => 'getId', + 'ins' => 'getIns', + 'keeper_block' => 'getKeeperBlock', + 'object_in_json' => 'getObjectInJson', + 'outs' => 'getOuts', + 'pub_key' => 'getPubKey', + 'timestamp' => 'getTimestamp' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap(): array + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters(): array + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters(): array + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName(): string + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var array + */ + protected array $container = []; + + /** + * Constructor + * + * @param array $data Associated array of property values initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('amount', $data ?? [], null); + $this->setIfExists('attachments', $data ?? [], null); + $this->setIfExists('blob', $data ?? [], null); + $this->setIfExists('blob_size', $data ?? [], null); + $this->setIfExists('extra', $data ?? [], null); + $this->setIfExists('fee', $data ?? [], null); + $this->setIfExists('id', $data ?? [], null); + $this->setIfExists('ins', $data ?? [], null); + $this->setIfExists('keeper_block', $data ?? [], null); + $this->setIfExists('object_in_json', $data ?? [], null); + $this->setIfExists('outs', $data ?? [], null); + $this->setIfExists('pub_key', $data ?? [], null); + $this->setIfExists('timestamp', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, mixed $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 string[] invalid properties with reasons + */ + public function listInvalidProperties(): array + { + $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(): bool + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets amount + * + * @return int|null + */ + public function getAmount(): ?int + { + return $this->container['amount']; + } + + /** + * Sets amount + * + * @param int|null $amount amount + * + * @return $this + */ + public function setAmount(?int $amount): static + { + if (is_null($amount)) { + throw new InvalidArgumentException('non-nullable amount cannot be null'); + } + $this->container['amount'] = $amount; + + return $this; + } + + /** + * Gets attachments + * + * @return \lthn\lthn\TransactionAttachmentModel[]|null + */ + public function getAttachments(): ?array + { + return $this->container['attachments']; + } + + /** + * Sets attachments + * + * @param \lthn\lthn\TransactionAttachmentModel[]|null $attachments attachments + * + * @return $this + */ + public function setAttachments(?array $attachments): static + { + if (is_null($attachments)) { + throw new InvalidArgumentException('non-nullable attachments cannot be null'); + } + $this->container['attachments'] = $attachments; + + return $this; + } + + /** + * Gets blob + * + * @return string|null + */ + public function getBlob(): ?string + { + return $this->container['blob']; + } + + /** + * Sets blob + * + * @param string|null $blob blob + * + * @return $this + */ + public function setBlob(?string $blob): static + { + if (is_null($blob)) { + throw new InvalidArgumentException('non-nullable blob cannot be null'); + } + $this->container['blob'] = $blob; + + return $this; + } + + /** + * Gets blob_size + * + * @return int|null + */ + public function getBlobSize(): ?int + { + return $this->container['blob_size']; + } + + /** + * Sets blob_size + * + * @param int|null $blob_size blob_size + * + * @return $this + */ + public function setBlobSize(?int $blob_size): static + { + if (is_null($blob_size)) { + throw new InvalidArgumentException('non-nullable blob_size cannot be null'); + } + $this->container['blob_size'] = $blob_size; + + return $this; + } + + /** + * Gets extra + * + * @return \lthn\lthn\TransactionExtraModel[]|null + */ + public function getExtra(): ?array + { + return $this->container['extra']; + } + + /** + * Sets extra + * + * @param \lthn\lthn\TransactionExtraModel[]|null $extra extra + * + * @return $this + */ + public function setExtra(?array $extra): static + { + if (is_null($extra)) { + throw new InvalidArgumentException('non-nullable extra cannot be null'); + } + $this->container['extra'] = $extra; + + return $this; + } + + /** + * Gets fee + * + * @return int|null + */ + public function getFee(): ?int + { + return $this->container['fee']; + } + + /** + * Sets fee + * + * @param int|null $fee fee + * + * @return $this + */ + public function setFee(?int $fee): static + { + if (is_null($fee)) { + throw new InvalidArgumentException('non-nullable fee cannot be null'); + } + $this->container['fee'] = $fee; + + return $this; + } + + /** + * Gets id + * + * @return string|null + */ + public function getId(): ?string + { + return $this->container['id']; + } + + /** + * Sets id + * + * @param string|null $id id + * + * @return $this + */ + public function setId(?string $id): static + { + if (is_null($id)) { + throw new InvalidArgumentException('non-nullable id cannot be null'); + } + $this->container['id'] = $id; + + return $this; + } + + /** + * Gets ins + * + * @return \lthn\lthn\TransactionInputModel[]|null + */ + public function getIns(): ?array + { + return $this->container['ins']; + } + + /** + * Sets ins + * + * @param \lthn\lthn\TransactionInputModel[]|null $ins ins + * + * @return $this + */ + public function setIns(?array $ins): static + { + if (is_null($ins)) { + throw new InvalidArgumentException('non-nullable ins cannot be null'); + } + $this->container['ins'] = $ins; + + return $this; + } + + /** + * Gets keeper_block + * + * @return int|null + */ + public function getKeeperBlock(): ?int + { + return $this->container['keeper_block']; + } + + /** + * Sets keeper_block + * + * @param int|null $keeper_block keeper_block + * + * @return $this + */ + public function setKeeperBlock(?int $keeper_block): static + { + if (is_null($keeper_block)) { + throw new InvalidArgumentException('non-nullable keeper_block cannot be null'); + } + $this->container['keeper_block'] = $keeper_block; + + return $this; + } + + /** + * Gets object_in_json + * + * @return string|null + */ + public function getObjectInJson(): ?string + { + return $this->container['object_in_json']; + } + + /** + * Sets object_in_json + * + * @param string|null $object_in_json object_in_json + * + * @return $this + */ + public function setObjectInJson(?string $object_in_json): static + { + if (is_null($object_in_json)) { + throw new InvalidArgumentException('non-nullable object_in_json cannot be null'); + } + $this->container['object_in_json'] = $object_in_json; + + return $this; + } + + /** + * Gets outs + * + * @return \lthn\lthn\TransactionOutputModel[]|null + */ + public function getOuts(): ?array + { + return $this->container['outs']; + } + + /** + * Sets outs + * + * @param \lthn\lthn\TransactionOutputModel[]|null $outs outs + * + * @return $this + */ + public function setOuts(?array $outs): static + { + if (is_null($outs)) { + throw new InvalidArgumentException('non-nullable outs cannot be null'); + } + $this->container['outs'] = $outs; + + return $this; + } + + /** + * Gets pub_key + * + * @return string|null + */ + public function getPubKey(): ?string + { + return $this->container['pub_key']; + } + + /** + * Sets pub_key + * + * @param string|null $pub_key pub_key + * + * @return $this + */ + public function setPubKey(?string $pub_key): static + { + if (is_null($pub_key)) { + throw new InvalidArgumentException('non-nullable pub_key cannot be null'); + } + $this->container['pub_key'] = $pub_key; + + return $this; + } + + /** + * Gets timestamp + * + * @return int|null + */ + public function getTimestamp(): ?int + { + return $this->container['timestamp']; + } + + /** + * Sets timestamp + * + * @param int|null $timestamp timestamp + * + * @return $this + */ + public function setTimestamp(?int $timestamp): static + { + if (is_null($timestamp)) { + throw new InvalidArgumentException('non-nullable timestamp cannot be null'); + } + $this->container['timestamp'] = $timestamp; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists(mixed $offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[ReturnTypeWillChange] + public function offsetGet(mixed $offset): mixed + { + 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(mixed $offset, mixed $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(mixed $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(): mixed + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString(): string + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue(): string + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/utils/sdk/client/php/src/TransactionExtraModel.php b/utils/sdk/client/php/src/TransactionExtraModel.php new file mode 100644 index 00000000..e8b8dbde --- /dev/null +++ b/utils/sdk/client/php/src/TransactionExtraModel.php @@ -0,0 +1,475 @@ + + */ +class TransactionExtraModel implements ModelInterface, ArrayAccess, JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = 'TransactionExtraModel'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPITypes = [ + 'type' => 'string', + 'short_view' => 'string', + 'details_view' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPIFormats = [ + 'type' => null, + 'short_view' => null, + 'details_view' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'type' => false, + 'short_view' => false, + 'details_view' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes(): array + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats(): array + { + 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 array + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param array $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 array + */ + protected static array $attributeMap = [ + 'type' => 'type', + 'short_view' => 'short_view', + 'details_view' => 'details_view' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var array + */ + protected static array $setters = [ + 'type' => 'setType', + 'short_view' => 'setShortView', + 'details_view' => 'setDetailsView' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var array + */ + protected static array $getters = [ + 'type' => 'getType', + 'short_view' => 'getShortView', + 'details_view' => 'getDetailsView' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap(): array + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters(): array + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters(): array + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName(): string + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var array + */ + protected array $container = []; + + /** + * Constructor + * + * @param array $data Associated array of property values initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('type', $data ?? [], null); + $this->setIfExists('short_view', $data ?? [], null); + $this->setIfExists('details_view', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, mixed $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 string[] invalid properties with reasons + */ + public function listInvalidProperties(): array + { + $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(): bool + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets type + * + * @return string|null + */ + public function getType(): ?string + { + return $this->container['type']; + } + + /** + * Sets type + * + * @param string|null $type type + * + * @return $this + */ + public function setType(?string $type): static + { + if (is_null($type)) { + throw new InvalidArgumentException('non-nullable type cannot be null'); + } + $this->container['type'] = $type; + + return $this; + } + + /** + * Gets short_view + * + * @return string|null + */ + public function getShortView(): ?string + { + return $this->container['short_view']; + } + + /** + * Sets short_view + * + * @param string|null $short_view short_view + * + * @return $this + */ + public function setShortView(?string $short_view): static + { + if (is_null($short_view)) { + throw new InvalidArgumentException('non-nullable short_view cannot be null'); + } + $this->container['short_view'] = $short_view; + + return $this; + } + + /** + * Gets details_view + * + * @return string|null + */ + public function getDetailsView(): ?string + { + return $this->container['details_view']; + } + + /** + * Sets details_view + * + * @param string|null $details_view details_view + * + * @return $this + */ + public function setDetailsView(?string $details_view): static + { + if (is_null($details_view)) { + throw new InvalidArgumentException('non-nullable details_view cannot be null'); + } + $this->container['details_view'] = $details_view; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists(mixed $offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[ReturnTypeWillChange] + public function offsetGet(mixed $offset): mixed + { + 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(mixed $offset, mixed $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(mixed $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(): mixed + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString(): string + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue(): string + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/utils/sdk/client/php/src/TransactionInputModel.php b/utils/sdk/client/php/src/TransactionInputModel.php new file mode 100644 index 00000000..2e3921f7 --- /dev/null +++ b/utils/sdk/client/php/src/TransactionInputModel.php @@ -0,0 +1,559 @@ + + */ +class TransactionInputModel implements ModelInterface, ArrayAccess, JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = 'TransactionInputModel'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPITypes = [ + 'amount' => 'int', + 'global_indexes' => 'int[]', + 'htlc_origin' => 'string', + 'kimage_or_ms_id' => 'string', + 'multisig_count' => 'int' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPIFormats = [ + 'amount' => null, + 'global_indexes' => null, + 'htlc_origin' => null, + 'kimage_or_ms_id' => null, + 'multisig_count' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'amount' => false, + 'global_indexes' => false, + 'htlc_origin' => false, + 'kimage_or_ms_id' => false, + 'multisig_count' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes(): array + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats(): array + { + 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 array + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param array $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 array + */ + protected static array $attributeMap = [ + 'amount' => 'amount', + 'global_indexes' => 'global_indexes', + 'htlc_origin' => 'htlc_origin', + 'kimage_or_ms_id' => 'kimage_or_ms_id', + 'multisig_count' => 'multisig_count' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var array + */ + protected static array $setters = [ + 'amount' => 'setAmount', + 'global_indexes' => 'setGlobalIndexes', + 'htlc_origin' => 'setHtlcOrigin', + 'kimage_or_ms_id' => 'setKimageOrMsId', + 'multisig_count' => 'setMultisigCount' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var array + */ + protected static array $getters = [ + 'amount' => 'getAmount', + 'global_indexes' => 'getGlobalIndexes', + 'htlc_origin' => 'getHtlcOrigin', + 'kimage_or_ms_id' => 'getKimageOrMsId', + 'multisig_count' => 'getMultisigCount' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap(): array + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters(): array + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters(): array + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName(): string + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var array + */ + protected array $container = []; + + /** + * Constructor + * + * @param array $data Associated array of property values initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('amount', $data ?? [], null); + $this->setIfExists('global_indexes', $data ?? [], null); + $this->setIfExists('htlc_origin', $data ?? [], null); + $this->setIfExists('kimage_or_ms_id', $data ?? [], null); + $this->setIfExists('multisig_count', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, mixed $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 string[] invalid properties with reasons + */ + public function listInvalidProperties(): array + { + $invalidProperties = []; + + if (!is_null($this->container['multisig_count']) && ($this->container['multisig_count'] > 4294967295)) { + $invalidProperties[] = "invalid value for 'multisig_count', must be smaller than or equal to 4294967295."; + } + + if (!is_null($this->container['multisig_count']) && ($this->container['multisig_count'] < 0)) { + $invalidProperties[] = "invalid value for 'multisig_count', must be bigger than or equal to 0."; + } + + 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(): bool + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets amount + * + * @return int|null + */ + public function getAmount(): ?int + { + return $this->container['amount']; + } + + /** + * Sets amount + * + * @param int|null $amount amount + * + * @return $this + */ + public function setAmount(?int $amount): static + { + if (is_null($amount)) { + throw new InvalidArgumentException('non-nullable amount cannot be null'); + } + $this->container['amount'] = $amount; + + return $this; + } + + /** + * Gets global_indexes + * + * @return int[]|null + */ + public function getGlobalIndexes(): ?array + { + return $this->container['global_indexes']; + } + + /** + * Sets global_indexes + * + * @param int[]|null $global_indexes global_indexes + * + * @return $this + */ + public function setGlobalIndexes(?array $global_indexes): static + { + if (is_null($global_indexes)) { + throw new InvalidArgumentException('non-nullable global_indexes cannot be null'); + } + $this->container['global_indexes'] = $global_indexes; + + return $this; + } + + /** + * Gets htlc_origin + * + * @return string|null + */ + public function getHtlcOrigin(): ?string + { + return $this->container['htlc_origin']; + } + + /** + * Sets htlc_origin + * + * @param string|null $htlc_origin htlc_origin + * + * @return $this + */ + public function setHtlcOrigin(?string $htlc_origin): static + { + if (is_null($htlc_origin)) { + throw new InvalidArgumentException('non-nullable htlc_origin cannot be null'); + } + $this->container['htlc_origin'] = $htlc_origin; + + return $this; + } + + /** + * Gets kimage_or_ms_id + * + * @return string|null + */ + public function getKimageOrMsId(): ?string + { + return $this->container['kimage_or_ms_id']; + } + + /** + * Sets kimage_or_ms_id + * + * @param string|null $kimage_or_ms_id kimage_or_ms_id + * + * @return $this + */ + public function setKimageOrMsId(?string $kimage_or_ms_id): static + { + if (is_null($kimage_or_ms_id)) { + throw new InvalidArgumentException('non-nullable kimage_or_ms_id cannot be null'); + } + $this->container['kimage_or_ms_id'] = $kimage_or_ms_id; + + return $this; + } + + /** + * Gets multisig_count + * + * @return int|null + */ + public function getMultisigCount(): ?int + { + return $this->container['multisig_count']; + } + + /** + * Sets multisig_count + * + * @param int|null $multisig_count multisig_count + * + * @return $this + */ + public function setMultisigCount(?int $multisig_count): static + { + if (is_null($multisig_count)) { + throw new InvalidArgumentException('non-nullable multisig_count cannot be null'); + } + + if (($multisig_count > 4294967295)) { + throw new InvalidArgumentException('invalid value for $multisig_count when calling TransactionInputModel., must be smaller than or equal to 4294967295.'); + } + if (($multisig_count < 0)) { + throw new InvalidArgumentException('invalid value for $multisig_count when calling TransactionInputModel., must be bigger than or equal to 0.'); + } + + $this->container['multisig_count'] = $multisig_count; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists(mixed $offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[ReturnTypeWillChange] + public function offsetGet(mixed $offset): mixed + { + 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(mixed $offset, mixed $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(mixed $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(): mixed + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString(): string + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue(): string + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/utils/sdk/client/php/src/TransactionOutputModel.php b/utils/sdk/client/php/src/TransactionOutputModel.php new file mode 100644 index 00000000..31953c22 --- /dev/null +++ b/utils/sdk/client/php/src/TransactionOutputModel.php @@ -0,0 +1,559 @@ + + */ +class TransactionOutputModel implements ModelInterface, ArrayAccess, JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = 'TransactionOutputModel'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPITypes = [ + 'amount' => 'int', + 'global_index' => 'int', + 'is_spent' => 'bool', + 'minimum_sigs' => 'int', + 'pub_keys' => 'string[]' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPIFormats = [ + 'amount' => null, + 'global_index' => null, + 'is_spent' => null, + 'minimum_sigs' => null, + 'pub_keys' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'amount' => false, + 'global_index' => false, + 'is_spent' => false, + 'minimum_sigs' => false, + 'pub_keys' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes(): array + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats(): array + { + 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 array + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param array $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 array + */ + protected static array $attributeMap = [ + 'amount' => 'amount', + 'global_index' => 'global_index', + 'is_spent' => 'is_spent', + 'minimum_sigs' => 'minimum_sigs', + 'pub_keys' => 'pub_keys' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var array + */ + protected static array $setters = [ + 'amount' => 'setAmount', + 'global_index' => 'setGlobalIndex', + 'is_spent' => 'setIsSpent', + 'minimum_sigs' => 'setMinimumSigs', + 'pub_keys' => 'setPubKeys' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var array + */ + protected static array $getters = [ + 'amount' => 'getAmount', + 'global_index' => 'getGlobalIndex', + 'is_spent' => 'getIsSpent', + 'minimum_sigs' => 'getMinimumSigs', + 'pub_keys' => 'getPubKeys' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap(): array + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters(): array + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters(): array + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName(): string + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var array + */ + protected array $container = []; + + /** + * Constructor + * + * @param array $data Associated array of property values initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('amount', $data ?? [], null); + $this->setIfExists('global_index', $data ?? [], null); + $this->setIfExists('is_spent', $data ?? [], null); + $this->setIfExists('minimum_sigs', $data ?? [], null); + $this->setIfExists('pub_keys', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, mixed $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 string[] invalid properties with reasons + */ + public function listInvalidProperties(): array + { + $invalidProperties = []; + + if (!is_null($this->container['minimum_sigs']) && ($this->container['minimum_sigs'] > 4294967295)) { + $invalidProperties[] = "invalid value for 'minimum_sigs', must be smaller than or equal to 4294967295."; + } + + if (!is_null($this->container['minimum_sigs']) && ($this->container['minimum_sigs'] < 0)) { + $invalidProperties[] = "invalid value for 'minimum_sigs', must be bigger than or equal to 0."; + } + + 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(): bool + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets amount + * + * @return int|null + */ + public function getAmount(): ?int + { + return $this->container['amount']; + } + + /** + * Sets amount + * + * @param int|null $amount amount + * + * @return $this + */ + public function setAmount(?int $amount): static + { + if (is_null($amount)) { + throw new InvalidArgumentException('non-nullable amount cannot be null'); + } + $this->container['amount'] = $amount; + + return $this; + } + + /** + * Gets global_index + * + * @return int|null + */ + public function getGlobalIndex(): ?int + { + return $this->container['global_index']; + } + + /** + * Sets global_index + * + * @param int|null $global_index global_index + * + * @return $this + */ + public function setGlobalIndex(?int $global_index): static + { + if (is_null($global_index)) { + throw new InvalidArgumentException('non-nullable global_index cannot be null'); + } + $this->container['global_index'] = $global_index; + + return $this; + } + + /** + * Gets is_spent + * + * @return bool|null + */ + public function getIsSpent(): ?bool + { + return $this->container['is_spent']; + } + + /** + * Sets is_spent + * + * @param bool|null $is_spent is_spent + * + * @return $this + */ + public function setIsSpent(?bool $is_spent): static + { + if (is_null($is_spent)) { + throw new InvalidArgumentException('non-nullable is_spent cannot be null'); + } + $this->container['is_spent'] = $is_spent; + + return $this; + } + + /** + * Gets minimum_sigs + * + * @return int|null + */ + public function getMinimumSigs(): ?int + { + return $this->container['minimum_sigs']; + } + + /** + * Sets minimum_sigs + * + * @param int|null $minimum_sigs minimum_sigs + * + * @return $this + */ + public function setMinimumSigs(?int $minimum_sigs): static + { + if (is_null($minimum_sigs)) { + throw new InvalidArgumentException('non-nullable minimum_sigs cannot be null'); + } + + if (($minimum_sigs > 4294967295)) { + throw new InvalidArgumentException('invalid value for $minimum_sigs when calling TransactionOutputModel., must be smaller than or equal to 4294967295.'); + } + if (($minimum_sigs < 0)) { + throw new InvalidArgumentException('invalid value for $minimum_sigs when calling TransactionOutputModel., must be bigger than or equal to 0.'); + } + + $this->container['minimum_sigs'] = $minimum_sigs; + + return $this; + } + + /** + * Gets pub_keys + * + * @return string[]|null + */ + public function getPubKeys(): ?array + { + return $this->container['pub_keys']; + } + + /** + * Sets pub_keys + * + * @param string[]|null $pub_keys pub_keys + * + * @return $this + */ + public function setPubKeys(?array $pub_keys): static + { + if (is_null($pub_keys)) { + throw new InvalidArgumentException('non-nullable pub_keys cannot be null'); + } + $this->container['pub_keys'] = $pub_keys; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists(mixed $offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[ReturnTypeWillChange] + public function offsetGet(mixed $offset): mixed + { + 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(mixed $offset, mixed $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(mixed $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(): mixed + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString(): string + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue(): string + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/utils/sdk/client/php/src/TxGenerationContextModel.php b/utils/sdk/client/php/src/TxGenerationContextModel.php new file mode 100644 index 00000000..949ca13b --- /dev/null +++ b/utils/sdk/client/php/src/TxGenerationContextModel.php @@ -0,0 +1,1189 @@ + + */ +class TxGenerationContextModel implements ModelInterface, ArrayAccess, JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = 'TxGenerationContextModel'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPITypes = [ + 'asset_ids' => 'string[]', + 'blinded_asset_ids' => 'string[]', + 'amount_commitments' => 'string[]', + 'asset_id_blinding_masks' => 'string[]', + 'amounts' => 'string[]', + 'amount_blinding_masks' => 'string[]', + 'pseudo_outs_blinded_asset_ids' => 'string[]', + 'pseudo_outs_plus_real_out_blinding_masks' => 'string[]', + 'real_zc_ins_asset_ids' => 'string[]', + 'zc_input_amounts' => 'int[]', + 'pseudo_out_amount_commitments_sum' => 'string', + 'pseudo_out_amount_blinding_masks_sum' => 'string', + 'real_in_asset_id_blinding_mask_x_amount_sum' => 'string', + 'amount_commitments_sum' => 'string', + 'amount_blinding_masks_sum' => 'string', + 'asset_id_blinding_mask_x_amount_sum' => 'string', + 'ao_asset_id' => 'string', + 'ao_asset_id_pt' => 'string', + 'ao_amount_commitment' => 'string', + 'ao_amount_blinding_mask' => 'string', + 'ao_commitment_in_outputs' => 'bool', + 'tx_key_pub' => 'string', + 'tx_key_sec' => 'string', + 'tx_pub_key_p' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPIFormats = [ + 'asset_ids' => null, + 'blinded_asset_ids' => null, + 'amount_commitments' => null, + 'asset_id_blinding_masks' => null, + 'amounts' => null, + 'amount_blinding_masks' => null, + 'pseudo_outs_blinded_asset_ids' => null, + 'pseudo_outs_plus_real_out_blinding_masks' => null, + 'real_zc_ins_asset_ids' => null, + 'zc_input_amounts' => null, + 'pseudo_out_amount_commitments_sum' => null, + 'pseudo_out_amount_blinding_masks_sum' => null, + 'real_in_asset_id_blinding_mask_x_amount_sum' => null, + 'amount_commitments_sum' => null, + 'amount_blinding_masks_sum' => null, + 'asset_id_blinding_mask_x_amount_sum' => null, + 'ao_asset_id' => null, + 'ao_asset_id_pt' => null, + 'ao_amount_commitment' => null, + 'ao_amount_blinding_mask' => null, + 'ao_commitment_in_outputs' => null, + 'tx_key_pub' => null, + 'tx_key_sec' => null, + 'tx_pub_key_p' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'asset_ids' => false, + 'blinded_asset_ids' => false, + 'amount_commitments' => false, + 'asset_id_blinding_masks' => false, + 'amounts' => false, + 'amount_blinding_masks' => false, + 'pseudo_outs_blinded_asset_ids' => false, + 'pseudo_outs_plus_real_out_blinding_masks' => false, + 'real_zc_ins_asset_ids' => false, + 'zc_input_amounts' => false, + 'pseudo_out_amount_commitments_sum' => false, + 'pseudo_out_amount_blinding_masks_sum' => false, + 'real_in_asset_id_blinding_mask_x_amount_sum' => false, + 'amount_commitments_sum' => false, + 'amount_blinding_masks_sum' => false, + 'asset_id_blinding_mask_x_amount_sum' => false, + 'ao_asset_id' => false, + 'ao_asset_id_pt' => false, + 'ao_amount_commitment' => false, + 'ao_amount_blinding_mask' => false, + 'ao_commitment_in_outputs' => false, + 'tx_key_pub' => false, + 'tx_key_sec' => false, + 'tx_pub_key_p' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes(): array + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats(): array + { + 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 array + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param array $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 array + */ + protected static array $attributeMap = [ + 'asset_ids' => 'asset_ids', + 'blinded_asset_ids' => 'blinded_asset_ids', + 'amount_commitments' => 'amount_commitments', + 'asset_id_blinding_masks' => 'asset_id_blinding_masks', + 'amounts' => 'amounts', + 'amount_blinding_masks' => 'amount_blinding_masks', + 'pseudo_outs_blinded_asset_ids' => 'pseudo_outs_blinded_asset_ids', + 'pseudo_outs_plus_real_out_blinding_masks' => 'pseudo_outs_plus_real_out_blinding_masks', + 'real_zc_ins_asset_ids' => 'real_zc_ins_asset_ids', + 'zc_input_amounts' => 'zc_input_amounts', + 'pseudo_out_amount_commitments_sum' => 'pseudo_out_amount_commitments_sum', + 'pseudo_out_amount_blinding_masks_sum' => 'pseudo_out_amount_blinding_masks_sum', + 'real_in_asset_id_blinding_mask_x_amount_sum' => 'real_in_asset_id_blinding_mask_x_amount_sum', + 'amount_commitments_sum' => 'amount_commitments_sum', + 'amount_blinding_masks_sum' => 'amount_blinding_masks_sum', + 'asset_id_blinding_mask_x_amount_sum' => 'asset_id_blinding_mask_x_amount_sum', + 'ao_asset_id' => 'ao_asset_id', + 'ao_asset_id_pt' => 'ao_asset_id_pt', + 'ao_amount_commitment' => 'ao_amount_commitment', + 'ao_amount_blinding_mask' => 'ao_amount_blinding_mask', + 'ao_commitment_in_outputs' => 'ao_commitment_in_outputs', + 'tx_key_pub' => 'tx_key_pub', + 'tx_key_sec' => 'tx_key_sec', + 'tx_pub_key_p' => 'tx_pub_key_p' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var array + */ + protected static array $setters = [ + 'asset_ids' => 'setAssetIds', + 'blinded_asset_ids' => 'setBlindedAssetIds', + 'amount_commitments' => 'setAmountCommitments', + 'asset_id_blinding_masks' => 'setAssetIdBlindingMasks', + 'amounts' => 'setAmounts', + 'amount_blinding_masks' => 'setAmountBlindingMasks', + 'pseudo_outs_blinded_asset_ids' => 'setPseudoOutsBlindedAssetIds', + 'pseudo_outs_plus_real_out_blinding_masks' => 'setPseudoOutsPlusRealOutBlindingMasks', + 'real_zc_ins_asset_ids' => 'setRealZcInsAssetIds', + 'zc_input_amounts' => 'setZcInputAmounts', + 'pseudo_out_amount_commitments_sum' => 'setPseudoOutAmountCommitmentsSum', + 'pseudo_out_amount_blinding_masks_sum' => 'setPseudoOutAmountBlindingMasksSum', + 'real_in_asset_id_blinding_mask_x_amount_sum' => 'setRealInAssetIdBlindingMaskXAmountSum', + 'amount_commitments_sum' => 'setAmountCommitmentsSum', + 'amount_blinding_masks_sum' => 'setAmountBlindingMasksSum', + 'asset_id_blinding_mask_x_amount_sum' => 'setAssetIdBlindingMaskXAmountSum', + 'ao_asset_id' => 'setAoAssetId', + 'ao_asset_id_pt' => 'setAoAssetIdPt', + 'ao_amount_commitment' => 'setAoAmountCommitment', + 'ao_amount_blinding_mask' => 'setAoAmountBlindingMask', + 'ao_commitment_in_outputs' => 'setAoCommitmentInOutputs', + 'tx_key_pub' => 'setTxKeyPub', + 'tx_key_sec' => 'setTxKeySec', + 'tx_pub_key_p' => 'setTxPubKeyP' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var array + */ + protected static array $getters = [ + 'asset_ids' => 'getAssetIds', + 'blinded_asset_ids' => 'getBlindedAssetIds', + 'amount_commitments' => 'getAmountCommitments', + 'asset_id_blinding_masks' => 'getAssetIdBlindingMasks', + 'amounts' => 'getAmounts', + 'amount_blinding_masks' => 'getAmountBlindingMasks', + 'pseudo_outs_blinded_asset_ids' => 'getPseudoOutsBlindedAssetIds', + 'pseudo_outs_plus_real_out_blinding_masks' => 'getPseudoOutsPlusRealOutBlindingMasks', + 'real_zc_ins_asset_ids' => 'getRealZcInsAssetIds', + 'zc_input_amounts' => 'getZcInputAmounts', + 'pseudo_out_amount_commitments_sum' => 'getPseudoOutAmountCommitmentsSum', + 'pseudo_out_amount_blinding_masks_sum' => 'getPseudoOutAmountBlindingMasksSum', + 'real_in_asset_id_blinding_mask_x_amount_sum' => 'getRealInAssetIdBlindingMaskXAmountSum', + 'amount_commitments_sum' => 'getAmountCommitmentsSum', + 'amount_blinding_masks_sum' => 'getAmountBlindingMasksSum', + 'asset_id_blinding_mask_x_amount_sum' => 'getAssetIdBlindingMaskXAmountSum', + 'ao_asset_id' => 'getAoAssetId', + 'ao_asset_id_pt' => 'getAoAssetIdPt', + 'ao_amount_commitment' => 'getAoAmountCommitment', + 'ao_amount_blinding_mask' => 'getAoAmountBlindingMask', + 'ao_commitment_in_outputs' => 'getAoCommitmentInOutputs', + 'tx_key_pub' => 'getTxKeyPub', + 'tx_key_sec' => 'getTxKeySec', + 'tx_pub_key_p' => 'getTxPubKeyP' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap(): array + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters(): array + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters(): array + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName(): string + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var array + */ + protected array $container = []; + + /** + * Constructor + * + * @param array $data Associated array of property values initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('asset_ids', $data ?? [], null); + $this->setIfExists('blinded_asset_ids', $data ?? [], null); + $this->setIfExists('amount_commitments', $data ?? [], null); + $this->setIfExists('asset_id_blinding_masks', $data ?? [], null); + $this->setIfExists('amounts', $data ?? [], null); + $this->setIfExists('amount_blinding_masks', $data ?? [], null); + $this->setIfExists('pseudo_outs_blinded_asset_ids', $data ?? [], null); + $this->setIfExists('pseudo_outs_plus_real_out_blinding_masks', $data ?? [], null); + $this->setIfExists('real_zc_ins_asset_ids', $data ?? [], null); + $this->setIfExists('zc_input_amounts', $data ?? [], null); + $this->setIfExists('pseudo_out_amount_commitments_sum', $data ?? [], null); + $this->setIfExists('pseudo_out_amount_blinding_masks_sum', $data ?? [], null); + $this->setIfExists('real_in_asset_id_blinding_mask_x_amount_sum', $data ?? [], null); + $this->setIfExists('amount_commitments_sum', $data ?? [], null); + $this->setIfExists('amount_blinding_masks_sum', $data ?? [], null); + $this->setIfExists('asset_id_blinding_mask_x_amount_sum', $data ?? [], null); + $this->setIfExists('ao_asset_id', $data ?? [], null); + $this->setIfExists('ao_asset_id_pt', $data ?? [], null); + $this->setIfExists('ao_amount_commitment', $data ?? [], null); + $this->setIfExists('ao_amount_blinding_mask', $data ?? [], null); + $this->setIfExists('ao_commitment_in_outputs', $data ?? [], null); + $this->setIfExists('tx_key_pub', $data ?? [], null); + $this->setIfExists('tx_key_sec', $data ?? [], null); + $this->setIfExists('tx_pub_key_p', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, mixed $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 string[] invalid properties with reasons + */ + public function listInvalidProperties(): array + { + $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(): bool + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets asset_ids + * + * @return string[]|null + */ + public function getAssetIds(): ?array + { + return $this->container['asset_ids']; + } + + /** + * Sets asset_ids + * + * @param string[]|null $asset_ids asset_ids + * + * @return $this + */ + public function setAssetIds(?array $asset_ids): static + { + if (is_null($asset_ids)) { + throw new InvalidArgumentException('non-nullable asset_ids cannot be null'); + } + $this->container['asset_ids'] = $asset_ids; + + return $this; + } + + /** + * Gets blinded_asset_ids + * + * @return string[]|null + */ + public function getBlindedAssetIds(): ?array + { + return $this->container['blinded_asset_ids']; + } + + /** + * Sets blinded_asset_ids + * + * @param string[]|null $blinded_asset_ids blinded_asset_ids + * + * @return $this + */ + public function setBlindedAssetIds(?array $blinded_asset_ids): static + { + if (is_null($blinded_asset_ids)) { + throw new InvalidArgumentException('non-nullable blinded_asset_ids cannot be null'); + } + $this->container['blinded_asset_ids'] = $blinded_asset_ids; + + return $this; + } + + /** + * Gets amount_commitments + * + * @return string[]|null + */ + public function getAmountCommitments(): ?array + { + return $this->container['amount_commitments']; + } + + /** + * Sets amount_commitments + * + * @param string[]|null $amount_commitments amount_commitments + * + * @return $this + */ + public function setAmountCommitments(?array $amount_commitments): static + { + if (is_null($amount_commitments)) { + throw new InvalidArgumentException('non-nullable amount_commitments cannot be null'); + } + $this->container['amount_commitments'] = $amount_commitments; + + return $this; + } + + /** + * Gets asset_id_blinding_masks + * + * @return string[]|null + */ + public function getAssetIdBlindingMasks(): ?array + { + return $this->container['asset_id_blinding_masks']; + } + + /** + * Sets asset_id_blinding_masks + * + * @param string[]|null $asset_id_blinding_masks asset_id_blinding_masks + * + * @return $this + */ + public function setAssetIdBlindingMasks(?array $asset_id_blinding_masks): static + { + if (is_null($asset_id_blinding_masks)) { + throw new InvalidArgumentException('non-nullable asset_id_blinding_masks cannot be null'); + } + $this->container['asset_id_blinding_masks'] = $asset_id_blinding_masks; + + return $this; + } + + /** + * Gets amounts + * + * @return string[]|null + */ + public function getAmounts(): ?array + { + return $this->container['amounts']; + } + + /** + * Sets amounts + * + * @param string[]|null $amounts amounts + * + * @return $this + */ + public function setAmounts(?array $amounts): static + { + if (is_null($amounts)) { + throw new InvalidArgumentException('non-nullable amounts cannot be null'); + } + $this->container['amounts'] = $amounts; + + return $this; + } + + /** + * Gets amount_blinding_masks + * + * @return string[]|null + */ + public function getAmountBlindingMasks(): ?array + { + return $this->container['amount_blinding_masks']; + } + + /** + * Sets amount_blinding_masks + * + * @param string[]|null $amount_blinding_masks amount_blinding_masks + * + * @return $this + */ + public function setAmountBlindingMasks(?array $amount_blinding_masks): static + { + if (is_null($amount_blinding_masks)) { + throw new InvalidArgumentException('non-nullable amount_blinding_masks cannot be null'); + } + $this->container['amount_blinding_masks'] = $amount_blinding_masks; + + return $this; + } + + /** + * Gets pseudo_outs_blinded_asset_ids + * + * @return string[]|null + */ + public function getPseudoOutsBlindedAssetIds(): ?array + { + return $this->container['pseudo_outs_blinded_asset_ids']; + } + + /** + * Sets pseudo_outs_blinded_asset_ids + * + * @param string[]|null $pseudo_outs_blinded_asset_ids pseudo_outs_blinded_asset_ids + * + * @return $this + */ + public function setPseudoOutsBlindedAssetIds(?array $pseudo_outs_blinded_asset_ids): static + { + if (is_null($pseudo_outs_blinded_asset_ids)) { + throw new InvalidArgumentException('non-nullable pseudo_outs_blinded_asset_ids cannot be null'); + } + $this->container['pseudo_outs_blinded_asset_ids'] = $pseudo_outs_blinded_asset_ids; + + return $this; + } + + /** + * Gets pseudo_outs_plus_real_out_blinding_masks + * + * @return string[]|null + */ + public function getPseudoOutsPlusRealOutBlindingMasks(): ?array + { + return $this->container['pseudo_outs_plus_real_out_blinding_masks']; + } + + /** + * Sets pseudo_outs_plus_real_out_blinding_masks + * + * @param string[]|null $pseudo_outs_plus_real_out_blinding_masks pseudo_outs_plus_real_out_blinding_masks + * + * @return $this + */ + public function setPseudoOutsPlusRealOutBlindingMasks(?array $pseudo_outs_plus_real_out_blinding_masks): static + { + if (is_null($pseudo_outs_plus_real_out_blinding_masks)) { + throw new InvalidArgumentException('non-nullable pseudo_outs_plus_real_out_blinding_masks cannot be null'); + } + $this->container['pseudo_outs_plus_real_out_blinding_masks'] = $pseudo_outs_plus_real_out_blinding_masks; + + return $this; + } + + /** + * Gets real_zc_ins_asset_ids + * + * @return string[]|null + */ + public function getRealZcInsAssetIds(): ?array + { + return $this->container['real_zc_ins_asset_ids']; + } + + /** + * Sets real_zc_ins_asset_ids + * + * @param string[]|null $real_zc_ins_asset_ids real_zc_ins_asset_ids + * + * @return $this + */ + public function setRealZcInsAssetIds(?array $real_zc_ins_asset_ids): static + { + if (is_null($real_zc_ins_asset_ids)) { + throw new InvalidArgumentException('non-nullable real_zc_ins_asset_ids cannot be null'); + } + $this->container['real_zc_ins_asset_ids'] = $real_zc_ins_asset_ids; + + return $this; + } + + /** + * Gets zc_input_amounts + * + * @return int[]|null + */ + public function getZcInputAmounts(): ?array + { + return $this->container['zc_input_amounts']; + } + + /** + * Sets zc_input_amounts + * + * @param int[]|null $zc_input_amounts zc_input_amounts + * + * @return $this + */ + public function setZcInputAmounts(?array $zc_input_amounts): static + { + if (is_null($zc_input_amounts)) { + throw new InvalidArgumentException('non-nullable zc_input_amounts cannot be null'); + } + $this->container['zc_input_amounts'] = $zc_input_amounts; + + return $this; + } + + /** + * Gets pseudo_out_amount_commitments_sum + * + * @return string|null + */ + public function getPseudoOutAmountCommitmentsSum(): ?string + { + return $this->container['pseudo_out_amount_commitments_sum']; + } + + /** + * Sets pseudo_out_amount_commitments_sum + * + * @param string|null $pseudo_out_amount_commitments_sum pseudo_out_amount_commitments_sum + * + * @return $this + */ + public function setPseudoOutAmountCommitmentsSum(?string $pseudo_out_amount_commitments_sum): static + { + if (is_null($pseudo_out_amount_commitments_sum)) { + throw new InvalidArgumentException('non-nullable pseudo_out_amount_commitments_sum cannot be null'); + } + $this->container['pseudo_out_amount_commitments_sum'] = $pseudo_out_amount_commitments_sum; + + return $this; + } + + /** + * Gets pseudo_out_amount_blinding_masks_sum + * + * @return string|null + */ + public function getPseudoOutAmountBlindingMasksSum(): ?string + { + return $this->container['pseudo_out_amount_blinding_masks_sum']; + } + + /** + * Sets pseudo_out_amount_blinding_masks_sum + * + * @param string|null $pseudo_out_amount_blinding_masks_sum pseudo_out_amount_blinding_masks_sum + * + * @return $this + */ + public function setPseudoOutAmountBlindingMasksSum(?string $pseudo_out_amount_blinding_masks_sum): static + { + if (is_null($pseudo_out_amount_blinding_masks_sum)) { + throw new InvalidArgumentException('non-nullable pseudo_out_amount_blinding_masks_sum cannot be null'); + } + $this->container['pseudo_out_amount_blinding_masks_sum'] = $pseudo_out_amount_blinding_masks_sum; + + return $this; + } + + /** + * Gets real_in_asset_id_blinding_mask_x_amount_sum + * + * @return string|null + */ + public function getRealInAssetIdBlindingMaskXAmountSum(): ?string + { + return $this->container['real_in_asset_id_blinding_mask_x_amount_sum']; + } + + /** + * Sets real_in_asset_id_blinding_mask_x_amount_sum + * + * @param string|null $real_in_asset_id_blinding_mask_x_amount_sum real_in_asset_id_blinding_mask_x_amount_sum + * + * @return $this + */ + public function setRealInAssetIdBlindingMaskXAmountSum(?string $real_in_asset_id_blinding_mask_x_amount_sum): static + { + if (is_null($real_in_asset_id_blinding_mask_x_amount_sum)) { + throw new InvalidArgumentException('non-nullable real_in_asset_id_blinding_mask_x_amount_sum cannot be null'); + } + $this->container['real_in_asset_id_blinding_mask_x_amount_sum'] = $real_in_asset_id_blinding_mask_x_amount_sum; + + return $this; + } + + /** + * Gets amount_commitments_sum + * + * @return string|null + */ + public function getAmountCommitmentsSum(): ?string + { + return $this->container['amount_commitments_sum']; + } + + /** + * Sets amount_commitments_sum + * + * @param string|null $amount_commitments_sum amount_commitments_sum + * + * @return $this + */ + public function setAmountCommitmentsSum(?string $amount_commitments_sum): static + { + if (is_null($amount_commitments_sum)) { + throw new InvalidArgumentException('non-nullable amount_commitments_sum cannot be null'); + } + $this->container['amount_commitments_sum'] = $amount_commitments_sum; + + return $this; + } + + /** + * Gets amount_blinding_masks_sum + * + * @return string|null + */ + public function getAmountBlindingMasksSum(): ?string + { + return $this->container['amount_blinding_masks_sum']; + } + + /** + * Sets amount_blinding_masks_sum + * + * @param string|null $amount_blinding_masks_sum amount_blinding_masks_sum + * + * @return $this + */ + public function setAmountBlindingMasksSum(?string $amount_blinding_masks_sum): static + { + if (is_null($amount_blinding_masks_sum)) { + throw new InvalidArgumentException('non-nullable amount_blinding_masks_sum cannot be null'); + } + $this->container['amount_blinding_masks_sum'] = $amount_blinding_masks_sum; + + return $this; + } + + /** + * Gets asset_id_blinding_mask_x_amount_sum + * + * @return string|null + */ + public function getAssetIdBlindingMaskXAmountSum(): ?string + { + return $this->container['asset_id_blinding_mask_x_amount_sum']; + } + + /** + * Sets asset_id_blinding_mask_x_amount_sum + * + * @param string|null $asset_id_blinding_mask_x_amount_sum asset_id_blinding_mask_x_amount_sum + * + * @return $this + */ + public function setAssetIdBlindingMaskXAmountSum(?string $asset_id_blinding_mask_x_amount_sum): static + { + if (is_null($asset_id_blinding_mask_x_amount_sum)) { + throw new InvalidArgumentException('non-nullable asset_id_blinding_mask_x_amount_sum cannot be null'); + } + $this->container['asset_id_blinding_mask_x_amount_sum'] = $asset_id_blinding_mask_x_amount_sum; + + return $this; + } + + /** + * Gets ao_asset_id + * + * @return string|null + */ + public function getAoAssetId(): ?string + { + return $this->container['ao_asset_id']; + } + + /** + * Sets ao_asset_id + * + * @param string|null $ao_asset_id ao_asset_id + * + * @return $this + */ + public function setAoAssetId(?string $ao_asset_id): static + { + if (is_null($ao_asset_id)) { + throw new InvalidArgumentException('non-nullable ao_asset_id cannot be null'); + } + $this->container['ao_asset_id'] = $ao_asset_id; + + return $this; + } + + /** + * Gets ao_asset_id_pt + * + * @return string|null + */ + public function getAoAssetIdPt(): ?string + { + return $this->container['ao_asset_id_pt']; + } + + /** + * Sets ao_asset_id_pt + * + * @param string|null $ao_asset_id_pt ao_asset_id_pt + * + * @return $this + */ + public function setAoAssetIdPt(?string $ao_asset_id_pt): static + { + if (is_null($ao_asset_id_pt)) { + throw new InvalidArgumentException('non-nullable ao_asset_id_pt cannot be null'); + } + $this->container['ao_asset_id_pt'] = $ao_asset_id_pt; + + return $this; + } + + /** + * Gets ao_amount_commitment + * + * @return string|null + */ + public function getAoAmountCommitment(): ?string + { + return $this->container['ao_amount_commitment']; + } + + /** + * Sets ao_amount_commitment + * + * @param string|null $ao_amount_commitment ao_amount_commitment + * + * @return $this + */ + public function setAoAmountCommitment(?string $ao_amount_commitment): static + { + if (is_null($ao_amount_commitment)) { + throw new InvalidArgumentException('non-nullable ao_amount_commitment cannot be null'); + } + $this->container['ao_amount_commitment'] = $ao_amount_commitment; + + return $this; + } + + /** + * Gets ao_amount_blinding_mask + * + * @return string|null + */ + public function getAoAmountBlindingMask(): ?string + { + return $this->container['ao_amount_blinding_mask']; + } + + /** + * Sets ao_amount_blinding_mask + * + * @param string|null $ao_amount_blinding_mask ao_amount_blinding_mask + * + * @return $this + */ + public function setAoAmountBlindingMask(?string $ao_amount_blinding_mask): static + { + if (is_null($ao_amount_blinding_mask)) { + throw new InvalidArgumentException('non-nullable ao_amount_blinding_mask cannot be null'); + } + $this->container['ao_amount_blinding_mask'] = $ao_amount_blinding_mask; + + return $this; + } + + /** + * Gets ao_commitment_in_outputs + * + * @return bool|null + */ + public function getAoCommitmentInOutputs(): ?bool + { + return $this->container['ao_commitment_in_outputs']; + } + + /** + * Sets ao_commitment_in_outputs + * + * @param bool|null $ao_commitment_in_outputs ao_commitment_in_outputs + * + * @return $this + */ + public function setAoCommitmentInOutputs(?bool $ao_commitment_in_outputs): static + { + if (is_null($ao_commitment_in_outputs)) { + throw new InvalidArgumentException('non-nullable ao_commitment_in_outputs cannot be null'); + } + $this->container['ao_commitment_in_outputs'] = $ao_commitment_in_outputs; + + return $this; + } + + /** + * Gets tx_key_pub + * + * @return string|null + */ + public function getTxKeyPub(): ?string + { + return $this->container['tx_key_pub']; + } + + /** + * Sets tx_key_pub + * + * @param string|null $tx_key_pub tx_key_pub + * + * @return $this + */ + public function setTxKeyPub(?string $tx_key_pub): static + { + if (is_null($tx_key_pub)) { + throw new InvalidArgumentException('non-nullable tx_key_pub cannot be null'); + } + $this->container['tx_key_pub'] = $tx_key_pub; + + return $this; + } + + /** + * Gets tx_key_sec + * + * @return string|null + */ + public function getTxKeySec(): ?string + { + return $this->container['tx_key_sec']; + } + + /** + * Sets tx_key_sec + * + * @param string|null $tx_key_sec tx_key_sec + * + * @return $this + */ + public function setTxKeySec(?string $tx_key_sec): static + { + if (is_null($tx_key_sec)) { + throw new InvalidArgumentException('non-nullable tx_key_sec cannot be null'); + } + $this->container['tx_key_sec'] = $tx_key_sec; + + return $this; + } + + /** + * Gets tx_pub_key_p + * + * @return string|null + */ + public function getTxPubKeyP(): ?string + { + return $this->container['tx_pub_key_p']; + } + + /** + * Sets tx_pub_key_p + * + * @param string|null $tx_pub_key_p tx_pub_key_p + * + * @return $this + */ + public function setTxPubKeyP(?string $tx_pub_key_p): static + { + if (is_null($tx_pub_key_p)) { + throw new InvalidArgumentException('non-nullable tx_pub_key_p cannot be null'); + } + $this->container['tx_pub_key_p'] = $tx_pub_key_p; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists(mixed $offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[ReturnTypeWillChange] + public function offsetGet(mixed $offset): mixed + { + 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(mixed $offset, mixed $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(mixed $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(): mixed + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString(): string + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue(): string + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/utils/sdk/client/php/src/TxPoolPerformanceModel.php b/utils/sdk/client/php/src/TxPoolPerformanceModel.php new file mode 100644 index 00000000..ee2d80c7 --- /dev/null +++ b/utils/sdk/client/php/src/TxPoolPerformanceModel.php @@ -0,0 +1,747 @@ + + */ +class TxPoolPerformanceModel implements ModelInterface, ArrayAccess, JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = 'TxPoolPerformanceModel'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPITypes = [ + 'tx_processing_time' => 'int', + 'check_inputs_types_supported_time' => 'int', + 'expiration_validate_time' => 'int', + 'validate_amount_time' => 'int', + 'validate_alias_time' => 'int', + 'check_keyimages_ws_ms_time' => 'int', + 'check_inputs_time' => 'int', + 'begin_tx_time' => 'int', + 'update_db_time' => 'int', + 'db_commit_time' => 'int', + 'check_post_hf4_balance' => 'int' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPIFormats = [ + 'tx_processing_time' => null, + 'check_inputs_types_supported_time' => null, + 'expiration_validate_time' => null, + 'validate_amount_time' => null, + 'validate_alias_time' => null, + 'check_keyimages_ws_ms_time' => null, + 'check_inputs_time' => null, + 'begin_tx_time' => null, + 'update_db_time' => null, + 'db_commit_time' => null, + 'check_post_hf4_balance' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'tx_processing_time' => false, + 'check_inputs_types_supported_time' => false, + 'expiration_validate_time' => false, + 'validate_amount_time' => false, + 'validate_alias_time' => false, + 'check_keyimages_ws_ms_time' => false, + 'check_inputs_time' => false, + 'begin_tx_time' => false, + 'update_db_time' => false, + 'db_commit_time' => false, + 'check_post_hf4_balance' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes(): array + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats(): array + { + 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 array + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param array $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 array + */ + protected static array $attributeMap = [ + 'tx_processing_time' => 'tx_processing_time', + 'check_inputs_types_supported_time' => 'check_inputs_types_supported_time', + 'expiration_validate_time' => 'expiration_validate_time', + 'validate_amount_time' => 'validate_amount_time', + 'validate_alias_time' => 'validate_alias_time', + 'check_keyimages_ws_ms_time' => 'check_keyimages_ws_ms_time', + 'check_inputs_time' => 'check_inputs_time', + 'begin_tx_time' => 'begin_tx_time', + 'update_db_time' => 'update_db_time', + 'db_commit_time' => 'db_commit_time', + 'check_post_hf4_balance' => 'check_post_hf4_balance' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var array + */ + protected static array $setters = [ + 'tx_processing_time' => 'setTxProcessingTime', + 'check_inputs_types_supported_time' => 'setCheckInputsTypesSupportedTime', + 'expiration_validate_time' => 'setExpirationValidateTime', + 'validate_amount_time' => 'setValidateAmountTime', + 'validate_alias_time' => 'setValidateAliasTime', + 'check_keyimages_ws_ms_time' => 'setCheckKeyimagesWsMsTime', + 'check_inputs_time' => 'setCheckInputsTime', + 'begin_tx_time' => 'setBeginTxTime', + 'update_db_time' => 'setUpdateDbTime', + 'db_commit_time' => 'setDbCommitTime', + 'check_post_hf4_balance' => 'setCheckPostHf4Balance' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var array + */ + protected static array $getters = [ + 'tx_processing_time' => 'getTxProcessingTime', + 'check_inputs_types_supported_time' => 'getCheckInputsTypesSupportedTime', + 'expiration_validate_time' => 'getExpirationValidateTime', + 'validate_amount_time' => 'getValidateAmountTime', + 'validate_alias_time' => 'getValidateAliasTime', + 'check_keyimages_ws_ms_time' => 'getCheckKeyimagesWsMsTime', + 'check_inputs_time' => 'getCheckInputsTime', + 'begin_tx_time' => 'getBeginTxTime', + 'update_db_time' => 'getUpdateDbTime', + 'db_commit_time' => 'getDbCommitTime', + 'check_post_hf4_balance' => 'getCheckPostHf4Balance' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap(): array + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters(): array + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters(): array + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName(): string + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var array + */ + protected array $container = []; + + /** + * Constructor + * + * @param array $data Associated array of property values initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('tx_processing_time', $data ?? [], null); + $this->setIfExists('check_inputs_types_supported_time', $data ?? [], null); + $this->setIfExists('expiration_validate_time', $data ?? [], null); + $this->setIfExists('validate_amount_time', $data ?? [], null); + $this->setIfExists('validate_alias_time', $data ?? [], null); + $this->setIfExists('check_keyimages_ws_ms_time', $data ?? [], null); + $this->setIfExists('check_inputs_time', $data ?? [], null); + $this->setIfExists('begin_tx_time', $data ?? [], null); + $this->setIfExists('update_db_time', $data ?? [], null); + $this->setIfExists('db_commit_time', $data ?? [], null); + $this->setIfExists('check_post_hf4_balance', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, mixed $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 string[] invalid properties with reasons + */ + public function listInvalidProperties(): array + { + $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(): bool + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets tx_processing_time + * + * @return int|null + */ + public function getTxProcessingTime(): ?int + { + return $this->container['tx_processing_time']; + } + + /** + * Sets tx_processing_time + * + * @param int|null $tx_processing_time tx_processing_time + * + * @return $this + */ + public function setTxProcessingTime(?int $tx_processing_time): static + { + if (is_null($tx_processing_time)) { + throw new InvalidArgumentException('non-nullable tx_processing_time cannot be null'); + } + $this->container['tx_processing_time'] = $tx_processing_time; + + return $this; + } + + /** + * Gets check_inputs_types_supported_time + * + * @return int|null + */ + public function getCheckInputsTypesSupportedTime(): ?int + { + return $this->container['check_inputs_types_supported_time']; + } + + /** + * Sets check_inputs_types_supported_time + * + * @param int|null $check_inputs_types_supported_time check_inputs_types_supported_time + * + * @return $this + */ + public function setCheckInputsTypesSupportedTime(?int $check_inputs_types_supported_time): static + { + if (is_null($check_inputs_types_supported_time)) { + throw new InvalidArgumentException('non-nullable check_inputs_types_supported_time cannot be null'); + } + $this->container['check_inputs_types_supported_time'] = $check_inputs_types_supported_time; + + return $this; + } + + /** + * Gets expiration_validate_time + * + * @return int|null + */ + public function getExpirationValidateTime(): ?int + { + return $this->container['expiration_validate_time']; + } + + /** + * Sets expiration_validate_time + * + * @param int|null $expiration_validate_time expiration_validate_time + * + * @return $this + */ + public function setExpirationValidateTime(?int $expiration_validate_time): static + { + if (is_null($expiration_validate_time)) { + throw new InvalidArgumentException('non-nullable expiration_validate_time cannot be null'); + } + $this->container['expiration_validate_time'] = $expiration_validate_time; + + return $this; + } + + /** + * Gets validate_amount_time + * + * @return int|null + */ + public function getValidateAmountTime(): ?int + { + return $this->container['validate_amount_time']; + } + + /** + * Sets validate_amount_time + * + * @param int|null $validate_amount_time validate_amount_time + * + * @return $this + */ + public function setValidateAmountTime(?int $validate_amount_time): static + { + if (is_null($validate_amount_time)) { + throw new InvalidArgumentException('non-nullable validate_amount_time cannot be null'); + } + $this->container['validate_amount_time'] = $validate_amount_time; + + return $this; + } + + /** + * Gets validate_alias_time + * + * @return int|null + */ + public function getValidateAliasTime(): ?int + { + return $this->container['validate_alias_time']; + } + + /** + * Sets validate_alias_time + * + * @param int|null $validate_alias_time validate_alias_time + * + * @return $this + */ + public function setValidateAliasTime(?int $validate_alias_time): static + { + if (is_null($validate_alias_time)) { + throw new InvalidArgumentException('non-nullable validate_alias_time cannot be null'); + } + $this->container['validate_alias_time'] = $validate_alias_time; + + return $this; + } + + /** + * Gets check_keyimages_ws_ms_time + * + * @return int|null + */ + public function getCheckKeyimagesWsMsTime(): ?int + { + return $this->container['check_keyimages_ws_ms_time']; + } + + /** + * Sets check_keyimages_ws_ms_time + * + * @param int|null $check_keyimages_ws_ms_time check_keyimages_ws_ms_time + * + * @return $this + */ + public function setCheckKeyimagesWsMsTime(?int $check_keyimages_ws_ms_time): static + { + if (is_null($check_keyimages_ws_ms_time)) { + throw new InvalidArgumentException('non-nullable check_keyimages_ws_ms_time cannot be null'); + } + $this->container['check_keyimages_ws_ms_time'] = $check_keyimages_ws_ms_time; + + return $this; + } + + /** + * Gets check_inputs_time + * + * @return int|null + */ + public function getCheckInputsTime(): ?int + { + return $this->container['check_inputs_time']; + } + + /** + * Sets check_inputs_time + * + * @param int|null $check_inputs_time check_inputs_time + * + * @return $this + */ + public function setCheckInputsTime(?int $check_inputs_time): static + { + if (is_null($check_inputs_time)) { + throw new InvalidArgumentException('non-nullable check_inputs_time cannot be null'); + } + $this->container['check_inputs_time'] = $check_inputs_time; + + return $this; + } + + /** + * Gets begin_tx_time + * + * @return int|null + */ + public function getBeginTxTime(): ?int + { + return $this->container['begin_tx_time']; + } + + /** + * Sets begin_tx_time + * + * @param int|null $begin_tx_time begin_tx_time + * + * @return $this + */ + public function setBeginTxTime(?int $begin_tx_time): static + { + if (is_null($begin_tx_time)) { + throw new InvalidArgumentException('non-nullable begin_tx_time cannot be null'); + } + $this->container['begin_tx_time'] = $begin_tx_time; + + return $this; + } + + /** + * Gets update_db_time + * + * @return int|null + */ + public function getUpdateDbTime(): ?int + { + return $this->container['update_db_time']; + } + + /** + * Sets update_db_time + * + * @param int|null $update_db_time update_db_time + * + * @return $this + */ + public function setUpdateDbTime(?int $update_db_time): static + { + if (is_null($update_db_time)) { + throw new InvalidArgumentException('non-nullable update_db_time cannot be null'); + } + $this->container['update_db_time'] = $update_db_time; + + return $this; + } + + /** + * Gets db_commit_time + * + * @return int|null + */ + public function getDbCommitTime(): ?int + { + return $this->container['db_commit_time']; + } + + /** + * Sets db_commit_time + * + * @param int|null $db_commit_time db_commit_time + * + * @return $this + */ + public function setDbCommitTime(?int $db_commit_time): static + { + if (is_null($db_commit_time)) { + throw new InvalidArgumentException('non-nullable db_commit_time cannot be null'); + } + $this->container['db_commit_time'] = $db_commit_time; + + return $this; + } + + /** + * Gets check_post_hf4_balance + * + * @return int|null + */ + public function getCheckPostHf4Balance(): ?int + { + return $this->container['check_post_hf4_balance']; + } + + /** + * Sets check_post_hf4_balance + * + * @param int|null $check_post_hf4_balance check_post_hf4_balance + * + * @return $this + */ + public function setCheckPostHf4Balance(?int $check_post_hf4_balance): static + { + if (is_null($check_post_hf4_balance)) { + throw new InvalidArgumentException('non-nullable check_post_hf4_balance cannot be null'); + } + $this->container['check_post_hf4_balance'] = $check_post_hf4_balance; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists(mixed $offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[ReturnTypeWillChange] + public function offsetGet(mixed $offset): mixed + { + 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(mixed $offset, mixed $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(mixed $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(): mixed + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString(): string + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue(): string + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/utils/sdk/client/php/src/TxProcessingPerformanceModel.php b/utils/sdk/client/php/src/TxProcessingPerformanceModel.php new file mode 100644 index 00000000..aa7fd7e2 --- /dev/null +++ b/utils/sdk/client/php/src/TxProcessingPerformanceModel.php @@ -0,0 +1,1223 @@ + + */ +class TxProcessingPerformanceModel implements ModelInterface, ArrayAccess, JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = 'TxProcessingPerformanceModel'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPITypes = [ + 'tx_check_inputs' => 'int', + 'tx_add_one_tx' => 'int', + 'tx_process_extra' => 'int', + 'tx_process_attachment' => 'int', + 'tx_process_inputs' => 'int', + 'tx_push_global_index' => 'int', + 'tx_check_exist' => 'int', + 'tx_print_log' => 'int', + 'tx_prapare_append' => 'int', + 'tx_append' => 'int', + 'tx_append_rl_wait' => 'int', + 'tx_append_is_expired' => 'int', + 'tx_store_db' => 'int', + 'tx_check_inputs_prefix_hash' => 'int', + 'tx_check_inputs_attachment_check' => 'int', + 'tx_check_inputs_loop' => 'int', + 'tx_check_inputs_loop_kimage_check' => 'int', + 'tx_check_inputs_loop_ch_in_val_sig' => 'int', + 'tx_check_inputs_loop_scan_outputkeys_get_item_size' => 'int', + 'tx_check_inputs_loop_scan_outputkeys_relative_to_absolute' => 'int', + 'tx_check_inputs_loop_scan_outputkeys_loop' => 'int', + 'tx_check_inputs_loop_scan_outputkeys_loop_get_subitem' => 'int', + 'tx_check_inputs_loop_scan_outputkeys_loop_find_tx' => 'int', + 'tx_check_inputs_loop_scan_outputkeys_loop_handle_output' => 'int', + 'tx_mixin_count' => 'int' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPIFormats = [ + 'tx_check_inputs' => null, + 'tx_add_one_tx' => null, + 'tx_process_extra' => null, + 'tx_process_attachment' => null, + 'tx_process_inputs' => null, + 'tx_push_global_index' => null, + 'tx_check_exist' => null, + 'tx_print_log' => null, + 'tx_prapare_append' => null, + 'tx_append' => null, + 'tx_append_rl_wait' => null, + 'tx_append_is_expired' => null, + 'tx_store_db' => null, + 'tx_check_inputs_prefix_hash' => null, + 'tx_check_inputs_attachment_check' => null, + 'tx_check_inputs_loop' => null, + 'tx_check_inputs_loop_kimage_check' => null, + 'tx_check_inputs_loop_ch_in_val_sig' => null, + 'tx_check_inputs_loop_scan_outputkeys_get_item_size' => null, + 'tx_check_inputs_loop_scan_outputkeys_relative_to_absolute' => null, + 'tx_check_inputs_loop_scan_outputkeys_loop' => null, + 'tx_check_inputs_loop_scan_outputkeys_loop_get_subitem' => null, + 'tx_check_inputs_loop_scan_outputkeys_loop_find_tx' => null, + 'tx_check_inputs_loop_scan_outputkeys_loop_handle_output' => null, + 'tx_mixin_count' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'tx_check_inputs' => false, + 'tx_add_one_tx' => false, + 'tx_process_extra' => false, + 'tx_process_attachment' => false, + 'tx_process_inputs' => false, + 'tx_push_global_index' => false, + 'tx_check_exist' => false, + 'tx_print_log' => false, + 'tx_prapare_append' => false, + 'tx_append' => false, + 'tx_append_rl_wait' => false, + 'tx_append_is_expired' => false, + 'tx_store_db' => false, + 'tx_check_inputs_prefix_hash' => false, + 'tx_check_inputs_attachment_check' => false, + 'tx_check_inputs_loop' => false, + 'tx_check_inputs_loop_kimage_check' => false, + 'tx_check_inputs_loop_ch_in_val_sig' => false, + 'tx_check_inputs_loop_scan_outputkeys_get_item_size' => false, + 'tx_check_inputs_loop_scan_outputkeys_relative_to_absolute' => false, + 'tx_check_inputs_loop_scan_outputkeys_loop' => false, + 'tx_check_inputs_loop_scan_outputkeys_loop_get_subitem' => false, + 'tx_check_inputs_loop_scan_outputkeys_loop_find_tx' => false, + 'tx_check_inputs_loop_scan_outputkeys_loop_handle_output' => false, + 'tx_mixin_count' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes(): array + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats(): array + { + 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 array + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param array $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 array + */ + protected static array $attributeMap = [ + 'tx_check_inputs' => 'tx_check_inputs', + 'tx_add_one_tx' => 'tx_add_one_tx', + 'tx_process_extra' => 'tx_process_extra', + 'tx_process_attachment' => 'tx_process_attachment', + 'tx_process_inputs' => 'tx_process_inputs', + 'tx_push_global_index' => 'tx_push_global_index', + 'tx_check_exist' => 'tx_check_exist', + 'tx_print_log' => 'tx_print_log', + 'tx_prapare_append' => 'tx_prapare_append', + 'tx_append' => 'tx_append', + 'tx_append_rl_wait' => 'tx_append_rl_wait', + 'tx_append_is_expired' => 'tx_append_is_expired', + 'tx_store_db' => 'tx_store_db', + 'tx_check_inputs_prefix_hash' => 'tx_check_inputs_prefix_hash', + 'tx_check_inputs_attachment_check' => 'tx_check_inputs_attachment_check', + 'tx_check_inputs_loop' => 'tx_check_inputs_loop', + 'tx_check_inputs_loop_kimage_check' => 'tx_check_inputs_loop_kimage_check', + 'tx_check_inputs_loop_ch_in_val_sig' => 'tx_check_inputs_loop_ch_in_val_sig', + 'tx_check_inputs_loop_scan_outputkeys_get_item_size' => 'tx_check_inputs_loop_scan_outputkeys_get_item_size', + 'tx_check_inputs_loop_scan_outputkeys_relative_to_absolute' => 'tx_check_inputs_loop_scan_outputkeys_relative_to_absolute', + 'tx_check_inputs_loop_scan_outputkeys_loop' => 'tx_check_inputs_loop_scan_outputkeys_loop', + 'tx_check_inputs_loop_scan_outputkeys_loop_get_subitem' => 'tx_check_inputs_loop_scan_outputkeys_loop_get_subitem', + 'tx_check_inputs_loop_scan_outputkeys_loop_find_tx' => 'tx_check_inputs_loop_scan_outputkeys_loop_find_tx', + 'tx_check_inputs_loop_scan_outputkeys_loop_handle_output' => 'tx_check_inputs_loop_scan_outputkeys_loop_handle_output', + 'tx_mixin_count' => 'tx_mixin_count' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var array + */ + protected static array $setters = [ + 'tx_check_inputs' => 'setTxCheckInputs', + 'tx_add_one_tx' => 'setTxAddOneTx', + 'tx_process_extra' => 'setTxProcessExtra', + 'tx_process_attachment' => 'setTxProcessAttachment', + 'tx_process_inputs' => 'setTxProcessInputs', + 'tx_push_global_index' => 'setTxPushGlobalIndex', + 'tx_check_exist' => 'setTxCheckExist', + 'tx_print_log' => 'setTxPrintLog', + 'tx_prapare_append' => 'setTxPrapareAppend', + 'tx_append' => 'setTxAppend', + 'tx_append_rl_wait' => 'setTxAppendRlWait', + 'tx_append_is_expired' => 'setTxAppendIsExpired', + 'tx_store_db' => 'setTxStoreDb', + 'tx_check_inputs_prefix_hash' => 'setTxCheckInputsPrefixHash', + 'tx_check_inputs_attachment_check' => 'setTxCheckInputsAttachmentCheck', + 'tx_check_inputs_loop' => 'setTxCheckInputsLoop', + 'tx_check_inputs_loop_kimage_check' => 'setTxCheckInputsLoopKimageCheck', + 'tx_check_inputs_loop_ch_in_val_sig' => 'setTxCheckInputsLoopChInValSig', + 'tx_check_inputs_loop_scan_outputkeys_get_item_size' => 'setTxCheckInputsLoopScanOutputkeysGetItemSize', + 'tx_check_inputs_loop_scan_outputkeys_relative_to_absolute' => 'setTxCheckInputsLoopScanOutputkeysRelativeToAbsolute', + 'tx_check_inputs_loop_scan_outputkeys_loop' => 'setTxCheckInputsLoopScanOutputkeysLoop', + 'tx_check_inputs_loop_scan_outputkeys_loop_get_subitem' => 'setTxCheckInputsLoopScanOutputkeysLoopGetSubitem', + 'tx_check_inputs_loop_scan_outputkeys_loop_find_tx' => 'setTxCheckInputsLoopScanOutputkeysLoopFindTx', + 'tx_check_inputs_loop_scan_outputkeys_loop_handle_output' => 'setTxCheckInputsLoopScanOutputkeysLoopHandleOutput', + 'tx_mixin_count' => 'setTxMixinCount' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var array + */ + protected static array $getters = [ + 'tx_check_inputs' => 'getTxCheckInputs', + 'tx_add_one_tx' => 'getTxAddOneTx', + 'tx_process_extra' => 'getTxProcessExtra', + 'tx_process_attachment' => 'getTxProcessAttachment', + 'tx_process_inputs' => 'getTxProcessInputs', + 'tx_push_global_index' => 'getTxPushGlobalIndex', + 'tx_check_exist' => 'getTxCheckExist', + 'tx_print_log' => 'getTxPrintLog', + 'tx_prapare_append' => 'getTxPrapareAppend', + 'tx_append' => 'getTxAppend', + 'tx_append_rl_wait' => 'getTxAppendRlWait', + 'tx_append_is_expired' => 'getTxAppendIsExpired', + 'tx_store_db' => 'getTxStoreDb', + 'tx_check_inputs_prefix_hash' => 'getTxCheckInputsPrefixHash', + 'tx_check_inputs_attachment_check' => 'getTxCheckInputsAttachmentCheck', + 'tx_check_inputs_loop' => 'getTxCheckInputsLoop', + 'tx_check_inputs_loop_kimage_check' => 'getTxCheckInputsLoopKimageCheck', + 'tx_check_inputs_loop_ch_in_val_sig' => 'getTxCheckInputsLoopChInValSig', + 'tx_check_inputs_loop_scan_outputkeys_get_item_size' => 'getTxCheckInputsLoopScanOutputkeysGetItemSize', + 'tx_check_inputs_loop_scan_outputkeys_relative_to_absolute' => 'getTxCheckInputsLoopScanOutputkeysRelativeToAbsolute', + 'tx_check_inputs_loop_scan_outputkeys_loop' => 'getTxCheckInputsLoopScanOutputkeysLoop', + 'tx_check_inputs_loop_scan_outputkeys_loop_get_subitem' => 'getTxCheckInputsLoopScanOutputkeysLoopGetSubitem', + 'tx_check_inputs_loop_scan_outputkeys_loop_find_tx' => 'getTxCheckInputsLoopScanOutputkeysLoopFindTx', + 'tx_check_inputs_loop_scan_outputkeys_loop_handle_output' => 'getTxCheckInputsLoopScanOutputkeysLoopHandleOutput', + 'tx_mixin_count' => 'getTxMixinCount' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap(): array + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters(): array + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters(): array + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName(): string + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var array + */ + protected array $container = []; + + /** + * Constructor + * + * @param array $data Associated array of property values initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('tx_check_inputs', $data ?? [], null); + $this->setIfExists('tx_add_one_tx', $data ?? [], null); + $this->setIfExists('tx_process_extra', $data ?? [], null); + $this->setIfExists('tx_process_attachment', $data ?? [], null); + $this->setIfExists('tx_process_inputs', $data ?? [], null); + $this->setIfExists('tx_push_global_index', $data ?? [], null); + $this->setIfExists('tx_check_exist', $data ?? [], null); + $this->setIfExists('tx_print_log', $data ?? [], null); + $this->setIfExists('tx_prapare_append', $data ?? [], null); + $this->setIfExists('tx_append', $data ?? [], null); + $this->setIfExists('tx_append_rl_wait', $data ?? [], null); + $this->setIfExists('tx_append_is_expired', $data ?? [], null); + $this->setIfExists('tx_store_db', $data ?? [], null); + $this->setIfExists('tx_check_inputs_prefix_hash', $data ?? [], null); + $this->setIfExists('tx_check_inputs_attachment_check', $data ?? [], null); + $this->setIfExists('tx_check_inputs_loop', $data ?? [], null); + $this->setIfExists('tx_check_inputs_loop_kimage_check', $data ?? [], null); + $this->setIfExists('tx_check_inputs_loop_ch_in_val_sig', $data ?? [], null); + $this->setIfExists('tx_check_inputs_loop_scan_outputkeys_get_item_size', $data ?? [], null); + $this->setIfExists('tx_check_inputs_loop_scan_outputkeys_relative_to_absolute', $data ?? [], null); + $this->setIfExists('tx_check_inputs_loop_scan_outputkeys_loop', $data ?? [], null); + $this->setIfExists('tx_check_inputs_loop_scan_outputkeys_loop_get_subitem', $data ?? [], null); + $this->setIfExists('tx_check_inputs_loop_scan_outputkeys_loop_find_tx', $data ?? [], null); + $this->setIfExists('tx_check_inputs_loop_scan_outputkeys_loop_handle_output', $data ?? [], null); + $this->setIfExists('tx_mixin_count', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, mixed $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 string[] invalid properties with reasons + */ + public function listInvalidProperties(): array + { + $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(): bool + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets tx_check_inputs + * + * @return int|null + */ + public function getTxCheckInputs(): ?int + { + return $this->container['tx_check_inputs']; + } + + /** + * Sets tx_check_inputs + * + * @param int|null $tx_check_inputs tx_check_inputs + * + * @return $this + */ + public function setTxCheckInputs(?int $tx_check_inputs): static + { + if (is_null($tx_check_inputs)) { + throw new InvalidArgumentException('non-nullable tx_check_inputs cannot be null'); + } + $this->container['tx_check_inputs'] = $tx_check_inputs; + + return $this; + } + + /** + * Gets tx_add_one_tx + * + * @return int|null + */ + public function getTxAddOneTx(): ?int + { + return $this->container['tx_add_one_tx']; + } + + /** + * Sets tx_add_one_tx + * + * @param int|null $tx_add_one_tx tx_add_one_tx + * + * @return $this + */ + public function setTxAddOneTx(?int $tx_add_one_tx): static + { + if (is_null($tx_add_one_tx)) { + throw new InvalidArgumentException('non-nullable tx_add_one_tx cannot be null'); + } + $this->container['tx_add_one_tx'] = $tx_add_one_tx; + + return $this; + } + + /** + * Gets tx_process_extra + * + * @return int|null + */ + public function getTxProcessExtra(): ?int + { + return $this->container['tx_process_extra']; + } + + /** + * Sets tx_process_extra + * + * @param int|null $tx_process_extra tx_process_extra + * + * @return $this + */ + public function setTxProcessExtra(?int $tx_process_extra): static + { + if (is_null($tx_process_extra)) { + throw new InvalidArgumentException('non-nullable tx_process_extra cannot be null'); + } + $this->container['tx_process_extra'] = $tx_process_extra; + + return $this; + } + + /** + * Gets tx_process_attachment + * + * @return int|null + */ + public function getTxProcessAttachment(): ?int + { + return $this->container['tx_process_attachment']; + } + + /** + * Sets tx_process_attachment + * + * @param int|null $tx_process_attachment tx_process_attachment + * + * @return $this + */ + public function setTxProcessAttachment(?int $tx_process_attachment): static + { + if (is_null($tx_process_attachment)) { + throw new InvalidArgumentException('non-nullable tx_process_attachment cannot be null'); + } + $this->container['tx_process_attachment'] = $tx_process_attachment; + + return $this; + } + + /** + * Gets tx_process_inputs + * + * @return int|null + */ + public function getTxProcessInputs(): ?int + { + return $this->container['tx_process_inputs']; + } + + /** + * Sets tx_process_inputs + * + * @param int|null $tx_process_inputs tx_process_inputs + * + * @return $this + */ + public function setTxProcessInputs(?int $tx_process_inputs): static + { + if (is_null($tx_process_inputs)) { + throw new InvalidArgumentException('non-nullable tx_process_inputs cannot be null'); + } + $this->container['tx_process_inputs'] = $tx_process_inputs; + + return $this; + } + + /** + * Gets tx_push_global_index + * + * @return int|null + */ + public function getTxPushGlobalIndex(): ?int + { + return $this->container['tx_push_global_index']; + } + + /** + * Sets tx_push_global_index + * + * @param int|null $tx_push_global_index tx_push_global_index + * + * @return $this + */ + public function setTxPushGlobalIndex(?int $tx_push_global_index): static + { + if (is_null($tx_push_global_index)) { + throw new InvalidArgumentException('non-nullable tx_push_global_index cannot be null'); + } + $this->container['tx_push_global_index'] = $tx_push_global_index; + + return $this; + } + + /** + * Gets tx_check_exist + * + * @return int|null + */ + public function getTxCheckExist(): ?int + { + return $this->container['tx_check_exist']; + } + + /** + * Sets tx_check_exist + * + * @param int|null $tx_check_exist tx_check_exist + * + * @return $this + */ + public function setTxCheckExist(?int $tx_check_exist): static + { + if (is_null($tx_check_exist)) { + throw new InvalidArgumentException('non-nullable tx_check_exist cannot be null'); + } + $this->container['tx_check_exist'] = $tx_check_exist; + + return $this; + } + + /** + * Gets tx_print_log + * + * @return int|null + */ + public function getTxPrintLog(): ?int + { + return $this->container['tx_print_log']; + } + + /** + * Sets tx_print_log + * + * @param int|null $tx_print_log tx_print_log + * + * @return $this + */ + public function setTxPrintLog(?int $tx_print_log): static + { + if (is_null($tx_print_log)) { + throw new InvalidArgumentException('non-nullable tx_print_log cannot be null'); + } + $this->container['tx_print_log'] = $tx_print_log; + + return $this; + } + + /** + * Gets tx_prapare_append + * + * @return int|null + */ + public function getTxPrapareAppend(): ?int + { + return $this->container['tx_prapare_append']; + } + + /** + * Sets tx_prapare_append + * + * @param int|null $tx_prapare_append tx_prapare_append + * + * @return $this + */ + public function setTxPrapareAppend(?int $tx_prapare_append): static + { + if (is_null($tx_prapare_append)) { + throw new InvalidArgumentException('non-nullable tx_prapare_append cannot be null'); + } + $this->container['tx_prapare_append'] = $tx_prapare_append; + + return $this; + } + + /** + * Gets tx_append + * + * @return int|null + */ + public function getTxAppend(): ?int + { + return $this->container['tx_append']; + } + + /** + * Sets tx_append + * + * @param int|null $tx_append tx_append + * + * @return $this + */ + public function setTxAppend(?int $tx_append): static + { + if (is_null($tx_append)) { + throw new InvalidArgumentException('non-nullable tx_append cannot be null'); + } + $this->container['tx_append'] = $tx_append; + + return $this; + } + + /** + * Gets tx_append_rl_wait + * + * @return int|null + */ + public function getTxAppendRlWait(): ?int + { + return $this->container['tx_append_rl_wait']; + } + + /** + * Sets tx_append_rl_wait + * + * @param int|null $tx_append_rl_wait tx_append_rl_wait + * + * @return $this + */ + public function setTxAppendRlWait(?int $tx_append_rl_wait): static + { + if (is_null($tx_append_rl_wait)) { + throw new InvalidArgumentException('non-nullable tx_append_rl_wait cannot be null'); + } + $this->container['tx_append_rl_wait'] = $tx_append_rl_wait; + + return $this; + } + + /** + * Gets tx_append_is_expired + * + * @return int|null + */ + public function getTxAppendIsExpired(): ?int + { + return $this->container['tx_append_is_expired']; + } + + /** + * Sets tx_append_is_expired + * + * @param int|null $tx_append_is_expired tx_append_is_expired + * + * @return $this + */ + public function setTxAppendIsExpired(?int $tx_append_is_expired): static + { + if (is_null($tx_append_is_expired)) { + throw new InvalidArgumentException('non-nullable tx_append_is_expired cannot be null'); + } + $this->container['tx_append_is_expired'] = $tx_append_is_expired; + + return $this; + } + + /** + * Gets tx_store_db + * + * @return int|null + */ + public function getTxStoreDb(): ?int + { + return $this->container['tx_store_db']; + } + + /** + * Sets tx_store_db + * + * @param int|null $tx_store_db tx_store_db + * + * @return $this + */ + public function setTxStoreDb(?int $tx_store_db): static + { + if (is_null($tx_store_db)) { + throw new InvalidArgumentException('non-nullable tx_store_db cannot be null'); + } + $this->container['tx_store_db'] = $tx_store_db; + + return $this; + } + + /** + * Gets tx_check_inputs_prefix_hash + * + * @return int|null + */ + public function getTxCheckInputsPrefixHash(): ?int + { + return $this->container['tx_check_inputs_prefix_hash']; + } + + /** + * Sets tx_check_inputs_prefix_hash + * + * @param int|null $tx_check_inputs_prefix_hash tx_check_inputs_prefix_hash + * + * @return $this + */ + public function setTxCheckInputsPrefixHash(?int $tx_check_inputs_prefix_hash): static + { + if (is_null($tx_check_inputs_prefix_hash)) { + throw new InvalidArgumentException('non-nullable tx_check_inputs_prefix_hash cannot be null'); + } + $this->container['tx_check_inputs_prefix_hash'] = $tx_check_inputs_prefix_hash; + + return $this; + } + + /** + * Gets tx_check_inputs_attachment_check + * + * @return int|null + */ + public function getTxCheckInputsAttachmentCheck(): ?int + { + return $this->container['tx_check_inputs_attachment_check']; + } + + /** + * Sets tx_check_inputs_attachment_check + * + * @param int|null $tx_check_inputs_attachment_check tx_check_inputs_attachment_check + * + * @return $this + */ + public function setTxCheckInputsAttachmentCheck(?int $tx_check_inputs_attachment_check): static + { + if (is_null($tx_check_inputs_attachment_check)) { + throw new InvalidArgumentException('non-nullable tx_check_inputs_attachment_check cannot be null'); + } + $this->container['tx_check_inputs_attachment_check'] = $tx_check_inputs_attachment_check; + + return $this; + } + + /** + * Gets tx_check_inputs_loop + * + * @return int|null + */ + public function getTxCheckInputsLoop(): ?int + { + return $this->container['tx_check_inputs_loop']; + } + + /** + * Sets tx_check_inputs_loop + * + * @param int|null $tx_check_inputs_loop tx_check_inputs_loop + * + * @return $this + */ + public function setTxCheckInputsLoop(?int $tx_check_inputs_loop): static + { + if (is_null($tx_check_inputs_loop)) { + throw new InvalidArgumentException('non-nullable tx_check_inputs_loop cannot be null'); + } + $this->container['tx_check_inputs_loop'] = $tx_check_inputs_loop; + + return $this; + } + + /** + * Gets tx_check_inputs_loop_kimage_check + * + * @return int|null + */ + public function getTxCheckInputsLoopKimageCheck(): ?int + { + return $this->container['tx_check_inputs_loop_kimage_check']; + } + + /** + * Sets tx_check_inputs_loop_kimage_check + * + * @param int|null $tx_check_inputs_loop_kimage_check tx_check_inputs_loop_kimage_check + * + * @return $this + */ + public function setTxCheckInputsLoopKimageCheck(?int $tx_check_inputs_loop_kimage_check): static + { + if (is_null($tx_check_inputs_loop_kimage_check)) { + throw new InvalidArgumentException('non-nullable tx_check_inputs_loop_kimage_check cannot be null'); + } + $this->container['tx_check_inputs_loop_kimage_check'] = $tx_check_inputs_loop_kimage_check; + + return $this; + } + + /** + * Gets tx_check_inputs_loop_ch_in_val_sig + * + * @return int|null + */ + public function getTxCheckInputsLoopChInValSig(): ?int + { + return $this->container['tx_check_inputs_loop_ch_in_val_sig']; + } + + /** + * Sets tx_check_inputs_loop_ch_in_val_sig + * + * @param int|null $tx_check_inputs_loop_ch_in_val_sig tx_check_inputs_loop_ch_in_val_sig + * + * @return $this + */ + public function setTxCheckInputsLoopChInValSig(?int $tx_check_inputs_loop_ch_in_val_sig): static + { + if (is_null($tx_check_inputs_loop_ch_in_val_sig)) { + throw new InvalidArgumentException('non-nullable tx_check_inputs_loop_ch_in_val_sig cannot be null'); + } + $this->container['tx_check_inputs_loop_ch_in_val_sig'] = $tx_check_inputs_loop_ch_in_val_sig; + + return $this; + } + + /** + * Gets tx_check_inputs_loop_scan_outputkeys_get_item_size + * + * @return int|null + */ + public function getTxCheckInputsLoopScanOutputkeysGetItemSize(): ?int + { + return $this->container['tx_check_inputs_loop_scan_outputkeys_get_item_size']; + } + + /** + * Sets tx_check_inputs_loop_scan_outputkeys_get_item_size + * + * @param int|null $tx_check_inputs_loop_scan_outputkeys_get_item_size tx_check_inputs_loop_scan_outputkeys_get_item_size + * + * @return $this + */ + public function setTxCheckInputsLoopScanOutputkeysGetItemSize(?int $tx_check_inputs_loop_scan_outputkeys_get_item_size): static + { + if (is_null($tx_check_inputs_loop_scan_outputkeys_get_item_size)) { + throw new InvalidArgumentException('non-nullable tx_check_inputs_loop_scan_outputkeys_get_item_size cannot be null'); + } + $this->container['tx_check_inputs_loop_scan_outputkeys_get_item_size'] = $tx_check_inputs_loop_scan_outputkeys_get_item_size; + + return $this; + } + + /** + * Gets tx_check_inputs_loop_scan_outputkeys_relative_to_absolute + * + * @return int|null + */ + public function getTxCheckInputsLoopScanOutputkeysRelativeToAbsolute(): ?int + { + return $this->container['tx_check_inputs_loop_scan_outputkeys_relative_to_absolute']; + } + + /** + * Sets tx_check_inputs_loop_scan_outputkeys_relative_to_absolute + * + * @param int|null $tx_check_inputs_loop_scan_outputkeys_relative_to_absolute tx_check_inputs_loop_scan_outputkeys_relative_to_absolute + * + * @return $this + */ + public function setTxCheckInputsLoopScanOutputkeysRelativeToAbsolute(?int $tx_check_inputs_loop_scan_outputkeys_relative_to_absolute): static + { + if (is_null($tx_check_inputs_loop_scan_outputkeys_relative_to_absolute)) { + throw new InvalidArgumentException('non-nullable tx_check_inputs_loop_scan_outputkeys_relative_to_absolute cannot be null'); + } + $this->container['tx_check_inputs_loop_scan_outputkeys_relative_to_absolute'] = $tx_check_inputs_loop_scan_outputkeys_relative_to_absolute; + + return $this; + } + + /** + * Gets tx_check_inputs_loop_scan_outputkeys_loop + * + * @return int|null + */ + public function getTxCheckInputsLoopScanOutputkeysLoop(): ?int + { + return $this->container['tx_check_inputs_loop_scan_outputkeys_loop']; + } + + /** + * Sets tx_check_inputs_loop_scan_outputkeys_loop + * + * @param int|null $tx_check_inputs_loop_scan_outputkeys_loop tx_check_inputs_loop_scan_outputkeys_loop + * + * @return $this + */ + public function setTxCheckInputsLoopScanOutputkeysLoop(?int $tx_check_inputs_loop_scan_outputkeys_loop): static + { + if (is_null($tx_check_inputs_loop_scan_outputkeys_loop)) { + throw new InvalidArgumentException('non-nullable tx_check_inputs_loop_scan_outputkeys_loop cannot be null'); + } + $this->container['tx_check_inputs_loop_scan_outputkeys_loop'] = $tx_check_inputs_loop_scan_outputkeys_loop; + + return $this; + } + + /** + * Gets tx_check_inputs_loop_scan_outputkeys_loop_get_subitem + * + * @return int|null + */ + public function getTxCheckInputsLoopScanOutputkeysLoopGetSubitem(): ?int + { + return $this->container['tx_check_inputs_loop_scan_outputkeys_loop_get_subitem']; + } + + /** + * Sets tx_check_inputs_loop_scan_outputkeys_loop_get_subitem + * + * @param int|null $tx_check_inputs_loop_scan_outputkeys_loop_get_subitem tx_check_inputs_loop_scan_outputkeys_loop_get_subitem + * + * @return $this + */ + public function setTxCheckInputsLoopScanOutputkeysLoopGetSubitem(?int $tx_check_inputs_loop_scan_outputkeys_loop_get_subitem): static + { + if (is_null($tx_check_inputs_loop_scan_outputkeys_loop_get_subitem)) { + throw new InvalidArgumentException('non-nullable tx_check_inputs_loop_scan_outputkeys_loop_get_subitem cannot be null'); + } + $this->container['tx_check_inputs_loop_scan_outputkeys_loop_get_subitem'] = $tx_check_inputs_loop_scan_outputkeys_loop_get_subitem; + + return $this; + } + + /** + * Gets tx_check_inputs_loop_scan_outputkeys_loop_find_tx + * + * @return int|null + */ + public function getTxCheckInputsLoopScanOutputkeysLoopFindTx(): ?int + { + return $this->container['tx_check_inputs_loop_scan_outputkeys_loop_find_tx']; + } + + /** + * Sets tx_check_inputs_loop_scan_outputkeys_loop_find_tx + * + * @param int|null $tx_check_inputs_loop_scan_outputkeys_loop_find_tx tx_check_inputs_loop_scan_outputkeys_loop_find_tx + * + * @return $this + */ + public function setTxCheckInputsLoopScanOutputkeysLoopFindTx(?int $tx_check_inputs_loop_scan_outputkeys_loop_find_tx): static + { + if (is_null($tx_check_inputs_loop_scan_outputkeys_loop_find_tx)) { + throw new InvalidArgumentException('non-nullable tx_check_inputs_loop_scan_outputkeys_loop_find_tx cannot be null'); + } + $this->container['tx_check_inputs_loop_scan_outputkeys_loop_find_tx'] = $tx_check_inputs_loop_scan_outputkeys_loop_find_tx; + + return $this; + } + + /** + * Gets tx_check_inputs_loop_scan_outputkeys_loop_handle_output + * + * @return int|null + */ + public function getTxCheckInputsLoopScanOutputkeysLoopHandleOutput(): ?int + { + return $this->container['tx_check_inputs_loop_scan_outputkeys_loop_handle_output']; + } + + /** + * Sets tx_check_inputs_loop_scan_outputkeys_loop_handle_output + * + * @param int|null $tx_check_inputs_loop_scan_outputkeys_loop_handle_output tx_check_inputs_loop_scan_outputkeys_loop_handle_output + * + * @return $this + */ + public function setTxCheckInputsLoopScanOutputkeysLoopHandleOutput(?int $tx_check_inputs_loop_scan_outputkeys_loop_handle_output): static + { + if (is_null($tx_check_inputs_loop_scan_outputkeys_loop_handle_output)) { + throw new InvalidArgumentException('non-nullable tx_check_inputs_loop_scan_outputkeys_loop_handle_output cannot be null'); + } + $this->container['tx_check_inputs_loop_scan_outputkeys_loop_handle_output'] = $tx_check_inputs_loop_scan_outputkeys_loop_handle_output; + + return $this; + } + + /** + * Gets tx_mixin_count + * + * @return int|null + */ + public function getTxMixinCount(): ?int + { + return $this->container['tx_mixin_count']; + } + + /** + * Sets tx_mixin_count + * + * @param int|null $tx_mixin_count tx_mixin_count + * + * @return $this + */ + public function setTxMixinCount(?int $tx_mixin_count): static + { + if (is_null($tx_mixin_count)) { + throw new InvalidArgumentException('non-nullable tx_mixin_count cannot be null'); + } + $this->container['tx_mixin_count'] = $tx_mixin_count; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists(mixed $offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[ReturnTypeWillChange] + public function offsetGet(mixed $offset): mixed + { + 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(mixed $offset, mixed $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(mixed $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(): mixed + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString(): string + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue(): string + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/utils/sdk/client/php/src/VersionModel.php b/utils/sdk/client/php/src/VersionModel.php new file mode 100644 index 00000000..8e2be451 --- /dev/null +++ b/utils/sdk/client/php/src/VersionModel.php @@ -0,0 +1,543 @@ + + */ +class VersionModel implements ModelInterface, ArrayAccess, JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = 'VersionModel'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPITypes = [ + 'version' => 'string', + 'version_long' => 'string', + 'major' => 'string', + 'minor' => 'string', + 'revision' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPIFormats = [ + 'version' => null, + 'version_long' => null, + 'major' => null, + 'minor' => null, + 'revision' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'version' => false, + 'version_long' => false, + 'major' => false, + 'minor' => false, + 'revision' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes(): array + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats(): array + { + 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 array + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param array $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 array + */ + protected static array $attributeMap = [ + 'version' => 'version', + 'version_long' => 'version_long', + 'major' => 'major', + 'minor' => 'minor', + 'revision' => 'revision' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var array + */ + protected static array $setters = [ + 'version' => 'setVersion', + 'version_long' => 'setVersionLong', + 'major' => 'setMajor', + 'minor' => 'setMinor', + 'revision' => 'setRevision' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var array + */ + protected static array $getters = [ + 'version' => 'getVersion', + 'version_long' => 'getVersionLong', + 'major' => 'getMajor', + 'minor' => 'getMinor', + 'revision' => 'getRevision' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap(): array + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters(): array + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters(): array + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName(): string + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var array + */ + protected array $container = []; + + /** + * Constructor + * + * @param array $data Associated array of property values initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('version', $data ?? [], null); + $this->setIfExists('version_long', $data ?? [], null); + $this->setIfExists('major', $data ?? [], null); + $this->setIfExists('minor', $data ?? [], null); + $this->setIfExists('revision', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, mixed $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 string[] invalid properties with reasons + */ + public function listInvalidProperties(): array + { + $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(): bool + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets version + * + * @return string|null + */ + public function getVersion(): ?string + { + return $this->container['version']; + } + + /** + * Sets version + * + * @param string|null $version version + * + * @return $this + */ + public function setVersion(?string $version): static + { + if (is_null($version)) { + throw new InvalidArgumentException('non-nullable version cannot be null'); + } + $this->container['version'] = $version; + + return $this; + } + + /** + * Gets version_long + * + * @return string|null + */ + public function getVersionLong(): ?string + { + return $this->container['version_long']; + } + + /** + * Sets version_long + * + * @param string|null $version_long version_long + * + * @return $this + */ + public function setVersionLong(?string $version_long): static + { + if (is_null($version_long)) { + throw new InvalidArgumentException('non-nullable version_long cannot be null'); + } + $this->container['version_long'] = $version_long; + + return $this; + } + + /** + * Gets major + * + * @return string|null + */ + public function getMajor(): ?string + { + return $this->container['major']; + } + + /** + * Sets major + * + * @param string|null $major major + * + * @return $this + */ + public function setMajor(?string $major): static + { + if (is_null($major)) { + throw new InvalidArgumentException('non-nullable major cannot be null'); + } + $this->container['major'] = $major; + + return $this; + } + + /** + * Gets minor + * + * @return string|null + */ + public function getMinor(): ?string + { + return $this->container['minor']; + } + + /** + * Sets minor + * + * @param string|null $minor minor + * + * @return $this + */ + public function setMinor(?string $minor): static + { + if (is_null($minor)) { + throw new InvalidArgumentException('non-nullable minor cannot be null'); + } + $this->container['minor'] = $minor; + + return $this; + } + + /** + * Gets revision + * + * @return string|null + */ + public function getRevision(): ?string + { + return $this->container['revision']; + } + + /** + * Sets revision + * + * @param string|null $revision revision + * + * @return $this + */ + public function setRevision(?string $revision): static + { + if (is_null($revision)) { + throw new InvalidArgumentException('non-nullable revision cannot be null'); + } + $this->container['revision'] = $revision; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists(mixed $offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[ReturnTypeWillChange] + public function offsetGet(mixed $offset): mixed + { + 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(mixed $offset, mixed $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(mixed $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(): mixed + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString(): string + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue(): string + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/utils/sdk/client/php/src/lthn/BlockApi.php b/utils/sdk/client/php/src/lthn/BlockApi.php new file mode 100644 index 00000000..fb488e22 --- /dev/null +++ b/utils/sdk/client/php/src/lthn/BlockApi.php @@ -0,0 +1,1549 @@ + [ + 'application/json', + ], + 'getBlock' => [ + 'application/json', + ], + 'getBlocks' => [ + 'application/json', + ], + 'getHeight' => [ + 'application/json', + ], + 'submitBlock' => [ + 'application/json', + ], + ]; + + /** + * @param ClientInterface|null $client + * @param Configuration|null $config + * @param HeaderSelector|null $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, + int $hostIndex = 0 + ) { + $this->client = $client ?: new Client(); + $this->config = $config ?: Configuration::getDefaultConfiguration(); + $this->headerSelector = $selector ?: new HeaderSelector(); + $this->hostIndex = $hostIndex; + } + + /** + * Set the host index + * + * @param int $hostIndex Host index (required) + */ + public function setHostIndex(int $hostIndex): void + { + $this->hostIndex = $hostIndex; + } + + /** + * Get the host index + * + * @return int Host index + */ + public function getHostIndex(): int + { + return $this->hostIndex; + } + + /** + * @return Configuration + */ + public function getConfig(): Configuration + { + return $this->config; + } + + /** + * Operation createBlockTemplate + * + * Create a block template for mining + * + * @param \OpenAPI\Client\Model\BlockTemplateRequestModel $block_template_request_model block_template_request_model (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createBlockTemplate'] to see the possible values for this operation + * + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return \OpenAPI\Client\Model\BlockTemplateModel + */ + public function createBlockTemplate( + \OpenAPI\Client\Model\BlockTemplateRequestModel $block_template_request_model, + string $contentType = self::contentTypes['createBlockTemplate'][0] + ): \OpenAPI\Client\Model\BlockTemplateModel + { + list($response) = $this->createBlockTemplateWithHttpInfo($block_template_request_model, $contentType); + return $response; + } + + /** + * Operation createBlockTemplateWithHttpInfo + * + * Create a block template for mining + * + * @param \OpenAPI\Client\Model\BlockTemplateRequestModel $block_template_request_model (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createBlockTemplate'] to see the possible values for this operation + * + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return array of |\OpenAPI\Client\Model\BlockTemplateModel, HTTP status code, HTTP response headers (array of strings) + */ + public function createBlockTemplateWithHttpInfo( + \OpenAPI\Client\Model\BlockTemplateRequestModel $block_template_request_model, + string $contentType = self::contentTypes['createBlockTemplate'][0] + ): array + { + $request = $this->createBlockTemplateRequest($block_template_request_model, $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(); + + switch($statusCode) { + case 200: + return $this->handleResponseWithDataType( + '\OpenAPI\Client\Model\BlockTemplateModel', + $request, + $response, + ); + } + + + 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 $this->handleResponseWithDataType( + '\OpenAPI\Client\Model\BlockTemplateModel', + $request, + $response, + ); + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\OpenAPI\Client\Model\BlockTemplateModel', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + } + + throw $e; + } + } + + /** + * Operation createBlockTemplateAsync + * + * Create a block template for mining + * + * @param \OpenAPI\Client\Model\BlockTemplateRequestModel $block_template_request_model (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createBlockTemplate'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return PromiseInterface + */ + public function createBlockTemplateAsync( + \OpenAPI\Client\Model\BlockTemplateRequestModel $block_template_request_model, + string $contentType = self::contentTypes['createBlockTemplate'][0] + ): PromiseInterface + { + return $this->createBlockTemplateAsyncWithHttpInfo($block_template_request_model, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation createBlockTemplateAsyncWithHttpInfo + * + * Create a block template for mining + * + * @param \OpenAPI\Client\Model\BlockTemplateRequestModel $block_template_request_model (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createBlockTemplate'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return PromiseInterface + */ + public function createBlockTemplateAsyncWithHttpInfo( + \OpenAPI\Client\Model\BlockTemplateRequestModel $block_template_request_model, + string $contentType = self::contentTypes['createBlockTemplate'][0] + ): PromiseInterface + { + $returnType = '\OpenAPI\Client\Model\BlockTemplateModel'; + $request = $this->createBlockTemplateRequest($block_template_request_model, $contentType); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $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 'createBlockTemplate' + * + * @param \OpenAPI\Client\Model\BlockTemplateRequestModel $block_template_request_model (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createBlockTemplate'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function createBlockTemplateRequest( + \OpenAPI\Client\Model\BlockTemplateRequestModel $block_template_request_model, + string $contentType = self::contentTypes['createBlockTemplate'][0] + ): Request + { + + // verify the required parameter 'block_template_request_model' is set + if ($block_template_request_model === null || (is_array($block_template_request_model) && count($block_template_request_model) === 0)) { + throw new InvalidArgumentException( + 'Missing the required parameter $block_template_request_model when calling createBlockTemplate' + ); + } + + + $resourcePath = '/block/template'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + + + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (isset($block_template_request_model)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($block_template_request_model)); + } else { + $httpBody = $block_template_request_model; + } + } 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 + ); + } + + /** + * Operation getBlock + * + * Get a block by its hash or height (ID) + * + * @param string $identifier The hash (hex string) or height (integer) of the block to retrieve. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getBlock'] to see the possible values for this operation + * + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return \OpenAPI\Client\Model\BlockDetailsModel + */ + public function getBlock( + string $identifier, + string $contentType = self::contentTypes['getBlock'][0] + ): \OpenAPI\Client\Model\BlockDetailsModel + { + list($response) = $this->getBlockWithHttpInfo($identifier, $contentType); + return $response; + } + + /** + * Operation getBlockWithHttpInfo + * + * Get a block by its hash or height (ID) + * + * @param string $identifier The hash (hex string) or height (integer) of the block to retrieve. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getBlock'] to see the possible values for this operation + * + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return array of |\OpenAPI\Client\Model\BlockDetailsModel, HTTP status code, HTTP response headers (array of strings) + */ + public function getBlockWithHttpInfo( + string $identifier, + string $contentType = self::contentTypes['getBlock'][0] + ): array + { + $request = $this->getBlockRequest($identifier, $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(); + + switch($statusCode) { + case 200: + return $this->handleResponseWithDataType( + '\OpenAPI\Client\Model\BlockDetailsModel', + $request, + $response, + ); + } + + + 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 $this->handleResponseWithDataType( + '\OpenAPI\Client\Model\BlockDetailsModel', + $request, + $response, + ); + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\OpenAPI\Client\Model\BlockDetailsModel', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + } + + throw $e; + } + } + + /** + * Operation getBlockAsync + * + * Get a block by its hash or height (ID) + * + * @param string $identifier The hash (hex string) or height (integer) of the block to retrieve. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getBlock'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return PromiseInterface + */ + public function getBlockAsync( + string $identifier, + string $contentType = self::contentTypes['getBlock'][0] + ): PromiseInterface + { + return $this->getBlockAsyncWithHttpInfo($identifier, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation getBlockAsyncWithHttpInfo + * + * Get a block by its hash or height (ID) + * + * @param string $identifier The hash (hex string) or height (integer) of the block to retrieve. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getBlock'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return PromiseInterface + */ + public function getBlockAsyncWithHttpInfo( + string $identifier, + string $contentType = self::contentTypes['getBlock'][0] + ): PromiseInterface + { + $returnType = '\OpenAPI\Client\Model\BlockDetailsModel'; + $request = $this->getBlockRequest($identifier, $contentType); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $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 'getBlock' + * + * @param string $identifier The hash (hex string) or height (integer) of the block to retrieve. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getBlock'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function getBlockRequest( + string $identifier, + string $contentType = self::contentTypes['getBlock'][0] + ): Request + { + + // verify the required parameter 'identifier' is set + if ($identifier === null || (is_array($identifier) && count($identifier) === 0)) { + throw new InvalidArgumentException( + 'Missing the required parameter $identifier when calling getBlock' + ); + } + + + $resourcePath = '/block/{identifier}'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + // path params + if ($identifier !== null) { + $resourcePath = str_replace( + '{' . 'identifier' . '}', + ObjectSerializer::toPathValue($identifier), + $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 getBlocks + * + * Get one or more blocks, with optional pagination. + * + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getBlocks'] to see the possible values for this operation + * + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return \OpenAPI\Client\Model\BlockDetailsModel[] + */ + public function getBlocks( + string $contentType = self::contentTypes['getBlocks'][0] + ): array + { + list($response) = $this->getBlocksWithHttpInfo($contentType); + return $response; + } + + /** + * Operation getBlocksWithHttpInfo + * + * Get one or more blocks, with optional pagination. + * + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getBlocks'] to see the possible values for this operation + * + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return array of |\OpenAPI\Client\Model\BlockDetailsModel[], HTTP status code, HTTP response headers (array of strings) + */ + public function getBlocksWithHttpInfo( + string $contentType = self::contentTypes['getBlocks'][0] + ): array + { + $request = $this->getBlocksRequest($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(); + + switch($statusCode) { + case 200: + return $this->handleResponseWithDataType( + '\OpenAPI\Client\Model\BlockDetailsModel[]', + $request, + $response, + ); + } + + + 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 $this->handleResponseWithDataType( + '\OpenAPI\Client\Model\BlockDetailsModel[]', + $request, + $response, + ); + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\OpenAPI\Client\Model\BlockDetailsModel[]', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + } + + throw $e; + } + } + + /** + * Operation getBlocksAsync + * + * Get one or more blocks, with optional pagination. + * + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getBlocks'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return PromiseInterface + */ + public function getBlocksAsync( + string $contentType = self::contentTypes['getBlocks'][0] + ): PromiseInterface + { + return $this->getBlocksAsyncWithHttpInfo($contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation getBlocksAsyncWithHttpInfo + * + * Get one or more blocks, with optional pagination. + * + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getBlocks'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return PromiseInterface + */ + public function getBlocksAsyncWithHttpInfo( + string $contentType = self::contentTypes['getBlocks'][0] + ): PromiseInterface + { + $returnType = '\OpenAPI\Client\Model\BlockDetailsModel[]'; + $request = $this->getBlocksRequest($contentType); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $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 'getBlocks' + * + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getBlocks'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function getBlocksRequest( + string $contentType = self::contentTypes['getBlocks'][0] + ): Request + { + + + $resourcePath = '/block'; + $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 + ); + } + + /** + * Operation getHeight + * + * Get the current blockchain height + * + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getHeight'] to see the possible values for this operation + * + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return \OpenAPI\Client\Model\HeightModel + */ + public function getHeight( + string $contentType = self::contentTypes['getHeight'][0] + ): \OpenAPI\Client\Model\HeightModel + { + list($response) = $this->getHeightWithHttpInfo($contentType); + return $response; + } + + /** + * Operation getHeightWithHttpInfo + * + * Get the current blockchain height + * + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getHeight'] to see the possible values for this operation + * + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return array of \OpenAPI\Client\Model\HeightModel, HTTP status code, HTTP response headers (array of strings) + */ + public function getHeightWithHttpInfo( + string $contentType = self::contentTypes['getHeight'][0] + ): array + { + $request = $this->getHeightRequest($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(); + + switch($statusCode) { + case 200: + return $this->handleResponseWithDataType( + '\OpenAPI\Client\Model\HeightModel', + $request, + $response, + ); + } + + + 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 $this->handleResponseWithDataType( + '\OpenAPI\Client\Model\HeightModel', + $request, + $response, + ); + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\OpenAPI\Client\Model\HeightModel', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + } + + throw $e; + } + } + + /** + * Operation getHeightAsync + * + * Get the current blockchain height + * + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getHeight'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return PromiseInterface + */ + public function getHeightAsync( + string $contentType = self::contentTypes['getHeight'][0] + ): PromiseInterface + { + return $this->getHeightAsyncWithHttpInfo($contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation getHeightAsyncWithHttpInfo + * + * Get the current blockchain height + * + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getHeight'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return PromiseInterface + */ + public function getHeightAsyncWithHttpInfo( + string $contentType = self::contentTypes['getHeight'][0] + ): PromiseInterface + { + $returnType = '\OpenAPI\Client\Model\HeightModel'; + $request = $this->getHeightRequest($contentType); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $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 'getHeight' + * + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getHeight'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function getHeightRequest( + string $contentType = self::contentTypes['getHeight'][0] + ): Request + { + + + $resourcePath = '/block/height'; + $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 + ); + } + + /** + * Operation submitBlock + * + * Submit a new block to the network + * + * @param \OpenAPI\Client\Model\SubmitBlockRequestModel $submit_block_request_model submit_block_request_model (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['submitBlock'] to see the possible values for this operation + * + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return \OpenAPI\Client\Model\SubmitBlockResponseModel + */ + public function submitBlock( + \OpenAPI\Client\Model\SubmitBlockRequestModel $submit_block_request_model, + string $contentType = self::contentTypes['submitBlock'][0] + ): \OpenAPI\Client\Model\SubmitBlockResponseModel + { + list($response) = $this->submitBlockWithHttpInfo($submit_block_request_model, $contentType); + return $response; + } + + /** + * Operation submitBlockWithHttpInfo + * + * Submit a new block to the network + * + * @param \OpenAPI\Client\Model\SubmitBlockRequestModel $submit_block_request_model (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['submitBlock'] to see the possible values for this operation + * + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return array of |\OpenAPI\Client\Model\SubmitBlockResponseModel, HTTP status code, HTTP response headers (array of strings) + */ + public function submitBlockWithHttpInfo( + \OpenAPI\Client\Model\SubmitBlockRequestModel $submit_block_request_model, + string $contentType = self::contentTypes['submitBlock'][0] + ): array + { + $request = $this->submitBlockRequest($submit_block_request_model, $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(); + + switch($statusCode) { + case 200: + return $this->handleResponseWithDataType( + '\OpenAPI\Client\Model\SubmitBlockResponseModel', + $request, + $response, + ); + } + + + 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 $this->handleResponseWithDataType( + '\OpenAPI\Client\Model\SubmitBlockResponseModel', + $request, + $response, + ); + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\OpenAPI\Client\Model\SubmitBlockResponseModel', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + } + + throw $e; + } + } + + /** + * Operation submitBlockAsync + * + * Submit a new block to the network + * + * @param \OpenAPI\Client\Model\SubmitBlockRequestModel $submit_block_request_model (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['submitBlock'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return PromiseInterface + */ + public function submitBlockAsync( + \OpenAPI\Client\Model\SubmitBlockRequestModel $submit_block_request_model, + string $contentType = self::contentTypes['submitBlock'][0] + ): PromiseInterface + { + return $this->submitBlockAsyncWithHttpInfo($submit_block_request_model, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation submitBlockAsyncWithHttpInfo + * + * Submit a new block to the network + * + * @param \OpenAPI\Client\Model\SubmitBlockRequestModel $submit_block_request_model (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['submitBlock'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return PromiseInterface + */ + public function submitBlockAsyncWithHttpInfo( + \OpenAPI\Client\Model\SubmitBlockRequestModel $submit_block_request_model, + string $contentType = self::contentTypes['submitBlock'][0] + ): PromiseInterface + { + $returnType = '\OpenAPI\Client\Model\SubmitBlockResponseModel'; + $request = $this->submitBlockRequest($submit_block_request_model, $contentType); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $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 'submitBlock' + * + * @param \OpenAPI\Client\Model\SubmitBlockRequestModel $submit_block_request_model (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['submitBlock'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function submitBlockRequest( + \OpenAPI\Client\Model\SubmitBlockRequestModel $submit_block_request_model, + string $contentType = self::contentTypes['submitBlock'][0] + ): Request + { + + // verify the required parameter 'submit_block_request_model' is set + if ($submit_block_request_model === null || (is_array($submit_block_request_model) && count($submit_block_request_model) === 0)) { + throw new InvalidArgumentException( + 'Missing the required parameter $submit_block_request_model when calling submitBlock' + ); + } + + + $resourcePath = '/block/submit'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + + + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (isset($submit_block_request_model)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($submit_block_request_model)); + } else { + $httpBody = $submit_block_request_model; + } + } 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(): array + { + $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; + } + + private function handleResponseWithDataType( + string $dataType, + RequestInterface $request, + ResponseInterface $response, + ): array { + if (in_array($dataType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($dataType !== '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() + ), + $response->getStatusCode(), + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, $dataType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + private function responseWithinRangeCode( + string $rangeCode, + int $statusCode, + ): bool { + $left = (int) ($rangeCode[0].'00'); + $right = (int) ($rangeCode[0].'99'); + + return $statusCode >= $left && $statusCode <= $right; + } +} diff --git a/utils/sdk/client/php/src/lthn/InfoApi.php b/utils/sdk/client/php/src/lthn/InfoApi.php new file mode 100644 index 00000000..efb7b5d1 --- /dev/null +++ b/utils/sdk/client/php/src/lthn/InfoApi.php @@ -0,0 +1,722 @@ + [ + 'application/json', + ], + 'version' => [ + 'application/json', + ], + ]; + + /** + * @param ClientInterface|null $client + * @param Configuration|null $config + * @param HeaderSelector|null $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, + int $hostIndex = 0 + ) { + $this->client = $client ?: new Client(); + $this->config = $config ?: Configuration::getDefaultConfiguration(); + $this->headerSelector = $selector ?: new HeaderSelector(); + $this->hostIndex = $hostIndex; + } + + /** + * Set the host index + * + * @param int $hostIndex Host index (required) + */ + public function setHostIndex(int $hostIndex): void + { + $this->hostIndex = $hostIndex; + } + + /** + * Get the host index + * + * @return int Host index + */ + public function getHostIndex(): int + { + return $this->hostIndex; + } + + /** + * @return Configuration + */ + public function getConfig(): Configuration + { + return $this->config; + } + + /** + * Operation getInfo + * + * Get detailed information about the blockchain and daemon state + * + * @param string|null $flags Possible values: net_time_delta_median, current_network_hashrate_50, current_network_hashrate_350, seconds_for_10_blocks, seconds_for_30_blocks, transactions_daily_stat, last_pos_timestamp, last_pow_timestamp, total_coins, last_block_size, tx_count_in_last_block, pos_sequence_factor, pow_sequence_factor, pos_difficulty, performance, outs_stat, expirations_median. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getInfo'] to see the possible values for this operation + * + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return \OpenAPI\Client\Model\InfoModel + */ + public function getInfo( + ?string $flags = null, + string $contentType = self::contentTypes['getInfo'][0] + ): \OpenAPI\Client\Model\InfoModel + { + list($response) = $this->getInfoWithHttpInfo($flags, $contentType); + return $response; + } + + /** + * Operation getInfoWithHttpInfo + * + * Get detailed information about the blockchain and daemon state + * + * @param string|null $flags Possible values: net_time_delta_median, current_network_hashrate_50, current_network_hashrate_350, seconds_for_10_blocks, seconds_for_30_blocks, transactions_daily_stat, last_pos_timestamp, last_pow_timestamp, total_coins, last_block_size, tx_count_in_last_block, pos_sequence_factor, pow_sequence_factor, pos_difficulty, performance, outs_stat, expirations_median. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getInfo'] to see the possible values for this operation + * + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return array of \OpenAPI\Client\Model\InfoModel, HTTP status code, HTTP response headers (array of strings) + */ + public function getInfoWithHttpInfo( + ?string $flags = null, + string $contentType = self::contentTypes['getInfo'][0] + ): array + { + $request = $this->getInfoRequest($flags, $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(); + + switch($statusCode) { + case 200: + return $this->handleResponseWithDataType( + '\OpenAPI\Client\Model\InfoModel', + $request, + $response, + ); + } + + + 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 $this->handleResponseWithDataType( + '\OpenAPI\Client\Model\InfoModel', + $request, + $response, + ); + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\OpenAPI\Client\Model\InfoModel', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + } + + throw $e; + } + } + + /** + * Operation getInfoAsync + * + * Get detailed information about the blockchain and daemon state + * + * @param string|null $flags Possible values: net_time_delta_median, current_network_hashrate_50, current_network_hashrate_350, seconds_for_10_blocks, seconds_for_30_blocks, transactions_daily_stat, last_pos_timestamp, last_pow_timestamp, total_coins, last_block_size, tx_count_in_last_block, pos_sequence_factor, pow_sequence_factor, pos_difficulty, performance, outs_stat, expirations_median. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getInfo'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return PromiseInterface + */ + public function getInfoAsync( + ?string $flags = null, + string $contentType = self::contentTypes['getInfo'][0] + ): PromiseInterface + { + return $this->getInfoAsyncWithHttpInfo($flags, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation getInfoAsyncWithHttpInfo + * + * Get detailed information about the blockchain and daemon state + * + * @param string|null $flags Possible values: net_time_delta_median, current_network_hashrate_50, current_network_hashrate_350, seconds_for_10_blocks, seconds_for_30_blocks, transactions_daily_stat, last_pos_timestamp, last_pow_timestamp, total_coins, last_block_size, tx_count_in_last_block, pos_sequence_factor, pow_sequence_factor, pos_difficulty, performance, outs_stat, expirations_median. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getInfo'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return PromiseInterface + */ + public function getInfoAsyncWithHttpInfo( + ?string $flags = null, + string $contentType = self::contentTypes['getInfo'][0] + ): PromiseInterface + { + $returnType = '\OpenAPI\Client\Model\InfoModel'; + $request = $this->getInfoRequest($flags, $contentType); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $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 'getInfo' + * + * @param string|null $flags Possible values: net_time_delta_median, current_network_hashrate_50, current_network_hashrate_350, seconds_for_10_blocks, seconds_for_30_blocks, transactions_daily_stat, last_pos_timestamp, last_pow_timestamp, total_coins, last_block_size, tx_count_in_last_block, pos_sequence_factor, pow_sequence_factor, pos_difficulty, performance, outs_stat, expirations_median. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getInfo'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function getInfoRequest( + ?string $flags = null, + string $contentType = self::contentTypes['getInfo'][0] + ): Request + { + + + + $resourcePath = '/info'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $flags, + 'flags', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + + + + + $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 version + * + * Get API version + * + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['version'] to see the possible values for this operation + * + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return \OpenAPI\Client\Model\VersionModel + */ + public function version( + string $contentType = self::contentTypes['version'][0] + ): \OpenAPI\Client\Model\VersionModel + { + list($response) = $this->versionWithHttpInfo($contentType); + return $response; + } + + /** + * Operation versionWithHttpInfo + * + * Get API version + * + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['version'] to see the possible values for this operation + * + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return array of \OpenAPI\Client\Model\VersionModel, HTTP status code, HTTP response headers (array of strings) + */ + public function versionWithHttpInfo( + string $contentType = self::contentTypes['version'][0] + ): array + { + $request = $this->versionRequest($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(); + + switch($statusCode) { + case 200: + return $this->handleResponseWithDataType( + '\OpenAPI\Client\Model\VersionModel', + $request, + $response, + ); + } + + + 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 $this->handleResponseWithDataType( + '\OpenAPI\Client\Model\VersionModel', + $request, + $response, + ); + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\OpenAPI\Client\Model\VersionModel', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + } + + throw $e; + } + } + + /** + * Operation versionAsync + * + * Get API version + * + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['version'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return PromiseInterface + */ + public function versionAsync( + string $contentType = self::contentTypes['version'][0] + ): PromiseInterface + { + return $this->versionAsyncWithHttpInfo($contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation versionAsyncWithHttpInfo + * + * Get API version + * + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['version'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return PromiseInterface + */ + public function versionAsyncWithHttpInfo( + string $contentType = self::contentTypes['version'][0] + ): PromiseInterface + { + $returnType = '\OpenAPI\Client\Model\VersionModel'; + $request = $this->versionRequest($contentType); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $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 'version' + * + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['version'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function versionRequest( + string $contentType = self::contentTypes['version'][0] + ): Request + { + + + $resourcePath = '/info/version'; + $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(): array + { + $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; + } + + private function handleResponseWithDataType( + string $dataType, + RequestInterface $request, + ResponseInterface $response, + ): array { + if (in_array($dataType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($dataType !== '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() + ), + $response->getStatusCode(), + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, $dataType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + private function responseWithinRangeCode( + string $rangeCode, + int $statusCode, + ): bool { + $left = (int) ($rangeCode[0].'00'); + $right = (int) ($rangeCode[0].'99'); + + return $statusCode >= $left && $statusCode <= $right; + } +} diff --git a/utils/sdk/client/php/tests/Api/BlockApiTest.php b/utils/sdk/client/php/tests/Api/BlockApiTest.php new file mode 100644 index 00000000..eeb84752 --- /dev/null +++ b/utils/sdk/client/php/tests/Api/BlockApiTest.php @@ -0,0 +1,131 @@ +